diff --git a/packages/bridge-ui/.env.example b/packages/bridge-ui/.env.example index 35a9b244252..68003b3861c 100644 --- a/packages/bridge-ui/.env.example +++ b/packages/bridge-ui/.env.example @@ -34,4 +34,7 @@ export CONFIGURED_RELAYER= export CONFIGURED_EVENT_INDEXER= # Show the slow L1 bridging warning -export PUBLIC_SLOW_L1_BRIDGING_WARNING=false \ No newline at end of file +export PUBLIC_SLOW_L1_BRIDGING_WARNING=false + +# Fees +export PUBLIC_BASE_FEE_MULTIPLIER = \ No newline at end of file diff --git a/packages/bridge-ui/__mocks__/$customToken.ts b/packages/bridge-ui/__mocks__/$customToken.ts index f30b01fee2e..eabf9987a71 100644 --- a/packages/bridge-ui/__mocks__/$customToken.ts +++ b/packages/bridge-ui/__mocks__/$customToken.ts @@ -1,29 +1,3 @@ -import { zeroAddress } from 'viem'; +import { MOCK_ERC20, MOCK_ERC721 } from './../src/tests/mocks/tokens'; -const mockERC20 = { - name: 'MockERC20', - addresses: { '1': zeroAddress }, - symbol: 'MTF', - decimals: 18, - type: 'ERC20', -}; - -const mockERC1155 = { - name: 'MockERC1155', - addresses: { '1': zeroAddress }, - symbol: 'MNFT', - balance: 1337n, - tokenId: 123, - uri: 'some/uri/123', - type: 'ERC1155', -}; - -const mockERC721 = { - name: 'MockERC721', - addresses: { '1': zeroAddress }, - symbol: 'MNFT', - decimals: 18, - type: 'ERC721', -}; - -export const customToken = [mockERC20, mockERC1155, mockERC721]; +export const customToken = [MOCK_ERC20, MOCK_ERC721, MOCK_ERC721]; diff --git a/packages/bridge-ui/src/abi/index.ts b/packages/bridge-ui/src/abi/index.ts index 82687d42e8c..145ae25b2de 100644 --- a/packages/bridge-ui/src/abi/index.ts +++ b/packages/bridge-ui/src/abi/index.ts @@ -7,34 +7,31 @@ export const bridgeAbi = [ { type: 'function', inputs: [], - name: 'acceptOwnership', - outputs: [], - stateMutability: 'nonpayable', - }, - { - type: 'function', - inputs: [{ name: 'addr', internalType: 'address', type: 'address' }], - name: 'addressBanned', - outputs: [{ name: 'banned', internalType: 'bool', type: 'bool' }], + name: 'GAS_OVERHEAD', + outputs: [{ name: '', internalType: 'uint32', type: 'uint32' }], stateMutability: 'view', }, { type: 'function', inputs: [], - name: 'addressManager', - outputs: [{ name: '', internalType: 'address', type: 'address' }], + name: 'GAS_RESERVE', + outputs: [{ name: '', internalType: 'uint32', type: 'uint32' }], stateMutability: 'view', }, { type: 'function', - inputs: [ - { name: '_addr', internalType: 'address', type: 'address' }, - { name: '_ban', internalType: 'bool', type: 'bool' }, - ], - name: 'banAddress', + inputs: [], + name: 'acceptOwnership', outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'addressManager', + outputs: [{ name: '', internalType: 'address', type: 'address' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -55,17 +52,36 @@ export const bridgeAbi = [ }, { type: 'function', - inputs: [], - name: 'getInvocationDelays', - outputs: [ - { name: 'invocationDelay_', internalType: 'uint256', type: 'uint256' }, + inputs: [ { - name: 'invocationExtraDelay_', - internalType: 'uint256', - type: 'uint256', + name: '_message', + internalType: 'struct IBridge.Message', + type: 'tuple', + components: [ + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, + { name: 'from', internalType: 'address', type: 'address' }, + { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'destOwner', internalType: 'address', type: 'address' }, + { name: 'to', internalType: 'address', type: 'address' }, + { name: 'value', internalType: 'uint256', type: 'uint256' }, + { name: 'data', internalType: 'bytes', type: 'bytes' }, + ], }, ], - stateMutability: 'view', + name: 'failMessage', + outputs: [], + stateMutability: 'nonpayable', + }, + { + type: 'function', + inputs: [{ name: 'dataLength', internalType: 'uint256', type: 'uint256' }], + name: 'getMessageMinGasLimit', + outputs: [{ name: '', internalType: 'uint32', type: 'uint32' }], + stateMutability: 'pure', }, { type: 'function', @@ -75,19 +91,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -105,6 +119,13 @@ export const bridgeAbi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'init2', + outputs: [], + stateMutability: 'nonpayable', + }, { type: 'function', inputs: [{ name: '_chainId', internalType: 'uint64', type: 'uint64' }], @@ -123,19 +144,71 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'srcOwner', internalType: 'address', type: 'address' }, { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'destOwner', internalType: 'address', type: 'address' }, + { name: 'to', internalType: 'address', type: 'address' }, + { name: 'value', internalType: 'uint256', type: 'uint256' }, + { name: 'data', internalType: 'bytes', type: 'bytes' }, + ], + }, + { name: '_proof', internalType: 'bytes', type: 'bytes' }, + ], + name: 'isMessageFailed', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + stateMutability: 'view', + }, + { + type: 'function', + inputs: [ + { + name: '_message', + internalType: 'struct IBridge.Message', + type: 'tuple', + components: [ + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, + { name: 'from', internalType: 'address', type: 'address' }, + { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, + { name: 'destOwner', internalType: 'address', type: 'address' }, + { name: 'to', internalType: 'address', type: 'address' }, + { name: 'value', internalType: 'uint256', type: 'uint256' }, + { name: 'data', internalType: 'bytes', type: 'bytes' }, + ], + }, + { name: '_proof', internalType: 'bytes', type: 'bytes' }, + ], + name: 'isMessageReceived', + outputs: [{ name: '', internalType: 'bool', type: 'bool' }], + stateMutability: 'view', + }, + { + type: 'function', + inputs: [ + { + name: '_message', + internalType: 'struct IBridge.Message', + type: 'tuple', + components: [ + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, + { name: 'from', internalType: 'address', type: 'address' }, + { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -143,6 +216,13 @@ export const bridgeAbi = [ outputs: [{ name: '', internalType: 'bool', type: 'bool' }], stateMutability: 'view', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [{ name: 'msgHash', internalType: 'bytes32', type: 'bytes32' }], @@ -156,7 +236,7 @@ export const bridgeAbi = [ type: 'function', inputs: [], name: 'nextMessageId', - outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }], + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], stateMutability: 'view', }, { @@ -195,19 +275,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: '_proof', internalType: 'bytes', type: 'bytes' }, @@ -216,74 +294,6 @@ export const bridgeAbi = [ outputs: [], stateMutability: 'nonpayable', }, - { - type: 'function', - inputs: [{ name: 'msgHash', internalType: 'bytes32', type: 'bytes32' }], - name: 'proofReceipt', - outputs: [ - { name: 'receivedAt', internalType: 'uint64', type: 'uint64' }, - { name: 'preferredExecutor', internalType: 'address', type: 'address' }, - ], - stateMutability: 'view', - }, - { - type: 'function', - inputs: [ - { - name: '_message', - internalType: 'struct IBridge.Message', - type: 'tuple', - components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, - { name: 'from', internalType: 'address', type: 'address' }, - { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'srcOwner', internalType: 'address', type: 'address' }, - { name: 'destOwner', internalType: 'address', type: 'address' }, - { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, - { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, - { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, - ], - }, - { name: '_proof', internalType: 'bytes', type: 'bytes' }, - ], - name: 'proveMessageFailed', - outputs: [{ name: '', internalType: 'bool', type: 'bool' }], - stateMutability: 'view', - }, - { - type: 'function', - inputs: [ - { - name: '_message', - internalType: 'struct IBridge.Message', - type: 'tuple', - components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, - { name: 'from', internalType: 'address', type: 'address' }, - { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'srcOwner', internalType: 'address', type: 'address' }, - { name: 'destOwner', internalType: 'address', type: 'address' }, - { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, - { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, - { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, - ], - }, - { name: '_proof', internalType: 'bytes', type: 'bytes' }, - ], - name: 'proveMessageReceived', - outputs: [{ name: '', internalType: 'bool', type: 'bool' }], - stateMutability: 'view', - }, { type: 'function', inputs: [], @@ -299,19 +309,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: '_proof', internalType: 'bytes', type: 'bytes' }, @@ -356,19 +364,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: '_isLastAttempt', internalType: 'bool', type: 'bool' }, @@ -385,19 +391,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -409,19 +413,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -434,16 +436,6 @@ export const bridgeAbi = [ outputs: [{ name: '', internalType: 'bytes32', type: 'bytes32' }], stateMutability: 'pure', }, - { - type: 'function', - inputs: [ - { name: '_msgHashes', internalType: 'bytes32[]', type: 'bytes32[]' }, - { name: '_suspend', internalType: 'bool', type: 'bool' }, - ], - name: 'suspendMessages', - outputs: [], - stateMutability: 'nonpayable', - }, { type: 'function', inputs: [{ name: 'newOwner', internalType: 'address', type: 'address' }], @@ -477,15 +469,6 @@ export const bridgeAbi = [ outputs: [], stateMutability: 'payable', }, - { - type: 'event', - anonymous: false, - inputs: [ - { name: 'addr', internalType: 'address', type: 'address', indexed: true }, - { name: 'banned', internalType: 'bool', type: 'bool', indexed: false }, - ], - name: 'AddressBanned', - }, { type: 'event', anonymous: false, @@ -526,32 +509,6 @@ export const bridgeAbi = [ ], name: 'Initialized', }, - { - type: 'event', - anonymous: false, - inputs: [ - { - name: 'msgHash', - internalType: 'bytes32', - type: 'bytes32', - indexed: true, - }, - ], - name: 'MessageExecuted', - }, - { - type: 'event', - anonymous: false, - inputs: [ - { - name: 'msgHash', - internalType: 'bytes32', - type: 'bytes32', - indexed: true, - }, - ], - name: 'MessageRecalled', - }, { type: 'event', anonymous: false, @@ -567,38 +524,33 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], indexed: false, }, - { name: 'isRecall', internalType: 'bool', type: 'bool', indexed: false }, - ], - name: 'MessageReceived', - }, - { - type: 'event', - anonymous: false, - inputs: [ { - name: 'msgHash', - internalType: 'bytes32', - type: 'bytes32', - indexed: true, + name: 'stats', + internalType: 'struct Bridge.ProcessingStats', + type: 'tuple', + components: [ + { name: 'gasUsedInFeeCalc', internalType: 'uint32', type: 'uint32' }, + { name: 'proofSize', internalType: 'uint32', type: 'uint32' }, + { name: 'numCacheOps', internalType: 'uint32', type: 'uint32' }, + ], + indexed: false, }, ], - name: 'MessageRetried', + name: 'MessageProcessed', }, { type: 'event', @@ -615,19 +567,17 @@ export const bridgeAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], indexed: false, }, @@ -653,20 +603,6 @@ export const bridgeAbi = [ ], name: 'MessageStatusChanged', }, - { - type: 'event', - anonymous: false, - inputs: [ - { - name: 'msgHash', - internalType: 'bytes32', - type: 'bytes32', - indexed: false, - }, - { name: 'suspended', internalType: 'bool', type: 'bool', indexed: false }, - ], - name: 'MessageSuspended', - }, { type: 'event', anonymous: false, @@ -744,19 +680,18 @@ export const bridgeAbi = [ ], name: 'Upgraded', }, + { type: 'error', inputs: [], name: 'B_INSUFFICIENT_GAS' }, { type: 'error', inputs: [], name: 'B_INVALID_CHAINID' }, { type: 'error', inputs: [], name: 'B_INVALID_CONTEXT' }, + { type: 'error', inputs: [], name: 'B_INVALID_FEE' }, { type: 'error', inputs: [], name: 'B_INVALID_GAS_LIMIT' }, { type: 'error', inputs: [], name: 'B_INVALID_STATUS' }, { type: 'error', inputs: [], name: 'B_INVALID_USER' }, { type: 'error', inputs: [], name: 'B_INVALID_VALUE' }, - { type: 'error', inputs: [], name: 'B_INVOCATION_TOO_EARLY' }, { type: 'error', inputs: [], name: 'B_MESSAGE_NOT_SENT' }, - { type: 'error', inputs: [], name: 'B_NON_RETRIABLE' }, - { type: 'error', inputs: [], name: 'B_NOT_FAILED' }, - { type: 'error', inputs: [], name: 'B_NOT_RECEIVED' }, { type: 'error', inputs: [], name: 'B_PERMISSION_DENIED' }, - { type: 'error', inputs: [], name: 'B_STATUS_MISMATCH' }, + { type: 'error', inputs: [], name: 'B_RETRY_FAILED' }, + { type: 'error', inputs: [], name: 'B_SIGNAL_NOT_RECEIVED' }, { type: 'error', inputs: [], name: 'ETH_TRANSFER_FAILED' }, { type: 'error', inputs: [], name: 'INVALID_PAUSE_STATUS' }, { type: 'error', inputs: [], name: 'REENTRANT_CALL' }, @@ -836,20 +771,6 @@ export const crossChainSyncAbi = [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// export const erc1155VaultAbi = [ - { - type: 'function', - inputs: [], - name: 'ERC1155_INTERFACE_ID', - outputs: [{ name: '', internalType: 'bytes4', type: 'bytes4' }], - stateMutability: 'view', - }, - { - type: 'function', - inputs: [], - name: 'ERC721_INTERFACE_ID', - outputs: [{ name: '', internalType: 'bytes4', type: 'bytes4' }], - stateMutability: 'view', - }, { type: 'function', inputs: [], @@ -903,6 +824,13 @@ export const erc1155VaultAbi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -951,19 +879,17 @@ export const erc1155VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: 'msgHash', internalType: 'bytes32', type: 'bytes32' }, @@ -1046,13 +972,11 @@ export const erc1155VaultAbi = [ { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, { name: 'token', internalType: 'address', type: 'address' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'tokenIds', internalType: 'uint256[]', type: 'uint256[]' }, { name: 'amounts', internalType: 'uint256[]', type: 'uint256[]' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -1063,19 +987,17 @@ export const erc1155VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -1086,7 +1008,7 @@ export const erc1155VaultAbi = [ inputs: [{ name: 'interfaceId', internalType: 'bytes4', type: 'bytes4' }], name: 'supportsInterface', outputs: [{ name: '', internalType: 'bool', type: 'bool' }], - stateMutability: 'view', + stateMutability: 'pure', }, { type: 'function', @@ -1507,6 +1429,13 @@ export const erc20VaultAbi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -1529,19 +1458,17 @@ export const erc20VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: '_msgHash', internalType: 'bytes32', type: 'bytes32' }, @@ -1624,12 +1551,10 @@ export const erc20VaultAbi = [ { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, { name: 'token', internalType: 'address', type: 'address' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'amount', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -1640,19 +1565,17 @@ export const erc20VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -1663,7 +1586,7 @@ export const erc20VaultAbi = [ inputs: [{ name: '_interfaceId', internalType: 'bytes4', type: 'bytes4' }], name: 'supportsInterface', outputs: [{ name: '', internalType: 'bool', type: 'bool' }], - stateMutability: 'view', + stateMutability: 'pure', }, { type: 'function', @@ -2047,20 +1970,6 @@ export const erc20VaultAbi = [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// export const erc721VaultAbi = [ - { - type: 'function', - inputs: [], - name: 'ERC1155_INTERFACE_ID', - outputs: [{ name: '', internalType: 'bytes4', type: 'bytes4' }], - stateMutability: 'view', - }, - { - type: 'function', - inputs: [], - name: 'ERC721_INTERFACE_ID', - outputs: [{ name: '', internalType: 'bytes4', type: 'bytes4' }], - stateMutability: 'view', - }, { type: 'function', inputs: [], @@ -2114,6 +2023,13 @@ export const erc721VaultAbi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -2148,19 +2064,17 @@ export const erc721VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, { name: '_msgHash', internalType: 'bytes32', type: 'bytes32' }, @@ -2243,13 +2157,11 @@ export const erc721VaultAbi = [ { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, { name: 'token', internalType: 'address', type: 'address' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'tokenIds', internalType: 'uint256[]', type: 'uint256[]' }, { name: 'amounts', internalType: 'uint256[]', type: 'uint256[]' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -2260,19 +2172,17 @@ export const erc721VaultAbi = [ internalType: 'struct IBridge.Message', type: 'tuple', components: [ - { name: 'id', internalType: 'uint128', type: 'uint128' }, + { name: 'id', internalType: 'uint64', type: 'uint64' }, + { name: 'fee', internalType: 'uint64', type: 'uint64' }, + { name: 'gasLimit', internalType: 'uint32', type: 'uint32' }, { name: 'from', internalType: 'address', type: 'address' }, { name: 'srcChainId', internalType: 'uint64', type: 'uint64' }, - { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'srcOwner', internalType: 'address', type: 'address' }, + { name: 'destChainId', internalType: 'uint64', type: 'uint64' }, { name: 'destOwner', internalType: 'address', type: 'address' }, { name: 'to', internalType: 'address', type: 'address' }, - { name: 'refundTo', internalType: 'address', type: 'address' }, { name: 'value', internalType: 'uint256', type: 'uint256' }, - { name: 'fee', internalType: 'uint256', type: 'uint256' }, - { name: 'gasLimit', internalType: 'uint256', type: 'uint256' }, { name: 'data', internalType: 'bytes', type: 'bytes' }, - { name: 'memo', internalType: 'string', type: 'string' }, ], }, ], @@ -2283,7 +2193,7 @@ export const erc721VaultAbi = [ inputs: [{ name: '_interfaceId', internalType: 'bytes4', type: 'bytes4' }], name: 'supportsInterface', outputs: [{ name: '', internalType: 'bool', type: 'bool' }], - stateMutability: 'view', + stateMutability: 'pure', }, { type: 'function', @@ -2674,6 +2584,16 @@ export const erc1155Abi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'canonical', + outputs: [ + { name: '', internalType: 'address', type: 'address' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + stateMutability: 'view', + }, { type: 'function', inputs: [ @@ -2698,6 +2618,13 @@ export const erc1155Abi = [ outputs: [{ name: '', internalType: 'bool', type: 'bool' }], stateMutability: 'view', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [ @@ -3112,6 +3039,13 @@ export const erc1155Abi = [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// export const erc20Abi = [ + { + type: 'function', + inputs: [], + name: 'CLOCK_MODE', + outputs: [{ name: '', internalType: 'string', type: 'string' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -3172,10 +3106,7 @@ export const erc20Abi = [ }, { type: 'function', - inputs: [ - { name: '_account', internalType: 'address', type: 'address' }, - { name: '_amount', internalType: 'uint256', type: 'uint256' }, - ], + inputs: [{ name: '_amount', internalType: 'uint256', type: 'uint256' }], name: 'burn', outputs: [], stateMutability: 'nonpayable', @@ -3220,6 +3151,13 @@ export const erc20Abi = [ ], stateMutability: 'view', }, + { + type: 'function', + inputs: [], + name: 'clock', + outputs: [{ name: '', internalType: 'uint48', type: 'uint48' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -3267,7 +3205,22 @@ export const erc20Abi = [ }, { type: 'function', - inputs: [{ name: 'blockNumber', internalType: 'uint256', type: 'uint256' }], + inputs: [], + name: 'eip712Domain', + outputs: [ + { name: 'fields', internalType: 'bytes1', type: 'bytes1' }, + { name: 'name', internalType: 'string', type: 'string' }, + { name: 'version', internalType: 'string', type: 'string' }, + { name: 'chainId', internalType: 'uint256', type: 'uint256' }, + { name: 'verifyingContract', internalType: 'address', type: 'address' }, + { name: 'salt', internalType: 'bytes32', type: 'bytes32' }, + { name: 'extensions', internalType: 'uint256[]', type: 'uint256[]' }, + ], + stateMutability: 'view', + }, + { + type: 'function', + inputs: [{ name: 'timepoint', internalType: 'uint256', type: 'uint256' }], name: 'getPastTotalSupply', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], stateMutability: 'view', @@ -3276,7 +3229,7 @@ export const erc20Abi = [ type: 'function', inputs: [ { name: 'account', internalType: 'address', type: 'address' }, - { name: 'blockNumber', internalType: 'uint256', type: 'uint256' }, + { name: 'timepoint', internalType: 'uint256', type: 'uint256' }, ], name: 'getPastVotes', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }], @@ -3314,6 +3267,13 @@ export const erc20Abi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [], @@ -3437,15 +3397,6 @@ export const erc20Abi = [ outputs: [{ name: '', internalType: 'address payable', type: 'address' }], stateMutability: 'view', }, - { - type: 'function', - inputs: [ - { name: '_snapshooter', internalType: 'address', type: 'address' }, - ], - name: 'setSnapshoter', - outputs: [], - stateMutability: 'nonpayable', - }, { type: 'function', inputs: [], @@ -3453,13 +3404,6 @@ export const erc20Abi = [ outputs: [{ name: '', internalType: 'address', type: 'address' }], stateMutability: 'view', }, - { - type: 'function', - inputs: [], - name: 'snapshot', - outputs: [], - stateMutability: 'nonpayable', - }, { type: 'function', inputs: [], @@ -3656,6 +3600,7 @@ export const erc20Abi = [ ], name: 'DelegateVotesChanged', }, + { type: 'event', anonymous: false, inputs: [], name: 'EIP712DomainChanged' }, { type: 'event', anonymous: false, @@ -3808,7 +3753,6 @@ export const erc20Abi = [ { type: 'error', inputs: [], name: 'BB_PERMISSION_DENIED' }, { type: 'error', inputs: [], name: 'BTOKEN_CANNOT_RECEIVE' }, { type: 'error', inputs: [], name: 'BTOKEN_INVALID_PARAMS' }, - { type: 'error', inputs: [], name: 'BTOKEN_UNAUTHORIZED' }, { type: 'error', inputs: [], name: 'INVALID_PAUSE_STATUS' }, { type: 'error', inputs: [], name: 'REENTRANT_CALL' }, { type: 'error', inputs: [], name: 'RESOLVER_DENIED' }, @@ -3871,6 +3815,16 @@ export const erc721Abi = [ outputs: [], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [], + name: 'canonical', + outputs: [ + { name: '', internalType: 'address', type: 'address' }, + { name: '', internalType: 'uint256', type: 'uint256' }, + ], + stateMutability: 'view', + }, { type: 'function', inputs: [{ name: 'tokenId', internalType: 'uint256', type: 'uint256' }], @@ -3902,6 +3856,13 @@ export const erc721Abi = [ outputs: [{ name: '', internalType: 'bool', type: 'bool' }], stateMutability: 'view', }, + { + type: 'function', + inputs: [], + name: 'lastUnpausedAt', + outputs: [{ name: '', internalType: 'uint64', type: 'uint64' }], + stateMutability: 'view', + }, { type: 'function', inputs: [ @@ -4523,7 +4484,9 @@ export const signalServiceAbi = [ { name: '_proof', internalType: 'bytes', type: 'bytes' }, ], name: 'proveSignalReceived', - outputs: [], + outputs: [ + { name: 'numCacheOps_', internalType: 'uint256', type: 'uint256' }, + ], stateMutability: 'nonpayable', }, { @@ -4556,6 +4519,18 @@ export const signalServiceAbi = [ outputs: [{ name: 'signal_', internalType: 'bytes32', type: 'bytes32' }], stateMutability: 'nonpayable', }, + { + type: 'function', + inputs: [ + { name: '_chainId', internalType: 'uint64', type: 'uint64' }, + { name: '_app', internalType: 'address', type: 'address' }, + { name: '_signal', internalType: 'bytes32', type: 'bytes32' }, + { name: '_proof', internalType: 'bytes', type: 'bytes' }, + ], + name: 'verifySignalReceived', + outputs: [], + stateMutability: 'view', + }, { type: 'event', anonymous: false, diff --git a/packages/bridge-ui/src/app.config.ts b/packages/bridge-ui/src/app.config.ts index 0afc7671bcc..4f147f0b621 100644 --- a/packages/bridge-ui/src/app.config.ts +++ b/packages/bridge-ui/src/app.config.ts @@ -1,4 +1,5 @@ export const recommendProcessingFeeConfig = { + GAS_RESERVE: 650_000, // based on Bridge.sol ethGasLimit: BigInt(900_000), erc20NotDeployedGasLimit: BigInt(1_650_000), erc20DeployedGasLimit: BigInt(1_100_000), @@ -39,7 +40,7 @@ export const bridgeTransactionPoller = { }; export const claimConfig = { - minimumEthToClaim: 0.0001, + minimumEthToClaim: 0.001, }; export const transactionConfig = { diff --git a/packages/bridge-ui/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte b/packages/bridge-ui/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte index 9f24c23da4c..8f81bbb7da8 100644 --- a/packages/bridge-ui/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte +++ b/packages/bridge-ui/src/components/Bridge/FungibleBridgeComponents/ImportStep/TokenInput/TokenInput.svelte @@ -25,8 +25,7 @@ import { OnNetwork } from '$components/OnNetwork'; import { TokenDropdown } from '$components/TokenDropdown'; import { getMaxAmountToBridge } from '$libs/bridge'; - import { UnknownTokenTypeError } from '$libs/error'; - import { fetchBalance, tokens, TokenType } from '$libs/token'; + import { fetchBalance, tokens } from '$libs/token'; import { refreshUserBalance, renderBalance } from '$libs/util/balance'; import { debounce } from '$libs/util/debounce'; import { getLogger } from '$libs/util/logger'; @@ -70,30 +69,6 @@ return; } - if (!$tokenBalance) { - $tokenBalance = await fetchBalance({ userAddress: user, token, srcChainId: $connectedSourceChain?.id }); - if (!$tokenBalance?.value) { - $insufficientBalance = true; - $validatingAmount = false; - } - } - - switch (token.type) { - case TokenType.ERC20: - case TokenType.ERC1155: - if ($tokenBalance?.value && ($ethBalance <= 0n || $enteredAmount > $tokenBalance?.value)) { - $insufficientBalance = true; - } - break; - case TokenType.ETH: - case TokenType.ERC721: - if ($enteredAmount >= $ethBalance) { - $insufficientBalance = true; - } - break; - default: - throw new UnknownTokenTypeError(); - } $validatingAmount = false; $computingBalance = false; } @@ -105,22 +80,7 @@ $validatingAmount = true; $errorComputingBalance = false; - if ($selectedToken.type === TokenType.ERC1155) { - // For ERC1155, no decimals are allowed - if (/[.,]/.test(value)) { - $errorComputingBalance = true; - return; - } - } - if ( - $selectedToken.type !== TokenType.ERC1155 && - $selectedToken.type !== TokenType.ERC721 && - !$selectedToken.decimals - ) { - $enteredAmount = BigInt(value); - } else { - $enteredAmount = parseUnits(value, $selectedToken.decimals); - } + $enteredAmount = parseUnits(value, $selectedToken.decimals); debouncedValidateAmount(); }; @@ -156,15 +116,14 @@ $computingBalance = true; value = ''; $enteredAmount = 0n; - if ($account && $account.address && $account?.isConnected) { + if ($account && $account.address && $account?.isConnected && $selectedToken) { validateAmount($selectedToken); refreshUserBalance(); - if ($selectedToken) - $tokenBalance = await fetchBalance({ - userAddress: $account.address, - token: $selectedToken, - srcChainId: $connectedSourceChain?.id, - }); + $tokenBalance = await fetchBalance({ + userAddress: $account.address, + token: $selectedToken, + srcChainId: $connectedSourceChain?.id, + }); previousSelectedToken = $selectedToken; } else { balance = '0.00'; diff --git a/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte index 323c702e4ce..92ecb6f7e24 100644 --- a/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte +++ b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ManualImport.svelte @@ -5,11 +5,11 @@ import { FlatAlert } from '$components/Alert'; import IdInput from '$components/Bridge/NFTBridgeComponents/IDInput/IDInput.svelte'; import { IDInputState } from '$components/Bridge/NFTBridgeComponents/IDInput/state'; + import TokenAmountInput from '$components/Bridge/NFTBridgeComponents/ImportStep/TokenAmountInput.svelte'; import AddressInput from '$components/Bridge/SharedBridgeComponents/AddressInput/AddressInput.svelte'; import { AddressInputState } from '$components/Bridge/SharedBridgeComponents/AddressInput/state'; import { enteredAmount, selectedNFTs, selectedToken, tokenBalance } from '$components/Bridge/state'; import { importDone } from '$components/Bridge/state'; - import TokenAmountInput from '$components/Bridge/TokenAmountInput.svelte'; import { detectContractType, type NFT, TokenType } from '$libs/token'; import { checkOwnership } from '$libs/token/checkOwnership'; import { getTokenWithInfoFromAddress } from '$libs/token/getTokenWithInfoFromAddress'; diff --git a/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte index 1f3975fac37..3743a9a6c56 100644 --- a/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte +++ b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/ScannedImport.svelte @@ -2,8 +2,8 @@ import { onMount } from 'svelte'; import { t } from 'svelte-i18n'; + import TokenAmountInput from '$components/Bridge/NFTBridgeComponents/ImportStep/TokenAmountInput.svelte'; import { enteredAmount, selectedNFTs, tokenBalance } from '$components/Bridge/state'; - import TokenAmountInput from '$components/Bridge/TokenAmountInput.svelte'; import { ImportMethod } from '$components/Bridge/types'; import { ActionButton, Button } from '$components/Button'; import { IconFlipper } from '$components/Icon'; diff --git a/packages/bridge-ui/src/components/Bridge/TokenAmountInput.svelte b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/TokenAmountInput.svelte similarity index 97% rename from packages/bridge-ui/src/components/Bridge/TokenAmountInput.svelte rename to packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/TokenAmountInput.svelte index d5a92e927b5..e37cd4030ae 100644 --- a/packages/bridge-ui/src/components/Bridge/TokenAmountInput.svelte +++ b/packages/bridge-ui/src/components/Bridge/NFTBridgeComponents/ImportStep/TokenAmountInput.svelte @@ -8,7 +8,6 @@ import { warningToast } from '$components/NotificationToast'; import { InvalidParametersProvidedError, UnknownTokenTypeError } from '$libs/error'; import { ETHToken, fetchBalance, fetchBalance as getTokenBalance, TokenType } from '$libs/token'; - import { renderBalance } from '$libs/util/balance'; import { debounce } from '$libs/util/debounce'; import { getLogger } from '$libs/util/logger'; import { uid } from '$libs/util/uid'; @@ -27,7 +26,7 @@ selectedToken, tokenBalance, validatingAmount, - } from './state'; + } from '../../state'; const log = getLogger('component:Amount'); @@ -212,7 +211,7 @@ {#if computingMaxAmount} {:else} - {renderBalance($tokenBalance)} + {/if} {/if} @@ -231,7 +230,6 @@ on:input={inputAmount} bind:this={inputBox} class="py-6 pr-16 px-[26px] title-subsection-bold border-0 {$$props.class}" /> - {#if maxButtonEnabled}