@injectivelabs/sdk-ts 1.16.5 → 1.16.6-alpha.0

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/client/indexer/grpc/IndexerGrpcTransactionApi.d.ts +3 -3
  3. package/dist/cjs/client/indexer/grpc/IndexerGrpcWeb3GwApi.d.ts +2 -2
  4. package/dist/cjs/core/accounts/PrivateKey.d.ts +2 -2
  5. package/dist/cjs/core/accounts/PrivateKey.js +17 -17
  6. package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContract.d.ts +1 -0
  7. package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContract.js +3 -7
  8. package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +3 -3
  9. package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.js +6 -7
  10. package/dist/cjs/core/tx/eip712/eip712.d.ts +5 -5
  11. package/dist/cjs/core/tx/eip712/eip712.js +4 -4
  12. package/dist/cjs/core/tx/eip712/utils.d.ts +3 -3
  13. package/dist/cjs/core/tx/eip712/utils.js +4 -4
  14. package/dist/cjs/core/tx/utils/tx.d.ts +3 -3
  15. package/dist/cjs/core/tx/utils/tx.js +2 -2
  16. package/dist/cjs/utils/grpc.d.ts +1 -1
  17. package/dist/cjs/utils/pagination.d.ts +1 -1
  18. package/dist/cjs/utils/pagination.js +5 -12
  19. package/dist/esm/client/indexer/grpc/IndexerGrpcTransactionApi.d.ts +3 -3
  20. package/dist/esm/client/indexer/grpc/IndexerGrpcWeb3GwApi.d.ts +2 -2
  21. package/dist/esm/core/accounts/PrivateKey.d.ts +2 -2
  22. package/dist/esm/core/accounts/PrivateKey.js +17 -17
  23. package/dist/esm/core/modules/wasm/msgs/MsgExecuteContract.d.ts +1 -0
  24. package/dist/esm/core/modules/wasm/msgs/MsgExecuteContract.js +3 -7
  25. package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +3 -3
  26. package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.js +6 -7
  27. package/dist/esm/core/tx/eip712/eip712.d.ts +5 -5
  28. package/dist/esm/core/tx/eip712/eip712.js +5 -5
  29. package/dist/esm/core/tx/eip712/utils.d.ts +3 -3
  30. package/dist/esm/core/tx/eip712/utils.js +4 -4
  31. package/dist/esm/core/tx/utils/tx.d.ts +3 -3
  32. package/dist/esm/core/tx/utils/tx.js +2 -2
  33. package/dist/esm/utils/grpc.d.ts +1 -1
  34. package/dist/esm/utils/pagination.d.ts +1 -1
  35. package/dist/esm/utils/pagination.js +5 -12
  36. package/package.json +9 -13
package/README.md CHANGED
@@ -33,7 +33,7 @@ We highly suggest using the `@injectivelabs/sdk-ts` with TypeScript, or JavaScri
33
33
  ### 📚 Installation
34
34
 
35
35
  ```bash
36
- yarn add @injectivelabs/sdk-ts
36
+ pnpm add @injectivelabs/sdk-ts
37
37
  ```
38
38
 
39
39
  ---
@@ -1,10 +1,10 @@
1
- import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
4
4
  import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer.js';
5
5
  interface PrepareTxArgs {
6
6
  address: AccountAddress;
7
- chainId: EthereumChainId;
7
+ chainId: EvmChainId;
8
8
  message: any;
9
9
  estimateGas?: boolean;
10
10
  gasLimit?: number;
@@ -41,7 +41,7 @@ export declare class IndexerGrpcTransactionApi extends BaseGrpcConsumer {
41
41
  */
42
42
  broadcastTxRequest({ signature, chainId, message, txResponse, }: {
43
43
  signature: string;
44
- chainId: EthereumChainId;
44
+ chainId: EvmChainId;
45
45
  useCorrectEIP712Hash?: boolean;
46
46
  txResponse: InjectiveExchangeRpc.PrepareTxResponse;
47
47
  message: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  import { IndexerGrpcTransactionApi } from './IndexerGrpcTransactionApi.js';
4
4
  /**
@@ -9,7 +9,7 @@ export declare class IndexerGrpcWeb3GwApi extends IndexerGrpcTransactionApi {
9
9
  constructor(endpoint: string);
10
10
  prepareEip712Request({ address, chainId, message, memo, sequence, accountNumber, estimateGas, gasLimit, feeDenom, feePrice, timeoutHeight, eip712Version, }: {
11
11
  address: AccountAddress;
12
- chainId: EthereumChainId;
12
+ chainId: EvmChainId;
13
13
  message: any;
14
14
  estimateGas?: boolean;
15
15
  gasLimit?: number;
@@ -1,6 +1,6 @@
1
- import { PublicKey } from './PublicKey.js';
2
- import { Address } from './Address.js';
3
1
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
2
+ import { Address } from './Address.js';
3
+ import { PublicKey } from './PublicKey.js';
4
4
  /**
5
5
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
6
6
  *
@@ -4,19 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PrivateKey = void 0;
7
- const bip39_1 = require("bip39");
8
- const ethers_1 = require("ethers");
9
7
  const secp256k1_1 = __importDefault(require("secp256k1"));
10
8
  const keccak256_1 = __importDefault(require("keccak256"));
11
- const PublicKey_js_1 = require("./PublicKey.js");
12
- const Address_js_1 = require("./Address.js");
9
+ const bip39_1 = require("bip39");
10
+ const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
11
+ const exceptions_1 = require("@injectivelabs/exceptions");
12
+ const ts_types_1 = require("@injectivelabs/ts-types");
13
+ const ethers_1 = require("ethers");
13
14
  const eth_sig_util_1 = require("@metamask/eth-sig-util");
14
15
  const index_js_1 = require("../../utils/index.js");
15
- const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
16
+ const Address_js_1 = require("./Address.js");
17
+ const PublicKey_js_1 = require("./PublicKey.js");
16
18
  const tx_js_1 = require("../tx/utils/tx.js");
17
19
  const index_js_2 = require("../tx/eip712/index.js");
18
- const exceptions_1 = require("@injectivelabs/exceptions");
19
- const ts_types_1 = require("@injectivelabs/ts-types");
20
20
  /**
21
21
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
22
22
  *
@@ -266,31 +266,31 @@ class PrivateKey {
266
266
  const getChainIds = () => {
267
267
  if (!body.extensionOptions.length) {
268
268
  return {
269
- ethereumChainId: ts_types_1.EthereumChainId.Mainnet,
270
269
  chainId: ts_types_1.ChainId.Mainnet,
270
+ EvmChainId: ts_types_1.EvmChainId.Mainnet,
271
271
  };
272
272
  }
273
273
  const extension = body.extensionOptions.find((extension) => extension.typeUrl.includes('ExtensionOptionsWeb3Tx'));
274
274
  if (!extension) {
275
275
  return {
276
- ethereumChainId: ts_types_1.EthereumChainId.Mainnet,
277
276
  chainId: ts_types_1.ChainId.Mainnet,
277
+ EvmChainId: ts_types_1.EvmChainId.Mainnet,
278
278
  };
279
279
  }
280
280
  const decodedExtension = core_proto_ts_1.InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.decode(extension.value);
281
- const ethereumChainId = Number(decodedExtension.typedDataChainID);
281
+ const evmChainId = Number(decodedExtension.typedDataChainID);
282
282
  return {
283
- ethereumChainId: ethereumChainId,
283
+ evmChainId: ts_types_1.EvmChainId,
284
284
  chainId: [
285
- ts_types_1.EthereumChainId.Goerli,
286
- ts_types_1.EthereumChainId.Kovan,
287
- ts_types_1.EthereumChainId.Sepolia,
288
- ].includes(ethereumChainId)
285
+ ts_types_1.EvmChainId.Kovan,
286
+ ts_types_1.EvmChainId.Goerli,
287
+ ts_types_1.EvmChainId.Sepolia,
288
+ ].includes(evmChainId)
289
289
  ? ts_types_1.ChainId.Testnet
290
290
  : ts_types_1.ChainId.Mainnet,
291
291
  };
292
292
  };
293
- const { ethereumChainId, chainId } = getChainIds();
293
+ const { evmChainId, chainId } = getChainIds();
294
294
  const [signerInfo] = authInfo.signerInfos;
295
295
  const [signature] = signatures;
296
296
  const [msg] = body.messages;
@@ -305,7 +305,7 @@ class PrivateKey {
305
305
  timeoutHeight: body.timeoutHeight.toString(),
306
306
  chainId,
307
307
  },
308
- ethereumChainId,
308
+ evmChainId: evmChainId,
309
309
  });
310
310
  return this.verifySignature({
311
311
  eip712: eip712TypedData,
@@ -53,6 +53,7 @@ export default class MsgExecuteContract extends MsgBase<MsgExecuteContract.Param
53
53
  msg: any;
54
54
  '@type': string;
55
55
  };
56
+ toEip712(): never;
56
57
  toDirectSign(): {
57
58
  type: string;
58
59
  message: CosmwasmWasmV1Tx.MsgExecuteContract;
@@ -62,13 +62,9 @@ class MsgExecuteContract extends MsgBase_js_1.MsgBase {
62
62
  ...value,
63
63
  };
64
64
  }
65
- // public toEip712(): never {
66
- // throw new GeneralException(
67
- // new Error(
68
- // 'EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2',
69
- // ),
70
- // )
71
- // }
65
+ toEip712() {
66
+ throw new exceptions_1.GeneralException(new Error('EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2'));
67
+ }
72
68
  toDirectSign() {
73
69
  const proto = this.toProto();
74
70
  return {
@@ -1,6 +1,6 @@
1
1
  import { PrivateKey } from '../../accounts/index.js';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
- import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
3
+ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
4
4
  import { Network, NetworkEndpoints } from '@injectivelabs/networks';
5
5
  import { AccountDetails } from '../../../types/auth.js';
6
6
  interface MsgBroadcasterTxOptions {
@@ -25,7 +25,7 @@ interface MsgBroadcasterWithPkOptions {
25
25
  rest: string;
26
26
  };
27
27
  privateKey: string | PrivateKey;
28
- ethereumChainId?: EthereumChainId;
28
+ evmChainId?: EvmChainId;
29
29
  chainId?: ChainId;
30
30
  simulateTx?: boolean;
31
31
  loggingEnabled?: boolean;
@@ -45,7 +45,7 @@ interface MsgBroadcasterWithPkOptions {
45
45
  export declare class MsgBroadcasterWithPk {
46
46
  endpoints: NetworkEndpoints;
47
47
  chainId: ChainId;
48
- ethereumChainId?: EthereumChainId;
48
+ evmChainId?: EvmChainId;
49
49
  privateKey: PrivateKey;
50
50
  simulateTx: boolean;
51
51
  txTimeoutOnFeeDelegation: boolean;
@@ -23,7 +23,7 @@ const index_js_5 = require("../../../json/index.js");
23
23
  class MsgBroadcasterWithPk {
24
24
  endpoints;
25
25
  chainId;
26
- ethereumChainId;
26
+ evmChainId;
27
27
  privateKey;
28
28
  simulateTx = false;
29
29
  txTimeoutOnFeeDelegation = false;
@@ -39,8 +39,7 @@ class MsgBroadcasterWithPk {
39
39
  this.simulateTx = options.simulateTx || false;
40
40
  this.chainId = options.chainId || networkInfo.chainId;
41
41
  this.txTimeout = options.txTimeout || utils_1.DEFAULT_BLOCK_TIMEOUT_HEIGHT;
42
- this.ethereumChainId =
43
- options.ethereumChainId || networkInfo.ethereumChainId;
42
+ this.evmChainId = options.evmChainId || networkInfo.evmChainId;
44
43
  this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
45
44
  this.privateKey =
46
45
  options.privateKey instanceof index_js_1.PrivateKey
@@ -70,7 +69,7 @@ class MsgBroadcasterWithPk {
70
69
  * @returns {string} transaction hash
71
70
  */
72
71
  async broadcastWithFeeDelegation(transaction) {
73
- const { simulateTx, privateKey, ethereumChainId, endpoints, txTimeoutOnFeeDelegation, txTimeout, } = this;
72
+ const { endpoints, txTimeout, simulateTx, privateKey, evmChainId, txTimeoutOnFeeDelegation, } = this;
74
73
  const ethereumWallet = this.privateKey.toHex();
75
74
  if (index_js_5.ofacWallets.includes(ethereumWallet)) {
76
75
  throw new exceptions_1.GeneralException(new Error('You cannot execute this transaction'));
@@ -84,7 +83,7 @@ class MsgBroadcasterWithPk {
84
83
  ethereumAddress: ethereumWallet,
85
84
  };
86
85
  const web3Msgs = msgs.map((msg) => msg.toWeb3());
87
- if (!ethereumChainId) {
86
+ if (!evmChainId) {
88
87
  throw new exceptions_1.GeneralException(new Error('Please provide ethereumChainId'));
89
88
  }
90
89
  let timeoutHeight = undefined;
@@ -100,7 +99,7 @@ class MsgBroadcasterWithPk {
100
99
  memo: tx.memo,
101
100
  message: web3Msgs,
102
101
  address: tx.ethereumAddress,
103
- chainId: ethereumChainId,
102
+ chainId: evmChainId,
104
103
  gasLimit: (0, msgs_js_1.getGasPriceBasedOnMessage)(msgs),
105
104
  estimateGas: simulateTx || false,
106
105
  timeoutHeight,
@@ -109,7 +108,7 @@ class MsgBroadcasterWithPk {
109
108
  const response = await transactionApi.broadcastTxRequest({
110
109
  txResponse,
111
110
  message: web3Msgs,
112
- chainId: ethereumChainId,
111
+ chainId: evmChainId,
113
112
  signature: `0x${Buffer.from(signature).toString('hex')}`,
114
113
  });
115
114
  return await new TxGrpcApi_js_1.TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
@@ -1,11 +1,11 @@
1
1
  import { Msgs } from '../../modules/msgs.js';
2
- import { EthereumChainId } from '@injectivelabs/ts-types';
2
+ import { EvmChainId } from '@injectivelabs/ts-types';
3
3
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
4
- export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
4
+ export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
5
5
  msgs: Msgs | Msgs[];
6
6
  tx: Eip712ConvertTxArgs;
7
7
  fee?: Eip712ConvertFeeArgs;
8
- ethereumChainId: EthereumChainId;
8
+ evmChainId: EvmChainId;
9
9
  }) => {
10
10
  message: {
11
11
  msgs: {
@@ -57,11 +57,11 @@ export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
57
57
  }[];
58
58
  };
59
59
  };
60
- export declare const getEip712TypedDataV2: ({ msgs, tx, fee, ethereumChainId, }: {
60
+ export declare const getEip712TypedDataV2: ({ msgs, tx, fee, evmChainId, }: {
61
61
  msgs: Msgs | Msgs[];
62
62
  tx: Eip712ConvertTxArgs;
63
63
  fee?: Eip712ConvertFeeArgs;
64
- ethereumChainId: EthereumChainId;
64
+ evmChainId: EvmChainId;
65
65
  }) => {
66
66
  message: {
67
67
  context: string;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEip712TypedDataV2 = exports.getEip712TypedData = void 0;
4
4
  const utils_js_1 = require("./utils.js");
5
5
  const utils_js_2 = require("./utils.js");
6
- const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
6
+ const getEip712TypedData = ({ msgs, tx, fee, evmChainId, }) => {
7
7
  const messages = Array.isArray(msgs) ? msgs : [msgs];
8
8
  const eip712Msgs = messages.map((m) => m.toEip712());
9
9
  const eip712MessageTypes = messages[0].toEip712Types();
@@ -21,7 +21,7 @@ const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
21
21
  return {
22
22
  ...typesWithFeePayer,
23
23
  primaryType: 'Tx',
24
- ...(0, utils_js_1.getEip712Domain)(ethereumChainId),
24
+ ...(0, utils_js_1.getEip712Domain)(evmChainId),
25
25
  message: {
26
26
  ...(0, utils_js_1.getEipTxDetails)(tx),
27
27
  ...(0, utils_js_1.getEip712Fee)(fee),
@@ -30,14 +30,14 @@ const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
30
30
  };
31
31
  };
32
32
  exports.getEip712TypedData = getEip712TypedData;
33
- const getEip712TypedDataV2 = ({ msgs, tx, fee, ethereumChainId, }) => {
33
+ const getEip712TypedDataV2 = ({ msgs, tx, fee, evmChainId, }) => {
34
34
  const messages = Array.isArray(msgs) ? msgs : [msgs];
35
35
  const eip712Msgs = messages.map((m) => m.toEip712V2());
36
36
  const types = (0, utils_js_1.getDefaultEip712TypesV2)();
37
37
  return {
38
38
  ...types,
39
39
  primaryType: 'Tx',
40
- ...(0, utils_js_1.getEip712DomainV2)(ethereumChainId),
40
+ ...(0, utils_js_1.getEip712DomainV2)(evmChainId),
41
41
  message: {
42
42
  context: JSON.stringify((0, utils_js_2.getEipTxContext)({ ...tx, fee })),
43
43
  msgs: JSON.stringify(eip712Msgs),
@@ -1,6 +1,6 @@
1
- import { EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
3
- export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
3
+ export declare const getEip712Domain: (evmChainId: EvmChainId) => {
4
4
  domain: {
5
5
  name: string;
6
6
  version: string;
@@ -9,7 +9,7 @@ export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
9
9
  verifyingContract: string;
10
10
  };
11
11
  };
12
- export declare const getEip712DomainV2: (ethereumChainId: EthereumChainId) => {
12
+ export declare const getEip712DomainV2: (evmChainId: EvmChainId) => {
13
13
  domain: {
14
14
  name: string;
15
15
  version: string;
@@ -2,24 +2,24 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getEipTxContext = exports.getEipTxDetails = exports.getTypesIncludingFeePayer = exports.getEip712FeeV2 = exports.getEip712Fee = exports.getDefaultEip712TypesV2 = exports.getDefaultEip712Types = exports.getEip712DomainV2 = exports.getEip712Domain = void 0;
4
4
  const utils_1 = require("@injectivelabs/utils");
5
- const getEip712Domain = (ethereumChainId) => {
5
+ const getEip712Domain = (evmChainId) => {
6
6
  return {
7
7
  domain: {
8
8
  name: 'Injective Web3',
9
9
  version: '1.0.0',
10
- chainId: '0x' + new utils_1.BigNumberInBase(ethereumChainId).toString(16),
10
+ chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
11
11
  salt: '0',
12
12
  verifyingContract: 'cosmos',
13
13
  },
14
14
  };
15
15
  };
16
16
  exports.getEip712Domain = getEip712Domain;
17
- const getEip712DomainV2 = (ethereumChainId) => {
17
+ const getEip712DomainV2 = (evmChainId) => {
18
18
  return {
19
19
  domain: {
20
20
  name: 'Injective Web3',
21
21
  version: '1.0.0',
22
- chainId: '0x' + new utils_1.BigNumberInBase(ethereumChainId).toString(16),
22
+ chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
23
23
  verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
24
24
  salt: '0',
25
25
  },
@@ -1,4 +1,4 @@
1
- import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
3
  import { GoogleProtobufAny, CosmosTxV1Beta1Tx, InjectiveTypesV1Beta1TxExt, CosmosTxSigningV1Beta1Signing } from '@injectivelabs/core-proto-ts';
4
4
  export declare const getPublicKey: ({ chainId, key, }: {
@@ -49,8 +49,8 @@ export declare const createSignDocFromTransaction: (args: {
49
49
  accountNumber: number;
50
50
  }) => CosmosTxV1Beta1Tx.SignDoc;
51
51
  export declare const createTxRawEIP712: (txRaw: CosmosTxV1Beta1Tx.TxRaw, extension: InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx, nonCriticalExtension?: GoogleProtobufAny.Any | GoogleProtobufAny.Any[]) => CosmosTxV1Beta1Tx.TxRaw;
52
- export declare const createWeb3Extension: ({ ethereumChainId, feePayer, feePayerSig, }: {
53
- ethereumChainId: EthereumChainId;
52
+ export declare const createWeb3Extension: ({ evmChainId, feePayer, feePayerSig, }: {
53
+ evmChainId: EvmChainId;
54
54
  feePayer?: string;
55
55
  feePayerSig?: Uint8Array;
56
56
  }) => InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx;
@@ -120,9 +120,9 @@ const createTxRawEIP712 = (txRaw, extension, nonCriticalExtension) => {
120
120
  return txRaw;
121
121
  };
122
122
  exports.createTxRawEIP712 = createTxRawEIP712;
123
- const createWeb3Extension = ({ ethereumChainId, feePayer, feePayerSig, }) => {
123
+ const createWeb3Extension = ({ evmChainId, feePayer, feePayerSig, }) => {
124
124
  const web3Extension = core_proto_ts_1.InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.create();
125
- web3Extension.typedDataChainID = ethereumChainId.toString();
125
+ web3Extension.typedDataChainID = evmChainId.toString();
126
126
  if (feePayer) {
127
127
  web3Extension.feePayer = feePayer;
128
128
  }
@@ -1,4 +1,4 @@
1
1
  import * as grpcPkg from '@injectivelabs/grpc-web';
2
2
  declare const grpc: typeof grpcPkg.grpc;
3
- export declare const getGrpcTransport: () => import("@injectivelabs/grpc-web").grpc.TransportFactory;
3
+ export declare const getGrpcTransport: () => grpcPkg.grpc.TransportFactory;
4
4
  export { grpc, grpcPkg };
@@ -19,4 +19,4 @@ export declare const fetchAllWithPagination: <T extends {
19
19
  pagination: PaginationOption | undefined;
20
20
  } | PaginationOption | undefined, Q extends {
21
21
  pagination: Pagination;
22
- }>(args: T, method: (args: T) => Promise<Q>) => Promise<Q>;
22
+ }>(args: T, method: (args: T) => Promise<Q>, result?: Array<unknown>) => Promise<Q>;
@@ -97,24 +97,17 @@ const grpcPagingToPaging = (pagination) => {
97
97
  };
98
98
  };
99
99
  exports.grpcPagingToPaging = grpcPagingToPaging;
100
- const fetchAllWithPagination = async (args, method) => {
101
- let result = [];
100
+ const fetchAllWithPagination = async (args, method, result = []) => {
102
101
  let response = await method(args);
103
102
  if (!args) {
104
103
  return response;
105
104
  }
106
- const paginationOption = args.pagination;
107
- if (!paginationOption) {
108
- return response;
109
- }
110
105
  const keys = Object.keys(response);
111
106
  const valueKey = keys.find((key) => key !== 'pagination');
112
- while (response.pagination.next) {
113
- result.push(response[valueKey]);
114
- response = await method({
115
- ...args,
116
- pagination: { ...paginationOption, key: response.pagination.next },
117
- });
107
+ result.push(...response[valueKey]);
108
+ const paginationOption = args;
109
+ if (response.pagination.next) {
110
+ return (0, exports.fetchAllWithPagination)({ ...paginationOption, key: response.pagination.next }, method, result);
118
111
  }
119
112
  return { [valueKey]: result, pagination: response.pagination };
120
113
  };
@@ -1,10 +1,10 @@
1
- import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
4
4
  import BaseGrpcConsumer from '../../base/BaseIndexerGrpcConsumer.js';
5
5
  interface PrepareTxArgs {
6
6
  address: AccountAddress;
7
- chainId: EthereumChainId;
7
+ chainId: EvmChainId;
8
8
  message: any;
9
9
  estimateGas?: boolean;
10
10
  gasLimit?: number;
@@ -41,7 +41,7 @@ export declare class IndexerGrpcTransactionApi extends BaseGrpcConsumer {
41
41
  */
42
42
  broadcastTxRequest({ signature, chainId, message, txResponse, }: {
43
43
  signature: string;
44
- chainId: EthereumChainId;
44
+ chainId: EvmChainId;
45
45
  useCorrectEIP712Hash?: boolean;
46
46
  txResponse: InjectiveExchangeRpc.PrepareTxResponse;
47
47
  message: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { AccountAddress, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { InjectiveExchangeRpc } from '@injectivelabs/indexer-proto-ts';
3
3
  import { IndexerGrpcTransactionApi } from './IndexerGrpcTransactionApi.js';
4
4
  /**
@@ -9,7 +9,7 @@ export declare class IndexerGrpcWeb3GwApi extends IndexerGrpcTransactionApi {
9
9
  constructor(endpoint: string);
10
10
  prepareEip712Request({ address, chainId, message, memo, sequence, accountNumber, estimateGas, gasLimit, feeDenom, feePrice, timeoutHeight, eip712Version, }: {
11
11
  address: AccountAddress;
12
- chainId: EthereumChainId;
12
+ chainId: EvmChainId;
13
13
  message: any;
14
14
  estimateGas?: boolean;
15
15
  gasLimit?: number;
@@ -1,6 +1,6 @@
1
- import { PublicKey } from './PublicKey.js';
2
- import { Address } from './Address.js';
3
1
  import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
2
+ import { Address } from './Address.js';
3
+ import { PublicKey } from './PublicKey.js';
4
4
  /**
5
5
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
6
6
  *
@@ -1,16 +1,16 @@
1
- import { generateMnemonic } from 'bip39';
2
- import { Wallet, HDNodeWallet, Signature, getBytes, concat } from 'ethers';
3
1
  import secp256k1 from 'secp256k1';
4
2
  import keccak256 from 'keccak256';
5
- import { PublicKey } from './PublicKey.js';
6
- import { Address } from './Address.js';
3
+ import { generateMnemonic } from 'bip39';
4
+ import { InjectiveTypesV1Beta1TxExt, } from '@injectivelabs/core-proto-ts';
5
+ import { GeneralException } from '@injectivelabs/exceptions';
6
+ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
7
+ import { Wallet, HDNodeWallet, Signature, getBytes, concat } from 'ethers';
7
8
  import { signTypedData, SignTypedDataVersion } from '@metamask/eth-sig-util';
8
9
  import { DEFAULT_DERIVATION_PATH, recoverTypedSignaturePubKey, } from '../../utils/index.js';
9
- import { InjectiveTypesV1Beta1TxExt, } from '@injectivelabs/core-proto-ts';
10
+ import { Address } from './Address.js';
11
+ import { PublicKey } from './PublicKey.js';
10
12
  import { getTransactionPartsFromTxRaw } from '../tx/utils/tx.js';
11
13
  import { getEip712TypedData, MsgDecoder } from '../tx/eip712/index.js';
12
- import { GeneralException } from '@injectivelabs/exceptions';
13
- import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
14
14
  /**
15
15
  * Class for wrapping SigningKey that is used for signature creation and public key derivation.
16
16
  *
@@ -260,31 +260,31 @@ export class PrivateKey {
260
260
  const getChainIds = () => {
261
261
  if (!body.extensionOptions.length) {
262
262
  return {
263
- ethereumChainId: EthereumChainId.Mainnet,
264
263
  chainId: ChainId.Mainnet,
264
+ EvmChainId: EvmChainId.Mainnet,
265
265
  };
266
266
  }
267
267
  const extension = body.extensionOptions.find((extension) => extension.typeUrl.includes('ExtensionOptionsWeb3Tx'));
268
268
  if (!extension) {
269
269
  return {
270
- ethereumChainId: EthereumChainId.Mainnet,
271
270
  chainId: ChainId.Mainnet,
271
+ EvmChainId: EvmChainId.Mainnet,
272
272
  };
273
273
  }
274
274
  const decodedExtension = InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.decode(extension.value);
275
- const ethereumChainId = Number(decodedExtension.typedDataChainID);
275
+ const evmChainId = Number(decodedExtension.typedDataChainID);
276
276
  return {
277
- ethereumChainId: ethereumChainId,
277
+ evmChainId: EvmChainId,
278
278
  chainId: [
279
- EthereumChainId.Goerli,
280
- EthereumChainId.Kovan,
281
- EthereumChainId.Sepolia,
282
- ].includes(ethereumChainId)
279
+ EvmChainId.Kovan,
280
+ EvmChainId.Goerli,
281
+ EvmChainId.Sepolia,
282
+ ].includes(evmChainId)
283
283
  ? ChainId.Testnet
284
284
  : ChainId.Mainnet,
285
285
  };
286
286
  };
287
- const { ethereumChainId, chainId } = getChainIds();
287
+ const { evmChainId, chainId } = getChainIds();
288
288
  const [signerInfo] = authInfo.signerInfos;
289
289
  const [signature] = signatures;
290
290
  const [msg] = body.messages;
@@ -299,7 +299,7 @@ export class PrivateKey {
299
299
  timeoutHeight: body.timeoutHeight.toString(),
300
300
  chainId,
301
301
  },
302
- ethereumChainId,
302
+ evmChainId: evmChainId,
303
303
  });
304
304
  return this.verifySignature({
305
305
  eip712: eip712TypedData,
@@ -53,6 +53,7 @@ export default class MsgExecuteContract extends MsgBase<MsgExecuteContract.Param
53
53
  msg: any;
54
54
  '@type': string;
55
55
  };
56
+ toEip712(): never;
56
57
  toDirectSign(): {
57
58
  type: string;
58
59
  message: CosmwasmWasmV1Tx.MsgExecuteContract;
@@ -57,13 +57,9 @@ export default class MsgExecuteContract extends MsgBase {
57
57
  ...value,
58
58
  };
59
59
  }
60
- // public toEip712(): never {
61
- // throw new GeneralException(
62
- // new Error(
63
- // 'EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2',
64
- // ),
65
- // )
66
- // }
60
+ toEip712() {
61
+ throw new GeneralException(new Error('EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2'));
62
+ }
67
63
  toDirectSign() {
68
64
  const proto = this.toProto();
69
65
  return {
@@ -1,6 +1,6 @@
1
1
  import { PrivateKey } from '../../accounts/index.js';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
- import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
3
+ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
4
4
  import { Network, NetworkEndpoints } from '@injectivelabs/networks';
5
5
  import { AccountDetails } from '../../../types/auth.js';
6
6
  interface MsgBroadcasterTxOptions {
@@ -25,7 +25,7 @@ interface MsgBroadcasterWithPkOptions {
25
25
  rest: string;
26
26
  };
27
27
  privateKey: string | PrivateKey;
28
- ethereumChainId?: EthereumChainId;
28
+ evmChainId?: EvmChainId;
29
29
  chainId?: ChainId;
30
30
  simulateTx?: boolean;
31
31
  loggingEnabled?: boolean;
@@ -45,7 +45,7 @@ interface MsgBroadcasterWithPkOptions {
45
45
  export declare class MsgBroadcasterWithPk {
46
46
  endpoints: NetworkEndpoints;
47
47
  chainId: ChainId;
48
- ethereumChainId?: EthereumChainId;
48
+ evmChainId?: EvmChainId;
49
49
  privateKey: PrivateKey;
50
50
  simulateTx: boolean;
51
51
  txTimeoutOnFeeDelegation: boolean;
@@ -20,7 +20,7 @@ import { ofacWallets } from '../../../json/index.js';
20
20
  export class MsgBroadcasterWithPk {
21
21
  endpoints;
22
22
  chainId;
23
- ethereumChainId;
23
+ evmChainId;
24
24
  privateKey;
25
25
  simulateTx = false;
26
26
  txTimeoutOnFeeDelegation = false;
@@ -36,8 +36,7 @@ export class MsgBroadcasterWithPk {
36
36
  this.simulateTx = options.simulateTx || false;
37
37
  this.chainId = options.chainId || networkInfo.chainId;
38
38
  this.txTimeout = options.txTimeout || DEFAULT_BLOCK_TIMEOUT_HEIGHT;
39
- this.ethereumChainId =
40
- options.ethereumChainId || networkInfo.ethereumChainId;
39
+ this.evmChainId = options.evmChainId || networkInfo.evmChainId;
41
40
  this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
42
41
  this.privateKey =
43
42
  options.privateKey instanceof PrivateKey
@@ -67,7 +66,7 @@ export class MsgBroadcasterWithPk {
67
66
  * @returns {string} transaction hash
68
67
  */
69
68
  async broadcastWithFeeDelegation(transaction) {
70
- const { simulateTx, privateKey, ethereumChainId, endpoints, txTimeoutOnFeeDelegation, txTimeout, } = this;
69
+ const { endpoints, txTimeout, simulateTx, privateKey, evmChainId, txTimeoutOnFeeDelegation, } = this;
71
70
  const ethereumWallet = this.privateKey.toHex();
72
71
  if (ofacWallets.includes(ethereumWallet)) {
73
72
  throw new GeneralException(new Error('You cannot execute this transaction'));
@@ -81,7 +80,7 @@ export class MsgBroadcasterWithPk {
81
80
  ethereumAddress: ethereumWallet,
82
81
  };
83
82
  const web3Msgs = msgs.map((msg) => msg.toWeb3());
84
- if (!ethereumChainId) {
83
+ if (!evmChainId) {
85
84
  throw new GeneralException(new Error('Please provide ethereumChainId'));
86
85
  }
87
86
  let timeoutHeight = undefined;
@@ -97,7 +96,7 @@ export class MsgBroadcasterWithPk {
97
96
  memo: tx.memo,
98
97
  message: web3Msgs,
99
98
  address: tx.ethereumAddress,
100
- chainId: ethereumChainId,
99
+ chainId: evmChainId,
101
100
  gasLimit: getGasPriceBasedOnMessage(msgs),
102
101
  estimateGas: simulateTx || false,
103
102
  timeoutHeight,
@@ -106,7 +105,7 @@ export class MsgBroadcasterWithPk {
106
105
  const response = await transactionApi.broadcastTxRequest({
107
106
  txResponse,
108
107
  message: web3Msgs,
109
- chainId: ethereumChainId,
108
+ chainId: evmChainId,
110
109
  signature: `0x${Buffer.from(signature).toString('hex')}`,
111
110
  });
112
111
  return await new TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
@@ -1,11 +1,11 @@
1
1
  import { Msgs } from '../../modules/msgs.js';
2
- import { EthereumChainId } from '@injectivelabs/ts-types';
2
+ import { EvmChainId } from '@injectivelabs/ts-types';
3
3
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
4
- export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
4
+ export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
5
5
  msgs: Msgs | Msgs[];
6
6
  tx: Eip712ConvertTxArgs;
7
7
  fee?: Eip712ConvertFeeArgs;
8
- ethereumChainId: EthereumChainId;
8
+ evmChainId: EvmChainId;
9
9
  }) => {
10
10
  message: {
11
11
  msgs: {
@@ -57,11 +57,11 @@ export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
57
57
  }[];
58
58
  };
59
59
  };
60
- export declare const getEip712TypedDataV2: ({ msgs, tx, fee, ethereumChainId, }: {
60
+ export declare const getEip712TypedDataV2: ({ msgs, tx, fee, evmChainId, }: {
61
61
  msgs: Msgs | Msgs[];
62
62
  tx: Eip712ConvertTxArgs;
63
63
  fee?: Eip712ConvertFeeArgs;
64
- ethereumChainId: EthereumChainId;
64
+ evmChainId: EvmChainId;
65
65
  }) => {
66
66
  message: {
67
67
  context: string;
@@ -1,6 +1,6 @@
1
- import { getEip712Fee, getEipTxDetails, getEip712Domain, getEip712DomainV2, getDefaultEip712Types, getTypesIncludingFeePayer, getDefaultEip712TypesV2, } from './utils.js';
1
+ import { getEip712Fee, getEipTxDetails, getEip712Domain, getEip712DomainV2, getDefaultEip712Types, getDefaultEip712TypesV2, getTypesIncludingFeePayer, } from './utils.js';
2
2
  import { getEipTxContext } from './utils.js';
3
- export const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
3
+ export const getEip712TypedData = ({ msgs, tx, fee, evmChainId, }) => {
4
4
  const messages = Array.isArray(msgs) ? msgs : [msgs];
5
5
  const eip712Msgs = messages.map((m) => m.toEip712());
6
6
  const eip712MessageTypes = messages[0].toEip712Types();
@@ -18,7 +18,7 @@ export const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
18
18
  return {
19
19
  ...typesWithFeePayer,
20
20
  primaryType: 'Tx',
21
- ...getEip712Domain(ethereumChainId),
21
+ ...getEip712Domain(evmChainId),
22
22
  message: {
23
23
  ...getEipTxDetails(tx),
24
24
  ...getEip712Fee(fee),
@@ -26,14 +26,14 @@ export const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
26
26
  },
27
27
  };
28
28
  };
29
- export const getEip712TypedDataV2 = ({ msgs, tx, fee, ethereumChainId, }) => {
29
+ export const getEip712TypedDataV2 = ({ msgs, tx, fee, evmChainId, }) => {
30
30
  const messages = Array.isArray(msgs) ? msgs : [msgs];
31
31
  const eip712Msgs = messages.map((m) => m.toEip712V2());
32
32
  const types = getDefaultEip712TypesV2();
33
33
  return {
34
34
  ...types,
35
35
  primaryType: 'Tx',
36
- ...getEip712DomainV2(ethereumChainId),
36
+ ...getEip712DomainV2(evmChainId),
37
37
  message: {
38
38
  context: JSON.stringify(getEipTxContext({ ...tx, fee })),
39
39
  msgs: JSON.stringify(eip712Msgs),
@@ -1,6 +1,6 @@
1
- import { EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
3
- export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
3
+ export declare const getEip712Domain: (evmChainId: EvmChainId) => {
4
4
  domain: {
5
5
  name: string;
6
6
  version: string;
@@ -9,7 +9,7 @@ export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
9
9
  verifyingContract: string;
10
10
  };
11
11
  };
12
- export declare const getEip712DomainV2: (ethereumChainId: EthereumChainId) => {
12
+ export declare const getEip712DomainV2: (evmChainId: EvmChainId) => {
13
13
  domain: {
14
14
  name: string;
15
15
  version: string;
@@ -1,21 +1,21 @@
1
1
  import { BigNumberInBase, DEFAULT_GAS_LIMIT, DEFAULT_STD_FEE, } from '@injectivelabs/utils';
2
- export const getEip712Domain = (ethereumChainId) => {
2
+ export const getEip712Domain = (evmChainId) => {
3
3
  return {
4
4
  domain: {
5
5
  name: 'Injective Web3',
6
6
  version: '1.0.0',
7
- chainId: '0x' + new BigNumberInBase(ethereumChainId).toString(16),
7
+ chainId: '0x' + new BigNumberInBase(evmChainId).toString(16),
8
8
  salt: '0',
9
9
  verifyingContract: 'cosmos',
10
10
  },
11
11
  };
12
12
  };
13
- export const getEip712DomainV2 = (ethereumChainId) => {
13
+ export const getEip712DomainV2 = (evmChainId) => {
14
14
  return {
15
15
  domain: {
16
16
  name: 'Injective Web3',
17
17
  version: '1.0.0',
18
- chainId: '0x' + new BigNumberInBase(ethereumChainId).toString(16),
18
+ chainId: '0x' + new BigNumberInBase(evmChainId).toString(16),
19
19
  verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
20
20
  salt: '0',
21
21
  },
@@ -1,4 +1,4 @@
1
- import { ChainId, EthereumChainId } from '@injectivelabs/ts-types';
1
+ import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
3
  import { GoogleProtobufAny, CosmosTxV1Beta1Tx, InjectiveTypesV1Beta1TxExt, CosmosTxSigningV1Beta1Signing } from '@injectivelabs/core-proto-ts';
4
4
  export declare const getPublicKey: ({ chainId, key, }: {
@@ -49,8 +49,8 @@ export declare const createSignDocFromTransaction: (args: {
49
49
  accountNumber: number;
50
50
  }) => CosmosTxV1Beta1Tx.SignDoc;
51
51
  export declare const createTxRawEIP712: (txRaw: CosmosTxV1Beta1Tx.TxRaw, extension: InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx, nonCriticalExtension?: GoogleProtobufAny.Any | GoogleProtobufAny.Any[]) => CosmosTxV1Beta1Tx.TxRaw;
52
- export declare const createWeb3Extension: ({ ethereumChainId, feePayer, feePayerSig, }: {
53
- ethereumChainId: EthereumChainId;
52
+ export declare const createWeb3Extension: ({ evmChainId, feePayer, feePayerSig, }: {
53
+ evmChainId: EvmChainId;
54
54
  feePayer?: string;
55
55
  feePayerSig?: Uint8Array;
56
56
  }) => InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx;
@@ -108,9 +108,9 @@ export const createTxRawEIP712 = (txRaw, extension, nonCriticalExtension) => {
108
108
  txRaw.bodyBytes = CosmosTxV1Beta1Tx.TxBody.encode(body).finish();
109
109
  return txRaw;
110
110
  };
111
- export const createWeb3Extension = ({ ethereumChainId, feePayer, feePayerSig, }) => {
111
+ export const createWeb3Extension = ({ evmChainId, feePayer, feePayerSig, }) => {
112
112
  const web3Extension = InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.create();
113
- web3Extension.typedDataChainID = ethereumChainId.toString();
113
+ web3Extension.typedDataChainID = evmChainId.toString();
114
114
  if (feePayer) {
115
115
  web3Extension.feePayer = feePayer;
116
116
  }
@@ -1,4 +1,4 @@
1
1
  import * as grpcPkg from '@injectivelabs/grpc-web';
2
2
  declare const grpc: typeof grpcPkg.grpc;
3
- export declare const getGrpcTransport: () => import("@injectivelabs/grpc-web").grpc.TransportFactory;
3
+ export declare const getGrpcTransport: () => grpcPkg.grpc.TransportFactory;
4
4
  export { grpc, grpcPkg };
@@ -19,4 +19,4 @@ export declare const fetchAllWithPagination: <T extends {
19
19
  pagination: PaginationOption | undefined;
20
20
  } | PaginationOption | undefined, Q extends {
21
21
  pagination: Pagination;
22
- }>(args: T, method: (args: T) => Promise<Q>) => Promise<Q>;
22
+ }>(args: T, method: (args: T) => Promise<Q>, result?: Array<unknown>) => Promise<Q>;
@@ -88,24 +88,17 @@ export const grpcPagingToPaging = (pagination) => {
88
88
  total: parseInt(pagination.total || '0', 10),
89
89
  };
90
90
  };
91
- export const fetchAllWithPagination = async (args, method) => {
92
- let result = [];
91
+ export const fetchAllWithPagination = async (args, method, result = []) => {
93
92
  let response = await method(args);
94
93
  if (!args) {
95
94
  return response;
96
95
  }
97
- const paginationOption = args.pagination;
98
- if (!paginationOption) {
99
- return response;
100
- }
101
96
  const keys = Object.keys(response);
102
97
  const valueKey = keys.find((key) => key !== 'pagination');
103
- while (response.pagination.next) {
104
- result.push(response[valueKey]);
105
- response = await method({
106
- ...args,
107
- pagination: { ...paginationOption, key: response.pagination.next },
108
- });
98
+ result.push(...response[valueKey]);
99
+ const paginationOption = args;
100
+ if (response.pagination.next) {
101
+ return fetchAllWithPagination({ ...paginationOption, key: response.pagination.next }, method, result);
109
102
  }
110
103
  return { [valueKey]: result, pagination: response.pagination };
111
104
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@injectivelabs/sdk-ts",
3
3
  "description": "SDK in TypeScript for building Injective applications in a browser, node, and react native environment.",
4
- "version": "1.16.5",
4
+ "version": "1.16.6-alpha.0",
5
5
  "sideEffects": false,
6
6
  "license": "Apache-2.0",
7
7
  "author": {
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "scripts": {
104
104
  "fetch:ofac": "node --experimental-fetch ./../../etc/ofac.js",
105
- "build": "yarn build:cjs && yarn build:esm && yarn build:post",
105
+ "build": "pnpm build:cjs && pnpm build:esm && pnpm build:post",
106
106
  "build:cjs": "tsc --build --force tsconfig.build.json",
107
107
  "build:esm": "tsc --build --force tsconfig.build.esm.json",
108
- "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn build:post",
108
+ "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && pnpm build:post",
109
109
  "build:post": "shx cp ../../etc/stub/package.json.stub dist/cjs/package.json && shx cp ../../etc/stub/package.esm.json.stub dist/esm/package.json",
110
110
  "clean": "tsc --build tsconfig.build.json --clean && tsc --build tsconfig.build.esm.json --clean && shx rm -rf coverage *.log junit.xml dist && jest --clearCache && shx mkdir -p dist",
111
111
  "test": "jest",
@@ -123,16 +123,16 @@
123
123
  "@cosmjs/stargate": "^0.33.0",
124
124
  "@injectivelabs/abacus-proto-ts": "1.14.0",
125
125
  "@injectivelabs/core-proto-ts": "1.16.1",
126
- "@injectivelabs/exceptions": "^1.16.5",
126
+ "@injectivelabs/exceptions": "1.16.6-alpha.0",
127
127
  "@injectivelabs/grpc-web": "^0.0.1",
128
128
  "@injectivelabs/grpc-web-node-http-transport": "^0.0.2",
129
129
  "@injectivelabs/grpc-web-react-native-transport": "^0.0.2",
130
130
  "@injectivelabs/indexer-proto-ts": "1.13.14",
131
131
  "@injectivelabs/mito-proto-ts": "1.13.2",
132
- "@injectivelabs/networks": "^1.16.5",
132
+ "@injectivelabs/networks": "1.16.6-alpha.0",
133
133
  "@injectivelabs/olp-proto-ts": "1.13.4",
134
- "@injectivelabs/ts-types": "^1.16.5",
135
- "@injectivelabs/utils": "^1.16.5",
134
+ "@injectivelabs/ts-types": "1.16.6-alpha.0",
135
+ "@injectivelabs/utils": "1.16.6-alpha.0",
136
136
  "@metamask/eth-sig-util": "^8.2.0",
137
137
  "@noble/curves": "^1.8.1",
138
138
  "@noble/hashes": "^1.7.1",
@@ -147,21 +147,17 @@
147
147
  "graphql": "^16.10.0",
148
148
  "http-status-codes": "^2.2.0",
149
149
  "keccak256": "^1.0.6",
150
+ "rxjs": "7.8.2",
150
151
  "secp256k1": "^4.0.3",
151
152
  "shx": "^0.3.4",
152
153
  "snakecase-keys": "^5.4.1"
153
154
  },
154
- "gitHead": "59378cbaf7f09e97bd0c8c157fd03abdd0ea35d5",
155
+ "gitHead": "b2bd329705e0848283332658754771d45c09d4f7",
155
156
  "typedoc": {
156
157
  "entryPoint": "./src/index.ts",
157
158
  "readmeFile": "./README.md",
158
159
  "displayName": "sdk-ts API documentation"
159
160
  },
160
- "resolutions": {
161
- "@ethereumjs/tx": "^4.1.1",
162
- "**/libsodium": "npm:@bangjelkoski/noop",
163
- "**/libsodium-wrappers": "npm:@bangjelkoski/noop"
164
- },
165
161
  "devDependencies": {
166
162
  "@types/crypto-js": "^4.2.2",
167
163
  "@types/lodash.toarray": "^4.4.7"