@firmachain/firma-js 0.2.52 → 0.2.53

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.
@@ -182,25 +182,45 @@ var NftService = /** @class */ (function () {
182
182
  });
183
183
  });
184
184
  };
185
- NftService.prototype.getSignedTxTransfer = function (wallet, toAddress, nftID, txMisc) {
186
- if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
185
+ NftService.prototype.getUnsignedTxTransfer = function (wallet, toAddress, nftID) {
187
186
  return __awaiter(this, void 0, void 0, function () {
188
- var address, message, nftTxClient, error_7;
187
+ var address, message, error_7;
189
188
  return __generator(this, function (_a) {
190
189
  switch (_a.label) {
191
190
  case 0:
192
- _a.trys.push([0, 3, , 4]);
191
+ _a.trys.push([0, 2, , 3]);
193
192
  return [4 /*yield*/, wallet.getAddress()];
194
193
  case 1:
195
194
  address = _a.sent();
196
195
  message = nft_1.NftTxClient.msgTransfer({ owner: address, toAddress: toAddress, nftId: parseInt(nftID) });
196
+ return [2 /*return*/, message];
197
+ case 2:
198
+ error_7 = _a.sent();
199
+ FirmaUtil_1.FirmaUtil.printLog(error_7);
200
+ throw error_7;
201
+ case 3: return [2 /*return*/];
202
+ }
203
+ });
204
+ });
205
+ };
206
+ NftService.prototype.getSignedTxTransfer = function (wallet, toAddress, nftID, txMisc) {
207
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
208
+ return __awaiter(this, void 0, void 0, function () {
209
+ var message, nftTxClient, error_8;
210
+ return __generator(this, function (_a) {
211
+ switch (_a.label) {
212
+ case 0:
213
+ _a.trys.push([0, 3, , 4]);
214
+ return [4 /*yield*/, this.getUnsignedTxTransfer(wallet, toAddress, nftID)];
215
+ case 1:
216
+ message = _a.sent();
197
217
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
198
218
  return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
199
219
  case 2: return [2 /*return*/, _a.sent()];
200
220
  case 3:
201
- error_7 = _a.sent();
202
- FirmaUtil_1.FirmaUtil.printLog(error_7);
203
- throw error_7;
221
+ error_8 = _a.sent();
222
+ FirmaUtil_1.FirmaUtil.printLog(error_8);
223
+ throw error_8;
204
224
  case 4: return [2 /*return*/];
205
225
  }
206
226
  });
@@ -209,7 +229,7 @@ var NftService = /** @class */ (function () {
209
229
  NftService.prototype.transfer = function (wallet, toAddress, nftID, txMisc) {
210
230
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
211
231
  return __awaiter(this, void 0, void 0, function () {
212
- var txRaw, nftTxClient, error_8;
232
+ var txRaw, nftTxClient, error_9;
213
233
  return __generator(this, function (_a) {
214
234
  switch (_a.label) {
215
235
  case 0:
@@ -221,9 +241,9 @@ var NftService = /** @class */ (function () {
221
241
  return [4 /*yield*/, nftTxClient.broadcast(txRaw)];
222
242
  case 2: return [2 /*return*/, _a.sent()];
223
243
  case 3:
224
- error_8 = _a.sent();
225
- FirmaUtil_1.FirmaUtil.printLog(error_8);
226
- throw error_8;
244
+ error_9 = _a.sent();
245
+ FirmaUtil_1.FirmaUtil.printLog(error_9);
246
+ throw error_9;
227
247
  case 4: return [2 /*return*/];
228
248
  }
229
249
  });
@@ -232,7 +252,7 @@ var NftService = /** @class */ (function () {
232
252
  NftService.prototype.getGasEstimationBurn = function (wallet, nftID, txMisc) {
233
253
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
234
254
  return __awaiter(this, void 0, void 0, function () {
235
- var txRaw, error_9;
255
+ var txRaw, error_10;
236
256
  return __generator(this, function (_a) {
237
257
  switch (_a.label) {
238
258
  case 0:
@@ -243,33 +263,53 @@ var NftService = /** @class */ (function () {
243
263
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
244
264
  case 2: return [2 /*return*/, _a.sent()];
245
265
  case 3:
246
- error_9 = _a.sent();
247
- FirmaUtil_1.FirmaUtil.printLog(error_9);
248
- throw error_9;
266
+ error_10 = _a.sent();
267
+ FirmaUtil_1.FirmaUtil.printLog(error_10);
268
+ throw error_10;
249
269
  case 4: return [2 /*return*/];
250
270
  }
251
271
  });
252
272
  });
253
273
  };
254
- NftService.prototype.getSignedTxBurn = function (wallet, nftID, txMisc) {
255
- if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
274
+ NftService.prototype.getUnsignedTxBurn = function (wallet, nftID) {
256
275
  return __awaiter(this, void 0, void 0, function () {
257
- var address, message, nftTxClient, error_10;
276
+ var address, message, error_11;
258
277
  return __generator(this, function (_a) {
259
278
  switch (_a.label) {
260
279
  case 0:
261
- _a.trys.push([0, 3, , 4]);
280
+ _a.trys.push([0, 2, , 3]);
262
281
  return [4 /*yield*/, wallet.getAddress()];
263
282
  case 1:
264
283
  address = _a.sent();
265
284
  message = nft_1.NftTxClient.msgBurn({ owner: address, nftId: parseInt(nftID) });
285
+ return [2 /*return*/, message];
286
+ case 2:
287
+ error_11 = _a.sent();
288
+ FirmaUtil_1.FirmaUtil.printLog(error_11);
289
+ throw error_11;
290
+ case 3: return [2 /*return*/];
291
+ }
292
+ });
293
+ });
294
+ };
295
+ NftService.prototype.getSignedTxBurn = function (wallet, nftID, txMisc) {
296
+ if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
297
+ return __awaiter(this, void 0, void 0, function () {
298
+ var message, nftTxClient, error_12;
299
+ return __generator(this, function (_a) {
300
+ switch (_a.label) {
301
+ case 0:
302
+ _a.trys.push([0, 3, , 4]);
303
+ return [4 /*yield*/, this.getUnsignedTxBurn(wallet, nftID)];
304
+ case 1:
305
+ message = _a.sent();
266
306
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
267
307
  return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
268
308
  case 2: return [2 /*return*/, _a.sent()];
269
309
  case 3:
270
- error_10 = _a.sent();
271
- FirmaUtil_1.FirmaUtil.printLog(error_10);
272
- throw error_10;
310
+ error_12 = _a.sent();
311
+ FirmaUtil_1.FirmaUtil.printLog(error_12);
312
+ throw error_12;
273
313
  case 4: return [2 /*return*/];
274
314
  }
275
315
  });
@@ -278,7 +318,7 @@ var NftService = /** @class */ (function () {
278
318
  NftService.prototype.burn = function (wallet, nftID, txMisc) {
279
319
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
280
320
  return __awaiter(this, void 0, void 0, function () {
281
- var txRaw, nftTxClient, error_11;
321
+ var txRaw, nftTxClient, error_13;
282
322
  return __generator(this, function (_a) {
283
323
  switch (_a.label) {
284
324
  case 0:
@@ -290,9 +330,9 @@ var NftService = /** @class */ (function () {
290
330
  return [4 /*yield*/, nftTxClient.broadcast(txRaw)];
291
331
  case 2: return [2 /*return*/, _a.sent()];
292
332
  case 3:
293
- error_11 = _a.sent();
294
- FirmaUtil_1.FirmaUtil.printLog(error_11);
295
- throw error_11;
333
+ error_13 = _a.sent();
334
+ FirmaUtil_1.FirmaUtil.printLog(error_13);
335
+ throw error_13;
296
336
  case 4: return [2 /*return*/];
297
337
  }
298
338
  });
@@ -301,7 +341,7 @@ var NftService = /** @class */ (function () {
301
341
  NftService.prototype.getGasEstimationFromEncodeObject = function (wallet, msgList, txMisc) {
302
342
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
303
343
  return __awaiter(this, void 0, void 0, function () {
304
- var nftTxClient, txRaw, error_12;
344
+ var nftTxClient, txRaw, error_14;
305
345
  return __generator(this, function (_a) {
306
346
  switch (_a.label) {
307
347
  case 0:
@@ -313,9 +353,9 @@ var NftService = /** @class */ (function () {
313
353
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
314
354
  case 2: return [2 /*return*/, _a.sent()];
315
355
  case 3:
316
- error_12 = _a.sent();
317
- FirmaUtil_1.FirmaUtil.printLog(error_12);
318
- throw error_12;
356
+ error_14 = _a.sent();
357
+ FirmaUtil_1.FirmaUtil.printLog(error_14);
358
+ throw error_14;
319
359
  case 4: return [2 /*return*/];
320
360
  }
321
361
  });
@@ -324,7 +364,7 @@ var NftService = /** @class */ (function () {
324
364
  NftService.prototype.getGasEstimationMint = function (wallet, tokenURI, txMisc) {
325
365
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
326
366
  return __awaiter(this, void 0, void 0, function () {
327
- var txRaw, error_13;
367
+ var txRaw, error_15;
328
368
  return __generator(this, function (_a) {
329
369
  switch (_a.label) {
330
370
  case 0:
@@ -335,9 +375,9 @@ var NftService = /** @class */ (function () {
335
375
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
336
376
  case 2: return [2 /*return*/, _a.sent()];
337
377
  case 3:
338
- error_13 = _a.sent();
339
- FirmaUtil_1.FirmaUtil.printLog(error_13);
340
- throw error_13;
378
+ error_15 = _a.sent();
379
+ FirmaUtil_1.FirmaUtil.printLog(error_15);
380
+ throw error_15;
341
381
  case 4: return [2 /*return*/];
342
382
  }
343
383
  });
@@ -346,31 +386,51 @@ var NftService = /** @class */ (function () {
346
386
  NftService.prototype.getSignedTxMint = function (wallet, tokenURI, txMisc) {
347
387
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
348
388
  return __awaiter(this, void 0, void 0, function () {
349
- var address, message, nftTxClient, error_14;
389
+ var message, nftTxClient, error_16;
350
390
  return __generator(this, function (_a) {
351
391
  switch (_a.label) {
352
392
  case 0:
353
393
  _a.trys.push([0, 3, , 4]);
354
- return [4 /*yield*/, wallet.getAddress()];
394
+ return [4 /*yield*/, this.getUnsignedTxMint(wallet, tokenURI)];
355
395
  case 1:
356
- address = _a.sent();
357
- message = nft_1.NftTxClient.msgMint({ owner: address, tokenURI: tokenURI });
396
+ message = _a.sent();
358
397
  nftTxClient = new nft_1.NftTxClient(wallet, this.config.rpcAddress);
359
398
  return [4 /*yield*/, nftTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
360
399
  case 2: return [2 /*return*/, _a.sent()];
361
400
  case 3:
362
- error_14 = _a.sent();
363
- FirmaUtil_1.FirmaUtil.printLog(error_14);
364
- throw error_14;
401
+ error_16 = _a.sent();
402
+ FirmaUtil_1.FirmaUtil.printLog(error_16);
403
+ throw error_16;
365
404
  case 4: return [2 /*return*/];
366
405
  }
367
406
  });
368
407
  });
369
408
  };
409
+ NftService.prototype.getUnsignedTxMint = function (wallet, tokenURI) {
410
+ return __awaiter(this, void 0, void 0, function () {
411
+ var address, message, error_17;
412
+ return __generator(this, function (_a) {
413
+ switch (_a.label) {
414
+ case 0:
415
+ _a.trys.push([0, 2, , 3]);
416
+ return [4 /*yield*/, wallet.getAddress()];
417
+ case 1:
418
+ address = _a.sent();
419
+ message = nft_1.NftTxClient.msgMint({ owner: address, tokenURI: tokenURI });
420
+ return [2 /*return*/, message];
421
+ case 2:
422
+ error_17 = _a.sent();
423
+ FirmaUtil_1.FirmaUtil.printLog(error_17);
424
+ throw error_17;
425
+ case 3: return [2 /*return*/];
426
+ }
427
+ });
428
+ });
429
+ };
370
430
  NftService.prototype.mint = function (wallet, tokenURI, txMisc) {
371
431
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
372
432
  return __awaiter(this, void 0, void 0, function () {
373
- var txRaw, nftTxClient, error_15;
433
+ var txRaw, nftTxClient, error_18;
374
434
  return __generator(this, function (_a) {
375
435
  switch (_a.label) {
376
436
  case 0:
@@ -382,9 +442,9 @@ var NftService = /** @class */ (function () {
382
442
  return [4 /*yield*/, nftTxClient.broadcast(txRaw)];
383
443
  case 2: return [2 /*return*/, _a.sent()];
384
444
  case 3:
385
- error_15 = _a.sent();
386
- FirmaUtil_1.FirmaUtil.printLog(error_15);
387
- throw error_15;
445
+ error_18 = _a.sent();
446
+ FirmaUtil_1.FirmaUtil.printLog(error_18);
447
+ throw error_18;
388
448
  case 4: return [2 /*return*/];
389
449
  }
390
450
  });
@@ -393,7 +453,7 @@ var NftService = /** @class */ (function () {
393
453
  NftService.prototype.signAndBroadcast = function (wallet, msgList, txMisc) {
394
454
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
395
455
  return __awaiter(this, void 0, void 0, function () {
396
- var contractTxClient, error_16;
456
+ var contractTxClient, error_19;
397
457
  return __generator(this, function (_a) {
398
458
  switch (_a.label) {
399
459
  case 0:
@@ -402,9 +462,9 @@ var NftService = /** @class */ (function () {
402
462
  return [4 /*yield*/, contractTxClient.signAndBroadcast(msgList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
403
463
  case 1: return [2 /*return*/, _a.sent()];
404
464
  case 2:
405
- error_16 = _a.sent();
406
- FirmaUtil_1.FirmaUtil.printLog(error_16);
407
- throw error_16;
465
+ error_19 = _a.sent();
466
+ FirmaUtil_1.FirmaUtil.printLog(error_19);
467
+ throw error_19;
408
468
  case 3: return [2 /*return*/];
409
469
  }
410
470
  });
@@ -17,6 +17,7 @@ import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
17
17
  import { FirmaIbcService } from "./FirmaIbcService";
18
18
  import { FirmaMintService } from "./FirmaMintService";
19
19
  import { FirmaCosmWasmCw721Service } from "./FirmaCosmWasmCw721";
20
+ import { FirmaCosmWasmCwBridgeService } from "./FirmaCosmWasmCwBridge";
20
21
  export declare class FirmaSDK {
21
22
  Config: FirmaConfig;
22
23
  Wallet: FirmaWalletService;
@@ -37,5 +38,6 @@ export declare class FirmaSDK {
37
38
  Mint: FirmaMintService;
38
39
  Cw20: FirmaCosmWasmCw20Service;
39
40
  Cw721: FirmaCosmWasmCw721Service;
40
- constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService, Ibc?: FirmaIbcService, Mint?: FirmaMintService, Cw20?: FirmaCosmWasmCw20Service, Cw721?: FirmaCosmWasmCw721Service);
41
+ CwBridge: FirmaCosmWasmCwBridgeService;
42
+ constructor(Config: FirmaConfig, Wallet?: FirmaWalletService, Bank?: FirmaBankService, FeeGrant?: FirmaFeeGrantService, Staking?: FirmaStakingService, Distribution?: FirmaDistributionService, Gov?: FirmaGovService, Nft?: NftService, Token?: TokenService, Contract?: ContractService, Ipfs?: IpfsService, BlockChain?: ChainService, Slashing?: SlashingService, Authz?: FirmaAuthzService, CosmWasm?: FirmaCosmWasmService, Ibc?: FirmaIbcService, Mint?: FirmaMintService, Cw20?: FirmaCosmWasmCw20Service, Cw721?: FirmaCosmWasmCw721Service, CwBridge?: FirmaCosmWasmCwBridgeService);
41
43
  }
@@ -20,8 +20,9 @@ var FirmaCosmWasmService_1 = require("./FirmaCosmWasmService");
20
20
  var FirmaIbcService_1 = require("./FirmaIbcService");
21
21
  var FirmaMintService_1 = require("./FirmaMintService");
22
22
  var FirmaCosmWasmCw721_1 = require("./FirmaCosmWasmCw721");
23
+ var FirmaCosmWasmCwBridge_1 = require("./FirmaCosmWasmCwBridge");
23
24
  var FirmaSDK = /** @class */ (function () {
24
- function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc, Mint, Cw20, Cw721) {
25
+ function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc, Mint, Cw20, Cw721, CwBridge) {
25
26
  if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
26
27
  if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
27
28
  if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
@@ -40,6 +41,7 @@ var FirmaSDK = /** @class */ (function () {
40
41
  if (Mint === void 0) { Mint = new FirmaMintService_1.FirmaMintService(Config); }
41
42
  if (Cw20 === void 0) { Cw20 = new FirmaCosmWasmCw20_1.FirmaCosmWasmCw20Service(Config, CosmWasm); }
42
43
  if (Cw721 === void 0) { Cw721 = new FirmaCosmWasmCw721_1.FirmaCosmWasmCw721Service(Config, CosmWasm); }
44
+ if (CwBridge === void 0) { CwBridge = new FirmaCosmWasmCwBridge_1.FirmaCosmWasmCwBridgeService(Config, CosmWasm, Cw721); }
43
45
  this.Config = Config;
44
46
  this.Wallet = Wallet;
45
47
  this.Bank = Bank;
@@ -59,6 +61,7 @@ var FirmaSDK = /** @class */ (function () {
59
61
  this.Mint = Mint;
60
62
  this.Cw20 = Cw20;
61
63
  this.Cw721 = Cw721;
64
+ this.CwBridge = CwBridge;
62
65
  FirmaUtil_1.FirmaUtil.config = Config;
63
66
  }
64
67
  return FirmaSDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firmachain/firma-js",
3
- "version": "0.2.52",
3
+ "version": "0.2.53",
4
4
  "description": "The Official FirmaChain Javascript SDK written in Typescript",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",