From 5176c7b7eecd012f97bba39f5843673be168076d Mon Sep 17 00:00:00 2001 From: Alberto Gualis Date: Mon, 24 Jul 2023 23:23:10 +0200 Subject: [PATCH] Merge latest hotfixes into develop (#3795) * fix: Exact out handler (#3793) * fix: Don't use swap exit if 1st level pool token * fix: buildExitExactTokensOut needs to have the bpt removed from tokenslist * 1.115.1 * Feat: Avalanche Support (#3487) * Feat: Avalanche Support * Add Initial contract addresses and settings for Avalanche * Add subgraphs and token addresses * Use a different public RPC. Add multicall address * Fix websocket URL, wallet enum and allowlist pools I created * Add trust wallet network for gauges and icons * Add avalanche network icon * Use new BAL token * Hide Avalanche in UI * whitelist initial boosted pools * Add pool factories. Remove pool with old BAL token from allowlist * Load ComposableStable and FX pool types * Add gyro to included pool types * Fix pools protocol features after refactor --------- Co-authored-by: ZeKraken <79888567+zekraken-bot@users.noreply.github.com> Co-authored-by: Alberto Gualis * 1.115.2 * fix: Catch metadata error setting (#3794) * 1.115.3 --------- Co-authored-by: Gareth Fuller Co-authored-by: Automated Version Bump Co-authored-by: Tim Robinson Co-authored-by: ZeKraken <79888567+zekraken-bot@users.noreply.github.com> --- package-lock.json | 4 +- package.json | 2 +- src/assets/data/contracts/avalanche.json | 46 ++++++++ .../images/icons/networks/avalanche.svg | 4 + src/lib/config/avalanche/contracts.ts | 29 +++++ src/lib/config/avalanche/index.ts | 77 +++++++++++++ src/lib/config/avalanche/keys.ts | 9 ++ src/lib/config/avalanche/pools.ts | 109 ++++++++++++++++++ src/lib/config/avalanche/rateProviders.ts | 9 ++ src/lib/config/avalanche/tokenlists.ts | 15 +++ src/lib/config/avalanche/tokens.ts | 19 +++ src/lib/config/index.ts | 3 + .../scripts/contract-addresses.generator.ts | 2 +- src/providers/local/exit-pool.provider.ts | 4 +- .../exits/handlers/exact-out-exit.handler.ts | 3 +- .../transactions/concerns/contract.concern.ts | 18 +-- .../web3/transactions/concerns/raw.concern.ts | 6 +- 17 files changed, 345 insertions(+), 14 deletions(-) create mode 100644 src/assets/data/contracts/avalanche.json create mode 100644 src/assets/images/icons/networks/avalanche.svg create mode 100644 src/lib/config/avalanche/contracts.ts create mode 100644 src/lib/config/avalanche/index.ts create mode 100644 src/lib/config/avalanche/keys.ts create mode 100644 src/lib/config/avalanche/pools.ts create mode 100644 src/lib/config/avalanche/rateProviders.ts create mode 100644 src/lib/config/avalanche/tokenlists.ts create mode 100644 src/lib/config/avalanche/tokens.ts diff --git a/package-lock.json b/package-lock.json index 452ade6ab7..74a4d50553 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@balancer/frontend-v2", - "version": "1.115.0", + "version": "1.115.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@balancer/frontend-v2", - "version": "1.115.0", + "version": "1.115.3", "license": "MIT", "devDependencies": { "@aave/protocol-js": "^4.3.0", diff --git a/package.json b/package.json index c1a6c2c149..6c2f126e5f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@balancer/frontend-v2", - "version": "1.115.0", + "version": "1.115.3", "engines": { "node": "=16", "npm": ">=8" diff --git a/src/assets/data/contracts/avalanche.json b/src/assets/data/contracts/avalanche.json new file mode 100644 index 0000000000..014aac22b0 --- /dev/null +++ b/src/assets/data/contracts/avalanche.json @@ -0,0 +1,46 @@ +{ + "AaveLinearPoolFactory": "0x6caf662b573F577DE01165d2d38D1910bba41F8A", + "Authorizer": "0xA331D84eC860Bf466b4CdCcFb4aC09a1B43F3aE6", + "AuthorizerAdaptor": "0xdAE7e32ADc5d490a43cCba1f0c736033F2b4eFca", + "AuthorizerAdaptorEntrypoint": "0x4E7bBd911cf1EFa442BC1b2e9Ea01ffE785412EC", + "AuthorizerWithAdaptorValidation": "0x8df317a729fcaA260306d7de28888932cb579b88", + "BalancerHelpers": "0x8E9aa87E45e92bad84D5F8DD1bff34Fb92637dE9", + "BalancerQueries": "0xC128468b7Ce63eA702C1f104D55A2566b13D3ABD", + "BalancerRelayer": "0x03F1ab8b19bcE21EB06C364aEc9e40322572a1e9", + "BatchRelayerLibrary": "0x45fFd460cC6642B8D8Fb12373DFd77Ceb0f4932B", + "ChildChainGauge": "0x4b7b369989e613ff2C65768B7Cf930cC927F901E", + "ChildChainGaugeFactory": "0x161f4014C27773840ccb4EC1957113e6DD028846", + "ChildChainGaugeRewardHelper": "0x2E96068b3D5B5BAE3D7515da4A1D2E52d08A2647", + "ChildChainGaugeTokenAdder": "0xf302f9F50958c5593770FDf4d4812309fF77414f", + "ChildChainLiquidityGaugeFactory": "0xb08E16cFc07C684dAA2f93C70323BAdb2A6CBFd2", + "ChildChainStreamer": "0xD7FAD3bd59D6477cbe1BE7f646F7f1BA25b230f8", + "CircuitBreakerLib": "0x9129E834e15eA19b6069e8f08a8EcFc13686B8dC", + "ComposableStablePoolFactory": "0x3B1eb8EB7b43882b385aB30533D9A2BeF9052a98", + "DistributionScheduler": "0xC128a9954e6c874eA3d62ce62B468bA073093F25", + "ERC4626LinearPoolFactory": "0x4507d91Cd2C0D51D9B4F30Bf0B93AFC938A70BA5", + "ExternalWeightedMath": "0xDF9B5B00Ef9bca66e9902Bd813dB14e4343Be025", + "L2BalancerPseudoMinter": "0xEa924b45a3fcDAAdf4E5cFB1665823B8F8F2039B", + "L2LayerZeroBridgeForwarder": "0x4638ab64022927C9bD5947607459D13f57f1551C", + "ManagedPoolAddRemoveTokenLib": "0xAcf05BE5134d64d150d153818F8C67EE36996650", + "ManagedPoolAmmLib": "0xA69E0Ccf150a29369D8Bbc0B3f510849dB7E8EEE", + "ManagedPoolFactory": "0x03F3Fb107e74F2EAC9358862E91ad3c692712054", + "MockAaveLendingPool": "0x57EA28A99394978D060E483477C0Fd9fb9aFa96c", + "MockAaveLinearPool": "0xA826a114B0c7dB4d1FF4a4BE845a78998c64564C", + "MockComposableStablePool": "0xEa4643102dFC03d5e382e7827Bf767f6587E9965", + "MockERC4626LinearPool": "0xEd3E2F496cbCd8e212192fb8D1499842f04A0D19", + "MockERC4626Token": "0x2EbE41E1aa44D61c206A94474932dADC7D3FD9E3", + "MockManagedPool": "0x3Fb81f6FB0dd94c6fC7e138887f1CA4CDB5E2999", + "MockStaticAToken": "0xD8B6b96c88ad626EB6209c4876e3B14f45f8803A", + "MockWeightedPool": "0xb2b5B452d53401391155EA48C4451f6E9b0dD058", + "NoProtocolFeeLiquidityBootstrappingPoolFactory": "0x0F3e0c4218b7b0108a3643cFe9D3ec0d4F57c54e", + "NullVotingEscrow": "0x6B1Da720Be2D11d95177ccFc40A917c2688f396c", + "PoolRecoveryHelper": "0x3b8cA519122CdD8efb272b0D3085453404B25bD0", + "ProtocolFeePercentagesProvider": "0x239e55F427D44C3cc793f49bFB507ebe76638a2b", + "ProtocolFeesCollector": "0xce88686553686DA562CE7Cea497CE749DA109f9F", + "ProtocolFeesWithdrawer": "0x8F42aDBbA1B16EaAE3BB5754915E0D06059aDd75", + "RecoveryModeHelper": "0x300Ab2038EAc391f26D9F895dc61F8F66a548833", + "RewardsOnlyGauge": "0x41B953164995c11C81DA73D212ED8Af25741b7Ac", + "Vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", + "VotingEscrowDelegationProxy": "0x0c6052254551EAe3ECac77B01DFcf1025418828f", + "WeightedPoolFactory": "0x230a59F4d9ADc147480f03B0D3fFfeCd56c3289a" +} diff --git a/src/assets/images/icons/networks/avalanche.svg b/src/assets/images/icons/networks/avalanche.svg new file mode 100644 index 0000000000..55473a0f24 --- /dev/null +++ b/src/assets/images/icons/networks/avalanche.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/lib/config/avalanche/contracts.ts b/src/lib/config/avalanche/contracts.ts new file mode 100644 index 0000000000..3abf7183f3 --- /dev/null +++ b/src/lib/config/avalanche/contracts.ts @@ -0,0 +1,29 @@ +import { Contracts } from '../types'; +import * as avalanche from '@/assets/data/contracts/avalanche.json'; + +const contracts: Contracts = { + merkleRedeem: '', + merkleOrchard: '', + merkleOrchardV2: '', + multicall: '0xca11bde05977b3631167028862be2a173976ca11', + authorizer: avalanche.Authorizer, + vault: avalanche.Vault, + weightedPoolFactory: avalanche.WeightedPoolFactory, + stablePoolFactory: avalanche.ComposableStablePoolFactory, + lidoRelayer: '', + balancerHelpers: avalanche.BalancerHelpers, + batchRelayer: avalanche.BalancerRelayer, + gaugeFactory: avalanche.ChildChainLiquidityGaugeFactory, + balancerMinter: avalanche.L2BalancerPseudoMinter, + gaugeController: '', + tokenAdmin: '', + veBAL: '', + veDelegationProxy: '', + veBALHelpers: '', + feeDistributor: '', + feeDistributorDeprecated: '', + faucet: '', + gaugeRewardsHelper: avalanche.ChildChainGaugeRewardHelper, +}; + +export default contracts; diff --git a/src/lib/config/avalanche/index.ts b/src/lib/config/avalanche/index.ts new file mode 100644 index 0000000000..cdfc6b2228 --- /dev/null +++ b/src/lib/config/avalanche/index.ts @@ -0,0 +1,77 @@ +import { Config } from '../types'; +import keys from './keys'; +import contracts from './contracts'; +import pools from './pools'; +import tokenlists from './tokenlists'; +import tokens from './tokens'; +import rateProviders from './rateProviders'; + +const config: Config = { + key: '43114', + chainId: 43114, + chainName: 'Avalanche', + name: 'Avalanche', + shortName: 'Avalanche', + monorepoName: 'avalanche', + slug: 'avalanche', + network: 'avalanche', + trustWalletNetwork: 'avalanchec', + unknown: false, + visibleInUI: false, + testNetwork: false, + rpc: `https://avalanche-mainnet.infura.io/v3/${keys.infura}`, + ws: `wss://api.avax.network/ext/bc/C/ws`, + publicRpc: 'https://avalanche.public-rpc.com', + explorer: 'https://snowtrace.io/', + explorerName: 'Snowtrace', + subgraph: + 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-avalanche-v2', + balancerApi: 'https://api.balancer.fi', + poolsUrlV2: '', + subgraphs: { + main: [ + 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-avalanche-v2', + ], + aave: 'https://api.thegraph.com/subgraphs/name/aave/protocol-v2-avalanche', + gauge: + 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gauges-avalanche', + blocks: + 'https://api.thegraph.com/subgraphs/name/iliaazhel/avalanche-blocks', + }, + bridgeUrl: 'https://core.app/bridge/', + supportsEIP1559: false, + supportsElementPools: false, + blockTime: 2, + nativeAsset: { + name: 'AVAX', + address: '0x0000000000000000000000000000000000000000', + symbol: 'AVAX', + decimals: 18, + deeplinkId: 'avax', + logoURI: 'tokens/avax.svg', + minTransactionBuffer: '0.1', + }, + thirdParty: { + coingecko: { + nativeAssetId: 'avalanche-2', + platformId: 'avalanche', + }, + apyVision: { + networkName: 'avalanche', + }, + }, + addresses: { + ...contracts, + }, + pools, + tokens, + keys, + gauges: { + type: 4, + weight: 0, + }, + tokenlists, + rateProviders, +}; + +export default config; diff --git a/src/lib/config/avalanche/keys.ts b/src/lib/config/avalanche/keys.ts new file mode 100644 index 0000000000..1eefb1aac7 --- /dev/null +++ b/src/lib/config/avalanche/keys.ts @@ -0,0 +1,9 @@ +import { Keys } from '../types'; + +const keys: Keys = { + infura: 'daaa68ec242643719749dd1caba2fc66', + alchemy: 'ODJ9G5Ipv-Hb2zTWMNbUFIqv9WtqBOc2', + balancerApi: 'da2-7a3ukmnw7bexndpx5x522uafui', +}; + +export default keys; diff --git a/src/lib/config/avalanche/pools.ts b/src/lib/config/avalanche/pools.ts new file mode 100644 index 0000000000..d75060d9f8 --- /dev/null +++ b/src/lib/config/avalanche/pools.ts @@ -0,0 +1,109 @@ +import { Protocol } from '@/composables/useProtocols'; +import { PoolFeature, Pools } from '@/types/pools'; + +const pools: Pools = { + IdsMap: {}, + Pagination: { + PerPage: 10, + PerPool: 10, + PerPoolInitial: 5, + }, + BoostsEnabled: false, + DelegateOwner: '0xba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1ba1b', + ZeroAddress: '0x0000000000000000000000000000000000000000', + DynamicFees: { + Gauntlet: [], + }, + BlockList: [''], + IncludedPoolTypes: [ + 'Weighted', + 'Stable', + 'MetaStable', + 'ComposableStable', + 'FX', + 'Gyro2', + 'Gyro3', + 'GyroE', + ], + Stable: { + AllowList: [ + '0xa1d14d922a575232066520eda11e27760946c991000000000000000000000012', // Boosted Aave v3 USD + '0xa154009870e9b6431305f19b09f9cfd7284d4e7a000000000000000000000013', // sAVAX/Boosted Aave v3 WAVAX + '0xece571847897fd61e764d455dc15cf1cd9de8d6f000000000000000000000014', // yyAVAX/Boosted Aave v3 WAVAX + '0x054e7b0c73e1ee5aed6864fa511658fc2b54bcaa000000000000000000000015', // ggAVAX/Boosted Aave v3 WAVAX + '0x670734d704eb7ef424d75321670f921fbf42e9cf000000000000000000000016', // sAVAX-ankrAVAX + ], + }, + Investment: { + AllowList: [''], + }, + Weighted: { + // Only effective after given timestamp here: usePool.ts#createdAfterTimestamp + // see useDisabledJoinPool.ts#nonAllowedWeightedPoolAfterTimestamp for logic. + AllowList: [ + '0xe4a4565ad31a3af8286bc6e6dbb20ba76752557700010000000000000000000b', + '0x3bde1563903ebb564ca37d5736afbb850929cfd7000200000000000000000017', // ankrAVAX-ankrETH + ], + }, + Factories: { + '0x230a59f4d9adc147480f03b0d3fffecd56c3289a': 'weightedPool', + '0x3b1eb8eb7b43882b385ab30533d9a2bef9052a98': 'composableStablePool', + '0xe42ffa682a26ef8f25891db4882932711d42e467': 'composableStablePool', + }, + Stakable: { + VotingGaugePools: [], + AllowList: [], + }, + Metadata: { + '0xa1d14d922a575232066520eda11e27760946c991000000000000000000000012': { + name: 'Balancer Boosted Aave v3 USD', + hasIcon: false, + features: { + [PoolFeature.Boosted]: { + featureProtocols: [Protocol.Aave], + }, + }, + }, + '0xa154009870e9b6431305f19b09f9cfd7284d4e7a000000000000000000000013': { + name: 'sAVAX/Boosted Aave v3 WAVAX', + hasIcon: false, + features: { + [PoolFeature.Boosted]: { + featureProtocols: [Protocol.Aave], + }, + }, + }, + '0xece571847897fd61e764d455dc15cf1cd9de8d6f000000000000000000000014': { + name: 'yyAVAX/Boosted Aave v3 WAVAX', + hasIcon: false, + features: { + [PoolFeature.Boosted]: { + featureProtocols: [Protocol.Aave], + }, + }, + }, + '0x054e7b0c73e1ee5aed6864fa511658fc2b54bcaa000000000000000000000015': { + name: 'ggAVAX/Boosted Aave v3 WAVAX', + hasIcon: false, + features: { + [PoolFeature.Boosted]: { + featureProtocols: [Protocol.Aave], + }, + }, + }, + }, + Deep: [ + '0xa1d14d922a575232066520eda11e27760946c991000000000000000000000012', // Boosted Aave v3 USD + '0xa154009870e9b6431305f19b09f9cfd7284d4e7a000000000000000000000013', // sAVAX/Boosted Aave v3 WAVAX + '0xece571847897fd61e764d455dc15cf1cd9de8d6f000000000000000000000014', // yyAVAX/Boosted Aave v3 WAVAX + '0x054e7b0c73e1ee5aed6864fa511658fc2b54bcaa000000000000000000000015', // ggAVAX/Boosted Aave v3 WAVAX + ], + BoostedApr: [], + DisabledJoins: [], + Deprecated: {}, + GaugeMigration: {}, + BrandedRedirect: {}, + Issues: {}, +}; + +export default pools; diff --git a/src/lib/config/avalanche/rateProviders.ts b/src/lib/config/avalanche/rateProviders.ts new file mode 100644 index 0000000000..a2072658fc --- /dev/null +++ b/src/lib/config/avalanche/rateProviders.ts @@ -0,0 +1,9 @@ +import { RateProviders } from '../types'; + +const rateProviders: RateProviders = { + '*': { + '0x0000000000000000000000000000000000000000': true, + }, +}; + +export default rateProviders; diff --git a/src/lib/config/avalanche/tokenlists.ts b/src/lib/config/avalanche/tokenlists.ts new file mode 100644 index 0000000000..ff949b6fe9 --- /dev/null +++ b/src/lib/config/avalanche/tokenlists.ts @@ -0,0 +1,15 @@ +import { TokenListURLMap } from '@/types/TokenList'; + +const tokenlists: TokenListURLMap = { + Balancer: { + Default: + 'https://raw.githubusercontent.com/balancer/tokenlists/main/generated/balancer.tokenlist.json', + Vetted: + 'https://raw.githubusercontent.com/balancer/tokenlists/main/generated/balancer.tokenlist.json', + }, + External: [ + 'https://unpkg.com/quickswap-default-token-list@1.0.67/build/quickswap-default.tokenlist.json', + ], +}; + +export default tokenlists; diff --git a/src/lib/config/avalanche/tokens.ts b/src/lib/config/avalanche/tokens.ts new file mode 100644 index 0000000000..b45faf38f5 --- /dev/null +++ b/src/lib/config/avalanche/tokens.ts @@ -0,0 +1,19 @@ +import { TokenConstants } from '../types'; + +const tokens: TokenConstants = { + Popular: { + Symbols: ['WBTC', 'WETH', 'DAI', 'USDC', 'BAL', 'AVAX'], + }, + InitialSwapTokens: { + input: '0x0000000000000000000000000000000000000000', + output: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E', // USDC + }, + Addresses: { + nativeAsset: '0x0000000000000000000000000000000000000000', + wNativeAsset: '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', + WETH: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB', + BAL: '0xE15bCB9E0EA69e6aB9FA080c4c4A5632896298C3', + }, +}; + +export default tokens; diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts index 7624c79370..26f197b5b7 100644 --- a/src/lib/config/index.ts +++ b/src/lib/config/index.ts @@ -1,6 +1,7 @@ import { Config } from './types'; import arbitrum from './arbitrum'; +import avalanche from './avalanche'; import goerli from './goerli'; import gnosisChain from './gnosis-chain'; import mainnet from './mainnet'; @@ -19,6 +20,7 @@ export enum Network { FANTOM = 250, ZKEVM = 1101, ARBITRUM = 42161, + AVALANCHE = 43114, } const config: Record = { @@ -29,6 +31,7 @@ const config: Record = { [Network.OPTIMISM]: optimism, [Network.GNOSIS]: gnosisChain, [Network.ZKEVM]: zkevm, + [Network.AVALANCHE]: avalanche, }; export default config; diff --git a/src/lib/scripts/contract-addresses.generator.ts b/src/lib/scripts/contract-addresses.generator.ts index 95aee2baa4..22232cda86 100644 --- a/src/lib/scripts/contract-addresses.generator.ts +++ b/src/lib/scripts/contract-addresses.generator.ts @@ -28,7 +28,7 @@ async function generate() { fs.writeFileSync( `./src/assets/data/contracts/${network}.json`, - JSON.stringify(sortedContracts, null, 2) + JSON.stringify(sortedContracts, null, 2) + '\n' ); }); } diff --git a/src/providers/local/exit-pool.provider.ts b/src/providers/local/exit-pool.provider.ts index 42afae04ab..fa9d9bba4d 100644 --- a/src/providers/local/exit-pool.provider.ts +++ b/src/providers/local/exit-pool.provider.ts @@ -24,6 +24,7 @@ import { hasFetchedPoolsForSor } from '@/lib/balancer.sdk'; import { bnSum, bnum, + includesAddress, isSameAddress, removeAddress, selectByAddress, @@ -188,7 +189,8 @@ export const exitPoolProvider = ( (): boolean => isSingleAssetExit.value && isDeep(pool.value) && - isPreMintedBptType(pool.value.poolType) + isPreMintedBptType(pool.value.poolType) && + !includesAddress(pool.value.tokensList, singleAmountOut.address) ); const shouldUseGeneralisedExit = computed( diff --git a/src/services/balancer/pools/exits/handlers/exact-out-exit.handler.ts b/src/services/balancer/pools/exits/handlers/exact-out-exit.handler.ts index f86f722bc6..20b6792be5 100644 --- a/src/services/balancer/pools/exits/handlers/exact-out-exit.handler.ts +++ b/src/services/balancer/pools/exits/handlers/exact-out-exit.handler.ts @@ -14,6 +14,7 @@ import { TransactionResponse } from '@ethersproject/abstract-provider'; import { formatFixed, parseFixed } from '@ethersproject/bignumber'; import { Ref } from 'vue'; import { ExitParams, ExitPoolHandler, QueryOutput } from './exit-pool.handler'; +import { tokensListExclBpt } from '@/composables/usePoolHelpers'; export type ExitExactOutResponse = ReturnType< PoolWithMethods['buildExitExactTokensOut'] @@ -62,7 +63,7 @@ export class ExactOutExitHandler implements ExitPoolHandler { const poolTokensList = nativeAssetExit ? this.replaceWethWithEth(this.pool.value.tokensList) - : this.pool.value.tokensList; + : tokensListExclBpt(this.pool.value); const tokenOutIndex = indexOfAddress(poolTokensList, tokenOutAddress); const amountOut = amountsOut[0].value; diff --git a/src/services/web3/transactions/concerns/contract.concern.ts b/src/services/web3/transactions/concerns/contract.concern.ts index 1ebcaf4757..2e87b4c29b 100644 --- a/src/services/web3/transactions/concerns/contract.concern.ts +++ b/src/services/web3/transactions/concerns/contract.concern.ts @@ -68,13 +68,17 @@ export class ContractConcern extends TransactionConcern { } catch (err) { const error = err as WalletError; - error.metadata = await this.getErrorMetadata( - contractWithSigner, - action, - params, - block, - options - ); + try { + error.metadata = await this.getErrorMetadata( + contractWithSigner, + action, + params, + block, + options + ); + } catch (metaErr) { + console.error('Failed to set error metadata', metaErr); + } return Promise.reject(error); } diff --git a/src/services/web3/transactions/concerns/raw.concern.ts b/src/services/web3/transactions/concerns/raw.concern.ts index 0b8ae08f8e..1a129f6bef 100644 --- a/src/services/web3/transactions/concerns/raw.concern.ts +++ b/src/services/web3/transactions/concerns/raw.concern.ts @@ -35,7 +35,11 @@ export class RawConcern extends TransactionConcern { return await this.signer.sendTransaction(txOptions); } catch (err) { const error = err as WalletError; - error.metadata = await this.getErrorMetadata(options); + try { + error.metadata = await this.getErrorMetadata(options); + } catch (metaErr) { + console.error('Failed to set error metadata', metaErr); + } return Promise.reject(error); }