@initia/initia.js 0.2.26 → 0.2.28
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/core/opchild/OpchildParams.d.ts +4 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +61 -46
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3,7 +3,7 @@ var fp = (a, t, e) => t in a ? hp(a, t, { enumerable: !0, configurable: !0, writ
|
|
|
3
3
|
var _ = (a, t, e) => fp(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import gp, { AxiosHeaders as yp } from "axios";
|
|
5
5
|
import { OrderBy as _p } from "@initia/initia.proto/cosmos/tx/v1beta1/service";
|
|
6
|
-
import { BigNumber as
|
|
6
|
+
import { BigNumber as dt } from "bignumber.js";
|
|
7
7
|
export * from "bignumber.js";
|
|
8
8
|
import { Coin as vp } from "@initia/initia.proto/cosmos/base/v1beta1/coin";
|
|
9
9
|
import { Any as f } from "@initia/initia.proto/google/protobuf/any";
|
|
@@ -185,7 +185,7 @@ function Wf(a) {
|
|
|
185
185
|
) : a;
|
|
186
186
|
}
|
|
187
187
|
function O(a) {
|
|
188
|
-
return new
|
|
188
|
+
return new dt(a);
|
|
189
189
|
}
|
|
190
190
|
function kn(a) {
|
|
191
191
|
return typeof a == "string" ? a.includes(".") : !O(a).isInteger();
|
|
@@ -201,19 +201,22 @@ class I extends m {
|
|
|
201
201
|
super();
|
|
202
202
|
_(this, "amount");
|
|
203
203
|
_(this, "isDecimal");
|
|
204
|
-
this.denom = e, this.amount = O(r).
|
|
204
|
+
this.denom = e, this.amount = O(r).toFixed(), this.isDecimal = kn(r);
|
|
205
205
|
}
|
|
206
206
|
/**
|
|
207
207
|
* Turns the Coin into an Integer coin.
|
|
208
208
|
*/
|
|
209
209
|
toIntCoin() {
|
|
210
|
-
return new I(this.denom, O(this.amount).toFixed());
|
|
210
|
+
return new I(this.denom, O(this.amount).toFixed(0));
|
|
211
211
|
}
|
|
212
212
|
/**
|
|
213
213
|
* Turns the Coin into an Integer coin with ceiling the amount.
|
|
214
214
|
*/
|
|
215
215
|
toIntCeilCoin() {
|
|
216
|
-
return new I(
|
|
216
|
+
return new I(
|
|
217
|
+
this.denom,
|
|
218
|
+
O(this.amount).toFixed(0, dt.ROUND_CEIL)
|
|
219
|
+
);
|
|
217
220
|
}
|
|
218
221
|
/**
|
|
219
222
|
* Turns the Coin into a Decimal coin.
|
|
@@ -1030,7 +1033,7 @@ var Qt;
|
|
|
1030
1033
|
function t(o) {
|
|
1031
1034
|
switch (o.type) {
|
|
1032
1035
|
case "tendermint/PubKeySecp256k1":
|
|
1033
|
-
return
|
|
1036
|
+
return lt.fromAmino(o);
|
|
1034
1037
|
case "tendermint/PubKeyMultisigThreshold":
|
|
1035
1038
|
return de.fromAmino(o);
|
|
1036
1039
|
case "tendermint/PubKeyEd25519":
|
|
@@ -1043,7 +1046,7 @@ var Qt;
|
|
|
1043
1046
|
function e(o) {
|
|
1044
1047
|
switch (o["@type"]) {
|
|
1045
1048
|
case "/cosmos.crypto.secp256k1.PubKey":
|
|
1046
|
-
return
|
|
1049
|
+
return lt.fromData(o);
|
|
1047
1050
|
case "/cosmos.crypto.multisig.LegacyAminoPubKey":
|
|
1048
1051
|
return de.fromData(o);
|
|
1049
1052
|
case "/cosmos.crypto.ed25519.PubKey":
|
|
@@ -1056,7 +1059,7 @@ var Qt;
|
|
|
1056
1059
|
function r(o) {
|
|
1057
1060
|
const s = o.typeUrl;
|
|
1058
1061
|
if (s === "/cosmos.crypto.secp256k1.PubKey")
|
|
1059
|
-
return
|
|
1062
|
+
return lt.unpackAny(o);
|
|
1060
1063
|
if (s === "/cosmos.crypto.multisig.LegacyAminoPubKey")
|
|
1061
1064
|
return de.unpackAny(o);
|
|
1062
1065
|
if (s === "/cosmos.crypto.ed25519.PubKey")
|
|
@@ -1067,12 +1070,12 @@ var Qt;
|
|
|
1067
1070
|
}
|
|
1068
1071
|
a.fromProto = r;
|
|
1069
1072
|
})(Qt || (Qt = {}));
|
|
1070
|
-
class
|
|
1073
|
+
class lt extends m {
|
|
1071
1074
|
constructor(t) {
|
|
1072
1075
|
super(), this.key = t;
|
|
1073
1076
|
}
|
|
1074
1077
|
static fromAmino(t) {
|
|
1075
|
-
return new
|
|
1078
|
+
return new lt(t.value);
|
|
1076
1079
|
}
|
|
1077
1080
|
toAmino() {
|
|
1078
1081
|
return {
|
|
@@ -1081,7 +1084,7 @@ class dt extends m {
|
|
|
1081
1084
|
};
|
|
1082
1085
|
}
|
|
1083
1086
|
static fromData(t) {
|
|
1084
|
-
return new
|
|
1087
|
+
return new lt(t.key);
|
|
1085
1088
|
}
|
|
1086
1089
|
toData() {
|
|
1087
1090
|
return {
|
|
@@ -1090,7 +1093,7 @@ class dt extends m {
|
|
|
1090
1093
|
};
|
|
1091
1094
|
}
|
|
1092
1095
|
static fromProto(t) {
|
|
1093
|
-
return new
|
|
1096
|
+
return new lt(Buffer.from(t.key).toString("base64"));
|
|
1094
1097
|
}
|
|
1095
1098
|
toProto() {
|
|
1096
1099
|
return ki.fromPartial({
|
|
@@ -1104,7 +1107,7 @@ class dt extends m {
|
|
|
1104
1107
|
});
|
|
1105
1108
|
}
|
|
1106
1109
|
static unpackAny(t) {
|
|
1107
|
-
return
|
|
1110
|
+
return lt.fromProto(ki.decode(t.value));
|
|
1108
1111
|
}
|
|
1109
1112
|
encodeAminoPubkey() {
|
|
1110
1113
|
return Buffer.concat([
|
|
@@ -1141,7 +1144,7 @@ class de extends m {
|
|
|
1141
1144
|
static fromAmino(t) {
|
|
1142
1145
|
return new de(
|
|
1143
1146
|
parseInt(t.value.threshold),
|
|
1144
|
-
t.value.pubkeys.map((e) =>
|
|
1147
|
+
t.value.pubkeys.map((e) => lt.fromAmino(e))
|
|
1145
1148
|
);
|
|
1146
1149
|
}
|
|
1147
1150
|
toAmino() {
|
|
@@ -1156,7 +1159,7 @@ class de extends m {
|
|
|
1156
1159
|
static fromData(t) {
|
|
1157
1160
|
return new de(
|
|
1158
1161
|
parseInt(t.threshold),
|
|
1159
|
-
t.public_keys.map((e) =>
|
|
1162
|
+
t.public_keys.map((e) => lt.fromData(e))
|
|
1160
1163
|
);
|
|
1161
1164
|
}
|
|
1162
1165
|
toData() {
|
|
@@ -1169,7 +1172,7 @@ class de extends m {
|
|
|
1169
1172
|
static fromProto(t) {
|
|
1170
1173
|
return new de(
|
|
1171
1174
|
t.threshold,
|
|
1172
|
-
t.publicKeys.map((e) =>
|
|
1175
|
+
t.publicKeys.map((e) => lt.unpackAny(e))
|
|
1173
1176
|
);
|
|
1174
1177
|
}
|
|
1175
1178
|
toProto() {
|
|
@@ -6038,7 +6041,7 @@ class ht {
|
|
|
6038
6041
|
new J.Single(J.SignMode.SIGN_MODE_DIRECT)
|
|
6039
6042
|
)
|
|
6040
6043
|
) : r = new Nt(
|
|
6041
|
-
new
|
|
6044
|
+
new lt(""),
|
|
6042
6045
|
e.sequenceNumber,
|
|
6043
6046
|
new J(new J.Single(J.SignMode.SIGN_MODE_DIRECT))
|
|
6044
6047
|
), this.auth_info.signer_infos.push(r), this.signatures.push("");
|
|
@@ -6144,7 +6147,7 @@ class Nt {
|
|
|
6144
6147
|
}
|
|
6145
6148
|
static fromData(t) {
|
|
6146
6149
|
return new Nt(
|
|
6147
|
-
Qt.fromData(t.public_key ?? new
|
|
6150
|
+
Qt.fromData(t.public_key ?? new lt("").toData()),
|
|
6148
6151
|
parseInt(t.sequence),
|
|
6149
6152
|
J.fromData(t.mode_info)
|
|
6150
6153
|
);
|
|
@@ -6159,7 +6162,7 @@ class Nt {
|
|
|
6159
6162
|
}
|
|
6160
6163
|
static fromProto(t) {
|
|
6161
6164
|
return new Nt(
|
|
6162
|
-
Qt.fromProto(t.publicKey ?? new
|
|
6165
|
+
Qt.fromProto(t.publicKey ?? new lt("").packAny()),
|
|
6163
6166
|
Number(t.sequence),
|
|
6164
6167
|
J.fromProto(t.modeInfo)
|
|
6165
6168
|
);
|
|
@@ -21835,11 +21838,12 @@ class $s extends m {
|
|
|
21835
21838
|
* @param bridge_executors the account addresses of bridge executor who can execute permissioned bridge messages
|
|
21836
21839
|
* @param admin the account address of admin who can execute permissioned cosmos messages
|
|
21837
21840
|
* @param fee_whitelist the list of addresses that are allowed to pay zero fee
|
|
21841
|
+
* @param hook_max_gas max gas for hook execution of `MsgFinalizeTokenDeposit`
|
|
21838
21842
|
*/
|
|
21839
|
-
constructor(e, r, o, s, n, i) {
|
|
21843
|
+
constructor(e, r, o, s, n, i, c) {
|
|
21840
21844
|
super();
|
|
21841
21845
|
_(this, "min_gas_prices");
|
|
21842
|
-
this.max_validators = e, this.historical_entries = r, this.bridge_executors = s, this.admin = n, this.fee_whitelist = i, this.min_gas_prices = new l(o);
|
|
21846
|
+
this.max_validators = e, this.historical_entries = r, this.bridge_executors = s, this.admin = n, this.fee_whitelist = i, this.hook_max_gas = c, this.min_gas_prices = new l(o);
|
|
21843
21847
|
}
|
|
21844
21848
|
static fromAmino(e) {
|
|
21845
21849
|
const {
|
|
@@ -21849,7 +21853,8 @@ class $s extends m {
|
|
|
21849
21853
|
min_gas_prices: s,
|
|
21850
21854
|
bridge_executors: n,
|
|
21851
21855
|
admin: i,
|
|
21852
|
-
fee_whitelist: c
|
|
21856
|
+
fee_whitelist: c,
|
|
21857
|
+
hook_max_gas: d
|
|
21853
21858
|
}
|
|
21854
21859
|
} = e;
|
|
21855
21860
|
return new $s(
|
|
@@ -21858,7 +21863,8 @@ class $s extends m {
|
|
|
21858
21863
|
l.fromAmino(s),
|
|
21859
21864
|
n,
|
|
21860
21865
|
i,
|
|
21861
|
-
c
|
|
21866
|
+
c,
|
|
21867
|
+
parseInt(d)
|
|
21862
21868
|
);
|
|
21863
21869
|
}
|
|
21864
21870
|
toAmino() {
|
|
@@ -21868,7 +21874,8 @@ class $s extends m {
|
|
|
21868
21874
|
min_gas_prices: o,
|
|
21869
21875
|
bridge_executors: s,
|
|
21870
21876
|
admin: n,
|
|
21871
|
-
fee_whitelist: i
|
|
21877
|
+
fee_whitelist: i,
|
|
21878
|
+
hook_max_gas: c
|
|
21872
21879
|
} = this;
|
|
21873
21880
|
return {
|
|
21874
21881
|
type: "opchild/Params",
|
|
@@ -21878,7 +21885,8 @@ class $s extends m {
|
|
|
21878
21885
|
min_gas_prices: o.toAmino(),
|
|
21879
21886
|
bridge_executors: s,
|
|
21880
21887
|
admin: n,
|
|
21881
|
-
fee_whitelist: i
|
|
21888
|
+
fee_whitelist: i,
|
|
21889
|
+
hook_max_gas: c.toFixed()
|
|
21882
21890
|
}
|
|
21883
21891
|
};
|
|
21884
21892
|
}
|
|
@@ -21889,7 +21897,8 @@ class $s extends m {
|
|
|
21889
21897
|
min_gas_prices: s,
|
|
21890
21898
|
bridge_executors: n,
|
|
21891
21899
|
admin: i,
|
|
21892
|
-
fee_whitelist: c
|
|
21900
|
+
fee_whitelist: c,
|
|
21901
|
+
hook_max_gas: d
|
|
21893
21902
|
} = e;
|
|
21894
21903
|
return new $s(
|
|
21895
21904
|
r,
|
|
@@ -21897,7 +21906,8 @@ class $s extends m {
|
|
|
21897
21906
|
l.fromData(s),
|
|
21898
21907
|
n,
|
|
21899
21908
|
i,
|
|
21900
|
-
c
|
|
21909
|
+
c,
|
|
21910
|
+
parseInt(d)
|
|
21901
21911
|
);
|
|
21902
21912
|
}
|
|
21903
21913
|
toData() {
|
|
@@ -21907,7 +21917,8 @@ class $s extends m {
|
|
|
21907
21917
|
min_gas_prices: o,
|
|
21908
21918
|
bridge_executors: s,
|
|
21909
21919
|
admin: n,
|
|
21910
|
-
fee_whitelist: i
|
|
21920
|
+
fee_whitelist: i,
|
|
21921
|
+
hook_max_gas: c
|
|
21911
21922
|
} = this;
|
|
21912
21923
|
return {
|
|
21913
21924
|
"@type": "/opinit.opchild.v1.Params",
|
|
@@ -21916,7 +21927,8 @@ class $s extends m {
|
|
|
21916
21927
|
min_gas_prices: o.toData(),
|
|
21917
21928
|
bridge_executors: s,
|
|
21918
21929
|
admin: n,
|
|
21919
|
-
fee_whitelist: i
|
|
21930
|
+
fee_whitelist: i,
|
|
21931
|
+
hook_max_gas: c.toFixed()
|
|
21920
21932
|
};
|
|
21921
21933
|
}
|
|
21922
21934
|
static fromProto(e) {
|
|
@@ -21926,7 +21938,8 @@ class $s extends m {
|
|
|
21926
21938
|
l.fromProto(e.minGasPrices),
|
|
21927
21939
|
e.bridgeExecutors,
|
|
21928
21940
|
e.admin,
|
|
21929
|
-
e.feeWhitelist
|
|
21941
|
+
e.feeWhitelist,
|
|
21942
|
+
Number(e.hookMaxGas)
|
|
21930
21943
|
);
|
|
21931
21944
|
}
|
|
21932
21945
|
toProto() {
|
|
@@ -21936,7 +21949,8 @@ class $s extends m {
|
|
|
21936
21949
|
min_gas_prices: o,
|
|
21937
21950
|
bridge_executors: s,
|
|
21938
21951
|
admin: n,
|
|
21939
|
-
fee_whitelist: i
|
|
21952
|
+
fee_whitelist: i,
|
|
21953
|
+
hook_max_gas: c
|
|
21940
21954
|
} = this;
|
|
21941
21955
|
return Mf.fromPartial({
|
|
21942
21956
|
maxValidators: e,
|
|
@@ -21944,7 +21958,8 @@ class $s extends m {
|
|
|
21944
21958
|
minGasPrices: o.toProto(),
|
|
21945
21959
|
bridgeExecutors: s,
|
|
21946
21960
|
admin: n,
|
|
21947
|
-
feeWhitelist: i
|
|
21961
|
+
feeWhitelist: i,
|
|
21962
|
+
hookMaxGas: BigInt(c)
|
|
21948
21963
|
});
|
|
21949
21964
|
}
|
|
21950
21965
|
}
|
|
@@ -24250,7 +24265,7 @@ class Jv {
|
|
|
24250
24265
|
}
|
|
24251
24266
|
appendSignatureV2s(t) {
|
|
24252
24267
|
for (const e of t) {
|
|
24253
|
-
if (!(e.public_key instanceof
|
|
24268
|
+
if (!(e.public_key instanceof lt))
|
|
24254
24269
|
throw new Error("non-SimplePublicKey cannot be used to sign multisig");
|
|
24255
24270
|
this.appendSignatureFromPubKey(e.data, e.public_key);
|
|
24256
24271
|
}
|
|
@@ -25856,8 +25871,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25856
25871
|
* bcs.fixed_point32().serialize('1.23')
|
|
25857
25872
|
*/
|
|
25858
25873
|
fixed_point32: (a) => Ht.u64(a).transform({
|
|
25859
|
-
input: (t) => O(t).times(new
|
|
25860
|
-
output: (t) => O(t).div(new
|
|
25874
|
+
input: (t) => O(t).times(new dt("4294967296")).toFixed(0, dt.ROUND_DOWN),
|
|
25875
|
+
output: (t) => O(t).div(new dt("4294967296")).toNumber()
|
|
25861
25876
|
}),
|
|
25862
25877
|
/**
|
|
25863
25878
|
* Creates a BcsType that can be used to read and write a fixed_point64.
|
|
@@ -25865,8 +25880,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25865
25880
|
* bcs.fixed_point64().serialize('1.23')
|
|
25866
25881
|
*/
|
|
25867
25882
|
fixed_point64: (a) => Ht.u128(a).transform({
|
|
25868
|
-
input: (t) => O(t).times(new
|
|
25869
|
-
output: (t) => O(t).div(new
|
|
25883
|
+
input: (t) => O(t).times(new dt("18446744073709551616")).toFixed(0, dt.ROUND_DOWN),
|
|
25884
|
+
output: (t) => O(t).div(new dt("18446744073709551616")).toNumber()
|
|
25870
25885
|
}),
|
|
25871
25886
|
/**
|
|
25872
25887
|
* Creates a BcsType that can be used to read and write a decimal128.
|
|
@@ -25874,8 +25889,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25874
25889
|
* bcs.decimal128().serialize('1.23')
|
|
25875
25890
|
*/
|
|
25876
25891
|
decimal128: (a) => Ht.u128(a).transform({
|
|
25877
|
-
input: (t) => O(t).times(new
|
|
25878
|
-
output: (t) => O(t).div(new
|
|
25892
|
+
input: (t) => O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN),
|
|
25893
|
+
output: (t) => O(t).div(new dt("1000000000000000000")).toNumber()
|
|
25879
25894
|
}),
|
|
25880
25895
|
/**
|
|
25881
25896
|
* Creates a BcsType that can be used to read and write a decimal256.
|
|
@@ -25883,8 +25898,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25883
25898
|
* bcs.decimal256().serialize('1.23')
|
|
25884
25899
|
*/
|
|
25885
25900
|
decimal256: (a) => Ht.u256(a).transform({
|
|
25886
|
-
input: (t) => O(t).times(new
|
|
25887
|
-
output: (t) => O(t).div(new
|
|
25901
|
+
input: (t) => O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN),
|
|
25902
|
+
output: (t) => O(t).div(new dt("1000000000000000000")).toNumber()
|
|
25888
25903
|
}),
|
|
25889
25904
|
/**
|
|
25890
25905
|
* Creates a BcsType that can be used to read and write a biguint.
|
|
@@ -25902,12 +25917,12 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25902
25917
|
*/
|
|
25903
25918
|
bigdecimal: (a) => Ht.vector(Ht.u8(a)).transform({
|
|
25904
25919
|
input: (t) => {
|
|
25905
|
-
const r = O(t).times(new
|
|
25920
|
+
const r = O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN);
|
|
25906
25921
|
return ul(BigInt(r));
|
|
25907
25922
|
},
|
|
25908
25923
|
output: (t) => {
|
|
25909
25924
|
const e = dl(t).toString();
|
|
25910
|
-
return O(e).div(new
|
|
25925
|
+
return O(e).div(new dt("1000000000000000000")).toNumber();
|
|
25911
25926
|
}
|
|
25912
25927
|
})
|
|
25913
25928
|
}, Zv = {
|
|
@@ -28879,7 +28894,7 @@ class Ad extends Fl {
|
|
|
28879
28894
|
new Uint8Array(e),
|
|
28880
28895
|
!0
|
|
28881
28896
|
);
|
|
28882
|
-
t(r ? new le(Buffer.from(o).toString("base64")) : new
|
|
28897
|
+
t(r ? new le(Buffer.from(o).toString("base64")) : new lt(Buffer.from(o).toString("base64"))), this.privateKey = e, this.eth = r;
|
|
28883
28898
|
}
|
|
28884
28899
|
static fromHex(e) {
|
|
28885
28900
|
const r = e.startsWith("0x") ? e.slice(2) : e;
|
|
@@ -29007,7 +29022,7 @@ class Ql extends Fl {
|
|
|
29007
29022
|
*/
|
|
29008
29023
|
async loadAccountDetails() {
|
|
29009
29024
|
const e = await this.app.getAddressAndPubKey(this.path, "init");
|
|
29010
|
-
return od(e), this.publicKey = new
|
|
29025
|
+
return od(e), this.publicKey = new lt(
|
|
29011
29026
|
Buffer.from(e.compressed_pk.data).toString("base64")
|
|
29012
29027
|
), this;
|
|
29013
29028
|
}
|
|
@@ -29447,7 +29462,7 @@ export {
|
|
|
29447
29462
|
Xf as SignDoc,
|
|
29448
29463
|
nt as SignatureV2,
|
|
29449
29464
|
Nt as SignerInfo,
|
|
29450
|
-
|
|
29465
|
+
lt as SimplePublicKey,
|
|
29451
29466
|
pd as SimulateResponse,
|
|
29452
29467
|
bg as SlashingAPI,
|
|
29453
29468
|
Os as SlashingParams,
|