@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]) {
|
|
@@ -50,10 +50,10 @@ describe('[17. Gov Query Test]', function () {
|
|
|
50
50
|
return __generator(this, function (_a) {
|
|
51
51
|
proposalList = [];
|
|
52
52
|
if (proposalList.length > 0) {
|
|
53
|
-
chai_1.expect(proposalList[0].id).to.not.equal('');
|
|
53
|
+
(0, chai_1.expect)(proposalList[0].id).to.not.equal('');
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
chai_1.expect(proposalList).to.be.deep.equal([]);
|
|
56
|
+
(0, chai_1.expect)(proposalList).to.be.deep.equal([]);
|
|
57
57
|
}
|
|
58
58
|
return [2 /*return*/];
|
|
59
59
|
});
|
|
@@ -67,13 +67,13 @@ describe('[17. Gov Query Test]', function () {
|
|
|
67
67
|
return [4 /*yield*/, firma.Gov.getProposalListByStatus(status)];
|
|
68
68
|
case 1:
|
|
69
69
|
proposalList = _a.sent();
|
|
70
|
-
chai_1.expect(proposalList).to.be.an('array');
|
|
70
|
+
(0, chai_1.expect)(proposalList).to.be.an('array');
|
|
71
71
|
if (proposalList.length > 0) {
|
|
72
|
-
chai_1.expect(proposalList[0]).to.have.property('id');
|
|
73
|
-
chai_1.expect(proposalList[0].id).to.not.equal('');
|
|
72
|
+
(0, chai_1.expect)(proposalList[0]).to.have.property('id');
|
|
73
|
+
(0, chai_1.expect)(proposalList[0].id).to.not.equal('');
|
|
74
74
|
}
|
|
75
75
|
else {
|
|
76
|
-
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
76
|
+
(0, chai_1.expect)(proposalList).to.have.lengthOf(0);
|
|
77
77
|
}
|
|
78
78
|
return [2 /*return*/];
|
|
79
79
|
}
|
|
@@ -91,12 +91,12 @@ describe('[17. Gov Query Test]', function () {
|
|
|
91
91
|
return [4 /*yield*/, firma.Gov.getProposal(id)];
|
|
92
92
|
case 2:
|
|
93
93
|
proposal = _a.sent();
|
|
94
|
-
chai_1.expect(proposal).to.be.an('object');
|
|
95
|
-
chai_1.expect(proposal).to.have.property('id');
|
|
96
|
-
chai_1.expect(proposal.id).to.equal(id);
|
|
94
|
+
(0, chai_1.expect)(proposal).to.be.an('object');
|
|
95
|
+
(0, chai_1.expect)(proposal).to.have.property('id');
|
|
96
|
+
(0, chai_1.expect)(proposal.id).to.equal(id);
|
|
97
97
|
return [3 /*break*/, 4];
|
|
98
98
|
case 3:
|
|
99
|
-
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
99
|
+
(0, chai_1.expect)(proposalList).to.have.lengthOf(0);
|
|
100
100
|
_a.label = 4;
|
|
101
101
|
case 4: return [2 /*return*/];
|
|
102
102
|
}
|
|
@@ -110,7 +110,7 @@ describe('[17. Gov Query Test]', function () {
|
|
|
110
110
|
case 0: return [4 /*yield*/, firma.Gov.getParam()];
|
|
111
111
|
case 1:
|
|
112
112
|
param = _a.sent();
|
|
113
|
-
chai_1.expect(param).to.be.an('object');
|
|
113
|
+
(0, chai_1.expect)(param).to.be.an('object');
|
|
114
114
|
return [2 /*return*/];
|
|
115
115
|
}
|
|
116
116
|
});
|
|
@@ -123,7 +123,7 @@ describe('[17. Gov Query Test]', function () {
|
|
|
123
123
|
case 0: return [4 /*yield*/, firma.Gov.getParamAsGovParams()];
|
|
124
124
|
case 1:
|
|
125
125
|
param = _a.sent();
|
|
126
|
-
chai_1.expect(param).to.be.an('object');
|
|
126
|
+
(0, chai_1.expect)(param).to.be.an('object');
|
|
127
127
|
return [2 /*return*/];
|
|
128
128
|
}
|
|
129
129
|
});
|
|
@@ -141,14 +141,14 @@ describe('[17. Gov Query Test]', function () {
|
|
|
141
141
|
return [4 /*yield*/, firma.Gov.getCurrentVoteInfo(proposalId)];
|
|
142
142
|
case 2:
|
|
143
143
|
param = _a.sent();
|
|
144
|
-
chai_1.expect(param).to.be.an('object');
|
|
145
|
-
chai_1.expect(param).to.have.property('yes');
|
|
146
|
-
chai_1.expect(param).to.have.property('abstain');
|
|
147
|
-
chai_1.expect(param).to.have.property('no');
|
|
148
|
-
chai_1.expect(param).to.have.property('no_with_veto');
|
|
144
|
+
(0, chai_1.expect)(param).to.be.an('object');
|
|
145
|
+
(0, chai_1.expect)(param).to.have.property('yes');
|
|
146
|
+
(0, chai_1.expect)(param).to.have.property('abstain');
|
|
147
|
+
(0, chai_1.expect)(param).to.have.property('no');
|
|
148
|
+
(0, chai_1.expect)(param).to.have.property('no_with_veto');
|
|
149
149
|
return [3 /*break*/, 4];
|
|
150
150
|
case 3:
|
|
151
|
-
chai_1.expect(proposalList).to.have.lengthOf(0);
|
|
151
|
+
(0, chai_1.expect)(proposalList).to.have.lengthOf(0);
|
|
152
152
|
_a.label = 4;
|
|
153
153
|
case 4: return [2 /*return*/];
|
|
154
154
|
}
|
|
@@ -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]) {
|
|
@@ -38,8 +38,29 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
var chai_1 = require("chai");
|
|
40
40
|
var FirmaUtil_1 = require("../sdk/FirmaUtil");
|
|
41
|
+
var FirmaSDK_1 = require("../sdk/FirmaSDK");
|
|
42
|
+
var config_test_1 = require("./config_test");
|
|
43
|
+
var FirmaConfig_1 = require("../sdk/FirmaConfig");
|
|
41
44
|
describe('[18. util Test]', function () {
|
|
45
|
+
var firma;
|
|
46
|
+
var aliceWallet;
|
|
47
|
+
var aliceAddress;
|
|
42
48
|
beforeEach(function () {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
50
|
+
return __generator(this, function (_a) {
|
|
51
|
+
switch (_a.label) {
|
|
52
|
+
case 0:
|
|
53
|
+
firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
|
|
54
|
+
return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
|
|
55
|
+
case 1:
|
|
56
|
+
aliceWallet = _a.sent();
|
|
57
|
+
return [4 /*yield*/, aliceWallet.getAddress()];
|
|
58
|
+
case 2:
|
|
59
|
+
aliceAddress = _a.sent();
|
|
60
|
+
return [2 /*return*/];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
});
|
|
43
64
|
});
|
|
44
65
|
// getHashFromString
|
|
45
66
|
it('getSha1HashFromString test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -47,7 +68,7 @@ describe('[18. util Test]', function () {
|
|
|
47
68
|
return __generator(this, function (_a) {
|
|
48
69
|
contractName = "testContract1234";
|
|
49
70
|
result = FirmaUtil_1.FirmaUtil.getSha1HashFromString(contractName);
|
|
50
|
-
chai_1.expect(result).to.be.equal("c88753a797d1310b36673e3494005bc7485746b7");
|
|
71
|
+
(0, chai_1.expect)(result).to.be.equal("c88753a797d1310b36673e3494005bc7485746b7");
|
|
51
72
|
return [2 /*return*/];
|
|
52
73
|
});
|
|
53
74
|
}); });
|
|
@@ -56,7 +77,7 @@ describe('[18. util Test]', function () {
|
|
|
56
77
|
return __generator(this, function (_a) {
|
|
57
78
|
contractName = "testContract1234";
|
|
58
79
|
result = FirmaUtil_1.FirmaUtil.getHashFromString(contractName);
|
|
59
|
-
chai_1.expect(result).to.be.equal("95e55f6b55ccf6b3988a6f9ee6d9c3c0011ea93a2489e7f05d10cada2613c17f");
|
|
80
|
+
(0, chai_1.expect)(result).to.be.equal("95e55f6b55ccf6b3988a6f9ee6d9c3c0011ea93a2489e7f05d10cada2613c17f");
|
|
60
81
|
return [2 /*return*/];
|
|
61
82
|
});
|
|
62
83
|
}); });
|
|
@@ -67,11 +88,11 @@ describe('[18. util Test]', function () {
|
|
|
67
88
|
wrongAddress1 = "firma134pp6s2nv7pl4mxu58aeufdd6fv5s2zujrrmsb";
|
|
68
89
|
wrongAddress2 = "firma134pp6s2nv7pl4mxu58aeufdd6fv5s2zujrrmsa1";
|
|
69
90
|
result = FirmaUtil_1.FirmaUtil.isValidAddress(validAddress);
|
|
70
|
-
chai_1.expect(result).to.be.equal(true);
|
|
91
|
+
(0, chai_1.expect)(result).to.be.equal(true);
|
|
71
92
|
result = FirmaUtil_1.FirmaUtil.isValidAddress(wrongAddress1);
|
|
72
|
-
chai_1.expect(result).to.be.equal(false);
|
|
93
|
+
(0, chai_1.expect)(result).to.be.equal(false);
|
|
73
94
|
result = FirmaUtil_1.FirmaUtil.isValidAddress(wrongAddress2);
|
|
74
|
-
chai_1.expect(result).to.be.equal(false);
|
|
95
|
+
(0, chai_1.expect)(result).to.be.equal(false);
|
|
75
96
|
return [2 /*return*/];
|
|
76
97
|
});
|
|
77
98
|
}); });
|
|
@@ -81,7 +102,7 @@ describe('[18. util Test]', function () {
|
|
|
81
102
|
accAddress = "firma1a85hxs97rxsrf0yzdn72vhfu39sa0dwxv90ghy";
|
|
82
103
|
valoperAddress = "firmavaloper1a85hxs97rxsrf0yzdn72vhfu39sa0dwxjkynh2";
|
|
83
104
|
result = FirmaUtil_1.FirmaUtil.getValOperAddressFromAccAddress(accAddress);
|
|
84
|
-
chai_1.expect(result).to.be.equal(valoperAddress);
|
|
105
|
+
(0, chai_1.expect)(result).to.be.equal(valoperAddress);
|
|
85
106
|
return [2 /*return*/];
|
|
86
107
|
});
|
|
87
108
|
}); });
|
|
@@ -91,7 +112,7 @@ describe('[18. util Test]', function () {
|
|
|
91
112
|
consensusPubkey = "InWhZBMP3wKQkwIBCrVqQ+BNoPhV5mTjpwiYHKHCZ/k=";
|
|
92
113
|
valconsAddress = "firmavalcons1fh73gr3f9df7yc390ykdnmeedetlw5ll3dqwje";
|
|
93
114
|
result = FirmaUtil_1.FirmaUtil.getValConsAddressFromAccAddress(consensusPubkey);
|
|
94
|
-
chai_1.expect(result).to.be.equal(valconsAddress);
|
|
115
|
+
(0, chai_1.expect)(result).to.be.equal(valconsAddress);
|
|
95
116
|
return [2 /*return*/];
|
|
96
117
|
});
|
|
97
118
|
}); });
|
|
@@ -101,7 +122,7 @@ describe('[18. util Test]', function () {
|
|
|
101
122
|
accAddress = "firma1a85hxs97rxsrf0yzdn72vhfu39sa0dwxv90ghy";
|
|
102
123
|
valoperAddress = "firmavaloper1a85hxs97rxsrf0yzdn72vhfu39sa0dwxjkynh2";
|
|
103
124
|
result = FirmaUtil_1.FirmaUtil.getAccAddressFromValOperAddress(valoperAddress);
|
|
104
|
-
chai_1.expect(result).to.be.equal(accAddress);
|
|
125
|
+
(0, chai_1.expect)(result).to.be.equal(accAddress);
|
|
105
126
|
return [2 /*return*/];
|
|
106
127
|
});
|
|
107
128
|
}); });
|
|
@@ -110,10 +131,10 @@ describe('[18. util Test]', function () {
|
|
|
110
131
|
return __generator(this, function (_a) {
|
|
111
132
|
amountUFCT = 1000000;
|
|
112
133
|
fct = FirmaUtil_1.FirmaUtil.getFCTStringFromUFCT(amountUFCT);
|
|
113
|
-
chai_1.expect(fct).to.be.equal("1");
|
|
134
|
+
(0, chai_1.expect)(fct).to.be.equal("1");
|
|
114
135
|
amountUFCT = 1234000;
|
|
115
136
|
fct = FirmaUtil_1.FirmaUtil.getFCTStringFromUFCT(amountUFCT);
|
|
116
|
-
chai_1.expect(fct).to.be.equal("1.234");
|
|
137
|
+
(0, chai_1.expect)(fct).to.be.equal("1.234");
|
|
117
138
|
return [2 /*return*/];
|
|
118
139
|
});
|
|
119
140
|
}); });
|
|
@@ -122,10 +143,10 @@ describe('[18. util Test]', function () {
|
|
|
122
143
|
return __generator(this, function (_a) {
|
|
123
144
|
amountUFCT = 1;
|
|
124
145
|
fct = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountUFCT);
|
|
125
|
-
chai_1.expect(fct).to.be.equal("1000000");
|
|
146
|
+
(0, chai_1.expect)(fct).to.be.equal("1000000");
|
|
126
147
|
amountUFCT = 1.23;
|
|
127
148
|
fct = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCT(amountUFCT);
|
|
128
|
-
chai_1.expect(fct).to.be.equal("1230000");
|
|
149
|
+
(0, chai_1.expect)(fct).to.be.equal("1230000");
|
|
129
150
|
return [2 /*return*/];
|
|
130
151
|
});
|
|
131
152
|
}); });
|
|
@@ -134,10 +155,10 @@ describe('[18. util Test]', function () {
|
|
|
134
155
|
return __generator(this, function (_a) {
|
|
135
156
|
amountUFCT = "1000000";
|
|
136
157
|
fct = FirmaUtil_1.FirmaUtil.getFCTStringFromUFCTStr(amountUFCT);
|
|
137
|
-
chai_1.expect(fct).to.be.equal("1");
|
|
158
|
+
(0, chai_1.expect)(fct).to.be.equal("1");
|
|
138
159
|
amountUFCT = "1234000";
|
|
139
160
|
fct = FirmaUtil_1.FirmaUtil.getFCTStringFromUFCTStr(amountUFCT);
|
|
140
|
-
chai_1.expect(fct).to.be.equal("1.234");
|
|
161
|
+
(0, chai_1.expect)(fct).to.be.equal("1.234");
|
|
141
162
|
return [2 /*return*/];
|
|
142
163
|
});
|
|
143
164
|
}); });
|
|
@@ -146,10 +167,10 @@ describe('[18. util Test]', function () {
|
|
|
146
167
|
return __generator(this, function (_a) {
|
|
147
168
|
amountUFCT = "1";
|
|
148
169
|
fct = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCTStr(amountUFCT);
|
|
149
|
-
chai_1.expect(fct).to.be.equal("1000000");
|
|
170
|
+
(0, chai_1.expect)(fct).to.be.equal("1000000");
|
|
150
171
|
amountUFCT = "1.23";
|
|
151
172
|
fct = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCTStr(amountUFCT);
|
|
152
|
-
chai_1.expect(fct).to.be.equal("1230000");
|
|
173
|
+
(0, chai_1.expect)(fct).to.be.equal("1230000");
|
|
153
174
|
return [2 /*return*/];
|
|
154
175
|
});
|
|
155
176
|
}); });
|
|
@@ -159,10 +180,10 @@ describe('[18. util Test]', function () {
|
|
|
159
180
|
decimal = 6;
|
|
160
181
|
amountUToken = 1000000;
|
|
161
182
|
token = FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(amountUToken, decimal);
|
|
162
|
-
chai_1.expect(token).to.be.equal("1");
|
|
183
|
+
(0, chai_1.expect)(token).to.be.equal("1");
|
|
163
184
|
amountUToken = 1234000;
|
|
164
185
|
token = FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(amountUToken, decimal);
|
|
165
|
-
chai_1.expect(token).to.be.equal("1.234");
|
|
186
|
+
(0, chai_1.expect)(token).to.be.equal("1.234");
|
|
166
187
|
return [2 /*return*/];
|
|
167
188
|
});
|
|
168
189
|
}); });
|
|
@@ -172,10 +193,10 @@ describe('[18. util Test]', function () {
|
|
|
172
193
|
decimal = 6;
|
|
173
194
|
amountUToken = 1;
|
|
174
195
|
token = FirmaUtil_1.FirmaUtil.getUTokenStringFromToken(amountUToken, decimal);
|
|
175
|
-
chai_1.expect(token).to.be.equal("1000000");
|
|
196
|
+
(0, chai_1.expect)(token).to.be.equal("1000000");
|
|
176
197
|
amountUToken = 1.23;
|
|
177
198
|
token = FirmaUtil_1.FirmaUtil.getUTokenStringFromToken(amountUToken, decimal);
|
|
178
|
-
chai_1.expect(token).to.be.equal("1230000");
|
|
199
|
+
(0, chai_1.expect)(token).to.be.equal("1230000");
|
|
179
200
|
return [2 /*return*/];
|
|
180
201
|
});
|
|
181
202
|
}); });
|
|
@@ -186,8 +207,8 @@ describe('[18. util Test]', function () {
|
|
|
186
207
|
testUTokenValue = 533.827284;
|
|
187
208
|
testUTokenValueStr = "533.827284";
|
|
188
209
|
testTokenValueStr = "0.000533";
|
|
189
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(testUTokenValueStr, decimal)).to.be.equal(testTokenValueStr);
|
|
190
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(testUTokenValue, decimal)).to.be.equal(testTokenValueStr);
|
|
210
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(testUTokenValueStr, decimal)).to.be.equal(testTokenValueStr);
|
|
211
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(testUTokenValue, decimal)).to.be.equal(testTokenValueStr);
|
|
191
212
|
return [2 /*return*/];
|
|
192
213
|
});
|
|
193
214
|
}); });
|
|
@@ -199,10 +220,10 @@ describe('[18. util Test]', function () {
|
|
|
199
220
|
testTokenValueStr = "533.827284";
|
|
200
221
|
testUTokenValue = 533827284;
|
|
201
222
|
testUTokenValueStr = "533827284";
|
|
202
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getUTokenFromToken(testTokenValue, decimal)).to.be.equal(testUTokenValue);
|
|
203
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getUTokenStringFromTokenStr(testTokenValueStr, decimal)).to.be.equal(testUTokenValueStr);
|
|
204
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(testUTokenValueStr, decimal)).to.be.equal(testTokenValueStr);
|
|
205
|
-
chai_1.expect(FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(testUTokenValue, decimal)).to.be.equal(testTokenValueStr);
|
|
223
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getUTokenFromToken(testTokenValue, decimal)).to.be.equal(testUTokenValue);
|
|
224
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getUTokenStringFromTokenStr(testTokenValueStr, decimal)).to.be.equal(testUTokenValueStr);
|
|
225
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(testUTokenValueStr, decimal)).to.be.equal(testTokenValueStr);
|
|
226
|
+
(0, chai_1.expect)(FirmaUtil_1.FirmaUtil.getTokenStringFromUToken(testUTokenValue, decimal)).to.be.equal(testTokenValueStr);
|
|
206
227
|
return [2 /*return*/];
|
|
207
228
|
});
|
|
208
229
|
}); });
|
|
@@ -212,10 +233,10 @@ describe('[18. util Test]', function () {
|
|
|
212
233
|
decimal = 6;
|
|
213
234
|
amountUToken = "1000000";
|
|
214
235
|
token = FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(amountUToken, decimal);
|
|
215
|
-
chai_1.expect(token).to.be.equal("1");
|
|
236
|
+
(0, chai_1.expect)(token).to.be.equal("1");
|
|
216
237
|
amountUToken = "1234000";
|
|
217
238
|
token = FirmaUtil_1.FirmaUtil.getTokenStringFromUTokenStr(amountUToken, decimal);
|
|
218
|
-
chai_1.expect(token).to.be.equal("1.234");
|
|
239
|
+
(0, chai_1.expect)(token).to.be.equal("1.234");
|
|
219
240
|
return [2 /*return*/];
|
|
220
241
|
});
|
|
221
242
|
}); });
|
|
@@ -225,10 +246,10 @@ describe('[18. util Test]', function () {
|
|
|
225
246
|
decimal = 6;
|
|
226
247
|
amountUToken = "1";
|
|
227
248
|
token = FirmaUtil_1.FirmaUtil.getUTokenStringFromTokenStr(amountUToken, decimal);
|
|
228
|
-
chai_1.expect(token).to.be.equal("1000000");
|
|
249
|
+
(0, chai_1.expect)(token).to.be.equal("1000000");
|
|
229
250
|
amountUToken = "1.23";
|
|
230
251
|
token = FirmaUtil_1.FirmaUtil.getUFCTStringFromFCTStr(amountUToken);
|
|
231
|
-
chai_1.expect(token).to.be.equal("1230000");
|
|
252
|
+
(0, chai_1.expect)(token).to.be.equal("1230000");
|
|
232
253
|
return [2 /*return*/];
|
|
233
254
|
});
|
|
234
255
|
}); });
|
|
@@ -240,7 +261,7 @@ describe('[18. util Test]', function () {
|
|
|
240
261
|
buffer = enc.encode(testString);
|
|
241
262
|
hash = FirmaUtil_1.FirmaUtil.getFileHashFromBuffer(buffer);
|
|
242
263
|
// hash from sha256 online
|
|
243
|
-
chai_1.expect(hash).to.be.equal("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9");
|
|
264
|
+
(0, chai_1.expect)(hash).to.be.equal("b94d27b9934d3e08a52e52d7da7dabfac484efe37a5380ee9088f7ace2efcde9");
|
|
244
265
|
return [2 /*return*/];
|
|
245
266
|
});
|
|
246
267
|
}); });
|
|
@@ -250,8 +271,8 @@ describe('[18. util Test]', function () {
|
|
|
250
271
|
testString = "1800s";
|
|
251
272
|
duration = FirmaUtil_1.FirmaUtil.parseDurationString(testString);
|
|
252
273
|
// Correct way to test object properties
|
|
253
|
-
chai_1.expect(duration.seconds).to.be.equal(BigInt(1800));
|
|
254
|
-
chai_1.expect(duration.nanos).to.be.equal(0);
|
|
274
|
+
(0, chai_1.expect)(duration.seconds).to.be.equal(BigInt(1800));
|
|
275
|
+
(0, chai_1.expect)(duration.nanos).to.be.equal(0);
|
|
255
276
|
return [2 /*return*/];
|
|
256
277
|
});
|
|
257
278
|
}); });
|
|
@@ -260,8 +281,8 @@ describe('[18. util Test]', function () {
|
|
|
260
281
|
return __generator(this, function (_a) {
|
|
261
282
|
testString = "1800s";
|
|
262
283
|
duration = FirmaUtil_1.FirmaUtil.createDurationFromString(testString);
|
|
263
|
-
chai_1.expect(duration.seconds).to.be.equal(BigInt(1800));
|
|
264
|
-
chai_1.expect(duration.nanos).to.be.equal(0);
|
|
284
|
+
(0, chai_1.expect)(duration.seconds).to.be.equal(BigInt(1800));
|
|
285
|
+
(0, chai_1.expect)(duration.nanos).to.be.equal(0);
|
|
265
286
|
return [2 /*return*/];
|
|
266
287
|
});
|
|
267
288
|
}); });
|
|
@@ -269,44 +290,65 @@ describe('[18. util Test]', function () {
|
|
|
269
290
|
var result;
|
|
270
291
|
return __generator(this, function (_a) {
|
|
271
292
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.000000000000000000");
|
|
272
|
-
chai_1.expect(result).to.equal("0");
|
|
293
|
+
(0, chai_1.expect)(result).to.equal("0");
|
|
273
294
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1");
|
|
274
|
-
chai_1.expect(result).to.equal("1000000000000000000");
|
|
295
|
+
(0, chai_1.expect)(result).to.equal("1000000000000000000");
|
|
275
296
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.99999999999999999999999");
|
|
276
|
-
chai_1.expect(result).to.equal("999999999999999999");
|
|
297
|
+
(0, chai_1.expect)(result).to.equal("999999999999999999");
|
|
277
298
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.3719281729181018373290120300000831");
|
|
278
|
-
chai_1.expect(result).to.equal("371928172918101837");
|
|
299
|
+
(0, chai_1.expect)(result).to.equal("371928172918101837");
|
|
279
300
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.000000000000000000");
|
|
280
|
-
chai_1.expect(result).to.equal("1000000000000000000");
|
|
301
|
+
(0, chai_1.expect)(result).to.equal("1000000000000000000");
|
|
281
302
|
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" 0.75 ");
|
|
282
|
-
chai_1.expect(result).to.equal("750000000000000000");
|
|
283
|
-
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(".23");
|
|
284
|
-
chai_1.expect(result).to.equal("230000000000000000");
|
|
285
|
-
result = FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(".9999990000000");
|
|
286
|
-
chai_1.expect(result).to.equal("999999000000000000");
|
|
303
|
+
(0, chai_1.expect)(result).to.equal("750000000000000000");
|
|
287
304
|
return [2 /*return*/];
|
|
288
305
|
});
|
|
289
306
|
}); });
|
|
290
307
|
it('processCommissionRateAsDecimal test - failure cases', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
291
308
|
return __generator(this, function (_a) {
|
|
292
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("."); }).to.throw("Invalid commission rate format: .");
|
|
293
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(""); }).to.throw("Invalid commission rate format: ");
|
|
294
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" "); }).to.throw("Invalid commission rate format: ");
|
|
295
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("null"); }).to.throw("Invalid commission rate format: null");
|
|
296
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1abc"); }).to.throw("Invalid commission rate format: 0.1abc");
|
|
297
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1.2"); }).to.throw("Invalid commission rate format: 0.1.2");
|
|
298
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("--0.5"); }).to.throw("Invalid commission rate format: --0.5");
|
|
299
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
300
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("2"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
301
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
302
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
303
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
304
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
305
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
306
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.00000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
307
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.5%"); }).to.throw("Invalid commission rate format: 0.5%");
|
|
308
|
-
chai_1.expect(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" 0.5 extra"); }).to.throw("Invalid commission rate format: 0.5 extra");
|
|
309
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("."); }).to.throw("Invalid commission rate format: .");
|
|
310
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(""); }).to.throw("Invalid commission rate format: ");
|
|
311
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" "); }).to.throw("Invalid commission rate format: ");
|
|
312
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("null"); }).to.throw("Invalid commission rate format: null");
|
|
313
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1abc"); }).to.throw("Invalid commission rate format: 0.1abc");
|
|
314
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.1.2"); }).to.throw("Invalid commission rate format: 0.1.2");
|
|
315
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("--0.5"); }).to.throw("Invalid commission rate format: --0.5");
|
|
316
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
317
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("2"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
318
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
319
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
320
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-1"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
321
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.01"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
322
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("-0.000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
323
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("1.00000000000000000001"); }).to.throw("Invalid commission rate range. Must be between 0 and 1 inclusive.");
|
|
324
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal("0.5%"); }).to.throw("Invalid commission rate format: 0.5%");
|
|
325
|
+
(0, chai_1.expect)(function () { return FirmaUtil_1.FirmaUtil.processCommissionRateAsDecimal(" 0.5 extra"); }).to.throw("Invalid commission rate format: 0.5 extra");
|
|
309
326
|
return [2 /*return*/];
|
|
310
327
|
});
|
|
311
328
|
}); });
|
|
329
|
+
it('getAccountInfo test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
330
|
+
var result;
|
|
331
|
+
return __generator(this, function (_a) {
|
|
332
|
+
switch (_a.label) {
|
|
333
|
+
case 0: return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getAccountInfo(aliceAddress)];
|
|
334
|
+
case 1:
|
|
335
|
+
result = _a.sent();
|
|
336
|
+
(0, chai_1.expect)(result).to.have.property('account_number');
|
|
337
|
+
(0, chai_1.expect)(result).to.have.property('sequence');
|
|
338
|
+
return [2 /*return*/];
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}); });
|
|
342
|
+
it('getChainId test', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
343
|
+
var result;
|
|
344
|
+
return __generator(this, function (_a) {
|
|
345
|
+
switch (_a.label) {
|
|
346
|
+
case 0: return [4 /*yield*/, FirmaUtil_1.FirmaUtil.getChainId()];
|
|
347
|
+
case 1:
|
|
348
|
+
result = _a.sent();
|
|
349
|
+
(0, chai_1.expect)(result).to.be.equal(FirmaConfig_1.FirmaConfig.DevNetConfig.chainID);
|
|
350
|
+
return [2 /*return*/];
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
}); });
|
|
312
354
|
});
|
|
@@ -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]) {
|
|
@@ -51,20 +51,20 @@ describe('[19. chain Test]', function () {
|
|
|
51
51
|
case 0: return [4 /*yield*/, firma.BlockChain.getChainSyncInfo()];
|
|
52
52
|
case 1:
|
|
53
53
|
result = _a.sent();
|
|
54
|
-
chai_1.expect(result).to.be.an('object');
|
|
55
|
-
chai_1.expect(result).to.have.property('latest_block_hash');
|
|
56
|
-
chai_1.expect(result).to.have.property('latest_app_hash');
|
|
57
|
-
chai_1.expect(result).to.have.property('latest_block_height');
|
|
58
|
-
chai_1.expect(result).to.have.property('latest_block_time');
|
|
59
|
-
chai_1.expect(result).to.have.property('earliest_block_hash');
|
|
60
|
-
chai_1.expect(result).to.have.property('earliest_app_hash');
|
|
61
|
-
chai_1.expect(result).to.have.property('earliest_block_height');
|
|
62
|
-
chai_1.expect(result).to.have.property('earliest_block_time');
|
|
63
|
-
chai_1.expect(result).to.have.property('catching_up');
|
|
64
|
-
chai_1.expect(parseInt(result.latest_block_height)).to.be.a('number');
|
|
65
|
-
chai_1.expect(parseInt(result.earliest_block_height)).to.be.a('number');
|
|
66
|
-
chai_1.expect(parseInt(result.latest_block_height)).to.be.greaterThan(0);
|
|
67
|
-
chai_1.expect(parseInt(result.earliest_block_height)).to.be.greaterThan(0);
|
|
54
|
+
(0, chai_1.expect)(result).to.be.an('object');
|
|
55
|
+
(0, chai_1.expect)(result).to.have.property('latest_block_hash');
|
|
56
|
+
(0, chai_1.expect)(result).to.have.property('latest_app_hash');
|
|
57
|
+
(0, chai_1.expect)(result).to.have.property('latest_block_height');
|
|
58
|
+
(0, chai_1.expect)(result).to.have.property('latest_block_time');
|
|
59
|
+
(0, chai_1.expect)(result).to.have.property('earliest_block_hash');
|
|
60
|
+
(0, chai_1.expect)(result).to.have.property('earliest_app_hash');
|
|
61
|
+
(0, chai_1.expect)(result).to.have.property('earliest_block_height');
|
|
62
|
+
(0, chai_1.expect)(result).to.have.property('earliest_block_time');
|
|
63
|
+
(0, chai_1.expect)(result).to.have.property('catching_up');
|
|
64
|
+
(0, chai_1.expect)(parseInt(result.latest_block_height)).to.be.a('number');
|
|
65
|
+
(0, chai_1.expect)(parseInt(result.earliest_block_height)).to.be.a('number');
|
|
66
|
+
(0, chai_1.expect)(parseInt(result.latest_block_height)).to.be.greaterThan(0);
|
|
67
|
+
(0, chai_1.expect)(parseInt(result.earliest_block_height)).to.be.greaterThan(0);
|
|
68
68
|
return [2 /*return*/];
|
|
69
69
|
}
|
|
70
70
|
});
|
|
@@ -82,26 +82,26 @@ describe('[19. chain Test]', function () {
|
|
|
82
82
|
return [4 /*yield*/, firma.BlockChain.getTransactionByHash(txHash)];
|
|
83
83
|
case 2:
|
|
84
84
|
result = _a.sent();
|
|
85
|
-
chai_1.expect(result).to.have.property('hash');
|
|
86
|
-
chai_1.expect(result).to.have.property('height');
|
|
87
|
-
chai_1.expect(result).to.have.property('index');
|
|
88
|
-
chai_1.expect(result).to.have.property('tx_result');
|
|
89
|
-
chai_1.expect(result).to.have.property('tx');
|
|
90
|
-
chai_1.expect(result.hash).to.equal(txHash);
|
|
91
|
-
chai_1.expect(parseInt(result.height)).to.be.greaterThan(0);
|
|
92
|
-
chai_1.expect(result.index).to.be.greaterThanOrEqual(0);
|
|
93
|
-
chai_1.expect(result.tx_result).to.have.property('code');
|
|
94
|
-
chai_1.expect(result.tx_result).to.have.property('data');
|
|
95
|
-
chai_1.expect(result.tx_result).to.have.property('log');
|
|
96
|
-
chai_1.expect(result.tx_result).to.have.property('info');
|
|
97
|
-
chai_1.expect(result.tx_result).to.have.property('gas_wanted');
|
|
98
|
-
chai_1.expect(result.tx_result).to.have.property('gas_used');
|
|
99
|
-
chai_1.expect(result.tx_result).to.have.property('events');
|
|
100
|
-
chai_1.expect(result.tx_result).to.have.property('codespace');
|
|
85
|
+
(0, chai_1.expect)(result).to.have.property('hash');
|
|
86
|
+
(0, chai_1.expect)(result).to.have.property('height');
|
|
87
|
+
(0, chai_1.expect)(result).to.have.property('index');
|
|
88
|
+
(0, chai_1.expect)(result).to.have.property('tx_result');
|
|
89
|
+
(0, chai_1.expect)(result).to.have.property('tx');
|
|
90
|
+
(0, chai_1.expect)(result.hash).to.equal(txHash);
|
|
91
|
+
(0, chai_1.expect)(parseInt(result.height)).to.be.greaterThan(0);
|
|
92
|
+
(0, chai_1.expect)(result.index).to.be.greaterThanOrEqual(0);
|
|
93
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('code');
|
|
94
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('data');
|
|
95
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('log');
|
|
96
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('info');
|
|
97
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('gas_wanted');
|
|
98
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('gas_used');
|
|
99
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('events');
|
|
100
|
+
(0, chai_1.expect)(result.tx_result).to.have.property('codespace');
|
|
101
101
|
return [3 /*break*/, 4];
|
|
102
102
|
case 3:
|
|
103
103
|
error_1 = _a.sent();
|
|
104
|
-
chai_1.expect(error_1).to.exist;
|
|
104
|
+
(0, chai_1.expect)(error_1).to.exist;
|
|
105
105
|
return [3 /*break*/, 4];
|
|
106
106
|
case 4: return [2 /*return*/];
|
|
107
107
|
}
|
|
@@ -114,12 +114,12 @@ describe('[19. chain Test]', function () {
|
|
|
114
114
|
case 0: return [4 /*yield*/, firma.BlockChain.getChainInfo()];
|
|
115
115
|
case 1:
|
|
116
116
|
result = _a.sent();
|
|
117
|
-
chai_1.expect(result).to.have.property('chainId');
|
|
118
|
-
chai_1.expect(result).to.have.property('appVersion');
|
|
119
|
-
chai_1.expect(result).to.have.property('cosmosVersion');
|
|
120
|
-
chai_1.expect(result.chainId).to.not.be.empty;
|
|
121
|
-
chai_1.expect(result.appVersion).to.not.be.empty;
|
|
122
|
-
chai_1.expect(result.cosmosVersion).to.not.be.empty;
|
|
117
|
+
(0, chai_1.expect)(result).to.have.property('chainId');
|
|
118
|
+
(0, chai_1.expect)(result).to.have.property('appVersion');
|
|
119
|
+
(0, chai_1.expect)(result).to.have.property('cosmosVersion');
|
|
120
|
+
(0, chai_1.expect)(result.chainId).to.not.be.empty;
|
|
121
|
+
(0, chai_1.expect)(result.appVersion).to.not.be.empty;
|
|
122
|
+
(0, chai_1.expect)(result.cosmosVersion).to.not.be.empty;
|
|
123
123
|
return [2 /*return*/];
|
|
124
124
|
}
|
|
125
125
|
});
|
|
@@ -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]) {
|
|
@@ -51,16 +51,16 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
51
51
|
case 0: return [4 /*yield*/, firma.Slashing.getSlashingParam()];
|
|
52
52
|
case 1:
|
|
53
53
|
result = _a.sent();
|
|
54
|
-
chai_1.expect(result).to.have.property('signed_blocks_window');
|
|
55
|
-
chai_1.expect(result).to.have.property('min_signed_per_window');
|
|
56
|
-
chai_1.expect(result).to.have.property('downtime_jail_duration');
|
|
57
|
-
chai_1.expect(result).to.have.property('slash_fraction_double_sign');
|
|
58
|
-
chai_1.expect(result).to.have.property('slash_fraction_downtime');
|
|
59
|
-
chai_1.expect(result.signed_blocks_window).to.not.be.empty;
|
|
60
|
-
chai_1.expect(result.min_signed_per_window).to.not.be.empty;
|
|
61
|
-
chai_1.expect(result.downtime_jail_duration).to.not.be.empty;
|
|
62
|
-
chai_1.expect(result.slash_fraction_double_sign).to.not.be.empty;
|
|
63
|
-
chai_1.expect(result.slash_fraction_downtime).to.not.be.empty;
|
|
54
|
+
(0, chai_1.expect)(result).to.have.property('signed_blocks_window');
|
|
55
|
+
(0, chai_1.expect)(result).to.have.property('min_signed_per_window');
|
|
56
|
+
(0, chai_1.expect)(result).to.have.property('downtime_jail_duration');
|
|
57
|
+
(0, chai_1.expect)(result).to.have.property('slash_fraction_double_sign');
|
|
58
|
+
(0, chai_1.expect)(result).to.have.property('slash_fraction_downtime');
|
|
59
|
+
(0, chai_1.expect)(result.signed_blocks_window).to.not.be.empty;
|
|
60
|
+
(0, chai_1.expect)(result.min_signed_per_window).to.not.be.empty;
|
|
61
|
+
(0, chai_1.expect)(result.downtime_jail_duration).to.not.be.empty;
|
|
62
|
+
(0, chai_1.expect)(result.slash_fraction_double_sign).to.not.be.empty;
|
|
63
|
+
(0, chai_1.expect)(result.slash_fraction_downtime).to.not.be.empty;
|
|
64
64
|
return [2 /*return*/];
|
|
65
65
|
}
|
|
66
66
|
});
|
|
@@ -73,13 +73,13 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
73
73
|
case 1:
|
|
74
74
|
result = _a.sent();
|
|
75
75
|
if (result.length > 0) {
|
|
76
|
-
chai_1.expect(result[0]).to.have.property('address');
|
|
77
|
-
chai_1.expect(result[0]).to.have.property('start_height');
|
|
78
|
-
chai_1.expect(result[0]).to.have.property('index_offset');
|
|
79
|
-
chai_1.expect(result[0]).to.have.property('jailed_until');
|
|
80
|
-
chai_1.expect(result[0]).to.have.property('tombstoned');
|
|
81
|
-
chai_1.expect(result[0]).to.have.property('missed_blocks_counter');
|
|
82
|
-
chai_1.expect(result[0].address).to.not.be.empty;
|
|
76
|
+
(0, chai_1.expect)(result[0]).to.have.property('address');
|
|
77
|
+
(0, chai_1.expect)(result[0]).to.have.property('start_height');
|
|
78
|
+
(0, chai_1.expect)(result[0]).to.have.property('index_offset');
|
|
79
|
+
(0, chai_1.expect)(result[0]).to.have.property('jailed_until');
|
|
80
|
+
(0, chai_1.expect)(result[0]).to.have.property('tombstoned');
|
|
81
|
+
(0, chai_1.expect)(result[0]).to.have.property('missed_blocks_counter');
|
|
82
|
+
(0, chai_1.expect)(result[0].address).to.not.be.empty;
|
|
83
83
|
}
|
|
84
84
|
return [2 /*return*/];
|
|
85
85
|
}
|
|
@@ -96,13 +96,13 @@ describe('[20. Slashing Query Test]', function () {
|
|
|
96
96
|
return [4 /*yield*/, firma.Slashing.getSigningInfo(infos[0].address)];
|
|
97
97
|
case 2:
|
|
98
98
|
result = _a.sent();
|
|
99
|
-
chai_1.expect(result).to.have.property('address');
|
|
100
|
-
chai_1.expect(result).to.have.property('start_height');
|
|
101
|
-
chai_1.expect(result).to.have.property('index_offset');
|
|
102
|
-
chai_1.expect(result).to.have.property('jailed_until');
|
|
103
|
-
chai_1.expect(result).to.have.property('tombstoned');
|
|
104
|
-
chai_1.expect(result).to.have.property('missed_blocks_counter');
|
|
105
|
-
chai_1.expect(result.address).to.equal(infos[0].address);
|
|
99
|
+
(0, chai_1.expect)(result).to.have.property('address');
|
|
100
|
+
(0, chai_1.expect)(result).to.have.property('start_height');
|
|
101
|
+
(0, chai_1.expect)(result).to.have.property('index_offset');
|
|
102
|
+
(0, chai_1.expect)(result).to.have.property('jailed_until');
|
|
103
|
+
(0, chai_1.expect)(result).to.have.property('tombstoned');
|
|
104
|
+
(0, chai_1.expect)(result).to.have.property('missed_blocks_counter');
|
|
105
|
+
(0, chai_1.expect)(result.address).to.equal(infos[0].address);
|
|
106
106
|
_a.label = 3;
|
|
107
107
|
case 3: return [2 /*return*/];
|
|
108
108
|
}
|