@injectivelabs/sdk-ts 1.20.15 → 1.20.17
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/cjs/{AbacusGrpcApi-xrQAr-fH.cjs → AbacusGrpcApi-Dwlpk6jY.cjs} +2 -2
- package/dist/cjs/{BaseGrpcConsumer-CgIbwIvJ.d.cts → BaseGrpcConsumer-CUdc9vEY.d.cts} +1 -1
- package/dist/cjs/{BaseGrpcConsumer-DHYpiqn5.cjs → BaseGrpcConsumer-zA9DIfEw.cjs} +24 -24
- package/dist/cjs/{BaseIndexerGrpcConsumer-GHyeUHdH.cjs → BaseIndexerGrpcConsumer-CQBZ05BC.cjs} +1 -1
- package/dist/cjs/{ChainGrpcExchangeApi-MspF9deW.cjs → ChainGrpcExchangeApi-vxOV2B57.cjs} +4 -4
- package/dist/cjs/{ChainRestTendermintApi-TZoqfN-E.cjs → ChainRestTendermintApi-Sni05dAJ.cjs} +7 -6
- package/dist/cjs/{DirectEthSecp256k1Wallet-D_rQWJR4.cjs → DirectEthSecp256k1Wallet-CbsATe2T.cjs} +14 -14
- package/dist/cjs/{ExecArgNeptuneWithdraw-ChJ7QUin.cjs → ExecArgNeptuneWithdraw-Sqk_zPQx.cjs} +7 -6
- package/dist/cjs/{IndexerGrpcWeb3GwApi-Cj9gotHt.cjs → IndexerGrpcWeb3GwApi-KVLJE-jW.cjs} +11 -10
- package/dist/cjs/{MsgBase-CAiwUyBz.cjs → MsgBase-BJmf0IHm.cjs} +1 -1
- package/dist/cjs/{MsgSetDenomMetadata-BDNtlSxx.cjs → MsgSetDenomMetadata-BQbzOfkE.cjs} +33 -31
- package/dist/cjs/{OLPGrpcApi-BqcMEdma.cjs → OLPGrpcApi-BNAfesZy.cjs} +2 -2
- package/dist/cjs/{QueryTradingStrategyContractTotalStrategies-CbfuOlxa.cjs → QueryTradingStrategyContractTotalStrategies-i7GNf-2z.cjs} +29 -29
- package/dist/cjs/{StreamManagerV2-Bo7m_nUZ.cjs → StreamManagerV2-qxdppofP.cjs} +72 -71
- package/dist/cjs/{TcAbacusGrpcApi-7a0vFnWK.cjs → TcAbacusGrpcApi-DRKR_enO.cjs} +2 -2
- package/dist/cjs/{accounts-gu3aR3dJ.cjs → accounts-pXwUOxWb.cjs} +38 -35
- package/dist/cjs/address-light-B5-DYwES.d.cts +14 -0
- package/dist/cjs/address-light-C_a6b8yF.cjs +114 -0
- package/dist/cjs/{chain-lo3Cyc0M.cjs → chain-DHppVc1K.cjs} +36 -35
- package/dist/cjs/client/abacus.cjs +6 -5
- package/dist/cjs/client/abacus.d.cts +5 -4
- package/dist/cjs/client/chain.cjs +14 -9
- package/dist/cjs/client/chain.d.cts +14 -9
- package/dist/cjs/client/indexer.cjs +15 -10
- package/dist/cjs/client/indexer.d.cts +14 -9
- package/dist/cjs/client/olp.cjs +7 -6
- package/dist/cjs/client/olp.d.cts +5 -4
- package/dist/cjs/client/tcAbacus.cjs +6 -5
- package/dist/cjs/client/tcAbacus.d.cts +5 -4
- package/dist/cjs/client/wasm.cjs +17 -12
- package/dist/cjs/client/wasm.d.cts +4 -3
- package/dist/cjs/coins-DRrEtaSG.cjs +20 -0
- package/dist/cjs/coins-JbAREn6e.d.cts +7 -0
- package/dist/cjs/constants-DSzHAIp3.d.cts +10 -0
- package/dist/cjs/constants-tPGACRGC.cjs +53 -0
- package/dist/cjs/core/accounts.cjs +9 -5
- package/dist/cjs/core/accounts.d.cts +14 -9
- package/dist/cjs/core/modules.cjs +20 -15
- package/dist/cjs/core/modules.d.cts +14 -9
- package/dist/cjs/core/tx.cjs +17 -12
- package/dist/cjs/core/tx.d.cts +14 -9
- package/dist/cjs/cosmjs.cjs +18 -13
- package/dist/cjs/cosmjs.d.cts +2 -2
- package/dist/cjs/encoding-light-CrQ0cICT.d.cts +18 -0
- package/dist/cjs/encoding-light-D96nxVLW.cjs +176 -0
- package/dist/cjs/exports.cjs +18 -13
- package/dist/cjs/exports.d.cts +2 -2
- package/dist/cjs/{index-DfNpbUN6.d.cts → index-2SjhKIkh.d.cts} +1 -1
- package/dist/cjs/{index-BEK8esHW.d.cts → index-BEwaspW_.d.cts} +7 -188
- package/dist/{esm/index-DCxzFRMk.d.ts → cjs/index-BG-nzcNI.d.cts} +3 -146
- package/dist/cjs/{index-uJW9LUqV.d.cts → index-BOj_EXVL.d.cts} +1 -1
- package/dist/cjs/{index-D3pv75E_.d.cts → index-BaPRB8bU.d.cts} +1 -1
- package/dist/cjs/{index-Ckay0hId.d.cts → index-CtkDjIwH.d.cts} +2 -2
- package/dist/cjs/{index-DiXeIFAS.d.cts → index-D5xZvGoG.d.cts} +1 -1
- package/dist/{esm/index-Bw9qjGRX.d.ts → cjs/index-DmanIXY9.d.cts} +2 -1
- package/dist/cjs/index.cjs +74 -67
- package/dist/cjs/index.d.cts +15 -10
- package/dist/cjs/light-4nNsYXxr.d.cts +241 -0
- package/dist/cjs/light-CrajlUvd.cjs +298 -0
- package/dist/cjs/proto/cosmos-tx.d.cts +1 -1
- package/dist/cjs/{service-2B8kFWdK.cjs → service-nm5Ct4_w.cjs} +18 -18
- package/dist/cjs/service.cjs +11 -6
- package/dist/cjs/service.d.cts +4 -3
- package/dist/cjs/stream-CcqYpdwJ.cjs +20 -0
- package/dist/cjs/{tx-C2jfAA8Y.cjs → tx-BlFLQ52d.cjs} +14 -13
- package/dist/cjs/types/light.cjs +20 -0
- package/dist/cjs/types/light.d.cts +2 -0
- package/dist/cjs/types-BJpWW-Rx.cjs +37 -0
- package/dist/cjs/types.cjs +14 -13
- package/dist/cjs/types.d.cts +3 -2
- package/dist/cjs/utils/address.cjs +13 -0
- package/dist/cjs/utils/address.d.cts +2 -0
- package/dist/cjs/utils/constants.cjs +9 -0
- package/dist/cjs/utils/constants.d.cts +2 -0
- package/dist/cjs/utils/encoding.cjs +17 -0
- package/dist/cjs/utils/encoding.d.cts +2 -0
- package/dist/cjs/utils/light.cjs +39 -0
- package/dist/cjs/utils/light.d.cts +5 -0
- package/dist/cjs/{utils-DbzXsOHS.cjs → utils-CH1Ojxun.cjs} +132 -592
- package/dist/cjs/utils.cjs +40 -34
- package/dist/cjs/utils.d.cts +15 -10
- package/dist/esm/{AbacusGrpcApi-CtwUxhbH.js → AbacusGrpcApi-DVO7c0mB.js} +2 -2
- package/dist/esm/{BaseGrpcConsumer-C2_ejXG6.js → BaseGrpcConsumer-Ci8sUY5h.js} +3 -3
- package/dist/esm/{BaseGrpcConsumer-C8YhjVn6.d.ts → BaseGrpcConsumer-DnPFbzJi.d.ts} +1 -1
- package/dist/esm/{BaseIndexerGrpcConsumer-B7ubNh4y.js → BaseIndexerGrpcConsumer-MGB306RP.js} +1 -1
- package/dist/esm/{ChainGrpcExchangeApi-46tg3Hzg.js → ChainGrpcExchangeApi-S5nJzebX.js} +4 -4
- package/dist/esm/{ChainRestTendermintApi-J6BTcNft.js → ChainRestTendermintApi-D_FQwKrf.js} +5 -4
- package/dist/esm/{DirectEthSecp256k1Wallet-DOuSBBhp.js → DirectEthSecp256k1Wallet-Daky9CEn.js} +3 -3
- package/dist/esm/{ExecArgNeptuneWithdraw-DiiRJIyN.js → ExecArgNeptuneWithdraw-ljDnPI2p.js} +4 -3
- package/dist/esm/{IndexerGrpcWeb3GwApi-43sbzWOe.js → IndexerGrpcWeb3GwApi-BWuDmOjX.js} +4 -3
- package/dist/esm/{MsgBase-C7o5mYq2.js → MsgBase-CishJWMN.js} +1 -1
- package/dist/esm/{MsgSetDenomMetadata-k1Be2o9j.js → MsgSetDenomMetadata-B4Ke5u9_.js} +8 -6
- package/dist/esm/{OLPGrpcApi-DJHRAhPY.js → OLPGrpcApi-BSFkBk80.js} +2 -2
- package/dist/esm/{QueryTradingStrategyContractTotalStrategies-NvpGnD6O.js → QueryTradingStrategyContractTotalStrategies-Cfz9KGFD.js} +4 -4
- package/dist/esm/{StreamManagerV2-DiRDW-5W.js → StreamManagerV2-CLqrfNTn.js} +9 -8
- package/dist/esm/{TcAbacusGrpcApi-Dat50xET.js → TcAbacusGrpcApi-k3COziPh.js} +2 -2
- package/dist/esm/{accounts-Bu0DRjk4.js → accounts-3rypojw1.js} +6 -3
- package/dist/esm/address-light-BcZDS-ks.d.ts +14 -0
- package/dist/esm/address-light-C9skTx0P.js +48 -0
- package/dist/esm/{chain-DDGdMRsP.js → chain-DD4YqzP5.js} +6 -5
- package/dist/esm/client/abacus.d.ts +5 -4
- package/dist/esm/client/abacus.js +6 -5
- package/dist/esm/client/chain.d.ts +14 -9
- package/dist/esm/client/chain.js +14 -9
- package/dist/esm/client/indexer.d.ts +14 -9
- package/dist/esm/client/indexer.js +15 -10
- package/dist/esm/client/olp.d.ts +5 -4
- package/dist/esm/client/olp.js +7 -6
- package/dist/esm/client/tcAbacus.d.ts +5 -4
- package/dist/esm/client/tcAbacus.js +6 -5
- package/dist/esm/client/wasm.d.ts +4 -3
- package/dist/esm/client/wasm.js +17 -12
- package/dist/esm/coins-D4vONigS.js +14 -0
- package/dist/esm/coins-ceq0Id0M.d.ts +7 -0
- package/dist/esm/constants-BZ28P_pH.d.ts +10 -0
- package/dist/esm/constants-CCVyqUU9.js +11 -0
- package/dist/esm/core/accounts.d.ts +14 -9
- package/dist/esm/core/accounts.js +9 -5
- package/dist/esm/core/modules.d.ts +14 -9
- package/dist/esm/core/modules.js +20 -15
- package/dist/esm/core/tx.d.ts +14 -9
- package/dist/esm/core/tx.js +17 -12
- package/dist/esm/cosmjs.d.ts +2 -2
- package/dist/esm/cosmjs.js +18 -13
- package/dist/esm/encoding-light-18k0e_8v.d.ts +18 -0
- package/dist/esm/encoding-light-DHtTGSg1.js +86 -0
- package/dist/esm/exports.d.ts +2 -2
- package/dist/esm/exports.js +18 -13
- package/dist/{cjs/index-DpsYFbif.d.cts → esm/index-81riAHnR.d.ts} +2 -1
- package/dist/esm/{index-JlA-uSsc.d.ts → index-B73CV7nM.d.ts} +1 -1
- package/dist/{cjs/index-DYAz6OYS.d.cts → esm/index-BJJNBulw.d.ts} +3 -146
- package/dist/esm/{index-DA42BIjg.d.ts → index-CFTXl2dv.d.ts} +1 -1
- package/dist/esm/{index-BrfNx2yV.d.ts → index-D3kPbyYA.d.ts} +1 -1
- package/dist/esm/{index-CZhX_Ynf.d.ts → index-DcPKOj0m.d.ts} +2 -2
- package/dist/esm/{index-CTAobhk3.d.ts → index-DuNPINdp.d.ts} +7 -188
- package/dist/esm/{index-B0mpSZSK.d.ts → index-SZeXNgo8.d.ts} +1 -1
- package/dist/esm/index.d.ts +15 -10
- package/dist/esm/index.js +29 -24
- package/dist/esm/light-BflupdEX.js +190 -0
- package/dist/esm/light-Cr4m0DAA.d.ts +241 -0
- package/dist/esm/proto/cosmos-tx.d.ts +1 -1
- package/dist/esm/{service-Uo4J-lwR.js → service-BER-mZkG.js} +3 -3
- package/dist/esm/service.d.ts +4 -3
- package/dist/esm/service.js +11 -6
- package/dist/esm/stream-BqkNM_6g.js +14 -0
- package/dist/esm/{tx-Ajrd7cHg.js → tx-Pg714BW8.js} +7 -6
- package/dist/esm/types/light.d.ts +2 -0
- package/dist/esm/types/light.js +3 -0
- package/dist/esm/types-BAV0654v.js +24 -0
- package/dist/esm/types.d.ts +3 -2
- package/dist/esm/types.js +3 -2
- package/dist/esm/utils/address.d.ts +2 -0
- package/dist/esm/utils/address.js +3 -0
- package/dist/esm/utils/constants.d.ts +2 -0
- package/dist/esm/utils/constants.js +3 -0
- package/dist/esm/utils/encoding.d.ts +2 -0
- package/dist/esm/utils/encoding.js +3 -0
- package/dist/esm/utils/light.d.ts +5 -0
- package/dist/esm/utils/light.js +6 -0
- package/dist/esm/{utils-bfl-Zimr.js → utils-B3t50ZnB.js} +125 -393
- package/dist/esm/utils.d.ts +15 -10
- package/dist/esm/utils.js +7 -3
- package/package.json +105 -5
- package/dist/cjs/stream-CfBvG3Ln.cjs +0 -87
- package/dist/cjs/types-Cn54Lzf-.cjs +0 -161
- package/dist/esm/stream-Cdx47Nhx.js +0 -63
- package/dist/esm/types-DQ7rwavH.js +0 -100
- /package/dist/cjs/{BaseRestConsumer-uSzCOit7.cjs → BaseRestConsumer-BcHgNcNh.cjs} +0 -0
- /package/dist/cjs/{defineProperty-DAtJs5JQ.cjs → defineProperty-C3FP2y9Y.cjs} +0 -0
- /package/dist/cjs/{grpc-FG2z-ICE.cjs → grpc-3Z8ffFdZ.cjs} +0 -0
- /package/dist/cjs/{tx_pb-7h617od9.d.cts → tx_pb-BmZhAoWC.d.cts} +0 -0
- /package/dist/esm/{BaseRestConsumer-DMS02DwS.js → BaseRestConsumer-L3j9-i4T.js} +0 -0
- /package/dist/esm/{defineProperty-CmydwPCD.js → defineProperty-C0TI9N8m.js} +0 -0
- /package/dist/esm/{grpc-lYZqzL0k.js → grpc-aI_RLGoG.js} +0 -0
- /package/dist/esm/{tx_pb-Bb9pvoP6.d.ts → tx_pb-DhFh6sWY.d.ts} +0 -0
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
2
|
+
const require_encoding_light = require('./encoding-light-D96nxVLW.cjs');
|
|
3
|
+
const require_constants = require('./constants-tPGACRGC.cjs');
|
|
4
|
+
const require_defineProperty = require('./defineProperty-C3FP2y9Y.cjs');
|
|
5
|
+
const require_utils = require('./utils-CH1Ojxun.cjs');
|
|
6
|
+
const require_address_light = require('./address-light-C_a6b8yF.cjs');
|
|
7
|
+
const require_MsgBase = require('./MsgBase-BJmf0IHm.cjs');
|
|
5
8
|
let __injectivelabs_core_proto_ts_v2_generated_cosmos_tx_v1beta1_tx_pb = require("@injectivelabs/core-proto-ts-v2/generated/cosmos/tx/v1beta1/tx_pb");
|
|
6
9
|
__injectivelabs_core_proto_ts_v2_generated_cosmos_tx_v1beta1_tx_pb = require_chunk.__toESM(__injectivelabs_core_proto_ts_v2_generated_cosmos_tx_v1beta1_tx_pb);
|
|
7
10
|
let viem = require("viem");
|
|
@@ -48,9 +51,9 @@ var Address = class Address {
|
|
|
48
51
|
* @return {Address}
|
|
49
52
|
* @throws {Error} if bech is not a valid bech32-encoded address
|
|
50
53
|
*/
|
|
51
|
-
static fromBech32(bech, prefix =
|
|
54
|
+
static fromBech32(bech, prefix = require_constants.BECH32_ADDR_ACC_PREFIX) {
|
|
52
55
|
try {
|
|
53
|
-
const address =
|
|
56
|
+
const address = require_encoding_light.uint8ArrayToHex(__scure_base.bech32.fromWords(__scure_base.bech32.decode(bech).words));
|
|
54
57
|
const addressBuffer = (0, viem.toBytes)((address.startsWith("0x") ? address : `0x${address}`).toString());
|
|
55
58
|
return new Address(__scure_base.bech32.encode(prefix, __scure_base.bech32.toWords(addressBuffer)));
|
|
56
59
|
} catch (e) {
|
|
@@ -64,7 +67,7 @@ var Address = class Address {
|
|
|
64
67
|
* @return {Address}
|
|
65
68
|
* @throws {Error} if bech is not a valid bech32-encoded address
|
|
66
69
|
*/
|
|
67
|
-
static fromHex(hex, prefix =
|
|
70
|
+
static fromHex(hex, prefix = require_constants.BECH32_ADDR_ACC_PREFIX) {
|
|
68
71
|
const addressBuffer = (0, viem.toBytes)((hex.startsWith("0x") ? hex : `0x${hex}`).toString());
|
|
69
72
|
return new Address(__scure_base.bech32.encode(prefix, __scure_base.bech32.toWords(addressBuffer)));
|
|
70
73
|
}
|
|
@@ -73,7 +76,7 @@ var Address = class Address {
|
|
|
73
76
|
* @param {string} prefix
|
|
74
77
|
* @returns {string}
|
|
75
78
|
*/
|
|
76
|
-
toBech32(prefix =
|
|
79
|
+
toBech32(prefix = require_constants.BECH32_ADDR_ACC_PREFIX) {
|
|
77
80
|
const address = this.toHex();
|
|
78
81
|
const addressBuffer = (0, viem.toBytes)(address.startsWith("0x") ? address : `0x${address}`);
|
|
79
82
|
return __scure_base.bech32.encode(prefix, __scure_base.bech32.toWords(addressBuffer));
|
|
@@ -84,7 +87,7 @@ var Address = class Address {
|
|
|
84
87
|
* @throws {Error} if this address is not a valid account address
|
|
85
88
|
* */
|
|
86
89
|
toAccountAddress() {
|
|
87
|
-
return this.toBech32(
|
|
90
|
+
return this.toBech32(require_constants.BECH32_ADDR_ACC_PREFIX);
|
|
88
91
|
}
|
|
89
92
|
/**
|
|
90
93
|
* Return a bech32-encoded validator address
|
|
@@ -92,7 +95,7 @@ var Address = class Address {
|
|
|
92
95
|
* @throws {Error} if this address is not a valid validator address
|
|
93
96
|
* */
|
|
94
97
|
toValidatorAddress() {
|
|
95
|
-
return this.toBech32(
|
|
98
|
+
return this.toBech32(require_constants.BECH32_ADDR_VAL_PREFIX);
|
|
96
99
|
}
|
|
97
100
|
/**
|
|
98
101
|
* Return a bech32-encoded consensus address
|
|
@@ -100,7 +103,7 @@ var Address = class Address {
|
|
|
100
103
|
* @throws {Error} if this address is not a valid consensus address
|
|
101
104
|
* */
|
|
102
105
|
toConsensusAddress() {
|
|
103
|
-
return this.toBech32(
|
|
106
|
+
return this.toBech32(require_constants.BECH32_ADDR_CONS_PREFIX);
|
|
104
107
|
}
|
|
105
108
|
/**
|
|
106
109
|
* Return a hex representation of address
|
|
@@ -109,7 +112,7 @@ var Address = class Address {
|
|
|
109
112
|
* */
|
|
110
113
|
toHex() {
|
|
111
114
|
const { bech32Address } = this;
|
|
112
|
-
const address =
|
|
115
|
+
const address = require_encoding_light.uint8ArrayToHex(__scure_base.bech32.fromWords(__scure_base.bech32.decode(bech32Address).words));
|
|
113
116
|
return address.startsWith("0x") ? address : `0x${address}`;
|
|
114
117
|
}
|
|
115
118
|
/**
|
|
@@ -145,40 +148,40 @@ var PublicKey = class PublicKey {
|
|
|
145
148
|
this.type = type || "/injective.crypto.v1beta1.ethsecp256k1.PubKey";
|
|
146
149
|
}
|
|
147
150
|
static fromBase64(publicKey) {
|
|
148
|
-
return new PublicKey(
|
|
151
|
+
return new PublicKey(require_encoding_light.base64ToUint8Array(publicKey));
|
|
149
152
|
}
|
|
150
153
|
static fromBytes(publicKey) {
|
|
151
154
|
return new PublicKey(publicKey);
|
|
152
155
|
}
|
|
153
156
|
static fromHex(pubKey) {
|
|
154
|
-
return new PublicKey(
|
|
157
|
+
return new PublicKey(require_encoding_light.hexToUint8Array((pubKey.startsWith("0x") ? pubKey.slice(2) : pubKey).toString()));
|
|
155
158
|
}
|
|
156
159
|
static fromPrivateKeyHex(privateKey) {
|
|
157
160
|
const isString = typeof privateKey === "string";
|
|
158
161
|
const privateKeyHex = isString && privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
159
|
-
const privateKeyBuff = isString ?
|
|
162
|
+
const privateKeyBuff = isString ? require_encoding_light.hexToUint8Array(privateKeyHex.toString()) : privateKey;
|
|
160
163
|
return new PublicKey(__noble_curves_secp256k1.secp256k1.getPublicKey(privateKeyBuff, true), "/injective.crypto.v1beta1.ethsecp256k1.PubKey");
|
|
161
164
|
}
|
|
162
165
|
toPubKeyBytes() {
|
|
163
166
|
return this.key;
|
|
164
167
|
}
|
|
165
168
|
toBase64() {
|
|
166
|
-
return
|
|
169
|
+
return require_encoding_light.uint8ArrayToBase64(this.toPubKeyBytes());
|
|
167
170
|
}
|
|
168
171
|
toHex() {
|
|
169
|
-
return
|
|
172
|
+
return require_encoding_light.uint8ArrayToHex(this.toPubKeyBytes());
|
|
170
173
|
}
|
|
171
174
|
/**
|
|
172
175
|
* Convert the public key to a pubkey in bech32 format.
|
|
173
176
|
* Note: this does not convert the public key to an address.
|
|
174
177
|
*/
|
|
175
178
|
toBech32() {
|
|
176
|
-
return __scure_base.bech32.encode(
|
|
179
|
+
return __scure_base.bech32.encode(require_constants.BECH32_PUBKEY_ACC_PREFIX, __scure_base.bech32.toWords(require_encoding_light.hexToUint8Array(this.toHex())));
|
|
177
180
|
}
|
|
178
181
|
toAddress() {
|
|
179
182
|
const decompressedPublicKey = require_utils.decompressPubKey(this.toHex());
|
|
180
183
|
const addressBuffer = (0, viem.keccak256)((0, viem.toBytes)(decompressedPublicKey.startsWith("0x") ? decompressedPublicKey : "0x" + decompressedPublicKey), "bytes").subarray(-20);
|
|
181
|
-
return Address.fromHex(
|
|
184
|
+
return Address.fromHex(require_encoding_light.uint8ArrayToHex(addressBuffer).toLowerCase());
|
|
182
185
|
}
|
|
183
186
|
toProto() {
|
|
184
187
|
const proto = __injectivelabs_core_proto_ts_v2_generated_injective_crypto_v1beta1_ethsecp256k1_keys_pb.PubKey.create();
|
|
@@ -211,13 +214,13 @@ const createAny = (value, type) => {
|
|
|
211
214
|
const getInjectiveSignerAddress = (address) => {
|
|
212
215
|
if (!address) return "";
|
|
213
216
|
if (address.startsWith("inj")) return address;
|
|
214
|
-
if (address.startsWith("0x")) return
|
|
217
|
+
if (address.startsWith("0x")) return require_address_light.getInjectiveAddress(address);
|
|
215
218
|
return address;
|
|
216
219
|
};
|
|
217
220
|
const getEthereumSignerAddress = (address) => {
|
|
218
221
|
if (!address) return "";
|
|
219
222
|
if (address.startsWith("0x")) return address;
|
|
220
|
-
if (address.startsWith("inj")) return
|
|
223
|
+
if (address.startsWith("inj")) return require_address_light.getEthereumAddress(address);
|
|
221
224
|
return `0x${address}`;
|
|
222
225
|
};
|
|
223
226
|
|
|
@@ -241,7 +244,7 @@ const getPublicKey = ({ chainId, key }) => {
|
|
|
241
244
|
baseProto = __injectivelabs_core_proto_ts_v2_generated_cosmos_crypto_secp256k1_keys_pb.PubKey;
|
|
242
245
|
path = "/cosmos.crypto.secp256k1.PubKey";
|
|
243
246
|
}
|
|
244
|
-
proto.key =
|
|
247
|
+
proto.key = require_encoding_light.base64ToUint8Array(key);
|
|
245
248
|
return createAny(baseProto.toBinary(proto), path);
|
|
246
249
|
};
|
|
247
250
|
const createBody = ({ message, memo = "", timeoutHeight }) => {
|
|
@@ -604,8 +607,8 @@ var MsgSignData = class MsgSignData extends require_MsgBase.MsgBase {
|
|
|
604
607
|
toProto() {
|
|
605
608
|
const { params } = this;
|
|
606
609
|
return __injectivelabs_core_proto_ts_v2_generated_injective_exchange_v1beta1_tx_pb.MsgSignData.create({
|
|
607
|
-
signer:
|
|
608
|
-
data:
|
|
610
|
+
signer: require_encoding_light.hexToUint8Array(require_address_light.getEthereumAddress(params.sender)),
|
|
611
|
+
data: require_encoding_light.stringToUint8Array(require_encoding_light.toUtf8(params.data))
|
|
609
612
|
});
|
|
610
613
|
}
|
|
611
614
|
toData() {
|
|
@@ -620,8 +623,8 @@ var MsgSignData = class MsgSignData extends require_MsgBase.MsgBase {
|
|
|
620
623
|
return {
|
|
621
624
|
type: "sign/MsgSignData",
|
|
622
625
|
value: {
|
|
623
|
-
signer:
|
|
624
|
-
data:
|
|
626
|
+
signer: require_encoding_light.uint8ArrayToHex(proto.signer),
|
|
627
|
+
data: require_encoding_light.toUtf8(proto.data)
|
|
625
628
|
}
|
|
626
629
|
};
|
|
627
630
|
}
|
|
@@ -832,8 +835,8 @@ var MsgDecoder = class {
|
|
|
832
835
|
case type.includes("MsgSignData"): {
|
|
833
836
|
const msg = __injectivelabs_core_proto_ts_v2_generated_injective_exchange_v1beta1_tx_pb.MsgSignData.fromBinary(message.value);
|
|
834
837
|
return MsgSignData.fromJSON({
|
|
835
|
-
data:
|
|
836
|
-
sender:
|
|
838
|
+
data: require_encoding_light.toUtf8(msg.data),
|
|
839
|
+
sender: require_address_light.getInjectiveAddress(require_encoding_light.uint8ArrayToHex(msg.signer))
|
|
837
840
|
});
|
|
838
841
|
}
|
|
839
842
|
default: throw new Error("Unknown message type");
|
|
@@ -871,7 +874,7 @@ var PrivateKey = class PrivateKey {
|
|
|
871
874
|
* @param {string|undefined} path the HD path that follows the BIP32 standard (optional)
|
|
872
875
|
* @returns {PrivateKey} Initialized PrivateKey object
|
|
873
876
|
*/
|
|
874
|
-
static fromMnemonic(words, path =
|
|
877
|
+
static fromMnemonic(words, path = require_constants.DEFAULT_DERIVATION_PATH) {
|
|
875
878
|
return new PrivateKey(new ethers.Wallet(ethers.HDNodeWallet.fromPhrase(words, void 0, path).privateKey));
|
|
876
879
|
}
|
|
877
880
|
/**
|
|
@@ -894,7 +897,7 @@ var PrivateKey = class PrivateKey {
|
|
|
894
897
|
static fromHex(privateKey) {
|
|
895
898
|
const isString = typeof privateKey === "string";
|
|
896
899
|
const privateKeyHex = isString && privateKey.startsWith("0x") ? privateKey.slice(2) : privateKey;
|
|
897
|
-
return new PrivateKey(new ethers.Wallet(
|
|
900
|
+
return new PrivateKey(new ethers.Wallet(require_encoding_light.uint8ArrayToHex(isString ? require_encoding_light.hexToUint8Array(privateKeyHex.toString()) : privateKey)));
|
|
898
901
|
}
|
|
899
902
|
/**
|
|
900
903
|
* Return the private key in hex
|
|
@@ -951,7 +954,7 @@ var PrivateKey = class PrivateKey {
|
|
|
951
954
|
signEcda(messageBytes) {
|
|
952
955
|
const { wallet } = this;
|
|
953
956
|
const msgHash = (0, viem.keccak256)(messageBytes);
|
|
954
|
-
const privateKey =
|
|
957
|
+
const privateKey = require_encoding_light.hexToUint8Array(wallet.privateKey.startsWith("0x") ? wallet.privateKey.slice(2) : wallet.privateKey);
|
|
955
958
|
return __noble_curves_secp256k1.secp256k1.sign((0, viem.toBytes)(msgHash), privateKey).toCompactRawBytes();
|
|
956
959
|
}
|
|
957
960
|
/**
|
|
@@ -972,7 +975,7 @@ var PrivateKey = class PrivateKey {
|
|
|
972
975
|
*/
|
|
973
976
|
signHashedEcda(messageHashedBytes) {
|
|
974
977
|
const { wallet } = this;
|
|
975
|
-
const privateKey =
|
|
978
|
+
const privateKey = require_encoding_light.hexToUint8Array(wallet.privateKey.startsWith("0x") ? wallet.privateKey.slice(2) : wallet.privateKey);
|
|
976
979
|
return __noble_curves_secp256k1.secp256k1.sign(messageHashedBytes, privateKey).toCompactRawBytes();
|
|
977
980
|
}
|
|
978
981
|
/**
|
|
@@ -984,7 +987,7 @@ var PrivateKey = class PrivateKey {
|
|
|
984
987
|
const { wallet } = this;
|
|
985
988
|
const privateKeyHex = wallet.privateKey.startsWith("0x") ? wallet.privateKey.slice(2) : wallet.privateKey;
|
|
986
989
|
const msgHashBytes = (0, viem.hashTypedData)(require_utils.TypedDataUtilsSanitizeData(eip712Data));
|
|
987
|
-
const privateKey =
|
|
990
|
+
const privateKey = require_encoding_light.hexToUint8Array(privateKeyHex);
|
|
988
991
|
const sig = __noble_curves_secp256k1.secp256k1.sign((0, viem.toBytes)(msgHashBytes), privateKey);
|
|
989
992
|
const signature = sig.toCompactRawBytes();
|
|
990
993
|
const signatureWithRecovery = new Uint8Array(signature.length + 1);
|
|
@@ -999,7 +1002,7 @@ var PrivateKey = class PrivateKey {
|
|
|
999
1002
|
*/
|
|
1000
1003
|
signHashedTypedData(eip712Data) {
|
|
1001
1004
|
const { wallet } = this;
|
|
1002
|
-
const privateKey =
|
|
1005
|
+
const privateKey = require_encoding_light.hexToUint8Array(wallet.privateKey.startsWith("0x") ? wallet.privateKey.slice(2) : wallet.privateKey);
|
|
1003
1006
|
return __noble_curves_secp256k1.secp256k1.sign(eip712Data, privateKey).toCompactRawBytes();
|
|
1004
1007
|
}
|
|
1005
1008
|
/**
|
|
@@ -1091,8 +1094,8 @@ var PrivateKey = class PrivateKey {
|
|
|
1091
1094
|
});
|
|
1092
1095
|
return await this.verifySignature({
|
|
1093
1096
|
eip712: eip712TypedData,
|
|
1094
|
-
signature:
|
|
1095
|
-
publicKey:
|
|
1097
|
+
signature: require_encoding_light.uint8ArrayToHex(signature),
|
|
1098
|
+
publicKey: require_encoding_light.uint8ArrayToHex(require_encoding_light.base64ToUint8Array(signer.publicKey))
|
|
1096
1099
|
});
|
|
1097
1100
|
}
|
|
1098
1101
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/utils/address-light.d.ts
|
|
2
|
+
declare const bytesToHex: (bytes: number[] | Uint8Array) => string;
|
|
3
|
+
declare const hexToBytes: (hex: string) => Uint8Array;
|
|
4
|
+
declare const getInjectiveAddress: (ethAddress: string) => string;
|
|
5
|
+
declare const getEthereumAddress: (injectiveAddress: string) => string;
|
|
6
|
+
declare const getInjectiveAddressFromSubaccountId: (subaccountId: string) => string;
|
|
7
|
+
declare const getDefaultSubaccountId: (injectiveAddress: string) => string;
|
|
8
|
+
declare const getSubaccountId: (injectiveAddress: string, nonce?: number) => string;
|
|
9
|
+
declare const getAddressFromInjectiveAddress: (address: string) => string;
|
|
10
|
+
declare const isCw20ContractAddress: (address: string) => boolean;
|
|
11
|
+
declare const addHexPrefix: (hex: string) => string;
|
|
12
|
+
declare const removeHexPrefix: (hex: string) => string;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { getEthereumAddress as a, getSubaccountId as c, removeHexPrefix as d, getDefaultSubaccountId as i, hexToBytes as l, bytesToHex as n, getInjectiveAddress as o, getAddressFromInjectiveAddress as r, getInjectiveAddressFromSubaccountId as s, addHexPrefix as t, isCw20ContractAddress as u };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
+
let __scure_base = require("@scure/base");
|
|
3
|
+
|
|
4
|
+
//#region src/utils/address-light.ts
|
|
5
|
+
const HEX_PATTERN = /^[0-9a-fA-F]*$/;
|
|
6
|
+
const normalizeHex = (hex) => {
|
|
7
|
+
const actualHex = removeHexPrefix(hex);
|
|
8
|
+
if (!HEX_PATTERN.test(actualHex) || actualHex.length % 2 !== 0) throw new Error(`Invalid hex string: ${hex}`);
|
|
9
|
+
return actualHex;
|
|
10
|
+
};
|
|
11
|
+
const getInjectiveAddressBytes = (injectiveAddress) => {
|
|
12
|
+
return __scure_base.bech32.fromWords(__scure_base.bech32.decode(injectiveAddress).words);
|
|
13
|
+
};
|
|
14
|
+
const bytesToHex = (bytes) => Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
15
|
+
const hexToBytes = (hex) => {
|
|
16
|
+
var _actualHex$match;
|
|
17
|
+
const actualHex = normalizeHex(hex);
|
|
18
|
+
return Uint8Array.from(((_actualHex$match = actualHex.match(/.{1,2}/g)) === null || _actualHex$match === void 0 ? void 0 : _actualHex$match.map((byte) => Number.parseInt(byte, 16))) || []);
|
|
19
|
+
};
|
|
20
|
+
const getInjectiveAddress = (ethAddress) => {
|
|
21
|
+
const addressBytes = hexToBytes(ethAddress);
|
|
22
|
+
if (addressBytes.length !== 20) throw new Error(`Invalid Ethereum address: ${ethAddress}`);
|
|
23
|
+
return __scure_base.bech32.encode("inj", __scure_base.bech32.toWords(addressBytes));
|
|
24
|
+
};
|
|
25
|
+
const getEthereumAddress = (injectiveAddress) => {
|
|
26
|
+
if (injectiveAddress.startsWith("0x")) return injectiveAddress;
|
|
27
|
+
return `0x${bytesToHex(getInjectiveAddressBytes(injectiveAddress))}`;
|
|
28
|
+
};
|
|
29
|
+
const getInjectiveAddressFromSubaccountId = (subaccountId) => {
|
|
30
|
+
return getInjectiveAddress(subaccountId.slice(0, 42));
|
|
31
|
+
};
|
|
32
|
+
const getDefaultSubaccountId = (injectiveAddress) => {
|
|
33
|
+
return `0x${bytesToHex(getInjectiveAddressBytes(injectiveAddress))}${"0".repeat(24)}`;
|
|
34
|
+
};
|
|
35
|
+
const getSubaccountId = (injectiveAddress, nonce = 0) => {
|
|
36
|
+
const bytes = getInjectiveAddressBytes(injectiveAddress);
|
|
37
|
+
if (!Number.isInteger(nonce) || nonce < 0 || nonce > 255) throw new Error("Invalid nonce, must be an integer between 0 and 255");
|
|
38
|
+
const nonceInHex = nonce.toString(16).padStart(2, "0");
|
|
39
|
+
return `0x${bytesToHex(bytes)}${"0".repeat(22)}${nonceInHex}`;
|
|
40
|
+
};
|
|
41
|
+
const getAddressFromInjectiveAddress = (address) => {
|
|
42
|
+
return getEthereumAddress(address);
|
|
43
|
+
};
|
|
44
|
+
const isCw20ContractAddress = (address) => address.length === 42 && address.startsWith("inj");
|
|
45
|
+
const addHexPrefix = (hex) => hex.startsWith("0x") ? hex : `0x${hex}`;
|
|
46
|
+
const removeHexPrefix = (hex) => hex.replace(/^0x/i, "");
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
Object.defineProperty(exports, 'addHexPrefix', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return addHexPrefix;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, 'bytesToHex', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return bytesToHex;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, 'getAddressFromInjectiveAddress', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return getAddressFromInjectiveAddress;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, 'getDefaultSubaccountId', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return getDefaultSubaccountId;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'getEthereumAddress', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return getEthereumAddress;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, 'getInjectiveAddress', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return getInjectiveAddress;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, 'getInjectiveAddressFromSubaccountId', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return getInjectiveAddressFromSubaccountId;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, 'getSubaccountId', {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return getSubaccountId;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
Object.defineProperty(exports, 'hexToBytes', {
|
|
98
|
+
enumerable: true,
|
|
99
|
+
get: function () {
|
|
100
|
+
return hexToBytes;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, 'isCw20ContractAddress', {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () {
|
|
106
|
+
return isCw20ContractAddress;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
Object.defineProperty(exports, 'removeHexPrefix', {
|
|
110
|
+
enumerable: true,
|
|
111
|
+
get: function () {
|
|
112
|
+
return removeHexPrefix;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const
|
|
3
|
-
const require_defineProperty = require('./defineProperty-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
const require_encoding_light = require('./encoding-light-D96nxVLW.cjs');
|
|
3
|
+
const require_defineProperty = require('./defineProperty-C3FP2y9Y.cjs');
|
|
4
|
+
const require_utils = require('./utils-CH1Ojxun.cjs');
|
|
5
|
+
const require_ChainRestTendermintApi = require('./ChainRestTendermintApi-Sni05dAJ.cjs');
|
|
6
|
+
const require_BaseGrpcConsumer = require('./BaseGrpcConsumer-zA9DIfEw.cjs');
|
|
7
|
+
const require_BaseRestConsumer = require('./BaseRestConsumer-BcHgNcNh.cjs');
|
|
7
8
|
let __injectivelabs_utils = require("@injectivelabs/utils");
|
|
8
9
|
let __injectivelabs_exceptions = require("@injectivelabs/exceptions");
|
|
9
10
|
let __injectivelabs_core_proto_ts_v2_generated_cosmos_authz_v1beta1_authz_pb = require("@injectivelabs/core-proto-ts-v2/generated/cosmos/authz/v1beta1/authz_pb");
|
|
@@ -83,10 +84,10 @@ var ChainGrpcGovTransformer = class ChainGrpcGovTransformer {
|
|
|
83
84
|
expeditedVotingPeriod: Number((_params$expeditedVoti = params === null || params === void 0 || (_params$expeditedVoti2 = params.expeditedVotingPeriod) === null || _params$expeditedVoti2 === void 0 ? void 0 : _params$expeditedVoti2.seconds) !== null && _params$expeditedVoti !== void 0 ? _params$expeditedVoti : 0n)
|
|
84
85
|
},
|
|
85
86
|
tallyParams: {
|
|
86
|
-
quorum: !(params === null || params === void 0 ? void 0 : params.quorum) ? "0" : typeof params.quorum === "string" ? params.quorum :
|
|
87
|
-
threshold: !(params === null || params === void 0 ? void 0 : params.threshold) ? "0" : typeof params.threshold === "string" ? params.threshold :
|
|
88
|
-
vetoThreshold: !(params === null || params === void 0 ? void 0 : params.vetoThreshold) ? "0" : typeof params.vetoThreshold === "string" ? params.vetoThreshold :
|
|
89
|
-
expeditedThreshold: !(params === null || params === void 0 ? void 0 : params.expeditedThreshold) ? "0" : typeof params.expeditedThreshold === "string" ? params.expeditedThreshold :
|
|
87
|
+
quorum: !(params === null || params === void 0 ? void 0 : params.quorum) ? "0" : typeof params.quorum === "string" ? params.quorum : require_encoding_light.uint8ArrayToString(params.quorum),
|
|
88
|
+
threshold: !(params === null || params === void 0 ? void 0 : params.threshold) ? "0" : typeof params.threshold === "string" ? params.threshold : require_encoding_light.uint8ArrayToString(params.threshold),
|
|
89
|
+
vetoThreshold: !(params === null || params === void 0 ? void 0 : params.vetoThreshold) ? "0" : typeof params.vetoThreshold === "string" ? params.vetoThreshold : require_encoding_light.uint8ArrayToString(params.vetoThreshold),
|
|
90
|
+
expeditedThreshold: !(params === null || params === void 0 ? void 0 : params.expeditedThreshold) ? "0" : typeof params.expeditedThreshold === "string" ? params.expeditedThreshold : require_encoding_light.uint8ArrayToString(params.expeditedThreshold)
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
}
|
|
@@ -103,10 +104,10 @@ var ChainGrpcGovTransformer = class ChainGrpcGovTransformer {
|
|
|
103
104
|
expeditedVotingPeriod: Number((_votingParams$expedit = (_votingParams$expedit2 = votingParams.expeditedVotingPeriod) === null || _votingParams$expedit2 === void 0 ? void 0 : _votingParams$expedit2.seconds) !== null && _votingParams$expedit !== void 0 ? _votingParams$expedit : 0n)
|
|
104
105
|
},
|
|
105
106
|
tallyParams: {
|
|
106
|
-
quorum: typeof tallyParams.quorum === "string" ? tallyParams.quorum :
|
|
107
|
-
threshold: typeof tallyParams.threshold === "string" ? tallyParams.threshold :
|
|
108
|
-
vetoThreshold: typeof tallyParams.vetoThreshold === "string" ? tallyParams.vetoThreshold :
|
|
109
|
-
expeditedThreshold: typeof tallyParams.expeditedThreshold === "string" ? tallyParams.expeditedThreshold :
|
|
107
|
+
quorum: typeof tallyParams.quorum === "string" ? tallyParams.quorum : require_encoding_light.uint8ArrayToString(tallyParams.quorum),
|
|
108
|
+
threshold: typeof tallyParams.threshold === "string" ? tallyParams.threshold : require_encoding_light.uint8ArrayToString(tallyParams.threshold),
|
|
109
|
+
vetoThreshold: typeof tallyParams.vetoThreshold === "string" ? tallyParams.vetoThreshold : require_encoding_light.uint8ArrayToString(tallyParams.vetoThreshold),
|
|
110
|
+
expeditedThreshold: typeof tallyParams.expeditedThreshold === "string" ? tallyParams.expeditedThreshold : require_encoding_light.uint8ArrayToString(tallyParams.expeditedThreshold)
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
113
|
}
|
|
@@ -358,24 +359,24 @@ var ChainGrpcWasmTransformer = class ChainGrpcWasmTransformer {
|
|
|
358
359
|
static allContractStateResponseToContractAccountsBalanceWithPagination(response) {
|
|
359
360
|
const contractAccountsBalance = response.models.map((model) => {
|
|
360
361
|
return {
|
|
361
|
-
account:
|
|
362
|
-
balance:
|
|
362
|
+
account: require_encoding_light.uint8ArrayToString(model.key).split("balance").pop(),
|
|
363
|
+
balance: require_encoding_light.uint8ArrayToString(model.value).replace(/['"]+/g, "")
|
|
363
364
|
};
|
|
364
365
|
}).filter(({ account, balance }) => {
|
|
365
366
|
return account && account.startsWith("inj") && balance;
|
|
366
367
|
});
|
|
367
368
|
const contractInfoModel = response.models.find((model) => {
|
|
368
|
-
return
|
|
369
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "contract_info";
|
|
369
370
|
});
|
|
370
|
-
const contractInfoValue =
|
|
371
|
+
const contractInfoValue = require_encoding_light.uint8ArrayToString((contractInfoModel === null || contractInfoModel === void 0 ? void 0 : contractInfoModel.value) || new Uint8Array());
|
|
371
372
|
const tokenInfoModel = response.models.find((model) => {
|
|
372
|
-
return
|
|
373
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "token_info";
|
|
373
374
|
});
|
|
374
|
-
const tokenInfoValue =
|
|
375
|
+
const tokenInfoValue = require_encoding_light.uint8ArrayToString((tokenInfoModel === null || tokenInfoModel === void 0 ? void 0 : tokenInfoModel.value) || new Uint8Array());
|
|
375
376
|
const marketingInfoModel = response.models.find((model) => {
|
|
376
|
-
return
|
|
377
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "marketing_info";
|
|
377
378
|
});
|
|
378
|
-
const marketingInfoValue =
|
|
379
|
+
const marketingInfoValue = require_encoding_light.uint8ArrayToString((marketingInfoModel === null || marketingInfoModel === void 0 ? void 0 : marketingInfoModel.value) || new Uint8Array());
|
|
379
380
|
return {
|
|
380
381
|
contractAccountsBalance,
|
|
381
382
|
tokenInfo: JSON.parse(tokenInfoValue || "{}"),
|
|
@@ -387,24 +388,24 @@ var ChainGrpcWasmTransformer = class ChainGrpcWasmTransformer {
|
|
|
387
388
|
static allContractStateResponseToContractState(response) {
|
|
388
389
|
const contractAccountsBalance = response.models.map((model) => {
|
|
389
390
|
return {
|
|
390
|
-
account:
|
|
391
|
-
balance:
|
|
391
|
+
account: require_encoding_light.uint8ArrayToString(model.key).split("balance").pop(),
|
|
392
|
+
balance: require_encoding_light.uint8ArrayToString(model.value).replace(/['"]+/g, "")
|
|
392
393
|
};
|
|
393
394
|
}).filter(({ account, balance }) => {
|
|
394
395
|
return account && account.startsWith("inj") && balance;
|
|
395
396
|
});
|
|
396
397
|
const contractInfoModel = response.models.find((model) => {
|
|
397
|
-
return
|
|
398
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "contract_info";
|
|
398
399
|
});
|
|
399
|
-
const contractInfoValue =
|
|
400
|
+
const contractInfoValue = require_encoding_light.uint8ArrayToString((contractInfoModel === null || contractInfoModel === void 0 ? void 0 : contractInfoModel.value) || new Uint8Array());
|
|
400
401
|
const tokenInfoModel = response.models.find((model) => {
|
|
401
|
-
return
|
|
402
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "token_info";
|
|
402
403
|
});
|
|
403
|
-
const tokenInfoValue =
|
|
404
|
+
const tokenInfoValue = require_encoding_light.uint8ArrayToString((tokenInfoModel === null || tokenInfoModel === void 0 ? void 0 : tokenInfoModel.value) || new Uint8Array());
|
|
404
405
|
const marketingInfoModel = response.models.find((model) => {
|
|
405
|
-
return
|
|
406
|
+
return require_encoding_light.uint8ArrayToString(model.key) === "marketing_info";
|
|
406
407
|
});
|
|
407
|
-
const marketingInfoValue =
|
|
408
|
+
const marketingInfoValue = require_encoding_light.uint8ArrayToString((marketingInfoModel === null || marketingInfoModel === void 0 ? void 0 : marketingInfoModel.value) || new Uint8Array());
|
|
408
409
|
return {
|
|
409
410
|
contractAccountsBalance,
|
|
410
411
|
tokenInfo: JSON.parse(tokenInfoValue || "{}"),
|
|
@@ -436,7 +437,7 @@ var ChainGrpcWasmTransformer = class ChainGrpcWasmTransformer {
|
|
|
436
437
|
blockHeight: Number(updated.blockHeight),
|
|
437
438
|
txIndex: Number(updated.txIndex)
|
|
438
439
|
} : void 0,
|
|
439
|
-
msg:
|
|
440
|
+
msg: require_encoding_light.fromUtf8(entry.msg)
|
|
440
441
|
};
|
|
441
442
|
}
|
|
442
443
|
static grpcCodeInfoResponseToCodeInfoResponse(info) {
|
|
@@ -792,7 +793,7 @@ var ChainGrpcStakingTransformer = class ChainGrpcStakingTransformer {
|
|
|
792
793
|
return {
|
|
793
794
|
operatorAddress: validator.operatorAddress,
|
|
794
795
|
jailed: validator.jailed,
|
|
795
|
-
consensusPubKey:
|
|
796
|
+
consensusPubKey: require_encoding_light.uint8ArrayToBase64(((_validator$consensusP = validator.consensusPubkey) === null || _validator$consensusP === void 0 || (_validator$consensusP = _validator$consensusP.value) === null || _validator$consensusP === void 0 ? void 0 : _validator$consensusP.slice(2)) || new Uint8Array()),
|
|
796
797
|
status: ChainGrpcStakingTransformer.grpcValidatorStatusToStatus(validator.status),
|
|
797
798
|
tokens: (0, __injectivelabs_utils.toHumanReadable)(validator.tokens).toFixed(),
|
|
798
799
|
delegatorShares: (0, __injectivelabs_utils.toHumanReadable)(validator.delegatorShares).toFixed(),
|
|
@@ -1318,11 +1319,11 @@ var ChainGrpcMintApi = class extends require_BaseGrpcConsumer.BaseGrpcConsumer {
|
|
|
1318
1319
|
}
|
|
1319
1320
|
async fetchInflation() {
|
|
1320
1321
|
const request = __injectivelabs_core_proto_ts_v2_generated_cosmos_mint_v1beta1_query_pb.QueryInflationRequest.create();
|
|
1321
|
-
return { inflation: (0, __injectivelabs_utils.toHumanReadable)(
|
|
1322
|
+
return { inflation: (0, __injectivelabs_utils.toHumanReadable)(require_encoding_light.uint8ArrayToString((await this.executeGrpcCall(request, this.client.inflation.bind(this.client))).inflation)) };
|
|
1322
1323
|
}
|
|
1323
1324
|
async fetchAnnualProvisions() {
|
|
1324
1325
|
const request = __injectivelabs_core_proto_ts_v2_generated_cosmos_mint_v1beta1_query_pb.QueryAnnualProvisionsRequest.create();
|
|
1325
|
-
return { annualProvisions: (0, __injectivelabs_utils.toHumanReadable)(
|
|
1326
|
+
return { annualProvisions: (0, __injectivelabs_utils.toHumanReadable)(require_encoding_light.uint8ArrayToString((await this.executeGrpcCall(request, this.client.annualProvisions.bind(this.client))).annualProvisions)).toFixed() };
|
|
1326
1327
|
}
|
|
1327
1328
|
};
|
|
1328
1329
|
|
|
@@ -1371,13 +1372,13 @@ var ChainGrpcWasmApi = class extends require_BaseGrpcConsumer.BaseGrpcConsumer {
|
|
|
1371
1372
|
async fetchSmartContractState(contractAddress, query) {
|
|
1372
1373
|
const request = __injectivelabs_core_proto_ts_v2_generated_cosmwasm_wasm_v1_query_pb.QuerySmartContractStateRequest.create();
|
|
1373
1374
|
request.address = contractAddress;
|
|
1374
|
-
if (query) request.queryData =
|
|
1375
|
+
if (query) request.queryData = require_encoding_light.base64ToUint8Array(typeof query === "string" ? query : require_encoding_light.toBase64(query));
|
|
1375
1376
|
return await this.executeGrpcCall(request, this.client.smartContractState.bind(this.client));
|
|
1376
1377
|
}
|
|
1377
1378
|
async fetchRawContractState(contractAddress, query) {
|
|
1378
1379
|
const request = __injectivelabs_core_proto_ts_v2_generated_cosmwasm_wasm_v1_query_pb.QueryRawContractStateRequest.create();
|
|
1379
1380
|
request.address = contractAddress;
|
|
1380
|
-
if (query) request.queryData =
|
|
1381
|
+
if (query) request.queryData = require_encoding_light.base64ToUint8Array(query);
|
|
1381
1382
|
return await this.executeGrpcCall(request, this.client.rawContractState.bind(this.client));
|
|
1382
1383
|
}
|
|
1383
1384
|
async fetchContractCodes(pagination) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
require('../defineProperty-
|
|
2
|
-
require('../grpc-
|
|
3
|
-
require('../
|
|
4
|
-
require('../
|
|
5
|
-
|
|
1
|
+
require('../defineProperty-C3FP2y9Y.cjs');
|
|
2
|
+
require('../grpc-3Z8ffFdZ.cjs');
|
|
3
|
+
require('../light-CrajlUvd.cjs');
|
|
4
|
+
require('../stream-CcqYpdwJ.cjs');
|
|
5
|
+
require('../BaseGrpcConsumer-zA9DIfEw.cjs');
|
|
6
|
+
const require_AbacusGrpcApi = require('../AbacusGrpcApi-Dwlpk6jY.cjs');
|
|
6
7
|
|
|
7
8
|
exports.AbacusGrpcApi = require_AbacusGrpcApi.AbacusGrpcApi;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "../tx_pb-
|
|
2
|
-
import "../index-
|
|
3
|
-
import "../
|
|
4
|
-
import
|
|
1
|
+
import "../tx_pb-BmZhAoWC.cjs";
|
|
2
|
+
import "../index-BG-nzcNI.cjs";
|
|
3
|
+
import "../light-4nNsYXxr.cjs";
|
|
4
|
+
import "../BaseGrpcConsumer-CUdc9vEY.cjs";
|
|
5
|
+
import { n as PointsStatsRow, r as AbacusGrpcApi, t as PointsLatestResponse } from "../index-BOj_EXVL.cjs";
|
|
5
6
|
export { AbacusGrpcApi, PointsLatestResponse, PointsStatsRow };
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
2
|
-
|
|
3
|
-
require('../
|
|
4
|
-
require('../
|
|
5
|
-
const
|
|
6
|
-
require('../
|
|
7
|
-
require('../
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
require('../
|
|
2
|
+
require('../encoding-light-D96nxVLW.cjs');
|
|
3
|
+
require('../constants-tPGACRGC.cjs');
|
|
4
|
+
require('../defineProperty-C3FP2y9Y.cjs');
|
|
5
|
+
const require_utils = require('../utils-CH1Ojxun.cjs');
|
|
6
|
+
require('../grpc-3Z8ffFdZ.cjs');
|
|
7
|
+
require('../coins-DRrEtaSG.cjs');
|
|
8
|
+
require('../address-light-C_a6b8yF.cjs');
|
|
9
|
+
const require_ChainRestTendermintApi = require('../ChainRestTendermintApi-Sni05dAJ.cjs');
|
|
10
|
+
require('../light-CrajlUvd.cjs');
|
|
11
|
+
require('../stream-CcqYpdwJ.cjs');
|
|
12
|
+
require('../BaseGrpcConsumer-zA9DIfEw.cjs');
|
|
13
|
+
const require_chain = require('../chain-DHppVc1K.cjs');
|
|
14
|
+
const require_ChainGrpcExchangeApi = require('../ChainGrpcExchangeApi-vxOV2B57.cjs');
|
|
15
|
+
require('../BaseRestConsumer-BcHgNcNh.cjs');
|
|
11
16
|
let __injectivelabs_core_proto_ts_v2_generated_injective_oracle_v1beta1_oracle_pb = require("@injectivelabs/core-proto-ts-v2/generated/injective/oracle/v1beta1/oracle_pb");
|
|
12
17
|
|
|
13
18
|
exports.BondStatus = require_ChainRestTendermintApi.BondStatus;
|