@firmachain/firma-js 0.2.58 → 0.2.59

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 (88) hide show
  1. package/dist/sdk/FirmaCosmWasmService.d.ts +5 -2
  2. package/dist/sdk/FirmaCosmWasmService.js +3 -2
  3. package/dist/sdk/FirmaIbcService.js +3 -3
  4. package/dist/sdk/firmachain/common/ITxClient.d.ts +1 -0
  5. package/dist/sdk/firmachain/common/ITxClient.js +14 -0
  6. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.d.ts +5 -1
  7. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +8 -4
  8. package/package.json +1 -1
  9. package/dist/test/00.wallet.test.d.ts +0 -1
  10. package/dist/test/00.wallet.test.js +0 -90
  11. package/dist/test/01.contract_tx.test.d.ts +0 -1
  12. package/dist/test/01.contract_tx.test.js +0 -149
  13. package/dist/test/02.contract_query.test.d.ts +0 -1
  14. package/dist/test/02.contract_query.test.js +0 -222
  15. package/dist/test/03.contract_scenario.test.d.ts +0 -1
  16. package/dist/test/03.contract_scenario.test.js +0 -562
  17. package/dist/test/04.bank_tx.test.d.ts +0 -1
  18. package/dist/test/04.bank_tx.test.js +0 -127
  19. package/dist/test/05.bank_query.test.d.ts +0 -1
  20. package/dist/test/05.bank_query.test.js +0 -167
  21. package/dist/test/06.feegrant_tx.test.d.ts +0 -1
  22. package/dist/test/06.feegrant_tx.test.js +0 -176
  23. package/dist/test/07.feegrant_query.test.d.ts +0 -1
  24. package/dist/test/07.feegrant_query.test.js +0 -84
  25. package/dist/test/08.gas_estimate.test.d.ts +0 -1
  26. package/dist/test/08.gas_estimate.test.js +0 -703
  27. package/dist/test/09.ipfs.test.d.ts +0 -1
  28. package/dist/test/09.ipfs.test.js +0 -72
  29. package/dist/test/10.nft_tx.test.d.ts +0 -1
  30. package/dist/test/10.nft_tx.test.js +0 -177
  31. package/dist/test/11.nft_query.test.d.ts +0 -1
  32. package/dist/test/11.nft_query.test.js +0 -170
  33. package/dist/test/12.staking_tx.test.d.ts +0 -1
  34. package/dist/test/12.staking_tx.test.js +0 -216
  35. package/dist/test/13.staking_query.test.d.ts +0 -1
  36. package/dist/test/13.staking_query.test.js +0 -209
  37. package/dist/test/14.distribution_tx.test.d.ts +0 -1
  38. package/dist/test/14.distribution_tx.test.js +0 -179
  39. package/dist/test/15.distribution_query.test.d.ts +0 -1
  40. package/dist/test/15.distribution_query.test.js +0 -219
  41. package/dist/test/16.gov_tx.test.d.ts +0 -1
  42. package/dist/test/16.gov_tx.test.js +0 -240
  43. package/dist/test/17.gov_query.test.d.ts +0 -1
  44. package/dist/test/17.gov_query.test.js +0 -118
  45. package/dist/test/18.util.test.d.ts +0 -1
  46. package/dist/test/18.util.test.js +0 -246
  47. package/dist/test/19.chain.test.d.ts +0 -1
  48. package/dist/test/19.chain.test.js +0 -81
  49. package/dist/test/20.slashing_query.test.d.ts +0 -1
  50. package/dist/test/20.slashing_query.test.js +0 -82
  51. package/dist/test/21.token_tx.test.d.ts +0 -1
  52. package/dist/test/21.token_tx.test.js +0 -157
  53. package/dist/test/22.token_query.test.d.ts +0 -1
  54. package/dist/test/22.token_query.test.js +0 -99
  55. package/dist/test/23.authz_tx.test.d.ts +0 -1
  56. package/dist/test/23.authz_tx.test.js +0 -471
  57. package/dist/test/24.authz_query.test.d.ts +0 -1
  58. package/dist/test/24.authz_query.test.js +0 -143
  59. package/dist/test/25.cosmwasm_tx.test.d.ts +0 -1
  60. package/dist/test/25.cosmwasm_tx.test.js +0 -191
  61. package/dist/test/26.cosmwasm_query.test.d.ts +0 -1
  62. package/dist/test/26.cosmwasm_query.test.js +0 -170
  63. package/dist/test/27.arbitary_sign.test.d.ts +0 -1
  64. package/dist/test/27.arbitary_sign.test.js +0 -167
  65. package/dist/test/28.ibc_tx.test.d.ts +0 -1
  66. package/dist/test/28.ibc_tx.test.js +0 -86
  67. package/dist/test/29.mint_query.test.d.ts +0 -1
  68. package/dist/test/29.mint_query.test.js +0 -57
  69. package/dist/test/30.cw20_tx.test.d.ts +0 -1
  70. package/dist/test/30.cw20_tx.test.js +0 -515
  71. package/dist/test/31.cw20_query.test.d.ts +0 -1
  72. package/dist/test/31.cw20_query.test.js +0 -188
  73. package/dist/test/32.cw721_tx.test.d.ts +0 -1
  74. package/dist/test/32.cw721_tx.test.js +0 -433
  75. package/dist/test/33.cw721_query.test.d.ts +0 -1
  76. package/dist/test/33.cw721_query.test.js +0 -219
  77. package/dist/test/34.cw_bridge_tx.test.d.ts +0 -1
  78. package/dist/test/34.cw_bridge_tx.test.js +0 -365
  79. package/dist/test/35.cw_bridge_tx_low.test.d.ts +0 -1
  80. package/dist/test/35.cw_bridge_tx_low.test.js +0 -258
  81. package/dist/test/36.cw_bridge_query.test.d.ts +0 -1
  82. package/dist/test/36.cw_bridge_query.test.js +0 -182
  83. package/dist/test/37.cw_marketplace_tx.test.d.ts +0 -1
  84. package/dist/test/37.cw_marketplace_tx.test.js +0 -794
  85. package/dist/test/38.cw_marketplace_query.test.d.ts +0 -1
  86. package/dist/test/38.cw_marketplace_query.test.js +0 -128
  87. package/dist/test/config_test.d.ts +0 -5
  88. package/dist/test/config_test.js +0 -26
@@ -1,57 +0,0 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var FirmaSDK_1 = require("../sdk/FirmaSDK");
40
- var config_test_1 = require("./config_test");
41
- describe('[29. Mint Query Test]', function () {
42
- var firma;
43
- beforeEach(function () {
44
- firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
45
- });
46
- it('Mint getInflation()', function () { return __awaiter(void 0, void 0, void 0, function () {
47
- var result;
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0: return [4 /*yield*/, firma.Mint.getInflation()];
51
- case 1:
52
- result = _a.sent();
53
- return [2 /*return*/];
54
- }
55
- });
56
- }); });
57
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,515 +0,0 @@
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 __importDefault = (this && this.__importDefault) || function (mod) {
39
- return (mod && mod.__esModule) ? mod : { "default": mod };
40
- };
41
- Object.defineProperty(exports, "__esModule", { value: true });
42
- var FirmaConfig_1 = require("../sdk/FirmaConfig");
43
- var FirmaSDK_1 = require("../sdk/FirmaSDK");
44
- var chai_1 = require("chai");
45
- var config_test_1 = require("./config_test");
46
- var FirmaUtil_1 = require("../sdk/FirmaUtil");
47
- var fs_1 = __importDefault(require("fs"));
48
- var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
49
- describe('[30. cw20 tx Test]', function () {
50
- var firma;
51
- var aliceWallet;
52
- var bobWallet;
53
- var aliceAddress;
54
- var bobAddress;
55
- beforeEach(function () {
56
- return __awaiter(this, void 0, void 0, function () {
57
- return __generator(this, function (_a) {
58
- switch (_a.label) {
59
- case 0:
60
- firma = new FirmaSDK_1.FirmaSDK(FirmaConfig_1.FirmaConfig.TestNetConfig);
61
- return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
62
- case 1:
63
- aliceWallet = _a.sent();
64
- return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.bobMnemonic)];
65
- case 2:
66
- bobWallet = _a.sent();
67
- return [4 /*yield*/, aliceWallet.getAddress()];
68
- case 3:
69
- aliceAddress = _a.sent();
70
- return [4 /*yield*/, bobWallet.getAddress()];
71
- case 4:
72
- bobAddress = _a.sent();
73
- return [2 /*return*/];
74
- }
75
- });
76
- });
77
- });
78
- var contractAddress = "";
79
- var codeId = "";
80
- it.skip('CosmWasm Cw20 StoreCode', function () { return __awaiter(void 0, void 0, void 0, function () {
81
- var wasmFile, array, gas, fee, everyBodyAccessConfig, result, data;
82
- return __generator(this, function (_a) {
83
- switch (_a.label) {
84
- case 0:
85
- wasmFile = fs_1.default.readFileSync("./test/sample/cw20_base.wasm");
86
- array = new Uint8Array(wasmFile.buffer);
87
- gas = 3000000;
88
- fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
89
- everyBodyAccessConfig = { permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY, address: "" };
90
- return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: gas, fee: fee })];
91
- case 1:
92
- result = _a.sent();
93
- data = JSON.parse(result.rawLog);
94
- codeId = data[0]["events"][1]["attributes"][1]["value"];
95
- chai_1.expect(result.code).to.be.equal(0);
96
- return [2 /*return*/];
97
- }
98
- });
99
- }); });
100
- it.skip('CosmWasm Cw20 InstantiateContract', function () { return __awaiter(void 0, void 0, void 0, function () {
101
- var admin, label, gas, fee, noFunds, testData, result, data;
102
- return __generator(this, function (_a) {
103
- switch (_a.label) {
104
- case 0: return [4 /*yield*/, aliceWallet.getAddress()];
105
- case 1:
106
- admin = _a.sent();
107
- label = "test1";
108
- gas = 3000000;
109
- fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
110
- noFunds = [];
111
- testData = JSON.stringify({
112
- decimals: 6,
113
- name: "MyToken",
114
- symbol: "MTK",
115
- initial_balances: [
116
- {
117
- address: aliceAddress,
118
- amount: "1000000"
119
- }
120
- ],
121
- // mint is optional
122
- mint: {
123
- minter: aliceAddress,
124
- cap: "10000000"
125
- },
126
- // marketing is optional
127
- marketing: {
128
- description: "MyToken's description is like this.",
129
- logo: {
130
- "url": "https://example.com/mytoken-logo.png"
131
- },
132
- marketing: aliceAddress,
133
- project: "https://mytokenproject.com"
134
- }
135
- });
136
- return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: gas, fee: fee })];
137
- case 2:
138
- result = _a.sent();
139
- data = JSON.parse(result.rawLog);
140
- contractAddress = data[0]["events"][0]["attributes"][0]["value"];
141
- chai_1.expect(result.code).to.be.equal(0);
142
- return [2 /*return*/];
143
- }
144
- });
145
- }); });
146
- it.skip('Cw20 transfer', function () { return __awaiter(void 0, void 0, void 0, function () {
147
- var aliceBalance, bobBalance, amount, gas, fee, result;
148
- return __generator(this, function (_a) {
149
- switch (_a.label) {
150
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
151
- case 1:
152
- aliceBalance = _a.sent();
153
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
154
- case 2:
155
- bobBalance = _a.sent();
156
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
157
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
158
- amount = "10000";
159
- return [4 /*yield*/, firma.Cw20.getGasEstimationTransfer(aliceWallet, contractAddress, bobAddress, amount)];
160
- case 3:
161
- gas = _a.sent();
162
- fee = Math.ceil(gas * 0.1);
163
- return [4 /*yield*/, firma.Cw20.transfer(aliceWallet, contractAddress, bobAddress, amount, { gas: gas, fee: fee })];
164
- case 4:
165
- result = _a.sent();
166
- chai_1.expect(result.code).to.be.equal(0);
167
- return [2 /*return*/];
168
- }
169
- });
170
- }); });
171
- it.skip('Cw20 transfer_form', function () { return __awaiter(void 0, void 0, void 0, function () {
172
- var aliceBalance, bobBalance, allowance, amount, gas, fee, result, allowance1;
173
- return __generator(this, function (_a) {
174
- switch (_a.label) {
175
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
176
- case 1:
177
- aliceBalance = _a.sent();
178
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
179
- case 2:
180
- bobBalance = _a.sent();
181
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
182
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
183
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
184
- case 3:
185
- allowance = _a.sent();
186
- console.log(allowance);
187
- amount = "1000";
188
- return [4 /*yield*/, firma.Cw20.getGasEstimationTransferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount)];
189
- case 4:
190
- gas = _a.sent();
191
- fee = Math.ceil(gas * 0.1);
192
- return [4 /*yield*/, firma.Cw20.transferFrom(bobWallet, contractAddress, aliceAddress, bobAddress, amount, { gas: gas, fee: fee })];
193
- case 5:
194
- result = _a.sent();
195
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
196
- case 6:
197
- aliceBalance = _a.sent();
198
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
199
- case 7:
200
- bobBalance = _a.sent();
201
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
202
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
203
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
204
- case 8:
205
- allowance1 = _a.sent();
206
- console.log(allowance1);
207
- chai_1.expect(result.code).to.be.equal(0);
208
- return [2 /*return*/];
209
- }
210
- });
211
- }); });
212
- it.skip('Cw20 mint', function () { return __awaiter(void 0, void 0, void 0, function () {
213
- var aliceBalance, bobBalance, minter, info, amount, gas, fee, result;
214
- return __generator(this, function (_a) {
215
- switch (_a.label) {
216
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
217
- case 1:
218
- aliceBalance = _a.sent();
219
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
220
- case 2:
221
- bobBalance = _a.sent();
222
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
223
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
224
- return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
225
- case 3:
226
- minter = _a.sent();
227
- if (minter == null) {
228
- console.log("minter is null");
229
- return [2 /*return*/];
230
- }
231
- console.log(minter.minter);
232
- console.log(minter.cap);
233
- return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
234
- case 4:
235
- info = _a.sent();
236
- console.log(info);
237
- amount = "1000";
238
- return [4 /*yield*/, firma.Cw20.getGasEstimationMint(aliceWallet, contractAddress, aliceAddress, amount)];
239
- case 5:
240
- gas = _a.sent();
241
- fee = Math.ceil(gas * 0.1);
242
- return [4 /*yield*/, firma.Cw20.mint(aliceWallet, contractAddress, aliceAddress, amount, { gas: gas, fee: fee })];
243
- case 6:
244
- result = _a.sent();
245
- console.log(result);
246
- chai_1.expect(result.code).to.be.equal(0);
247
- return [2 /*return*/];
248
- }
249
- });
250
- }); });
251
- it.skip('Cw20 burn', function () { return __awaiter(void 0, void 0, void 0, function () {
252
- var info, aliceBalance, bobBalance, amount, gas, fee, result;
253
- return __generator(this, function (_a) {
254
- switch (_a.label) {
255
- case 0: return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
256
- case 1:
257
- info = _a.sent();
258
- console.log(info);
259
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
260
- case 2:
261
- aliceBalance = _a.sent();
262
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
263
- case 3:
264
- bobBalance = _a.sent();
265
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
266
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
267
- amount = "1000";
268
- return [4 /*yield*/, firma.Cw20.getGasEstimationBurn(aliceWallet, contractAddress, amount)];
269
- case 4:
270
- gas = _a.sent();
271
- fee = Math.ceil(gas * 0.1);
272
- return [4 /*yield*/, firma.Cw20.burn(aliceWallet, contractAddress, amount, { gas: gas, fee: fee })];
273
- case 5:
274
- result = _a.sent();
275
- console.log(result);
276
- chai_1.expect(result.code).to.be.equal(0);
277
- return [2 /*return*/];
278
- }
279
- });
280
- }); });
281
- it.skip('Cw20 burn_from', function () { return __awaiter(void 0, void 0, void 0, function () {
282
- var info, aliceBalance, bobBalance, amount, gas, fee, result;
283
- return __generator(this, function (_a) {
284
- switch (_a.label) {
285
- case 0: return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
286
- case 1:
287
- info = _a.sent();
288
- console.log(info);
289
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
290
- case 2:
291
- aliceBalance = _a.sent();
292
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
293
- case 3:
294
- bobBalance = _a.sent();
295
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
296
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
297
- amount = "1000";
298
- return [4 /*yield*/, firma.Cw20.getGasEstimationBurnFrom(bobWallet, contractAddress, aliceAddress, amount)];
299
- case 4:
300
- gas = _a.sent();
301
- fee = Math.ceil(gas * 0.1);
302
- return [4 /*yield*/, firma.Cw20.burnFrom(bobWallet, contractAddress, aliceAddress, amount, { gas: gas, fee: fee })];
303
- case 5:
304
- result = _a.sent();
305
- console.log(result);
306
- chai_1.expect(result.code).to.be.equal(0);
307
- return [2 /*return*/];
308
- }
309
- });
310
- }); });
311
- it.skip('Cw20 increase_allowance', function () { return __awaiter(void 0, void 0, void 0, function () {
312
- var aliceBalance, bobBalance, olDAllowance, amount, expires, gas, fee, result, newAllowance;
313
- return __generator(this, function (_a) {
314
- switch (_a.label) {
315
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
316
- case 1:
317
- aliceBalance = _a.sent();
318
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
319
- case 2:
320
- bobBalance = _a.sent();
321
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
322
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
323
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
324
- case 3:
325
- olDAllowance = _a.sent();
326
- console.log(olDAllowance);
327
- amount = "1000";
328
- expires = { never: {} };
329
- return [4 /*yield*/, firma.Cw20.getGasEstimationIncreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires)];
330
- case 4:
331
- gas = _a.sent();
332
- fee = Math.ceil(gas * 0.1);
333
- return [4 /*yield*/, firma.Cw20.increaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires, { gas: gas, fee: fee })];
334
- case 5:
335
- result = _a.sent();
336
- console.log(result);
337
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
338
- case 6:
339
- newAllowance = _a.sent();
340
- console.log(newAllowance);
341
- return [2 /*return*/];
342
- }
343
- });
344
- }); });
345
- it.skip('Cw20 decrease_allowance', function () { return __awaiter(void 0, void 0, void 0, function () {
346
- var aliceBalance, bobBalance, olDAllowance, amount, expires, gas, fee, result, newAllowance;
347
- return __generator(this, function (_a) {
348
- switch (_a.label) {
349
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
350
- case 1:
351
- aliceBalance = _a.sent();
352
- return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, bobAddress)];
353
- case 2:
354
- bobBalance = _a.sent();
355
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
356
- console.log("bob: " + bobAddress + ", balance: " + bobBalance);
357
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
358
- case 3:
359
- olDAllowance = _a.sent();
360
- console.log(olDAllowance);
361
- amount = "1000";
362
- expires = { never: {} };
363
- return [4 /*yield*/, firma.Cw20.getGasEstimationDecreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires)];
364
- case 4:
365
- gas = _a.sent();
366
- fee = Math.ceil(gas * 0.1);
367
- return [4 /*yield*/, firma.Cw20.decreaseAllowance(aliceWallet, contractAddress, bobAddress, amount, expires, { gas: gas, fee: fee })];
368
- case 5:
369
- result = _a.sent();
370
- console.log(result);
371
- return [4 /*yield*/, firma.Cw20.getAllowance(contractAddress, aliceAddress, bobAddress)];
372
- case 6:
373
- newAllowance = _a.sent();
374
- console.log(newAllowance);
375
- return [2 /*return*/];
376
- }
377
- });
378
- }); });
379
- it.skip('Cw20 update_minter', function () { return __awaiter(void 0, void 0, void 0, function () {
380
- var minter, gas, fee, result;
381
- return __generator(this, function (_a) {
382
- switch (_a.label) {
383
- case 0: return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
384
- case 1:
385
- minter = _a.sent();
386
- console.log(minter);
387
- return [4 /*yield*/, firma.Cw20.getGasEstimationUpdateMinter(aliceWallet, contractAddress, bobAddress)];
388
- case 2:
389
- gas = _a.sent();
390
- fee = Math.ceil(gas * 0.1);
391
- return [4 /*yield*/, firma.Cw20.updateMinter(aliceWallet, contractAddress, bobAddress, { gas: gas, fee: fee })];
392
- case 3:
393
- result = _a.sent();
394
- console.log(result);
395
- return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
396
- case 4:
397
- minter = _a.sent();
398
- console.log(minter);
399
- return [2 /*return*/];
400
- }
401
- });
402
- }); });
403
- it.skip('Cw20 update_marketing', function () { return __awaiter(void 0, void 0, void 0, function () {
404
- var info, marketingInfo, description, marketingAddress, project, gas, fee, result;
405
- return __generator(this, function (_a) {
406
- switch (_a.label) {
407
- case 0: return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
408
- case 1:
409
- info = _a.sent();
410
- console.log(info);
411
- return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
412
- case 2:
413
- marketingInfo = _a.sent();
414
- console.log(marketingInfo);
415
- description = "description";
416
- marketingAddress = aliceAddress;
417
- project = "project";
418
- return [4 /*yield*/, firma.Cw20.getGasEstimationUpdateMarketing(aliceWallet, contractAddress, description, marketingAddress, project)];
419
- case 3:
420
- gas = _a.sent();
421
- fee = Math.ceil(gas * 0.1);
422
- return [4 /*yield*/, firma.Cw20.updateMarketing(aliceWallet, contractAddress, description, marketingAddress, project, { gas: gas, fee: fee })];
423
- case 4:
424
- result = _a.sent();
425
- console.log(result);
426
- return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
427
- case 5:
428
- marketingInfo = _a.sent();
429
- console.log(marketingInfo);
430
- return [2 /*return*/];
431
- }
432
- });
433
- }); });
434
- it.skip('Cw20 update_logo', function () { return __awaiter(void 0, void 0, void 0, function () {
435
- var minter, info, marketingInfo, url, gas, fee, result;
436
- return __generator(this, function (_a) {
437
- switch (_a.label) {
438
- case 0: return [4 /*yield*/, firma.Cw20.getMinter(contractAddress)];
439
- case 1:
440
- minter = _a.sent();
441
- console.log(minter);
442
- console.log(aliceAddress);
443
- return [4 /*yield*/, firma.Cw20.getTokenInfo(contractAddress)];
444
- case 2:
445
- info = _a.sent();
446
- console.log(info);
447
- return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
448
- case 3:
449
- marketingInfo = _a.sent();
450
- console.log(marketingInfo);
451
- url = "https://firmachain.org";
452
- return [4 /*yield*/, firma.Cw20.getGasEstimationUploadLogo(aliceWallet, contractAddress, url)];
453
- case 4:
454
- gas = _a.sent();
455
- fee = Math.ceil(gas * 0.1);
456
- return [4 /*yield*/, firma.Cw20.uploadLogo(aliceWallet, contractAddress, url, { gas: gas, fee: fee })];
457
- case 5:
458
- result = _a.sent();
459
- console.log(result);
460
- return [4 /*yield*/, firma.Cw20.getMarketingInfo(contractAddress)];
461
- case 6:
462
- marketingInfo = _a.sent();
463
- console.log(marketingInfo);
464
- return [2 /*return*/];
465
- }
466
- });
467
- }); });
468
- it.skip('Cw20 send', function () { return __awaiter(void 0, void 0, void 0, function () {
469
- var aliceBalance, amount, targetContractAddress, msg, gas, fee, result;
470
- return __generator(this, function (_a) {
471
- switch (_a.label) {
472
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
473
- case 1:
474
- aliceBalance = _a.sent();
475
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
476
- amount = "10000";
477
- targetContractAddress = contractAddress;
478
- msg = { action: "send", data: "example" };
479
- return [4 /*yield*/, firma.Cw20.getGasEstimationSend(aliceWallet, contractAddress, targetContractAddress, amount, msg)];
480
- case 2:
481
- gas = _a.sent();
482
- fee = Math.ceil(gas * 0.1);
483
- return [4 /*yield*/, firma.Cw20.send(aliceWallet, contractAddress, targetContractAddress, amount, msg, { gas: gas, fee: fee })];
484
- case 3:
485
- result = _a.sent();
486
- console.log(result);
487
- return [2 /*return*/];
488
- }
489
- });
490
- }); });
491
- it.skip('Cw20 send_from', function () { return __awaiter(void 0, void 0, void 0, function () {
492
- var aliceBalance, amount, targetContractAddress, owner, msg, gas, fee, result;
493
- return __generator(this, function (_a) {
494
- switch (_a.label) {
495
- case 0: return [4 /*yield*/, firma.Cw20.getBalance(contractAddress, aliceAddress)];
496
- case 1:
497
- aliceBalance = _a.sent();
498
- console.log("alice: " + aliceAddress + ", balance: " + aliceBalance);
499
- amount = "100";
500
- targetContractAddress = contractAddress;
501
- owner = aliceAddress;
502
- msg = { action: "send", data: "example" };
503
- return [4 /*yield*/, firma.Cw20.getGasEstimationSendFrom(bobWallet, contractAddress, targetContractAddress, owner, amount, msg)];
504
- case 2:
505
- gas = _a.sent();
506
- fee = Math.ceil(gas * 0.1);
507
- return [4 /*yield*/, firma.Cw20.sendFrom(bobWallet, contractAddress, targetContractAddress, owner, amount, msg, { gas: gas, fee: fee })];
508
- case 3:
509
- result = _a.sent();
510
- console.log(result);
511
- return [2 /*return*/];
512
- }
513
- });
514
- }); });
515
- });
@@ -1 +0,0 @@
1
- export {};