@firmachain/firma-js 0.2.45 → 0.2.46

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 (79) hide show
  1. package/dist/sdk/FirmaBankService.d.ts +2 -0
  2. package/dist/sdk/FirmaBankService.js +59 -16
  3. package/dist/sdk/FirmaMintService.d.ts +6 -0
  4. package/dist/sdk/FirmaMintService.js +67 -0
  5. package/dist/sdk/FirmaSDK.d.ts +3 -1
  6. package/dist/sdk/FirmaSDK.js +4 -1
  7. package/dist/sdk/FirmaUtil.d.ts +1 -0
  8. package/dist/sdk/FirmaUtil.js +5 -0
  9. package/dist/sdk/firmachain/mint/MintQueryClient.d.ts +5 -0
  10. package/dist/sdk/firmachain/mint/MintQueryClient.js +71 -0
  11. package/dist/sdk/firmachain/mint/index.d.ts +2 -0
  12. package/dist/sdk/firmachain/mint/index.js +18 -0
  13. package/dist/test/00.wallet.test.d.ts +1 -0
  14. package/dist/test/00.wallet.test.js +87 -0
  15. package/dist/test/000./354/227/220/354/226/264/353/223/234/353/236/215_/353/246/254/354/212/244/355/205/214/354/235/264/355/201/254.test.d.ts +1 -0
  16. package/dist/test/000./354/227/220/354/226/264/353/223/234/353/236/215_/353/246/254/354/212/244/355/205/214/354/235/264/355/201/254.test.js +302 -0
  17. package/dist/test/000./354/236/254/353/213/250/352/264/200/353/240/250.test.d.ts +1 -0
  18. package/dist/test/000./354/236/254/353/213/250/352/264/200/353/240/250.test.js +436 -0
  19. package/dist/test/01.contract_tx.test.d.ts +1 -0
  20. package/dist/test/01.contract_tx.test.js +146 -0
  21. package/dist/test/02.contract_query.test.d.ts +1 -0
  22. package/dist/test/02.contract_query.test.js +219 -0
  23. package/dist/test/03.contract_scenario.test.d.ts +1 -0
  24. package/dist/test/03.contract_scenario.test.js +559 -0
  25. package/dist/test/04.bank_tx.test.d.ts +1 -0
  26. package/dist/test/04.bank_tx.test.js +124 -0
  27. package/dist/test/05.bank_query.test.d.ts +1 -0
  28. package/dist/test/05.bank_query.test.js +164 -0
  29. package/dist/test/06.feegrant_tx.test.d.ts +1 -0
  30. package/dist/test/06.feegrant_tx.test.js +173 -0
  31. package/dist/test/07.feegrant_query.test.d.ts +1 -0
  32. package/dist/test/07.feegrant_query.test.js +81 -0
  33. package/dist/test/08.gas_estimate.test.d.ts +1 -0
  34. package/dist/test/08.gas_estimate.test.js +702 -0
  35. package/dist/test/09.ipfs.test.d.ts +1 -0
  36. package/dist/test/09.ipfs.test.js +69 -0
  37. package/dist/test/10.nft_tx.test.d.ts +1 -0
  38. package/dist/test/10.nft_tx.test.js +137 -0
  39. package/dist/test/11.nft_query.test.d.ts +1 -0
  40. package/dist/test/11.nft_query.test.js +167 -0
  41. package/dist/test/12.staking_tx.test.d.ts +1 -0
  42. package/dist/test/12.staking_tx.test.js +213 -0
  43. package/dist/test/13.staking_query.test.d.ts +1 -0
  44. package/dist/test/13.staking_query.test.js +206 -0
  45. package/dist/test/14.distribution_tx.test.d.ts +1 -0
  46. package/dist/test/14.distribution_tx.test.js +176 -0
  47. package/dist/test/15.distribution_query.test.d.ts +1 -0
  48. package/dist/test/15.distribution_query.test.js +216 -0
  49. package/dist/test/16.gov_tx.test.d.ts +1 -0
  50. package/dist/test/16.gov_tx.test.js +237 -0
  51. package/dist/test/17.gov_query.test.d.ts +1 -0
  52. package/dist/test/17.gov_query.test.js +115 -0
  53. package/dist/test/18.util.test.d.ts +1 -0
  54. package/dist/test/18.util.test.js +246 -0
  55. package/dist/test/19.chain.test.d.ts +1 -0
  56. package/dist/test/19.chain.test.js +67 -0
  57. package/dist/test/20.slashing_query.test.d.ts +1 -0
  58. package/dist/test/20.slashing_query.test.js +82 -0
  59. package/dist/test/21.token_tx.test.d.ts +1 -0
  60. package/dist/test/21.token_tx.test.js +154 -0
  61. package/dist/test/22.token_query.test.d.ts +1 -0
  62. package/dist/test/22.token_query.test.js +96 -0
  63. package/dist/test/23.authz_tx.test.d.ts +1 -0
  64. package/dist/test/23.authz_tx.test.js +468 -0
  65. package/dist/test/24.authz_query.test.d.ts +1 -0
  66. package/dist/test/24.authz_query.test.js +140 -0
  67. package/dist/test/25.cosmwasm_tx.test.d.ts +1 -0
  68. package/dist/test/25.cosmwasm_tx.test.js +188 -0
  69. package/dist/test/26.cosmwasm_query.test.d.ts +1 -0
  70. package/dist/test/26.cosmwasm_query.test.js +167 -0
  71. package/dist/test/27.arbitary_sign.test.d.ts +1 -0
  72. package/dist/test/27.arbitary_sign.test.js +164 -0
  73. package/dist/test/28.ibc_tx.test.d.ts +1 -0
  74. package/dist/test/28.ibc_tx.test.js +83 -0
  75. package/dist/test/29.mint_query.copy.d.ts +1 -0
  76. package/dist/test/29.mint_query.copy.js +54 -0
  77. package/dist/test/config_test.d.ts +5 -0
  78. package/dist/test/config_test.js +27 -0
  79. package/package.json +1 -1
@@ -11,6 +11,8 @@ export declare class FirmaBankService {
11
11
  sendToken(wallet: FirmaWalletService, targetAddress: string, tokenID: string, amount: number, decimal: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
12
12
  send(wallet: FirmaWalletService, targetAddress: string, amount: number, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
13
13
  send_raw(wallet: FirmaWalletService, targetAddress: string, ufctAmount: string, txMisc?: TxMisc): Promise<BroadcastTxResponse>;
14
+ getSupply(): Promise<string>;
15
+ getTokenSupply(tokenID: string): Promise<string>;
14
16
  getTokenBalanceList(address: string): Promise<Token[]>;
15
17
  getTokenBalance(address: string, tokenID: string): Promise<string>;
16
18
  getBalance(address: string): Promise<string>;
@@ -159,9 +159,52 @@ var FirmaBankService = /** @class */ (function () {
159
159
  });
160
160
  });
161
161
  };
162
+ // getSupply
163
+ FirmaBankService.prototype.getSupply = function () {
164
+ return __awaiter(this, void 0, void 0, function () {
165
+ var bankQueryClient, result, error_6;
166
+ return __generator(this, function (_a) {
167
+ switch (_a.label) {
168
+ case 0:
169
+ _a.trys.push([0, 2, , 3]);
170
+ bankQueryClient = new bank_1.BankQueryClient(this.config.restApiAddress);
171
+ return [4 /*yield*/, bankQueryClient.querySupplyOf("ufct")];
172
+ case 1:
173
+ result = _a.sent();
174
+ return [2 /*return*/, result];
175
+ case 2:
176
+ error_6 = _a.sent();
177
+ FirmaUtil_1.FirmaUtil.printLog(error_6);
178
+ throw error_6;
179
+ case 3: return [2 /*return*/];
180
+ }
181
+ });
182
+ });
183
+ };
184
+ FirmaBankService.prototype.getTokenSupply = function (tokenID) {
185
+ return __awaiter(this, void 0, void 0, function () {
186
+ var bankQueryClient, result, error_7;
187
+ return __generator(this, function (_a) {
188
+ switch (_a.label) {
189
+ case 0:
190
+ _a.trys.push([0, 2, , 3]);
191
+ bankQueryClient = new bank_1.BankQueryClient(this.config.restApiAddress);
192
+ return [4 /*yield*/, bankQueryClient.querySupplyOf(tokenID)];
193
+ case 1:
194
+ result = _a.sent();
195
+ return [2 /*return*/, result];
196
+ case 2:
197
+ error_7 = _a.sent();
198
+ FirmaUtil_1.FirmaUtil.printLog(error_7);
199
+ throw error_7;
200
+ case 3: return [2 /*return*/];
201
+ }
202
+ });
203
+ });
204
+ };
162
205
  FirmaBankService.prototype.getTokenBalanceList = function (address) {
163
206
  return __awaiter(this, void 0, void 0, function () {
164
- var bankQueryClient, result, tokenList, i, error_6;
207
+ var bankQueryClient, result, tokenList, i, error_8;
165
208
  return __generator(this, function (_a) {
166
209
  switch (_a.label) {
167
210
  case 0:
@@ -179,9 +222,9 @@ var FirmaBankService = /** @class */ (function () {
179
222
  }
180
223
  return [2 /*return*/, tokenList];
181
224
  case 2:
182
- error_6 = _a.sent();
183
- FirmaUtil_1.FirmaUtil.printLog(error_6);
184
- throw error_6;
225
+ error_8 = _a.sent();
226
+ FirmaUtil_1.FirmaUtil.printLog(error_8);
227
+ throw error_8;
185
228
  case 3: return [2 /*return*/];
186
229
  }
187
230
  });
@@ -189,7 +232,7 @@ var FirmaBankService = /** @class */ (function () {
189
232
  };
190
233
  FirmaBankService.prototype.getTokenBalance = function (address, tokenID) {
191
234
  return __awaiter(this, void 0, void 0, function () {
192
- var bankQueryClient, result, error_7;
235
+ var bankQueryClient, result, error_9;
193
236
  return __generator(this, function (_a) {
194
237
  switch (_a.label) {
195
238
  case 0:
@@ -200,9 +243,9 @@ var FirmaBankService = /** @class */ (function () {
200
243
  result = _a.sent();
201
244
  return [2 /*return*/, result.amount];
202
245
  case 2:
203
- error_7 = _a.sent();
204
- FirmaUtil_1.FirmaUtil.printLog(error_7);
205
- throw error_7;
246
+ error_9 = _a.sent();
247
+ FirmaUtil_1.FirmaUtil.printLog(error_9);
248
+ throw error_9;
206
249
  case 3: return [2 /*return*/];
207
250
  }
208
251
  });
@@ -210,7 +253,7 @@ var FirmaBankService = /** @class */ (function () {
210
253
  };
211
254
  FirmaBankService.prototype.getBalance = function (address) {
212
255
  return __awaiter(this, void 0, void 0, function () {
213
- var bankQueryClient, result, error_8;
256
+ var bankQueryClient, result, error_10;
214
257
  return __generator(this, function (_a) {
215
258
  switch (_a.label) {
216
259
  case 0:
@@ -221,9 +264,9 @@ var FirmaBankService = /** @class */ (function () {
221
264
  result = _a.sent();
222
265
  return [2 /*return*/, result.amount];
223
266
  case 2:
224
- error_8 = _a.sent();
225
- FirmaUtil_1.FirmaUtil.printLog(error_8);
226
- throw error_8;
267
+ error_10 = _a.sent();
268
+ FirmaUtil_1.FirmaUtil.printLog(error_10);
269
+ throw error_10;
227
270
  case 3: return [2 /*return*/];
228
271
  }
229
272
  });
@@ -232,7 +275,7 @@ var FirmaBankService = /** @class */ (function () {
232
275
  FirmaBankService.prototype.getSignedTxSend = function (wallet, targetAddress, denom, amount, txMisc) {
233
276
  if (txMisc === void 0) { txMisc = FirmaUtil_1.DefaultTxMisc; }
234
277
  return __awaiter(this, void 0, void 0, function () {
235
- var bankTxClient, address, sendAmount, message, error_9;
278
+ var bankTxClient, address, sendAmount, message, error_11;
236
279
  return __generator(this, function (_a) {
237
280
  switch (_a.label) {
238
281
  case 0:
@@ -246,9 +289,9 @@ var FirmaBankService = /** @class */ (function () {
246
289
  return [4 /*yield*/, bankTxClient.sign([message], (0, FirmaUtil_1.getSignAndBroadcastOption)(this.config.denom, txMisc))];
247
290
  case 2: return [2 /*return*/, _a.sent()];
248
291
  case 3:
249
- error_9 = _a.sent();
250
- FirmaUtil_1.FirmaUtil.printLog(error_9);
251
- throw error_9;
292
+ error_11 = _a.sent();
293
+ FirmaUtil_1.FirmaUtil.printLog(error_11);
294
+ throw error_11;
252
295
  case 4: return [2 /*return*/];
253
296
  }
254
297
  });
@@ -0,0 +1,6 @@
1
+ import { FirmaConfig } from "./FirmaConfig";
2
+ export declare class FirmaMintService {
3
+ private readonly config;
4
+ constructor(config: FirmaConfig);
5
+ getInflation(): Promise<string>;
6
+ }
@@ -0,0 +1,67 @@
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.FirmaMintService = void 0;
40
+ var FirmaUtil_1 = require("./FirmaUtil");
41
+ var mint_1 = require("./firmachain/mint");
42
+ var FirmaMintService = /** @class */ (function () {
43
+ function FirmaMintService(config) {
44
+ this.config = config;
45
+ }
46
+ FirmaMintService.prototype.getInflation = function () {
47
+ return __awaiter(this, void 0, void 0, function () {
48
+ var queryClient, error_1;
49
+ return __generator(this, function (_a) {
50
+ switch (_a.label) {
51
+ case 0:
52
+ _a.trys.push([0, 2, , 3]);
53
+ queryClient = new mint_1.MintQueryClient(this.config.restApiAddress);
54
+ return [4 /*yield*/, queryClient.queryInflation()];
55
+ case 1: return [2 /*return*/, _a.sent()];
56
+ case 2:
57
+ error_1 = _a.sent();
58
+ FirmaUtil_1.FirmaUtil.printLog(error_1);
59
+ throw error_1;
60
+ case 3: return [2 /*return*/];
61
+ }
62
+ });
63
+ });
64
+ };
65
+ return FirmaMintService;
66
+ }());
67
+ exports.FirmaMintService = FirmaMintService;
@@ -14,6 +14,7 @@ import { SlashingService } from "./FirmaSlashingService";
14
14
  import { FirmaAuthzService } from "./FirmaAuthzService";
15
15
  import { FirmaCosmWasmService } from "./FirmaCosmWasmService";
16
16
  import { FirmaIbcService } from "./FirmaIbcService";
17
+ import { FirmaMintService } from "./FirmaMintService";
17
18
  export declare class FirmaSDK {
18
19
  Config: FirmaConfig;
19
20
  Wallet: FirmaWalletService;
@@ -31,5 +32,6 @@ export declare class FirmaSDK {
31
32
  Authz: FirmaAuthzService;
32
33
  CosmWasm: FirmaCosmWasmService;
33
34
  Ibc: FirmaIbcService;
34
- 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);
35
+ Mint: FirmaMintService;
36
+ 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);
35
37
  }
@@ -17,8 +17,9 @@ var FirmaSlashingService_1 = require("./FirmaSlashingService");
17
17
  var FirmaAuthzService_1 = require("./FirmaAuthzService");
18
18
  var FirmaCosmWasmService_1 = require("./FirmaCosmWasmService");
19
19
  var FirmaIbcService_1 = require("./FirmaIbcService");
20
+ var FirmaMintService_1 = require("./FirmaMintService");
20
21
  var FirmaSDK = /** @class */ (function () {
21
- function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc) {
22
+ function FirmaSDK(Config, Wallet, Bank, FeeGrant, Staking, Distribution, Gov, Nft, Token, Contract, Ipfs, BlockChain, Slashing, Authz, CosmWasm, Ibc, Mint) {
22
23
  if (Wallet === void 0) { Wallet = new FirmaWalletService_1.FirmaWalletService(Config); }
23
24
  if (Bank === void 0) { Bank = new FirmaBankService_1.FirmaBankService(Config); }
24
25
  if (FeeGrant === void 0) { FeeGrant = new FirmaFeeGrantService_1.FirmaFeeGrantService(Config); }
@@ -34,6 +35,7 @@ var FirmaSDK = /** @class */ (function () {
34
35
  if (Authz === void 0) { Authz = new FirmaAuthzService_1.FirmaAuthzService(Config); }
35
36
  if (CosmWasm === void 0) { CosmWasm = new FirmaCosmWasmService_1.FirmaCosmWasmService(Config); }
36
37
  if (Ibc === void 0) { Ibc = new FirmaIbcService_1.FirmaIbcService(Config); }
38
+ if (Mint === void 0) { Mint = new FirmaMintService_1.FirmaMintService(Config); }
37
39
  this.Config = Config;
38
40
  this.Wallet = Wallet;
39
41
  this.Bank = Bank;
@@ -50,6 +52,7 @@ var FirmaSDK = /** @class */ (function () {
50
52
  this.Authz = Authz;
51
53
  this.CosmWasm = CosmWasm;
52
54
  this.Ibc = Ibc;
55
+ this.Mint = Mint;
53
56
  FirmaUtil_1.FirmaUtil.config = Config;
54
57
  }
55
58
  return FirmaSDK;
@@ -32,6 +32,7 @@ export declare class FirmaUtil {
32
32
  static buf2hex(buffer: Uint8Array): string;
33
33
  static getHexAddressFromAddress(address: string): string;
34
34
  static getValOperAddressFromAccAddress(address: string): string;
35
+ static getValConsAddressFromAccAddress(consensusPubkey: string): string;
35
36
  static getAccAddressFromValOperAddress(address: string): string;
36
37
  static getSignerDataForLedger(address: string): Promise<SignerData>;
37
38
  static estimateGas(txRaw: TxRaw): Promise<number>;
@@ -224,6 +224,11 @@ var FirmaUtil = /** @class */ (function () {
224
224
  var data = encoding_1.Bech32.decode(address).data;
225
225
  return encoding_1.Bech32.encode(FirmaUtil.config.prefix + "valoper", data);
226
226
  };
227
+ FirmaUtil.getValConsAddressFromAccAddress = function (consensusPubkey) {
228
+ var ed25519PubkeyRaw = (0, encoding_2.fromBase64)(consensusPubkey);
229
+ var addressData = (0, crypto_1.sha256)(ed25519PubkeyRaw).slice(0, 20);
230
+ return encoding_1.Bech32.encode(FirmaUtil.config.prefix + "valcons", addressData);
231
+ };
227
232
  FirmaUtil.getAccAddressFromValOperAddress = function (address) {
228
233
  var data = encoding_1.Bech32.decode(address).data;
229
234
  return encoding_1.Bech32.encode(FirmaUtil.config.prefix, data);
@@ -0,0 +1,5 @@
1
+ export declare class MintQueryClient {
2
+ private readonly axios;
3
+ constructor(baseUrl: string);
4
+ queryInflation(): Promise<string>;
5
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.MintQueryClient = void 0;
43
+ var axios_1 = __importDefault(require("axios"));
44
+ var MintQueryClient = /** @class */ (function () {
45
+ function MintQueryClient(baseUrl) {
46
+ this.axios = axios_1.default.create({
47
+ baseURL: baseUrl,
48
+ headers: {
49
+ Accept: "application/json",
50
+ },
51
+ timeout: 15000,
52
+ });
53
+ }
54
+ MintQueryClient.prototype.queryInflation = function () {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var path, result;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ path = "/cosmos/mint/v1beta1/inflation";
61
+ return [4 /*yield*/, this.axios.get(path)];
62
+ case 1:
63
+ result = _a.sent();
64
+ return [2 /*return*/, result.data.inflation];
65
+ }
66
+ });
67
+ });
68
+ };
69
+ return MintQueryClient;
70
+ }());
71
+ exports.MintQueryClient = MintQueryClient;
@@ -0,0 +1,2 @@
1
+ export * from './MintQueryClient';
2
+ export * from '../common';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
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);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./MintQueryClient"), exports);
18
+ __exportStar(require("../common"), exports);
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ var chai_1 = require("chai");
40
+ var FirmaSDK_1 = require("../sdk/FirmaSDK");
41
+ var config_test_1 = require("./config_test");
42
+ describe('[00. Wallet Test]', function () {
43
+ var firma = new FirmaSDK_1.FirmaSDK(config_test_1.TestChainConfig);
44
+ it('fromMnemonic check', function () { return __awaiter(void 0, void 0, void 0, function () {
45
+ var wallet;
46
+ return __generator(this, function (_a) {
47
+ switch (_a.label) {
48
+ case 0: return [4 /*yield*/, firma.Wallet.fromMnemonic(config_test_1.aliceMnemonic)];
49
+ case 1:
50
+ wallet = _a.sent();
51
+ (0, chai_1.expect)(wallet.getMnemonic()).to.equal(config_test_1.aliceMnemonic);
52
+ return [2 /*return*/];
53
+ }
54
+ });
55
+ }); });
56
+ it('Wallet.fromPrivateKey check', function () { return __awaiter(void 0, void 0, void 0, function () {
57
+ var privateKey, privateKeyFromWallet;
58
+ return __generator(this, function (_a) {
59
+ switch (_a.label) {
60
+ case 0:
61
+ privateKey = "0x15bc0d2e445ef5b13f9d3c6d227f21524fd05d5afda713d1aff1ecc8db49a62d";
62
+ return [4 /*yield*/, firma.Wallet.fromPrivateKey(privateKey)];
63
+ case 1:
64
+ privateKeyFromWallet = (_a.sent()).getPrivateKey();
65
+ (0, chai_1.expect)(privateKeyFromWallet).to.equal(privateKey);
66
+ return [2 /*return*/];
67
+ }
68
+ });
69
+ }); });
70
+ it('Wallet.getPubKey check with new mnemonic', function () { return __awaiter(void 0, void 0, void 0, function () {
71
+ var randomMnemonic, wallet, pubkey;
72
+ return __generator(this, function (_a) {
73
+ switch (_a.label) {
74
+ case 0:
75
+ randomMnemonic = "inmate stock silly toy divide example orchard harbor pulse gasp acquire bulk predict spin salon quiz record office party today narrow crumble remember sing";
76
+ return [4 /*yield*/, firma.Wallet.fromMnemonic(randomMnemonic)];
77
+ case 1:
78
+ wallet = _a.sent();
79
+ return [4 /*yield*/, wallet.getPubKey()];
80
+ case 2:
81
+ pubkey = _a.sent();
82
+ (0, chai_1.expect)(pubkey).to.equal("AvzyjjaXumyGNQR1DRkDdozJge+MPJPFuNaMr+DAK2ks");
83
+ return [2 /*return*/];
84
+ }
85
+ });
86
+ }); });
87
+ });