@initia/initia.js 0.1.0 → 0.1.1
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/package.json +1 -1
- package/dist/client/lcd/LCDUtils.d.ts +0 -18
- package/dist/client/lcd/LCDUtils.js +0 -93
- package/dist/client/lcd/LCDUtils.js.map +0 -1
- package/dist/client/lcd/api/MintAPI.d.ts +0 -27
- package/dist/client/lcd/api/MintAPI.js +0 -109
- package/dist/client/lcd/api/MintAPI.js.map +0 -1
- package/dist/client/lcd/api/StakingAPI.d.ts +0 -100
- package/dist/client/lcd/api/StakingAPI.js +0 -297
- package/dist/client/lcd/api/StakingAPI.js.map +0 -1
- package/dist/core/CompactBitArray.d.ts +0 -23
- package/dist/core/CompactBitArray.js +0 -94
- package/dist/core/CompactBitArray.js.map +0 -1
- package/dist/core/Deposit.d.ts +0 -37
- package/dist/core/Deposit.js +0 -81
- package/dist/core/Deposit.js.map +0 -1
- package/dist/core/Fee.d.ts +0 -42
- package/dist/core/Fee.js +0 -88
- package/dist/core/Fee.js.map +0 -1
- package/dist/core/MultiSignature.d.ts +0 -17
- package/dist/core/MultiSignature.js +0 -57
- package/dist/core/MultiSignature.js.map +0 -1
- package/dist/core/SignDoc.d.ts +0 -54
- package/dist/core/SignDoc.js +0 -96
- package/dist/core/SignDoc.js.map +0 -1
- package/dist/core/SignatureV2.d.ts +0 -66
- package/dist/core/SignatureV2.js +0 -131
- package/dist/core/SignatureV2.js.map +0 -1
- package/dist/core/Tx.d.ts +0 -147
- package/dist/core/Tx.js +0 -279
- package/dist/core/Tx.js.map +0 -1
- package/dist/core/TxInfo.d.ts +0 -91
- package/dist/core/TxInfo.js +0 -115
- package/dist/core/TxInfo.js.map +0 -1
- package/dist/core/ValidatorSet.d.ts +0 -11
- package/dist/core/ValidatorSet.js +0 -3
- package/dist/core/ValidatorSet.js.map +0 -1
- package/dist/core/auth/BaseVestingAccount.d.ts +0 -58
- package/dist/core/auth/BaseVestingAccount.js +0 -123
- package/dist/core/auth/BaseVestingAccount.js.map +0 -1
- package/dist/core/auth/ContinuousVestingAccount.d.ts +0 -45
- package/dist/core/auth/ContinuousVestingAccount.js +0 -116
- package/dist/core/auth/ContinuousVestingAccount.js.map +0 -1
- package/dist/core/auth/DelayedVestingAccount.d.ts +0 -42
- package/dist/core/auth/DelayedVestingAccount.js +0 -108
- package/dist/core/auth/DelayedVestingAccount.js.map +0 -1
- package/dist/core/auth/PeriodicVestingAccount.d.ts +0 -72
- package/dist/core/auth/PeriodicVestingAccount.js +0 -170
- package/dist/core/auth/PeriodicVestingAccount.js.map +0 -1
- package/dist/core/crisis/MsgVerifyInvariant.d.ts +0 -43
- package/dist/core/crisis/MsgVerifyInvariant.js +0 -77
- package/dist/core/crisis/MsgVerifyInvariant.js.map +0 -1
- package/dist/core/distribution/proposals/CommunityPoolSpendProposal.d.ts +0 -49
- package/dist/core/distribution/proposals/CommunityPoolSpendProposal.js +0 -97
- package/dist/core/distribution/proposals/CommunityPoolSpendProposal.js.map +0 -1
- package/dist/core/distribution/proposals/index.d.ts +0 -1
- package/dist/core/distribution/proposals/index.js +0 -18
- package/dist/core/distribution/proposals/index.js.map +0 -1
- package/dist/core/gov/Proposal.d.ts +0 -96
- package/dist/core/gov/Proposal.js +0 -244
- package/dist/core/gov/Proposal.js.map +0 -1
- package/dist/core/ibc/applications/fee/msgs/MsgRegisterCounterpartAddress.d.ts +0 -34
- package/dist/core/ibc/applications/fee/msgs/MsgRegisterCounterpartAddress.js +0 -82
- package/dist/core/ibc/applications/fee/msgs/MsgRegisterCounterpartAddress.js.map +0 -1
- package/dist/core/ibc/applications/nft-transfer/ClassTrace.d.ts +0 -28
- package/dist/core/ibc/applications/nft-transfer/ClassTrace.js +0 -67
- package/dist/core/ibc/applications/nft-transfer/ClassTrace.js.map +0 -1
- package/dist/core/ibc/core/connection/Version.d.ts +0 -28
- package/dist/core/ibc/core/connection/Version.js +0 -70
- package/dist/core/ibc/core/connection/Version.js.map +0 -1
- package/dist/core/move/StorageFee.d.ts +0 -34
- package/dist/core/move/StorageFee.js +0 -78
- package/dist/core/move/StorageFee.js.map +0 -1
- package/dist/core/move/proposals/DelistProposal.d.ts +0 -50
- package/dist/core/move/proposals/DelistProposal.js +0 -100
- package/dist/core/move/proposals/DelistProposal.js.map +0 -1
- package/dist/core/move/proposals/ExecuteOperation.d.ts +0 -51
- package/dist/core/move/proposals/ExecuteOperation.js +0 -100
- package/dist/core/move/proposals/ExecuteOperation.js.map +0 -1
- package/dist/core/move/proposals/ExecuteProposal.d.ts +0 -54
- package/dist/core/move/proposals/ExecuteProposal.js +0 -105
- package/dist/core/move/proposals/ExecuteProposal.js.map +0 -1
- package/dist/core/move/proposals/OperationsProposal.d.ts +0 -57
- package/dist/core/move/proposals/OperationsProposal.js +0 -129
- package/dist/core/move/proposals/OperationsProposal.js.map +0 -1
- package/dist/core/move/proposals/PublishOperation.d.ts +0 -34
- package/dist/core/move/proposals/PublishOperation.js +0 -76
- package/dist/core/move/proposals/PublishOperation.js.map +0 -1
- package/dist/core/move/proposals/PublishProposal.d.ts +0 -42
- package/dist/core/move/proposals/PublishProposal.js +0 -90
- package/dist/core/move/proposals/PublishProposal.js.map +0 -1
- package/dist/core/move/proposals/WhitelistProposal.d.ts +0 -54
- package/dist/core/move/proposals/WhitelistProposal.js +0 -105
- package/dist/core/move/proposals/WhitelistProposal.js.map +0 -1
- package/dist/core/move/proposals/index.d.ts +0 -5
- package/dist/core/move/proposals/index.js +0 -22
- package/dist/core/move/proposals/index.js.map +0 -1
- package/dist/core/staking/Delegation.d.ts +0 -45
- package/dist/core/staking/Delegation.js +0 -89
- package/dist/core/staking/Delegation.js.map +0 -1
- package/dist/core/staking/Redelegation.d.ts +0 -97
- package/dist/core/staking/Redelegation.js +0 -174
- package/dist/core/staking/Redelegation.js.map +0 -1
- package/dist/core/staking/UnbondingDelegation.d.ts +0 -75
- package/dist/core/staking/UnbondingDelegation.js +0 -143
- package/dist/core/staking/UnbondingDelegation.js.map +0 -1
- package/dist/core/staking/Validator.d.ts +0 -173
- package/dist/core/staking/Validator.js +0 -287
- package/dist/core/staking/Validator.js.map +0 -1
- package/dist/core/staking/msgs/MsgBeginRedelegate.d.ts +0 -51
- package/dist/core/staking/msgs/MsgBeginRedelegate.js +0 -99
- package/dist/core/staking/msgs/MsgBeginRedelegate.js.map +0 -1
- package/dist/core/staking/msgs/MsgCreateValidator.d.ts +0 -60
- package/dist/core/staking/msgs/MsgCreateValidator.js +0 -110
- package/dist/core/staking/msgs/MsgCreateValidator.js.map +0 -1
- package/dist/core/staking/msgs/MsgDelegate.d.ts +0 -46
- package/dist/core/staking/msgs/MsgDelegate.js +0 -93
- package/dist/core/staking/msgs/MsgDelegate.js.map +0 -1
- package/dist/core/staking/msgs/MsgEditValidator.d.ts +0 -50
- package/dist/core/staking/msgs/MsgEditValidator.js +0 -111
- package/dist/core/staking/msgs/MsgEditValidator.js.map +0 -1
- package/dist/core/staking/msgs/MsgUndelegate.d.ts +0 -46
- package/dist/core/staking/msgs/MsgUndelegate.js +0 -93
- package/dist/core/staking/msgs/MsgUndelegate.js.map +0 -1
- package/dist/core/staking/msgs/index.d.ts +0 -16
- package/dist/core/staking/msgs/index.js +0 -22
- package/dist/core/staking/msgs/index.js.map +0 -1
- package/dist/core/upgrade/proposals/CancelSoftwareUpgradeProposal.d.ts +0 -39
- package/dist/core/upgrade/proposals/CancelSoftwareUpgradeProposal.js +0 -86
- package/dist/core/upgrade/proposals/CancelSoftwareUpgradeProposal.js.map +0 -1
- package/dist/core/upgrade/proposals/SoftwareUpgradeProposal.d.ts +0 -44
- package/dist/core/upgrade/proposals/SoftwareUpgradeProposal.js +0 -92
- package/dist/core/upgrade/proposals/SoftwareUpgradeProposal.js.map +0 -1
- package/dist/core/upgrade/proposals/index.d.ts +0 -2
- package/dist/core/upgrade/proposals/index.js +0 -19
- package/dist/core/upgrade/proposals/index.js.map +0 -1
- package/dist/core/vesting/Period.d.ts +0 -32
- package/dist/core/vesting/Period.js +0 -78
- package/dist/core/vesting/Period.js.map +0 -1
- package/dist/core/vesting/index.d.ts +0 -2
- package/dist/core/vesting/index.js +0 -19
- package/dist/core/vesting/index.js.map +0 -1
- package/dist/core/vesting/msgs/MsgCreateVestingAccount.d.ts +0 -50
- package/dist/core/vesting/msgs/MsgCreateVestingAccount.js +0 -103
- package/dist/core/vesting/msgs/MsgCreateVestingAccount.js.map +0 -1
- package/dist/core/vesting/msgs/index.d.ts +0 -8
- package/dist/core/vesting/msgs/index.js +0 -18
- package/dist/core/vesting/msgs/index.js.map +0 -1
- package/dist/util/contract.d.ts +0 -9
- package/dist/util/contract.js +0 -57
- package/dist/util/contract.js.map +0 -1
- package/dist/util/convert.d.ts +0 -8
- package/dist/util/convert.js +0 -12
- package/dist/util/convert.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { LCDClient } from './LCDClient';
|
|
2
|
-
import { Validator } from '../../core/mstaking/Validator';
|
|
3
|
-
interface ValidatorWithVotingPower {
|
|
4
|
-
validatorInfo: Validator;
|
|
5
|
-
votingPower: number;
|
|
6
|
-
proposerPriority: number;
|
|
7
|
-
}
|
|
8
|
-
export declare class LCDUtils {
|
|
9
|
-
lcd: LCDClient;
|
|
10
|
-
constructor(lcd: LCDClient);
|
|
11
|
-
/**
|
|
12
|
-
* Gets current validators and merges their voting power from the validator set query.
|
|
13
|
-
*/
|
|
14
|
-
validatorsWithVotingPower(): Promise<{
|
|
15
|
-
[validatorAddress: string]: ValidatorWithVotingPower;
|
|
16
|
-
}>;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) 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.LCDUtils = void 0;
|
|
40
|
-
var LCDUtils = /** @class */ (function () {
|
|
41
|
-
function LCDUtils(lcd) {
|
|
42
|
-
this.lcd = lcd;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Gets current validators and merges their voting power from the validator set query.
|
|
46
|
-
*/
|
|
47
|
-
LCDUtils.prototype.validatorsWithVotingPower = function () {
|
|
48
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
49
|
-
var validatorSet, validatorSetByPubKey, validators, next_key, validatorsRes, res, _i, validators_1, v, delegateInfo;
|
|
50
|
-
return __generator(this, function (_a) {
|
|
51
|
-
switch (_a.label) {
|
|
52
|
-
case 0: return [4 /*yield*/, this.lcd.tendermint.validatorSet()];
|
|
53
|
-
case 1:
|
|
54
|
-
validatorSet = (_a.sent())[0];
|
|
55
|
-
validatorSetByPubKey = validatorSet.reduce(function (m, o) {
|
|
56
|
-
m[o.pub_key.key] = o;
|
|
57
|
-
return m;
|
|
58
|
-
}, {});
|
|
59
|
-
validators = [];
|
|
60
|
-
_a.label = 2;
|
|
61
|
-
case 2: return [4 /*yield*/, this.lcd.mstaking.validators({
|
|
62
|
-
'pagination.key': next_key,
|
|
63
|
-
})];
|
|
64
|
-
case 3:
|
|
65
|
-
validatorsRes = _a.sent();
|
|
66
|
-
validators.push.apply(validators, validatorsRes[0]);
|
|
67
|
-
if (!validatorsRes[1].next_key)
|
|
68
|
-
return [3 /*break*/, 5];
|
|
69
|
-
next_key = validatorsRes[1].next_key;
|
|
70
|
-
_a.label = 4;
|
|
71
|
-
case 4: return [3 /*break*/, 2];
|
|
72
|
-
case 5:
|
|
73
|
-
res = {};
|
|
74
|
-
for (_i = 0, validators_1 = validators; _i < validators_1.length; _i++) {
|
|
75
|
-
v = validators_1[_i];
|
|
76
|
-
delegateInfo = validatorSetByPubKey[v.consensus_pubkey.toData().key];
|
|
77
|
-
if (delegateInfo === undefined)
|
|
78
|
-
continue;
|
|
79
|
-
res[v.operator_address] = {
|
|
80
|
-
validatorInfo: v,
|
|
81
|
-
votingPower: Number.parseInt(delegateInfo.voting_power),
|
|
82
|
-
proposerPriority: Number.parseInt(delegateInfo.proposer_priority),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
return [2 /*return*/, res];
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
return LCDUtils;
|
|
91
|
-
}());
|
|
92
|
-
exports.LCDUtils = LCDUtils;
|
|
93
|
-
//# sourceMappingURL=LCDUtils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LCDUtils.js","sourceRoot":"","sources":["../../../src/client/lcd/LCDUtils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA;IACE,kBAAmB,GAAc;QAAd,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAErC;;OAEG;IACU,4CAAyB,GAAtC;;;;;4BAGyB,qBAAM,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,YAAY,EAAE,EAAA;;wBAAxD,YAAY,GAAI,CAAA,SAAwC,CAAA,GAA5C;wBACb,oBAAoB,GAAG,YAAY,CAAC,MAAM,CAAC,UAAC,CAAM,EAAE,CAAC;4BACzD,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;4BACrB,OAAO,CAAC,CAAC;wBACX,CAAC,EAAE,EAAE,CAAC,CAAC;wBAED,UAAU,GAAgB,EAAE,CAAC;;4BAGX,qBAAM,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;4BACvD,gBAAgB,EAAE,QAAQ;yBAC3B,CAAC,EAAA;;wBAFI,aAAa,GAAG,SAEpB;wBAEF,UAAU,CAAC,IAAI,OAAf,UAAU,EAAS,aAAa,CAAC,CAAC,CAAC,EAAE;wBAErC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ;4BAAE,wBAAM;wBACtC,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;;;;wBAGjC,GAAG,GAA8C,EAAE,CAAC;wBAE1D,WAA0B,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;4BAAjB,CAAC;4BACJ,YAAY,GAChB,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAa,CAAC,CAAC;4BAClE,IAAI,YAAY,KAAK,SAAS;gCAAE,SAAS;4BACzC,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAAG;gCACxB,aAAa,EAAE,CAAC;gCAChB,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,YAAY,CAAC;gCACvD,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,iBAAiB,CAAC;6BAClE,CAAC;yBACH;wBAED,sBAAO,GAAG,EAAC;;;;KACZ;IACH,eAAC;AAAD,CAAC,AA3CD,IA2CC;AA3CY,4BAAQ"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Denom } from '../../../core';
|
|
2
|
-
import { APIParams } from '../APIRequester';
|
|
3
|
-
import { BaseAPI } from './BaseAPI';
|
|
4
|
-
export interface MintingParams {
|
|
5
|
-
mint_denom: Denom;
|
|
6
|
-
inflation_rate: string;
|
|
7
|
-
}
|
|
8
|
-
export declare namespace MintingParams {
|
|
9
|
-
interface Data {
|
|
10
|
-
mint_denom: string;
|
|
11
|
-
inflation_rate: string;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
export declare class MintAPI extends BaseAPI {
|
|
15
|
-
/**
|
|
16
|
-
* Gets the current minting inflation value
|
|
17
|
-
*/
|
|
18
|
-
inflation(params?: APIParams): Promise<string>;
|
|
19
|
-
/**
|
|
20
|
-
* Gets the current minting annual provisions value
|
|
21
|
-
*/
|
|
22
|
-
annualProvisions(params?: APIParams): Promise<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Gets the current minting module's parameters.
|
|
25
|
-
*/
|
|
26
|
-
parameters(params?: APIParams): Promise<MintingParams>;
|
|
27
|
-
}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (_) try {
|
|
33
|
-
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;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
-
exports.MintAPI = void 0;
|
|
55
|
-
var BaseAPI_1 = require("./BaseAPI");
|
|
56
|
-
var MintAPI = /** @class */ (function (_super) {
|
|
57
|
-
__extends(MintAPI, _super);
|
|
58
|
-
function MintAPI() {
|
|
59
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Gets the current minting inflation value
|
|
63
|
-
*/
|
|
64
|
-
MintAPI.prototype.inflation = function (params) {
|
|
65
|
-
if (params === void 0) { params = {}; }
|
|
66
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
return [2 /*return*/, this.c
|
|
69
|
-
.get("/cosmos/mint/v1beta1/inflation", params)
|
|
70
|
-
.then(function (d) { return d.inflation; })];
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Gets the current minting annual provisions value
|
|
76
|
-
*/
|
|
77
|
-
MintAPI.prototype.annualProvisions = function (params) {
|
|
78
|
-
if (params === void 0) { params = {}; }
|
|
79
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
80
|
-
return __generator(this, function (_a) {
|
|
81
|
-
return [2 /*return*/, this.c
|
|
82
|
-
.get("cosmos/mint/v1beta1/annual_provisions", params)
|
|
83
|
-
.then(function (d) { return d.annual_provisions; })];
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Gets the current minting module's parameters.
|
|
89
|
-
*/
|
|
90
|
-
MintAPI.prototype.parameters = function (params) {
|
|
91
|
-
if (params === void 0) { params = {}; }
|
|
92
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
return __generator(this, function (_a) {
|
|
94
|
-
return [2 /*return*/, this.c
|
|
95
|
-
.get("/cosmos/mint/v1beta1/params", params)
|
|
96
|
-
.then(function (_a) {
|
|
97
|
-
var d = _a.params;
|
|
98
|
-
return ({
|
|
99
|
-
mint_denom: d.mint_denom,
|
|
100
|
-
inflation_rate: d.inflation_rate,
|
|
101
|
-
});
|
|
102
|
-
})];
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
return MintAPI;
|
|
107
|
-
}(BaseAPI_1.BaseAPI));
|
|
108
|
-
exports.MintAPI = MintAPI;
|
|
109
|
-
//# sourceMappingURL=MintAPI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MintAPI.js","sourceRoot":"","sources":["../../../../src/client/lcd/api/MintAPI.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qCAAoC;AAcpC;IAA6B,2BAAO;IAApC;;IAoCA,CAAC;IAnCC;;OAEG;IACU,2BAAS,GAAtB,UAAuB,MAAsB;QAAtB,uBAAA,EAAA,WAAsB;;;gBAC3C,sBAAO,IAAI,CAAC,CAAC;yBACV,GAAG,CAAwB,gCAAgC,EAAE,MAAM,CAAC;yBACpE,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,SAAS,EAAX,CAAW,CAAC,EAAC;;;KAC3B;IAED;;OAEG;IACU,kCAAgB,GAA7B,UAA8B,MAAsB;QAAtB,uBAAA,EAAA,WAAsB;;;gBAClD,sBAAO,IAAI,CAAC,CAAC;yBACV,GAAG,CACF,uCAAuC,EACvC,MAAM,CACP;yBACA,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,EAAnB,CAAmB,CAAC,EAAC;;;KACnC;IAED;;OAEG;IACU,4BAAU,GAAvB,UAAwB,MAAsB;QAAtB,uBAAA,EAAA,WAAsB;;;gBAC5C,sBAAO,IAAI,CAAC,CAAC;yBACV,GAAG,CACF,6BAA6B,EAC7B,MAAM,CACP;yBACA,IAAI,CAAC,UAAC,EAAa;4BAAH,CAAC,YAAA;wBAAO,OAAA,CAAC;4BACxB,UAAU,EAAE,CAAC,CAAC,UAAU;4BACxB,cAAc,EAAE,CAAC,CAAC,cAAc;yBACjC,CAAC;oBAHuB,CAGvB,CAAC,EAAC;;;KACP;IACH,cAAC;AAAD,CAAC,AApCD,CAA6B,iBAAO,GAoCnC;AApCY,0BAAO"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { AccAddress, ValAddress, UnbondingDelegation, Coins } from '../../../core';
|
|
2
|
-
import { BaseAPI } from './BaseAPI';
|
|
3
|
-
import { Delegation } from '../../../core/staking/Delegation';
|
|
4
|
-
import { Validator } from '../../../core/staking/Validator';
|
|
5
|
-
import { Redelegation } from '../../../core/staking/Redelegation';
|
|
6
|
-
import { Denom } from '../../../core/Denom';
|
|
7
|
-
import { APIParams, Pagination, PaginationOptions } from '../APIRequester';
|
|
8
|
-
export interface StakingParams {
|
|
9
|
-
/** Amount of time, in seconds, for bonded staking tokens to be unbonded. */
|
|
10
|
-
unbonding_time: number;
|
|
11
|
-
/** Max number of validators for the validating set (delegates). */
|
|
12
|
-
max_validators: number;
|
|
13
|
-
/** Maximum entries for unbonding delegations and redelegations. */
|
|
14
|
-
max_entries: number;
|
|
15
|
-
historical_entries: number;
|
|
16
|
-
/** The denomination used as the staking token. */
|
|
17
|
-
bond_denoms: Denom[];
|
|
18
|
-
min_voting_power: number;
|
|
19
|
-
}
|
|
20
|
-
export declare namespace StakingParams {
|
|
21
|
-
interface Data {
|
|
22
|
-
unbonding_time: string;
|
|
23
|
-
max_validators: number;
|
|
24
|
-
max_entries: number;
|
|
25
|
-
historical_entries: number;
|
|
26
|
-
bond_denoms: Denom[];
|
|
27
|
-
min_voting_power: string;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
export interface StakingPool {
|
|
31
|
-
/** amount of tokens are bonded, including those that are currently unbonding */
|
|
32
|
-
bonded_tokens: Coins;
|
|
33
|
-
/** amount of tokens that are not bonded */
|
|
34
|
-
not_bonded_tokens: Coins;
|
|
35
|
-
}
|
|
36
|
-
export declare namespace StakingPool {
|
|
37
|
-
interface Data {
|
|
38
|
-
bonded_tokens: Coins.Data;
|
|
39
|
-
not_bonded_tokens: Coins.Data;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
export declare class StakingAPI extends BaseAPI {
|
|
43
|
-
/**
|
|
44
|
-
* Queries all delegations, filtering by delegator, validator, or both.
|
|
45
|
-
*
|
|
46
|
-
* At least one of the parameters must be defined.
|
|
47
|
-
* @param delegator delegator's account address
|
|
48
|
-
* @param validator validator's operator address
|
|
49
|
-
*/
|
|
50
|
-
delegations(delegator?: AccAddress, validator?: ValAddress, params?: Partial<PaginationOptions & APIParams>): Promise<[Delegation[], Pagination]>;
|
|
51
|
-
/**
|
|
52
|
-
* Gets the delegation between a delegator and validator, if it exists.
|
|
53
|
-
* @param delegator delegator's account address
|
|
54
|
-
* @param validator validator's operator address
|
|
55
|
-
*/
|
|
56
|
-
delegation(delegator: AccAddress, validator: ValAddress): Promise<Delegation>;
|
|
57
|
-
/**
|
|
58
|
-
* Queries all unbonding delegations, filtering by delegator, validator, or both.
|
|
59
|
-
*
|
|
60
|
-
* At least one of the parameters must be defined.
|
|
61
|
-
* @param delegator delegator's account address
|
|
62
|
-
* @param validator validator's operator address
|
|
63
|
-
*/
|
|
64
|
-
unbondingDelegations(delegator?: AccAddress, validator?: ValAddress, params?: Partial<PaginationOptions & APIParams>): Promise<[UnbondingDelegation[], Pagination]>;
|
|
65
|
-
/**
|
|
66
|
-
* Gets the unbonding delegation between a delegator and validator, if it exists.
|
|
67
|
-
* @param delegator delegator's account address
|
|
68
|
-
* @param validator validator's operator address
|
|
69
|
-
*/
|
|
70
|
-
unbondingDelegation(delegator?: AccAddress, validator?: ValAddress): Promise<UnbondingDelegation>;
|
|
71
|
-
/**
|
|
72
|
-
* Queries all redelegations, filterable by delegator, source validator, and target validator.
|
|
73
|
-
* @param delegator delegator's account address
|
|
74
|
-
* @param validatorSrc source validator's operator address (from).
|
|
75
|
-
* @param validatorDst destination validator's operator address (to).
|
|
76
|
-
*/
|
|
77
|
-
redelegations(delegator: AccAddress, validatorSrc?: ValAddress, validatorDst?: ValAddress, _params?: Partial<PaginationOptions & APIParams>): Promise<[Redelegation[], Pagination]>;
|
|
78
|
-
/**
|
|
79
|
-
* Gets all bonded validators for a delegator given its address.
|
|
80
|
-
* @param delegator delegator's account address
|
|
81
|
-
*/
|
|
82
|
-
bondedValidators(delegator: AccAddress, params?: Partial<PaginationOptions & APIParams>): Promise<[Validator[], Pagination]>;
|
|
83
|
-
/**
|
|
84
|
-
* Get all current registered validators, including validators that are not currently in the validating set.
|
|
85
|
-
*/
|
|
86
|
-
validators(params?: Partial<PaginationOptions & APIParams>): Promise<[Validator[], Pagination]>;
|
|
87
|
-
/**
|
|
88
|
-
* Gets the validator information for a specific validator.
|
|
89
|
-
* @param validator validator's operator address
|
|
90
|
-
*/
|
|
91
|
-
validator(validator: ValAddress, params?: APIParams): Promise<Validator>;
|
|
92
|
-
/**
|
|
93
|
-
* Gets the current staking pool.
|
|
94
|
-
*/
|
|
95
|
-
pool(params?: APIParams): Promise<StakingPool>;
|
|
96
|
-
/**
|
|
97
|
-
* Gets the current Staking module's parameters.
|
|
98
|
-
*/
|
|
99
|
-
parameters(params?: APIParams): Promise<StakingParams>;
|
|
100
|
-
}
|
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __assign = (this && this.__assign) || function () {
|
|
18
|
-
__assign = Object.assign || function(t) {
|
|
19
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
20
|
-
s = arguments[i];
|
|
21
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
22
|
-
t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
29
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
38
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
39
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
40
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
|
-
function step(op) {
|
|
42
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
44
|
-
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;
|
|
45
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
|
-
switch (op[0]) {
|
|
47
|
-
case 0: case 1: t = op; break;
|
|
48
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
49
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
50
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
51
|
-
default:
|
|
52
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
53
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
54
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
55
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
56
|
-
if (t[2]) _.ops.pop();
|
|
57
|
-
_.trys.pop(); continue;
|
|
58
|
-
}
|
|
59
|
-
op = body.call(thisArg, _);
|
|
60
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
61
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.StakingAPI = void 0;
|
|
66
|
-
var core_1 = require("../../../core");
|
|
67
|
-
var BaseAPI_1 = require("./BaseAPI");
|
|
68
|
-
var Delegation_1 = require("../../../core/staking/Delegation");
|
|
69
|
-
var Validator_1 = require("../../../core/staking/Validator");
|
|
70
|
-
var Redelegation_1 = require("../../../core/staking/Redelegation");
|
|
71
|
-
var StakingAPI = /** @class */ (function (_super) {
|
|
72
|
-
__extends(StakingAPI, _super);
|
|
73
|
-
function StakingAPI() {
|
|
74
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Queries all delegations, filtering by delegator, validator, or both.
|
|
78
|
-
*
|
|
79
|
-
* At least one of the parameters must be defined.
|
|
80
|
-
* @param delegator delegator's account address
|
|
81
|
-
* @param validator validator's operator address
|
|
82
|
-
*/
|
|
83
|
-
StakingAPI.prototype.delegations = function (delegator, validator, params) {
|
|
84
|
-
if (params === void 0) { params = {}; }
|
|
85
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
86
|
-
return __generator(this, function (_a) {
|
|
87
|
-
if (delegator !== undefined && validator !== undefined) {
|
|
88
|
-
return [2 /*return*/, this.c
|
|
89
|
-
.get("/initia/mstaking/v1/validators/".concat(validator, "/delegations/").concat(delegator), params)
|
|
90
|
-
.then(function (_a) {
|
|
91
|
-
var data = _a.delegation_response;
|
|
92
|
-
return [
|
|
93
|
-
[Delegation_1.Delegation.fromData(data)],
|
|
94
|
-
{ total: 1, next_key: '' },
|
|
95
|
-
];
|
|
96
|
-
})];
|
|
97
|
-
}
|
|
98
|
-
else if (delegator !== undefined) {
|
|
99
|
-
return [2 /*return*/, this.c
|
|
100
|
-
.get("/initia/mstaking/v1/delegations/".concat(delegator), params)
|
|
101
|
-
.then(function (data) { return [
|
|
102
|
-
data.delegation_responses.map(Delegation_1.Delegation.fromData),
|
|
103
|
-
data.pagination,
|
|
104
|
-
]; })];
|
|
105
|
-
}
|
|
106
|
-
else if (validator !== undefined) {
|
|
107
|
-
return [2 /*return*/, this.c
|
|
108
|
-
.get("/initia/mstaking/v1/validators/".concat(validator, "/delegations"), params)
|
|
109
|
-
.then(function (data) { return [
|
|
110
|
-
data.delegation_responses.map(Delegation_1.Delegation.fromData),
|
|
111
|
-
data.pagination,
|
|
112
|
-
]; })];
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
throw new TypeError('arguments delegator and validator cannot both be empty');
|
|
116
|
-
}
|
|
117
|
-
return [2 /*return*/];
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Gets the delegation between a delegator and validator, if it exists.
|
|
123
|
-
* @param delegator delegator's account address
|
|
124
|
-
* @param validator validator's operator address
|
|
125
|
-
*/
|
|
126
|
-
StakingAPI.prototype.delegation = function (delegator, validator) {
|
|
127
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
-
return __generator(this, function (_a) {
|
|
129
|
-
return [2 /*return*/, this.delegations(delegator, validator).then(function (delgs) { return delgs[0][0]; })];
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
/**
|
|
134
|
-
* Queries all unbonding delegations, filtering by delegator, validator, or both.
|
|
135
|
-
*
|
|
136
|
-
* At least one of the parameters must be defined.
|
|
137
|
-
* @param delegator delegator's account address
|
|
138
|
-
* @param validator validator's operator address
|
|
139
|
-
*/
|
|
140
|
-
StakingAPI.prototype.unbondingDelegations = function (delegator, validator, params) {
|
|
141
|
-
if (params === void 0) { params = {}; }
|
|
142
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
return __generator(this, function (_a) {
|
|
144
|
-
if (delegator !== undefined && validator !== undefined) {
|
|
145
|
-
return [2 /*return*/, this.c
|
|
146
|
-
.get("/initia/mstaking/v1/validators/".concat(validator, "/delegations/").concat(delegator, "/unbonding_delegation"), params)
|
|
147
|
-
.then(function (_a) {
|
|
148
|
-
var data = _a.unbond;
|
|
149
|
-
return [
|
|
150
|
-
[core_1.UnbondingDelegation.fromData(data)],
|
|
151
|
-
{ next_key: '', total: 1 },
|
|
152
|
-
];
|
|
153
|
-
})];
|
|
154
|
-
}
|
|
155
|
-
else if (delegator !== undefined) {
|
|
156
|
-
return [2 /*return*/, this.c
|
|
157
|
-
.get("/initia/mstaking/v1/delegators/".concat(delegator, "/unbonding_delegations"), params)
|
|
158
|
-
.then(function (data) { return [
|
|
159
|
-
data.unbonding_responses.map(core_1.UnbondingDelegation.fromData),
|
|
160
|
-
data.pagination,
|
|
161
|
-
]; })];
|
|
162
|
-
}
|
|
163
|
-
else if (validator !== undefined) {
|
|
164
|
-
return [2 /*return*/, this.c
|
|
165
|
-
.get("/initia/mstaking/v1/validators/".concat(validator, "/unbonding_delegations"), params)
|
|
166
|
-
.then(function (data) { return [
|
|
167
|
-
data.unbonding_responses.map(core_1.UnbondingDelegation.fromData),
|
|
168
|
-
data.pagination,
|
|
169
|
-
]; })];
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
throw new TypeError('arguments delegator and validator cannot both be empty');
|
|
173
|
-
}
|
|
174
|
-
return [2 /*return*/];
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Gets the unbonding delegation between a delegator and validator, if it exists.
|
|
180
|
-
* @param delegator delegator's account address
|
|
181
|
-
* @param validator validator's operator address
|
|
182
|
-
*/
|
|
183
|
-
StakingAPI.prototype.unbondingDelegation = function (delegator, validator) {
|
|
184
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
185
|
-
return __generator(this, function (_a) {
|
|
186
|
-
return [2 /*return*/, this.unbondingDelegations(delegator, validator).then(function (udelgs) { return udelgs[0][0]; })];
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Queries all redelegations, filterable by delegator, source validator, and target validator.
|
|
192
|
-
* @param delegator delegator's account address
|
|
193
|
-
* @param validatorSrc source validator's operator address (from).
|
|
194
|
-
* @param validatorDst destination validator's operator address (to).
|
|
195
|
-
*/
|
|
196
|
-
StakingAPI.prototype.redelegations = function (delegator, validatorSrc, validatorDst, _params) {
|
|
197
|
-
if (_params === void 0) { _params = {}; }
|
|
198
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
199
|
-
var params;
|
|
200
|
-
return __generator(this, function (_a) {
|
|
201
|
-
params = __assign(__assign({}, _params), { src_validator_addr: validatorSrc, dst_validator_addr: validatorDst });
|
|
202
|
-
return [2 /*return*/, this.c
|
|
203
|
-
.get("/initia/mstaking/v1/delegators/".concat(delegator, "/redelegations"), params)
|
|
204
|
-
.then(function (d) { return [
|
|
205
|
-
d.redelegation_responses.map(Redelegation_1.Redelegation.fromData),
|
|
206
|
-
d.pagination,
|
|
207
|
-
]; })];
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
};
|
|
211
|
-
/**
|
|
212
|
-
* Gets all bonded validators for a delegator given its address.
|
|
213
|
-
* @param delegator delegator's account address
|
|
214
|
-
*/
|
|
215
|
-
StakingAPI.prototype.bondedValidators = function (delegator, params) {
|
|
216
|
-
if (params === void 0) { params = {}; }
|
|
217
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
218
|
-
return __generator(this, function (_a) {
|
|
219
|
-
return [2 /*return*/, this.c
|
|
220
|
-
.get("/initia/mstaking/v1/delegators/".concat(delegator, "/validators"), params)
|
|
221
|
-
.then(function (d) { return [d.validators.map(Validator_1.Validator.fromData), d.pagination]; })];
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
};
|
|
225
|
-
/**
|
|
226
|
-
* Get all current registered validators, including validators that are not currently in the validating set.
|
|
227
|
-
*/
|
|
228
|
-
StakingAPI.prototype.validators = function (params) {
|
|
229
|
-
if (params === void 0) { params = {}; }
|
|
230
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
231
|
-
return __generator(this, function (_a) {
|
|
232
|
-
return [2 /*return*/, this.c
|
|
233
|
-
.get("/initia/mstaking/v1/validators", params)
|
|
234
|
-
.then(function (d) { return [d.validators.map(Validator_1.Validator.fromData), d.pagination]; })];
|
|
235
|
-
});
|
|
236
|
-
});
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* Gets the validator information for a specific validator.
|
|
240
|
-
* @param validator validator's operator address
|
|
241
|
-
*/
|
|
242
|
-
StakingAPI.prototype.validator = function (validator, params) {
|
|
243
|
-
if (params === void 0) { params = {}; }
|
|
244
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
245
|
-
return __generator(this, function (_a) {
|
|
246
|
-
return [2 /*return*/, this.c
|
|
247
|
-
.get("/initia/mstaking/v1/validators/".concat(validator), params)
|
|
248
|
-
.then(function (d) { return Validator_1.Validator.fromData(d.validator); })];
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Gets the current staking pool.
|
|
254
|
-
*/
|
|
255
|
-
StakingAPI.prototype.pool = function (params) {
|
|
256
|
-
if (params === void 0) { params = {}; }
|
|
257
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
258
|
-
return __generator(this, function (_a) {
|
|
259
|
-
return [2 /*return*/, this.c
|
|
260
|
-
.get("/initia/mstaking/v1/pool", params)
|
|
261
|
-
.then(function (_a) {
|
|
262
|
-
var d = _a.pool;
|
|
263
|
-
return ({
|
|
264
|
-
bonded_tokens: core_1.Coins.fromData(d.bonded_tokens),
|
|
265
|
-
not_bonded_tokens: core_1.Coins.fromData(d.not_bonded_tokens),
|
|
266
|
-
});
|
|
267
|
-
})];
|
|
268
|
-
});
|
|
269
|
-
});
|
|
270
|
-
};
|
|
271
|
-
/**
|
|
272
|
-
* Gets the current Staking module's parameters.
|
|
273
|
-
*/
|
|
274
|
-
StakingAPI.prototype.parameters = function (params) {
|
|
275
|
-
if (params === void 0) { params = {}; }
|
|
276
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
277
|
-
return __generator(this, function (_a) {
|
|
278
|
-
return [2 /*return*/, this.c
|
|
279
|
-
.get("/initia/mstaking/v1/params", params)
|
|
280
|
-
.then(function (_a) {
|
|
281
|
-
var d = _a.params;
|
|
282
|
-
return ({
|
|
283
|
-
unbonding_time: Number.parseInt(d.unbonding_time),
|
|
284
|
-
max_validators: d.max_validators,
|
|
285
|
-
max_entries: d.max_entries,
|
|
286
|
-
historical_entries: d.historical_entries,
|
|
287
|
-
bond_denoms: d.bond_denoms,
|
|
288
|
-
min_voting_power: Number.parseInt(d.min_voting_power),
|
|
289
|
-
});
|
|
290
|
-
})];
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
return StakingAPI;
|
|
295
|
-
}(BaseAPI_1.BaseAPI));
|
|
296
|
-
exports.StakingAPI = StakingAPI;
|
|
297
|
-
//# sourceMappingURL=StakingAPI.js.map
|