Skip to content

Commit

Permalink
remove additional payload, since aptos does not support it acordingly…
Browse files Browse the repository at this point in the history
… to the wormhole sdk comment (#1179)

Co-authored-by: Sebastian Scatularo <[email protected]>
  • Loading branch information
sebastianscatularo and Sebastian Scatularo authored Nov 15, 2024
1 parent 2913300 commit fccf201
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/hooks/useHandleTransfer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,20 @@ async function aptos(
const baseAmountParsed = parseUnits(amount, decimals);
const feeParsed = parseUnits(relayerFee || "0", decimals);
const transferAmountParsed = baseAmountParsed.add(feeParsed);

const additionalPayload = maybeAdditionalPayload();

// Aptos does not support additional payload, comment out for now
// See https://github.com/wormhole-foundation/wormhole/blob/main/sdk/js/src/token_bridge/transfer.ts#L901
// const additionalPayload = maybeAdditionalPayload();
const transferPayload = transferFromAptos(
tokenBridgeAddress,
tokenAddress,
transferAmountParsed.toString(),
recipientChain,
additionalPayload?.receivingContract || recipientAddress,
additionalPayload?.payload
? undefined
: createNonce().readUInt32LE(0).toString(),
additionalPayload?.payload
recipientAddress,
//additionalPayload?.receivingContract || recipientAddress,
//additionalPayload?.payload
// ? undefined
// : createNonce().readUInt32LE(0).toString(),
//additionalPayload?.payload
);

const hash = await waitForSignAndSubmitTransaction(transferPayload, wallet);
Expand Down
2 changes: 2 additions & 0 deletions src/utils/parseError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const MM_ERR_WITH_INFO_START =
const DEFAULT_ERROR_MESSAGE = "An unknown error occurred";

const parseError = (e: any): string => {
// Logs more information about the error
console.trace(e);
if (e?.data?.message?.startsWith(MM_ERR_WITH_INFO_START)) {
return e.data.message.replace(MM_ERR_WITH_INFO_START, "");
}
Expand Down

0 comments on commit fccf201

Please sign in to comment.