@firmachain/firma-js 0.2.47 → 0.2.49

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 (69) hide show
  1. package/dist/index.js +1 -5
  2. package/dist/sdk/FirmaAuthzService.js +5 -5
  3. package/dist/sdk/FirmaBankService.js +1 -1
  4. package/dist/sdk/FirmaChainService.d.ts +5 -0
  5. package/dist/sdk/FirmaChainService.js +44 -0
  6. package/dist/sdk/FirmaContractService.js +5 -5
  7. package/dist/sdk/FirmaCosmWasmCw20.d.ts +17 -0
  8. package/dist/sdk/FirmaCosmWasmCw20.js +269 -0
  9. package/dist/sdk/FirmaCosmWasmCw721.d.ts +43 -0
  10. package/dist/sdk/FirmaCosmWasmCw721.js +318 -0
  11. package/dist/sdk/FirmaCosmWasmService.js +9 -9
  12. package/dist/sdk/FirmaDistributionService.js +5 -5
  13. package/dist/sdk/FirmaFeeGrantService.js +3 -3
  14. package/dist/sdk/FirmaGovService.js +7 -7
  15. package/dist/sdk/FirmaIbcService.js +1 -1
  16. package/dist/sdk/FirmaNftService.js +5 -5
  17. package/dist/sdk/FirmaSDK.d.ts +5 -1
  18. package/dist/sdk/FirmaSDK.js +7 -1
  19. package/dist/sdk/FirmaStakingService.d.ts +7 -1
  20. package/dist/sdk/FirmaStakingService.js +16 -8
  21. package/dist/sdk/FirmaTokenService.js +4 -4
  22. package/dist/sdk/FirmaUtil.js +16 -20
  23. package/dist/sdk/FirmaWalletService.js +3 -3
  24. package/dist/sdk/firmachain/amino/addresses.js +11 -11
  25. package/dist/sdk/firmachain/amino/aminotypes.js +32 -36
  26. package/dist/sdk/firmachain/amino/encoding.js +26 -30
  27. package/dist/sdk/firmachain/amino/multisig.js +5 -5
  28. package/dist/sdk/firmachain/amino/signature.js +4 -4
  29. package/dist/sdk/firmachain/amino/signdoc.js +1 -1
  30. package/dist/sdk/firmachain/amino/wallet.js +10 -14
  31. package/dist/sdk/firmachain/authz/AuthzQueryClient.js +3 -3
  32. package/dist/sdk/firmachain/authz/index.js +1 -5
  33. package/dist/sdk/firmachain/bank/BankQueryClient.js +4 -4
  34. package/dist/sdk/firmachain/bank/index.js +1 -5
  35. package/dist/sdk/firmachain/common/LedgerSigningStargateClient.js +2 -2
  36. package/dist/sdk/firmachain/common/LedgerWallet.js +10 -14
  37. package/dist/sdk/firmachain/common/accounts.js +2 -2
  38. package/dist/sdk/firmachain/common/index.js +1 -5
  39. package/dist/sdk/firmachain/common/signing.js +5 -9
  40. package/dist/sdk/firmachain/common/signingaminostargateclient.js +16 -16
  41. package/dist/sdk/firmachain/common/signingstargateclient.js +14 -18
  42. package/dist/sdk/firmachain/common/stargateclient.js +6 -6
  43. package/dist/sdk/firmachain/contract/ContractQueryClient.js +2 -2
  44. package/dist/sdk/firmachain/contract/ContractTxTypes.d.ts +4 -4
  45. package/dist/sdk/firmachain/contract/index.js +1 -5
  46. package/dist/sdk/firmachain/cosmwasm/CosmWasmQueryClient.js +8 -8
  47. package/dist/sdk/firmachain/cosmwasm/index.js +1 -5
  48. package/dist/sdk/firmachain/distribution/DistributionQueryClient.js +5 -5
  49. package/dist/sdk/firmachain/distribution/index.js +1 -5
  50. package/dist/sdk/firmachain/feegrant/FeeGrantQueryClient.js +2 -2
  51. package/dist/sdk/firmachain/feegrant/index.js +1 -5
  52. package/dist/sdk/firmachain/google/protobuf/any.d.ts +1 -1
  53. package/dist/sdk/firmachain/google/protobuf/descriptor.d.ts +27 -27
  54. package/dist/sdk/firmachain/google/protobuf/duration.d.ts +1 -1
  55. package/dist/sdk/firmachain/google/protobuf/timestamp.d.ts +1 -1
  56. package/dist/sdk/firmachain/gov/GovQueryClient.js +2 -2
  57. package/dist/sdk/firmachain/gov/index.js +1 -5
  58. package/dist/sdk/firmachain/ibc/IbcQueryClient.js +1 -1
  59. package/dist/sdk/firmachain/ibc/index.js +1 -5
  60. package/dist/sdk/firmachain/mint/index.js +1 -5
  61. package/dist/sdk/firmachain/nft/NftTxTypes.d.ts +6 -6
  62. package/dist/sdk/firmachain/nft/index.js +1 -5
  63. package/dist/sdk/firmachain/slashing/index.js +1 -5
  64. package/dist/sdk/firmachain/staking/StakingQueryClient.d.ts +3 -3
  65. package/dist/sdk/firmachain/staking/StakingQueryClient.js +13 -13
  66. package/dist/sdk/firmachain/staking/index.js +1 -5
  67. package/dist/sdk/firmachain/token/TokenTxTypes.d.ts +8 -8
  68. package/dist/sdk/firmachain/token/index.js +1 -5
  69. package/package.json +24 -24
package/dist/index.js CHANGED
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -73,7 +73,7 @@ var FirmaAuthzService = /** @class */ (function () {
73
73
  }
74
74
  });
75
75
  authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
76
- return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
76
+ return [4 /*yield*/, authzTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
77
77
  case 2: return [2 /*return*/, _a.sent()];
78
78
  case 3:
79
79
  error_1 = _a.sent();
@@ -113,7 +113,7 @@ var FirmaAuthzService = /** @class */ (function () {
113
113
  }
114
114
  });
115
115
  authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
116
- return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
116
+ return [4 /*yield*/, authzTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
117
117
  case 2: return [2 /*return*/, _a.sent()];
118
118
  case 3:
119
119
  error_2 = _a.sent();
@@ -151,7 +151,7 @@ var FirmaAuthzService = /** @class */ (function () {
151
151
  }
152
152
  });
153
153
  authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
154
- return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
154
+ return [4 /*yield*/, authzTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
155
155
  case 2: return [2 /*return*/, _a.sent()];
156
156
  case 3:
157
157
  error_3 = _a.sent();
@@ -179,7 +179,7 @@ var FirmaAuthzService = /** @class */ (function () {
179
179
  msgTypeUrl: msgType
180
180
  });
181
181
  authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
182
- return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
182
+ return [4 /*yield*/, authzTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
183
183
  case 2: return [2 /*return*/, _a.sent()];
184
184
  case 3:
185
185
  error_4 = _a.sent();
@@ -207,7 +207,7 @@ var FirmaAuthzService = /** @class */ (function () {
207
207
  msgs: msgs
208
208
  });
209
209
  authzTxClient = new authz_1.AuthzTxClient(wallet, this.config.rpcAddress);
210
- return [4 /*yield*/, authzTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
210
+ return [4 /*yield*/, authzTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
211
211
  case 2: return [2 /*return*/, _a.sent()];
212
212
  case 3:
213
213
  error_5 = _a.sent();
@@ -286,7 +286,7 @@ var FirmaBankService = /** @class */ (function () {
286
286
  address = _a.sent();
287
287
  sendAmount = { denom: denom, amount: amount };
288
288
  message = bank_1.BankTxClient.msgSend({ fromAddress: address, toAddress: targetAddress, amount: [sendAmount] });
289
- return [4 /*yield*/, bankTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
289
+ return [4 /*yield*/, bankTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
290
290
  case 2: return [2 /*return*/, _a.sent()];
291
291
  case 3:
292
292
  error_11 = _a.sent();
@@ -5,4 +5,9 @@ export declare class ChainService {
5
5
  constructor(config: FirmaConfig);
6
6
  getChainSyncInfo(): Promise<ChainSyncInfo>;
7
7
  getTransactionByHash(txHash: string): Promise<TransactionHash>;
8
+ getChainInfo(): Promise<{
9
+ chainId: string;
10
+ appVersion: string;
11
+ cosmosVersion: string;
12
+ }>;
8
13
  }
@@ -35,10 +35,14 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
36
  }
37
37
  };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
38
41
  Object.defineProperty(exports, "__esModule", { value: true });
39
42
  exports.ChainService = void 0;
40
43
  var FirmaUtil_1 = require("./FirmaUtil");
41
44
  var TendermintQueryClient_1 = require("./firmachain/common/TendermintQueryClient");
45
+ var axios_1 = __importDefault(require("axios"));
42
46
  var ChainService = /** @class */ (function () {
43
47
  function ChainService(config) {
44
48
  this.config = config;
@@ -81,6 +85,46 @@ var ChainService = /** @class */ (function () {
81
85
  });
82
86
  });
83
87
  };
88
+ ChainService.prototype.getChainInfo = function () {
89
+ return __awaiter(this, void 0, void 0, function () {
90
+ var axios, path, result, nodeInfo, appInfo, chainId, appVersion, cosmosVersion, i, dep, error_3;
91
+ return __generator(this, function (_a) {
92
+ switch (_a.label) {
93
+ case 0:
94
+ _a.trys.push([0, 2, , 3]);
95
+ axios = axios_1.default.create({
96
+ baseURL: this.config.restApiAddress,
97
+ headers: {
98
+ Accept: "application/json",
99
+ },
100
+ timeout: 15000,
101
+ });
102
+ path = "/cosmos/base/tendermint/v1beta1/node_info";
103
+ return [4 /*yield*/, axios.get(path)];
104
+ case 1:
105
+ result = _a.sent();
106
+ nodeInfo = result.data.default_node_info;
107
+ appInfo = result.data.application_version;
108
+ chainId = nodeInfo.network;
109
+ appVersion = appInfo.version;
110
+ cosmosVersion = "";
111
+ for (i = 0; i < appInfo.build_deps.length; i++) {
112
+ dep = appInfo.build_deps[i];
113
+ if (dep.path == "github.com/cosmos/cosmos-sdk") {
114
+ cosmosVersion = dep.version;
115
+ break;
116
+ }
117
+ }
118
+ return [2 /*return*/, { chainId: chainId, appVersion: appVersion, cosmosVersion: cosmosVersion }];
119
+ case 2:
120
+ error_3 = _a.sent();
121
+ FirmaUtil_1.FirmaUtil.printLog(error_3);
122
+ throw error_3;
123
+ case 3: return [2 /*return*/];
124
+ }
125
+ });
126
+ });
127
+ };
84
128
  return ChainService;
85
129
  }());
86
130
  exports.ChainService = ChainService;
@@ -168,7 +168,7 @@ var ContractService = /** @class */ (function () {
168
168
  case 0:
169
169
  _a.trys.push([0, 3, , 4]);
170
170
  contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
171
- return [4 /*yield*/, contractTxClient.sign(txList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
171
+ return [4 /*yield*/, contractTxClient.sign(txList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
172
172
  case 1:
173
173
  txRaw = _a.sent();
174
174
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
@@ -249,7 +249,7 @@ var ContractService = /** @class */ (function () {
249
249
  metaDataJsonString: metaDataJsonString
250
250
  });
251
251
  contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
252
- return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
252
+ return [4 /*yield*/, contractTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
253
253
  case 2: return [2 /*return*/, _a.sent()];
254
254
  case 3:
255
255
  error_10 = _a.sent();
@@ -325,7 +325,7 @@ var ContractService = /** @class */ (function () {
325
325
  jsonString: jsonString
326
326
  });
327
327
  contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
328
- return [4 /*yield*/, contractTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
328
+ return [4 /*yield*/, contractTxClient.sign([message], FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
329
329
  case 2: return [2 /*return*/, _a.sent()];
330
330
  case 3:
331
331
  error_13 = _a.sent();
@@ -395,7 +395,7 @@ var ContractService = /** @class */ (function () {
395
395
  case 0:
396
396
  _a.trys.push([0, 3, , 4]);
397
397
  contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
398
- return [4 /*yield*/, contractTxClient.sign(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
398
+ return [4 /*yield*/, contractTxClient.sign(msgList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
399
399
  case 1:
400
400
  txRaw = _a.sent();
401
401
  return [4 /*yield*/, FirmaUtil_1.FirmaUtil.estimateGas(txRaw)];
@@ -418,7 +418,7 @@ var ContractService = /** @class */ (function () {
418
418
  case 0:
419
419
  _a.trys.push([0, 2, , 3]);
420
420
  contractTxClient = new contract_1.ContractTxClient(wallet, this.config.rpcAddress);
421
- return [4 /*yield*/, contractTxClient.signAndBroadcast(msgList, (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
421
+ return [4 /*yield*/, contractTxClient.signAndBroadcast(msgList, FirmaUtil_1.getSignAndBroadcastOption(this.config.denom, txMisc))];
422
422
  case 1: return [2 /*return*/, _a.sent()];
423
423
  case 2:
424
424
  error_17 = _a.sent();
@@ -0,0 +1,17 @@
1
+ import { FirmaConfig } from "./FirmaConfig";
2
+ import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
3
+ export declare class FirmaCosmWasmCw20Service {
4
+ private readonly config;
5
+ private readonly cosmwasmService;
6
+ constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
7
+ getBalance(contractAddress: string, address: string): Promise<string>;
8
+ getTotalSupply(contractAddress: string): Promise<string>;
9
+ getTokenInfo(contractAddress: string): Promise<string>;
10
+ getMinter(contractAddress: string): Promise<string>;
11
+ getAllowance(contractAddress: string, owner: string, spender: string): Promise<string>;
12
+ getAllAllowances(contractAddress: string, owner: string): Promise<string>;
13
+ getAllSpenderAllowances(contractAddress: string, spender: string): Promise<string>;
14
+ getAllAccounts(contractAddress: string): Promise<string>;
15
+ getMarketingInfo(contractAddress: string): Promise<string>;
16
+ getDownloadLogo(contractAddress: string): Promise<string>;
17
+ }
@@ -0,0 +1,269 @@
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
+ exports.FirmaCosmWasmCw20Service = void 0;
40
+ var FirmaUtil_1 = require("./FirmaUtil");
41
+ var FirmaCosmWasmCw20Service = /** @class */ (function () {
42
+ function FirmaCosmWasmCw20Service(config, cosmwasmService) {
43
+ this.config = config;
44
+ this.cosmwasmService = cosmwasmService;
45
+ }
46
+ // query
47
+ FirmaCosmWasmCw20Service.prototype.getBalance = function (contractAddress, address) {
48
+ return __awaiter(this, void 0, void 0, function () {
49
+ var query, result, data, error_1;
50
+ return __generator(this, function (_a) {
51
+ switch (_a.label) {
52
+ case 0:
53
+ _a.trys.push([0, 2, , 3]);
54
+ query = "{\"balance\": { \"address\": \"" + address + "\" }}";
55
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
56
+ case 1:
57
+ result = _a.sent();
58
+ data = JSON.parse(result);
59
+ return [2 /*return*/, data.balance];
60
+ case 2:
61
+ error_1 = _a.sent();
62
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
63
+ throw error_1;
64
+ case 3: return [2 /*return*/];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ FirmaCosmWasmCw20Service.prototype.getTotalSupply = function (contractAddress) {
70
+ return __awaiter(this, void 0, void 0, function () {
71
+ var query, result, data, error_2;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0:
75
+ _a.trys.push([0, 2, , 3]);
76
+ query = "{\"token_info\": {}}";
77
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
78
+ case 1:
79
+ result = _a.sent();
80
+ data = JSON.parse(result);
81
+ return [2 /*return*/, data.total_supply];
82
+ case 2:
83
+ error_2 = _a.sent();
84
+ FirmaUtil_1.FirmaUtil.printLog(error_2);
85
+ throw error_2;
86
+ case 3: return [2 /*return*/];
87
+ }
88
+ });
89
+ });
90
+ };
91
+ FirmaCosmWasmCw20Service.prototype.getTokenInfo = function (contractAddress) {
92
+ return __awaiter(this, void 0, void 0, function () {
93
+ var query, result, data, error_3;
94
+ return __generator(this, function (_a) {
95
+ switch (_a.label) {
96
+ case 0:
97
+ _a.trys.push([0, 2, , 3]);
98
+ query = "{\"token_info\": {}}";
99
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
100
+ case 1:
101
+ result = _a.sent();
102
+ data = JSON.parse(result);
103
+ return [2 /*return*/, data];
104
+ case 2:
105
+ error_3 = _a.sent();
106
+ FirmaUtil_1.FirmaUtil.printLog(error_3);
107
+ throw error_3;
108
+ case 3: return [2 /*return*/];
109
+ }
110
+ });
111
+ });
112
+ };
113
+ FirmaCosmWasmCw20Service.prototype.getMinter = function (contractAddress) {
114
+ return __awaiter(this, void 0, void 0, function () {
115
+ var query, result, data, error_4;
116
+ return __generator(this, function (_a) {
117
+ switch (_a.label) {
118
+ case 0:
119
+ _a.trys.push([0, 2, , 3]);
120
+ query = "{\"minter\": {}}";
121
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
122
+ case 1:
123
+ result = _a.sent();
124
+ data = JSON.parse(result);
125
+ return [2 /*return*/, data];
126
+ case 2:
127
+ error_4 = _a.sent();
128
+ FirmaUtil_1.FirmaUtil.printLog(error_4);
129
+ throw error_4;
130
+ case 3: return [2 /*return*/];
131
+ }
132
+ });
133
+ });
134
+ };
135
+ FirmaCosmWasmCw20Service.prototype.getAllowance = function (contractAddress, owner, spender) {
136
+ return __awaiter(this, void 0, void 0, function () {
137
+ var query, result, data, error_5;
138
+ return __generator(this, function (_a) {
139
+ switch (_a.label) {
140
+ case 0:
141
+ _a.trys.push([0, 2, , 3]);
142
+ query = "{\"allowance\": {\"owner\": \"" + owner + "\", \"spender\":\"" + spender + "\"}}";
143
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
144
+ case 1:
145
+ result = _a.sent();
146
+ data = JSON.parse(result);
147
+ return [2 /*return*/, data];
148
+ case 2:
149
+ error_5 = _a.sent();
150
+ FirmaUtil_1.FirmaUtil.printLog(error_5);
151
+ throw error_5;
152
+ case 3: return [2 /*return*/];
153
+ }
154
+ });
155
+ });
156
+ };
157
+ FirmaCosmWasmCw20Service.prototype.getAllAllowances = function (contractAddress, owner) {
158
+ return __awaiter(this, void 0, void 0, function () {
159
+ var query, result, data, error_6;
160
+ return __generator(this, function (_a) {
161
+ switch (_a.label) {
162
+ case 0:
163
+ _a.trys.push([0, 2, , 3]);
164
+ query = "{\"all_allowances\": {\"owner\": \"" + owner + "\"}}";
165
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
166
+ case 1:
167
+ result = _a.sent();
168
+ data = JSON.parse(result);
169
+ return [2 /*return*/, data];
170
+ case 2:
171
+ error_6 = _a.sent();
172
+ FirmaUtil_1.FirmaUtil.printLog(error_6);
173
+ throw error_6;
174
+ case 3: return [2 /*return*/];
175
+ }
176
+ });
177
+ });
178
+ };
179
+ FirmaCosmWasmCw20Service.prototype.getAllSpenderAllowances = function (contractAddress, spender) {
180
+ return __awaiter(this, void 0, void 0, function () {
181
+ var query, result, data, error_7;
182
+ return __generator(this, function (_a) {
183
+ switch (_a.label) {
184
+ case 0:
185
+ _a.trys.push([0, 2, , 3]);
186
+ query = "{\"all_spender_allowances\": {\"spender\": \"" + spender + "\"}}";
187
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
188
+ case 1:
189
+ result = _a.sent();
190
+ data = JSON.parse(result);
191
+ return [2 /*return*/, data];
192
+ case 2:
193
+ error_7 = _a.sent();
194
+ FirmaUtil_1.FirmaUtil.printLog(error_7);
195
+ throw error_7;
196
+ case 3: return [2 /*return*/];
197
+ }
198
+ });
199
+ });
200
+ };
201
+ FirmaCosmWasmCw20Service.prototype.getAllAccounts = function (contractAddress) {
202
+ return __awaiter(this, void 0, void 0, function () {
203
+ var query, result, data, error_8;
204
+ return __generator(this, function (_a) {
205
+ switch (_a.label) {
206
+ case 0:
207
+ _a.trys.push([0, 2, , 3]);
208
+ query = "{\"all_accounts\": {}}";
209
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
210
+ case 1:
211
+ result = _a.sent();
212
+ data = JSON.parse(result);
213
+ return [2 /*return*/, data];
214
+ case 2:
215
+ error_8 = _a.sent();
216
+ FirmaUtil_1.FirmaUtil.printLog(error_8);
217
+ throw error_8;
218
+ case 3: return [2 /*return*/];
219
+ }
220
+ });
221
+ });
222
+ };
223
+ FirmaCosmWasmCw20Service.prototype.getMarketingInfo = function (contractAddress) {
224
+ return __awaiter(this, void 0, void 0, function () {
225
+ var query, result, data, error_9;
226
+ return __generator(this, function (_a) {
227
+ switch (_a.label) {
228
+ case 0:
229
+ _a.trys.push([0, 2, , 3]);
230
+ query = "{\"marketing_info\": {}}";
231
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
232
+ case 1:
233
+ result = _a.sent();
234
+ data = JSON.parse(result);
235
+ return [2 /*return*/, data];
236
+ case 2:
237
+ error_9 = _a.sent();
238
+ FirmaUtil_1.FirmaUtil.printLog(error_9);
239
+ throw error_9;
240
+ case 3: return [2 /*return*/];
241
+ }
242
+ });
243
+ });
244
+ };
245
+ FirmaCosmWasmCw20Service.prototype.getDownloadLogo = function (contractAddress) {
246
+ return __awaiter(this, void 0, void 0, function () {
247
+ var query, result, data, error_10;
248
+ return __generator(this, function (_a) {
249
+ switch (_a.label) {
250
+ case 0:
251
+ _a.trys.push([0, 2, , 3]);
252
+ query = "{\"download_logo\": {}}";
253
+ return [4 /*yield*/, this.cosmwasmService.getContractSmartQueryData(contractAddress, query)];
254
+ case 1:
255
+ result = _a.sent();
256
+ data = JSON.parse(result);
257
+ return [2 /*return*/, data];
258
+ case 2:
259
+ error_10 = _a.sent();
260
+ FirmaUtil_1.FirmaUtil.printLog(error_10);
261
+ throw error_10;
262
+ case 3: return [2 /*return*/];
263
+ }
264
+ });
265
+ });
266
+ };
267
+ return FirmaCosmWasmCw20Service;
268
+ }());
269
+ exports.FirmaCosmWasmCw20Service = FirmaCosmWasmCw20Service;
@@ -0,0 +1,43 @@
1
+ import { FirmaConfig } from "./FirmaConfig";
2
+ import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
3
+ import { Uint64 } from "@cosmjs/math";
4
+ export interface ExpireAll {
5
+ never: string;
6
+ at_height: Uint64;
7
+ at_time: string;
8
+ }
9
+ export interface Cw721NftInfo {
10
+ access: {
11
+ owner: string;
12
+ approvals: Cw721Approval[];
13
+ };
14
+ info: {
15
+ token_uri: string;
16
+ extension: Object;
17
+ };
18
+ }
19
+ export interface Cw721ContractInfo {
20
+ name: string;
21
+ symbol: string;
22
+ }
23
+ export interface Cw721Approval {
24
+ spender: string;
25
+ expires: ExpireAll;
26
+ }
27
+ export declare class FirmaCosmWasmCw721Service {
28
+ private readonly config;
29
+ private readonly cosmwasmService;
30
+ constructor(config: FirmaConfig, cosmwasmService: FirmaCosmWasmService);
31
+ getOwnerFromNftID(contractAddress: string, tokenId: string): Promise<string>;
32
+ getApproval(contractAddress: string, tokenId: string, spender: string, isIncludeExpired?: boolean): Promise<Cw721Approval>;
33
+ getApprovals(contractAddress: string, tokenId: string, isIncludeExpired?: boolean): Promise<Cw721Approval[]>;
34
+ getAllOperators(contractAddress: string, owner: string, isIncludeExpired?: boolean): Promise<Cw721Approval[]>;
35
+ getTotalNfts(contractAddress: string): Promise<number>;
36
+ getContractInfo(contractAddress: string): Promise<Cw721ContractInfo>;
37
+ getNftTokenUri(contractAddress: string, tokenId: string): Promise<string>;
38
+ getNftData(contractAddress: string, tokenId: string): Promise<Cw721NftInfo>;
39
+ getNFTIdListOfOwner(contractAddress: string, owner: string): Promise<string[]>;
40
+ getAllNftIdList(contractAddress: string): Promise<string[]>;
41
+ getMinter(contractAddress: string): Promise<string>;
42
+ getExtension(contractAddress: string): Promise<any>;
43
+ }