How to use the fabric-shim.Shim.success function in fabric-shim

To help you get started, we’ve selected a few fabric-shim examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hyperledger / fabric-chaincode-node / test / typescript / chaincode.ts View on Github external
const strArgs: string[] = stub.getStringArgs();
        const {fcn, params} =  stub.getFunctionAndParameters();
        const FunctionsAndParameters: {fcn: string, params: string[]} =  stub.getFunctionAndParameters();

        if (fcn === 'ThrowError') {
            const err: Error = new Error('Had a problem');
            return shim.error(Buffer.from(err.message));
        }

        if (fcn === 'ThrowErrorShim') {
            const err: Error = new Error('Had a problem');
            return Shim.error(Buffer.from(err.message));
        }

        if (fcn === 'SuccessShim') {
            return Shim.success();
        }

        await this.testAll(stub);

        if (fcn === 'nopayload') {
            return shim.success();
        }

        if (fcn === 'myReturnCode') {
            let rc: number;
            rc = ChaincodeStub.RESPONSE_CODE.OK;
            rc = shim.RESPONSE_CODE.OK;
            rc = ChaincodeStub.RESPONSE_CODE.ERRORTHRESHOLD;
            rc = shim.RESPONSE_CODE.ERRORTHRESHOLD;
            rc = ChaincodeStub.RESPONSE_CODE.ERROR;
            rc = shim.RESPONSE_CODE.ERROR;
github IBM-Blockchain / generator-fabric / generators / chaincode / templates / javascript / lib / chaincode.js View on Github external
async Init(stub) {
        const { fcn, params } = stub.getFunctionAndParameters();
        console.info('Init()', fcn, params);
        return Shim.success();
    }
github IBM-Blockchain / generator-fabric / generators / chaincode / templates / typescript / src / chaincode.ts View on Github external
public async Init(stub: ChaincodeStub): Promise {
        const { fcn, params } = stub.getFunctionAndParameters();
        console.info('Init()', fcn, params);
        return Shim.success();
    }
github IBM-Blockchain / generator-fabric / generators / chaincode / templates / typescript / src / chaincode.ts View on Github external
public async Invoke(stub: ChaincodeStub): Promise {
        const { fcn, params } = stub.getFunctionAndParameters();
        console.info('Invoke()', fcn, params);
        return Shim.success();
    }
github IBM-Blockchain / generator-fabric / generators / chaincode / templates / javascript / lib / chaincode.js View on Github external
async Invoke(stub) {
        const { fcn, params } = stub.getFunctionAndParameters();
        console.info('Invoke()', fcn, params);
        return Shim.success();
    }