aurora-is-near / rainbow-bridge-client

Monorepo containing Aurora-maintained libraries for using the Rainbow Bridge
https://github.com/near/rainbow-bridge-client/tree/main/packages/client#readme
MIT License
25 stars 7 forks source link

BorshError: Expected buffer length 20 isn't within bounds: recipient #77

Closed dlpigpen closed 2 years ago

dlpigpen commented 2 years ago

It comes from the line code in the file src/rainbown/nep141-erc20/src/bridged-nep141/sendToEthereum/index.ts:334:41)

  const withdrawEvent = deserializeBorsh(
    SCHEMA, WithdrawEvent, Buffer.from(successValue, 'base64')
  ) as { amount: BN, token: Uint8Array, recipient: Uint8Array}
dlpigpen commented 2 years ago

The same issue in the file ethXnear.naturalNEAR.recover BorshError: Unexpected 19 bytes after deserialized data


ethXnear.naturalNEAR.recover BorshError: Unexpected 19 bytes after deserialized data
    at deserialize (/node_modules/borsh/lib/index.js:405:15)
    at Object.recover (/src/rainbown/near-ether/src/natural-near/sendToEthereum/index.ts:315:37)
paouvrard commented 2 years ago

It appears your NEAR transaction which started the transfer doesn't contain the recipient on Ethereum. Do you have the NEAR testnet transaction to reproduce ?

dlpigpen commented 2 years ago

you can reproduce with txHash 'H6oYtGjZPtV2S74s32Nswrckah4eLGyeNB6u74X9sLnw'

paouvrard commented 2 years ago

The hash provided in an ETH transfer, so you should be using @near-eth/near-ether/bridged-ether/sendToEthereum. https://testnet.rainbowbridge.app/transfer/H6oYtGjZPtV2S74s32Nswrckah4eLGyeNB6u74X9sLnw

dlpigpen commented 2 years ago

I think it made by a mistake. any way how to recover a tx hash without knowing type of transfer?

paouvrard commented 2 years ago

You could query the tx information to see which contract is being called, or just try/catch recover from the different packages.