@initia/initia.js 0.2.26 → 0.2.27
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/index.cjs.js +1 -1
- package/dist/index.es.js +33 -33
- 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,19 @@ 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(this.denom, O(this.amount).toFixed(0,
|
|
216
|
+
return new I(this.denom, O(this.amount).toFixed(0, dt.ROUND_CEIL));
|
|
217
217
|
}
|
|
218
218
|
/**
|
|
219
219
|
* Turns the Coin into a Decimal coin.
|
|
@@ -1030,7 +1030,7 @@ var Qt;
|
|
|
1030
1030
|
function t(o) {
|
|
1031
1031
|
switch (o.type) {
|
|
1032
1032
|
case "tendermint/PubKeySecp256k1":
|
|
1033
|
-
return
|
|
1033
|
+
return lt.fromAmino(o);
|
|
1034
1034
|
case "tendermint/PubKeyMultisigThreshold":
|
|
1035
1035
|
return de.fromAmino(o);
|
|
1036
1036
|
case "tendermint/PubKeyEd25519":
|
|
@@ -1043,7 +1043,7 @@ var Qt;
|
|
|
1043
1043
|
function e(o) {
|
|
1044
1044
|
switch (o["@type"]) {
|
|
1045
1045
|
case "/cosmos.crypto.secp256k1.PubKey":
|
|
1046
|
-
return
|
|
1046
|
+
return lt.fromData(o);
|
|
1047
1047
|
case "/cosmos.crypto.multisig.LegacyAminoPubKey":
|
|
1048
1048
|
return de.fromData(o);
|
|
1049
1049
|
case "/cosmos.crypto.ed25519.PubKey":
|
|
@@ -1056,7 +1056,7 @@ var Qt;
|
|
|
1056
1056
|
function r(o) {
|
|
1057
1057
|
const s = o.typeUrl;
|
|
1058
1058
|
if (s === "/cosmos.crypto.secp256k1.PubKey")
|
|
1059
|
-
return
|
|
1059
|
+
return lt.unpackAny(o);
|
|
1060
1060
|
if (s === "/cosmos.crypto.multisig.LegacyAminoPubKey")
|
|
1061
1061
|
return de.unpackAny(o);
|
|
1062
1062
|
if (s === "/cosmos.crypto.ed25519.PubKey")
|
|
@@ -1067,12 +1067,12 @@ var Qt;
|
|
|
1067
1067
|
}
|
|
1068
1068
|
a.fromProto = r;
|
|
1069
1069
|
})(Qt || (Qt = {}));
|
|
1070
|
-
class
|
|
1070
|
+
class lt extends m {
|
|
1071
1071
|
constructor(t) {
|
|
1072
1072
|
super(), this.key = t;
|
|
1073
1073
|
}
|
|
1074
1074
|
static fromAmino(t) {
|
|
1075
|
-
return new
|
|
1075
|
+
return new lt(t.value);
|
|
1076
1076
|
}
|
|
1077
1077
|
toAmino() {
|
|
1078
1078
|
return {
|
|
@@ -1081,7 +1081,7 @@ class dt extends m {
|
|
|
1081
1081
|
};
|
|
1082
1082
|
}
|
|
1083
1083
|
static fromData(t) {
|
|
1084
|
-
return new
|
|
1084
|
+
return new lt(t.key);
|
|
1085
1085
|
}
|
|
1086
1086
|
toData() {
|
|
1087
1087
|
return {
|
|
@@ -1090,7 +1090,7 @@ class dt extends m {
|
|
|
1090
1090
|
};
|
|
1091
1091
|
}
|
|
1092
1092
|
static fromProto(t) {
|
|
1093
|
-
return new
|
|
1093
|
+
return new lt(Buffer.from(t.key).toString("base64"));
|
|
1094
1094
|
}
|
|
1095
1095
|
toProto() {
|
|
1096
1096
|
return ki.fromPartial({
|
|
@@ -1104,7 +1104,7 @@ class dt extends m {
|
|
|
1104
1104
|
});
|
|
1105
1105
|
}
|
|
1106
1106
|
static unpackAny(t) {
|
|
1107
|
-
return
|
|
1107
|
+
return lt.fromProto(ki.decode(t.value));
|
|
1108
1108
|
}
|
|
1109
1109
|
encodeAminoPubkey() {
|
|
1110
1110
|
return Buffer.concat([
|
|
@@ -1141,7 +1141,7 @@ class de extends m {
|
|
|
1141
1141
|
static fromAmino(t) {
|
|
1142
1142
|
return new de(
|
|
1143
1143
|
parseInt(t.value.threshold),
|
|
1144
|
-
t.value.pubkeys.map((e) =>
|
|
1144
|
+
t.value.pubkeys.map((e) => lt.fromAmino(e))
|
|
1145
1145
|
);
|
|
1146
1146
|
}
|
|
1147
1147
|
toAmino() {
|
|
@@ -1156,7 +1156,7 @@ class de extends m {
|
|
|
1156
1156
|
static fromData(t) {
|
|
1157
1157
|
return new de(
|
|
1158
1158
|
parseInt(t.threshold),
|
|
1159
|
-
t.public_keys.map((e) =>
|
|
1159
|
+
t.public_keys.map((e) => lt.fromData(e))
|
|
1160
1160
|
);
|
|
1161
1161
|
}
|
|
1162
1162
|
toData() {
|
|
@@ -1169,7 +1169,7 @@ class de extends m {
|
|
|
1169
1169
|
static fromProto(t) {
|
|
1170
1170
|
return new de(
|
|
1171
1171
|
t.threshold,
|
|
1172
|
-
t.publicKeys.map((e) =>
|
|
1172
|
+
t.publicKeys.map((e) => lt.unpackAny(e))
|
|
1173
1173
|
);
|
|
1174
1174
|
}
|
|
1175
1175
|
toProto() {
|
|
@@ -6038,7 +6038,7 @@ class ht {
|
|
|
6038
6038
|
new J.Single(J.SignMode.SIGN_MODE_DIRECT)
|
|
6039
6039
|
)
|
|
6040
6040
|
) : r = new Nt(
|
|
6041
|
-
new
|
|
6041
|
+
new lt(""),
|
|
6042
6042
|
e.sequenceNumber,
|
|
6043
6043
|
new J(new J.Single(J.SignMode.SIGN_MODE_DIRECT))
|
|
6044
6044
|
), this.auth_info.signer_infos.push(r), this.signatures.push("");
|
|
@@ -6144,7 +6144,7 @@ class Nt {
|
|
|
6144
6144
|
}
|
|
6145
6145
|
static fromData(t) {
|
|
6146
6146
|
return new Nt(
|
|
6147
|
-
Qt.fromData(t.public_key ?? new
|
|
6147
|
+
Qt.fromData(t.public_key ?? new lt("").toData()),
|
|
6148
6148
|
parseInt(t.sequence),
|
|
6149
6149
|
J.fromData(t.mode_info)
|
|
6150
6150
|
);
|
|
@@ -6159,7 +6159,7 @@ class Nt {
|
|
|
6159
6159
|
}
|
|
6160
6160
|
static fromProto(t) {
|
|
6161
6161
|
return new Nt(
|
|
6162
|
-
Qt.fromProto(t.publicKey ?? new
|
|
6162
|
+
Qt.fromProto(t.publicKey ?? new lt("").packAny()),
|
|
6163
6163
|
Number(t.sequence),
|
|
6164
6164
|
J.fromProto(t.modeInfo)
|
|
6165
6165
|
);
|
|
@@ -24250,7 +24250,7 @@ class Jv {
|
|
|
24250
24250
|
}
|
|
24251
24251
|
appendSignatureV2s(t) {
|
|
24252
24252
|
for (const e of t) {
|
|
24253
|
-
if (!(e.public_key instanceof
|
|
24253
|
+
if (!(e.public_key instanceof lt))
|
|
24254
24254
|
throw new Error("non-SimplePublicKey cannot be used to sign multisig");
|
|
24255
24255
|
this.appendSignatureFromPubKey(e.data, e.public_key);
|
|
24256
24256
|
}
|
|
@@ -25856,8 +25856,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25856
25856
|
* bcs.fixed_point32().serialize('1.23')
|
|
25857
25857
|
*/
|
|
25858
25858
|
fixed_point32: (a) => Ht.u64(a).transform({
|
|
25859
|
-
input: (t) => O(t).times(new
|
|
25860
|
-
output: (t) => O(t).div(new
|
|
25859
|
+
input: (t) => O(t).times(new dt("4294967296")).toFixed(0, dt.ROUND_DOWN),
|
|
25860
|
+
output: (t) => O(t).div(new dt("4294967296")).toNumber()
|
|
25861
25861
|
}),
|
|
25862
25862
|
/**
|
|
25863
25863
|
* Creates a BcsType that can be used to read and write a fixed_point64.
|
|
@@ -25865,8 +25865,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25865
25865
|
* bcs.fixed_point64().serialize('1.23')
|
|
25866
25866
|
*/
|
|
25867
25867
|
fixed_point64: (a) => Ht.u128(a).transform({
|
|
25868
|
-
input: (t) => O(t).times(new
|
|
25869
|
-
output: (t) => O(t).div(new
|
|
25868
|
+
input: (t) => O(t).times(new dt("18446744073709551616")).toFixed(0, dt.ROUND_DOWN),
|
|
25869
|
+
output: (t) => O(t).div(new dt("18446744073709551616")).toNumber()
|
|
25870
25870
|
}),
|
|
25871
25871
|
/**
|
|
25872
25872
|
* Creates a BcsType that can be used to read and write a decimal128.
|
|
@@ -25874,8 +25874,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25874
25874
|
* bcs.decimal128().serialize('1.23')
|
|
25875
25875
|
*/
|
|
25876
25876
|
decimal128: (a) => Ht.u128(a).transform({
|
|
25877
|
-
input: (t) => O(t).times(new
|
|
25878
|
-
output: (t) => O(t).div(new
|
|
25877
|
+
input: (t) => O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN),
|
|
25878
|
+
output: (t) => O(t).div(new dt("1000000000000000000")).toNumber()
|
|
25879
25879
|
}),
|
|
25880
25880
|
/**
|
|
25881
25881
|
* Creates a BcsType that can be used to read and write a decimal256.
|
|
@@ -25883,8 +25883,8 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25883
25883
|
* bcs.decimal256().serialize('1.23')
|
|
25884
25884
|
*/
|
|
25885
25885
|
decimal256: (a) => Ht.u256(a).transform({
|
|
25886
|
-
input: (t) => O(t).times(new
|
|
25887
|
-
output: (t) => O(t).div(new
|
|
25886
|
+
input: (t) => O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN),
|
|
25887
|
+
output: (t) => O(t).div(new dt("1000000000000000000")).toNumber()
|
|
25888
25888
|
}),
|
|
25889
25889
|
/**
|
|
25890
25890
|
* Creates a BcsType that can be used to read and write a biguint.
|
|
@@ -25902,12 +25902,12 @@ const ml = (a) => Ht.bytes(32, a).transform({
|
|
|
25902
25902
|
*/
|
|
25903
25903
|
bigdecimal: (a) => Ht.vector(Ht.u8(a)).transform({
|
|
25904
25904
|
input: (t) => {
|
|
25905
|
-
const r = O(t).times(new
|
|
25905
|
+
const r = O(t).times(new dt("1000000000000000000")).toFixed(0, dt.ROUND_DOWN);
|
|
25906
25906
|
return ul(BigInt(r));
|
|
25907
25907
|
},
|
|
25908
25908
|
output: (t) => {
|
|
25909
25909
|
const e = dl(t).toString();
|
|
25910
|
-
return O(e).div(new
|
|
25910
|
+
return O(e).div(new dt("1000000000000000000")).toNumber();
|
|
25911
25911
|
}
|
|
25912
25912
|
})
|
|
25913
25913
|
}, Zv = {
|
|
@@ -28879,7 +28879,7 @@ class Ad extends Fl {
|
|
|
28879
28879
|
new Uint8Array(e),
|
|
28880
28880
|
!0
|
|
28881
28881
|
);
|
|
28882
|
-
t(r ? new le(Buffer.from(o).toString("base64")) : new
|
|
28882
|
+
t(r ? new le(Buffer.from(o).toString("base64")) : new lt(Buffer.from(o).toString("base64"))), this.privateKey = e, this.eth = r;
|
|
28883
28883
|
}
|
|
28884
28884
|
static fromHex(e) {
|
|
28885
28885
|
const r = e.startsWith("0x") ? e.slice(2) : e;
|
|
@@ -29007,7 +29007,7 @@ class Ql extends Fl {
|
|
|
29007
29007
|
*/
|
|
29008
29008
|
async loadAccountDetails() {
|
|
29009
29009
|
const e = await this.app.getAddressAndPubKey(this.path, "init");
|
|
29010
|
-
return od(e), this.publicKey = new
|
|
29010
|
+
return od(e), this.publicKey = new lt(
|
|
29011
29011
|
Buffer.from(e.compressed_pk.data).toString("base64")
|
|
29012
29012
|
), this;
|
|
29013
29013
|
}
|
|
@@ -29447,7 +29447,7 @@ export {
|
|
|
29447
29447
|
Xf as SignDoc,
|
|
29448
29448
|
nt as SignatureV2,
|
|
29449
29449
|
Nt as SignerInfo,
|
|
29450
|
-
|
|
29450
|
+
lt as SimplePublicKey,
|
|
29451
29451
|
pd as SimulateResponse,
|
|
29452
29452
|
bg as SlashingAPI,
|
|
29453
29453
|
Os as SlashingParams,
|