@firmachain/firma-js 0.3.4 → 0.3.6-beta1
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/dist/index.js +5 -1
- package/dist/sdk/FirmaAuthzService.d.ts +8 -7
- package/dist/sdk/FirmaAuthzService.js +12 -22
- package/dist/sdk/FirmaBankService.js +2 -2
- package/dist/sdk/FirmaChainService.js +1 -1
- package/dist/sdk/FirmaContractService.d.ts +1 -1
- package/dist/sdk/FirmaContractService.js +6 -6
- package/dist/sdk/FirmaCosmWasmCw20.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw20.js +8 -8
- package/dist/sdk/FirmaCosmWasmCw721.d.ts +2 -2
- package/dist/sdk/FirmaCosmWasmCw721.js +12 -12
- package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwBridge.js +8 -8
- package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmCwMarketplace.js +5 -5
- package/dist/sdk/FirmaCosmWasmService.d.ts +1 -1
- package/dist/sdk/FirmaCosmWasmService.js +13 -13
- package/dist/sdk/FirmaDistributionService.d.ts +1 -1
- package/dist/sdk/FirmaDistributionService.js +6 -6
- package/dist/sdk/FirmaFeeGrantService.d.ts +7 -6
- package/dist/sdk/FirmaFeeGrantService.js +9 -26
- package/dist/sdk/FirmaGovService.d.ts +1 -1
- package/dist/sdk/FirmaGovService.js +14 -14
- package/dist/sdk/FirmaIbcService.d.ts +3 -3
- package/dist/sdk/FirmaIbcService.js +11 -8
- package/dist/sdk/FirmaIpfsService.js +1 -1
- package/dist/sdk/FirmaMintService.js +1 -1
- package/dist/sdk/FirmaNftService.d.ts +1 -1
- package/dist/sdk/FirmaNftService.js +6 -6
- package/dist/sdk/FirmaSlashingService.js +1 -1
- package/dist/sdk/FirmaStakingService.d.ts +3 -3
- package/dist/sdk/FirmaStakingService.js +6 -6
- package/dist/sdk/FirmaTokenService.d.ts +1 -1
- package/dist/sdk/FirmaTokenService.js +5 -5
- package/dist/sdk/FirmaUtil.d.ts +26 -23
- package/dist/sdk/FirmaUtil.js +157 -137
- package/dist/sdk/FirmaWalletService.d.ts +5 -9
- package/dist/sdk/FirmaWalletService.js +86 -52
- package/dist/sdk/firmachain/authz/AuthzQueryClient.js +4 -4
- package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +8 -11
- package/dist/sdk/firmachain/authz/AuthzTxTypes.js +6 -10
- package/dist/sdk/firmachain/authz/index.js +5 -1
- package/dist/sdk/firmachain/bank/BankQueryClient.js +5 -5
- package/dist/sdk/firmachain/bank/index.js +5 -1
- package/dist/sdk/firmachain/common/ITxClient.d.ts +3 -3
- package/dist/sdk/firmachain/common/ITxClient.js +25 -83
- package/dist/sdk/firmachain/common/LedgerWallet.d.ts +19 -3
- package/dist/sdk/firmachain/common/LedgerWallet.js +138 -68
- package/dist/sdk/firmachain/common/TendermintQueryClient.js +1 -1
- package/dist/sdk/firmachain/common/TxCommon.d.ts +14 -30
- package/dist/sdk/firmachain/common/accounts.d.ts +1 -1
- package/dist/sdk/firmachain/common/accounts.js +7 -7
- package/dist/sdk/firmachain/common/events.js +2 -2
- package/dist/sdk/firmachain/common/fee.d.ts +2 -2
- package/dist/sdk/firmachain/common/fee.js +4 -2
- package/dist/sdk/firmachain/common/index.d.ts +0 -1
- package/dist/sdk/firmachain/common/index.js +5 -4
- package/dist/sdk/firmachain/common/signing.d.ts +13 -9
- package/dist/sdk/firmachain/common/signing.js +81 -36
- package/dist/sdk/firmachain/common/signingprotobufstargateclient.d.ts +34 -0
- package/dist/sdk/firmachain/common/signingprotobufstargateclient.js +319 -0
- package/dist/sdk/firmachain/common/signingstargateclient.d.ts +21 -105
- package/dist/sdk/firmachain/common/signingstargateclient.js +120 -472
- package/dist/sdk/firmachain/common/{stargateclient.d.ts → stargateClient.d.ts} +11 -60
- package/dist/sdk/firmachain/common/{stargateclient.js → stargateClient.js} +109 -203
- package/dist/sdk/firmachain/{amino → common}/wallet.js +15 -11
- package/dist/sdk/firmachain/contract/ContractQueryClient.js +3 -3
- package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +6 -6
- package/dist/sdk/firmachain/contract/index.js +5 -1
- package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +9 -9
- package/dist/sdk/firmachain/cosmwasm/index.js +5 -1
- package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +6 -6
- package/dist/sdk/firmachain/distribution/index.js +5 -1
- package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +3 -3
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +4 -45
- package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +3 -82
- package/dist/sdk/firmachain/feegrant/index.js +5 -1
- package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -3
- package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +29 -29
- package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -3
- package/dist/sdk/firmachain/gov/GovQueryClient.js +3 -3
- package/dist/sdk/firmachain/gov/index.js +5 -1
- package/dist/sdk/firmachain/ibc/IbcQueryClient.js +2 -2
- package/dist/sdk/firmachain/ibc/index.js +5 -1
- package/dist/sdk/firmachain/mint/MintQueryClient.js +1 -1
- package/dist/sdk/firmachain/mint/index.js +5 -1
- package/dist/sdk/firmachain/nft/NftQueryClient.js +1 -1
- package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +8 -8
- package/dist/sdk/firmachain/nft/index.js +5 -1
- package/dist/sdk/firmachain/slashing/SlashingQueryClient.js +1 -1
- package/dist/sdk/firmachain/slashing/index.js +5 -1
- package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +2 -2
- package/dist/sdk/firmachain/staking/StakingQueryClient.js +10 -9
- package/dist/sdk/firmachain/staking/index.js +5 -1
- package/dist/sdk/firmachain/token/TokenQueryClient.js +1 -1
- package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +11 -11
- package/dist/sdk/firmachain/token/TokenTxTypes.js +1 -1
- package/dist/sdk/firmachain/token/index.js +5 -1
- package/dist/test/00.wallet.test.js +4 -4
- package/dist/test/01.contract_tx.test.js +5 -5
- package/dist/test/02.contract_query.test.js +15 -15
- package/dist/test/03.contract_scenario.test.js +28 -28
- package/dist/test/04.bank_tx.test.js +4 -4
- package/dist/test/05.bank_query.test.js +9 -9
- package/dist/test/06.feegrant_tx.test.js +59 -35
- package/dist/test/07.feegrant_query.test.js +18 -15
- package/dist/test/08.gas_estimate.test.js +110 -70
- package/dist/test/09.ipfs.test.js +4 -4
- package/dist/test/10.nft_tx.test.js +7 -7
- package/dist/test/11.nft_query.test.js +9 -9
- package/dist/test/12.staking_tx.test.js +27 -15
- package/dist/test/13.staking_query.test.js +20 -20
- package/dist/test/14.distribution_tx.test.js +8 -8
- package/dist/test/15.distribution_query.test.js +15 -15
- package/dist/test/16.gov_tx.test.js +17 -17
- package/dist/test/17.gov_query.test.js +19 -19
- package/dist/test/18.util.test.js +105 -63
- package/dist/test/19.chain.test.js +38 -38
- package/dist/test/20.slashing_query.test.js +25 -25
- package/dist/test/21.token_tx.test.js +6 -6
- package/dist/test/22.token_query.test.js +4 -4
- package/dist/test/23.authz_tx.test.js +77 -47
- package/dist/test/24.authz_query.test.js +66 -67
- package/dist/test/25.cosmwasm_tx.test.js +7 -7
- package/dist/test/26.cosmwasm_query.test.js +127 -59
- package/dist/test/{27.arbitary_sign.test.js → 27.arbitrary_sign.test.js} +41 -40
- package/dist/test/28.ibc_tx.test.js +8 -8
- package/dist/test/29.mint_query.test.js +2 -2
- package/dist/test/30.cw20_tx.test.js +20 -20
- package/dist/test/31.cw20_query.test.js +24 -24
- package/dist/test/32.cw721_tx.test.js +19 -19
- package/dist/test/33.cw721_query.test.js +32 -32
- package/dist/test/34.cw_bridge_tx.test.js +19 -19
- package/dist/test/35.cw_bridge_tx_low.test.js +13 -13
- package/dist/test/36.cw_bridge_query.test.js +20 -20
- package/dist/test/37.cw_marketplace_tx.test.js +32 -32
- package/dist/test/38.cw_marketplace_query.test.js +2 -2
- package/dist/test/config_test.d.ts +2 -2
- package/dist/test/config_test.js +22 -5
- package/package.json +9 -10
- package/dist/sdk/firmachain/amino/addresses.d.ts +0 -5
- package/dist/sdk/firmachain/amino/addresses.js +0 -46
- package/dist/sdk/firmachain/amino/aminomsgs.d.ts +0 -291
- package/dist/sdk/firmachain/amino/aminomsgs.js +0 -81
- package/dist/sdk/firmachain/amino/aminotypes.d.ts +0 -22
- package/dist/sdk/firmachain/amino/aminotypes.js +0 -538
- package/dist/sdk/firmachain/amino/coins.d.ts +0 -42
- package/dist/sdk/firmachain/amino/coins.js +0 -90
- package/dist/sdk/firmachain/amino/encoding.d.ts +0 -33
- package/dist/sdk/firmachain/amino/encoding.js +0 -252
- package/dist/sdk/firmachain/amino/multisig.d.ts +0 -10
- package/dist/sdk/firmachain/amino/multisig.js +0 -42
- package/dist/sdk/firmachain/amino/pubkeys.d.ts +0 -47
- package/dist/sdk/firmachain/amino/pubkeys.js +0 -29
- package/dist/sdk/firmachain/amino/signature.d.ts +0 -16
- package/dist/sdk/firmachain/amino/signature.js +0 -36
- package/dist/sdk/firmachain/amino/signdoc.d.ts +0 -44
- package/dist/sdk/firmachain/amino/signdoc.js +0 -68
- package/dist/sdk/firmachain/amino/signer.d.ts +0 -33
- package/dist/sdk/firmachain/amino/signer.js +0 -2
- package/dist/sdk/firmachain/amino/stdtx.d.ts +0 -15
- package/dist/sdk/firmachain/amino/stdtx.js +0 -17
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +0 -22
- package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +0 -170
- package/dist/sdk/firmachain/common/aminotypes.d.ts +0 -19
- package/dist/sdk/firmachain/common/aminotypes.js +0 -74
- package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/auth/queries.js +0 -64
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +0 -15
- package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/authz/messages.js +0 -9
- package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/authz/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +0 -35
- package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +0 -85
- package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/bank/messages.js +0 -12
- package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +0 -15
- package/dist/sdk/firmachain/common/modules/bank/queries.js +0 -128
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +0 -14
- package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +0 -44
- package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +0 -113
- package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/distribution/messages.js +0 -15
- package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/distribution/queries.js +0 -171
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +0 -18
- package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +0 -14
- package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/feegrant/messages.js +0 -8
- package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +0 -9
- package/dist/sdk/firmachain/common/modules/feegrant/queries.js +0 -81
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +0 -79
- package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +0 -152
- package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +0 -29
- package/dist/sdk/firmachain/common/modules/gov/messages.js +0 -39
- package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +0 -19
- package/dist/sdk/firmachain/common/modules/gov/queries.js +0 -160
- package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/aminomessages.js +0 -8
- package/dist/sdk/firmachain/common/modules/group/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/group/messages.js +0 -28
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +0 -38
- package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +0 -55
- package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +0 -8
- package/dist/sdk/firmachain/common/modules/ibc/messages.js +0 -32
- package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +0 -58
- package/dist/sdk/firmachain/common/modules/ibc/queries.js +0 -576
- package/dist/sdk/firmachain/common/modules/index.d.ts +0 -32
- package/dist/sdk/firmachain/common/modules/index.js +0 -101
- package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +0 -21
- package/dist/sdk/firmachain/common/modules/mint/queries.js +0 -95
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +0 -12
- package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +0 -11
- package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +0 -10
- package/dist/sdk/firmachain/common/modules/slashing/queries.js +0 -88
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +0 -112
- package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +0 -234
- package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +0 -33
- package/dist/sdk/firmachain/common/modules/staking/messages.js +0 -37
- package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +0 -23
- package/dist/sdk/firmachain/common/modules/staking/queries.js +0 -242
- package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +0 -11
- package/dist/sdk/firmachain/common/modules/tx/queries.js +0 -103
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +0 -16
- package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +0 -56
- package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +0 -2
- package/dist/sdk/firmachain/common/modules/vesting/messages.js +0 -7
- package/dist/sdk/firmachain/common/queryclient/index.d.ts +0 -2
- package/dist/sdk/firmachain/common/queryclient/index.js +0 -10
- package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +0 -75
- package/dist/sdk/firmachain/common/queryclient/queryclient.js +0 -157
- package/dist/sdk/firmachain/common/queryclient/utils.d.ts +0 -33
- package/dist/sdk/firmachain/common/queryclient/utils.js +0 -101
- package/dist/sdk/firmachain/common/search.d.ts +0 -10
- package/dist/sdk/firmachain/common/search.js +0 -7
- package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +0 -110
- package/dist/sdk/firmachain/google/protobuf/timestamp.js +0 -108
- /package/dist/sdk/firmachain/{amino → common}/paths.d.ts +0 -0
- /package/dist/sdk/firmachain/{amino → common}/paths.js +0 -0
- /package/dist/sdk/firmachain/{amino → common}/wallet.d.ts +0 -0
- /package/dist/test/{27.arbitary_sign.test.d.ts → 27.arbitrary_sign.test.d.ts} +0 -0
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
var chai_1 = require("chai");
|
|
40
40
|
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
41
41
|
var config_test_1 = require("./config_test");
|
|
42
|
+
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
42
43
|
describe('[06. Feegrant Tx Test]', function () {
|
|
43
44
|
var firma;
|
|
44
45
|
var aliceWallet;
|
|
@@ -69,24 +70,25 @@ describe('[06. Feegrant Tx Test]', function () {
|
|
|
69
70
|
});
|
|
70
71
|
});
|
|
71
72
|
it('feegrant GrantPeriodicAllowance tx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
72
|
-
var expirationDate,
|
|
73
|
+
var expirationDate, grantResult;
|
|
73
74
|
return __generator(this, function (_a) {
|
|
74
75
|
switch (_a.label) {
|
|
75
76
|
case 0:
|
|
76
77
|
expirationDate = new Date();
|
|
77
|
-
expirationDate.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
78
|
+
expirationDate.setDate(expirationDate.getDate() + 1);
|
|
79
|
+
return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, {
|
|
80
|
+
spendLimit: [{
|
|
81
|
+
amount: "10000",
|
|
82
|
+
denom: firma.Config.denom
|
|
83
|
+
}],
|
|
84
|
+
expiration: {
|
|
85
|
+
seconds: BigInt(Math.floor(expirationDate.getTime() / 1000)),
|
|
86
|
+
nanos: (expirationDate.getTime() % 1000) * 1000000
|
|
87
|
+
}
|
|
88
|
+
})];
|
|
87
89
|
case 1:
|
|
88
|
-
|
|
89
|
-
chai_1.expect(
|
|
90
|
+
grantResult = _a.sent();
|
|
91
|
+
(0, chai_1.expect)(grantResult.code).to.equal(0);
|
|
90
92
|
return [2 /*return*/];
|
|
91
93
|
}
|
|
92
94
|
});
|
|
@@ -102,58 +104,80 @@ describe('[06. Feegrant Tx Test]', function () {
|
|
|
102
104
|
case 1: return [4 /*yield*/, _b.apply(_a, _c.concat([_d.sent()]))];
|
|
103
105
|
case 2:
|
|
104
106
|
result = _d.sent();
|
|
105
|
-
chai_1.expect(result.code).to.equal(0);
|
|
107
|
+
(0, chai_1.expect)(result.code).to.equal(0);
|
|
106
108
|
return [2 /*return*/];
|
|
107
109
|
}
|
|
108
110
|
});
|
|
109
111
|
}); });
|
|
110
112
|
it('feegrant GrantBasicAllowance tx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var
|
|
113
|
+
var result, revokeResult;
|
|
112
114
|
return __generator(this, function (_a) {
|
|
113
115
|
switch (_a.label) {
|
|
114
|
-
case 0:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
case 0: return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, {
|
|
117
|
+
spendLimit: [{
|
|
118
|
+
denom: firma.Config.denom,
|
|
119
|
+
amount: "10000"
|
|
120
|
+
}]
|
|
121
|
+
})];
|
|
118
122
|
case 1:
|
|
119
123
|
result = _a.sent();
|
|
120
|
-
chai_1.expect(result.code).to.be.equal(0);
|
|
124
|
+
(0, chai_1.expect)(result.code).to.be.equal(0);
|
|
121
125
|
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress)];
|
|
122
126
|
case 2:
|
|
123
127
|
revokeResult = _a.sent();
|
|
124
|
-
chai_1.expect(revokeResult.code).to.be.equal(0);
|
|
128
|
+
(0, chai_1.expect)(revokeResult.code).to.be.equal(0);
|
|
125
129
|
return [2 /*return*/];
|
|
126
130
|
}
|
|
127
131
|
});
|
|
128
132
|
}); });
|
|
129
133
|
it('feegrant send tx', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
|
-
var amount, expirationDate, periodicAllowanceData, grantResult, sendResult, revokeResult;
|
|
134
|
+
var error_1, spendAmount, amount, expirationDate, periodicAllowanceData, grantResult, sendResult, revokeResult;
|
|
131
135
|
return __generator(this, function (_a) {
|
|
132
136
|
switch (_a.label) {
|
|
133
137
|
case 0:
|
|
138
|
+
_a.trys.push([0, 2, , 3]);
|
|
139
|
+
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress)];
|
|
140
|
+
case 1:
|
|
141
|
+
_a.sent();
|
|
142
|
+
return [3 /*break*/, 3];
|
|
143
|
+
case 2:
|
|
144
|
+
error_1 = _a.sent();
|
|
145
|
+
return [3 /*break*/, 3];
|
|
146
|
+
case 3:
|
|
147
|
+
spendAmount = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCTStr("10");
|
|
134
148
|
amount = 0.1;
|
|
135
149
|
expirationDate = new Date();
|
|
136
150
|
expirationDate.setMinutes(expirationDate.getMinutes() + 20);
|
|
137
151
|
periodicAllowanceData = {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
152
|
+
basic: {
|
|
153
|
+
spendLimit: [
|
|
154
|
+
{ amount: spendAmount, denom: firma.Config.denom }
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
period: { seconds: BigInt(60 * 60 * 24), nanos: 0 },
|
|
158
|
+
periodSpendLimit: [
|
|
159
|
+
{ amount: spendAmount, denom: firma.Config.denom }
|
|
160
|
+
],
|
|
161
|
+
periodCanSpend: [
|
|
162
|
+
{ amount: spendAmount, denom: firma.Config.denom }
|
|
163
|
+
],
|
|
164
|
+
periodReset: {
|
|
165
|
+
seconds: BigInt(Math.floor(expirationDate.getTime() / 1000)),
|
|
166
|
+
nanos: (expirationDate.getTime() % 1000) * 1000000
|
|
167
|
+
}
|
|
144
168
|
};
|
|
145
169
|
return [4 /*yield*/, firma.FeeGrant.grantPeriodicAllowance(aliceWallet, bobAddress, periodicAllowanceData)];
|
|
146
|
-
case
|
|
170
|
+
case 4:
|
|
147
171
|
grantResult = _a.sent();
|
|
148
|
-
chai_1.expect(grantResult.code).to.equal(0);
|
|
172
|
+
(0, chai_1.expect)(grantResult.code).to.equal(0);
|
|
149
173
|
return [4 /*yield*/, firma.Bank.send(bobWallet, aliceAddress, amount, { feeGranter: aliceAddress })];
|
|
150
|
-
case
|
|
174
|
+
case 5:
|
|
151
175
|
sendResult = _a.sent();
|
|
152
|
-
chai_1.expect(sendResult.code).to.equal(0);
|
|
176
|
+
(0, chai_1.expect)(sendResult.code).to.equal(0);
|
|
153
177
|
return [4 /*yield*/, firma.FeeGrant.revokeAllowance(aliceWallet, bobAddress)];
|
|
154
|
-
case
|
|
178
|
+
case 6:
|
|
155
179
|
revokeResult = _a.sent();
|
|
156
|
-
chai_1.expect(revokeResult.code).to.equal(0);
|
|
180
|
+
(0, chai_1.expect)(revokeResult.code).to.equal(0);
|
|
157
181
|
return [2 /*return*/];
|
|
158
182
|
}
|
|
159
183
|
});
|
|
@@ -14,7 +14,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
14
14
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
15
|
function step(op) {
|
|
16
16
|
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
18
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
19
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
20
|
switch (op[0]) {
|
|
@@ -82,27 +82,30 @@ describe('[07. Feegrant Query Test]', function () {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
it('feegrant getGranteeAllowance', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
85
|
-
var expirationDate, grantResult, allowance
|
|
85
|
+
var expirationDate, grantResult, allowance;
|
|
86
86
|
return __generator(this, function (_a) {
|
|
87
87
|
switch (_a.label) {
|
|
88
88
|
case 0:
|
|
89
|
-
_a.trys.push([0, 3, , 4]);
|
|
90
89
|
expirationDate = new Date();
|
|
91
|
-
expirationDate.
|
|
92
|
-
return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, {
|
|
90
|
+
expirationDate.setDate(expirationDate.getDate() + 1);
|
|
91
|
+
return [4 /*yield*/, firma.FeeGrant.grantBasicAllowance(aliceWallet, bobAddress, {
|
|
92
|
+
spendLimit: [{
|
|
93
|
+
amount: "10000",
|
|
94
|
+
denom: firma.Config.denom
|
|
95
|
+
}],
|
|
96
|
+
expiration: {
|
|
97
|
+
seconds: BigInt(Math.floor(expirationDate.getTime() / 1000)),
|
|
98
|
+
nanos: (expirationDate.getTime() % 1000) * 1000000
|
|
99
|
+
}
|
|
100
|
+
})];
|
|
93
101
|
case 1:
|
|
94
102
|
grantResult = _a.sent();
|
|
95
|
-
chai_1.expect(grantResult.code).to.equal(0);
|
|
103
|
+
(0, chai_1.expect)(grantResult.code).to.equal(0);
|
|
96
104
|
return [4 /*yield*/, firma.FeeGrant.getGranteeAllowance(aliceAddress, bobAddress)];
|
|
97
105
|
case 2:
|
|
98
106
|
allowance = _a.sent();
|
|
99
|
-
chai_1.expect(allowance).to.not.equal(null);
|
|
100
|
-
return [
|
|
101
|
-
case 3:
|
|
102
|
-
error_1 = _a.sent();
|
|
103
|
-
chai_1.expect(false).to.be.equal(true);
|
|
104
|
-
return [3 /*break*/, 4];
|
|
105
|
-
case 4: return [2 /*return*/];
|
|
107
|
+
(0, chai_1.expect)(allowance).to.not.equal(null);
|
|
108
|
+
return [2 /*return*/];
|
|
106
109
|
}
|
|
107
110
|
});
|
|
108
111
|
}); });
|
|
@@ -114,10 +117,10 @@ describe('[07. Feegrant Query Test]', function () {
|
|
|
114
117
|
case 1:
|
|
115
118
|
result = _a.sent();
|
|
116
119
|
if (result.length === 0) {
|
|
117
|
-
chai_1.expect(true).to.be.equal(true);
|
|
120
|
+
(0, chai_1.expect)(true).to.be.equal(true);
|
|
118
121
|
}
|
|
119
122
|
else {
|
|
120
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.isValidAddress(result[0].granter)).to.be.equal(true);
|
|
123
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.isValidAddress(result[0].granter)).to.be.equal(true);
|
|
121
124
|
}
|
|
122
125
|
return [2 /*return*/];
|
|
123
126
|
}
|