@firmachain/firma-js 0.3.8 → 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 +20 -15
  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 +58 -37
  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 -394
  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 -26
  127. package/dist/test/config_test.sample.d.ts +0 -11
  128. package/dist/test/config_test.sample.js +0 -14
@@ -1,476 +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('[34. Bridge tx 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 codeId = "";
122
- var cw721ContractAddress = "";
123
- var bridgeContractAddress = "";
124
- it('Cosmwasm Cw721 setup', function () { return __awaiter(void 0, void 0, void 0, function () {
125
- var wasmFile, array, storeGas, storeFee, everyBodyAccessConfig, storeCodeResult, admin, label, instantiateGas, instantiateFee, noFunds, testData, instantiateResult;
126
- return __generator(this, function (_a) {
127
- switch (_a.label) {
128
- case 0:
129
- wasmFile = fs_1.default.readFileSync("./test/sample/cw721_base.wasm");
130
- array = new Uint8Array(wasmFile.buffer);
131
- storeGas = 3000000;
132
- storeFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
133
- everyBodyAccessConfig = {
134
- permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
135
- address: "",
136
- addresses: []
137
- };
138
- return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: storeGas, fee: storeFee })];
139
- case 1:
140
- storeCodeResult = _a.sent();
141
- codeId = extractValue(storeCodeResult.events, "store_code", "code_id");
142
- (0, chai_1.expect)(storeCodeResult.code).to.be.equal(0);
143
- return [4 /*yield*/, aliceWallet.getAddress()];
144
- case 2:
145
- admin = _a.sent();
146
- label = "test1";
147
- instantiateGas = 3000000;
148
- instantiateFee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
149
- noFunds = [];
150
- testData = JSON.stringify({
151
- minter: aliceAddress,
152
- name: "My Awesome NFT Collection",
153
- symbol: "MAWESOME"
154
- });
155
- return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: instantiateGas, fee: instantiateFee })];
156
- case 3:
157
- instantiateResult = _a.sent();
158
- cw721ContractAddress = extractValue(instantiateResult.events, "instantiate", "_contract_address");
159
- (0, chai_1.expect)(instantiateResult.code).to.be.equal(0);
160
- return [2 /*return*/];
161
- }
162
- });
163
- }); });
164
- it('CosmWasm Cw bridge StoreCode', function () { return __awaiter(void 0, void 0, void 0, function () {
165
- var wasmFile, array, gas, fee, everyBodyAccessConfig, result;
166
- return __generator(this, function (_a) {
167
- switch (_a.label) {
168
- case 0:
169
- wasmFile = fs_1.default.readFileSync("./test/sample/bridge_contract.wasm");
170
- array = new Uint8Array(wasmFile.buffer);
171
- gas = 3000000;
172
- fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
173
- everyBodyAccessConfig = {
174
- permission: FirmaCosmWasmService_1.AccessType.ACCESS_TYPE_EVERYBODY,
175
- address: "",
176
- addresses: []
177
- };
178
- return [4 /*yield*/, firma.CosmWasm.storeCode(aliceWallet, array, everyBodyAccessConfig, { gas: gas, fee: fee })];
179
- case 1:
180
- result = _a.sent();
181
- codeId = extractValue(result.events, "store_code", "code_id");
182
- (0, chai_1.expect)(result.code).to.be.equal(0);
183
- return [2 /*return*/];
184
- }
185
- });
186
- }); });
187
- it('CosmWasm Cw bridge InstantiateContract', function () { return __awaiter(void 0, void 0, void 0, function () {
188
- var admin, label, gas, fee, noFunds, testData, result;
189
- return __generator(this, function (_a) {
190
- switch (_a.label) {
191
- case 0:
192
- admin = aliceAddress;
193
- label = "CwBridge";
194
- gas = 3000000;
195
- fee = FirmaUtil_1.FirmaUtil.getUFCTFromFCT(0.3);
196
- noFunds = [];
197
- testData = JSON.stringify({
198
- owner: admin,
199
- cw721_address: cw721ContractAddress
200
- });
201
- return [4 /*yield*/, firma.CosmWasm.instantiateContract(aliceWallet, admin, codeId, label, testData, noFunds, { gas: gas, fee: fee })];
202
- case 1:
203
- result = _a.sent();
204
- bridgeContractAddress = extractValue(result.events, "instantiate", "_contract_address");
205
- (0, chai_1.expect)(result.code).to.be.equal(0);
206
- return [2 /*return*/];
207
- }
208
- });
209
- }); });
210
- it('Cw bridge mint temp', function () { return __awaiter(void 0, void 0, void 0, function () {
211
- var owner, tokenId1, tokenUri1, gas1, fee1, result1, tokenId2, tokenUri2, gas2, fee2, result2, tokenId3, tokenUri3, gas3, fee3, result3;
212
- return __generator(this, function (_a) {
213
- switch (_a.label) {
214
- case 0:
215
- owner = aliceAddress;
216
- tokenId1 = "1";
217
- tokenUri1 = "https://meta.nft.io/uri/" + tokenId1;
218
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, cw721ContractAddress, owner, tokenId1, tokenUri1)];
219
- case 1:
220
- gas1 = _a.sent();
221
- fee1 = Math.ceil(gas1 * 0.1);
222
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, cw721ContractAddress, owner, tokenId1, tokenUri1, { gas: gas1, fee: fee1 })];
223
- case 2:
224
- result1 = _a.sent();
225
- (0, chai_1.expect)(result1.code).to.be.equal(0);
226
- tokenId2 = "2";
227
- tokenUri2 = "https://meta.nft.io/uri/" + tokenId2;
228
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, cw721ContractAddress, owner, tokenId2, tokenUri2)];
229
- case 3:
230
- gas2 = _a.sent();
231
- fee2 = Math.ceil(gas2 * 0.1);
232
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, cw721ContractAddress, owner, tokenId2, tokenUri2, { gas: gas2, fee: fee2 })];
233
- case 4:
234
- result2 = _a.sent();
235
- (0, chai_1.expect)(result2.code).to.be.equal(0);
236
- tokenId3 = "3";
237
- tokenUri3 = "https://meta.nft.io/uri/" + tokenId3;
238
- return [4 /*yield*/, firma.Cw721.getGasEstimationMint(aliceWallet, cw721ContractAddress, owner, tokenId3, tokenUri3)];
239
- case 5:
240
- gas3 = _a.sent();
241
- fee3 = Math.ceil(gas3 * 0.1);
242
- return [4 /*yield*/, firma.Cw721.mint(aliceWallet, cw721ContractAddress, owner, tokenId3, tokenUri3, { gas: gas3, fee: fee3 })];
243
- case 6:
244
- result3 = _a.sent();
245
- (0, chai_1.expect)(result3.code).to.be.equal(0);
246
- return [2 /*return*/];
247
- }
248
- });
249
- }); });
250
- it('Cw bridge add_authorized_user', function () { return __awaiter(void 0, void 0, void 0, function () {
251
- var user, gas, fee, result;
252
- return __generator(this, function (_a) {
253
- switch (_a.label) {
254
- case 0:
255
- user = aliceAddress;
256
- return [4 /*yield*/, firma.CwBridge.getGasEstimationAddAuthorizedUser(aliceWallet, bridgeContractAddress, user)];
257
- case 1:
258
- gas = _a.sent();
259
- fee = Math.ceil(gas * 0.1);
260
- return [4 /*yield*/, firma.CwBridge.addAuthorizedUser(aliceWallet, bridgeContractAddress, user, { gas: gas, fee: fee })];
261
- case 2:
262
- result = _a.sent();
263
- (0, chai_1.expect)(result.code).to.be.equal(0);
264
- return [2 /*return*/];
265
- }
266
- });
267
- }); });
268
- it('Cw bridge lock', function () { return __awaiter(void 0, void 0, void 0, function () {
269
- var token_id, gas, fee, result;
270
- return __generator(this, function (_a) {
271
- switch (_a.label) {
272
- case 0:
273
- token_id = "1";
274
- return [4 /*yield*/, firma.CwBridge.getGasEstimationLock(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id)];
275
- case 1:
276
- gas = _a.sent();
277
- fee = Math.ceil(gas * 0.1);
278
- return [4 /*yield*/, firma.CwBridge.lock(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id, { gas: gas, fee: fee })];
279
- case 2:
280
- result = _a.sent();
281
- (0, chai_1.expect)(result.code).to.be.equal(0);
282
- return [2 /*return*/];
283
- }
284
- });
285
- }); });
286
- it('cw bridge lock bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
287
- var token_id1, token_id2, tx1, tx2, gas, fee, result;
288
- return __generator(this, function (_a) {
289
- switch (_a.label) {
290
- case 0:
291
- token_id1 = "2";
292
- token_id2 = "3";
293
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxLock(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id1)];
294
- case 1:
295
- tx1 = _a.sent();
296
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxLock(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id2)];
297
- case 2:
298
- tx2 = _a.sent();
299
- return [4 /*yield*/, firma.CwBridge.getGasEstimationSignAndBroadcast(aliceWallet, [tx1, tx2])];
300
- case 3:
301
- gas = _a.sent();
302
- fee = Math.ceil(gas * 0.1);
303
- return [4 /*yield*/, firma.CwBridge.signAndBroadcast(aliceWallet, [tx1, tx2], { gas: gas, fee: fee })];
304
- case 4:
305
- result = _a.sent();
306
- (0, chai_1.expect)(result.code).to.be.equal(0);
307
- return [2 /*return*/];
308
- }
309
- });
310
- }); });
311
- it('Cw bridge unlock', function () { return __awaiter(void 0, void 0, void 0, function () {
312
- var token_id, gas, fee, result;
313
- return __generator(this, function (_a) {
314
- switch (_a.label) {
315
- case 0:
316
- token_id = "1";
317
- return [4 /*yield*/, firma.CwBridge.getGasEstimationUnlock(aliceWallet, bridgeContractAddress, token_id)];
318
- case 1:
319
- gas = _a.sent();
320
- fee = Math.ceil(gas * 0.1);
321
- return [4 /*yield*/, firma.CwBridge.unlock(aliceWallet, bridgeContractAddress, token_id, { gas: gas, fee: fee })];
322
- case 2:
323
- result = _a.sent();
324
- (0, chai_1.expect)(result.code).to.be.equal(0);
325
- return [2 /*return*/];
326
- }
327
- });
328
- }); });
329
- it('Cw bridge unlock bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
330
- var token_id1, token_id2, tx1, tx2, gas, fee, result;
331
- return __generator(this, function (_a) {
332
- switch (_a.label) {
333
- case 0:
334
- token_id1 = "2";
335
- token_id2 = "3";
336
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxUnlock(aliceWallet, bridgeContractAddress, token_id1)];
337
- case 1:
338
- tx1 = _a.sent();
339
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxUnlock(aliceWallet, bridgeContractAddress, token_id2)];
340
- case 2:
341
- tx2 = _a.sent();
342
- return [4 /*yield*/, firma.CwBridge.getGasEstimationSignAndBroadcast(aliceWallet, [tx1, tx2])];
343
- case 3:
344
- gas = _a.sent();
345
- fee = Math.ceil(gas * 0.1);
346
- return [4 /*yield*/, firma.CwBridge.signAndBroadcast(aliceWallet, [tx1, tx2], { gas: gas, fee: fee })];
347
- case 4:
348
- result = _a.sent();
349
- (0, chai_1.expect)(result.code).to.be.equal(0);
350
- return [2 /*return*/];
351
- }
352
- });
353
- }); });
354
- it('Cw bridge deposit', function () { return __awaiter(void 0, void 0, void 0, function () {
355
- var token_id, gas, fee, result;
356
- return __generator(this, function (_a) {
357
- switch (_a.label) {
358
- case 0:
359
- token_id = "1";
360
- return [4 /*yield*/, firma.CwBridge.getGasEstimationDeposit(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id, bobAddress)];
361
- case 1:
362
- gas = _a.sent();
363
- fee = Math.ceil(gas * 0.1);
364
- return [4 /*yield*/, firma.CwBridge.deposit(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id, bobAddress, { gas: gas, fee: fee })];
365
- case 2:
366
- result = _a.sent();
367
- (0, chai_1.expect)(result.code).to.be.equal(0);
368
- return [2 /*return*/];
369
- }
370
- });
371
- }); });
372
- it('Cw bridge deposit bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
373
- var token_id1, token_id2, tx1, tx2, gas, fee, result;
374
- return __generator(this, function (_a) {
375
- switch (_a.label) {
376
- case 0:
377
- token_id1 = "2";
378
- token_id2 = "3";
379
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxDeposit(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id1, bobAddress)];
380
- case 1:
381
- tx1 = _a.sent();
382
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxDeposit(aliceWallet, bridgeContractAddress, cw721ContractAddress, token_id2, bobAddress)];
383
- case 2:
384
- tx2 = _a.sent();
385
- return [4 /*yield*/, firma.CwBridge.getGasEstimationSignAndBroadcast(aliceWallet, [tx1, tx2])];
386
- case 3:
387
- gas = _a.sent();
388
- fee = Math.ceil(gas * 0.1);
389
- return [4 /*yield*/, firma.CwBridge.signAndBroadcast(aliceWallet, [tx1, tx2], { gas: gas, fee: fee })];
390
- case 4:
391
- result = _a.sent();
392
- (0, chai_1.expect)(result.code).to.be.equal(0);
393
- return [2 /*return*/];
394
- }
395
- });
396
- }); });
397
- it('Cw bridge withdraw', function () { return __awaiter(void 0, void 0, void 0, function () {
398
- var token_id, gas, fee, result;
399
- return __generator(this, function (_a) {
400
- switch (_a.label) {
401
- case 0:
402
- token_id = "1";
403
- return [4 /*yield*/, firma.CwBridge.getGasEstimationWithdraw(bobWallet, bridgeContractAddress, token_id)];
404
- case 1:
405
- gas = _a.sent();
406
- fee = Math.ceil(gas * 0.1);
407
- return [4 /*yield*/, firma.CwBridge.withdraw(bobWallet, bridgeContractAddress, token_id, { gas: gas, fee: fee })];
408
- case 2:
409
- result = _a.sent();
410
- (0, chai_1.expect)(result.code).to.be.equal(0);
411
- return [2 /*return*/];
412
- }
413
- });
414
- }); });
415
- it('Cw bridge withdraw bulk', function () { return __awaiter(void 0, void 0, void 0, function () {
416
- var token_id1, token_id2, tx1, tx2, gas, fee, result;
417
- return __generator(this, function (_a) {
418
- switch (_a.label) {
419
- case 0:
420
- token_id1 = "2";
421
- token_id2 = "3";
422
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxWithdraw(bobWallet, bridgeContractAddress, token_id1)];
423
- case 1:
424
- tx1 = _a.sent();
425
- return [4 /*yield*/, firma.CwBridge.getUnsignedTxWithdraw(bobWallet, bridgeContractAddress, token_id2)];
426
- case 2:
427
- tx2 = _a.sent();
428
- return [4 /*yield*/, firma.CwBridge.getGasEstimationSignAndBroadcast(bobWallet, [tx1, tx2])];
429
- case 3:
430
- gas = _a.sent();
431
- fee = Math.ceil(gas * 0.1);
432
- return [4 /*yield*/, firma.CwBridge.signAndBroadcast(bobWallet, [tx1, tx2], { gas: gas, fee: fee })];
433
- case 4:
434
- result = _a.sent();
435
- (0, chai_1.expect)(result.code).to.be.equal(0);
436
- return [2 /*return*/];
437
- }
438
- });
439
- }); });
440
- it('Cw bridge remove_authorized_user', function () { return __awaiter(void 0, void 0, void 0, function () {
441
- var user, gas, fee, result;
442
- return __generator(this, function (_a) {
443
- switch (_a.label) {
444
- case 0:
445
- user = aliceAddress;
446
- return [4 /*yield*/, firma.CwBridge.getGasEstimationRemoveAuthorizedUser(aliceWallet, bridgeContractAddress, user)];
447
- case 1:
448
- gas = _a.sent();
449
- fee = Math.ceil(gas * 0.1);
450
- return [4 /*yield*/, firma.CwBridge.removeAuthorizedUser(aliceWallet, bridgeContractAddress, user, { gas: gas, fee: fee })];
451
- case 2:
452
- result = _a.sent();
453
- (0, chai_1.expect)(result.code).to.be.equal(0);
454
- return [2 /*return*/];
455
- }
456
- });
457
- }); });
458
- it('Cw bridge chage_owner', function () { return __awaiter(void 0, void 0, void 0, function () {
459
- var new_owner, gas, fee, result;
460
- return __generator(this, function (_a) {
461
- switch (_a.label) {
462
- case 0:
463
- new_owner = bobAddress;
464
- return [4 /*yield*/, firma.CwBridge.getGasEstimationChangeOwner(aliceWallet, bridgeContractAddress, new_owner)];
465
- case 1:
466
- gas = _a.sent();
467
- fee = Math.ceil(gas * 0.1);
468
- return [4 /*yield*/, firma.CwBridge.changeOwner(aliceWallet, bridgeContractAddress, new_owner, { gas: gas, fee: fee })];
469
- case 2:
470
- result = _a.sent();
471
- (0, chai_1.expect)(result.code).to.be.equal(0);
472
- return [2 /*return*/];
473
- }
474
- });
475
- }); });
476
- });
@@ -1 +0,0 @@
1
- export {};