@firmachain/firma-js 0.3.7 → 0.4.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 (128) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/sdk/FirmaAuthzService.js +20 -15
  4. package/dist/sdk/FirmaBankService.d.ts +1 -1
  5. package/dist/sdk/FirmaBankService.js +5 -4
  6. package/dist/sdk/FirmaConfig.js +4 -4
  7. package/dist/sdk/FirmaContractService.js +10 -8
  8. package/dist/sdk/FirmaDistributionService.js +37 -22
  9. package/dist/sdk/FirmaFeeGrantService.d.ts +0 -1
  10. package/dist/sdk/FirmaFeeGrantService.js +12 -14
  11. package/dist/sdk/FirmaGovService.d.ts +14 -0
  12. package/dist/sdk/FirmaGovService.js +74 -47
  13. package/dist/sdk/FirmaIbcService.js +4 -3
  14. package/dist/sdk/FirmaNftService.d.ts +3 -3
  15. package/dist/sdk/FirmaNftService.js +13 -10
  16. package/dist/sdk/FirmaStakingService.js +12 -9
  17. package/dist/sdk/FirmaTokenService.js +17 -14
  18. package/dist/sdk/FirmaUtil.js +1 -1
  19. package/dist/sdk/FirmaWalletService.d.ts +1 -1
  20. package/dist/sdk/FirmaWalletService.js +11 -23
  21. package/dist/sdk/firmachain/authz/AuthzTxClient.js +2 -0
  22. package/dist/sdk/firmachain/bank/BankTxClient.js +1 -1
  23. package/dist/sdk/firmachain/common/CommonTxClient.js +3 -1
  24. package/dist/sdk/firmachain/common/FirmaLedger.d.ts +49 -0
  25. package/dist/sdk/firmachain/common/FirmaLedger.js +301 -0
  26. package/dist/sdk/firmachain/common/ITxClient.d.ts +1 -1
  27. package/dist/sdk/firmachain/common/ITxClient.js +6 -4
  28. package/dist/sdk/firmachain/common/LedgerWallet.d.ts +5 -13
  29. package/dist/sdk/firmachain/common/LedgerWallet.js +1266 -124
  30. package/dist/sdk/firmachain/common/SigningProtobufStargateClient.js +3 -4
  31. package/dist/sdk/firmachain/common/SigningStargateClient.d.ts +2 -3
  32. package/dist/sdk/firmachain/common/SigningStargateClient.js +7 -10
  33. package/dist/sdk/firmachain/common/index.d.ts +1 -0
  34. package/dist/sdk/firmachain/common/index.js +1 -0
  35. package/dist/sdk/firmachain/common/signing.d.ts +4 -10
  36. package/dist/sdk/firmachain/common/signing.js +13 -60
  37. package/dist/sdk/firmachain/contract/ContractTxClient.js +1 -1
  38. package/dist/sdk/firmachain/contract/ContractTxTypes.js +54 -8
  39. package/dist/sdk/firmachain/distribution/DistributionTxClient.js +1 -1
  40. package/dist/sdk/firmachain/feegrant/FeeGrantTxClient.js +3 -1
  41. package/dist/sdk/firmachain/feegrant/FeeGrantTxTypes.d.ts +1 -2
  42. package/dist/sdk/firmachain/google/protobuf/any.js +0 -12
  43. package/dist/sdk/firmachain/gov/GovTxClient.js +3 -0
  44. package/dist/sdk/firmachain/nft/NftTxClient.js +1 -1
  45. package/dist/sdk/firmachain/token/TokenTxClient.js +1 -1
  46. package/package.json +16 -8
  47. package/dist/test/00.wallet.test.d.ts +0 -1
  48. package/dist/test/00.wallet.test.js +0 -96
  49. package/dist/test/01.contract_tx.test.d.ts +0 -1
  50. package/dist/test/01.contract_tx.test.js +0 -157
  51. package/dist/test/02.contract_query.test.d.ts +0 -1
  52. package/dist/test/02.contract_query.test.js +0 -245
  53. package/dist/test/03.contract_scenario.test.d.ts +0 -1
  54. package/dist/test/03.contract_scenario.test.js +0 -406
  55. package/dist/test/04.bank_tx.test.d.ts +0 -1
  56. package/dist/test/04.bank_tx.test.js +0 -126
  57. package/dist/test/05.bank_query.test.d.ts +0 -1
  58. package/dist/test/05.bank_query.test.js +0 -162
  59. package/dist/test/06.feegrant_tx.test.d.ts +0 -1
  60. package/dist/test/06.feegrant_tx.test.js +0 -185
  61. package/dist/test/07.feegrant_query.test.d.ts +0 -1
  62. package/dist/test/07.feegrant_query.test.js +0 -129
  63. package/dist/test/08.gas_estimate.test.d.ts +0 -1
  64. package/dist/test/08.gas_estimate.test.js +0 -728
  65. package/dist/test/09.ipfs.test.d.ts +0 -1
  66. package/dist/test/09.ipfs.test.js +0 -72
  67. package/dist/test/10.nft_tx.test.d.ts +0 -1
  68. package/dist/test/10.nft_tx.test.js +0 -209
  69. package/dist/test/11.nft_query.test.d.ts +0 -1
  70. package/dist/test/11.nft_query.test.js +0 -165
  71. package/dist/test/12.staking_tx.test.d.ts +0 -1
  72. package/dist/test/12.staking_tx.test.js +0 -211
  73. package/dist/test/13.staking_query.test.d.ts +0 -1
  74. package/dist/test/13.staking_query.test.js +0 -275
  75. package/dist/test/14.distribution_tx.test.d.ts +0 -1
  76. package/dist/test/14.distribution_tx.test.js +0 -170
  77. package/dist/test/15.distribution_query.test.d.ts +0 -1
  78. package/dist/test/15.distribution_query.test.js +0 -243
  79. package/dist/test/16.gov_tx.test.d.ts +0 -1
  80. package/dist/test/16.gov_tx.test.js +0 -396
  81. package/dist/test/17.gov_query.test.d.ts +0 -1
  82. package/dist/test/17.gov_query.test.js +0 -181
  83. package/dist/test/18.util.test.d.ts +0 -1
  84. package/dist/test/18.util.test.js +0 -354
  85. package/dist/test/19.chain.test.d.ts +0 -1
  86. package/dist/test/19.chain.test.js +0 -127
  87. package/dist/test/20.slashing_query.test.d.ts +0 -1
  88. package/dist/test/20.slashing_query.test.js +0 -111
  89. package/dist/test/21.token_tx.test.d.ts +0 -1
  90. package/dist/test/21.token_tx.test.js +0 -149
  91. package/dist/test/22.token_query.test.d.ts +0 -1
  92. package/dist/test/22.token_query.test.js +0 -103
  93. package/dist/test/23.authz_tx.test.d.ts +0 -1
  94. package/dist/test/23.authz_tx.test.js +0 -380
  95. package/dist/test/24.authz_query.test.d.ts +0 -1
  96. package/dist/test/24.authz_query.test.js +0 -202
  97. package/dist/test/25.cosmwasm_tx.test.d.ts +0 -1
  98. package/dist/test/25.cosmwasm_tx.test.js +0 -229
  99. package/dist/test/26.cosmwasm_query.test.d.ts +0 -1
  100. package/dist/test/26.cosmwasm_query.test.js +0 -275
  101. package/dist/test/27.arbitrary_sign.test.d.ts +0 -1
  102. package/dist/test/27.arbitrary_sign.test.js +0 -162
  103. package/dist/test/28.ibc_tx.test.d.ts +0 -1
  104. package/dist/test/28.ibc_tx.test.js +0 -98
  105. package/dist/test/29.mint_query.test.d.ts +0 -1
  106. package/dist/test/29.mint_query.test.js +0 -59
  107. package/dist/test/30.cw20_tx.test.d.ts +0 -1
  108. package/dist/test/30.cw20_tx.test.js +0 -450
  109. package/dist/test/31.cw20_query.test.d.ts +0 -1
  110. package/dist/test/31.cw20_query.test.js +0 -333
  111. package/dist/test/32.cw721_tx.test.d.ts +0 -1
  112. package/dist/test/32.cw721_tx.test.js +0 -431
  113. package/dist/test/33.cw721_query.test.d.ts +0 -1
  114. package/dist/test/33.cw721_query.test.js +0 -371
  115. package/dist/test/34.cw_bridge_tx.test.d.ts +0 -1
  116. package/dist/test/34.cw_bridge_tx.test.js +0 -476
  117. package/dist/test/35.cw_bridge_tx_low.test.d.ts +0 -1
  118. package/dist/test/35.cw_bridge_tx_low.test.js +0 -398
  119. package/dist/test/36.cw_bridge_query.test.d.ts +0 -1
  120. package/dist/test/36.cw_bridge_query.test.js +0 -318
  121. package/dist/test/37.cw_marketplace_tx.test.d.ts +0 -1
  122. package/dist/test/37.cw_marketplace_tx.test.js +0 -794
  123. package/dist/test/38.cw_marketplace_query.test.d.ts +0 -1
  124. package/dist/test/38.cw_marketplace_query.test.js +0 -128
  125. package/dist/test/config_test.d.ts +0 -11
  126. package/dist/test/config_test.js +0 -14
  127. package/dist/test/config_test.sample.d.ts +0 -11
  128. package/dist/test/config_test.sample.js +0 -14
@@ -1,431 +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 (g && (g = 0, op[0] && (_ = 0)), _) 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 fs_1 = __importDefault(require("fs"));
54
- var chai_1 = require("chai");
55
- var FirmaSDK_1 = require("../sdk/FirmaSDK");
56
- var FirmaUtil_1 = require("../sdk/FirmaUtil");
57
- var FirmaCosmWasmService_1 = require("../sdk/FirmaCosmWasmService");
58
- var config_test_1 = require("./config_test");
59
- describe('[32. cw721 tx Test]', function () {
60
- var firma;
61
- var aliceWallet;
62
- var aliceAddress;
63
- var bobWallet;
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
- var codeId = "";
123
- it('CosmWasm Cw721 StoreCode', function () { return __awaiter(void 0, void 0, void 0, function () {
124
- var wasmFile, array, gas, fee, everyBodyAccessConfig, result;
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
- gas = 3000000;
131
- fee = 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: gas, fee: fee })];
138
- case 1:
139
- result = _a.sent();
140
- codeId = extractValue(result.events, "store_code", "code_id");
141
- (0, chai_1.expect)(result.code).to.be.equal(0);
142
- return [2 /*return*/];
143
- }
144
- });
145
- }); });
146
- it('CosmWasm Cw721 InstantiateContract', function () { return __awaiter(void 0, void 0, void 0, function () {
147
- var admin, label, gas, fee, noFunds, testData, result;
148
- return __generator(this, function (_a) {
149
- switch (_a.label) {
150
- case 0: return [4 /*yield*/, aliceWallet.getAddress()];
151
- case 1:
152
- admin = _a.sent();
153
- label = "test1";
154
- gas = 3000000;
155
- fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
156
- noFunds = [];
157
- testData = JSON.stringify({
158
- minter: aliceAddress,
159
- name: "My Awesome NFT Collection",
160
- symbol: "MAWESOME"
161
- });
162
- return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: gas, fee: fee })];
163
- case 2:
164
- result = _a.sent();
165
- contractAddress = extractValue(result.events, "instantiate", "_contract_address");
166
- (0, chai_1.expect)(result.code).to.be.equal(0);
167
- return [2 /*return*/];
168
- }
169
- });
170
- }); });
171
- it('Cw721 mint', function () { return __awaiter(void 0, void 0, void 0, function () {
172
- var owner, token_id, token_uri, gas, fee, result, nftData;
173
- return __generator(this, function (_a) {
174
- switch (_a.label) {
175
- case 0:
176
- owner = aliceAddress;
177
- token_id = "1";
178
- token_uri = "https://meta.nft.io/uri/" + token_id;
179
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, contractAddress, owner, token_id, token_uri)];
180
- case 1:
181
- gas = _a.sent();
182
- fee = Math.ceil(gas * 0.1);
183
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, contractAddress, owner, token_id, token_uri, { gas: gas, fee: fee })];
184
- case 2:
185
- result = _a.sent();
186
- return [4 /*yield*/, firma.Cw721.getNftData(contractAddress, token_id)];
187
- case 3:
188
- nftData = _a.sent();
189
- (0, chai_1.expect)(result.code).to.be.equal(0);
190
- return [2 /*return*/];
191
- }
192
- });
193
- }); });
194
- it('Cw721 burn', function () { return __awaiter(void 0, void 0, void 0, function () {
195
- var owner, token_id, token_uri, mintGas, mintFee, mintResult, gas, fee, result;
196
- return __generator(this, function (_a) {
197
- switch (_a.label) {
198
- case 0:
199
- owner = aliceAddress;
200
- token_id = "2";
201
- token_uri = "https://meta.nft.io/uri/" + token_id;
202
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, contractAddress, owner, token_id, token_uri)];
203
- case 1:
204
- mintGas = _a.sent();
205
- mintFee = Math.ceil(mintGas * 0.1);
206
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, contractAddress, owner, token_id, token_uri, { gas: mintGas, fee: mintFee })];
207
- case 2:
208
- mintResult = _a.sent();
209
- (0, chai_1.expect)(mintResult.code).to.be.equal(0);
210
- return [4 /*yield*/, firma.Cw721.getGasEstimationBurn(aliceWallet, contractAddress, token_id)];
211
- case 3:
212
- gas = _a.sent();
213
- fee = Math.ceil(gas * 0.1);
214
- return [4 /*yield*/, firma.Cw721.burn(aliceWallet, contractAddress, token_id, { gas: gas, fee: fee })];
215
- case 4:
216
- result = _a.sent();
217
- (0, chai_1.expect)(result.code).to.be.equal(0);
218
- return [2 /*return*/];
219
- }
220
- });
221
- }); });
222
- it('Cw721 transfer', function () { return __awaiter(void 0, void 0, void 0, function () {
223
- var owner, token_id, token_uri, mintGas, mintFee, mintResult, gas, fee, result;
224
- return __generator(this, function (_a) {
225
- switch (_a.label) {
226
- case 0:
227
- owner = aliceAddress;
228
- token_id = "3";
229
- token_uri = "https://meta.nft.io/uri/" + token_id;
230
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, contractAddress, owner, token_id, token_uri)];
231
- case 1:
232
- mintGas = _a.sent();
233
- mintFee = Math.ceil(mintGas * 0.1);
234
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, contractAddress, owner, token_id, token_uri, { gas: mintGas, fee: mintFee })];
235
- case 2:
236
- mintResult = _a.sent();
237
- (0, chai_1.expect)(mintResult.code).to.be.equal(0);
238
- return [4 /*yield*/, firma.Cw721.getGasEstimationTransfer(aliceWallet, contractAddress, bobAddress, token_id)];
239
- case 3:
240
- gas = _a.sent();
241
- fee = Math.ceil(gas * 0.1);
242
- return [4 /*yield*/, firma.Cw721.transfer(aliceWallet, contractAddress, bobAddress, token_id, { gas: gas, fee: fee })];
243
- case 4:
244
- result = _a.sent();
245
- (0, chai_1.expect)(result.code).to.be.equal(0);
246
- return [2 /*return*/];
247
- }
248
- });
249
- }); });
250
- it('Cw721 approve', function () { return __awaiter(void 0, void 0, void 0, function () {
251
- var expires, token_id, gas, fee, result;
252
- return __generator(this, function (_a) {
253
- switch (_a.label) {
254
- case 0:
255
- expires = { never: {} };
256
- token_id = "1";
257
- return [4 /*yield*/, firma.Cw721.getGasEstimationApprove(aliceWallet, contractAddress, bobAddress, token_id, expires)];
258
- case 1:
259
- gas = _a.sent();
260
- fee = Math.ceil(gas * 0.1);
261
- return [4 /*yield*/, firma.Cw721.approve(aliceWallet, contractAddress, bobAddress, token_id, expires, { gas: gas, fee: fee })];
262
- case 2:
263
- result = _a.sent();
264
- (0, chai_1.expect)(result.code).to.be.equal(0);
265
- return [2 /*return*/];
266
- }
267
- });
268
- }); });
269
- it('Cw721 revoke', function () { return __awaiter(void 0, void 0, void 0, function () {
270
- var token_id, gas, fee, result;
271
- return __generator(this, function (_a) {
272
- switch (_a.label) {
273
- case 0:
274
- token_id = "1";
275
- return [4 /*yield*/, firma.Cw721.getGasEstimationRevoke(aliceWallet, contractAddress, bobAddress, token_id)];
276
- case 1:
277
- gas = _a.sent();
278
- fee = Math.ceil(gas * 0.1);
279
- return [4 /*yield*/, firma.Cw721.revoke(aliceWallet, contractAddress, bobAddress, token_id, { gas: gas, fee: fee })];
280
- case 2:
281
- result = _a.sent();
282
- (0, chai_1.expect)(result.code).to.be.equal(0);
283
- return [2 /*return*/];
284
- }
285
- });
286
- }); });
287
- it('Cw721 approve_all', function () { return __awaiter(void 0, void 0, void 0, function () {
288
- var expires, gas, fee, result;
289
- return __generator(this, function (_a) {
290
- switch (_a.label) {
291
- case 0:
292
- expires = { never: {} };
293
- return [4 /*yield*/, firma.Cw721.getGasEstimationApproveAll(aliceWallet, contractAddress, bobAddress, expires)];
294
- case 1:
295
- gas = _a.sent();
296
- fee = Math.ceil(gas * 0.1);
297
- return [4 /*yield*/, firma.Cw721.approveAll(aliceWallet, contractAddress, bobAddress, expires, { gas: gas, fee: fee })];
298
- case 2:
299
- result = _a.sent();
300
- (0, chai_1.expect)(result.code).to.be.equal(0);
301
- return [2 /*return*/];
302
- }
303
- });
304
- }); });
305
- it('Cw721 revoke_all', function () { return __awaiter(void 0, void 0, void 0, function () {
306
- var gas, fee, result;
307
- return __generator(this, function (_a) {
308
- switch (_a.label) {
309
- case 0: return [4 /*yield*/, firma.Cw721.getGasEstimationRevokeAll(aliceWallet, contractAddress, bobAddress)];
310
- case 1:
311
- gas = _a.sent();
312
- fee = Math.ceil(gas * 0.1);
313
- return [4 /*yield*/, firma.Cw721.revokeAll(aliceWallet, contractAddress, bobAddress, { gas: gas, fee: fee })];
314
- case 2:
315
- result = _a.sent();
316
- (0, chai_1.expect)(result.code).to.be.equal(0);
317
- return [2 /*return*/];
318
- }
319
- });
320
- }); });
321
- // TODO: check this test case.
322
- it.skip('Cw721 send_nft', function () { return __awaiter(void 0, void 0, void 0, function () {
323
- var token_id, targetContractAddress, gas, fee, result;
324
- return __generator(this, function (_a) {
325
- switch (_a.label) {
326
- case 0:
327
- token_id = "1";
328
- targetContractAddress = contractAddress;
329
- return [4 /*yield*/, firma.Cw721.getGasEstimationSendNft(aliceWallet, contractAddress, targetContractAddress, bobAddress, token_id)];
330
- case 1:
331
- gas = _a.sent();
332
- fee = Math.ceil(gas * 0.1);
333
- return [4 /*yield*/, firma.Cw721.sendNft(aliceWallet, contractAddress, targetContractAddress, bobAddress, token_id, { gas: gas, fee: fee })];
334
- case 2:
335
- result = _a.sent();
336
- (0, chai_1.expect)(result.code).to.be.equal(0);
337
- return [2 /*return*/];
338
- }
339
- });
340
- }); });
341
- it('Cw721 alice mint, approve, bob transfer', function () { return __awaiter(void 0, void 0, void 0, function () {
342
- var owner, token_id, token_uri, expires, gas, fee, result;
343
- return __generator(this, function (_a) {
344
- switch (_a.label) {
345
- case 0:
346
- owner = aliceAddress;
347
- token_id = "4";
348
- token_uri = "https://meta.nft.io/uri/" + token_id;
349
- expires = { never: {} };
350
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, contractAddress, owner, token_id, token_uri)];
351
- case 1:
352
- gas = _a.sent();
353
- fee = Math.ceil(gas * 0.1);
354
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, contractAddress, owner, token_id, token_uri, { gas: gas, fee: fee })];
355
- case 2:
356
- result = _a.sent();
357
- (0, chai_1.expect)(result.code).to.be.equal(0);
358
- return [4 /*yield*/, firma.Cw721.getGasEstimationApproveAll(aliceWallet, contractAddress, bobAddress, expires)];
359
- case 3:
360
- gas = _a.sent();
361
- fee = Math.ceil(gas * 0.1);
362
- return [4 /*yield*/, firma.Cw721.approveAll(aliceWallet, contractAddress, bobAddress, expires, { gas: gas, fee: fee })];
363
- case 4:
364
- result = _a.sent();
365
- (0, chai_1.expect)(result.code).to.be.equal(0);
366
- return [4 /*yield*/, firma.Cw721.getGasEstimationTransfer(bobWallet, contractAddress, bobAddress, token_id)];
367
- case 5:
368
- gas = _a.sent();
369
- fee = Math.ceil(gas * 0.1);
370
- return [4 /*yield*/, firma.Cw721.transfer(bobWallet, contractAddress, bobAddress, token_id, { gas: gas, fee: fee })];
371
- case 6:
372
- result = _a.sent();
373
- (0, chai_1.expect)(result.code).to.be.equal(0);
374
- return [2 /*return*/];
375
- }
376
- });
377
- }); });
378
- it('Cw721 transfer ownership', function () { return __awaiter(void 0, void 0, void 0, function () {
379
- var expires, new_owner, gas, fee, result;
380
- return __generator(this, function (_a) {
381
- switch (_a.label) {
382
- case 0:
383
- expires = { never: {} };
384
- new_owner = bobAddress;
385
- return [4 /*yield*/, firma.Cw721.getGasEstimationUpdateOwnerShipTransfer(aliceWallet, contractAddress, new_owner, expires)];
386
- case 1:
387
- gas = _a.sent();
388
- fee = Math.ceil(gas * 0.1);
389
- return [4 /*yield*/, firma.Cw721.updateOwnerShipTransfer(aliceWallet, contractAddress, new_owner, expires, { gas: gas, fee: fee })];
390
- case 2:
391
- result = _a.sent();
392
- (0, chai_1.expect)(result.code).to.be.equal(0);
393
- return [2 /*return*/];
394
- }
395
- });
396
- }); });
397
- it('Cw721 accept ownership', function () { return __awaiter(void 0, void 0, void 0, function () {
398
- var gas, fee, result;
399
- return __generator(this, function (_a) {
400
- switch (_a.label) {
401
- case 0: return [4 /*yield*/, firma.Cw721.getGasEstimationUpdateOwnerShipAccept(bobWallet, contractAddress)];
402
- case 1:
403
- gas = _a.sent();
404
- fee = Math.ceil(gas * 0.1);
405
- return [4 /*yield*/, firma.Cw721.updateOwnerShipAccept(bobWallet, contractAddress, { gas: gas, fee: fee })];
406
- case 2:
407
- result = _a.sent();
408
- (0, chai_1.expect)(result.code).to.be.equal(0);
409
- return [2 /*return*/];
410
- }
411
- });
412
- }); });
413
- // give up all ownership.
414
- // This unit test verifies contract ownership renunciation and is skipped by default
415
- it('Cw721 renounce ownership', function () { return __awaiter(void 0, void 0, void 0, function () {
416
- var gas, fee, result;
417
- return __generator(this, function (_a) {
418
- switch (_a.label) {
419
- case 0: return [4 /*yield*/, firma.Cw721.getGasEstimationUpdateOwnerShipRenounce(bobWallet, contractAddress)];
420
- case 1:
421
- gas = _a.sent();
422
- fee = Math.ceil(gas * 0.1);
423
- return [4 /*yield*/, firma.Cw721.updateOwnerShipRenounce(bobWallet, contractAddress, { gas: gas, fee: fee })];
424
- case 2:
425
- result = _a.sent();
426
- (0, chai_1.expect)(result.code).to.be.equal(0);
427
- return [2 /*return*/];
428
- }
429
- });
430
- }); });
431
- });
@@ -1 +0,0 @@
1
- export {};