@initia/initia.js 0.0.30 → 0.0.31
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/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/dist/bundle.node.js +1 -1
- package/dist/bundle.node.js.map +1 -1
- package/dist/client/lcd/LCDClient.d.ts +2 -2
- package/dist/client/lcd/LCDClient.js +1 -1
- package/dist/client/lcd/LCDClient.js.map +1 -1
- package/dist/client/lcd/LCDUtils.d.ts +1 -1
- package/dist/client/lcd/LCDUtils.js +1 -1
- package/dist/client/lcd/LCDUtils.js.map +1 -1
- package/dist/client/lcd/api/MoveAPI.d.ts +2 -0
- package/dist/client/lcd/api/MoveAPI.js +2 -0
- package/dist/client/lcd/api/MoveAPI.js.map +1 -1
- package/dist/client/lcd/api/MstakingAPI.d.ts +97 -0
- package/dist/client/lcd/api/MstakingAPI.js +294 -0
- package/dist/client/lcd/api/MstakingAPI.js.map +1 -0
- package/dist/client/lcd/api/index.d.ts +1 -1
- package/dist/client/lcd/api/index.js +1 -1
- package/dist/client/lcd/api/index.js.map +1 -1
- package/dist/core/Msg.d.ts +5 -5
- package/dist/core/Msg.js +9 -9
- package/dist/core/Msg.js.map +1 -1
- package/dist/core/index.d.ts +5 -5
- package/dist/core/index.js +6 -6
- package/dist/core/index.js.map +1 -1
- package/dist/core/move/msgs/MsgExecute.d.ts +1 -1
- package/dist/core/move/msgs/MsgExecute.js +1 -1
- package/dist/core/move/msgs/MsgPublish.d.ts +8 -3
- package/dist/core/move/msgs/MsgPublish.js +16 -11
- package/dist/core/move/msgs/MsgPublish.js.map +1 -1
- package/dist/core/move/msgs/MsgScript.d.ts +2 -2
- package/dist/core/move/msgs/MsgScript.js +2 -2
- package/dist/core/mstaking/Delegation.d.ts +45 -0
- package/dist/core/mstaking/Delegation.js +89 -0
- package/dist/core/mstaking/Delegation.js.map +1 -0
- package/dist/core/mstaking/Redelegation.d.ts +97 -0
- package/dist/core/mstaking/Redelegation.js +174 -0
- package/dist/core/mstaking/Redelegation.js.map +1 -0
- package/dist/core/mstaking/UnbondingDelegation.d.ts +75 -0
- package/dist/core/mstaking/UnbondingDelegation.js +143 -0
- package/dist/core/mstaking/UnbondingDelegation.js.map +1 -0
- package/dist/core/mstaking/Validator.d.ts +173 -0
- package/dist/core/mstaking/Validator.js +287 -0
- package/dist/core/mstaking/Validator.js.map +1 -0
- package/dist/core/mstaking/msgs/MsgBeginRedelegate.d.ts +51 -0
- package/dist/core/mstaking/msgs/MsgBeginRedelegate.js +99 -0
- package/dist/core/mstaking/msgs/MsgBeginRedelegate.js.map +1 -0
- package/dist/core/mstaking/msgs/MsgCreateValidator.d.ts +60 -0
- package/dist/core/mstaking/msgs/MsgCreateValidator.js +110 -0
- package/dist/core/mstaking/msgs/MsgCreateValidator.js.map +1 -0
- package/dist/core/mstaking/msgs/MsgDelegate.d.ts +46 -0
- package/dist/core/mstaking/msgs/MsgDelegate.js +93 -0
- package/dist/core/mstaking/msgs/MsgDelegate.js.map +1 -0
- package/dist/core/mstaking/msgs/MsgEditValidator.d.ts +50 -0
- package/dist/core/mstaking/msgs/MsgEditValidator.js +111 -0
- package/dist/core/mstaking/msgs/MsgEditValidator.js.map +1 -0
- package/dist/core/mstaking/msgs/MsgUndelegate.d.ts +46 -0
- package/dist/core/mstaking/msgs/MsgUndelegate.js +93 -0
- package/dist/core/mstaking/msgs/MsgUndelegate.js.map +1 -0
- package/dist/core/mstaking/msgs/index.d.ts +16 -0
- package/dist/core/mstaking/msgs/index.js +22 -0
- package/dist/core/mstaking/msgs/index.js.map +1 -0
- package/dist/core/params/proposals/ParameterChangeProposal.d.ts +1 -5
- package/dist/core/params/proposals/ParameterChangeProposal.js +1 -5
- package/dist/core/params/proposals/ParameterChangeProposal.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,174 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.Redelegation = void 0;
|
|
22
|
+
var json_1 = require("../../util/json");
|
|
23
|
+
var Coins_1 = require("../Coins");
|
|
24
|
+
var staking_1 = require("@initia/initia.proto/initia/mstaking/v1/staking");
|
|
25
|
+
var long_1 = __importDefault(require("long"));
|
|
26
|
+
/**
|
|
27
|
+
* A redelegation is when a delegator decides to stop mstaking with one validator and
|
|
28
|
+
* transfer their delegation to another validator. Rather than unbonding (which takes
|
|
29
|
+
* some time) and re-staking, the funds can be redelegated immediately if a
|
|
30
|
+
* [[Redelegation.Entry]] can be created.
|
|
31
|
+
*
|
|
32
|
+
* A redelegation, like an unbonding delegation, is implemented through
|
|
33
|
+
* [[Redelegation.Entry]] objects, limited by the `max_entry` parameter in the mstaking
|
|
34
|
+
* module params. For each pair of source and target validators, you cannot redelegate
|
|
35
|
+
* more times than the amount of entries. Entries are cleared when the redelegation is
|
|
36
|
+
* completed, the same amount of time as unbonding.
|
|
37
|
+
*/
|
|
38
|
+
var Redelegation = /** @class */ (function (_super) {
|
|
39
|
+
__extends(Redelegation, _super);
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param delegator_address delegator's account address
|
|
43
|
+
* @param validator_src_address source validator's operator address (from)
|
|
44
|
+
* @param validator_dst_address target validator's operator address (to)
|
|
45
|
+
* @param entries entries
|
|
46
|
+
*/
|
|
47
|
+
function Redelegation(delegator_address, validator_src_address, validator_dst_address, entries) {
|
|
48
|
+
var _this = _super.call(this) || this;
|
|
49
|
+
_this.delegator_address = delegator_address;
|
|
50
|
+
_this.validator_src_address = validator_src_address;
|
|
51
|
+
_this.validator_dst_address = validator_dst_address;
|
|
52
|
+
_this.entries = entries;
|
|
53
|
+
return _this;
|
|
54
|
+
}
|
|
55
|
+
Redelegation.fromAmino = function (data) {
|
|
56
|
+
var _a = data.redelegation, delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, entries = data.entries;
|
|
57
|
+
return new Redelegation(delegator_address, validator_src_address, validator_dst_address, entries.map(function (e) { return Redelegation.Entry.fromAmino(e); }));
|
|
58
|
+
};
|
|
59
|
+
Redelegation.prototype.toAmino = function () {
|
|
60
|
+
var _a = this, delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, entries = _a.entries;
|
|
61
|
+
return {
|
|
62
|
+
redelegation: {
|
|
63
|
+
delegator_address: delegator_address,
|
|
64
|
+
validator_src_address: validator_src_address,
|
|
65
|
+
validator_dst_address: validator_dst_address,
|
|
66
|
+
},
|
|
67
|
+
entries: entries.map(function (e) { return e.toAmino(); }),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
Redelegation.fromData = function (data) {
|
|
71
|
+
var _a = data.redelegation, delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, entries = data.entries;
|
|
72
|
+
return new Redelegation(delegator_address, validator_src_address, validator_dst_address, entries.map(function (e) { return Redelegation.Entry.fromData(e); }));
|
|
73
|
+
};
|
|
74
|
+
Redelegation.prototype.toData = function () {
|
|
75
|
+
var _a = this, delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, entries = _a.entries;
|
|
76
|
+
return {
|
|
77
|
+
redelegation: {
|
|
78
|
+
delegator_address: delegator_address,
|
|
79
|
+
validator_src_address: validator_src_address,
|
|
80
|
+
validator_dst_address: validator_dst_address,
|
|
81
|
+
},
|
|
82
|
+
entries: entries.map(function (e) { return e.toData(); }),
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
Redelegation.fromProto = function (data) {
|
|
86
|
+
var redelegationProto = data.redelegation;
|
|
87
|
+
return new Redelegation(redelegationProto.delegatorAddress, redelegationProto.validatorDstAddress, redelegationProto.validatorDstAddress, data.entries.map(function (e) { return Redelegation.Entry.fromProto(e); }));
|
|
88
|
+
};
|
|
89
|
+
Redelegation.prototype.toProto = function () {
|
|
90
|
+
var _a = this, delegator_address = _a.delegator_address, validator_src_address = _a.validator_src_address, validator_dst_address = _a.validator_dst_address, entries = _a.entries;
|
|
91
|
+
return staking_1.RedelegationResponse.fromPartial({
|
|
92
|
+
entries: entries.map(function (e) { return e.toProto(); }),
|
|
93
|
+
redelegation: staking_1.Redelegation.fromPartial({
|
|
94
|
+
delegatorAddress: delegator_address,
|
|
95
|
+
entries: entries.map(function (e) { return e.toProto().redelegationEntry; }),
|
|
96
|
+
validatorDstAddress: validator_dst_address,
|
|
97
|
+
validatorSrcAddress: validator_src_address,
|
|
98
|
+
}),
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
return Redelegation;
|
|
102
|
+
}(json_1.JSONSerializable));
|
|
103
|
+
exports.Redelegation = Redelegation;
|
|
104
|
+
(function (Redelegation) {
|
|
105
|
+
var Entry = /** @class */ (function (_super) {
|
|
106
|
+
__extends(Entry, _super);
|
|
107
|
+
/**
|
|
108
|
+
*
|
|
109
|
+
* @param initial_balance balance of delegation prior to initiating redelegation
|
|
110
|
+
* @param shares_dst
|
|
111
|
+
* @param creation_height height of blockchain when entry was created
|
|
112
|
+
* @param completion_time time when redelegation entry will be removed
|
|
113
|
+
*/
|
|
114
|
+
function Entry(initial_balance, balance, shares_dst, creation_height, completion_time) {
|
|
115
|
+
var _this = _super.call(this) || this;
|
|
116
|
+
_this.creation_height = creation_height;
|
|
117
|
+
_this.completion_time = completion_time;
|
|
118
|
+
_this.initial_balance = new Coins_1.Coins(initial_balance);
|
|
119
|
+
_this.balance = new Coins_1.Coins(balance);
|
|
120
|
+
_this.shares_dst = new Coins_1.Coins(shares_dst);
|
|
121
|
+
return _this;
|
|
122
|
+
}
|
|
123
|
+
Entry.prototype.toAmino = function () {
|
|
124
|
+
return {
|
|
125
|
+
redelegation_entry: {
|
|
126
|
+
initial_balance: this.initial_balance.toAmino(),
|
|
127
|
+
shares_dst: this.shares_dst.toAmino(),
|
|
128
|
+
creation_height: this.creation_height,
|
|
129
|
+
completion_time: this.completion_time.toISOString(),
|
|
130
|
+
},
|
|
131
|
+
balance: this.balance.toAmino(),
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
Entry.fromAmino = function (data) {
|
|
135
|
+
var _a = data.redelegation_entry, initial_balance = _a.initial_balance, shares_dst = _a.shares_dst, creation_height = _a.creation_height, completion_time = _a.completion_time, balance = data.balance;
|
|
136
|
+
return new Entry(Coins_1.Coins.fromAmino(initial_balance), Coins_1.Coins.fromAmino(balance), Coins_1.Coins.fromAmino(shares_dst), creation_height, new Date(completion_time));
|
|
137
|
+
};
|
|
138
|
+
Entry.prototype.toData = function () {
|
|
139
|
+
return {
|
|
140
|
+
redelegation_entry: {
|
|
141
|
+
initial_balance: this.initial_balance.toData(),
|
|
142
|
+
shares_dst: this.shares_dst.toData(),
|
|
143
|
+
creation_height: this.creation_height,
|
|
144
|
+
completion_time: this.completion_time.toISOString(),
|
|
145
|
+
},
|
|
146
|
+
balance: this.balance.toData(),
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
Entry.fromData = function (data) {
|
|
150
|
+
var _a = data.redelegation_entry, initial_balance = _a.initial_balance, shares_dst = _a.shares_dst, creation_height = _a.creation_height, completion_time = _a.completion_time, balance = data.balance;
|
|
151
|
+
return new Entry(Coins_1.Coins.fromData(initial_balance), Coins_1.Coins.fromData(balance), Coins_1.Coins.fromData(shares_dst), creation_height, new Date(completion_time));
|
|
152
|
+
};
|
|
153
|
+
Entry.prototype.toProto = function () {
|
|
154
|
+
var _a = this, initial_balance = _a.initial_balance, balance = _a.balance, shares_dst = _a.shares_dst, creation_height = _a.creation_height, completion_time = _a.completion_time;
|
|
155
|
+
return staking_1.RedelegationEntryResponse.fromPartial({
|
|
156
|
+
balance: balance.toProto(),
|
|
157
|
+
redelegationEntry: staking_1.RedelegationEntry.fromPartial({
|
|
158
|
+
completionTime: completion_time,
|
|
159
|
+
creationHeight: long_1.default.fromNumber(creation_height),
|
|
160
|
+
initialBalance: initial_balance.toProto(),
|
|
161
|
+
sharesDst: shares_dst.toProto(),
|
|
162
|
+
}),
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
Entry.fromProto = function (proto) {
|
|
166
|
+
var redelegationEntryProto = proto.redelegationEntry;
|
|
167
|
+
return new Entry(Coins_1.Coins.fromProto(redelegationEntryProto.initialBalance), Coins_1.Coins.fromProto(proto.balance), Coins_1.Coins.fromProto(redelegationEntryProto.sharesDst), redelegationEntryProto.creationHeight.toNumber(), redelegationEntryProto.completionTime);
|
|
168
|
+
};
|
|
169
|
+
return Entry;
|
|
170
|
+
}(json_1.JSONSerializable));
|
|
171
|
+
Redelegation.Entry = Entry;
|
|
172
|
+
})(Redelegation = exports.Redelegation || (exports.Redelegation = {}));
|
|
173
|
+
exports.Redelegation = Redelegation;
|
|
174
|
+
//# sourceMappingURL=Redelegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Redelegation.js","sourceRoot":"","sources":["../../../src/core/mstaking/Redelegation.ts"],"names":[],"mappings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C;YAET,OAAO,mCAA4B,CAAC,WAAW,CAAC;gBAC9C,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;gBAC1B,iBAAiB,EAAE,2BAAoB,CAAC,WAAW,CAAC;oBAClD,cAAc,EAAE,eAAe;oBAC/B,cAAc,EAAE,cAAI,CAAC,UAAU,CAAC,eAAe,CAAC;oBAChD,cAAc,EAAE,eAAe,CAAC,OAAO,EAAE;oBACzC,SAAS,EAAE,UAAU,CAAC,OAAO,EAAE;iBAChC,CAAC;aACH,CAAC,CAAC;QACL,CAAC;QAEa,eAAS,GAAvB,UAAwB,KAAkB;YACxC,IAAM,sBAAsB,GAC1B,KAAK,CAAC,iBAAyC,CAAC;YAElD,OAAO,IAAI,KAAK,CACd,aAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,cAAc,CAAC,EACtD,aAAK,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAC9B,aAAK,CAAC,SAAS,CAAC,sBAAsB,CAAC,SAAS,CAAC,EACjD,sBAAsB,CAAC,cAAc,CAAC,QAAQ,EAAE,EAChD,sBAAsB,CAAC,cAAsB,CAC9C,CAAC;QACJ,CAAC;QACH,YAAC;IAAD,CAAC,AA3HD,CAA2B,uBAAgB,GA2H1C;IA3HY,kBAAK,QA2HjB,CAAA;AAyBH,CAAC,EAzKgB,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QAyK5B;AAlSY,oCAAY"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { JSONSerializable } from '../../util/json';
|
|
2
|
+
import { Coins } from '../Coins';
|
|
3
|
+
import { AccAddress, ValAddress } from '../bech32';
|
|
4
|
+
import { UnbondingDelegation as UnbondingDelegation_pb, UnbondingDelegationEntry as UnbondingDelegationEntry_pb } from '@initia/initia.proto/initia/mstaking/v1/staking';
|
|
5
|
+
/**
|
|
6
|
+
* When a delegator decides to take out their funds from the mstaking pool, they must
|
|
7
|
+
* unbond their tokens which takes an amount of time specified by `unbonding_time`
|
|
8
|
+
* parameter in the mstaking module.
|
|
9
|
+
*
|
|
10
|
+
* An unbonding delegation is implemented through creating [[UnbondingDelegation.Entry]]
|
|
11
|
+
* objects, limited by the max_entry parameter in the mstaking module params. You cannot
|
|
12
|
+
* initiate unbonds more times than the amount of entries permitted. Entries are cleared
|
|
13
|
+
* when their unbonding periods are completed and the funds are returned to the
|
|
14
|
+
* delegator's account balance to be spent freely.
|
|
15
|
+
*/
|
|
16
|
+
export declare class UnbondingDelegation extends JSONSerializable<UnbondingDelegation.Amino, UnbondingDelegation.Data, UnbondingDelegation.Proto> {
|
|
17
|
+
delegator_address: AccAddress;
|
|
18
|
+
validator_address: ValAddress;
|
|
19
|
+
entries: UnbondingDelegation.Entry[];
|
|
20
|
+
constructor(delegator_address: AccAddress, validator_address: ValAddress, entries: UnbondingDelegation.Entry[]);
|
|
21
|
+
static fromAmino(data: UnbondingDelegation.Amino): UnbondingDelegation;
|
|
22
|
+
toAmino(): UnbondingDelegation.Amino;
|
|
23
|
+
static fromData(data: UnbondingDelegation.Data): UnbondingDelegation;
|
|
24
|
+
toData(): UnbondingDelegation.Data;
|
|
25
|
+
toProto(): UnbondingDelegation.Proto;
|
|
26
|
+
static fromProto(proto: UnbondingDelegation.Proto): UnbondingDelegation;
|
|
27
|
+
}
|
|
28
|
+
export declare namespace UnbondingDelegation {
|
|
29
|
+
interface Amino {
|
|
30
|
+
delegator_address: AccAddress;
|
|
31
|
+
validator_address: ValAddress;
|
|
32
|
+
entries: UnbondingDelegation.Entry.Amino[];
|
|
33
|
+
}
|
|
34
|
+
interface Data {
|
|
35
|
+
delegator_address: AccAddress;
|
|
36
|
+
validator_address: ValAddress;
|
|
37
|
+
entries: UnbondingDelegation.Entry.Data[];
|
|
38
|
+
}
|
|
39
|
+
type Proto = UnbondingDelegation_pb;
|
|
40
|
+
class Entry extends JSONSerializable<Entry.Amino, Entry.Data, Entry.Proto> {
|
|
41
|
+
creation_height: number;
|
|
42
|
+
completion_time: Date;
|
|
43
|
+
initial_balance: Coins;
|
|
44
|
+
balance: Coins;
|
|
45
|
+
/**
|
|
46
|
+
* Note that the size of the undelegation is `initial_balance - balance`
|
|
47
|
+
* @param initial_balance balance of delegation prior to initiating unbond
|
|
48
|
+
* @param balance balance of delegation after initiating unbond
|
|
49
|
+
* @param creation_height height of blockchain when entry was created
|
|
50
|
+
* @param completion_time time when unbonding will be completed
|
|
51
|
+
*/
|
|
52
|
+
constructor(initial_balance: Coins.Input, balance: Coins.Input, creation_height: number, completion_time: Date);
|
|
53
|
+
toAmino(): Entry.Amino;
|
|
54
|
+
static fromAmino(data: Entry.Amino): Entry;
|
|
55
|
+
toData(): Entry.Data;
|
|
56
|
+
static fromData(data: Entry.Data): Entry;
|
|
57
|
+
toProto(): Entry.Proto;
|
|
58
|
+
static fromProto(proto: Entry.Proto): Entry;
|
|
59
|
+
}
|
|
60
|
+
namespace Entry {
|
|
61
|
+
interface Amino {
|
|
62
|
+
initial_balance: Coins.Amino;
|
|
63
|
+
balance: Coins.Amino;
|
|
64
|
+
creation_height: string;
|
|
65
|
+
completion_time: string;
|
|
66
|
+
}
|
|
67
|
+
interface Data {
|
|
68
|
+
initial_balance: Coins.Data;
|
|
69
|
+
balance: Coins.Data;
|
|
70
|
+
creation_height: string;
|
|
71
|
+
completion_time: string;
|
|
72
|
+
}
|
|
73
|
+
type Proto = UnbondingDelegationEntry_pb;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.UnbondingDelegation = void 0;
|
|
22
|
+
var json_1 = require("../../util/json");
|
|
23
|
+
var Coins_1 = require("../Coins");
|
|
24
|
+
var staking_1 = require("@initia/initia.proto/initia/mstaking/v1/staking");
|
|
25
|
+
var long_1 = __importDefault(require("long"));
|
|
26
|
+
/**
|
|
27
|
+
* When a delegator decides to take out their funds from the mstaking pool, they must
|
|
28
|
+
* unbond their tokens which takes an amount of time specified by `unbonding_time`
|
|
29
|
+
* parameter in the mstaking module.
|
|
30
|
+
*
|
|
31
|
+
* An unbonding delegation is implemented through creating [[UnbondingDelegation.Entry]]
|
|
32
|
+
* objects, limited by the max_entry parameter in the mstaking module params. You cannot
|
|
33
|
+
* initiate unbonds more times than the amount of entries permitted. Entries are cleared
|
|
34
|
+
* when their unbonding periods are completed and the funds are returned to the
|
|
35
|
+
* delegator's account balance to be spent freely.
|
|
36
|
+
*/
|
|
37
|
+
var UnbondingDelegation = /** @class */ (function (_super) {
|
|
38
|
+
__extends(UnbondingDelegation, _super);
|
|
39
|
+
function UnbondingDelegation(delegator_address, validator_address, entries) {
|
|
40
|
+
var _this = _super.call(this) || this;
|
|
41
|
+
_this.delegator_address = delegator_address;
|
|
42
|
+
_this.validator_address = validator_address;
|
|
43
|
+
_this.entries = entries;
|
|
44
|
+
return _this;
|
|
45
|
+
}
|
|
46
|
+
UnbondingDelegation.fromAmino = function (data) {
|
|
47
|
+
var delegator_address = data.delegator_address, validator_address = data.validator_address, entries = data.entries;
|
|
48
|
+
return new UnbondingDelegation(delegator_address, validator_address, entries.map(function (e) { return UnbondingDelegation.Entry.fromAmino(e); }));
|
|
49
|
+
};
|
|
50
|
+
UnbondingDelegation.prototype.toAmino = function () {
|
|
51
|
+
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, entries = _a.entries;
|
|
52
|
+
return {
|
|
53
|
+
delegator_address: delegator_address,
|
|
54
|
+
validator_address: validator_address,
|
|
55
|
+
entries: entries.map(function (e) { return e.toAmino(); }),
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
UnbondingDelegation.fromData = function (data) {
|
|
59
|
+
var delegator_address = data.delegator_address, validator_address = data.validator_address, entries = data.entries;
|
|
60
|
+
return new UnbondingDelegation(delegator_address, validator_address, entries.map(function (e) { return UnbondingDelegation.Entry.fromData(e); }));
|
|
61
|
+
};
|
|
62
|
+
UnbondingDelegation.prototype.toData = function () {
|
|
63
|
+
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, entries = _a.entries;
|
|
64
|
+
return {
|
|
65
|
+
delegator_address: delegator_address,
|
|
66
|
+
validator_address: validator_address,
|
|
67
|
+
entries: entries.map(function (e) { return e.toData(); }),
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
UnbondingDelegation.prototype.toProto = function () {
|
|
71
|
+
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, entries = _a.entries;
|
|
72
|
+
return staking_1.UnbondingDelegation.fromPartial({
|
|
73
|
+
delegatorAddress: delegator_address,
|
|
74
|
+
entries: entries.map(function (e) { return e.toProto(); }),
|
|
75
|
+
validatorAddress: validator_address,
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
UnbondingDelegation.fromProto = function (proto) {
|
|
79
|
+
return new UnbondingDelegation(proto.delegatorAddress, proto.validatorAddress, proto.entries.map(function (e) { return UnbondingDelegation.Entry.fromProto(e); }));
|
|
80
|
+
};
|
|
81
|
+
return UnbondingDelegation;
|
|
82
|
+
}(json_1.JSONSerializable));
|
|
83
|
+
exports.UnbondingDelegation = UnbondingDelegation;
|
|
84
|
+
(function (UnbondingDelegation) {
|
|
85
|
+
var Entry = /** @class */ (function (_super) {
|
|
86
|
+
__extends(Entry, _super);
|
|
87
|
+
/**
|
|
88
|
+
* Note that the size of the undelegation is `initial_balance - balance`
|
|
89
|
+
* @param initial_balance balance of delegation prior to initiating unbond
|
|
90
|
+
* @param balance balance of delegation after initiating unbond
|
|
91
|
+
* @param creation_height height of blockchain when entry was created
|
|
92
|
+
* @param completion_time time when unbonding will be completed
|
|
93
|
+
*/
|
|
94
|
+
function Entry(initial_balance, balance, creation_height, completion_time) {
|
|
95
|
+
var _this = _super.call(this) || this;
|
|
96
|
+
_this.creation_height = creation_height;
|
|
97
|
+
_this.completion_time = completion_time;
|
|
98
|
+
_this.initial_balance = new Coins_1.Coins(initial_balance);
|
|
99
|
+
_this.balance = new Coins_1.Coins(balance);
|
|
100
|
+
return _this;
|
|
101
|
+
}
|
|
102
|
+
Entry.prototype.toAmino = function () {
|
|
103
|
+
return {
|
|
104
|
+
initial_balance: this.initial_balance.toAmino(),
|
|
105
|
+
balance: this.balance.toAmino(),
|
|
106
|
+
creation_height: this.creation_height.toFixed(),
|
|
107
|
+
completion_time: this.completion_time.toISOString(),
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
Entry.fromAmino = function (data) {
|
|
111
|
+
var initial_balance = data.initial_balance, balance = data.balance, creation_height = data.creation_height, completion_time = data.completion_time;
|
|
112
|
+
return new Entry(Coins_1.Coins.fromAmino(initial_balance), Coins_1.Coins.fromAmino(balance), Number.parseInt(creation_height), new Date(completion_time));
|
|
113
|
+
};
|
|
114
|
+
Entry.prototype.toData = function () {
|
|
115
|
+
return {
|
|
116
|
+
initial_balance: this.initial_balance.toData(),
|
|
117
|
+
balance: this.balance.toData(),
|
|
118
|
+
creation_height: this.creation_height.toFixed(),
|
|
119
|
+
completion_time: this.completion_time.toISOString(),
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
Entry.fromData = function (data) {
|
|
123
|
+
var initial_balance = data.initial_balance, balance = data.balance, creation_height = data.creation_height, completion_time = data.completion_time;
|
|
124
|
+
return new Entry(Coins_1.Coins.fromData(initial_balance), Coins_1.Coins.fromData(balance), Number.parseInt(creation_height), new Date(completion_time));
|
|
125
|
+
};
|
|
126
|
+
Entry.prototype.toProto = function () {
|
|
127
|
+
var _a = this, initial_balance = _a.initial_balance, balance = _a.balance, creation_height = _a.creation_height, completion_time = _a.completion_time;
|
|
128
|
+
return staking_1.UnbondingDelegationEntry.fromPartial({
|
|
129
|
+
balance: balance.toProto(),
|
|
130
|
+
completionTime: completion_time,
|
|
131
|
+
creationHeight: long_1.default.fromNumber(creation_height),
|
|
132
|
+
initialBalance: initial_balance.toProto(),
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
Entry.fromProto = function (proto) {
|
|
136
|
+
return new Entry(Coins_1.Coins.fromProto(proto.initialBalance), Coins_1.Coins.fromProto(proto.balance), proto.creationHeight.toNumber(), proto.completionTime);
|
|
137
|
+
};
|
|
138
|
+
return Entry;
|
|
139
|
+
}(json_1.JSONSerializable));
|
|
140
|
+
UnbondingDelegation.Entry = Entry;
|
|
141
|
+
})(UnbondingDelegation = exports.UnbondingDelegation || (exports.UnbondingDelegation = {}));
|
|
142
|
+
exports.UnbondingDelegation = UnbondingDelegation;
|
|
143
|
+
//# sourceMappingURL=UnbondingDelegation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UnbondingDelegation.js","sourceRoot":"","sources":["../../../src/core/mstaking/UnbondingDelegation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,wCAAmD;AACnD,kCAAiC;AAEjC,2EAGyD;AACzD,8CAAwB;AAExB;;;;;;;;;;GAUG;AACH;IAAyC,uCAIxC;IACC,6BACS,iBAA6B,EAC7B,iBA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AC,eAAe,CAAC,EAC/B,aAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EACvB,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,EAChC,IAAI,IAAI,CAAC,eAAe,CAAC,CAC1B,CAAC;QACJ,CAAC;QAEM,uBAAO,GAAd;YACQ,IAAA,KACJ,IAAI,EADE,eAAe,qBAAA,EAAE,OAAO,aAAA,EAAE,eAAe,qBAAA,EAAE,eAAe,qBAC5D,CAAC;YACP,OAAO,kCAA2B,CAAC,WAAW,CAAC;gBAC7C,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;gBAC1B,cAAc,EAAE,eAAe;gBAC/B,cAAc,EAAE,cAAI,CAAC,UAAU,CAAC,eAAe,CAAC;gBAChD,cAAc,EAAE,eAAe,CAAC,OAAO,EAAE;aAC1C,CAAC,CAAC;QACL,CAAC;QAEa,eAAS,GAAvB,UAAwB,KAAkB;YACxC,OAAO,IAAI,KAAK,CACd,aAAK,CAAC,SAAS,CAAC,KAAK,CAAC,cAAc,CAAC,EACrC,aAAK,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAC9B,KAAK,CAAC,cAAc,CAAC,QAAQ,EAAE,EAC/B,KAAK,CAAC,cAAsB,CAC7B,CAAC;QACJ,CAAC;QACH,YAAC;IAAD,CAAC,AArFD,CAA2B,uBAAgB,GAqF1C;IArFY,yBAAK,QAqFjB,CAAA;AAmBH,CAAC,EAvHgB,mBAAmB,GAAnB,2BAAmB,KAAnB,2BAAmB,QAuHnC;AA9LY,kDAAmB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { JSONSerializable } from '../../util/json';
|
|
2
|
+
import { Coins } from '../Coins';
|
|
3
|
+
import { ValAddress } from '../bech32';
|
|
4
|
+
import { ValConsPublicKey } from '../PublicKey';
|
|
5
|
+
import { Validator as Validator_pb, Description as Description_pb, Commission as Commission_pb, CommissionRates as CommissionRates_pb, BondStatus } from '@initia/initia.proto/initia/mstaking/v1/staking';
|
|
6
|
+
/**
|
|
7
|
+
* Stores information fetched from the blockchain about the current status of a validator.
|
|
8
|
+
* As an end user, you will not have to create an instance of this class, one will be
|
|
9
|
+
* generated for you to store information about a validator polled from the API functions
|
|
10
|
+
* in [[MstakingAPI]].
|
|
11
|
+
*/
|
|
12
|
+
export declare class Validator extends JSONSerializable<Validator.Amino, Validator.Data, Validator.Proto> {
|
|
13
|
+
operator_address: ValAddress;
|
|
14
|
+
consensus_pubkey: ValConsPublicKey;
|
|
15
|
+
jailed: boolean;
|
|
16
|
+
status: BondStatus;
|
|
17
|
+
description: Validator.Description;
|
|
18
|
+
unbonding_height: number;
|
|
19
|
+
unbonding_time: Date;
|
|
20
|
+
commission: Validator.Commission;
|
|
21
|
+
voting_power: string;
|
|
22
|
+
tokens: Coins;
|
|
23
|
+
delegator_shares: Coins;
|
|
24
|
+
voting_powers: Coins;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* @param operator_address validator's operator address
|
|
28
|
+
* @param consensus_pubkey validator's consensus public key
|
|
29
|
+
* @param jailed whether the current validator is jailed
|
|
30
|
+
* @param status unbonded `0`, unbonding `1`, bonded `2`
|
|
31
|
+
* @param tokens total Initia from all delegations (including self)
|
|
32
|
+
* @param delegator_shares total shares of all delegators
|
|
33
|
+
* @param description validator's delegate description
|
|
34
|
+
* @param unbonding_height if unbonding, height at which this validator began unbonding
|
|
35
|
+
* @param unbonding_time if unbonding, min time for the validator to complete unbonding
|
|
36
|
+
* @param commission validator commission
|
|
37
|
+
* @param min_self_delegation minimum self delegation
|
|
38
|
+
*/
|
|
39
|
+
constructor(operator_address: ValAddress, consensus_pubkey: ValConsPublicKey, jailed: boolean, status: BondStatus, tokens: Coins.Input, delegator_shares: Coins.Input, description: Validator.Description, unbonding_height: number, unbonding_time: Date, commission: Validator.Commission, voting_powers: Coins.Input, voting_power: string);
|
|
40
|
+
toAmino(): Validator.Amino;
|
|
41
|
+
static fromAmino(data: Validator.Amino): Validator;
|
|
42
|
+
toData(): Validator.Data;
|
|
43
|
+
static fromData(data: Validator.Data): Validator;
|
|
44
|
+
toProto(): Validator.Proto;
|
|
45
|
+
static fromProto(data: Validator.Proto): Validator;
|
|
46
|
+
}
|
|
47
|
+
export declare namespace Validator {
|
|
48
|
+
const Status: typeof BondStatus;
|
|
49
|
+
type Status = BondStatus;
|
|
50
|
+
interface Amino {
|
|
51
|
+
operator_address: ValAddress;
|
|
52
|
+
consensus_pubkey: ValConsPublicKey.Amino;
|
|
53
|
+
jailed: boolean;
|
|
54
|
+
status: BondStatus;
|
|
55
|
+
tokens: Coins.Amino;
|
|
56
|
+
delegator_shares: Coins.Amino;
|
|
57
|
+
description: Description.Amino;
|
|
58
|
+
unbonding_height: string;
|
|
59
|
+
unbonding_time: string;
|
|
60
|
+
commission: Commission.Amino;
|
|
61
|
+
voting_powers: Coins.Amino;
|
|
62
|
+
voting_power: string;
|
|
63
|
+
}
|
|
64
|
+
interface Data {
|
|
65
|
+
operator_address: ValAddress;
|
|
66
|
+
consensus_pubkey: ValConsPublicKey.Data;
|
|
67
|
+
jailed: boolean;
|
|
68
|
+
status: BondStatus;
|
|
69
|
+
tokens: Coins.Data;
|
|
70
|
+
delegator_shares: Coins.Data;
|
|
71
|
+
description: Description.Data;
|
|
72
|
+
unbonding_height: string;
|
|
73
|
+
unbonding_time: string;
|
|
74
|
+
commission: Commission.Data;
|
|
75
|
+
voting_powers: Coins.Data;
|
|
76
|
+
voting_power: string;
|
|
77
|
+
}
|
|
78
|
+
type Proto = Validator_pb;
|
|
79
|
+
class Description extends JSONSerializable<Description.Amino, Description.Data, Description.Proto> {
|
|
80
|
+
moniker: string;
|
|
81
|
+
identity: string;
|
|
82
|
+
website: string;
|
|
83
|
+
details: string;
|
|
84
|
+
security_contact: string;
|
|
85
|
+
/**
|
|
86
|
+
* @param moniker Identifying name, e.g. "Hashed"
|
|
87
|
+
* @param identity time at which commission was last updated
|
|
88
|
+
* @param website validator's website
|
|
89
|
+
* @param details long description
|
|
90
|
+
* @param security_contact validator's contact
|
|
91
|
+
*/
|
|
92
|
+
constructor(moniker: string, identity: string, website: string, details: string, security_contact: string);
|
|
93
|
+
toAmino(): Description.Amino;
|
|
94
|
+
static fromAmino(data: Description.Amino): Description;
|
|
95
|
+
toData(): Description.Data;
|
|
96
|
+
static fromData(data: Description.Data): Description;
|
|
97
|
+
toProto(): Description.Proto;
|
|
98
|
+
static fromProto(proto: Description.Proto): Description;
|
|
99
|
+
}
|
|
100
|
+
namespace Description {
|
|
101
|
+
interface Amino {
|
|
102
|
+
moniker: string;
|
|
103
|
+
identity: string;
|
|
104
|
+
website: string;
|
|
105
|
+
details: string;
|
|
106
|
+
security_contact: string;
|
|
107
|
+
}
|
|
108
|
+
interface Data {
|
|
109
|
+
moniker: string;
|
|
110
|
+
identity: string;
|
|
111
|
+
website: string;
|
|
112
|
+
details: string;
|
|
113
|
+
security_contact: string;
|
|
114
|
+
}
|
|
115
|
+
type Proto = Description_pb;
|
|
116
|
+
}
|
|
117
|
+
class CommissionRates extends JSONSerializable<CommissionRates.Amino, CommissionRates.Data, CommissionRates.Proto> {
|
|
118
|
+
rate: string;
|
|
119
|
+
max_rate: string;
|
|
120
|
+
max_change_rate: string;
|
|
121
|
+
/**
|
|
122
|
+
* @param rate current commission rate
|
|
123
|
+
* @param max_rate max commission rate
|
|
124
|
+
* @param max_change_rate max percentage commission can change in 24hrs
|
|
125
|
+
*/
|
|
126
|
+
constructor(rate: string, max_rate: string, max_change_rate: string);
|
|
127
|
+
static fromAmino(data: CommissionRates.Amino): CommissionRates;
|
|
128
|
+
toAmino(): Validator.CommissionRates.Amino;
|
|
129
|
+
static fromData(data: CommissionRates.Data): CommissionRates;
|
|
130
|
+
toData(): Validator.CommissionRates.Data;
|
|
131
|
+
static fromProto(proto: CommissionRates.Proto): CommissionRates;
|
|
132
|
+
toProto(): Validator.CommissionRates.Proto;
|
|
133
|
+
}
|
|
134
|
+
namespace CommissionRates {
|
|
135
|
+
interface Amino {
|
|
136
|
+
rate: string;
|
|
137
|
+
max_rate: string;
|
|
138
|
+
max_change_rate: string;
|
|
139
|
+
}
|
|
140
|
+
interface Data {
|
|
141
|
+
rate: string;
|
|
142
|
+
max_rate: string;
|
|
143
|
+
max_change_rate: string;
|
|
144
|
+
}
|
|
145
|
+
type Proto = CommissionRates_pb;
|
|
146
|
+
}
|
|
147
|
+
class Commission extends JSONSerializable<Commission.Amino, Commission.Data, Commission.Proto> {
|
|
148
|
+
commission_rates: CommissionRates;
|
|
149
|
+
update_time: Date;
|
|
150
|
+
/**
|
|
151
|
+
* @param commission_rates commission rates
|
|
152
|
+
* @param update_time time at which commission was last updated
|
|
153
|
+
*/
|
|
154
|
+
constructor(commission_rates: CommissionRates, update_time: Date);
|
|
155
|
+
toAmino(): Commission.Amino;
|
|
156
|
+
static fromAmino(data: Commission.Amino): Commission;
|
|
157
|
+
toData(): Commission.Data;
|
|
158
|
+
static fromData(data: Commission.Data): Commission;
|
|
159
|
+
toProto(): Commission.Proto;
|
|
160
|
+
static fromProto(proto: Commission.Proto): Commission;
|
|
161
|
+
}
|
|
162
|
+
namespace Commission {
|
|
163
|
+
interface Amino {
|
|
164
|
+
commission_rates: CommissionRates.Amino;
|
|
165
|
+
update_time: string;
|
|
166
|
+
}
|
|
167
|
+
interface Data {
|
|
168
|
+
commission_rates: CommissionRates.Data;
|
|
169
|
+
update_time: string;
|
|
170
|
+
}
|
|
171
|
+
type Proto = Commission_pb;
|
|
172
|
+
}
|
|
173
|
+
}
|