@cryptorubic/web3 0.13.0-alpha.solana-gas.7 → 0.13.0-alpha.solana-gas.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "0.13.0-alpha.solana-gas.7",
3
+ "version": "0.13.0-alpha.solana-gas.9",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -42,7 +42,6 @@ class SolanaAdapter extends abstract_adapter_1.AbstractAdapter {
42
42
  async multicallByAddress(_address, _abi, _method, _methodArgs = [], _allowErrors = true) {
43
43
  throw new Error('Method multicall is not supported');
44
44
  }
45
- // 6024 - Insufficient balance
46
45
  async simulateTransaction(config, timeout = 15_000) {
47
46
  try {
48
47
  const bufferData = config.data.startsWith('0x') ? Buffer.from(config.data.slice(2), 'hex') : Buffer.from(config.data, 'base64');
@@ -66,10 +65,11 @@ class SolanaAdapter extends abstract_adapter_1.AbstractAdapter {
66
65
  };
67
66
  if (err) {
68
67
  if (Array.isArray(err['InstructionError'])) {
69
- const errorsArr = err['InstructionError'];
70
- const isBalanceError = errorsArr?.[0] === 2 && errorsArr?.[1].Custom === 1;
71
- // skip balance error cause on max balance swaps it estimates gas roughly and
72
- if (isBalanceError)
68
+ const [failedInstructionIdx, errorData] = err['InstructionError'];
69
+ const failedIxProgrammId = tx.message.staticAccountKeys[failedInstructionIdx];
70
+ this.logger?.customLog('FAILED INSTRUCTION PROGRAM ID', failedIxProgrammId.toBase58());
71
+ const weirdError = errorData?.Custom === 1;
72
+ if (weirdError)
73
73
  return defineCuLimit();
74
74
  }
75
75
  throw new Error('Transaction simulation failed.');