diff --git a/packages/aurora-erc20/src/bridged-erc20/sendToEthereum/index.ts b/packages/aurora-erc20/src/bridged-erc20/sendToEthereum/index.ts index 40235480..ea8af2fa 100644 --- a/packages/aurora-erc20/src/bridged-erc20/sendToEthereum/index.ts +++ b/packages/aurora-erc20/src/bridged-erc20/sendToEthereum/index.ts @@ -80,6 +80,7 @@ export interface TransferOptions { nearAccount?: Account ethClientAddress?: string ethClientAbi?: string + nearTokenFactoryAccount?: string } const transferDraft: TransferDraft = { @@ -765,7 +766,7 @@ export async function checkSync ( if (nearOnEthClientBlockHeight > burnBlockHeight) { proof = await findNearProof( last(transfer.nearBurnReceiptIds), - transfer.sender, + options.nearTokenFactoryAccount ?? bridgeParams.nearTokenFactoryAccount, nearOnEthClientBlockHeight, nearAccount, provider, diff --git a/packages/aurora-ether/src/bridged-ether/sendToEthereum/index.ts b/packages/aurora-ether/src/bridged-ether/sendToEthereum/index.ts index 17fc3802..5ea8ea34 100644 --- a/packages/aurora-ether/src/bridged-ether/sendToEthereum/index.ts +++ b/packages/aurora-ether/src/bridged-ether/sendToEthereum/index.ts @@ -77,6 +77,7 @@ export interface TransferOptions { ethClientAddress?: string ethClientAbi?: string auroraProvider?: ethers.providers.JsonRpcProvider + auroraEvmAccount?: string } const transferDraft: TransferDraft = { @@ -725,7 +726,7 @@ export async function checkSync ( if (nearOnEthClientBlockHeight > burnBlockHeight) { proof = await findNearProof( last(transfer.nearBurnReceiptIds), - transfer.sender, + options.auroraEvmAccount ?? bridgeParams.auroraEvmAccount, nearOnEthClientBlockHeight, nearAccount, provider, diff --git a/packages/near-ether/src/bridged-ether/sendToEthereum/index.ts b/packages/near-ether/src/bridged-ether/sendToEthereum/index.ts index b7e4fdb1..73c5ea70 100644 --- a/packages/near-ether/src/bridged-ether/sendToEthereum/index.ts +++ b/packages/near-ether/src/bridged-ether/sendToEthereum/index.ts @@ -776,7 +776,7 @@ export async function checkSync ( if (nearOnEthClientBlockHeight > withdrawBlockHeight) { proof = await findNearProof( last(transfer.burnReceiptIds), - transfer.sender, + options.auroraEvmAccount ?? bridgeParams.auroraEvmAccount, nearOnEthClientBlockHeight, nearAccount, provider, diff --git a/packages/near-ether/src/natural-near/sendToEthereum/index.ts b/packages/near-ether/src/natural-near/sendToEthereum/index.ts index 67cdc501..6c4ed3b2 100644 --- a/packages/near-ether/src/natural-near/sendToEthereum/index.ts +++ b/packages/near-ether/src/natural-near/sendToEthereum/index.ts @@ -761,7 +761,7 @@ export async function checkSync ( if (nearOnEthClientBlockHeight > lockReceiptBlockHeight) { proof = await findNearProof( last(transfer.lockReceiptIds), - transfer.sender, + options.nativeNEARLockerAddress ?? bridgeParams.nativeNEARLockerAddress, nearOnEthClientBlockHeight, nearAccount, provider, diff --git a/packages/nep141-erc20/src/bridged-nep141/sendToEthereum/index.ts b/packages/nep141-erc20/src/bridged-nep141/sendToEthereum/index.ts index d2f50445..555806d6 100644 --- a/packages/nep141-erc20/src/bridged-nep141/sendToEthereum/index.ts +++ b/packages/nep141-erc20/src/bridged-nep141/sendToEthereum/index.ts @@ -68,6 +68,7 @@ export interface TransferOptions { erc20Abi?: string nep141Factory?: string erc20LockerAbi?: string + nearTokenFactoryAccount?: string } class TransferError extends Error {} @@ -776,7 +777,7 @@ export async function checkSync ( if (nearOnEthClientBlockHeight > withdrawBlockHeight) { proof = await findNearProof( last(transfer.withdrawReceiptIds), - transfer.sender, + options.nearTokenFactoryAccount ?? bridgeParams.nearTokenFactoryAccount, nearOnEthClientBlockHeight, nearAccount, provider, diff --git a/packages/utils/src/borshify-proof.ts b/packages/utils/src/borshify-proof.ts index dc59fd71..8bcd4a21 100644 --- a/packages/utils/src/borshify-proof.ts +++ b/packages/utils/src/borshify-proof.ts @@ -61,7 +61,15 @@ export function borshifyOutcomeProof (proof: any): Buffer { statusToBuffer(proof.outcome_proof.outcome.status), - utils.toBN(0).toBuffer('le', 4), + utils.toBN(proof.outcome_root_proof.length).toBuffer('le', 4), + Buffer.concat( + proof.outcome_root_proof.map((orp: any) => + Buffer.concat([ + bs58.decode(orp.hash), + Buffer.from([orp.direction === 'Right' ? 1 : 0]) + ]) + ) + ), bs58.decode(proof.block_header_lite.prev_block_hash), bs58.decode(proof.block_header_lite.inner_rest_hash),