Skip to content

Commit 3411d85

Browse files
authored
fix: solana CCTPv2 redeem support (#3797)
1 parent be391b2 commit 3411d85

4 files changed

Lines changed: 30 additions & 7 deletions

File tree

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@wormhole-foundation/sdk-sui": "3.5.0",
7575
"@wormhole-foundation/sdk-sui-core": "3.5.0",
7676
"@wormhole-foundation/sdk-sui-ntt": "2.0.5",
77-
"@wormhole-labs/cctp-executor-route": "0.15.0",
77+
"@wormhole-labs/cctp-executor-route": "0.16.0",
7878
"@wormhole-labs/wallet-aggregator-aptos": "1.3.0",
7979
"@wormhole-labs/wallet-aggregator-core": "0.0.1",
8080
"@wormhole-labs/wallet-aggregator-evm": "0.9.0",

src/utils/sdkv2.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,25 @@ const parseCCTPv2Receipt = async (
506506
// NOTE: the sender is the shim contract, not the user's wallet
507507
// so don't set that here
508508

509-
txData.recipient = messageBody.mintRecipient.toNative(receipt.to).toString();
509+
if (receipt.to === 'Solana') {
510+
if (!config.rpcs.Solana) {
511+
throw new Error('Missing Solana RPC');
512+
}
513+
// the recipient on the VAA is the ATA
514+
const ata = messageBody.mintRecipient.toNative(receipt.to).toString();
515+
const connection = new Connection(config.rpcs.Solana);
516+
try {
517+
const account = await splToken.getAccount(connection, new PublicKey(ata));
518+
txData.recipient = account.owner.toBase58();
519+
} catch (e) {
520+
console.error(e);
521+
txData.recipient = ata;
522+
}
523+
} else {
524+
txData.recipient = messageBody.mintRecipient
525+
.toNative(receipt.to)
526+
.toString();
527+
}
510528

511529
// The attestation doesn't have the destination token address, but we can deduce which it is
512530
// just based off the destination chain

src/views/v3/Redeem/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,12 @@ function Redeem() {
608608
receivingWallet.address !== recipient &&
609609
routeName &&
610610
// These routes set the recipient address to the associated token address
611-
['ManualTokenBridge', 'ManualCCTP'].includes(routeName)
611+
[
612+
'ManualTokenBridge',
613+
'ManualCCTP',
614+
'CCTPv2FastExecutorRoute',
615+
'CCTPv2StandardExecutorRoute',
616+
].includes(routeName)
612617
) {
613618
const { address: receiveTokenAddress } = tokenIdFromTuple(receivedToken);
614619

0 commit comments

Comments
 (0)