@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.
Files changed (206) hide show
  1. package/README.md +1 -1
  2. package/dist/sdk/FirmaAuthzService.d.ts +8 -8
  3. package/dist/sdk/FirmaAuthzService.js +12 -6
  4. package/dist/sdk/FirmaBankService.d.ts +4 -4
  5. package/dist/sdk/FirmaContractService.d.ts +4 -4
  6. package/dist/sdk/FirmaCosmWasmCw20.d.ts +14 -14
  7. package/dist/sdk/FirmaCosmWasmCw721.d.ts +14 -14
  8. package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
  9. package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
  10. package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
  11. package/dist/sdk/FirmaCosmWasmService.js +2 -3
  12. package/dist/sdk/FirmaDistributionService.d.ts +6 -6
  13. package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
  14. package/dist/sdk/FirmaGovService.d.ts +27 -16
  15. package/dist/sdk/FirmaGovService.js +305 -195
  16. package/dist/sdk/FirmaIbcService.d.ts +3 -4
  17. package/dist/sdk/FirmaIbcService.js +5 -2
  18. package/dist/sdk/FirmaNftService.d.ts +5 -5
  19. package/dist/sdk/FirmaStakingService.d.ts +6 -6
  20. package/dist/sdk/FirmaTokenService.d.ts +5 -5
  21. package/dist/sdk/FirmaUtil.d.ts +1 -1
  22. package/dist/sdk/FirmaUtil.js +12 -14
  23. package/dist/sdk/firmachain/amino/addresses.js +1 -1
  24. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
  25. package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
  26. package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
  27. package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
  28. package/dist/sdk/firmachain/amino/coins.js +26 -5
  29. package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
  30. package/dist/sdk/firmachain/amino/encoding.js +21 -3
  31. package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
  32. package/dist/sdk/firmachain/amino/signdoc.js +37 -11
  33. package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
  34. package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
  35. package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
  36. package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
  37. package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
  38. package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
  39. package/dist/sdk/firmachain/common/ITxClient.js +82 -24
  40. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
  41. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
  42. package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
  43. package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
  44. package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
  45. package/dist/sdk/firmachain/common/accounts.js +28 -33
  46. package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
  47. package/dist/sdk/firmachain/common/aminotypes.js +74 -0
  48. package/dist/sdk/firmachain/common/events.d.ts +32 -0
  49. package/dist/sdk/firmachain/common/events.js +18 -0
  50. package/dist/sdk/firmachain/common/fee.d.ts +26 -0
  51. package/dist/sdk/firmachain/common/fee.js +83 -0
  52. package/dist/sdk/firmachain/common/index.d.ts +1 -0
  53. package/dist/sdk/firmachain/common/index.js +3 -0
  54. package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
  55. package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
  56. package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
  57. package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
  58. package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
  59. package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
  60. package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
  61. package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
  62. package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
  63. package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
  64. package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
  65. package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
  66. package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
  67. package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
  68. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
  69. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
  70. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
  71. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
  72. package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
  73. package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
  74. package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
  75. package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
  76. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
  77. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
  78. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
  79. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
  80. package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
  81. package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
  82. package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
  83. package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
  84. package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
  85. package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
  86. package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
  87. package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
  88. package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
  89. package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
  90. package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
  91. package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
  92. package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
  93. package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
  94. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
  95. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
  96. package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
  97. package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
  98. package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
  99. package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
  100. package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
  101. package/dist/sdk/firmachain/common/modules/index.js +101 -0
  102. package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
  103. package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
  104. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
  105. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
  106. package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
  107. package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
  108. package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
  109. package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
  110. package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
  111. package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
  112. package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
  113. package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
  114. package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
  115. package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
  116. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
  117. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
  118. package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
  119. package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
  120. package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
  121. package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
  122. package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
  123. package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
  124. package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
  125. package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
  126. package/dist/sdk/firmachain/common/search.d.ts +10 -0
  127. package/dist/sdk/firmachain/common/search.js +7 -0
  128. package/dist/sdk/firmachain/common/signing.d.ts +8 -3
  129. package/dist/sdk/firmachain/common/signing.js +24 -12
  130. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
  131. package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
  132. package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
  133. package/dist/sdk/firmachain/common/stargateclient.js +351 -35
  134. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
  135. package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
  136. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
  137. package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
  138. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
  139. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
  140. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
  141. package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
  142. package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
  143. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
  144. package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
  145. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
  146. package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
  147. package/dist/sdk/firmachain/gov/GovQueryClient.d.ts +13 -1
  148. package/dist/sdk/firmachain/gov/GovQueryClient.js +9 -2
  149. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +12 -0
  150. package/dist/sdk/firmachain/gov/GovTxClient.js +11 -1
  151. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
  152. package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
  153. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
  154. package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
  155. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +1 -0
  156. package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
  157. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
  158. package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
  159. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
  160. package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
  161. package/dist/test/00.wallet.test.js +15 -9
  162. package/dist/test/01.contract_tx.test.js +53 -45
  163. package/dist/test/02.contract_query.test.js +54 -31
  164. package/dist/test/03.contract_scenario.test.js +170 -326
  165. package/dist/test/04.bank_tx.test.js +58 -59
  166. package/dist/test/05.bank_query.test.js +51 -56
  167. package/dist/test/06.feegrant_tx.test.js +74 -89
  168. package/dist/test/07.feegrant_query.test.js +69 -27
  169. package/dist/test/08.gas_estimate.test.js +422 -392
  170. package/dist/test/09.ipfs.test.js +3 -3
  171. package/dist/test/10.nft_tx.test.js +108 -76
  172. package/dist/test/11.nft_query.test.js +41 -46
  173. package/dist/test/12.staking_tx.test.js +81 -98
  174. package/dist/test/13.staking_query.test.js +66 -12
  175. package/dist/test/14.distribution_tx.test.js +69 -78
  176. package/dist/test/15.distribution_query.test.js +81 -57
  177. package/dist/test/16.gov_tx.test.js +247 -107
  178. package/dist/test/17.gov_query.test.js +48 -9
  179. package/dist/test/18.util.test.js +6 -1
  180. package/dist/test/19.chain.test.js +50 -4
  181. package/dist/test/20.slashing_query.test.js +31 -1
  182. package/dist/test/21.token_tx.test.js +48 -56
  183. package/dist/test/22.token_query.test.js +24 -20
  184. package/dist/test/23.authz_tx.test.js +119 -240
  185. package/dist/test/24.authz_query.test.js +116 -56
  186. package/dist/test/25.cosmwasm_tx.test.js +95 -57
  187. package/dist/test/26.cosmwasm_query.test.js +66 -26
  188. package/dist/test/27.arbitary_sign.test.js +59 -67
  189. package/dist/test/28.ibc_tx.test.js +29 -17
  190. package/dist/test/29.mint_query.test.js +2 -0
  191. package/dist/test/30.cw20_tx.test.js +161 -226
  192. package/dist/test/31.cw20_query.test.js +183 -37
  193. package/dist/test/32.cw721_tx.test.js +147 -149
  194. package/dist/test/33.cw721_query.test.js +188 -36
  195. package/dist/test/34.cw_bridge_tx.test.js +266 -155
  196. package/dist/test/35.cw_bridge_tx_low.test.js +221 -81
  197. package/dist/test/36.cw_bridge_query.test.js +157 -21
  198. package/dist/test/37.cw_marketplace_tx.test.js +22 -22
  199. package/dist/test/38.cw_marketplace_query.test.js +9 -9
  200. package/dist/test/config_test.d.ts +10 -4
  201. package/dist/test/config_test.js +16 -9
  202. package/dist/test/config_test.sample.d.ts +11 -0
  203. package/dist/test/config_test.sample.js +14 -0
  204. package/package.json +9 -7
  205. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
  206. package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
@@ -35,15 +35,152 @@ 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
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
38
52
  Object.defineProperty(exports, "__esModule", { value: true });
39
- var FirmaConfig_1 = require("../sdk/FirmaConfig");
53
+ var chai_1 = require("chai");
54
+ var fs_1 = __importDefault(require("fs"));
55
+ var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
40
56
  var FirmaSDK_1 = require("../sdk/FirmaSDK");
57
+ var FirmaUtil_1 = require("../sdk/FirmaUtil");
58
+ var config_test_1 = require("./config_test");
41
59
  describe('[33. cw721 query Test]', function () {
42
60
  var firma;
61
+ var aliceWallet;
62
+ var bobWallet;
63
+ var aliceAddress;
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
+ };
43
98
  beforeEach(function () {
44
- firma = new FirmaSDK_1.FirmaSDK(FirmaConfig_1.FirmaConfig.TestNetConfig);
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ return __generator(this, function (_a) {
101
+ switch (_a.label) {
102
+ case 0:
103
+ firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
104
+ return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
105
+ case 1:
106
+ aliceWallet = _a.sent();
107
+ return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
108
+ case 2:
109
+ bobWallet = _a.sent();
110
+ return [4 /*yield*/, aliceWallet.getAddress()];
111
+ case 3:
112
+ aliceAddress = _a.sent();
113
+ return [4 /*yield*/, bobWallet.getAddress()];
114
+ case 4:
115
+ bobAddress = _a.sent();
116
+ return [2 /*return*/];
117
+ }
118
+ });
119
+ });
45
120
  });
46
- var contractAddress = "firma17uh2wj875vt64x7pzzy08slsl5pqupfln0vw2k79knfshygy6ausxth5d2";
121
+ var contractAddress = "";
122
+ var mintId = "";
123
+ it('cw721 setup query', function () { return __awaiter(void 0, void 0, void 0, function () {
124
+ var wasmFile, array, storeGas, storeFee, everyBodyAccessConfig, storeCodeResult, codeId, admin, label, instantiateGas, instantiateFee, noFunds, testData, instantiateResult, owner, new_token_id, new_token_uri, mintGas, mintFee, mintResult, expires, token_id, approveGas, approveFee, approveResult;
125
+ return __generator(this, function (_a) {
126
+ switch (_a.label) {
127
+ case 0:
128
+ wasmFile = fs_1.default.readFileSync("./test/sample/cw721_base.wasm");
129
+ array = new Uint8Array(wasmFile.buffer);
130
+ storeGas = 3000000;
131
+ storeFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
132
+ everyBodyAccessConfig = {
133
+ permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
134
+ address: "",
135
+ addresses: []
136
+ };
137
+ return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: storeGas, fee: storeFee })];
138
+ case 1:
139
+ storeCodeResult = _a.sent();
140
+ codeId = extractValue(storeCodeResult.events, "store_code", "code_id");
141
+ chai_1.expect(storeCodeResult.code).to.be.equal(0);
142
+ return [4 /*yield*/, aliceWallet.getAddress()];
143
+ case 2:
144
+ admin = _a.sent();
145
+ label = "test1";
146
+ instantiateGas = 3000000;
147
+ instantiateFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
148
+ noFunds = [];
149
+ testData = JSON.stringify({
150
+ minter: aliceAddress,
151
+ name: "My Awesome NFT Collection",
152
+ symbol: "MAWESOME"
153
+ });
154
+ return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: instantiateGas, fee: instantiateFee })];
155
+ case 3:
156
+ instantiateResult = _a.sent();
157
+ contractAddress = extractValue(instantiateResult.events, "instantiate", "_contract_address");
158
+ chai_1.expect(instantiateResult.code).to.be.equal(0);
159
+ owner = aliceAddress;
160
+ new_token_id = "1";
161
+ new_token_uri = "https://meta.nft.io/uri/" + new_token_id;
162
+ return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, contractAddress, owner, new_token_id, new_token_uri)];
163
+ case 4:
164
+ mintGas = _a.sent();
165
+ mintFee = Math.ceil(mintGas * 0.1);
166
+ return [4 /*yield*/, firma.Cw721.mint(aliceWallet, contractAddress, owner, new_token_id, new_token_uri, { gas: mintGas, fee: mintFee })];
167
+ case 5:
168
+ mintResult = _a.sent();
169
+ chai_1.expect(mintResult.code).to.be.equal(0);
170
+ expires = { never: {} };
171
+ token_id = "1";
172
+ return [4 /*yield*/, firma.Cw721.getGasEstimationApprove(aliceWallet, contractAddress, bobAddress, token_id, expires)];
173
+ case 6:
174
+ approveGas = _a.sent();
175
+ approveFee = Math.ceil(approveGas * 0.1);
176
+ return [4 /*yield*/, firma.Cw721.approve(aliceWallet, contractAddress, bobAddress, token_id, expires, { gas: approveGas, fee: approveFee })];
177
+ case 7:
178
+ approveResult = _a.sent();
179
+ chai_1.expect(approveResult.code).to.be.equal(0);
180
+ return [2 /*return*/];
181
+ }
182
+ });
183
+ }); });
47
184
  it('cw721 getOwnerFromNftID', function () { return __awaiter(void 0, void 0, void 0, function () {
48
185
  var tokenId, owner;
49
186
  return __generator(this, function (_a) {
@@ -53,30 +190,39 @@ describe('[33. cw721 query Test]', function () {
53
190
  return [4 /*yield*/, firma.Cw721.getOwnerFromNftID(contractAddress, tokenId)];
54
191
  case 1:
55
192
  owner = _a.sent();
56
- console.log(owner);
193
+ chai_1.expect(owner).to.be.a('string');
194
+ chai_1.expect(owner.length).to.be.greaterThan(0);
57
195
  return [2 /*return*/];
58
196
  }
59
197
  });
60
198
  }); });
61
199
  it('cw721 approval', function () { return __awaiter(void 0, void 0, void 0, function () {
62
- var tokenId, spender, isIncludeExpired, approval, expires;
200
+ var tokenId, isIncludeExpired, approval, error_1;
63
201
  return __generator(this, function (_a) {
64
202
  switch (_a.label) {
65
203
  case 0:
66
204
  tokenId = "1";
67
- spender = "firma1lkly7qj4w2la2xxlatrtw6wynz8vxkctjlqkch";
68
205
  isIncludeExpired = true;
69
- return [4 /*yield*/, firma.Cw721.getApproval(contractAddress, tokenId, spender, isIncludeExpired)];
206
+ _a.label = 1;
70
207
  case 1:
208
+ _a.trys.push([1, 3, , 4]);
209
+ return [4 /*yield*/, firma.Cw721.getApproval(contractAddress, tokenId, bobAddress, isIncludeExpired)];
210
+ case 2:
71
211
  approval = _a.sent();
72
- expires = approval.expires;
73
- console.log(expires);
74
- return [2 /*return*/];
212
+ chai_1.expect(approval).to.be.an('object');
213
+ chai_1.expect(approval).to.have.property('spender');
214
+ chai_1.expect(approval).to.have.property('expires');
215
+ return [3 /*break*/, 4];
216
+ case 3:
217
+ error_1 = _a.sent();
218
+ chai_1.expect(error_1).to.exist;
219
+ return [3 /*break*/, 4];
220
+ case 4: return [2 /*return*/];
75
221
  }
76
222
  });
77
223
  }); });
78
224
  it('cw721 approvals', function () { return __awaiter(void 0, void 0, void 0, function () {
79
- var tokenId, isIncludeExpired, approvals, i, approval, expires;
225
+ var tokenId, isIncludeExpired, approvals;
80
226
  return __generator(this, function (_a) {
81
227
  switch (_a.label) {
82
228
  case 0:
@@ -85,27 +231,25 @@ describe('[33. cw721 query Test]', function () {
85
231
  return [4 /*yield*/, firma.Cw721.getApprovals(contractAddress, tokenId, isIncludeExpired)];
86
232
  case 1:
87
233
  approvals = _a.sent();
88
- //console.log(approvals);
89
- for (i = 0; i < approvals.length; i++) {
90
- approval = approvals[i];
91
- expires = approval.expires;
92
- console.log(approval.spender);
93
- console.log(expires);
234
+ chai_1.expect(approvals).to.be.an('array');
235
+ if (approvals.length > 0) {
236
+ chai_1.expect(approvals[0]).to.have.property('spender');
237
+ chai_1.expect(approvals[0]).to.have.property('expires');
94
238
  }
95
239
  return [2 /*return*/];
96
240
  }
97
241
  });
98
242
  }); });
99
243
  it('cw721 getAllOperators', function () { return __awaiter(void 0, void 0, void 0, function () {
100
- var owner, isIncludeExpired, operators;
244
+ var isIncludeExpired, operators;
101
245
  return __generator(this, function (_a) {
102
246
  switch (_a.label) {
103
247
  case 0:
104
- owner = "firma13hcgnwfpe99htsr92v2keqsgx909rhkwfnxgwr";
105
248
  isIncludeExpired = false;
106
- return [4 /*yield*/, firma.Cw721.getAllOperators(contractAddress, owner, isIncludeExpired)];
249
+ return [4 /*yield*/, firma.Cw721.getAllOperators(contractAddress, aliceAddress, isIncludeExpired)];
107
250
  case 1:
108
251
  operators = _a.sent();
252
+ chai_1.expect(operators).to.be.an('array');
109
253
  return [2 /*return*/];
110
254
  }
111
255
  });
@@ -117,6 +261,7 @@ describe('[33. cw721 query Test]', function () {
117
261
  case 0: return [4 /*yield*/, firma.Cw721.getTotalNfts(contractAddress)];
118
262
  case 1:
119
263
  total = _a.sent();
264
+ chai_1.expect(total).to.be.at.least(0);
120
265
  return [2 /*return*/];
121
266
  }
122
267
  });
@@ -128,6 +273,9 @@ describe('[33. cw721 query Test]', function () {
128
273
  case 0: return [4 /*yield*/, firma.Cw721.getContractInfo(contractAddress)];
129
274
  case 1:
130
275
  contractInfo = _a.sent();
276
+ chai_1.expect(contractInfo).to.be.an('object');
277
+ chai_1.expect(contractInfo).to.have.property('name');
278
+ chai_1.expect(contractInfo).to.have.property('symbol');
131
279
  return [2 /*return*/];
132
280
  }
133
281
  });
@@ -141,6 +289,7 @@ describe('[33. cw721 query Test]', function () {
141
289
  return [4 /*yield*/, firma.Cw721.getNftTokenUri(contractAddress, tokenId)];
142
290
  case 1:
143
291
  nftInfo = _a.sent();
292
+ chai_1.expect(nftInfo).to.be.a('string');
144
293
  return [2 /*return*/];
145
294
  }
146
295
  });
@@ -154,20 +303,25 @@ describe('[33. cw721 query Test]', function () {
154
303
  return [4 /*yield*/, firma.Cw721.getNftData(contractAddress, tokenId)];
155
304
  case 1:
156
305
  nftInfo = _a.sent();
306
+ chai_1.expect(nftInfo).to.have.property('access');
307
+ chai_1.expect(nftInfo.access).to.have.property('owner');
308
+ chai_1.expect(nftInfo.access).to.have.property('approvals');
309
+ chai_1.expect(nftInfo.access.approvals).to.be.an('array');
310
+ chai_1.expect(nftInfo).to.have.property('info');
311
+ chai_1.expect(nftInfo.info).to.have.property('token_uri');
312
+ chai_1.expect(nftInfo.info).to.have.property('extension');
157
313
  return [2 /*return*/];
158
314
  }
159
315
  });
160
316
  }); });
161
317
  it('cw721 getNFTIdListOfOwner', function () { return __awaiter(void 0, void 0, void 0, function () {
162
- var owner, nftIdList;
318
+ var nftIdList;
163
319
  return __generator(this, function (_a) {
164
320
  switch (_a.label) {
165
- case 0:
166
- owner = "firma13hcgnwfpe99htsr92v2keqsgx909rhkwfnxgwr";
167
- return [4 /*yield*/, firma.Cw721.getNFTIdListOfOwner(contractAddress, owner)];
321
+ case 0: return [4 /*yield*/, firma.Cw721.getNFTIdListOfOwner(contractAddress, aliceAddress)];
168
322
  case 1:
169
323
  nftIdList = _a.sent();
170
- console.log(nftIdList);
324
+ chai_1.expect(nftIdList).to.be.an('array');
171
325
  return [2 /*return*/];
172
326
  }
173
327
  });
@@ -179,6 +333,7 @@ describe('[33. cw721 query Test]', function () {
179
333
  case 0: return [4 /*yield*/, firma.Cw721.getAllNftIdList(contractAddress)];
180
334
  case 1:
181
335
  nftIdList = _a.sent();
336
+ chai_1.expect(nftIdList).to.be.an('array');
182
337
  return [2 /*return*/];
183
338
  }
184
339
  });
@@ -190,17 +345,7 @@ describe('[33. cw721 query Test]', function () {
190
345
  case 0: return [4 /*yield*/, firma.Cw721.getMinter(contractAddress)];
191
346
  case 1:
192
347
  minter = _a.sent();
193
- return [2 /*return*/];
194
- }
195
- });
196
- }); });
197
- it('cw721 getExtension', function () { return __awaiter(void 0, void 0, void 0, function () {
198
- var extension;
199
- return __generator(this, function (_a) {
200
- switch (_a.label) {
201
- case 0: return [4 /*yield*/, firma.Cw721.getExtension(contractAddress)];
202
- case 1:
203
- extension = _a.sent();
348
+ chai_1.expect(minter).to.be.a('string');
204
349
  return [2 /*return*/];
205
350
  }
206
351
  });
@@ -212,8 +357,15 @@ describe('[33. cw721 query Test]', function () {
212
357
  case 0: return [4 /*yield*/, firma.Cw721.getOwnerShip(contractAddress)];
213
358
  case 1:
214
359
  data = _a.sent();
360
+ chai_1.expect(data).to.be.an('object');
361
+ chai_1.expect(data).to.have.property('owner');
215
362
  return [2 /*return*/];
216
363
  }
217
364
  });
218
365
  }); });
366
+ // it('cw721 getExtension', async () => {
367
+ // // not use
368
+ // const extension = await firma.Cw721.getExtension(contractAddress);
369
+ // expect(extension).to.be.an('object');
370
+ // });
219
371
  });