Skip to content

Commit

Permalink
fix: Transfer Ether from NEAR to Aurora.
Browse files Browse the repository at this point in the history
  • Loading branch information
paouvrard committed Jul 19, 2024
1 parent 211ce6d commit adcd103
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ export async function sendToAurora (
nearAccount?: Account
nearProvider?: najProviders.Provider
auroraEvmAccount?: string
etherNep141Factory?: string
}
}
): Promise<Transfer> {
Expand Down Expand Up @@ -422,6 +423,7 @@ export async function lock (
options?: {
nearAccount?: Account
auroraEvmAccount?: string
etherNep141Factory?: string
}
): Promise<Transfer> {
options = options ?? {}
Expand All @@ -430,10 +432,11 @@ export async function lock (
const isNajAccount = nearWallet instanceof Account
const browserRedirect = typeof window !== 'undefined' && (isNajAccount || nearWallet.type === 'browser')
const auroraEvmAccount = options.auroraEvmAccount ?? bridgeParams.auroraEvmAccount
const etherNep141Factory = options.etherNep141Factory ?? bridgeParams.etherNep141Factory

// nETH (aurora) transfers to Aurora have a different protocol:
// nETH (etherNep141Factory) transfers to Aurora have a different protocol:
// <relayer_id>:<fee(32 bytes)><eth_address_receiver(20 bytes)>
const msgPrefix = transfer.sourceToken === auroraEvmAccount ? transfer.sender + ':' + '0'.repeat(64) : ''
const msgPrefix = transfer.sourceToken === etherNep141Factory ? transfer.sender + ':' + '0'.repeat(64) : ''

// NOTE:
// checkStatus should wait for NEAR wallet redirect if it didn't happen yet.
Expand Down

0 comments on commit adcd103

Please sign in to comment.