@firmachain/firma-js 0.2.45 → 0.2.47
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.
- package/dist/sdk/FirmaBankService.d.ts +2 -0
- package/dist/sdk/FirmaBankService.js +59 -16
- package/dist/sdk/FirmaMintService.d.ts +6 -0
- package/dist/sdk/FirmaMintService.js +67 -0
- package/dist/sdk/FirmaSDK.d.ts +3 -1
- package/dist/sdk/FirmaSDK.js +4 -1
- package/dist/sdk/FirmaUtil.d.ts +1 -0
- package/dist/sdk/FirmaUtil.js +5 -0
- package/dist/sdk/firmachain/mint/MintQueryClient.d.ts +5 -0
- package/dist/sdk/firmachain/mint/MintQueryClient.js +71 -0
- package/dist/sdk/firmachain/mint/index.d.ts +2 -0
- package/dist/sdk/firmachain/mint/index.js +18 -0
- 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,
|
|
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
|
-
|
|
183
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
184
|
-
throw
|
|
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,
|
|
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
|
-
|
|
204
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
205
|
-
throw
|
|
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,
|
|
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
|
-
|
|
225
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
226
|
-
throw
|
|
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,
|
|
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
|
-
|
|
250
|
-
FirmaUtil_1.FirmaUtil.printLog(
|
|
251
|
-
throw
|
|
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,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;
|
package/dist/sdk/FirmaSDK.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
}
|
package/dist/sdk/FirmaSDK.js
CHANGED
|
@@ -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;
|
package/dist/sdk/FirmaUtil.d.ts
CHANGED
|
@@ -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>;
|
package/dist/sdk/FirmaUtil.js
CHANGED
|
@@ -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,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,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);
|