@firmachain/firma-js 0.2.64 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -8
- package/dist/sdk/FirmaAuthzService.js +12 -6
- package/dist/sdk/FirmaBankService.d.ts +4 -4
- package/dist/sdk/FirmaContractService.d.ts +4 -4
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +14 -14
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
- package/dist/sdk/FirmaCosmWasmService.js +2 -3
- package/dist/sdk/FirmaDistributionService.d.ts +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
- package/dist/sdk/FirmaGovService.d.ts +27 -16
- package/dist/sdk/FirmaGovService.js +305 -195
- package/dist/sdk/FirmaIbcService.d.ts +3 -4
- package/dist/sdk/FirmaIbcService.js +5 -2
- package/dist/sdk/FirmaNftService.d.ts +5 -5
- package/dist/sdk/FirmaStakingService.d.ts +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +5 -5
- package/dist/sdk/FirmaUtil.d.ts +1 -1
- package/dist/sdk/FirmaUtil.js +12 -14
- package/dist/sdk/firmachain/amino/addresses.js +1 -1
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
- package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
- package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
- package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
- package/dist/sdk/firmachain/amino/coins.js +26 -5
- package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
- package/dist/sdk/firmachain/amino/encoding.js +21 -3
- package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
- package/dist/sdk/firmachain/amino/signdoc.js +37 -11
- package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
- package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
- package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
- package/dist/sdk/firmachain/common/ITxClient.js +82 -24
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
- package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
- package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
- package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
- package/dist/sdk/firmachain/common/accounts.js +28 -33
- package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
- package/dist/sdk/firmachain/common/aminotypes.js +74 -0
- package/dist/sdk/firmachain/common/events.d.ts +32 -0
- package/dist/sdk/firmachain/common/events.js +18 -0
- package/dist/sdk/firmachain/common/fee.d.ts +26 -0
- package/dist/sdk/firmachain/common/fee.js +83 -0
- package/dist/sdk/firmachain/common/index.d.ts +1 -0
- package/dist/sdk/firmachain/common/index.js +3 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
- package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
- package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
- package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
- package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
- package/dist/sdk/firmachain/common/modules/index.js +101 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
- package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
- package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
- package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
- package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
- package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
- package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
- package/dist/sdk/firmachain/common/search.d.ts +10 -0
- package/dist/sdk/firmachain/common/search.js +7 -0
- package/dist/sdk/firmachain/common/signing.d.ts +8 -3
- package/dist/sdk/firmachain/common/signing.js +24 -12
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
- package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
- package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
- package/dist/sdk/firmachain/common/stargateclient.js +351 -35
- package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
- package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +13 -1
- package/dist/sdk/firmachain/gov/GovQueryClient.js +9 -2
- package/dist/sdk/firmachain/gov/GovTxClient.d.ts +12 -0
- package/dist/sdk/firmachain/gov/GovTxClient.js +11 -1
- package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
- package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -0
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
- package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
- package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
- package/dist/test/00.wallet.test.js +15 -9
- package/dist/test/01.contract_tx.test.js +53 -45
- package/dist/test/02.contract_query.test.js +54 -31
- package/dist/test/03.contract_scenario.test.js +170 -326
- package/dist/test/04.bank_tx.test.js +58 -59
- package/dist/test/05.bank_query.test.js +51 -56
- package/dist/test/06.feegrant_tx.test.js +74 -89
- package/dist/test/07.feegrant_query.test.js +69 -27
- package/dist/test/08.gas_estimate.test.js +422 -392
- package/dist/test/09.ipfs.test.js +3 -3
- package/dist/test/10.nft_tx.test.js +108 -76
- package/dist/test/11.nft_query.test.js +41 -46
- package/dist/test/12.staking_tx.test.js +81 -98
- package/dist/test/13.staking_query.test.js +66 -12
- package/dist/test/14.distribution_tx.test.js +69 -78
- package/dist/test/15.distribution_query.test.js +81 -57
- package/dist/test/16.gov_tx.test.js +247 -107
- package/dist/test/17.gov_query.test.js +48 -9
- package/dist/test/18.util.test.js +6 -1
- package/dist/test/19.chain.test.js +50 -4
- package/dist/test/20.slashing_query.test.js +31 -1
- package/dist/test/21.token_tx.test.js +48 -56
- package/dist/test/22.token_query.test.js +24 -20
- package/dist/test/23.authz_tx.test.js +119 -240
- package/dist/test/24.authz_query.test.js +116 -56
- package/dist/test/25.cosmwasm_tx.test.js +95 -57
- package/dist/test/26.cosmwasm_query.test.js +66 -26
- package/dist/test/27.arbitary_sign.test.js +59 -67
- package/dist/test/28.ibc_tx.test.js +29 -17
- package/dist/test/29.mint_query.test.js +2 -0
- package/dist/test/30.cw20_tx.test.js +161 -226
- package/dist/test/31.cw20_query.test.js +183 -37
- package/dist/test/32.cw721_tx.test.js +147 -149
- package/dist/test/33.cw721_query.test.js +188 -36
- package/dist/test/34.cw_bridge_tx.test.js +266 -155
- package/dist/test/35.cw_bridge_tx_low.test.js +221 -81
- package/dist/test/36.cw_bridge_query.test.js +157 -21
- package/dist/test/37.cw_marketplace_tx.test.js +22 -22
- package/dist/test/38.cw_marketplace_query.test.js +9 -9
- package/dist/test/config_test.d.ts +10 -4
- package/dist/test/config_test.js +16 -9
- package/dist/test/config_test.sample.d.ts +11 -0
- package/dist/test/config_test.sample.js +14 -0
- package/package.json +9 -7
- package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
- package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
|
@@ -35,29 +35,72 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
+
var __values = (this && this.__values) || function(o) {
|
|
39
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
40
|
+
if (m) return m.call(o);
|
|
41
|
+
if (o && typeof o.length === "number") return {
|
|
42
|
+
next: function () {
|
|
43
|
+
if (o && i >= o.length) o = void 0;
|
|
44
|
+
return { value: o && o[i++], done: !o };
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
48
|
+
};
|
|
38
49
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
50
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
51
|
};
|
|
41
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var FirmaConfig_1 = require("../sdk/FirmaConfig");
|
|
43
|
-
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
44
53
|
var chai_1 = require("chai");
|
|
45
|
-
var config_test_1 = require("./config_test");
|
|
46
|
-
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
47
54
|
var fs_1 = __importDefault(require("fs"));
|
|
55
|
+
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
56
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
48
57
|
var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
|
|
58
|
+
var config_test_1 = require("./config_test");
|
|
49
59
|
describe('[30. cw20 tx Test]', function () {
|
|
50
60
|
var firma;
|
|
51
61
|
var aliceWallet;
|
|
52
62
|
var bobWallet;
|
|
53
63
|
var aliceAddress;
|
|
54
64
|
var bobAddress;
|
|
65
|
+
var extractValue = function (events, eventType, attrKey) {
|
|
66
|
+
var e_1, _a, e_2, _b;
|
|
67
|
+
try {
|
|
68
|
+
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
69
|
+
var event_1 = events_1_1.value;
|
|
70
|
+
if (event_1.type === eventType) {
|
|
71
|
+
try {
|
|
72
|
+
for (var _c = (e_2 = void 0, __values(event_1.attributes)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
73
|
+
var attr = _d.value;
|
|
74
|
+
if (attr.key === attrKey) {
|
|
75
|
+
return attr.value;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
80
|
+
finally {
|
|
81
|
+
try {
|
|
82
|
+
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
83
|
+
}
|
|
84
|
+
finally { if (e_2) throw e_2.error; }
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
90
|
+
finally {
|
|
91
|
+
try {
|
|
92
|
+
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
93
|
+
}
|
|
94
|
+
finally { if (e_1) throw e_1.error; }
|
|
95
|
+
}
|
|
96
|
+
return "";
|
|
97
|
+
};
|
|
55
98
|
beforeEach(function () {
|
|
56
99
|
return __awaiter(this, void 0, void 0, function () {
|
|
57
100
|
return __generator(this, function (_a) {
|
|
58
101
|
switch (_a.label) {
|
|
59
102
|
case 0:
|
|
60
|
-
firma = new FirmaSDK_1.FirmaSDK(
|
|
103
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
61
104
|
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
62
105
|
case 1:
|
|
63
106
|
aliceWallet = _a.sent();
|
|
@@ -77,8 +120,8 @@ describe('[30. cw20 tx Test]', function () {
|
|
|
77
120
|
});
|
|
78
121
|
var contractAddress = "";
|
|
79
122
|
var codeId = "";
|
|
80
|
-
it
|
|
81
|
-
var wasmFile, array, gas, fee, everyBodyAccessConfig, result
|
|
123
|
+
it('CosmWasm Cw20 StoreCode', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var wasmFile, array, gas, fee, everyBodyAccessConfig, result;
|
|
82
125
|
return __generator(this, function (_a) {
|
|
83
126
|
switch (_a.label) {
|
|
84
127
|
case 0:
|
|
@@ -86,24 +129,26 @@ describe('[30. cw20 tx Test]', function () {
|
|
|
86
129
|
array = new Uint8Array(wasmFile.buffer);
|
|
87
130
|
gas = 3000000;
|
|
88
131
|
fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
89
|
-
everyBodyAccessConfig = {
|
|
132
|
+
everyBodyAccessConfig = {
|
|
133
|
+
permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
|
|
134
|
+
address: "",
|
|
135
|
+
addresses: []
|
|
136
|
+
};
|
|
90
137
|
return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: gas, fee: fee })];
|
|
91
138
|
case 1:
|
|
92
139
|
result = _a.sent();
|
|
93
|
-
|
|
94
|
-
codeId = data[0]["events"][1]["attributes"][1]["value"];
|
|
140
|
+
codeId = extractValue(result.events, "store_code", "code_id");
|
|
95
141
|
chai_1.expect(result.code).to.be.equal(0);
|
|
96
142
|
return [2 /*return*/];
|
|
97
143
|
}
|
|
98
144
|
});
|
|
99
145
|
}); });
|
|
100
|
-
it
|
|
101
|
-
var admin, label, gas, fee, noFunds, testData, result
|
|
146
|
+
it('CosmWasm Cw20 InstantiateContract', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
147
|
+
var admin, label, gas, fee, noFunds, testData, result;
|
|
102
148
|
return __generator(this, function (_a) {
|
|
103
149
|
switch (_a.label) {
|
|
104
|
-
case 0:
|
|
105
|
-
|
|
106
|
-
admin = _a.sent();
|
|
150
|
+
case 0:
|
|
151
|
+
admin = aliceAddress;
|
|
107
152
|
label = "test1";
|
|
108
153
|
gas = 3000000;
|
|
109
154
|
fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
|
|
@@ -134,256 +179,167 @@ describe('[30. cw20 tx Test]', function () {
|
|
|
134
179
|
}
|
|
135
180
|
});
|
|
136
181
|
return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: gas, fee: fee })];
|
|
137
|
-
case
|
|
182
|
+
case 1:
|
|
138
183
|
result = _a.sent();
|
|
139
|
-
|
|
140
|
-
contractAddress = data[0]["events"][0]["attributes"][0]["value"];
|
|
184
|
+
contractAddress = extractValue(result.events, "instantiate", "_contract_address");
|
|
141
185
|
chai_1.expect(result.code).to.be.equal(0);
|
|
142
186
|
return [2 /*return*/];
|
|
143
187
|
}
|
|
144
188
|
});
|
|
145
189
|
}); });
|
|
146
|
-
it
|
|
147
|
-
var
|
|
190
|
+
it('Cw20 transfer', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
191
|
+
var amount, gas, fee, result;
|
|
148
192
|
return __generator(this, function (_a) {
|
|
149
193
|
switch (_a.label) {
|
|
150
|
-
case 0:
|
|
151
|
-
|
|
152
|
-
aliceBalance = _a.sent();
|
|
153
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
154
|
-
case 2:
|
|
155
|
-
bobBalance = _a.sent();
|
|
156
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
157
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
158
|
-
amount = "10000";
|
|
194
|
+
case 0:
|
|
195
|
+
amount = "100";
|
|
159
196
|
return [4 /*yield*/, firma.Cw20.getGasEstimationTransfer(aliceWallet, contractAddress, bobAddress, amount)];
|
|
160
|
-
case
|
|
197
|
+
case 1:
|
|
161
198
|
gas = _a.sent();
|
|
162
199
|
fee = Math.ceil(gas * 0.1);
|
|
163
200
|
return [4 /*yield*/, firma.Cw20.transfer(aliceWallet, contractAddress, bobAddress, amount, { gas: gas, fee: fee })];
|
|
164
|
-
case 4:
|
|
165
|
-
result = _a.sent();
|
|
166
|
-
chai_1.expect(result.code).to.be.equal(0);
|
|
167
|
-
return [2 /*return*/];
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}); });
|
|
171
|
-
it.skip('Cw20 transfer_form', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
172
|
-
var aliceBalance, bobBalance, allowance, amount, gas, fee, result, allowance1;
|
|
173
|
-
return __generator(this, function (_a) {
|
|
174
|
-
switch (_a.label) {
|
|
175
|
-
case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
|
|
176
|
-
case 1:
|
|
177
|
-
aliceBalance = _a.sent();
|
|
178
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
179
201
|
case 2:
|
|
180
|
-
bobBalance = _a.sent();
|
|
181
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
182
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
183
|
-
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
184
|
-
case 3:
|
|
185
|
-
allowance = _a.sent();
|
|
186
|
-
console.log(allowance);
|
|
187
|
-
amount = "1000";
|
|
188
|
-
return [4 /*yield*/, firma.Cw20.getGasEstimationTransferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount)];
|
|
189
|
-
case 4:
|
|
190
|
-
gas = _a.sent();
|
|
191
|
-
fee = Math.ceil(gas * 0.1);
|
|
192
|
-
return [4 /*yield*/, firma.Cw20.transferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount, { gas: gas, fee: fee })];
|
|
193
|
-
case 5:
|
|
194
202
|
result = _a.sent();
|
|
195
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
|
|
196
|
-
case 6:
|
|
197
|
-
aliceBalance = _a.sent();
|
|
198
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
199
|
-
case 7:
|
|
200
|
-
bobBalance = _a.sent();
|
|
201
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
202
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
203
|
-
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
204
|
-
case 8:
|
|
205
|
-
allowance1 = _a.sent();
|
|
206
|
-
console.log(allowance1);
|
|
207
203
|
chai_1.expect(result.code).to.be.equal(0);
|
|
208
204
|
return [2 /*return*/];
|
|
209
205
|
}
|
|
210
206
|
});
|
|
211
207
|
}); });
|
|
212
|
-
it
|
|
213
|
-
var
|
|
208
|
+
it('Cw20 mint', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
209
|
+
var minter, amount, gas, fee, result;
|
|
214
210
|
return __generator(this, function (_a) {
|
|
215
211
|
switch (_a.label) {
|
|
216
|
-
case 0: return [4 /*yield*/, firma.Cw20.
|
|
212
|
+
case 0: return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
|
|
217
213
|
case 1:
|
|
218
|
-
aliceBalance = _a.sent();
|
|
219
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
220
|
-
case 2:
|
|
221
|
-
bobBalance = _a.sent();
|
|
222
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
223
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
224
|
-
return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
|
|
225
|
-
case 3:
|
|
226
214
|
minter = _a.sent();
|
|
227
215
|
if (minter == null) {
|
|
228
216
|
console.log("minter is null");
|
|
229
217
|
return [2 /*return*/];
|
|
230
218
|
}
|
|
231
|
-
console.log(minter.minter);
|
|
232
|
-
console.log(minter.cap);
|
|
233
|
-
return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
|
|
234
|
-
case 4:
|
|
235
|
-
info = _a.sent();
|
|
236
|
-
console.log(info);
|
|
237
219
|
amount = "1000";
|
|
238
220
|
return [4 /*yield*/, firma.Cw20.getGasEstimationMint(aliceWallet, contractAddress, aliceAddress, amount)];
|
|
239
|
-
case
|
|
221
|
+
case 2:
|
|
240
222
|
gas = _a.sent();
|
|
241
223
|
fee = Math.ceil(gas * 0.1);
|
|
242
224
|
return [4 /*yield*/, firma.Cw20.mint(aliceWallet, contractAddress, aliceAddress, amount, { gas: gas, fee: fee })];
|
|
243
|
-
case
|
|
225
|
+
case 3:
|
|
244
226
|
result = _a.sent();
|
|
245
|
-
console.log(result);
|
|
246
227
|
chai_1.expect(result.code).to.be.equal(0);
|
|
247
228
|
return [2 /*return*/];
|
|
248
229
|
}
|
|
249
230
|
});
|
|
250
231
|
}); });
|
|
251
|
-
it
|
|
252
|
-
var
|
|
232
|
+
it('Cw20 burn', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
233
|
+
var amount, gas, fee, result;
|
|
253
234
|
return __generator(this, function (_a) {
|
|
254
235
|
switch (_a.label) {
|
|
255
|
-
case 0:
|
|
256
|
-
|
|
257
|
-
info = _a.sent();
|
|
258
|
-
console.log(info);
|
|
259
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
|
|
260
|
-
case 2:
|
|
261
|
-
aliceBalance = _a.sent();
|
|
262
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
263
|
-
case 3:
|
|
264
|
-
bobBalance = _a.sent();
|
|
265
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
266
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
267
|
-
amount = "1000";
|
|
236
|
+
case 0:
|
|
237
|
+
amount = "10";
|
|
268
238
|
return [4 /*yield*/, firma.Cw20.getGasEstimationBurn(aliceWallet, contractAddress, amount)];
|
|
269
|
-
case
|
|
239
|
+
case 1:
|
|
270
240
|
gas = _a.sent();
|
|
271
241
|
fee = Math.ceil(gas * 0.1);
|
|
272
242
|
return [4 /*yield*/, firma.Cw20.burn(aliceWallet, contractAddress, amount, { gas: gas, fee: fee })];
|
|
273
|
-
case
|
|
243
|
+
case 2:
|
|
274
244
|
result = _a.sent();
|
|
275
|
-
console.log(result);
|
|
276
245
|
chai_1.expect(result.code).to.be.equal(0);
|
|
277
246
|
return [2 /*return*/];
|
|
278
247
|
}
|
|
279
248
|
});
|
|
280
249
|
}); });
|
|
281
|
-
it
|
|
282
|
-
var
|
|
250
|
+
it('Cw20 increase_allowance', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
251
|
+
var olDAllowance, expires, amount, gas, fee, result, newAllowance;
|
|
283
252
|
return __generator(this, function (_a) {
|
|
284
253
|
switch (_a.label) {
|
|
285
|
-
case 0: return [4 /*yield*/, firma.Cw20.
|
|
254
|
+
case 0: return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
286
255
|
case 1:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
256
|
+
olDAllowance = _a.sent();
|
|
257
|
+
expires = { never: {} };
|
|
258
|
+
amount = "1000";
|
|
259
|
+
return [4 /*yield*/, firma.Cw20.getGasEstimationIncreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires)];
|
|
290
260
|
case 2:
|
|
291
|
-
|
|
292
|
-
|
|
261
|
+
gas = _a.sent();
|
|
262
|
+
fee = Math.ceil(gas * 0.1);
|
|
263
|
+
return [4 /*yield*/, firma.Cw20.increaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires, { gas: gas, fee: fee })];
|
|
293
264
|
case 3:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
amount = "1000";
|
|
298
|
-
return [4 /*yield*/, firma.Cw20.getGasEstimationBurnFrom(bobWallet, contractAddress, aliceAddress, amount)];
|
|
265
|
+
result = _a.sent();
|
|
266
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
267
|
+
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
299
268
|
case 4:
|
|
269
|
+
newAllowance = _a.sent();
|
|
270
|
+
chai_1.expect(Number.parseInt(olDAllowance.allowance) + Number.parseInt(amount)).to.be.equal(Number.parseInt(newAllowance.allowance));
|
|
271
|
+
return [2 /*return*/];
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}); });
|
|
275
|
+
it('Cw20 transfer_from', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
276
|
+
var amount, gas, fee, result;
|
|
277
|
+
return __generator(this, function (_a) {
|
|
278
|
+
switch (_a.label) {
|
|
279
|
+
case 0:
|
|
280
|
+
amount = "10";
|
|
281
|
+
return [4 /*yield*/, firma.Cw20.getGasEstimationTransferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount)];
|
|
282
|
+
case 1:
|
|
300
283
|
gas = _a.sent();
|
|
301
284
|
fee = Math.ceil(gas * 0.1);
|
|
302
|
-
return [4 /*yield*/, firma.Cw20.
|
|
303
|
-
case
|
|
285
|
+
return [4 /*yield*/, firma.Cw20.transferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount, { gas: gas, fee: fee })];
|
|
286
|
+
case 2:
|
|
304
287
|
result = _a.sent();
|
|
305
|
-
console.log(result);
|
|
306
288
|
chai_1.expect(result.code).to.be.equal(0);
|
|
307
289
|
return [2 /*return*/];
|
|
308
290
|
}
|
|
309
291
|
});
|
|
310
292
|
}); });
|
|
311
|
-
it
|
|
312
|
-
var
|
|
293
|
+
it('Cw20 burn_from', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
294
|
+
var amount, gas, fee, result;
|
|
313
295
|
return __generator(this, function (_a) {
|
|
314
296
|
switch (_a.label) {
|
|
315
|
-
case 0:
|
|
297
|
+
case 0:
|
|
298
|
+
amount = "10";
|
|
299
|
+
return [4 /*yield*/, firma.Cw20.getGasEstimationBurnFrom(bobWallet, contractAddress, aliceAddress, amount)];
|
|
316
300
|
case 1:
|
|
317
|
-
aliceBalance = _a.sent();
|
|
318
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
319
|
-
case 2:
|
|
320
|
-
bobBalance = _a.sent();
|
|
321
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
322
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
323
|
-
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
324
|
-
case 3:
|
|
325
|
-
olDAllowance = _a.sent();
|
|
326
|
-
console.log(olDAllowance);
|
|
327
|
-
amount = "1000";
|
|
328
|
-
expires = { never: {} };
|
|
329
|
-
return [4 /*yield*/, firma.Cw20.getGasEstimationIncreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires)];
|
|
330
|
-
case 4:
|
|
331
301
|
gas = _a.sent();
|
|
332
302
|
fee = Math.ceil(gas * 0.1);
|
|
333
|
-
return [4 /*yield*/, firma.Cw20.
|
|
334
|
-
case
|
|
303
|
+
return [4 /*yield*/, firma.Cw20.burnFrom(bobWallet, contractAddress, aliceAddress, amount, { gas: gas, fee: fee })];
|
|
304
|
+
case 2:
|
|
335
305
|
result = _a.sent();
|
|
336
|
-
|
|
337
|
-
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
338
|
-
case 6:
|
|
339
|
-
newAllowance = _a.sent();
|
|
340
|
-
console.log(newAllowance);
|
|
306
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
341
307
|
return [2 /*return*/];
|
|
342
308
|
}
|
|
343
309
|
});
|
|
344
310
|
}); });
|
|
345
|
-
it
|
|
346
|
-
var
|
|
311
|
+
it('Cw20 decrease_allowance', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
312
|
+
var oldAllowance, expires, amount, gas, fee, result, newAllowance;
|
|
347
313
|
return __generator(this, function (_a) {
|
|
348
314
|
switch (_a.label) {
|
|
349
|
-
case 0: return [4 /*yield*/, firma.Cw20.
|
|
315
|
+
case 0: return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
350
316
|
case 1:
|
|
351
|
-
|
|
352
|
-
return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
|
|
353
|
-
case 2:
|
|
354
|
-
bobBalance = _a.sent();
|
|
355
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
356
|
-
console.log("bob: " + bobAddress + ", balance: " + bobBalance);
|
|
357
|
-
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
358
|
-
case 3:
|
|
359
|
-
olDAllowance = _a.sent();
|
|
360
|
-
console.log(olDAllowance);
|
|
361
|
-
amount = "1000";
|
|
317
|
+
oldAllowance = _a.sent();
|
|
362
318
|
expires = { never: {} };
|
|
319
|
+
amount = "100";
|
|
363
320
|
return [4 /*yield*/, firma.Cw20.getGasEstimationDecreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires)];
|
|
364
|
-
case
|
|
321
|
+
case 2:
|
|
365
322
|
gas = _a.sent();
|
|
366
323
|
fee = Math.ceil(gas * 0.1);
|
|
367
324
|
return [4 /*yield*/, firma.Cw20.decreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires, { gas: gas, fee: fee })];
|
|
368
|
-
case
|
|
325
|
+
case 3:
|
|
369
326
|
result = _a.sent();
|
|
370
|
-
|
|
327
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
371
328
|
return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
|
|
372
|
-
case
|
|
329
|
+
case 4:
|
|
373
330
|
newAllowance = _a.sent();
|
|
374
|
-
|
|
331
|
+
chai_1.expect(Number.parseInt(newAllowance.allowance) + Number.parseInt(amount)).to.be.equal(Number.parseInt(oldAllowance.allowance));
|
|
375
332
|
return [2 /*return*/];
|
|
376
333
|
}
|
|
377
334
|
});
|
|
378
335
|
}); });
|
|
379
|
-
it
|
|
380
|
-
var
|
|
336
|
+
it('Cw20 update_minter', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
337
|
+
var oldMinter, gas, fee, result, newMinter;
|
|
381
338
|
return __generator(this, function (_a) {
|
|
382
339
|
switch (_a.label) {
|
|
383
340
|
case 0: return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
|
|
384
341
|
case 1:
|
|
385
|
-
|
|
386
|
-
console.log(minter);
|
|
342
|
+
oldMinter = _a.sent();
|
|
387
343
|
return [4 /*yield*/, firma.Cw20.getGasEstimationUpdateMinter(aliceWallet, contractAddress, bobAddress)];
|
|
388
344
|
case 2:
|
|
389
345
|
gas = _a.sent();
|
|
@@ -391,123 +347,102 @@ describe('[30. cw20 tx Test]', function () {
|
|
|
391
347
|
return [4 /*yield*/, firma.Cw20.updateMinter(aliceWallet, contractAddress, bobAddress, { gas: gas, fee: fee })];
|
|
392
348
|
case 3:
|
|
393
349
|
result = _a.sent();
|
|
394
|
-
|
|
350
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
395
351
|
return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
|
|
396
352
|
case 4:
|
|
397
|
-
|
|
398
|
-
|
|
353
|
+
newMinter = _a.sent();
|
|
354
|
+
chai_1.expect(oldMinter).to.not.equal(newMinter);
|
|
399
355
|
return [2 /*return*/];
|
|
400
356
|
}
|
|
401
357
|
});
|
|
402
358
|
}); });
|
|
403
|
-
it
|
|
404
|
-
var
|
|
359
|
+
it('Cw20 update_marketing', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
360
|
+
var oldMarketingInfo, description, marketingAddress, project, gas, fee, result, newMarketingInfo;
|
|
405
361
|
return __generator(this, function (_a) {
|
|
406
362
|
switch (_a.label) {
|
|
407
|
-
case 0: return [4 /*yield*/, firma.Cw20.
|
|
363
|
+
case 0: return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
408
364
|
case 1:
|
|
409
|
-
|
|
410
|
-
console.log(info);
|
|
411
|
-
return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
412
|
-
case 2:
|
|
413
|
-
marketingInfo = _a.sent();
|
|
414
|
-
console.log(marketingInfo);
|
|
365
|
+
oldMarketingInfo = _a.sent();
|
|
415
366
|
description = "description";
|
|
416
367
|
marketingAddress = aliceAddress;
|
|
417
368
|
project = "project";
|
|
418
369
|
return [4 /*yield*/, firma.Cw20.getGasEstimationUpdateMarketing(aliceWallet, contractAddress, description, marketingAddress, project)];
|
|
419
|
-
case
|
|
370
|
+
case 2:
|
|
420
371
|
gas = _a.sent();
|
|
421
372
|
fee = Math.ceil(gas * 0.1);
|
|
422
373
|
return [4 /*yield*/, firma.Cw20.updateMarketing(aliceWallet, contractAddress, description, marketingAddress, project, { gas: gas, fee: fee })];
|
|
423
|
-
case
|
|
374
|
+
case 3:
|
|
424
375
|
result = _a.sent();
|
|
425
|
-
|
|
376
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
426
377
|
return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
427
|
-
case
|
|
428
|
-
|
|
429
|
-
|
|
378
|
+
case 4:
|
|
379
|
+
newMarketingInfo = _a.sent();
|
|
380
|
+
chai_1.expect(oldMarketingInfo).to.not.equal(newMarketingInfo);
|
|
430
381
|
return [2 /*return*/];
|
|
431
382
|
}
|
|
432
383
|
});
|
|
433
384
|
}); });
|
|
434
|
-
it
|
|
435
|
-
var
|
|
385
|
+
it('Cw20 update_logo', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
386
|
+
var oldMarketingInfo, url, gas, fee, result, newMarketingInfo;
|
|
436
387
|
return __generator(this, function (_a) {
|
|
437
388
|
switch (_a.label) {
|
|
438
|
-
case 0: return [4 /*yield*/, firma.Cw20.
|
|
389
|
+
case 0: return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
439
390
|
case 1:
|
|
440
|
-
|
|
441
|
-
console.log(minter);
|
|
442
|
-
console.log(aliceAddress);
|
|
443
|
-
return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
|
|
444
|
-
case 2:
|
|
445
|
-
info = _a.sent();
|
|
446
|
-
console.log(info);
|
|
447
|
-
return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
448
|
-
case 3:
|
|
449
|
-
marketingInfo = _a.sent();
|
|
450
|
-
console.log(marketingInfo);
|
|
391
|
+
oldMarketingInfo = _a.sent();
|
|
451
392
|
url = "https://firmachain.org";
|
|
452
393
|
return [4 /*yield*/, firma.Cw20.getGasEstimationUploadLogo(aliceWallet, contractAddress, url)];
|
|
453
|
-
case
|
|
394
|
+
case 2:
|
|
454
395
|
gas = _a.sent();
|
|
455
396
|
fee = Math.ceil(gas * 0.1);
|
|
456
397
|
return [4 /*yield*/, firma.Cw20.uploadLogo(aliceWallet, contractAddress, url, { gas: gas, fee: fee })];
|
|
457
|
-
case
|
|
398
|
+
case 3:
|
|
458
399
|
result = _a.sent();
|
|
459
|
-
|
|
400
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
460
401
|
return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
|
|
461
|
-
case
|
|
462
|
-
|
|
463
|
-
|
|
402
|
+
case 4:
|
|
403
|
+
newMarketingInfo = _a.sent();
|
|
404
|
+
chai_1.expect(oldMarketingInfo).to.not.equal(newMarketingInfo);
|
|
464
405
|
return [2 /*return*/];
|
|
465
406
|
}
|
|
466
407
|
});
|
|
467
408
|
}); });
|
|
468
409
|
it.skip('Cw20 send', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
469
|
-
var
|
|
410
|
+
var amount, targetContractAddress, msg, gas, fee, result;
|
|
470
411
|
return __generator(this, function (_a) {
|
|
471
412
|
switch (_a.label) {
|
|
472
|
-
case 0:
|
|
473
|
-
case 1:
|
|
474
|
-
aliceBalance = _a.sent();
|
|
475
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
413
|
+
case 0:
|
|
476
414
|
amount = "10000";
|
|
477
415
|
targetContractAddress = contractAddress;
|
|
478
416
|
msg = { action: "send", data: "example" };
|
|
479
417
|
return [4 /*yield*/, firma.Cw20.getGasEstimationSend(aliceWallet, contractAddress, targetContractAddress, amount, msg)];
|
|
480
|
-
case
|
|
418
|
+
case 1:
|
|
481
419
|
gas = _a.sent();
|
|
482
420
|
fee = Math.ceil(gas * 0.1);
|
|
483
421
|
return [4 /*yield*/, firma.Cw20.send(aliceWallet, contractAddress, targetContractAddress, amount, msg, { gas: gas, fee: fee })];
|
|
484
|
-
case
|
|
422
|
+
case 2:
|
|
485
423
|
result = _a.sent();
|
|
486
|
-
|
|
424
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
487
425
|
return [2 /*return*/];
|
|
488
426
|
}
|
|
489
427
|
});
|
|
490
428
|
}); });
|
|
491
429
|
it.skip('Cw20 send_from', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
492
|
-
var
|
|
430
|
+
var amount, targetContractAddress, owner, msg, gas, fee, result;
|
|
493
431
|
return __generator(this, function (_a) {
|
|
494
432
|
switch (_a.label) {
|
|
495
|
-
case 0:
|
|
496
|
-
case 1:
|
|
497
|
-
aliceBalance = _a.sent();
|
|
498
|
-
console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
|
|
433
|
+
case 0:
|
|
499
434
|
amount = "100";
|
|
500
435
|
targetContractAddress = contractAddress;
|
|
501
436
|
owner = aliceAddress;
|
|
502
437
|
msg = { action: "send", data: "example" };
|
|
503
438
|
return [4 /*yield*/, firma.Cw20.getGasEstimationSendFrom(bobWallet, contractAddress, targetContractAddress, owner, amount, msg)];
|
|
504
|
-
case
|
|
439
|
+
case 1:
|
|
505
440
|
gas = _a.sent();
|
|
506
441
|
fee = Math.ceil(gas * 0.1);
|
|
507
442
|
return [4 /*yield*/, firma.Cw20.sendFrom(bobWallet, contractAddress, targetContractAddress, owner, amount, msg, { gas: gas, fee: fee })];
|
|
508
|
-
case
|
|
443
|
+
case 2:
|
|
509
444
|
result = _a.sent();
|
|
510
|
-
|
|
445
|
+
chai_1.expect(result.code).to.be.equal(0);
|
|
511
446
|
return [2 /*return*/];
|
|
512
447
|
}
|
|
513
448
|
});
|