@firmachain/firma-js 0.2.62 → 0.3.0-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.
Files changed (243) hide show
  1. package/README.md +4 -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 +31 -13
  8. package/dist/sdk/FirmaCosmWasmCw721.js +25 -0
  9. package/dist/sdk/FirmaCosmWasmCwBridge.d.ts +9 -9
  10. package/dist/sdk/FirmaCosmWasmCwMarketplace.d.ts +8 -8
  11. package/dist/sdk/FirmaCosmWasmService.d.ts +8 -8
  12. package/dist/sdk/FirmaCosmWasmService.js +2 -3
  13. package/dist/sdk/FirmaDistributionService.d.ts +6 -6
  14. package/dist/sdk/FirmaFeeGrantService.d.ts +4 -4
  15. package/dist/sdk/FirmaGovService.d.ts +12 -9
  16. package/dist/sdk/FirmaGovService.js +162 -97
  17. package/dist/sdk/FirmaIbcService.d.ts +3 -4
  18. package/dist/sdk/FirmaIbcService.js +5 -2
  19. package/dist/sdk/FirmaNftService.d.ts +5 -5
  20. package/dist/sdk/FirmaStakingService.d.ts +6 -6
  21. package/dist/sdk/FirmaTokenService.d.ts +5 -5
  22. package/dist/sdk/FirmaUtil.d.ts +1 -1
  23. package/dist/sdk/FirmaUtil.js +12 -14
  24. package/dist/sdk/firmachain/amino/addresses.js +1 -1
  25. package/dist/sdk/firmachain/amino/aminomsgs.d.ts +10 -0
  26. package/dist/sdk/firmachain/amino/aminomsgs.js +5 -1
  27. package/dist/sdk/firmachain/amino/aminotypes.js +27 -10
  28. package/dist/sdk/firmachain/amino/coins.d.ts +14 -2
  29. package/dist/sdk/firmachain/amino/coins.js +26 -5
  30. package/dist/sdk/firmachain/amino/encoding.d.ts +10 -1
  31. package/dist/sdk/firmachain/amino/encoding.js +21 -3
  32. package/dist/sdk/firmachain/amino/signdoc.d.ts +21 -3
  33. package/dist/sdk/firmachain/amino/signdoc.js +37 -11
  34. package/dist/sdk/firmachain/amino/signer.d.ts +2 -1
  35. package/dist/sdk/firmachain/authz/AuthzTxTypes.d.ts +7 -6
  36. package/dist/sdk/firmachain/authz/AuthzTxTypes.js +7 -6
  37. package/dist/sdk/firmachain/bank/BankQueryClient.js +1 -1
  38. package/dist/sdk/firmachain/common/CommonTxClient.js +11 -9
  39. package/dist/sdk/firmachain/common/ITxClient.d.ts +6 -6
  40. package/dist/sdk/firmachain/common/ITxClient.js +82 -24
  41. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.d.ts +4 -9
  42. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +37 -32
  43. package/dist/sdk/firmachain/common/LedgerWallet.js +4 -8
  44. package/dist/sdk/firmachain/common/TxCommon.d.ts +1 -2
  45. package/dist/sdk/firmachain/common/accounts.d.ts +7 -3
  46. package/dist/sdk/firmachain/common/accounts.js +28 -33
  47. package/dist/sdk/firmachain/common/aminotypes.d.ts +19 -0
  48. package/dist/sdk/firmachain/common/aminotypes.js +74 -0
  49. package/dist/sdk/firmachain/common/events.d.ts +32 -0
  50. package/dist/sdk/firmachain/common/events.js +18 -0
  51. package/dist/sdk/firmachain/common/fee.d.ts +26 -0
  52. package/dist/sdk/firmachain/common/fee.js +83 -0
  53. package/dist/sdk/firmachain/common/index.d.ts +1 -0
  54. package/dist/sdk/firmachain/common/index.js +3 -0
  55. package/dist/sdk/firmachain/common/modules/auth/queries.d.ts +15 -0
  56. package/dist/sdk/firmachain/common/modules/auth/queries.js +64 -0
  57. package/dist/sdk/firmachain/common/modules/authz/aminomessages.d.ts +2 -0
  58. package/dist/sdk/firmachain/common/modules/authz/aminomessages.js +15 -0
  59. package/dist/sdk/firmachain/common/modules/authz/messages.d.ts +2 -0
  60. package/dist/sdk/firmachain/common/modules/authz/messages.js +9 -0
  61. package/dist/sdk/firmachain/common/modules/authz/queries.d.ts +10 -0
  62. package/dist/sdk/firmachain/common/modules/authz/queries.js +88 -0
  63. package/dist/sdk/firmachain/common/modules/bank/aminomessages.d.ts +35 -0
  64. package/dist/sdk/firmachain/common/modules/bank/aminomessages.js +85 -0
  65. package/dist/sdk/firmachain/common/modules/bank/messages.d.ts +8 -0
  66. package/dist/sdk/firmachain/common/modules/bank/messages.js +12 -0
  67. package/dist/sdk/firmachain/common/modules/bank/queries.d.ts +15 -0
  68. package/dist/sdk/firmachain/common/modules/bank/queries.js +128 -0
  69. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.d.ts +14 -0
  70. package/dist/sdk/firmachain/common/modules/crisis/aminomessages.js +11 -0
  71. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.d.ts +44 -0
  72. package/dist/sdk/firmachain/common/modules/distribution/aminomessages.js +113 -0
  73. package/dist/sdk/firmachain/common/modules/distribution/messages.d.ts +8 -0
  74. package/dist/sdk/firmachain/common/modules/distribution/messages.js +15 -0
  75. package/dist/sdk/firmachain/common/modules/distribution/queries.d.ts +16 -0
  76. package/dist/sdk/firmachain/common/modules/distribution/queries.js +171 -0
  77. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.d.ts +18 -0
  78. package/dist/sdk/firmachain/common/modules/evidence/aminomessages.js +11 -0
  79. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.d.ts +2 -0
  80. package/dist/sdk/firmachain/common/modules/feegrant/aminomessages.js +14 -0
  81. package/dist/sdk/firmachain/common/modules/feegrant/messages.d.ts +2 -0
  82. package/dist/sdk/firmachain/common/modules/feegrant/messages.js +8 -0
  83. package/dist/sdk/firmachain/common/modules/feegrant/queries.d.ts +9 -0
  84. package/dist/sdk/firmachain/common/modules/feegrant/queries.js +81 -0
  85. package/dist/sdk/firmachain/common/modules/gov/aminomessages.d.ts +79 -0
  86. package/dist/sdk/firmachain/common/modules/gov/aminomessages.js +152 -0
  87. package/dist/sdk/firmachain/common/modules/gov/messages.d.ts +29 -0
  88. package/dist/sdk/firmachain/common/modules/gov/messages.js +38 -0
  89. package/dist/sdk/firmachain/common/modules/gov/queries.d.ts +19 -0
  90. package/dist/sdk/firmachain/common/modules/gov/queries.js +160 -0
  91. package/dist/sdk/firmachain/common/modules/group/aminomessages.d.ts +2 -0
  92. package/dist/sdk/firmachain/common/modules/group/aminomessages.js +8 -0
  93. package/dist/sdk/firmachain/common/modules/group/messages.d.ts +2 -0
  94. package/dist/sdk/firmachain/common/modules/group/messages.js +28 -0
  95. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.d.ts +38 -0
  96. package/dist/sdk/firmachain/common/modules/ibc/aminomessages.js +55 -0
  97. package/dist/sdk/firmachain/common/modules/ibc/messages.d.ts +8 -0
  98. package/dist/sdk/firmachain/common/modules/ibc/messages.js +32 -0
  99. package/dist/sdk/firmachain/common/modules/ibc/queries.d.ts +58 -0
  100. package/dist/sdk/firmachain/common/modules/ibc/queries.js +576 -0
  101. package/dist/sdk/firmachain/common/modules/index.d.ts +32 -0
  102. package/dist/sdk/firmachain/common/modules/index.js +101 -0
  103. package/dist/sdk/firmachain/common/modules/mint/queries.d.ts +21 -0
  104. package/dist/sdk/firmachain/common/modules/mint/queries.js +95 -0
  105. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.d.ts +12 -0
  106. package/dist/sdk/firmachain/common/modules/slashing/aminomessages.js +11 -0
  107. package/dist/sdk/firmachain/common/modules/slashing/queries.d.ts +10 -0
  108. package/dist/sdk/firmachain/common/modules/slashing/queries.js +88 -0
  109. package/dist/sdk/firmachain/common/modules/staking/aminomessages.d.ts +112 -0
  110. package/dist/sdk/firmachain/common/modules/staking/aminomessages.js +234 -0
  111. package/dist/sdk/firmachain/common/modules/staking/messages.d.ts +33 -0
  112. package/dist/sdk/firmachain/common/modules/staking/messages.js +37 -0
  113. package/dist/sdk/firmachain/common/modules/staking/queries.d.ts +23 -0
  114. package/dist/sdk/firmachain/common/modules/staking/queries.js +242 -0
  115. package/dist/sdk/firmachain/common/modules/tx/queries.d.ts +11 -0
  116. package/dist/sdk/firmachain/common/modules/tx/queries.js +103 -0
  117. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.d.ts +16 -0
  118. package/dist/sdk/firmachain/common/modules/vesting/aminomessages.js +56 -0
  119. package/dist/sdk/firmachain/common/modules/vesting/messages.d.ts +2 -0
  120. package/dist/sdk/firmachain/common/modules/vesting/messages.js +7 -0
  121. package/dist/sdk/firmachain/common/queryclient/index.d.ts +2 -0
  122. package/dist/sdk/firmachain/common/queryclient/index.js +10 -0
  123. package/dist/sdk/firmachain/common/queryclient/queryclient.d.ts +75 -0
  124. package/dist/sdk/firmachain/common/queryclient/queryclient.js +157 -0
  125. package/dist/sdk/firmachain/common/queryclient/utils.d.ts +33 -0
  126. package/dist/sdk/firmachain/common/queryclient/utils.js +101 -0
  127. package/dist/sdk/firmachain/common/search.d.ts +10 -0
  128. package/dist/sdk/firmachain/common/search.js +7 -0
  129. package/dist/sdk/firmachain/common/signing.d.ts +8 -3
  130. package/dist/sdk/firmachain/common/signing.js +24 -12
  131. package/dist/sdk/firmachain/common/signingstargateclient.d.ts +107 -30
  132. package/dist/sdk/firmachain/common/signingstargateclient.js +445 -128
  133. package/dist/sdk/firmachain/common/stargateclient.d.ts +184 -20
  134. package/dist/sdk/firmachain/common/stargateclient.js +351 -35
  135. package/dist/sdk/firmachain/contract/ContractTxClient.d.ts +2 -2
  136. package/dist/sdk/firmachain/contract/ContractTxClient.js +4 -4
  137. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +1 -1
  138. package/dist/sdk/firmachain/contract/ContractTxTypes.js +3 -3
  139. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +1 -1
  140. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +5 -5
  141. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.js +10 -8
  142. package/dist/sdk/firmachain/google/protobuf/any.d.ts +3 -2
  143. package/dist/sdk/firmachain/google/protobuf/any.js +2 -1
  144. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +3 -2
  145. package/dist/sdk/firmachain/google/protobuf/duration.js +2 -1
  146. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +3 -2
  147. package/dist/sdk/firmachain/google/protobuf/timestamp.js +2 -1
  148. package/dist/sdk/firmachain/gov/GovTxClient.d.ts +6 -0
  149. package/dist/sdk/firmachain/gov/GovTxClient.js +6 -1
  150. package/dist/sdk/firmachain/nft/NftTxClient.d.ts +3 -3
  151. package/dist/sdk/firmachain/nft/NftTxClient.js +6 -6
  152. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +1 -1
  153. package/dist/sdk/firmachain/nft/NftTxTypes.js +4 -4
  154. package/dist/sdk/firmachain/staking/StakingQueryClient.js +0 -1
  155. package/dist/sdk/firmachain/token/TokenTxClient.d.ts +4 -4
  156. package/dist/sdk/firmachain/token/TokenTxClient.js +8 -8
  157. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +1 -1
  158. package/dist/sdk/firmachain/token/TokenTxTypes.js +5 -5
  159. package/dist/test/00.wallet.test.d.ts +1 -0
  160. package/dist/test/00.wallet.test.js +96 -0
  161. package/dist/test/01.contract_tx.test.d.ts +1 -0
  162. package/dist/test/01.contract_tx.test.js +157 -0
  163. package/dist/test/02.contract_query.test.d.ts +1 -0
  164. package/dist/test/02.contract_query.test.js +245 -0
  165. package/dist/test/03.contract_scenario.test.d.ts +1 -0
  166. package/dist/test/03.contract_scenario.test.js +406 -0
  167. package/dist/test/04.bank_tx.test.d.ts +1 -0
  168. package/dist/test/04.bank_tx.test.js +126 -0
  169. package/dist/test/05.bank_query.test.d.ts +1 -0
  170. package/dist/test/05.bank_query.test.js +162 -0
  171. package/dist/test/06.feegrant_tx.test.d.ts +1 -0
  172. package/dist/test/06.feegrant_tx.test.js +161 -0
  173. package/dist/test/07.feegrant_query.test.d.ts +1 -0
  174. package/dist/test/07.feegrant_query.test.js +126 -0
  175. package/dist/test/08.gas_estimate.test.d.ts +1 -0
  176. package/dist/test/08.gas_estimate.test.js +675 -0
  177. package/dist/test/09.ipfs.test.d.ts +1 -0
  178. package/dist/test/09.ipfs.test.js +72 -0
  179. package/dist/test/10.nft_tx.test.d.ts +1 -0
  180. package/dist/test/10.nft_tx.test.js +209 -0
  181. package/dist/test/11.nft_query.test.d.ts +1 -0
  182. package/dist/test/11.nft_query.test.js +165 -0
  183. package/dist/test/12.staking_tx.test.d.ts +1 -0
  184. package/dist/test/12.staking_tx.test.js +199 -0
  185. package/dist/test/13.staking_query.test.d.ts +1 -0
  186. package/dist/test/13.staking_query.test.js +263 -0
  187. package/dist/test/14.distribution_tx.test.d.ts +1 -0
  188. package/dist/test/14.distribution_tx.test.js +170 -0
  189. package/dist/test/15.distribution_query.test.d.ts +1 -0
  190. package/dist/test/15.distribution_query.test.js +243 -0
  191. package/dist/test/16.gov_tx.test.d.ts +1 -0
  192. package/dist/test/16.gov_tx.test.js +311 -0
  193. package/dist/test/17.gov_query.test.d.ts +1 -0
  194. package/dist/test/17.gov_query.test.js +157 -0
  195. package/dist/test/18.util.test.d.ts +1 -0
  196. package/dist/test/18.util.test.js +251 -0
  197. package/dist/test/19.chain.test.d.ts +1 -0
  198. package/dist/test/19.chain.test.js +127 -0
  199. package/dist/test/20.slashing_query.test.d.ts +1 -0
  200. package/dist/test/20.slashing_query.test.js +112 -0
  201. package/dist/test/21.token_tx.test.d.ts +1 -0
  202. package/dist/test/21.token_tx.test.js +149 -0
  203. package/dist/test/22.token_query.test.d.ts +1 -0
  204. package/dist/test/22.token_query.test.js +103 -0
  205. package/dist/test/23.authz_tx.test.d.ts +1 -0
  206. package/dist/test/23.authz_tx.test.js +350 -0
  207. package/dist/test/24.authz_query.test.d.ts +1 -0
  208. package/dist/test/24.authz_query.test.js +203 -0
  209. package/dist/test/25.cosmwasm_tx.test.d.ts +1 -0
  210. package/dist/test/25.cosmwasm_tx.test.js +229 -0
  211. package/dist/test/26.cosmwasm_query.test.d.ts +1 -0
  212. package/dist/test/26.cosmwasm_query.test.js +209 -0
  213. package/dist/test/27.arbitary_sign.test.d.ts +1 -0
  214. package/dist/test/27.arbitary_sign.test.js +159 -0
  215. package/dist/test/28.ibc_tx.test.d.ts +1 -0
  216. package/dist/test/28.ibc_tx.test.js +98 -0
  217. package/dist/test/29.mint_query.test.d.ts +1 -0
  218. package/dist/test/29.mint_query.test.js +59 -0
  219. package/dist/test/30.cw20_tx.test.d.ts +1 -0
  220. package/dist/test/30.cw20_tx.test.js +450 -0
  221. package/dist/test/31.cw20_query.test.d.ts +1 -0
  222. package/dist/test/31.cw20_query.test.js +333 -0
  223. package/dist/test/32.cw721_tx.test.d.ts +1 -0
  224. package/dist/test/32.cw721_tx.test.js +431 -0
  225. package/dist/test/33.cw721_query.test.d.ts +1 -0
  226. package/dist/test/33.cw721_query.test.js +371 -0
  227. package/dist/test/34.cw_bridge_tx.test.d.ts +1 -0
  228. package/dist/test/34.cw_bridge_tx.test.js +476 -0
  229. package/dist/test/35.cw_bridge_tx_low.test.d.ts +1 -0
  230. package/dist/test/35.cw_bridge_tx_low.test.js +398 -0
  231. package/dist/test/36.cw_bridge_query.test.d.ts +1 -0
  232. package/dist/test/36.cw_bridge_query.test.js +318 -0
  233. package/dist/test/37.cw_marketplace_tx.test.d.ts +1 -0
  234. package/dist/test/37.cw_marketplace_tx.test.js +794 -0
  235. package/dist/test/38.cw_marketplace_query.test.d.ts +1 -0
  236. package/dist/test/38.cw_marketplace_query.test.js +128 -0
  237. package/dist/test/config_test.d.ts +11 -0
  238. package/dist/test/config_test.js +29 -0
  239. package/dist/test/config_test.sample.d.ts +5 -0
  240. package/dist/test/config_test.sample.js +8 -0
  241. package/package.json +9 -7
  242. package/dist/sdk/firmachain/common/signingaminostargateclient.d.ts +0 -50
  243. package/dist/sdk/firmachain/common/signingaminostargateclient.js +0 -267
@@ -0,0 +1,333 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
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
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
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
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ var chai_1 = require("chai");
54
+ var fs_1 = __importDefault(require("fs"));
55
+ var FirmaSDK_1 = require("../sdk/FirmaSDK");
56
+ var config_test_1 = require("./config_test");
57
+ var FirmaUtil_1 = require("../sdk/FirmaUtil");
58
+ var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
59
+ describe('[31. cw20 query Test]', function () {
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
+ };
98
+ beforeEach(function () {
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
+ });
120
+ });
121
+ var contractAddress = "";
122
+ it('Cw20 setup query ', function () { return __awaiter(void 0, void 0, void 0, function () {
123
+ var wasmFile, array, storeCodeGas, storeCodeFee, everyBodyAccessConfig, storeCodeResult, codeId, admin, label, instantiateGas, instantiateFee, noFunds, testData, result;
124
+ return __generator(this, function (_a) {
125
+ switch (_a.label) {
126
+ case 0:
127
+ wasmFile = fs_1.default.readFileSync("./test/sample/cw20_base.wasm");
128
+ array = new Uint8Array(wasmFile.buffer);
129
+ storeCodeGas = 3000000;
130
+ storeCodeFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
131
+ everyBodyAccessConfig = {
132
+ permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
133
+ address: "",
134
+ addresses: []
135
+ };
136
+ return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: storeCodeGas, fee: storeCodeFee })];
137
+ case 1:
138
+ storeCodeResult = _a.sent();
139
+ codeId = extractValue(storeCodeResult.events, "store_code", "code_id");
140
+ chai_1.expect(storeCodeResult.code).to.be.equal(0);
141
+ return [4 /*yield*/, aliceWallet.getAddress()];
142
+ case 2:
143
+ admin = _a.sent();
144
+ label = "test1";
145
+ instantiateGas = 3000000;
146
+ instantiateFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
147
+ noFunds = [];
148
+ testData = JSON.stringify({
149
+ decimals: 6,
150
+ name: "MyToken",
151
+ symbol: "MTK",
152
+ initial_balances: [
153
+ {
154
+ address: aliceAddress,
155
+ amount: "1000000"
156
+ }
157
+ ],
158
+ // mint is optional
159
+ mint: {
160
+ minter: aliceAddress,
161
+ cap: "10000000"
162
+ },
163
+ // marketing is optional
164
+ marketing: {
165
+ description: "MyToken's description is like this.",
166
+ logo: {
167
+ "url": "https://example.com/mytoken-logo.png"
168
+ },
169
+ marketing: aliceAddress,
170
+ project: "https://mytokenproject.com"
171
+ }
172
+ });
173
+ return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: instantiateGas, fee: instantiateFee })];
174
+ case 3:
175
+ result = _a.sent();
176
+ contractAddress = extractValue(result.events, "instantiate", "_contract_address");
177
+ chai_1.expect(result.code).to.be.equal(0);
178
+ return [2 /*return*/];
179
+ }
180
+ });
181
+ }); });
182
+ it('Cw20 getBalance', function () { return __awaiter(void 0, void 0, void 0, function () {
183
+ var balance;
184
+ return __generator(this, function (_a) {
185
+ switch (_a.label) {
186
+ case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
187
+ case 1:
188
+ balance = _a.sent();
189
+ chai_1.expect(balance).to.be.a('string');
190
+ chai_1.expect(Number(balance)).to.be.at.least(0);
191
+ return [2 /*return*/];
192
+ }
193
+ });
194
+ }); });
195
+ it('Cw20 getBalance - no balance', function () { return __awaiter(void 0, void 0, void 0, function () {
196
+ var nobalance_address, balance;
197
+ return __generator(this, function (_a) {
198
+ switch (_a.label) {
199
+ case 0:
200
+ nobalance_address = "firma1d84pmnumnsh80v74lta0vnpd476ncp4pjnuklr";
201
+ return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, nobalance_address)];
202
+ case 1:
203
+ balance = _a.sent();
204
+ chai_1.expect(balance).to.be.a('string');
205
+ chai_1.expect(Number(balance)).to.equal(0);
206
+ return [2 /*return*/];
207
+ }
208
+ });
209
+ }); });
210
+ it('Cw20 getTotalSupply', function () { return __awaiter(void 0, void 0, void 0, function () {
211
+ var totalSupply;
212
+ return __generator(this, function (_a) {
213
+ switch (_a.label) {
214
+ case 0: return [4 /*yield*/, firma.Cw20.getTotalSupply(contractAddress)];
215
+ case 1:
216
+ totalSupply = _a.sent();
217
+ chai_1.expect(totalSupply).to.be.a('string');
218
+ chai_1.expect(Number(totalSupply)).to.be.at.least(0);
219
+ return [2 /*return*/];
220
+ }
221
+ });
222
+ }); });
223
+ it('Cw20 getTokenInfo', function () { return __awaiter(void 0, void 0, void 0, function () {
224
+ var tokenInfo;
225
+ return __generator(this, function (_a) {
226
+ switch (_a.label) {
227
+ case 0: return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
228
+ case 1:
229
+ tokenInfo = _a.sent();
230
+ chai_1.expect(tokenInfo).to.be.an('object');
231
+ chai_1.expect(tokenInfo).to.have.property('name');
232
+ chai_1.expect(tokenInfo).to.have.property('symbol');
233
+ chai_1.expect(tokenInfo).to.have.property('decimals');
234
+ chai_1.expect(tokenInfo).to.have.property('total_supply');
235
+ return [2 /*return*/];
236
+ }
237
+ });
238
+ }); });
239
+ it('Cw20 getMinter', function () { return __awaiter(void 0, void 0, void 0, function () {
240
+ var minter;
241
+ return __generator(this, function (_a) {
242
+ switch (_a.label) {
243
+ case 0: return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
244
+ case 1:
245
+ minter = _a.sent();
246
+ chai_1.expect(minter).to.be.an('object');
247
+ chai_1.expect(minter).to.have.property('minter');
248
+ return [2 /*return*/];
249
+ }
250
+ });
251
+ }); });
252
+ it('Cw20 getAllowance', function () { return __awaiter(void 0, void 0, void 0, function () {
253
+ var info;
254
+ return __generator(this, function (_a) {
255
+ switch (_a.label) {
256
+ case 0: return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
257
+ case 1:
258
+ info = _a.sent();
259
+ chai_1.expect(info).to.be.an('object');
260
+ chai_1.expect(info).to.have.property('allowance');
261
+ chai_1.expect(info).to.have.property('expires');
262
+ return [2 /*return*/];
263
+ }
264
+ });
265
+ }); });
266
+ it('Cw20 getAllAllowances', function () { return __awaiter(void 0, void 0, void 0, function () {
267
+ var info;
268
+ return __generator(this, function (_a) {
269
+ switch (_a.label) {
270
+ case 0: return [4 /*yield*/, firma.Cw20.getAllAllowances(contractAddress, aliceAddress)];
271
+ case 1:
272
+ info = _a.sent();
273
+ chai_1.expect(info).to.be.an('array');
274
+ return [2 /*return*/];
275
+ }
276
+ });
277
+ }); });
278
+ it('Cw20 getAllSpenderAllowances', function () { return __awaiter(void 0, void 0, void 0, function () {
279
+ var info;
280
+ return __generator(this, function (_a) {
281
+ switch (_a.label) {
282
+ case 0: return [4 /*yield*/, firma.Cw20.getAllSpenderAllowances(contractAddress, bobAddress)];
283
+ case 1:
284
+ info = _a.sent();
285
+ chai_1.expect(info).to.be.an('array');
286
+ return [2 /*return*/];
287
+ }
288
+ });
289
+ }); });
290
+ it('Cw20 getAllAccounts', function () { return __awaiter(void 0, void 0, void 0, function () {
291
+ var info;
292
+ return __generator(this, function (_a) {
293
+ switch (_a.label) {
294
+ case 0: return [4 /*yield*/, firma.Cw20.getAllAccounts(contractAddress)];
295
+ case 1:
296
+ info = _a.sent();
297
+ chai_1.expect(info).to.be.an('array');
298
+ return [2 /*return*/];
299
+ }
300
+ });
301
+ }); });
302
+ it('Cw20 getMarketingInfo', function () { return __awaiter(void 0, void 0, void 0, function () {
303
+ var info;
304
+ return __generator(this, function (_a) {
305
+ switch (_a.label) {
306
+ case 0: return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
307
+ case 1:
308
+ info = _a.sent();
309
+ chai_1.expect(info).to.be.an('object');
310
+ return [2 /*return*/];
311
+ }
312
+ });
313
+ }); });
314
+ it.skip('Cw20 getDownloadLogo', function () { return __awaiter(void 0, void 0, void 0, function () {
315
+ var info, error_1;
316
+ return __generator(this, function (_a) {
317
+ switch (_a.label) {
318
+ case 0:
319
+ _a.trys.push([0, 2, , 3]);
320
+ return [4 /*yield*/, firma.Cw20.getDownloadLogo(contractAddress)];
321
+ case 1:
322
+ info = _a.sent();
323
+ return [3 /*break*/, 3];
324
+ case 2:
325
+ error_1 = _a.sent();
326
+ chai_1.expect(false).to.not.equal(true);
327
+ console.log(error_1);
328
+ return [3 /*break*/, 3];
329
+ case 3: return [2 /*return*/];
330
+ }
331
+ });
332
+ }); });
333
+ });
@@ -0,0 +1 @@
1
+ export {};