@initia/initia.js 0.0.21 → 0.0.23
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/LocalInitia.js +1 -4
- package/dist/client/LocalInitia.js.map +1 -1
- package/dist/client/lcd/LCDClient.d.ts +6 -10
- package/dist/client/lcd/LCDClient.js +8 -8
- package/dist/client/lcd/LCDClient.js.map +1 -1
- package/dist/client/lcd/Wallet.js +4 -1
- package/dist/client/lcd/Wallet.js.map +1 -1
- package/dist/client/lcd/api/AuthAPI.d.ts +2 -1
- package/dist/client/lcd/api/AuthAPI.js +15 -0
- package/dist/client/lcd/api/AuthAPI.js.map +1 -1
- package/dist/client/lcd/api/StakingAPI.d.ts +10 -8
- package/dist/client/lcd/api/StakingAPI.js +16 -15
- package/dist/client/lcd/api/StakingAPI.js.map +1 -1
- package/dist/core/Msg.js +10 -22
- package/dist/core/Msg.js.map +1 -1
- package/dist/core/auth/Account.d.ts +4 -3
- package/dist/core/auth/Account.js +8 -0
- package/dist/core/auth/Account.js.map +1 -1
- package/dist/core/auth/ModuleAccount.d.ts +48 -0
- package/dist/core/auth/ModuleAccount.js +115 -0
- package/dist/core/auth/ModuleAccount.js.map +1 -0
- package/dist/core/auth/index.d.ts +1 -0
- package/dist/core/auth/index.js +1 -0
- package/dist/core/auth/index.js.map +1 -1
- package/dist/core/authz/authorizations/Authorization.js +2 -2
- package/dist/core/authz/authorizations/Authorization.js.map +1 -1
- package/dist/core/authz/authorizations/StakeAuthorization.d.ts +6 -6
- package/dist/core/authz/authorizations/StakeAuthorization.js +7 -7
- package/dist/core/authz/authorizations/StakeAuthorization.js.map +1 -1
- package/dist/core/staking/Delegation.d.ts +9 -9
- package/dist/core/staking/Delegation.js +10 -12
- package/dist/core/staking/Delegation.js.map +1 -1
- package/dist/core/staking/Redelegation.d.ts +12 -11
- package/dist/core/staking/Redelegation.js +17 -20
- package/dist/core/staking/Redelegation.js.map +1 -1
- package/dist/core/staking/UnbondingDelegation.d.ts +9 -8
- package/dist/core/staking/UnbondingDelegation.js +13 -15
- package/dist/core/staking/UnbondingDelegation.js.map +1 -1
- package/dist/core/staking/Validator.d.ts +15 -11
- package/dist/core/staking/Validator.js +26 -22
- package/dist/core/staking/Validator.js.map +1 -1
- package/dist/core/staking/msgs/MsgBeginRedelegate.d.ts +8 -8
- package/dist/core/staking/msgs/MsgBeginRedelegate.js +9 -9
- package/dist/core/staking/msgs/MsgBeginRedelegate.js.map +1 -1
- package/dist/core/staking/msgs/MsgCreateValidator.d.ts +8 -12
- package/dist/core/staking/msgs/MsgCreateValidator.js +18 -25
- package/dist/core/staking/msgs/MsgCreateValidator.js.map +1 -1
- package/dist/core/staking/msgs/MsgDelegate.d.ts +8 -8
- package/dist/core/staking/msgs/MsgDelegate.js +9 -9
- package/dist/core/staking/msgs/MsgDelegate.js.map +1 -1
- package/dist/core/staking/msgs/MsgEditValidator.d.ts +5 -9
- package/dist/core/staking/msgs/MsgEditValidator.js +14 -29
- package/dist/core/staking/msgs/MsgEditValidator.js.map +1 -1
- package/dist/core/staking/msgs/MsgUndelegate.d.ts +8 -8
- package/dist/core/staking/msgs/MsgUndelegate.js +9 -9
- package/dist/core/staking/msgs/MsgUndelegate.js.map +1 -1
- package/dist/core/vesting/msgs/index.d.ts +4 -8
- package/dist/core/vesting/msgs/index.js +0 -2
- package/dist/core/vesting/msgs/index.js.map +1 -1
- package/dist/key/Key.d.ts +1 -1
- package/dist/key/Key.js +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { JSONSerializable } from '../../util/json';
|
|
2
|
+
import { PublicKey } from '../PublicKey';
|
|
3
|
+
import { BaseAccount } from './BaseAccount';
|
|
4
|
+
import { ModuleAccount as ModuleAccount_pb } from '@initia/initia.proto/cosmos/auth/v1beta1/auth';
|
|
5
|
+
import { Any } from '@initia/initia.proto/google/protobuf/any';
|
|
6
|
+
/**
|
|
7
|
+
* Stores information about an account for modules that holds coins on a pool.
|
|
8
|
+
*/
|
|
9
|
+
export declare class ModuleAccount extends JSONSerializable<ModuleAccount.Amino, ModuleAccount.Data, ModuleAccount.Proto> {
|
|
10
|
+
base_account: BaseAccount;
|
|
11
|
+
name: string;
|
|
12
|
+
permissions: string[];
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param base_account account information
|
|
16
|
+
* @param name account's name
|
|
17
|
+
* @param permissions account's permissions
|
|
18
|
+
*/
|
|
19
|
+
constructor(base_account: BaseAccount, name: string, permissions: string[]);
|
|
20
|
+
getAccountNumber(): number;
|
|
21
|
+
getSequenceNumber(): number;
|
|
22
|
+
getPublicKey(): PublicKey | null;
|
|
23
|
+
static fromAmino(data: ModuleAccount.Amino): ModuleAccount;
|
|
24
|
+
toAmino(): ModuleAccount.Amino;
|
|
25
|
+
static fromData(data: ModuleAccount.Data): ModuleAccount;
|
|
26
|
+
toData(): ModuleAccount.Data;
|
|
27
|
+
static fromProto(proto: ModuleAccount.Proto): ModuleAccount;
|
|
28
|
+
toProto(): ModuleAccount.Proto;
|
|
29
|
+
packAny(): Any;
|
|
30
|
+
static unpackAny(pubkeyAny: Any): ModuleAccount;
|
|
31
|
+
}
|
|
32
|
+
export declare namespace ModuleAccount {
|
|
33
|
+
interface Amino {
|
|
34
|
+
type: 'cosmos-sdk/ModuleAccount';
|
|
35
|
+
value: {
|
|
36
|
+
base_account: BaseAccount.AminoValue;
|
|
37
|
+
name: string;
|
|
38
|
+
permissions: string[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
interface Data {
|
|
42
|
+
'@type': '/cosmos.auth.v1beta1.ModuleAccount';
|
|
43
|
+
base_account: BaseAccount.DataValue;
|
|
44
|
+
name: string;
|
|
45
|
+
permissions: string[];
|
|
46
|
+
}
|
|
47
|
+
type Proto = ModuleAccount_pb;
|
|
48
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ModuleAccount = void 0;
|
|
30
|
+
var json_1 = require("../../util/json");
|
|
31
|
+
var BaseAccount_1 = require("./BaseAccount");
|
|
32
|
+
var auth_1 = require("@initia/initia.proto/cosmos/auth/v1beta1/auth");
|
|
33
|
+
var any_1 = require("@initia/initia.proto/google/protobuf/any");
|
|
34
|
+
/**
|
|
35
|
+
* Stores information about an account for modules that holds coins on a pool.
|
|
36
|
+
*/
|
|
37
|
+
var ModuleAccount = /** @class */ (function (_super) {
|
|
38
|
+
__extends(ModuleAccount, _super);
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param base_account account information
|
|
42
|
+
* @param name account's name
|
|
43
|
+
* @param permissions account's permissions
|
|
44
|
+
*/
|
|
45
|
+
function ModuleAccount(base_account, name, permissions) {
|
|
46
|
+
var _this = _super.call(this) || this;
|
|
47
|
+
_this.base_account = base_account;
|
|
48
|
+
_this.name = name;
|
|
49
|
+
_this.permissions = permissions;
|
|
50
|
+
return _this;
|
|
51
|
+
}
|
|
52
|
+
ModuleAccount.prototype.getAccountNumber = function () {
|
|
53
|
+
return this.base_account.account_number;
|
|
54
|
+
};
|
|
55
|
+
ModuleAccount.prototype.getSequenceNumber = function () {
|
|
56
|
+
return this.base_account.sequence;
|
|
57
|
+
};
|
|
58
|
+
ModuleAccount.prototype.getPublicKey = function () {
|
|
59
|
+
return this.base_account.public_key;
|
|
60
|
+
};
|
|
61
|
+
ModuleAccount.fromAmino = function (data) {
|
|
62
|
+
var _a = data.value, base_account = _a.base_account, name = _a.name, permissions = _a.permissions;
|
|
63
|
+
return new ModuleAccount(BaseAccount_1.BaseAccount.fromAmino({
|
|
64
|
+
type: 'cosmos-sdk/BaseAccount',
|
|
65
|
+
value: base_account,
|
|
66
|
+
}), name, permissions);
|
|
67
|
+
};
|
|
68
|
+
ModuleAccount.prototype.toAmino = function () {
|
|
69
|
+
var _a = this, base_account = _a.base_account, name = _a.name, permissions = _a.permissions;
|
|
70
|
+
return {
|
|
71
|
+
type: 'cosmos-sdk/ModuleAccount',
|
|
72
|
+
value: {
|
|
73
|
+
base_account: base_account.toAmino().value,
|
|
74
|
+
name: name,
|
|
75
|
+
permissions: permissions,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
ModuleAccount.fromData = function (data) {
|
|
80
|
+
var base_account = data.base_account, name = data.name, permissions = data.permissions;
|
|
81
|
+
return new ModuleAccount(BaseAccount_1.BaseAccount.fromData(__assign({ '@type': '/cosmos.auth.v1beta1.BaseAccount' }, base_account)), name, permissions);
|
|
82
|
+
};
|
|
83
|
+
ModuleAccount.prototype.toData = function () {
|
|
84
|
+
var _a = this, base_account = _a.base_account, name = _a.name, permissions = _a.permissions;
|
|
85
|
+
return {
|
|
86
|
+
'@type': '/cosmos.auth.v1beta1.ModuleAccount',
|
|
87
|
+
base_account: base_account.toData(),
|
|
88
|
+
name: name,
|
|
89
|
+
permissions: permissions,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
ModuleAccount.fromProto = function (proto) {
|
|
93
|
+
return new ModuleAccount(BaseAccount_1.BaseAccount.fromProto(proto.baseAccount), proto.name, proto.permissions);
|
|
94
|
+
};
|
|
95
|
+
ModuleAccount.prototype.toProto = function () {
|
|
96
|
+
var _a = this, base_account = _a.base_account, name = _a.name, permissions = _a.permissions;
|
|
97
|
+
return auth_1.ModuleAccount.fromPartial({
|
|
98
|
+
baseAccount: base_account.toProto(),
|
|
99
|
+
name: name,
|
|
100
|
+
permissions: permissions,
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
ModuleAccount.prototype.packAny = function () {
|
|
104
|
+
return any_1.Any.fromPartial({
|
|
105
|
+
typeUrl: '/cosmos.auth.v1beta1.ModuleAccount',
|
|
106
|
+
value: auth_1.ModuleAccount.encode(this.toProto()).finish(),
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
ModuleAccount.unpackAny = function (pubkeyAny) {
|
|
110
|
+
return ModuleAccount.fromProto(auth_1.ModuleAccount.decode(pubkeyAny.value));
|
|
111
|
+
};
|
|
112
|
+
return ModuleAccount;
|
|
113
|
+
}(json_1.JSONSerializable));
|
|
114
|
+
exports.ModuleAccount = ModuleAccount;
|
|
115
|
+
//# sourceMappingURL=ModuleAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModuleAccount.js","sourceRoot":"","sources":["../../../src/core/auth/ModuleAccount.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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,CAAC,AA5GD,CAAmC,uBAAgB,GA4GlD;AA5GY,sCAAa"}
|
package/dist/core/auth/index.js
CHANGED
|
@@ -20,4 +20,5 @@ __exportStar(require("./BaseVestingAccount"), exports);
|
|
|
20
20
|
__exportStar(require("./ContinuousVestingAccount"), exports);
|
|
21
21
|
__exportStar(require("./DelayedVestingAccount"), exports);
|
|
22
22
|
__exportStar(require("./PeriodicVestingAccount"), exports);
|
|
23
|
+
__exportStar(require("./ModuleAccount"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,gDAA8B;AAC9B,uDAAqC;AACrC,6DAA2C;AAC3C,0DAAwC;AACxC,2DAAyC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/auth/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,gDAA8B;AAC9B,uDAAqC;AACrC,6DAA2C;AAC3C,0DAAwC;AACxC,2DAAyC;AACzC,kDAAgC"}
|
|
@@ -81,7 +81,7 @@ var Authorization;
|
|
|
81
81
|
return GenericAuthorization_1.GenericAuthorization.fromData(data);
|
|
82
82
|
case '/cosmos.bank.v1beta1.SendAuthorization':
|
|
83
83
|
return SendAuthorization_1.SendAuthorization.fromData(data);
|
|
84
|
-
case '/
|
|
84
|
+
case '/initia.mstaking.v1.StakeAuthorization':
|
|
85
85
|
return StakeAuthorization_1.StakeAuthorization.fromData(data);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -93,7 +93,7 @@ var Authorization;
|
|
|
93
93
|
return GenericAuthorization_1.GenericAuthorization.unpackAny(proto);
|
|
94
94
|
case '/cosmos.bank.v1beta1.SendAuthorization':
|
|
95
95
|
return SendAuthorization_1.SendAuthorization.unpackAny(proto);
|
|
96
|
-
case '/
|
|
96
|
+
case '/initia.mstaking.v1.StakeAuthorization':
|
|
97
97
|
return StakeAuthorization_1.StakeAuthorization.unpackAny(proto);
|
|
98
98
|
}
|
|
99
99
|
throw new Error("Authorization type ".concat(typeUrl, " not recognized"));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Authorization.js","sourceRoot":"","sources":["../../../../src/core/authz/authorizations/Authorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAsD;AACtD,+DAA8D;AAC9D,yDAAwD;AACxD,2DAA0D;AAE1D,yEAAoF;AAEpF;IAAwC,sCAIvC;IACC,4BAAmB,aAA4B,EAAS,UAAgB;QAAxE,YACE,iBAAO,SACR;QAFkB,mBAAa,GAAb,aAAa,CAAe;QAAS,gBAAU,GAAV,UAAU,CAAM;;IAExE,CAAC;IAEa,4BAAS,GAAvB,UAAwB,KAA+B;QAC7C,IAAA,aAAa,GAAiB,KAAK,cAAtB,EAAE,UAAU,GAAK,KAAK,WAAV,CAAW;QAC5C,OAAO,IAAI,kBAAkB,CAC3B,aAAa,CAAC,SAAS,CAAC,aAAa,CAAC,EACtC,IAAI,IAAI,CAAC,UAAU,CAAC,CACrB,CAAC;IACJ,CAAC;IAEM,oCAAO,GAAd;QACQ,IAAA,KAAgC,IAAI,EAAlC,aAAa,mBAAA,EAAE,UAAU,gBAAS,CAAC;QAC3C,OAAO;YACL,aAAa,EAAE,aAAa,CAAC,OAAO,EAAE;YACtC,UAAU,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SAC7D,CAAC;IACJ,CAAC;IAEa,2BAAQ,GAAtB,UAAuB,IAA6B;QAC1C,IAAA,aAAa,GAAiB,IAAI,cAArB,EAAE,UAAU,GAAK,IAAI,WAAT,CAAU;QAC3C,OAAO,IAAI,kBAAkB,CAC3B,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,EACrC,IAAI,IAAI,CAAC,UAAU,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A;AACH,CAAC,EAxCgB,aAAa,GAAb,qBAAa,KAAb,qBAAa,QAwC7B"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { JSONSerializable } from '../../../util/json';
|
|
2
|
-
import {
|
|
2
|
+
import { Coins } from '../../Coins';
|
|
3
3
|
import { AccAddress } from '../../bech32';
|
|
4
|
-
import { StakeAuthorization as StakeAuthorization_pb, AuthorizationType, StakeAuthorization_Validators as StakeAuthorizationValidators_pb } from '@initia/initia.proto/
|
|
4
|
+
import { StakeAuthorization as StakeAuthorization_pb, AuthorizationType, StakeAuthorization_Validators as StakeAuthorizationValidators_pb } from '@initia/initia.proto/initia/mstaking/v1/authz';
|
|
5
5
|
import { Any } from '@initia/initia.proto/google/protobuf/any';
|
|
6
6
|
export declare class StakeAuthorization extends JSONSerializable<any, StakeAuthorization.Data, StakeAuthorization.Proto> {
|
|
7
7
|
authorization_type: AuthorizationType;
|
|
8
|
-
max_tokens?: Coin | undefined;
|
|
9
8
|
allow_list?: StakeAuthorizationValidators | undefined;
|
|
10
9
|
deny_list?: StakeAuthorizationValidators | undefined;
|
|
11
|
-
|
|
10
|
+
max_tokens: Coins;
|
|
11
|
+
constructor(authorization_type: AuthorizationType, max_tokens: Coins.Input, allow_list?: StakeAuthorizationValidators | undefined, deny_list?: StakeAuthorizationValidators | undefined);
|
|
12
12
|
static fromAmino(_: any): StakeAuthorizationValidators;
|
|
13
13
|
toAmino(): any;
|
|
14
14
|
static fromData(data: StakeAuthorization.Data): StakeAuthorization;
|
|
@@ -38,8 +38,8 @@ export declare namespace StakeAuthorization {
|
|
|
38
38
|
type Type = AuthorizationType;
|
|
39
39
|
const Type: typeof AuthorizationType;
|
|
40
40
|
interface Data {
|
|
41
|
-
'@type': '/
|
|
42
|
-
max_tokens
|
|
41
|
+
'@type': '/initia.mstaking.v1.StakeAuthorization';
|
|
42
|
+
max_tokens: Coins.Data;
|
|
43
43
|
allow_list?: StakeAuthorizationValidators.Data;
|
|
44
44
|
deny_list?: StakeAuthorizationValidators.Data;
|
|
45
45
|
authorization_type: string;
|
|
@@ -17,17 +17,17 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.StakeAuthorizationValidators = exports.StakeAuthorization = void 0;
|
|
19
19
|
var json_1 = require("../../../util/json");
|
|
20
|
-
var
|
|
21
|
-
var authz_1 = require("@initia/initia.proto/
|
|
20
|
+
var Coins_1 = require("../../Coins");
|
|
21
|
+
var authz_1 = require("@initia/initia.proto/initia/mstaking/v1/authz");
|
|
22
22
|
var any_1 = require("@initia/initia.proto/google/protobuf/any");
|
|
23
23
|
var StakeAuthorization = /** @class */ (function (_super) {
|
|
24
24
|
__extends(StakeAuthorization, _super);
|
|
25
25
|
function StakeAuthorization(authorization_type, max_tokens, allow_list, deny_list) {
|
|
26
26
|
var _this = _super.call(this) || this;
|
|
27
27
|
_this.authorization_type = authorization_type;
|
|
28
|
-
_this.max_tokens = max_tokens;
|
|
29
28
|
_this.allow_list = allow_list;
|
|
30
29
|
_this.deny_list = deny_list;
|
|
30
|
+
_this.max_tokens = new Coins_1.Coins(max_tokens);
|
|
31
31
|
return _this;
|
|
32
32
|
}
|
|
33
33
|
StakeAuthorization.fromAmino = function (_) {
|
|
@@ -38,7 +38,7 @@ var StakeAuthorization = /** @class */ (function (_super) {
|
|
|
38
38
|
throw new Error('Amino not supported');
|
|
39
39
|
};
|
|
40
40
|
StakeAuthorization.fromData = function (data) {
|
|
41
|
-
return new StakeAuthorization((0, authz_1.authorizationTypeFromJSON)(data.authorization_type),
|
|
41
|
+
return new StakeAuthorization((0, authz_1.authorizationTypeFromJSON)(data.authorization_type), Coins_1.Coins.fromData(data.max_tokens), data.allow_list
|
|
42
42
|
? StakeAuthorizationValidators.fromData(data.allow_list)
|
|
43
43
|
: undefined, data.deny_list
|
|
44
44
|
? StakeAuthorizationValidators.fromData(data.deny_list)
|
|
@@ -47,7 +47,7 @@ var StakeAuthorization = /** @class */ (function (_super) {
|
|
|
47
47
|
StakeAuthorization.prototype.toData = function () {
|
|
48
48
|
var _a = this, max_tokens = _a.max_tokens, allow_list = _a.allow_list, deny_list = _a.deny_list, authorization_type = _a.authorization_type;
|
|
49
49
|
return {
|
|
50
|
-
'@type': '/
|
|
50
|
+
'@type': '/initia.mstaking.v1.StakeAuthorization',
|
|
51
51
|
authorization_type: (0, authz_1.authorizationTypeToJSON)(authorization_type),
|
|
52
52
|
max_tokens: max_tokens === null || max_tokens === void 0 ? void 0 : max_tokens.toData(),
|
|
53
53
|
allow_list: allow_list === null || allow_list === void 0 ? void 0 : allow_list.toData(),
|
|
@@ -55,7 +55,7 @@ var StakeAuthorization = /** @class */ (function (_super) {
|
|
|
55
55
|
};
|
|
56
56
|
};
|
|
57
57
|
StakeAuthorization.fromProto = function (proto) {
|
|
58
|
-
return new StakeAuthorization(proto.authorizationType,
|
|
58
|
+
return new StakeAuthorization(proto.authorizationType, Coins_1.Coins.fromProto(proto.maxTokens), proto.allowList
|
|
59
59
|
? StakeAuthorizationValidators.fromProto(proto.allowList)
|
|
60
60
|
: undefined, proto.denyList
|
|
61
61
|
? StakeAuthorizationValidators.fromProto(proto.denyList)
|
|
@@ -72,7 +72,7 @@ var StakeAuthorization = /** @class */ (function (_super) {
|
|
|
72
72
|
};
|
|
73
73
|
StakeAuthorization.prototype.packAny = function () {
|
|
74
74
|
return any_1.Any.fromPartial({
|
|
75
|
-
typeUrl: '/
|
|
75
|
+
typeUrl: '/initia.mstaking.v1.StakeAuthorization',
|
|
76
76
|
value: authz_1.StakeAuthorization.encode(this.toProto()).finish(),
|
|
77
77
|
});
|
|
78
78
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StakeAuthorization.js","sourceRoot":"","sources":["../../../../src/core/authz/authorizations/StakeAuthorization.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,2CAAsD;AACtD,
|
|
1
|
+
{"version":3,"file":"StakeAuthorization.js","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vJY,gDAAkB"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { JSONSerializable } from '../../util/json';
|
|
2
2
|
import { AccAddress, ValAddress } from '../bech32';
|
|
3
|
-
import {
|
|
4
|
-
import { DelegationResponse as DelegationResponse_pb } from '@initia/initia.proto/
|
|
3
|
+
import { Coins } from '../Coins';
|
|
4
|
+
import { DelegationResponse as DelegationResponse_pb } from '@initia/initia.proto/initia/mstaking/v1/staking';
|
|
5
5
|
/**
|
|
6
6
|
* Stores information about the status of a delegation between a delegator and validator, fetched from the blockchain.
|
|
7
7
|
*/
|
|
8
8
|
export declare class Delegation extends JSONSerializable<Delegation.Amino, Delegation.Data, Delegation.Proto> {
|
|
9
9
|
delegator_address: AccAddress;
|
|
10
10
|
validator_address: ValAddress;
|
|
11
|
-
shares:
|
|
12
|
-
balance:
|
|
11
|
+
shares: Coins;
|
|
12
|
+
balance: Coins;
|
|
13
13
|
/**
|
|
14
14
|
* @param delegator_address delegator's account address
|
|
15
15
|
* @param validator_address validator's operator address
|
|
16
16
|
* @param shares delegator's shares
|
|
17
17
|
* @param balance balance of the delegation
|
|
18
18
|
*/
|
|
19
|
-
constructor(delegator_address: AccAddress, validator_address: ValAddress, shares:
|
|
19
|
+
constructor(delegator_address: AccAddress, validator_address: ValAddress, shares: Coins.Input, balance: Coins.Input);
|
|
20
20
|
static fromAmino(data: Delegation.Amino): Delegation;
|
|
21
21
|
toAmino(): Delegation.Amino;
|
|
22
22
|
static fromData(data: Delegation.Data): Delegation;
|
|
@@ -29,17 +29,17 @@ export declare namespace Delegation {
|
|
|
29
29
|
delegation: {
|
|
30
30
|
delegator_address: AccAddress;
|
|
31
31
|
validator_address: ValAddress;
|
|
32
|
-
shares:
|
|
32
|
+
shares: Coins.Amino;
|
|
33
33
|
};
|
|
34
|
-
balance:
|
|
34
|
+
balance: Coins.Amino;
|
|
35
35
|
}
|
|
36
36
|
interface Data {
|
|
37
37
|
delegation: {
|
|
38
38
|
delegator_address: AccAddress;
|
|
39
39
|
validator_address: ValAddress;
|
|
40
|
-
shares:
|
|
40
|
+
shares: Coins.Data;
|
|
41
41
|
};
|
|
42
|
-
balance:
|
|
42
|
+
balance: Coins.Data;
|
|
43
43
|
}
|
|
44
44
|
type Proto = DelegationResponse_pb;
|
|
45
45
|
}
|
|
@@ -17,9 +17,8 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.Delegation = void 0;
|
|
19
19
|
var json_1 = require("../../util/json");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var staking_1 = require("@initia/initia.proto/cosmos/staking/v1beta1/staking");
|
|
20
|
+
var Coins_1 = require("../Coins");
|
|
21
|
+
var staking_1 = require("@initia/initia.proto/initia/mstaking/v1/staking");
|
|
23
22
|
/**
|
|
24
23
|
* Stores information about the status of a delegation between a delegator and validator, fetched from the blockchain.
|
|
25
24
|
*/
|
|
@@ -35,14 +34,13 @@ var Delegation = /** @class */ (function (_super) {
|
|
|
35
34
|
var _this = _super.call(this) || this;
|
|
36
35
|
_this.delegator_address = delegator_address;
|
|
37
36
|
_this.validator_address = validator_address;
|
|
38
|
-
_this.shares = shares;
|
|
39
|
-
_this.balance = balance;
|
|
40
|
-
_this.shares = (0, num_1.num)(shares).toString();
|
|
37
|
+
_this.shares = new Coins_1.Coins(shares);
|
|
38
|
+
_this.balance = new Coins_1.Coins(balance);
|
|
41
39
|
return _this;
|
|
42
40
|
}
|
|
43
41
|
Delegation.fromAmino = function (data) {
|
|
44
42
|
var _a = data.delegation, delegator_address = _a.delegator_address, validator_address = _a.validator_address, shares = _a.shares, balance = data.balance;
|
|
45
|
-
return new Delegation(delegator_address, validator_address, shares,
|
|
43
|
+
return new Delegation(delegator_address, validator_address, Coins_1.Coins.fromAmino(shares), Coins_1.Coins.fromAmino(balance));
|
|
46
44
|
};
|
|
47
45
|
Delegation.prototype.toAmino = function () {
|
|
48
46
|
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, shares = _a.shares, balance = _a.balance;
|
|
@@ -50,14 +48,14 @@ var Delegation = /** @class */ (function (_super) {
|
|
|
50
48
|
delegation: {
|
|
51
49
|
delegator_address: delegator_address,
|
|
52
50
|
validator_address: validator_address,
|
|
53
|
-
shares:
|
|
51
|
+
shares: shares.toAmino(),
|
|
54
52
|
},
|
|
55
53
|
balance: balance.toAmino(),
|
|
56
54
|
};
|
|
57
55
|
};
|
|
58
56
|
Delegation.fromData = function (data) {
|
|
59
57
|
var _a = data.delegation, delegator_address = _a.delegator_address, validator_address = _a.validator_address, shares = _a.shares, balance = data.balance;
|
|
60
|
-
return new Delegation(delegator_address, validator_address, shares,
|
|
58
|
+
return new Delegation(delegator_address, validator_address, Coins_1.Coins.fromData(shares), Coins_1.Coins.fromData(balance));
|
|
61
59
|
};
|
|
62
60
|
Delegation.prototype.toData = function () {
|
|
63
61
|
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, shares = _a.shares, balance = _a.balance;
|
|
@@ -65,22 +63,22 @@ var Delegation = /** @class */ (function (_super) {
|
|
|
65
63
|
delegation: {
|
|
66
64
|
delegator_address: delegator_address,
|
|
67
65
|
validator_address: validator_address,
|
|
68
|
-
shares:
|
|
66
|
+
shares: shares.toData(),
|
|
69
67
|
},
|
|
70
68
|
balance: balance.toData(),
|
|
71
69
|
};
|
|
72
70
|
};
|
|
73
71
|
Delegation.fromProto = function (proto) {
|
|
74
72
|
var delegationProto = proto.delegation;
|
|
75
|
-
return new Delegation(delegationProto.delegatorAddress, delegationProto.validatorAddress, delegationProto.shares,
|
|
73
|
+
return new Delegation(delegationProto.delegatorAddress, delegationProto.validatorAddress, Coins_1.Coins.fromProto(delegationProto.shares), Coins_1.Coins.fromProto(proto.balance));
|
|
76
74
|
};
|
|
77
75
|
Delegation.prototype.toProto = function () {
|
|
78
76
|
var _a = this, delegator_address = _a.delegator_address, validator_address = _a.validator_address, shares = _a.shares, balance = _a.balance;
|
|
79
77
|
return staking_1.DelegationResponse.fromPartial({
|
|
80
78
|
delegation: staking_1.Delegation.fromPartial({
|
|
81
79
|
delegatorAddress: delegator_address,
|
|
82
|
-
shares: (0, num_1.num)(shares).toFixed(18),
|
|
83
80
|
validatorAddress: validator_address,
|
|
81
|
+
shares: shares.toProto(),
|
|
84
82
|
}),
|
|
85
83
|
balance: balance.toProto(),
|
|
86
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Delegation.js","sourceRoot":"","sources":["../../../src/core/staking/Delegation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,wCAAmD;
|
|
1
|
+
{"version":3,"file":"Delegation.js","sourceRoot":"","sources":["../../../src/core/staking/Delegation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,wCAAmD;AAEnD,kCAAiC;AACjC,2EAGyD;AAEzD;;GAEG;AACH;IAAgC,8BAI/B;IAIC;;;;;OAKG;IACH,oBACS,iBAA6B,EAC7B,iBAA6B,EACpC,MAAmB,EACnB,OAAoB;QAJtB,YAME,iBAAO,SAGR;QARQ,uBAAiB,GAAjB,iBAAiB,CAAY;QAC7B,uBAAiB,GAAjB,iBAAiB,CAAY;QAKpC,KAAI,CAAC,MAAM,GAAG,IAAI,aAAK,CAAC,MAAM,CAAC,CAAC;QAChC,KAAI,CAAC,OAAO,GAAG,IAAI,aAAK,CAAC,OAAO,CAAC,CAAC;;IACpC,CAAC;IAEa,oBAAS,GAAvB,UAAwB,IAAsB;QAE1C,IAAA,KAEE,IAAI,WAFsD,EAA9C,iBAAiB,uBAAA,EAAE,iBAAiB,uBAAA,EAAE,MAAM,YAAA,EAC1D,OAAO,GACL,IAAI,QADC,CACA;QACT,OAAO,IAAI,UAAU,CACnB,iBAAiB,EACjB,iBAAiB,EACjB,aAAK,CAAC,SAAS,CAAC,MAAM,CAAC,EACvB,aAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CACzB,CAAC;IACJ,CAAC;IAEM,4BAA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AC9C,CAAC;IACJ,CAAC;IAEM,4BAAO,GAAd;QACQ,IAAA,KAA4D,IAAI,EAA9D,iBAAiB,uBAAA,EAAE,iBAAiB,uBAAA,EAAE,MAAM,YAAA,EAAE,OAAO,aAAS,CAAC;QACvE,OAAO,4BAAqB,CAAC,WAAW,CAAC;YACvC,UAAU,EAAE,oBAAa,CAAC,WAAW,CAAC;gBACpC,gBAAgB,EAAE,iBAAiB;gBACnC,gBAAgB,EAAE,iBAAiB;gBACnC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE;aACzB,CAAC;YACF,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IACH,iBAAC;AAAD,CAAC,AAlGD,CAAgC,uBAAgB,GAkG/C;AAlGY,gCAAU"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { JSONSerializable } from '../../util/json';
|
|
2
|
+
import { Coins } from '../Coins';
|
|
2
3
|
import { AccAddress, ValAddress } from '../bech32';
|
|
3
|
-
import { RedelegationResponse as RedelegationResponse_pb, RedelegationEntryResponse as RedelegationEntryResponse_pb } from '@initia/initia.proto/
|
|
4
|
+
import { RedelegationResponse as RedelegationResponse_pb, RedelegationEntryResponse as RedelegationEntryResponse_pb } from '@initia/initia.proto/initia/mstaking/v1/staking';
|
|
4
5
|
/**
|
|
5
6
|
* A redelegation is when a delegator decides to stop staking with one validator and
|
|
6
7
|
* transfer their delegation to another validator. Rather than unbonding (which takes
|
|
@@ -52,11 +53,11 @@ export declare namespace Redelegation {
|
|
|
52
53
|
}
|
|
53
54
|
type Proto = RedelegationResponse_pb;
|
|
54
55
|
class Entry extends JSONSerializable<Entry.Amino, Entry.Data, Entry.Proto> {
|
|
55
|
-
initial_balance: string;
|
|
56
|
-
balance: string;
|
|
57
|
-
shares_dst: string;
|
|
58
56
|
creation_height: number;
|
|
59
57
|
completion_time: Date;
|
|
58
|
+
initial_balance: Coins;
|
|
59
|
+
shares_dst: Coins;
|
|
60
|
+
balance: Coins;
|
|
60
61
|
/**
|
|
61
62
|
*
|
|
62
63
|
* @param initial_balance balance of delegation prior to initiating redelegation
|
|
@@ -64,7 +65,7 @@ export declare namespace Redelegation {
|
|
|
64
65
|
* @param creation_height height of blockchain when entry was created
|
|
65
66
|
* @param completion_time time when redelegation entry will be removed
|
|
66
67
|
*/
|
|
67
|
-
constructor(initial_balance:
|
|
68
|
+
constructor(initial_balance: Coins.Input, balance: Coins.Input, shares_dst: Coins.Input, creation_height: number, completion_time: Date);
|
|
68
69
|
toAmino(): Entry.Amino;
|
|
69
70
|
static fromAmino(data: Entry.Amino): Entry;
|
|
70
71
|
toData(): Entry.Data;
|
|
@@ -77,19 +78,19 @@ export declare namespace Redelegation {
|
|
|
77
78
|
redelegation_entry: {
|
|
78
79
|
creation_height: number;
|
|
79
80
|
completion_time: string;
|
|
80
|
-
initial_balance:
|
|
81
|
-
shares_dst:
|
|
81
|
+
initial_balance: Coins.Amino;
|
|
82
|
+
shares_dst: Coins.Amino;
|
|
82
83
|
};
|
|
83
|
-
balance:
|
|
84
|
+
balance: Coins.Amino;
|
|
84
85
|
}
|
|
85
86
|
interface Data {
|
|
86
87
|
redelegation_entry: {
|
|
87
88
|
creation_height: number;
|
|
88
89
|
completion_time: string;
|
|
89
|
-
initial_balance:
|
|
90
|
-
shares_dst:
|
|
90
|
+
initial_balance: Coins.Data;
|
|
91
|
+
shares_dst: Coins.Data;
|
|
91
92
|
};
|
|
92
|
-
balance:
|
|
93
|
+
balance: Coins.Data;
|
|
93
94
|
}
|
|
94
95
|
type Proto = RedelegationEntryResponse_pb;
|
|
95
96
|
}
|
|
@@ -20,8 +20,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
20
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
21
|
exports.Redelegation = void 0;
|
|
22
22
|
var json_1 = require("../../util/json");
|
|
23
|
-
var
|
|
24
|
-
var staking_1 = require("@initia/initia.proto/
|
|
23
|
+
var Coins_1 = require("../Coins");
|
|
24
|
+
var staking_1 = require("@initia/initia.proto/initia/mstaking/v1/staking");
|
|
25
25
|
var long_1 = __importDefault(require("long"));
|
|
26
26
|
/**
|
|
27
27
|
* A redelegation is when a delegator decides to stop staking with one validator and
|
|
@@ -113,61 +113,58 @@ exports.Redelegation = Redelegation;
|
|
|
113
113
|
*/
|
|
114
114
|
function Entry(initial_balance, balance, shares_dst, creation_height, completion_time) {
|
|
115
115
|
var _this = _super.call(this) || this;
|
|
116
|
-
_this.initial_balance = initial_balance;
|
|
117
|
-
_this.balance = balance;
|
|
118
|
-
_this.shares_dst = shares_dst;
|
|
119
116
|
_this.creation_height = creation_height;
|
|
120
117
|
_this.completion_time = completion_time;
|
|
121
|
-
_this.initial_balance =
|
|
122
|
-
_this.balance =
|
|
123
|
-
_this.shares_dst =
|
|
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);
|
|
124
121
|
return _this;
|
|
125
122
|
}
|
|
126
123
|
Entry.prototype.toAmino = function () {
|
|
127
124
|
return {
|
|
128
125
|
redelegation_entry: {
|
|
129
|
-
initial_balance: this.initial_balance.
|
|
130
|
-
shares_dst:
|
|
126
|
+
initial_balance: this.initial_balance.toAmino(),
|
|
127
|
+
shares_dst: this.shares_dst.toAmino(),
|
|
131
128
|
creation_height: this.creation_height,
|
|
132
129
|
completion_time: this.completion_time.toISOString(),
|
|
133
130
|
},
|
|
134
|
-
balance: this.balance.
|
|
131
|
+
balance: this.balance.toAmino(),
|
|
135
132
|
};
|
|
136
133
|
};
|
|
137
134
|
Entry.fromAmino = function (data) {
|
|
138
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;
|
|
139
|
-
return new Entry(initial_balance, balance, shares_dst, creation_height, new Date(completion_time));
|
|
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));
|
|
140
137
|
};
|
|
141
138
|
Entry.prototype.toData = function () {
|
|
142
139
|
return {
|
|
143
140
|
redelegation_entry: {
|
|
144
|
-
initial_balance: this.initial_balance.
|
|
145
|
-
shares_dst:
|
|
141
|
+
initial_balance: this.initial_balance.toData(),
|
|
142
|
+
shares_dst: this.shares_dst.toData(),
|
|
146
143
|
creation_height: this.creation_height,
|
|
147
144
|
completion_time: this.completion_time.toISOString(),
|
|
148
145
|
},
|
|
149
|
-
balance: this.balance.
|
|
146
|
+
balance: this.balance.toData(),
|
|
150
147
|
};
|
|
151
148
|
};
|
|
152
149
|
Entry.fromData = function (data) {
|
|
153
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;
|
|
154
|
-
return new Entry(initial_balance, balance, shares_dst, creation_height, new Date(completion_time));
|
|
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));
|
|
155
152
|
};
|
|
156
153
|
Entry.prototype.toProto = function () {
|
|
157
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;
|
|
158
155
|
return staking_1.RedelegationEntryResponse.fromPartial({
|
|
159
|
-
balance: balance.
|
|
156
|
+
balance: balance.toProto(),
|
|
160
157
|
redelegationEntry: staking_1.RedelegationEntry.fromPartial({
|
|
161
158
|
completionTime: completion_time,
|
|
162
159
|
creationHeight: long_1.default.fromNumber(creation_height),
|
|
163
|
-
initialBalance: initial_balance.
|
|
164
|
-
sharesDst:
|
|
160
|
+
initialBalance: initial_balance.toProto(),
|
|
161
|
+
sharesDst: shares_dst.toProto(),
|
|
165
162
|
}),
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
165
|
Entry.fromProto = function (proto) {
|
|
169
166
|
var redelegationEntryProto = proto.redelegationEntry;
|
|
170
|
-
return new Entry(redelegationEntryProto.initialBalance, proto.balance, redelegationEntryProto.sharesDst, redelegationEntryProto.creationHeight.toNumber(), redelegationEntryProto.completionTime);
|
|
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);
|
|
171
168
|
};
|
|
172
169
|
return Entry;
|
|
173
170
|
}(json_1.JSONSerializable));
|