How to use the fabric-contract-api.Context function in fabric-contract-api

To help you get started, we’ve selected a few fabric-contract-api 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 ampretia / fabric-application-examples / contracts / trade-ts / dist / lifecyclecontract.js View on Github external
* @param {Context} ctx the transaction context
     */
    async instantiate(ctx) {
        console.log('Instantiate the contract');
        const mgt = new commoditymgt_1.CommodityManagementContract();
        await mgt.setCommodityDescription(ctx, 'au', 'GOLD');
        await mgt.setCommodityDescription(ctx, 'ag', 'SILVER');
        await mgt.setCommodityDescription(ctx, 'fe', 'IRON');
        await mgt.setCommodityDescription(ctx, 'al', 'ALUMINIUM');
        // need to call the commodity management to establish the trading symbol description mapping
    }
}
__decorate([
    fabric_contract_api_1.Transaction(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [fabric_contract_api_1.Context]),
    __metadata("design:returntype", Promise)
], LifecycleContract.prototype, "instantiate", null);
exports.LifecycleContract = LifecycleContract;