@shapeshiftoss/unchained-client 10.15.0 → 10.17.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 (159) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/evm/arbitrum/parser/index.js +1 -1
  3. package/dist/cjs/evm/avalanche/parser/index.js +1 -1
  4. package/dist/cjs/evm/base/parser/index.js +1 -1
  5. package/dist/cjs/evm/bnbsmartchain/parser/index.js +1 -1
  6. package/dist/cjs/evm/ethereum/parser/__tests__/ethereum.test.js +13 -13
  7. package/dist/cjs/evm/ethereum/parser/index.js +12 -3
  8. package/dist/cjs/evm/ethereum/parser/uniV2.d.ts +4 -3
  9. package/dist/cjs/evm/ethereum/parser/uniV2.js +13 -10
  10. package/dist/cjs/evm/ethereum/parser/weth.d.ts +0 -2
  11. package/dist/cjs/evm/ethereum/parser/weth.js +0 -2
  12. package/dist/cjs/evm/gnosis/parser/index.js +1 -1
  13. package/dist/cjs/evm/optimism/parser/index.js +1 -1
  14. package/dist/cjs/evm/parser/erc20.d.ts +0 -2
  15. package/dist/cjs/evm/parser/erc20.js +0 -2
  16. package/dist/cjs/evm/parser/index.d.ts +1 -2
  17. package/dist/cjs/evm/parser/index.js +2 -2
  18. package/dist/cjs/evm/polygon/parser/index.js +1 -1
  19. package/dist/cjs/generated/arbitrum/models/NotFoundError.d.ts +31 -0
  20. package/dist/cjs/generated/arbitrum/models/NotFoundError.js +51 -0
  21. package/dist/cjs/generated/arbitrum/models/index.d.ts +1 -0
  22. package/dist/cjs/generated/arbitrum/models/index.js +1 -0
  23. package/dist/cjs/generated/avalanche/models/NotFoundError.d.ts +31 -0
  24. package/dist/cjs/generated/avalanche/models/NotFoundError.js +51 -0
  25. package/dist/cjs/generated/avalanche/models/index.d.ts +1 -0
  26. package/dist/cjs/generated/avalanche/models/index.js +1 -0
  27. package/dist/cjs/generated/base/models/NotFoundError.d.ts +31 -0
  28. package/dist/cjs/generated/base/models/NotFoundError.js +51 -0
  29. package/dist/cjs/generated/base/models/index.d.ts +1 -0
  30. package/dist/cjs/generated/base/models/index.js +1 -0
  31. package/dist/cjs/generated/bitcoin/models/NotFoundError.d.ts +31 -0
  32. package/dist/cjs/generated/bitcoin/models/NotFoundError.js +51 -0
  33. package/dist/cjs/generated/bitcoin/models/index.d.ts +1 -0
  34. package/dist/cjs/generated/bitcoin/models/index.js +1 -0
  35. package/dist/cjs/generated/bitcoincash/models/NotFoundError.d.ts +31 -0
  36. package/dist/cjs/generated/bitcoincash/models/NotFoundError.js +51 -0
  37. package/dist/cjs/generated/bitcoincash/models/index.d.ts +1 -0
  38. package/dist/cjs/generated/bitcoincash/models/index.js +1 -0
  39. package/dist/cjs/generated/bnbsmartchain/models/NotFoundError.d.ts +31 -0
  40. package/dist/cjs/generated/bnbsmartchain/models/NotFoundError.js +51 -0
  41. package/dist/cjs/generated/bnbsmartchain/models/index.d.ts +1 -0
  42. package/dist/cjs/generated/bnbsmartchain/models/index.js +1 -0
  43. package/dist/cjs/generated/dogecoin/models/NotFoundError.d.ts +31 -0
  44. package/dist/cjs/generated/dogecoin/models/NotFoundError.js +51 -0
  45. package/dist/cjs/generated/dogecoin/models/index.d.ts +1 -0
  46. package/dist/cjs/generated/dogecoin/models/index.js +1 -0
  47. package/dist/cjs/generated/ethereum/apis/V1Api.d.ts +15 -0
  48. package/dist/cjs/generated/ethereum/apis/V1Api.js +24 -0
  49. package/dist/cjs/generated/ethereum/models/NotFoundError.d.ts +31 -0
  50. package/dist/cjs/generated/ethereum/models/NotFoundError.js +51 -0
  51. package/dist/cjs/generated/ethereum/models/index.d.ts +1 -0
  52. package/dist/cjs/generated/ethereum/models/index.js +1 -0
  53. package/dist/cjs/generated/gnosis/models/NotFoundError.d.ts +31 -0
  54. package/dist/cjs/generated/gnosis/models/NotFoundError.js +51 -0
  55. package/dist/cjs/generated/gnosis/models/index.d.ts +1 -0
  56. package/dist/cjs/generated/gnosis/models/index.js +1 -0
  57. package/dist/cjs/generated/litecoin/models/NotFoundError.d.ts +31 -0
  58. package/dist/cjs/generated/litecoin/models/NotFoundError.js +51 -0
  59. package/dist/cjs/generated/litecoin/models/index.d.ts +1 -0
  60. package/dist/cjs/generated/litecoin/models/index.js +1 -0
  61. package/dist/cjs/generated/optimism/models/NotFoundError.d.ts +31 -0
  62. package/dist/cjs/generated/optimism/models/NotFoundError.js +51 -0
  63. package/dist/cjs/generated/optimism/models/index.d.ts +1 -0
  64. package/dist/cjs/generated/optimism/models/index.js +1 -0
  65. package/dist/cjs/generated/polygon/models/NotFoundError.d.ts +31 -0
  66. package/dist/cjs/generated/polygon/models/NotFoundError.js +51 -0
  67. package/dist/cjs/generated/polygon/models/index.d.ts +1 -0
  68. package/dist/cjs/generated/polygon/models/index.js +1 -0
  69. package/dist/cjs/generated/solana/models/NotFoundError.d.ts +31 -0
  70. package/dist/cjs/generated/solana/models/NotFoundError.js +51 -0
  71. package/dist/cjs/generated/solana/models/index.d.ts +1 -0
  72. package/dist/cjs/generated/solana/models/index.js +1 -0
  73. package/dist/cjs/generated/zcash/models/NotFoundError.d.ts +31 -0
  74. package/dist/cjs/generated/zcash/models/NotFoundError.js +51 -0
  75. package/dist/cjs/generated/zcash/models/index.d.ts +1 -0
  76. package/dist/cjs/generated/zcash/models/index.js +1 -0
  77. package/dist/cjs/tron/__tests__/api.test.js +125 -0
  78. package/dist/cjs/tron/api.d.ts +7 -0
  79. package/dist/cjs/tron/api.js +39 -3
  80. package/dist/esm/.tsbuildinfo +1 -1
  81. package/dist/esm/evm/arbitrum/parser/index.js +1 -1
  82. package/dist/esm/evm/avalanche/parser/index.js +1 -1
  83. package/dist/esm/evm/base/parser/index.js +1 -1
  84. package/dist/esm/evm/bnbsmartchain/parser/index.js +1 -1
  85. package/dist/esm/evm/ethereum/parser/__tests__/ethereum.test.js +13 -13
  86. package/dist/esm/evm/ethereum/parser/index.js +12 -3
  87. package/dist/esm/evm/ethereum/parser/uniV2.d.ts +4 -3
  88. package/dist/esm/evm/ethereum/parser/uniV2.js +14 -11
  89. package/dist/esm/evm/ethereum/parser/weth.d.ts +0 -2
  90. package/dist/esm/evm/ethereum/parser/weth.js +0 -2
  91. package/dist/esm/evm/gnosis/parser/index.js +1 -1
  92. package/dist/esm/evm/optimism/parser/index.js +1 -1
  93. package/dist/esm/evm/parser/erc20.d.ts +0 -2
  94. package/dist/esm/evm/parser/erc20.js +0 -2
  95. package/dist/esm/evm/parser/index.d.ts +1 -2
  96. package/dist/esm/evm/parser/index.js +3 -3
  97. package/dist/esm/evm/polygon/parser/index.js +1 -1
  98. package/dist/esm/generated/arbitrum/models/NotFoundError.d.ts +31 -0
  99. package/dist/esm/generated/arbitrum/models/NotFoundError.js +44 -0
  100. package/dist/esm/generated/arbitrum/models/index.d.ts +1 -0
  101. package/dist/esm/generated/arbitrum/models/index.js +1 -0
  102. package/dist/esm/generated/avalanche/models/NotFoundError.d.ts +31 -0
  103. package/dist/esm/generated/avalanche/models/NotFoundError.js +44 -0
  104. package/dist/esm/generated/avalanche/models/index.d.ts +1 -0
  105. package/dist/esm/generated/avalanche/models/index.js +1 -0
  106. package/dist/esm/generated/base/models/NotFoundError.d.ts +31 -0
  107. package/dist/esm/generated/base/models/NotFoundError.js +44 -0
  108. package/dist/esm/generated/base/models/index.d.ts +1 -0
  109. package/dist/esm/generated/base/models/index.js +1 -0
  110. package/dist/esm/generated/bitcoin/models/NotFoundError.d.ts +31 -0
  111. package/dist/esm/generated/bitcoin/models/NotFoundError.js +44 -0
  112. package/dist/esm/generated/bitcoin/models/index.d.ts +1 -0
  113. package/dist/esm/generated/bitcoin/models/index.js +1 -0
  114. package/dist/esm/generated/bitcoincash/models/NotFoundError.d.ts +31 -0
  115. package/dist/esm/generated/bitcoincash/models/NotFoundError.js +44 -0
  116. package/dist/esm/generated/bitcoincash/models/index.d.ts +1 -0
  117. package/dist/esm/generated/bitcoincash/models/index.js +1 -0
  118. package/dist/esm/generated/bnbsmartchain/models/NotFoundError.d.ts +31 -0
  119. package/dist/esm/generated/bnbsmartchain/models/NotFoundError.js +44 -0
  120. package/dist/esm/generated/bnbsmartchain/models/index.d.ts +1 -0
  121. package/dist/esm/generated/bnbsmartchain/models/index.js +1 -0
  122. package/dist/esm/generated/dogecoin/models/NotFoundError.d.ts +31 -0
  123. package/dist/esm/generated/dogecoin/models/NotFoundError.js +44 -0
  124. package/dist/esm/generated/dogecoin/models/index.d.ts +1 -0
  125. package/dist/esm/generated/dogecoin/models/index.js +1 -0
  126. package/dist/esm/generated/ethereum/apis/V1Api.d.ts +15 -0
  127. package/dist/esm/generated/ethereum/apis/V1Api.js +24 -0
  128. package/dist/esm/generated/ethereum/models/NotFoundError.d.ts +31 -0
  129. package/dist/esm/generated/ethereum/models/NotFoundError.js +44 -0
  130. package/dist/esm/generated/ethereum/models/index.d.ts +1 -0
  131. package/dist/esm/generated/ethereum/models/index.js +1 -0
  132. package/dist/esm/generated/gnosis/models/NotFoundError.d.ts +31 -0
  133. package/dist/esm/generated/gnosis/models/NotFoundError.js +44 -0
  134. package/dist/esm/generated/gnosis/models/index.d.ts +1 -0
  135. package/dist/esm/generated/gnosis/models/index.js +1 -0
  136. package/dist/esm/generated/litecoin/models/NotFoundError.d.ts +31 -0
  137. package/dist/esm/generated/litecoin/models/NotFoundError.js +44 -0
  138. package/dist/esm/generated/litecoin/models/index.d.ts +1 -0
  139. package/dist/esm/generated/litecoin/models/index.js +1 -0
  140. package/dist/esm/generated/optimism/models/NotFoundError.d.ts +31 -0
  141. package/dist/esm/generated/optimism/models/NotFoundError.js +44 -0
  142. package/dist/esm/generated/optimism/models/index.d.ts +1 -0
  143. package/dist/esm/generated/optimism/models/index.js +1 -0
  144. package/dist/esm/generated/polygon/models/NotFoundError.d.ts +31 -0
  145. package/dist/esm/generated/polygon/models/NotFoundError.js +44 -0
  146. package/dist/esm/generated/polygon/models/index.d.ts +1 -0
  147. package/dist/esm/generated/polygon/models/index.js +1 -0
  148. package/dist/esm/generated/solana/models/NotFoundError.d.ts +31 -0
  149. package/dist/esm/generated/solana/models/NotFoundError.js +44 -0
  150. package/dist/esm/generated/solana/models/index.d.ts +1 -0
  151. package/dist/esm/generated/solana/models/index.js +1 -0
  152. package/dist/esm/generated/zcash/models/NotFoundError.d.ts +31 -0
  153. package/dist/esm/generated/zcash/models/NotFoundError.js +44 -0
  154. package/dist/esm/generated/zcash/models/index.d.ts +1 -0
  155. package/dist/esm/generated/zcash/models/index.js +1 -0
  156. package/dist/esm/tron/__tests__/api.test.js +125 -0
  157. package/dist/esm/tron/api.d.ts +7 -0
  158. package/dist/esm/tron/api.js +39 -3
  159. package/package.json +4 -4
@@ -10,7 +10,7 @@ export class TransactionParser extends BaseTransactionParser {
10
10
  constructor(args) {
11
11
  super(args);
12
12
  this.registerParsers([
13
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
13
+ new erc20.Parser({ chainId: this.chainId }),
14
14
  new mayachain.Parser({
15
15
  chainId: this.chainId,
16
16
  midgardUrl: args.mayaMidgardUrl,
@@ -7,7 +7,7 @@ export class TransactionParser extends BaseTransactionParser {
7
7
  constructor(args) {
8
8
  super(args);
9
9
  this.registerParsers([
10
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
10
+ new erc20.Parser({ chainId: this.chainId }),
11
11
  new thorchain.Parser({
12
12
  chainId: this.chainId,
13
13
  midgardUrl: args.midgardUrl,
@@ -6,7 +6,7 @@ export class TransactionParser extends BaseTransactionParser {
6
6
  constructor(args) {
7
7
  super(args);
8
8
  this.registerParsers([
9
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
9
+ new erc20.Parser({ chainId: this.chainId }),
10
10
  new zrx.Parser({ proxyContract: ZRX_ETHEREUM_PROXY_CONTRACT }),
11
11
  ]);
12
12
  }
@@ -7,7 +7,7 @@ export class TransactionParser extends BaseTransactionParser {
7
7
  constructor(args) {
8
8
  super(args);
9
9
  this.registerParsers([
10
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
10
+ new erc20.Parser({ chainId: this.chainId }),
11
11
  new thorchain.Parser({
12
12
  chainId: this.chainId,
13
13
  midgardUrl: args.midgardUrl,
@@ -105,21 +105,21 @@ const mockTokenData = {
105
105
  symbol: 'UNI-V2',
106
106
  },
107
107
  };
108
- vi.mock('ethers', async () => {
109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
- const actual = await vi.importActual('ethers');
111
- const MockContract = vi.fn().mockImplementation(function (address) {
112
- const checksumAddress = actual.getAddress(address.toLowerCase());
113
- const data = mockTokenData[checksumAddress] ?? { decimals: 18, name: 'Unknown', symbol: 'UNK' };
114
- return {
115
- decimals: vi.fn().mockResolvedValue(data.decimals),
116
- name: vi.fn().mockResolvedValue(data.name),
117
- symbol: vi.fn().mockResolvedValue(data.symbol),
118
- };
119
- });
108
+ vi.mock('viem', async () => {
109
+ const actual = await vi.importActual('viem');
120
110
  return {
121
111
  ...actual,
122
- Contract: MockContract,
112
+ createPublicClient: vi.fn(() => ({
113
+ readContract: vi.fn(({ address, functionName, }) => {
114
+ const checksumAddress = actual.getAddress(address.toLowerCase());
115
+ const data = mockTokenData[checksumAddress] ?? {
116
+ decimals: 18,
117
+ name: 'Unknown',
118
+ symbol: 'UNK',
119
+ };
120
+ return Promise.resolve(data[functionName]);
121
+ }),
122
+ })),
123
123
  };
124
124
  });
125
125
  const makeTxParser = vi.fn(async () => new TransactionParser({
@@ -1,5 +1,7 @@
1
1
  import { foxAssetId } from '@shapeshiftoss/caip';
2
2
  import { RFOX_ETH_PROXY_CONTRACT, ZRX_ETHEREUM_PROXY_CONTRACT } from '@shapeshiftoss/contracts';
3
+ import { createPublicClient, http } from 'viem';
4
+ import { mainnet } from 'viem/chains';
3
5
  import { BaseTransactionParser } from '../../parser/index.js';
4
6
  import * as arbitrumBridge from '../../parser/arbitrumBridge.js';
5
7
  import * as erc20 from '../../parser/erc20.js';
@@ -16,10 +18,17 @@ export class TransactionParser extends BaseTransactionParser {
16
18
  super(args);
17
19
  // due to the current parser logic, order here matters (register most generic first to most specific last)
18
20
  this.registerParsers([
19
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
21
+ new erc20.Parser({ chainId: this.chainId }),
20
22
  new foxy.Parser(),
21
- new weth.Parser({ chainId: this.chainId, provider: this.provider }),
22
- new uniV2.Parser({ chainId: this.chainId, provider: this.provider }),
23
+ new weth.Parser({ chainId: this.chainId }),
24
+ new uniV2.Parser({
25
+ chainId: this.chainId,
26
+ client: createPublicClient({
27
+ chain: mainnet,
28
+ transport: http(this.rpcUrl),
29
+ batch: { multicall: true },
30
+ }),
31
+ }),
23
32
  new mayachain.Parser({
24
33
  chainId: this.chainId,
25
34
  midgardUrl: args.mayaMidgardUrl,
@@ -1,6 +1,6 @@
1
1
  import type { ChainId } from '@shapeshiftoss/caip';
2
- import type { JsonRpcProvider } from 'ethers';
3
2
  import { Interface } from 'ethers';
3
+ import type { PublicClient } from 'viem';
4
4
  import type { Tx } from '../../../generated/ethereum/index.js';
5
5
  import type { BaseTxMetadata } from '../../../types.js';
6
6
  import type { SubParser, TxSpecific } from '../../parser/index.js';
@@ -9,10 +9,10 @@ export interface TxMetadata extends BaseTxMetadata {
9
9
  }
10
10
  export interface ParserArgs {
11
11
  chainId: ChainId;
12
- provider: JsonRpcProvider;
12
+ client: PublicClient;
13
13
  }
14
14
  export declare class Parser implements SubParser<Tx> {
15
- provider: JsonRpcProvider;
15
+ client: PublicClient;
16
16
  readonly chainId: ChainId;
17
17
  readonly wethContract: string;
18
18
  readonly abiInterface: Interface;
@@ -23,5 +23,6 @@ export declare class Parser implements SubParser<Tx> {
23
23
  parseUniV2(tx: Tx): Promise<TxSpecific | undefined>;
24
24
  parseStakingRewards(tx: Tx): TxSpecific | undefined;
25
25
  parse(tx: Tx): Promise<TxSpecific | undefined>;
26
+ private getTokenMetadata;
26
27
  private static pairFor;
27
28
  }
@@ -1,12 +1,12 @@
1
1
  import { fromChainId, toAssetId } from '@shapeshiftoss/caip';
2
2
  import { UNI_V2_FOX_STAKING_REWARDS_CONTRACTS, UNISWAP_V2_FACTORY_CONTRACT_MAINNET, UNISWAP_V2_ROUTER_02_ABI, UNISWAP_V2_ROUTER_02_CONTRACT_MAINNET, UNIV2_STAKING_REWARDS_ABI, WETH_TOKEN_CONTRACT, } from '@shapeshiftoss/contracts';
3
3
  import assert from 'assert';
4
- import { Contract, getAddress, getCreate2Address, Interface, solidityPackedKeccak256 } from 'ethers';
4
+ import { getAddress, getCreate2Address, Interface, solidityPackedKeccak256 } from 'ethers';
5
5
  import { erc20Abi } from 'viem';
6
6
  import { TransferType } from '../../../types.js';
7
7
  import { getSigHash, txInteractsWithContract } from '../../parser/index.js';
8
8
  export class Parser {
9
- provider;
9
+ client;
10
10
  chainId;
11
11
  wethContract;
12
12
  abiInterface = new Interface(UNISWAP_V2_ROUTER_02_ABI);
@@ -15,7 +15,7 @@ export class Parser {
15
15
  supportedStakingRewardsFunctions;
16
16
  constructor(args) {
17
17
  this.chainId = args.chainId;
18
- this.provider = args.provider;
18
+ this.client = args.client;
19
19
  assert(args.chainId === 'eip155:1', `chainId '${args.chainId}' is not supported`);
20
20
  this.wethContract = WETH_TOKEN_CONTRACT;
21
21
  const addLiquidityEthSigHash = this.abiInterface.getFunction('addLiquidityETH')?.selector;
@@ -61,10 +61,7 @@ export class Parser {
61
61
  const transfers = await (async () => {
62
62
  switch (getSigHash(tx.inputData)) {
63
63
  case this.supportedFunctions.addLiquidityEthSigHash: {
64
- const contract = new Contract(tokenAddress, erc20Abi, this.provider);
65
- const decimals = await contract.decimals();
66
- const name = await contract.name();
67
- const symbol = await contract.symbol();
64
+ const { decimals, name, symbol } = await this.getTokenMetadata(tokenAddress);
68
65
  const value = decoded.args.amountTokenDesired.toString();
69
66
  const assetId = toAssetId({
70
67
  ...fromChainId(this.chainId),
@@ -84,10 +81,7 @@ export class Parser {
84
81
  ];
85
82
  }
86
83
  case this.supportedFunctions.removeLiquidityEthSigHash: {
87
- const contract = new Contract(lpTokenAddress, erc20Abi, this.provider);
88
- const decimals = await contract.decimals();
89
- const name = await contract.name();
90
- const symbol = await contract.symbol();
84
+ const { decimals, name, symbol } = await this.getTokenMetadata(lpTokenAddress);
91
85
  const value = decoded.args.liquidity.toString();
92
86
  const assetId = toAssetId({
93
87
  ...fromChainId(this.chainId),
@@ -146,6 +140,15 @@ export class Parser {
146
140
  if (isFoxStakingRewards)
147
141
  return await Promise.resolve(this.parseStakingRewards(tx));
148
142
  }
143
+ async getTokenMetadata(address) {
144
+ const contract = { address: address, abi: erc20Abi };
145
+ const [decimals, name, symbol] = await Promise.all([
146
+ this.client.readContract({ ...contract, functionName: 'decimals' }),
147
+ this.client.readContract({ ...contract, functionName: 'name' }),
148
+ this.client.readContract({ ...contract, functionName: 'symbol' }),
149
+ ]);
150
+ return { decimals, name, symbol };
151
+ }
149
152
  static pairFor(tokenA, tokenB) {
150
153
  const [token0, token1] = tokenA < tokenB ? [tokenA, tokenB] : [tokenB, tokenA];
151
154
  const salt = solidityPackedKeccak256(['address', 'address'], [token0, token1]);
@@ -8,10 +8,8 @@ export interface TxMetadata extends BaseTxMetadata {
8
8
  }
9
9
  export interface ParserArgs {
10
10
  chainId: ChainId;
11
- provider: ethers.JsonRpcProvider;
12
11
  }
13
12
  export declare class Parser implements SubParser<Tx> {
14
- provider: ethers.JsonRpcProvider;
15
13
  readonly chainId: ChainId;
16
14
  readonly wethContract: string;
17
15
  readonly abiInterface: ethers.Interface;
@@ -5,14 +5,12 @@ import { ethers } from 'ethers';
5
5
  import { TransferType } from '../../../types.js';
6
6
  import { getSigHash, txInteractsWithContract } from '../../parser/index.js';
7
7
  export class Parser {
8
- provider;
9
8
  chainId;
10
9
  wethContract;
11
10
  abiInterface = new ethers.Interface(WETH_ABI);
12
11
  supportedFunctions;
13
12
  constructor(args) {
14
13
  this.chainId = args.chainId;
15
- this.provider = args.provider;
16
14
  assert(args.chainId === 'eip155:1', `chainId '${args.chainId}' is not supported`);
17
15
  this.wethContract = WETH_TOKEN_CONTRACT;
18
16
  const depositSigHash = this.abiInterface.getFunction('deposit')?.selector;
@@ -3,6 +3,6 @@ import * as erc20 from '../../parser/erc20.js';
3
3
  export class TransactionParser extends BaseTransactionParser {
4
4
  constructor(args) {
5
5
  super(args);
6
- this.registerParsers([new erc20.Parser({ chainId: this.chainId, provider: this.provider })]);
6
+ this.registerParsers([new erc20.Parser({ chainId: this.chainId })]);
7
7
  }
8
8
  }
@@ -6,7 +6,7 @@ export class TransactionParser extends BaseTransactionParser {
6
6
  constructor(args) {
7
7
  super(args);
8
8
  this.registerParsers([
9
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
9
+ new erc20.Parser({ chainId: this.chainId }),
10
10
  new zrx.Parser({ proxyContract: ZRX_OPTIMISM_PROXY_CONTRACT }),
11
11
  ]);
12
12
  }
@@ -9,10 +9,8 @@ export interface TxMetadata extends BaseTxMetadata {
9
9
  }
10
10
  interface ParserArgs {
11
11
  chainId: ChainId;
12
- provider: ethers.JsonRpcProvider;
13
12
  }
14
13
  export declare class Parser<T extends Tx> implements SubParser<T> {
15
- provider: ethers.JsonRpcProvider;
16
14
  readonly chainId: ChainId;
17
15
  readonly abiInterface: ethers.Interface;
18
16
  private readonly supportedFunctions;
@@ -3,12 +3,10 @@ import { ethers } from 'ethers';
3
3
  import { erc20Abi } from 'viem';
4
4
  import { getSigHash } from './utils.js';
5
5
  export class Parser {
6
- provider;
7
6
  chainId;
8
7
  abiInterface = new ethers.Interface(erc20Abi);
9
8
  supportedFunctions;
10
9
  constructor(args) {
11
- this.provider = args.provider;
12
10
  this.chainId = args.chainId;
13
11
  const approveSigHash = this.abiInterface.getFunction('approve')?.selector;
14
12
  if (!approveSigHash)
@@ -1,5 +1,4 @@
1
1
  import type { AssetId, ChainId } from '@shapeshiftoss/caip';
2
- import { JsonRpcProvider } from 'ethers';
3
2
  import type { Api } from '../index.js';
4
3
  import type { ParsedTx, SubParser, Tx } from './types.js';
5
4
  export * from './types.js';
@@ -14,7 +13,7 @@ export declare class BaseTransactionParser<T extends Tx> {
14
13
  chainId: ChainId;
15
14
  assetId: AssetId;
16
15
  protected readonly api: Api;
17
- protected readonly provider: JsonRpcProvider;
16
+ protected readonly rpcUrl: string;
18
17
  private parsers;
19
18
  constructor(args: BaseTransactionParserArgs);
20
19
  /**
@@ -1,6 +1,6 @@
1
1
  import { ASSET_NAMESPACE, ASSET_REFERENCE, ethChainId, optimismChainId, polygonChainId, toAssetId, } from '@shapeshiftoss/caip';
2
2
  import { BigNumber } from 'bignumber.js';
3
- import { getAddress, JsonRpcProvider } from 'ethers';
3
+ import { getAddress } from 'ethers';
4
4
  import { TransferType } from '../../types.js';
5
5
  import { aggregateTransfer, findAsyncSequential } from '../../utils.js';
6
6
  import { getTxStatus } from './utils.js';
@@ -10,13 +10,13 @@ export class BaseTransactionParser {
10
10
  chainId;
11
11
  assetId;
12
12
  api;
13
- provider;
13
+ rpcUrl;
14
14
  parsers = [];
15
15
  constructor(args) {
16
16
  this.chainId = args.chainId;
17
17
  this.assetId = args.assetId;
18
18
  this.api = args.api;
19
- this.provider = new JsonRpcProvider(args.rpcUrl, undefined, { staticNetwork: true });
19
+ this.rpcUrl = args.rpcUrl;
20
20
  }
21
21
  /**
22
22
  * Register custom transaction sub parser to extract contract specific data
@@ -6,7 +6,7 @@ export class TransactionParser extends BaseTransactionParser {
6
6
  constructor(args) {
7
7
  super(args);
8
8
  this.registerParsers([
9
- new erc20.Parser({ chainId: this.chainId, provider: this.provider }),
9
+ new erc20.Parser({ chainId: this.chainId }),
10
10
  new zrx.Parser({ proxyContract: ZRX_ETHEREUM_PROXY_CONTRACT }),
11
11
  ]);
12
12
  }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @shapeshiftoss/arbitrum-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 10.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Contains info about a 404 Not Found response
14
+ * @export
15
+ * @interface NotFoundError
16
+ */
17
+ export interface NotFoundError {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof NotFoundError
22
+ */
23
+ message: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the NotFoundError interface.
27
+ */
28
+ export declare function instanceOfNotFoundError(value: object): boolean;
29
+ export declare function NotFoundErrorFromJSON(json: any): NotFoundError;
30
+ export declare function NotFoundErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotFoundError;
31
+ export declare function NotFoundErrorToJSON(value?: NotFoundError | null): any;
@@ -0,0 +1,44 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * @shapeshiftoss/arbitrum-api
6
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+ *
8
+ * The version of the OpenAPI document: 10.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ /**
16
+ * Check if a given object implements the NotFoundError interface.
17
+ */
18
+ export function instanceOfNotFoundError(value) {
19
+ let isInstance = true;
20
+ isInstance = isInstance && "message" in value;
21
+ return isInstance;
22
+ }
23
+ export function NotFoundErrorFromJSON(json) {
24
+ return NotFoundErrorFromJSONTyped(json, false);
25
+ }
26
+ export function NotFoundErrorFromJSONTyped(json, ignoreDiscriminator) {
27
+ if ((json === undefined) || (json === null)) {
28
+ return json;
29
+ }
30
+ return {
31
+ 'message': json['message'],
32
+ };
33
+ }
34
+ export function NotFoundErrorToJSON(value) {
35
+ if (value === undefined) {
36
+ return undefined;
37
+ }
38
+ if (value === null) {
39
+ return null;
40
+ }
41
+ return {
42
+ 'message': value.message,
43
+ };
44
+ }
@@ -10,6 +10,7 @@ export * from './GasEstimate.js';
10
10
  export * from './GasFees.js';
11
11
  export * from './InternalServerError.js';
12
12
  export * from './InternalTx.js';
13
+ export * from './NotFoundError.js';
13
14
  export * from './RPCRequest.js';
14
15
  export * from './RPCResponse.js';
15
16
  export * from './RPCResponseError.js';
@@ -13,6 +13,7 @@ export * from './GasEstimate.js';
13
13
  export * from './GasFees.js';
14
14
  export * from './InternalServerError.js';
15
15
  export * from './InternalTx.js';
16
+ export * from './NotFoundError.js';
16
17
  export * from './RPCRequest.js';
17
18
  export * from './RPCResponse.js';
18
19
  export * from './RPCResponseError.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @shapeshiftoss/avalanche-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 10.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Contains info about a 404 Not Found response
14
+ * @export
15
+ * @interface NotFoundError
16
+ */
17
+ export interface NotFoundError {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof NotFoundError
22
+ */
23
+ message: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the NotFoundError interface.
27
+ */
28
+ export declare function instanceOfNotFoundError(value: object): boolean;
29
+ export declare function NotFoundErrorFromJSON(json: any): NotFoundError;
30
+ export declare function NotFoundErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotFoundError;
31
+ export declare function NotFoundErrorToJSON(value?: NotFoundError | null): any;
@@ -0,0 +1,44 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * @shapeshiftoss/avalanche-api
6
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+ *
8
+ * The version of the OpenAPI document: 10.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ /**
16
+ * Check if a given object implements the NotFoundError interface.
17
+ */
18
+ export function instanceOfNotFoundError(value) {
19
+ let isInstance = true;
20
+ isInstance = isInstance && "message" in value;
21
+ return isInstance;
22
+ }
23
+ export function NotFoundErrorFromJSON(json) {
24
+ return NotFoundErrorFromJSONTyped(json, false);
25
+ }
26
+ export function NotFoundErrorFromJSONTyped(json, ignoreDiscriminator) {
27
+ if ((json === undefined) || (json === null)) {
28
+ return json;
29
+ }
30
+ return {
31
+ 'message': json['message'],
32
+ };
33
+ }
34
+ export function NotFoundErrorToJSON(value) {
35
+ if (value === undefined) {
36
+ return undefined;
37
+ }
38
+ if (value === null) {
39
+ return null;
40
+ }
41
+ return {
42
+ 'message': value.message,
43
+ };
44
+ }
@@ -10,6 +10,7 @@ export * from './GasEstimate.js';
10
10
  export * from './GasFees.js';
11
11
  export * from './InternalServerError.js';
12
12
  export * from './InternalTx.js';
13
+ export * from './NotFoundError.js';
13
14
  export * from './RPCRequest.js';
14
15
  export * from './RPCResponse.js';
15
16
  export * from './RPCResponseError.js';
@@ -13,6 +13,7 @@ export * from './GasEstimate.js';
13
13
  export * from './GasFees.js';
14
14
  export * from './InternalServerError.js';
15
15
  export * from './InternalTx.js';
16
+ export * from './NotFoundError.js';
16
17
  export * from './RPCRequest.js';
17
18
  export * from './RPCResponse.js';
18
19
  export * from './RPCResponseError.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @shapeshiftoss/base-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 10.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Contains info about a 404 Not Found response
14
+ * @export
15
+ * @interface NotFoundError
16
+ */
17
+ export interface NotFoundError {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof NotFoundError
22
+ */
23
+ message: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the NotFoundError interface.
27
+ */
28
+ export declare function instanceOfNotFoundError(value: object): boolean;
29
+ export declare function NotFoundErrorFromJSON(json: any): NotFoundError;
30
+ export declare function NotFoundErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotFoundError;
31
+ export declare function NotFoundErrorToJSON(value?: NotFoundError | null): any;
@@ -0,0 +1,44 @@
1
+ // @ts-nocheck
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * @shapeshiftoss/base-api
6
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+ *
8
+ * The version of the OpenAPI document: 10.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ /**
16
+ * Check if a given object implements the NotFoundError interface.
17
+ */
18
+ export function instanceOfNotFoundError(value) {
19
+ let isInstance = true;
20
+ isInstance = isInstance && "message" in value;
21
+ return isInstance;
22
+ }
23
+ export function NotFoundErrorFromJSON(json) {
24
+ return NotFoundErrorFromJSONTyped(json, false);
25
+ }
26
+ export function NotFoundErrorFromJSONTyped(json, ignoreDiscriminator) {
27
+ if ((json === undefined) || (json === null)) {
28
+ return json;
29
+ }
30
+ return {
31
+ 'message': json['message'],
32
+ };
33
+ }
34
+ export function NotFoundErrorToJSON(value) {
35
+ if (value === undefined) {
36
+ return undefined;
37
+ }
38
+ if (value === null) {
39
+ return null;
40
+ }
41
+ return {
42
+ 'message': value.message,
43
+ };
44
+ }
@@ -10,6 +10,7 @@ export * from './EstimateGasBody.js';
10
10
  export * from './Fees.js';
11
11
  export * from './InternalServerError.js';
12
12
  export * from './InternalTx.js';
13
+ export * from './NotFoundError.js';
13
14
  export * from './RPCRequest.js';
14
15
  export * from './RPCResponse.js';
15
16
  export * from './RPCResponseError.js';
@@ -13,6 +13,7 @@ export * from './EstimateGasBody.js';
13
13
  export * from './Fees.js';
14
14
  export * from './InternalServerError.js';
15
15
  export * from './InternalTx.js';
16
+ export * from './NotFoundError.js';
16
17
  export * from './RPCRequest.js';
17
18
  export * from './RPCResponse.js';
18
19
  export * from './RPCResponseError.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @shapeshiftoss/bitcoin-api
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 10.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Contains info about a 404 Not Found response
14
+ * @export
15
+ * @interface NotFoundError
16
+ */
17
+ export interface NotFoundError {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof NotFoundError
22
+ */
23
+ message: string;
24
+ }
25
+ /**
26
+ * Check if a given object implements the NotFoundError interface.
27
+ */
28
+ export declare function instanceOfNotFoundError(value: object): boolean;
29
+ export declare function NotFoundErrorFromJSON(json: any): NotFoundError;
30
+ export declare function NotFoundErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): NotFoundError;
31
+ export declare function NotFoundErrorToJSON(value?: NotFoundError | null): any;