@injectivelabs/sdk-ts 1.16.2-alpha.1 → 1.16.3

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 (38) 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/client/indexer/transformers/IndexerGrpcExplorerTransformer.js +2 -1
  5. package/dist/cjs/core/accounts/PrivateKey.d.ts +2 -2
  6. package/dist/cjs/core/accounts/PrivateKey.js +17 -17
  7. package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContract.d.ts +0 -1
  8. package/dist/cjs/core/modules/wasm/msgs/MsgExecuteContract.js +7 -3
  9. package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +3 -3
  10. package/dist/cjs/core/tx/broadcaster/MsgBroadcasterWithPk.js +7 -6
  11. package/dist/cjs/core/tx/eip712/eip712.d.ts +5 -5
  12. package/dist/cjs/core/tx/eip712/eip712.js +4 -4
  13. package/dist/cjs/core/tx/eip712/utils.d.ts +3 -3
  14. package/dist/cjs/core/tx/eip712/utils.js +4 -4
  15. package/dist/cjs/core/tx/utils/tx.d.ts +3 -3
  16. package/dist/cjs/core/tx/utils/tx.js +2 -2
  17. package/dist/cjs/utils/grpc.d.ts +1 -1
  18. package/dist/cjs/utils/pagination.d.ts +1 -1
  19. package/dist/cjs/utils/pagination.js +12 -5
  20. package/dist/esm/client/indexer/grpc/IndexerGrpcTransactionApi.d.ts +3 -3
  21. package/dist/esm/client/indexer/grpc/IndexerGrpcWeb3GwApi.d.ts +2 -2
  22. package/dist/esm/client/indexer/transformers/IndexerGrpcExplorerTransformer.js +2 -1
  23. package/dist/esm/core/accounts/PrivateKey.d.ts +2 -2
  24. package/dist/esm/core/accounts/PrivateKey.js +17 -17
  25. package/dist/esm/core/modules/wasm/msgs/MsgExecuteContract.d.ts +0 -1
  26. package/dist/esm/core/modules/wasm/msgs/MsgExecuteContract.js +7 -3
  27. package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.d.ts +3 -3
  28. package/dist/esm/core/tx/broadcaster/MsgBroadcasterWithPk.js +7 -6
  29. package/dist/esm/core/tx/eip712/eip712.d.ts +5 -5
  30. package/dist/esm/core/tx/eip712/eip712.js +5 -5
  31. package/dist/esm/core/tx/eip712/utils.d.ts +3 -3
  32. package/dist/esm/core/tx/eip712/utils.js +4 -4
  33. package/dist/esm/core/tx/utils/tx.d.ts +3 -3
  34. package/dist/esm/core/tx/utils/tx.js +2 -2
  35. package/dist/esm/utils/grpc.d.ts +1 -1
  36. package/dist/esm/utils/pagination.d.ts +1 -1
  37. package/dist/esm/utils/pagination.js +12 -5
  38. package/package.json +13 -9
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
- pnpm add @injectivelabs/sdk-ts
36
+ yarn add @injectivelabs/sdk-ts
37
37
  ```
38
38
 
39
39
  ---
@@ -1,10 +1,10 @@
1
- import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EthereumChainId } 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: EvmChainId;
7
+ chainId: EthereumChainId;
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: EvmChainId;
44
+ chainId: EthereumChainId;
45
45
  useCorrectEIP712Hash?: boolean;
46
46
  txResponse: InjectiveExchangeRpc.PrepareTxResponse;
47
47
  message: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EthereumChainId } 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: EvmChainId;
12
+ chainId: EthereumChainId;
13
13
  message: any;
14
14
  estimateGas?: boolean;
15
15
  gasLimit?: number;
@@ -42,7 +42,8 @@ const parseStringToObjectLikeNoThrow = (object, defaultValue = []) => {
42
42
  };
43
43
  const transactionV2MessagesToMessagesNoThrow = (messages) => {
44
44
  const messagesArray = parseStringToObjectLikeNoThrow(messages);
45
- return messagesArray.map((msg) => ({
45
+ const nonNullMessages = messagesArray.filter((msg) => !!msg);
46
+ return nonNullMessages.map((msg) => ({
46
47
  type: msg.type,
47
48
  message: msg.value,
48
49
  }));
@@ -1,6 +1,6 @@
1
- import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
2
- import { Address } from './Address.js';
3
1
  import { PublicKey } from './PublicKey.js';
2
+ import { Address } from './Address.js';
3
+ import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
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 secp256k1_1 = __importDefault(require("secp256k1"));
8
- const keccak256_1 = __importDefault(require("keccak256"));
9
7
  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
8
  const ethers_1 = require("ethers");
9
+ const secp256k1_1 = __importDefault(require("secp256k1"));
10
+ const keccak256_1 = __importDefault(require("keccak256"));
11
+ const PublicKey_js_1 = require("./PublicKey.js");
12
+ const Address_js_1 = require("./Address.js");
14
13
  const eth_sig_util_1 = require("@metamask/eth-sig-util");
15
14
  const index_js_1 = require("../../utils/index.js");
16
- const Address_js_1 = require("./Address.js");
17
- const PublicKey_js_1 = require("./PublicKey.js");
15
+ const core_proto_ts_1 = require("@injectivelabs/core-proto-ts");
18
16
  const tx_js_1 = require("../tx/utils/tx.js");
19
17
  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,
269
270
  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,
276
277
  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 evmChainId = Number(decodedExtension.typedDataChainID);
281
+ const ethereumChainId = Number(decodedExtension.typedDataChainID);
282
282
  return {
283
- evmChainId: ts_types_1.EvmChainId,
283
+ ethereumChainId: ethereumChainId,
284
284
  chainId: [
285
- ts_types_1.EvmChainId.Kovan,
286
- ts_types_1.EvmChainId.Goerli,
287
- ts_types_1.EvmChainId.Sepolia,
288
- ].includes(evmChainId)
285
+ ts_types_1.EthereumChainId.Goerli,
286
+ ts_types_1.EthereumChainId.Kovan,
287
+ ts_types_1.EthereumChainId.Sepolia,
288
+ ].includes(ethereumChainId)
289
289
  ? ts_types_1.ChainId.Testnet
290
290
  : ts_types_1.ChainId.Mainnet,
291
291
  };
292
292
  };
293
- const { evmChainId, chainId } = getChainIds();
293
+ const { ethereumChainId, 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
- evmChainId: evmChainId,
308
+ ethereumChainId,
309
309
  });
310
310
  return this.verifySignature({
311
311
  eip712: eip712TypedData,
@@ -53,7 +53,6 @@ export default class MsgExecuteContract extends MsgBase<MsgExecuteContract.Param
53
53
  msg: any;
54
54
  '@type': string;
55
55
  };
56
- toEip712(): never;
57
56
  toDirectSign(): {
58
57
  type: string;
59
58
  message: CosmwasmWasmV1Tx.MsgExecuteContract;
@@ -62,9 +62,13 @@ class MsgExecuteContract extends MsgBase_js_1.MsgBase {
62
62
  ...value,
63
63
  };
64
64
  }
65
- toEip712() {
66
- throw new exceptions_1.GeneralException(new Error('EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2'));
67
- }
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
+ // }
68
72
  toDirectSign() {
69
73
  const proto = this.toProto();
70
74
  return {
@@ -1,6 +1,6 @@
1
1
  import { PrivateKey } from '../../accounts/index.js';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
- import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
3
+ import { ChainId, EthereumChainId } 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
- evmChainId?: EvmChainId;
28
+ ethereumChainId?: EthereumChainId;
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
- evmChainId?: EvmChainId;
48
+ ethereumChainId?: EthereumChainId;
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
- evmChainId;
26
+ ethereumChainId;
27
27
  privateKey;
28
28
  simulateTx = false;
29
29
  txTimeoutOnFeeDelegation = false;
@@ -39,7 +39,8 @@ 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.evmChainId = options.evmChainId || networkInfo.evmChainId;
42
+ this.ethereumChainId =
43
+ options.ethereumChainId || networkInfo.ethereumChainId;
43
44
  this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
44
45
  this.privateKey =
45
46
  options.privateKey instanceof index_js_1.PrivateKey
@@ -69,7 +70,7 @@ class MsgBroadcasterWithPk {
69
70
  * @returns {string} transaction hash
70
71
  */
71
72
  async broadcastWithFeeDelegation(transaction) {
72
- const { endpoints, txTimeout, simulateTx, privateKey, evmChainId, txTimeoutOnFeeDelegation, } = this;
73
+ const { simulateTx, privateKey, ethereumChainId, endpoints, txTimeoutOnFeeDelegation, txTimeout, } = this;
73
74
  const ethereumWallet = this.privateKey.toHex();
74
75
  if (index_js_5.ofacWallets.includes(ethereumWallet)) {
75
76
  throw new exceptions_1.GeneralException(new Error('You cannot execute this transaction'));
@@ -83,7 +84,7 @@ class MsgBroadcasterWithPk {
83
84
  ethereumAddress: ethereumWallet,
84
85
  };
85
86
  const web3Msgs = msgs.map((msg) => msg.toWeb3());
86
- if (!evmChainId) {
87
+ if (!ethereumChainId) {
87
88
  throw new exceptions_1.GeneralException(new Error('Please provide ethereumChainId'));
88
89
  }
89
90
  let timeoutHeight = undefined;
@@ -99,7 +100,7 @@ class MsgBroadcasterWithPk {
99
100
  memo: tx.memo,
100
101
  message: web3Msgs,
101
102
  address: tx.ethereumAddress,
102
- chainId: evmChainId,
103
+ chainId: ethereumChainId,
103
104
  gasLimit: (0, msgs_js_1.getGasPriceBasedOnMessage)(msgs),
104
105
  estimateGas: simulateTx || false,
105
106
  timeoutHeight,
@@ -108,7 +109,7 @@ class MsgBroadcasterWithPk {
108
109
  const response = await transactionApi.broadcastTxRequest({
109
110
  txResponse,
110
111
  message: web3Msgs,
111
- chainId: evmChainId,
112
+ chainId: ethereumChainId,
112
113
  signature: `0x${Buffer.from(signature).toString('hex')}`,
113
114
  });
114
115
  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 { EvmChainId } from '@injectivelabs/ts-types';
2
+ import { EthereumChainId } from '@injectivelabs/ts-types';
3
3
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
4
- export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
4
+ export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
5
5
  msgs: Msgs | Msgs[];
6
6
  tx: Eip712ConvertTxArgs;
7
7
  fee?: Eip712ConvertFeeArgs;
8
- evmChainId: EvmChainId;
8
+ ethereumChainId: EthereumChainId;
9
9
  }) => {
10
10
  message: {
11
11
  msgs: {
@@ -57,11 +57,11 @@ export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
57
57
  }[];
58
58
  };
59
59
  };
60
- export declare const getEip712TypedDataV2: ({ msgs, tx, fee, evmChainId, }: {
60
+ export declare const getEip712TypedDataV2: ({ msgs, tx, fee, ethereumChainId, }: {
61
61
  msgs: Msgs | Msgs[];
62
62
  tx: Eip712ConvertTxArgs;
63
63
  fee?: Eip712ConvertFeeArgs;
64
- evmChainId: EvmChainId;
64
+ ethereumChainId: EthereumChainId;
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, evmChainId, }) => {
6
+ const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
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, evmChainId, }) => {
21
21
  return {
22
22
  ...typesWithFeePayer,
23
23
  primaryType: 'Tx',
24
- ...(0, utils_js_1.getEip712Domain)(evmChainId),
24
+ ...(0, utils_js_1.getEip712Domain)(ethereumChainId),
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, evmChainId, }) => {
30
30
  };
31
31
  };
32
32
  exports.getEip712TypedData = getEip712TypedData;
33
- const getEip712TypedDataV2 = ({ msgs, tx, fee, evmChainId, }) => {
33
+ const getEip712TypedDataV2 = ({ msgs, tx, fee, ethereumChainId, }) => {
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)(evmChainId),
40
+ ...(0, utils_js_1.getEip712DomainV2)(ethereumChainId),
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 { EvmChainId } from '@injectivelabs/ts-types';
1
+ import { EthereumChainId } from '@injectivelabs/ts-types';
2
2
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
3
- export declare const getEip712Domain: (evmChainId: EvmChainId) => {
3
+ export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
4
4
  domain: {
5
5
  name: string;
6
6
  version: string;
@@ -9,7 +9,7 @@ export declare const getEip712Domain: (evmChainId: EvmChainId) => {
9
9
  verifyingContract: string;
10
10
  };
11
11
  };
12
- export declare const getEip712DomainV2: (evmChainId: EvmChainId) => {
12
+ export declare const getEip712DomainV2: (ethereumChainId: EthereumChainId) => {
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 = (evmChainId) => {
5
+ const getEip712Domain = (ethereumChainId) => {
6
6
  return {
7
7
  domain: {
8
8
  name: 'Injective Web3',
9
9
  version: '1.0.0',
10
- chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
10
+ chainId: '0x' + new utils_1.BigNumberInBase(ethereumChainId).toString(16),
11
11
  salt: '0',
12
12
  verifyingContract: 'cosmos',
13
13
  },
14
14
  };
15
15
  };
16
16
  exports.getEip712Domain = getEip712Domain;
17
- const getEip712DomainV2 = (evmChainId) => {
17
+ const getEip712DomainV2 = (ethereumChainId) => {
18
18
  return {
19
19
  domain: {
20
20
  name: 'Injective Web3',
21
21
  version: '1.0.0',
22
- chainId: '0x' + new utils_1.BigNumberInBase(evmChainId).toString(16),
22
+ chainId: '0x' + new utils_1.BigNumberInBase(ethereumChainId).toString(16),
23
23
  verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
24
24
  salt: '0',
25
25
  },
@@ -1,4 +1,4 @@
1
- import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { ChainId, EthereumChainId } 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: ({ evmChainId, feePayer, feePayerSig, }: {
53
- evmChainId: EvmChainId;
52
+ export declare const createWeb3Extension: ({ ethereumChainId, feePayer, feePayerSig, }: {
53
+ ethereumChainId: EthereumChainId;
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 = ({ evmChainId, feePayer, feePayerSig, }) => {
123
+ const createWeb3Extension = ({ ethereumChainId, feePayer, feePayerSig, }) => {
124
124
  const web3Extension = core_proto_ts_1.InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.create();
125
- web3Extension.typedDataChainID = evmChainId.toString();
125
+ web3Extension.typedDataChainID = ethereumChainId.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: () => grpcPkg.grpc.TransportFactory;
3
+ export declare const getGrpcTransport: () => import("@injectivelabs/grpc-web").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>, result?: Array<unknown>) => Promise<Q>;
22
+ }>(args: T, method: (args: T) => Promise<Q>) => Promise<Q>;
@@ -97,17 +97,24 @@ const grpcPagingToPaging = (pagination) => {
97
97
  };
98
98
  };
99
99
  exports.grpcPagingToPaging = grpcPagingToPaging;
100
- const fetchAllWithPagination = async (args, method, result = []) => {
100
+ const fetchAllWithPagination = async (args, method) => {
101
+ let result = [];
101
102
  let response = await method(args);
102
103
  if (!args) {
103
104
  return response;
104
105
  }
106
+ const paginationOption = args.pagination;
107
+ if (!paginationOption) {
108
+ return response;
109
+ }
105
110
  const keys = Object.keys(response);
106
111
  const valueKey = keys.find((key) => key !== 'pagination');
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);
112
+ while (response.pagination.next) {
113
+ result.push(response[valueKey]);
114
+ response = await method({
115
+ ...args,
116
+ pagination: { ...paginationOption, key: response.pagination.next },
117
+ });
111
118
  }
112
119
  return { [valueKey]: result, pagination: response.pagination };
113
120
  };
@@ -1,10 +1,10 @@
1
- import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EthereumChainId } 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: EvmChainId;
7
+ chainId: EthereumChainId;
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: EvmChainId;
44
+ chainId: EthereumChainId;
45
45
  useCorrectEIP712Hash?: boolean;
46
46
  txResponse: InjectiveExchangeRpc.PrepareTxResponse;
47
47
  message: Record<string, any>;
@@ -1,4 +1,4 @@
1
- import { AccountAddress, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { AccountAddress, EthereumChainId } 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: EvmChainId;
12
+ chainId: EthereumChainId;
13
13
  message: any;
14
14
  estimateGas?: boolean;
15
15
  gasLimit?: number;
@@ -39,7 +39,8 @@ const parseStringToObjectLikeNoThrow = (object, defaultValue = []) => {
39
39
  };
40
40
  const transactionV2MessagesToMessagesNoThrow = (messages) => {
41
41
  const messagesArray = parseStringToObjectLikeNoThrow(messages);
42
- return messagesArray.map((msg) => ({
42
+ const nonNullMessages = messagesArray.filter((msg) => !!msg);
43
+ return nonNullMessages.map((msg) => ({
43
44
  type: msg.type,
44
45
  message: msg.value,
45
46
  }));
@@ -1,6 +1,6 @@
1
- import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
2
- import { Address } from './Address.js';
3
1
  import { PublicKey } from './PublicKey.js';
2
+ import { Address } from './Address.js';
3
+ import { CosmosTxV1Beta1Tx } from '@injectivelabs/core-proto-ts';
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 secp256k1 from 'secp256k1';
2
- import keccak256 from 'keccak256';
3
1
  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
2
  import { Wallet, HDNodeWallet, Signature, getBytes, concat } from 'ethers';
3
+ import secp256k1 from 'secp256k1';
4
+ import keccak256 from 'keccak256';
5
+ import { PublicKey } from './PublicKey.js';
6
+ import { Address } from './Address.js';
8
7
  import { signTypedData, SignTypedDataVersion } from '@metamask/eth-sig-util';
9
8
  import { DEFAULT_DERIVATION_PATH, recoverTypedSignaturePubKey, } from '../../utils/index.js';
10
- import { Address } from './Address.js';
11
- import { PublicKey } from './PublicKey.js';
9
+ import { InjectiveTypesV1Beta1TxExt, } from '@injectivelabs/core-proto-ts';
12
10
  import { getTransactionPartsFromTxRaw } from '../tx/utils/tx.js';
13
11
  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,
263
264
  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,
270
271
  chainId: ChainId.Mainnet,
271
- EvmChainId: EvmChainId.Mainnet,
272
272
  };
273
273
  }
274
274
  const decodedExtension = InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.decode(extension.value);
275
- const evmChainId = Number(decodedExtension.typedDataChainID);
275
+ const ethereumChainId = Number(decodedExtension.typedDataChainID);
276
276
  return {
277
- evmChainId: EvmChainId,
277
+ ethereumChainId: ethereumChainId,
278
278
  chainId: [
279
- EvmChainId.Kovan,
280
- EvmChainId.Goerli,
281
- EvmChainId.Sepolia,
282
- ].includes(evmChainId)
279
+ EthereumChainId.Goerli,
280
+ EthereumChainId.Kovan,
281
+ EthereumChainId.Sepolia,
282
+ ].includes(ethereumChainId)
283
283
  ? ChainId.Testnet
284
284
  : ChainId.Mainnet,
285
285
  };
286
286
  };
287
- const { evmChainId, chainId } = getChainIds();
287
+ const { ethereumChainId, 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
- evmChainId: evmChainId,
302
+ ethereumChainId,
303
303
  });
304
304
  return this.verifySignature({
305
305
  eip712: eip712TypedData,
@@ -53,7 +53,6 @@ export default class MsgExecuteContract extends MsgBase<MsgExecuteContract.Param
53
53
  msg: any;
54
54
  '@type': string;
55
55
  };
56
- toEip712(): never;
57
56
  toDirectSign(): {
58
57
  type: string;
59
58
  message: CosmwasmWasmV1Tx.MsgExecuteContract;
@@ -57,9 +57,13 @@ export default class MsgExecuteContract extends MsgBase {
57
57
  ...value,
58
58
  };
59
59
  }
60
- toEip712() {
61
- throw new GeneralException(new Error('EIP712_v1 is not supported for MsgExecuteContract. Please use EIP712_v2'));
62
- }
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
+ // }
63
67
  toDirectSign() {
64
68
  const proto = this.toProto();
65
69
  return {
@@ -1,6 +1,6 @@
1
1
  import { PrivateKey } from '../../accounts/index.js';
2
2
  import { Msgs } from '../../modules/msgs.js';
3
- import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
3
+ import { ChainId, EthereumChainId } 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
- evmChainId?: EvmChainId;
28
+ ethereumChainId?: EthereumChainId;
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
- evmChainId?: EvmChainId;
48
+ ethereumChainId?: EthereumChainId;
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
- evmChainId;
23
+ ethereumChainId;
24
24
  privateKey;
25
25
  simulateTx = false;
26
26
  txTimeoutOnFeeDelegation = false;
@@ -36,7 +36,8 @@ 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.evmChainId = options.evmChainId || networkInfo.evmChainId;
39
+ this.ethereumChainId =
40
+ options.ethereumChainId || networkInfo.ethereumChainId;
40
41
  this.endpoints = { ...endpoints, ...(options.endpoints || {}) };
41
42
  this.privateKey =
42
43
  options.privateKey instanceof PrivateKey
@@ -66,7 +67,7 @@ export class MsgBroadcasterWithPk {
66
67
  * @returns {string} transaction hash
67
68
  */
68
69
  async broadcastWithFeeDelegation(transaction) {
69
- const { endpoints, txTimeout, simulateTx, privateKey, evmChainId, txTimeoutOnFeeDelegation, } = this;
70
+ const { simulateTx, privateKey, ethereumChainId, endpoints, txTimeoutOnFeeDelegation, txTimeout, } = this;
70
71
  const ethereumWallet = this.privateKey.toHex();
71
72
  if (ofacWallets.includes(ethereumWallet)) {
72
73
  throw new GeneralException(new Error('You cannot execute this transaction'));
@@ -80,7 +81,7 @@ export class MsgBroadcasterWithPk {
80
81
  ethereumAddress: ethereumWallet,
81
82
  };
82
83
  const web3Msgs = msgs.map((msg) => msg.toWeb3());
83
- if (!evmChainId) {
84
+ if (!ethereumChainId) {
84
85
  throw new GeneralException(new Error('Please provide ethereumChainId'));
85
86
  }
86
87
  let timeoutHeight = undefined;
@@ -96,7 +97,7 @@ export class MsgBroadcasterWithPk {
96
97
  memo: tx.memo,
97
98
  message: web3Msgs,
98
99
  address: tx.ethereumAddress,
99
- chainId: evmChainId,
100
+ chainId: ethereumChainId,
100
101
  gasLimit: getGasPriceBasedOnMessage(msgs),
101
102
  estimateGas: simulateTx || false,
102
103
  timeoutHeight,
@@ -105,7 +106,7 @@ export class MsgBroadcasterWithPk {
105
106
  const response = await transactionApi.broadcastTxRequest({
106
107
  txResponse,
107
108
  message: web3Msgs,
108
- chainId: evmChainId,
109
+ chainId: ethereumChainId,
109
110
  signature: `0x${Buffer.from(signature).toString('hex')}`,
110
111
  });
111
112
  return await new TxGrpcApi(endpoints.grpc).fetchTxPoll(response.txHash);
@@ -1,11 +1,11 @@
1
1
  import { Msgs } from '../../modules/msgs.js';
2
- import { EvmChainId } from '@injectivelabs/ts-types';
2
+ import { EthereumChainId } from '@injectivelabs/ts-types';
3
3
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
4
- export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
4
+ export declare const getEip712TypedData: ({ msgs, tx, fee, ethereumChainId, }: {
5
5
  msgs: Msgs | Msgs[];
6
6
  tx: Eip712ConvertTxArgs;
7
7
  fee?: Eip712ConvertFeeArgs;
8
- evmChainId: EvmChainId;
8
+ ethereumChainId: EthereumChainId;
9
9
  }) => {
10
10
  message: {
11
11
  msgs: {
@@ -57,11 +57,11 @@ export declare const getEip712TypedData: ({ msgs, tx, fee, evmChainId, }: {
57
57
  }[];
58
58
  };
59
59
  };
60
- export declare const getEip712TypedDataV2: ({ msgs, tx, fee, evmChainId, }: {
60
+ export declare const getEip712TypedDataV2: ({ msgs, tx, fee, ethereumChainId, }: {
61
61
  msgs: Msgs | Msgs[];
62
62
  tx: Eip712ConvertTxArgs;
63
63
  fee?: Eip712ConvertFeeArgs;
64
- evmChainId: EvmChainId;
64
+ ethereumChainId: EthereumChainId;
65
65
  }) => {
66
66
  message: {
67
67
  context: string;
@@ -1,6 +1,6 @@
1
- import { getEip712Fee, getEipTxDetails, getEip712Domain, getEip712DomainV2, getDefaultEip712Types, getDefaultEip712TypesV2, getTypesIncludingFeePayer, } from './utils.js';
1
+ import { getEip712Fee, getEipTxDetails, getEip712Domain, getEip712DomainV2, getDefaultEip712Types, getTypesIncludingFeePayer, getDefaultEip712TypesV2, } from './utils.js';
2
2
  import { getEipTxContext } from './utils.js';
3
- export const getEip712TypedData = ({ msgs, tx, fee, evmChainId, }) => {
3
+ export const getEip712TypedData = ({ msgs, tx, fee, ethereumChainId, }) => {
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, evmChainId, }) => {
18
18
  return {
19
19
  ...typesWithFeePayer,
20
20
  primaryType: 'Tx',
21
- ...getEip712Domain(evmChainId),
21
+ ...getEip712Domain(ethereumChainId),
22
22
  message: {
23
23
  ...getEipTxDetails(tx),
24
24
  ...getEip712Fee(fee),
@@ -26,14 +26,14 @@ export const getEip712TypedData = ({ msgs, tx, fee, evmChainId, }) => {
26
26
  },
27
27
  };
28
28
  };
29
- export const getEip712TypedDataV2 = ({ msgs, tx, fee, evmChainId, }) => {
29
+ export const getEip712TypedDataV2 = ({ msgs, tx, fee, ethereumChainId, }) => {
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(evmChainId),
36
+ ...getEip712DomainV2(ethereumChainId),
37
37
  message: {
38
38
  context: JSON.stringify(getEipTxContext({ ...tx, fee })),
39
39
  msgs: JSON.stringify(eip712Msgs),
@@ -1,6 +1,6 @@
1
- import { EvmChainId } from '@injectivelabs/ts-types';
1
+ import { EthereumChainId } from '@injectivelabs/ts-types';
2
2
  import { Eip712ConvertFeeArgs, Eip712ConvertTxArgs } from './types.js';
3
- export declare const getEip712Domain: (evmChainId: EvmChainId) => {
3
+ export declare const getEip712Domain: (ethereumChainId: EthereumChainId) => {
4
4
  domain: {
5
5
  name: string;
6
6
  version: string;
@@ -9,7 +9,7 @@ export declare const getEip712Domain: (evmChainId: EvmChainId) => {
9
9
  verifyingContract: string;
10
10
  };
11
11
  };
12
- export declare const getEip712DomainV2: (evmChainId: EvmChainId) => {
12
+ export declare const getEip712DomainV2: (ethereumChainId: EthereumChainId) => {
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 = (evmChainId) => {
2
+ export const getEip712Domain = (ethereumChainId) => {
3
3
  return {
4
4
  domain: {
5
5
  name: 'Injective Web3',
6
6
  version: '1.0.0',
7
- chainId: '0x' + new BigNumberInBase(evmChainId).toString(16),
7
+ chainId: '0x' + new BigNumberInBase(ethereumChainId).toString(16),
8
8
  salt: '0',
9
9
  verifyingContract: 'cosmos',
10
10
  },
11
11
  };
12
12
  };
13
- export const getEip712DomainV2 = (evmChainId) => {
13
+ export const getEip712DomainV2 = (ethereumChainId) => {
14
14
  return {
15
15
  domain: {
16
16
  name: 'Injective Web3',
17
17
  version: '1.0.0',
18
- chainId: '0x' + new BigNumberInBase(evmChainId).toString(16),
18
+ chainId: '0x' + new BigNumberInBase(ethereumChainId).toString(16),
19
19
  verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC',
20
20
  salt: '0',
21
21
  },
@@ -1,4 +1,4 @@
1
- import { ChainId, EvmChainId } from '@injectivelabs/ts-types';
1
+ import { ChainId, EthereumChainId } 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: ({ evmChainId, feePayer, feePayerSig, }: {
53
- evmChainId: EvmChainId;
52
+ export declare const createWeb3Extension: ({ ethereumChainId, feePayer, feePayerSig, }: {
53
+ ethereumChainId: EthereumChainId;
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 = ({ evmChainId, feePayer, feePayerSig, }) => {
111
+ export const createWeb3Extension = ({ ethereumChainId, feePayer, feePayerSig, }) => {
112
112
  const web3Extension = InjectiveTypesV1Beta1TxExt.ExtensionOptionsWeb3Tx.create();
113
- web3Extension.typedDataChainID = evmChainId.toString();
113
+ web3Extension.typedDataChainID = ethereumChainId.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: () => grpcPkg.grpc.TransportFactory;
3
+ export declare const getGrpcTransport: () => import("@injectivelabs/grpc-web").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>, result?: Array<unknown>) => Promise<Q>;
22
+ }>(args: T, method: (args: T) => Promise<Q>) => Promise<Q>;
@@ -88,17 +88,24 @@ export const grpcPagingToPaging = (pagination) => {
88
88
  total: parseInt(pagination.total || '0', 10),
89
89
  };
90
90
  };
91
- export const fetchAllWithPagination = async (args, method, result = []) => {
91
+ export const fetchAllWithPagination = async (args, method) => {
92
+ let result = [];
92
93
  let response = await method(args);
93
94
  if (!args) {
94
95
  return response;
95
96
  }
97
+ const paginationOption = args.pagination;
98
+ if (!paginationOption) {
99
+ return response;
100
+ }
96
101
  const keys = Object.keys(response);
97
102
  const valueKey = keys.find((key) => key !== 'pagination');
98
- result.push(...response[valueKey]);
99
- const paginationOption = args;
100
- if (response.pagination.next) {
101
- return fetchAllWithPagination({ ...paginationOption, key: response.pagination.next }, method, result);
103
+ while (response.pagination.next) {
104
+ result.push(response[valueKey]);
105
+ response = await method({
106
+ ...args,
107
+ pagination: { ...paginationOption, key: response.pagination.next },
108
+ });
102
109
  }
103
110
  return { [valueKey]: result, pagination: response.pagination };
104
111
  };
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.2-alpha.1",
4
+ "version": "1.16.3",
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": "pnpm build:cjs && pnpm build:esm && pnpm build:post",
105
+ "build": "yarn build:cjs && yarn build:esm && yarn 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 && pnpm build:post",
108
+ "build:watch": "tsc --build -w tsconfig.build.json && tsc -w --build tsconfig.build.esm.json && yarn 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.2-alpha.1",
126
+ "@injectivelabs/exceptions": "^1.16.3",
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.2-alpha.1",
132
+ "@injectivelabs/networks": "^1.16.3",
133
133
  "@injectivelabs/olp-proto-ts": "1.13.4",
134
- "@injectivelabs/ts-types": "1.16.2-alpha.1",
135
- "@injectivelabs/utils": "1.16.2-alpha.1",
134
+ "@injectivelabs/ts-types": "^1.16.3",
135
+ "@injectivelabs/utils": "^1.16.3",
136
136
  "@metamask/eth-sig-util": "^8.2.0",
137
137
  "@noble/curves": "^1.8.1",
138
138
  "@noble/hashes": "^1.7.1",
@@ -147,17 +147,21 @@
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",
151
150
  "secp256k1": "^4.0.3",
152
151
  "shx": "^0.3.4",
153
152
  "snakecase-keys": "^5.4.1"
154
153
  },
155
- "gitHead": "25f2492ee251504d8b0c1f3e4ce49e96e759294b",
154
+ "gitHead": "6d6bc4a37888d089b67e5787555e760bdf29c780",
156
155
  "typedoc": {
157
156
  "entryPoint": "./src/index.ts",
158
157
  "readmeFile": "./README.md",
159
158
  "displayName": "sdk-ts API documentation"
160
159
  },
160
+ "resolutions": {
161
+ "@ethereumjs/tx": "^4.1.1",
162
+ "**/libsodium": "npm:@bangjelkoski/noop",
163
+ "**/libsodium-wrappers": "npm:@bangjelkoski/noop"
164
+ },
161
165
  "devDependencies": {
162
166
  "@types/crypto-js": "^4.2.2",
163
167
  "@types/lodash.toarray": "^4.4.7"