Skip to content

Commit

Permalink
sui: manual cctp support (#3074)
Browse files Browse the repository at this point in the history
  • Loading branch information
kev1n-peters authored Dec 17, 2024
1 parent 51a0e91 commit 84c171f
Show file tree
Hide file tree
Showing 7 changed files with 286 additions and 232 deletions.
381 changes: 226 additions & 155 deletions wormhole-connect/package-lock.json

Large diffs are not rendered by default.

32 changes: 16 additions & 16 deletions wormhole-connect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
"@solana/spl-token": "^0.3.9",
"@solana/wallet-adapter-wallets": "^0.19.25",
"@solana/web3.js": "^1.95.8",
"@wormhole-foundation/sdk": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-definitions": "^1.3.0-beta.2",
"@wormhole-foundation/sdk": "1.3.0-beta.3",
"@wormhole-foundation/sdk-definitions": "1.3.0-beta.3",
"@wormhole-foundation/sdk-definitions-ntt": "^0.6.1",
"@wormhole-foundation/sdk-evm-ntt": "^0.6.1",
"@wormhole-foundation/sdk-icons": "^1.0.0",
Expand Down Expand Up @@ -155,28 +155,28 @@
"@ledgerhq/devices": "6.27.1"
},
"@mayanfinance/wormhole-sdk-route": {
"@wormhole-foundation/sdk-connect": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-evm": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-solana": "^1.3.0-beta.2"
"@wormhole-foundation/sdk-connect": "1.3.0-beta.3",
"@wormhole-foundation/sdk-evm": "1.3.0-beta.3",
"@wormhole-foundation/sdk-solana": "1.3.0-beta.3"
},
"@wormhole-foundation/sdk-definitions-ntt": {
"@wormhole-foundation/sdk-base": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-definitions": "^1.3.0-beta.2"
"@wormhole-foundation/sdk-base": "1.3.0-beta.3",
"@wormhole-foundation/sdk-definitions": "1.3.0-beta.3"
},
"@wormhole-foundation/sdk-evm-ntt": {
"@wormhole-foundation/sdk-base": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-definitions": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-evm": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-evm-core": "^1.3.0-beta.2"
"@wormhole-foundation/sdk-base": "1.3.0-beta.3",
"@wormhole-foundation/sdk-definitions": "1.3.0-beta.3",
"@wormhole-foundation/sdk-evm": "1.3.0-beta.3",
"@wormhole-foundation/sdk-evm-core": "1.3.0-beta.3"
},
"@wormhole-foundation/sdk-route-ntt": {
"@wormhole-foundation/sdk-connect": "^1.3.0-beta.2"
"@wormhole-foundation/sdk-connect": "1.3.0-beta.3"
},
"@wormhole-foundation/sdk-solana-ntt": {
"@wormhole-foundation/sdk-base": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-definitions": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-solana": "^1.3.0-beta.2",
"@wormhole-foundation/sdk-solana-core": "^1.3.0-beta.2"
"@wormhole-foundation/sdk-base": "1.3.0-beta.3",
"@wormhole-foundation/sdk-definitions": "1.3.0-beta.3",
"@wormhole-foundation/sdk-solana": "1.3.0-beta.3",
"@wormhole-foundation/sdk-solana-core": "1.3.0-beta.3"
},
"@wormhole-foundation/wormhole-connect": {
"aptos": "1.5.0"
Expand Down
14 changes: 14 additions & 0 deletions wormhole-connect/src/config/mainnet/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,20 @@ export const MAINNET_TOKENS: TokensConfig = {
color: '#8457EF',
decimals: 9,
},
USDCsui: {
key: 'USDCsui',
symbol: 'USDC',
nativeChain: 'Sui',
tokenId: {
chain: 'Sui',
address:
'0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC',
},
icon: TokenIcon.USDC,
coinGeckoId: 'usd-coin',
color: '#2774CA',
decimals: 6,
},
APT: {
key: 'APT',
symbol: 'APT',
Expand Down
14 changes: 14 additions & 0 deletions wormhole-connect/src/config/testnet/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,20 @@ export const TESTNET_TOKENS: TokensConfig = {
color: '#8457EF',
decimals: 9,
},
USDCsui: {
key: 'USDCsui',
symbol: 'USDC',
nativeChain: 'Sui',
tokenId: {
chain: 'Sui',
address:
'0xa1ec7fc00a6f40db9693ad1415d0c193ad3906494428cf252621037bd7117e29::usdc::USDC',
},
icon: TokenIcon.USDC,
coinGeckoId: 'usd-coin',
color: '#2774CA',
decimals: 6,
},
APT: {
key: 'APT',
symbol: 'APT',
Expand Down
18 changes: 9 additions & 9 deletions wormhole-connect/src/icons/Chains/WORLD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ function WORLD() {
<path
d="M29.1239 11.0384L18.375 11.0554C14.8158 11.0554 11.9303 13.9408 11.9303 17.5C11.9303 21.0592 14.8158 23.9447 18.375 23.9447H28.726"
stroke="white"
stroke-width="2.25944"
stroke-miterlimit="10"
stroke-linecap="round"
strokeWidth="2.25944"
strokeMiterlimit="10"
strokeLinecap="round"
/>
<path
d="M6.17065 17.5H31.0001"
stroke="white"
stroke-width="2.25944"
stroke-miterlimit="10"
stroke-linecap="round"
strokeWidth="2.25944"
strokeMiterlimit="10"
strokeLinecap="round"
/>
<path
d="M18.5 5C25.4036 5 31 10.5964 31 17.5C31 24.4036 25.4036 30 18.5 30C11.5964 30 6 24.4036 6 17.5C6 10.5964 11.5964 5 18.5 5Z"
stroke="white"
stroke-width="2.25944"
stroke-miterlimit="10"
stroke-linecap="round"
strokeWidth="2.25944"
strokeMiterlimit="10"
strokeLinecap="round"
/>
</svg>
);
Expand Down
51 changes: 0 additions & 51 deletions wormhole-connect/src/utils/repairVaa.ts

This file was deleted.

8 changes: 7 additions & 1 deletion wormhole-connect/src/utils/sdkv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
amount,
routes,
CircleTransfer,
circle,
} from '@wormhole-foundation/sdk';
import config from 'config';
import { NttRoute } from '@wormhole-foundation/sdk-route-ntt';
Expand Down Expand Up @@ -310,8 +311,13 @@ const parseCCTPReceipt = async (

const sourceTokenId = Wormhole.tokenId(
receipt.from,
payload.burnToken.toNative(receipt.from).toString(),
receipt.from === 'Sui'
? // The `burnToken` from Sui is the keccak256 hash of the USDC token address,
// so we need to override it with the actual USDC address
circle.usdcContract.get(config.network, receipt.from)!
: payload.burnToken.toNative(receipt.from).toString(),
);

const usdcLegacy = config.sdkConverter.findTokenConfigV1(
sourceTokenId,
config.tokensArr,
Expand Down

0 comments on commit 84c171f

Please sign in to comment.