Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ VITE_FEATURE_DEBRIDGE_SWAP=true
VITE_FEATURE_USERBACK=true
VITE_FEATURE_AGENTIC_CHAT=false
VITE_FEATURE_MM_NATIVE_MULTICHAIN=false
VITE_FEATURE_APTOS=false
VITE_APTOS_NODE_URL=https://fullnode.mainnet.aptoslabs.com/v1

# experimental feature flags
VITE_EXPERIMENTAL_CUSTOM_SEND_NONCE=false
Expand Down
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ VITE_FEATURE_YIELD_MULTI_ACCOUNT=true
VITE_FEATURE_AGENTIC_CHAT=true
VITE_FEATURE_MM_NATIVE_MULTICHAIN=true
VITE_FEATURE_NOTIFICATIONS_WEBSERVICES=true
VITE_FEATURE_APTOS=true
VITE_APTOS_NODE_URL=https://fullnode.mainnet.aptoslabs.com/v1

# mixpanel
VITE_MIXPANEL_TOKEN=a867ce40912a6b7d01d088cf62b0e1ff
Expand Down
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ VITE_FEATURE_THORCHAIN_TCY_ACTIVITY=false
VITE_FEATURE_AGENTIC_CHAT=false
VITE_FEATURE_FLOWEVM=false
VITE_FEATURE_CELO=false
VITE_FEATURE_APTOS=false

# mixpanel
VITE_MIXPANEL_TOKEN=9d304465fc72224aead9e027e7c24356
66 changes: 66 additions & 0 deletions e2e/fixtures/aptos-chain-integration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Aptos Chain Integration
description: Validate Aptos chain integration - account discovery, balance display, native APT visibility, and asset picker integration. Mirrors the chain-integration-template.md test scenario used for Solana.
route: /trade
depends_on:
- wallet-health.yaml
steps:
- name: Open Manage Accounts modal
instruction: >
After wallet is unlocked and trade page is loaded, click the wallet button in the
top right (shows wallet name e.g. "teest"). Then click the three-dot menu icon
and select "Manage Accounts".
expected: Manage Accounts modal opened, list of supported chains displayed
screenshot: true

- name: Verify Aptos appears in chain list
instruction: >
In the Manage Accounts modal, scroll through the supported chains list and
verify "Aptos" appears as one of the available chains.
expected: Aptos is visible in the supported chains list
screenshot: true

- name: Discover Aptos account
instruction: >
Click on the Aptos chain row to expand it. If no account is shown, click
"Add Account" or the "+" button to derive the first Aptos account
(BIP44 path m/44'/637'/0'/0'/0'). Wait for the address to appear.
expected: An Aptos account address (0x followed by 64 hex chars) is shown
screenshot: true

- name: Close modal and verify Aptos in portfolio
instruction: >
Close the Manage Accounts modal. Navigate to the Dashboard (or Portfolio) page.
Look for Aptos chain in the asset list, or filter by chain to confirm Aptos
assets appear.
expected: Aptos chain and its native asset APT are visible in the portfolio
screenshot: true

- name: Open asset picker and search for APT
instruction: >
Navigate to /trade. Click the sell asset selector button. In the asset picker
dialog, type "APT" in the search box. Wait for the results to filter.
expected: APT (Aptos Coin) appears in the search results
screenshot: true

- name: Select APT as sell asset
instruction: >
Click "APT" (Aptos Coin, Aptos chain) from the search results. Wait for the
dialog to close and APT to appear as the sell asset.
expected: APT is selected as the sell asset, the chain filter shows Aptos
screenshot: true

- name: Verify Aptos chain filter in buy asset picker
instruction: >
Click the buy/receive asset selector. In the asset picker dialog, find and click
the Aptos chain filter chip (if available). Verify that filtering shows multiple
Aptos assets (e.g. APT, USDC, USDT, MOD, thAPT).
expected: Multiple Aptos-chain assets are listed (>= 5 tokens)
screenshot: true

- name: Verify APT native balance reads correctly
instruction: >
Close the asset picker. Look at the APT balance shown next to the sell input
("Balance: X APT" or similar). Verify the balance is a numeric value (could be
0 if test wallet has no APT, but should not be "N/A" or an error).
expected: APT balance is displayed as a numeric value (including 0)
screenshot: true
15 changes: 15 additions & 0 deletions headers/csps/chains/aptos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { loadEnv } from 'vite'

import type { Csp } from '../../types'

const mode = process.env.MODE ?? process.env.NODE_ENV ?? 'development'
const env = loadEnv(mode, process.cwd(), '')

export const csp: Csp = {
'connect-src': [
env.VITE_APTOS_NODE_URL,
env.VITE_APTOS_INDEXER_URL,
'https://fullnode.mainnet.aptoslabs.com/',
'https://api.mainnet.aptoslabs.com/',
],
}
2 changes: 2 additions & 0 deletions headers/csps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { csp as trustwallet } from './assetService/trustwallet'
import { csp as base } from './base'
import { csp as chainflip } from './chainflip'
import { csp as abstract } from './chains/abstract'
import { csp as aptos } from './chains/aptos'
import { csp as arbitrum } from './chains/arbitrum'
import { csp as avalanche } from './chains/avalanche'
import { csp as baseChain } from './chains/base'
Expand Down Expand Up @@ -130,6 +131,7 @@ export const csps = [
bitcoincash,
blast,
abstract,
aptos,
bnbsmartchain,
cosmos,
dogecoin,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"aptos:861fb8e6/slip44:637": "aptos", "aptos:861fb8e6/coin:0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b": "tether", "aptos:861fb8e6/coin:0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b": "usd-coin", "aptos:861fb8e6/coin:0x05fabd1b12e39967a3c24e91b7b8f67719a6dacee74f3c8b9fb7d93e855437d2": "usd1-wlfi", "aptos:861fb8e6/coin:0x68844a0d7f2587e726ad0579f3d640865bb4162c08a4589eeda3f9689ec52a3d": "wrapped-bitcoin", "aptos:861fb8e6/coin:0x435ad41e7b383cef98899c4e5a22c8dc88ab67b22f95e5663d6c6649298c3a9d": "hyperion", "aptos:861fb8e6/coin:0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab": "merkle-trade", "aptos:861fb8e6/coin:0xb36527754eb54d7ff55daf13bcb54b42b88ec484bd6f0e3b2e0d1db169de6451": "ami", "aptos:861fb8e6/coin:0x02370cc1d995f3aadd337c1c6c63834ad8d2bd0cdc70bc8dff81de463e18b159": "pontem-liquidswap", "aptos:861fb8e6/coin:0x377adc4848552eb2ea17259be928001923efe12271fef1667e2b784f04a7cf3a": "thala", "aptos:861fb8e6/coin:0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12": "cellena-finance", "aptos:861fb8e6/coin:0x0009da434d9b873b5159e8eeed70202ad22dc075867a7793234fbc981b63e119": "gui-inu", "aptos:861fb8e6/coin:0x378d5ba871c3d1bdf477a617f997f23d9e0702de97a02f42925b44fa3abc9866": "meso-finance", "aptos:861fb8e6/coin:0x79e8a5ddb82aa53854c1348c2865fd00732a41937dc1c160a4a50205537bd740": "tomarket", "aptos:861fb8e6/coin:0xb27b0c6b60772f0fc804ec1cd3339f552badf9bd1e125a7dd700d8eb11248ef1": "doodoo", "aptos:861fb8e6/coin:0xf37a8864fe737eb8ec2c2931047047cbaed1beed3fb0e5b7c5526dafd3b9c2e9": "ethena-usde", "aptos:861fb8e6/coin:0xa259be733b6a759909f92815927fa213904df6540519568692caf0b068fe8e62": "amnis-aptos", "aptos:861fb8e6/coin:0xb614bfdf9edc39b330bbf9c3c5bcd0473eee2f6d4e21748629cc367869ece627": "amnis-staked-aptos-coin", "aptos:861fb8e6/coin:0xa0d9d647c5737a5aed08d2cfeb39c31cf901d44bc4aa024eaa7e5e68b804e011": "thala-apt", "aptos:861fb8e6/coin:0x0a9ce1bddf93b074697ec5e483bc5050bc64cff2acd31e1ccfd8ac8cae5e4abe": "staked-thala-apt", "aptos:861fb8e6/coin:0x821c94e69bc7ca058c913b7b5e6b0a5c9fd1523d58723a966fb8c1f5ea888105": "kofi-aptos", "aptos:861fb8e6/coin:0x42556039b88593e768c97ab1a3ab0c6a17230825769304482dff8fdebe4c002b": "staked-kofi-aptos", "aptos:861fb8e6/coin:0x94ed76d3d66cb0b6e7a3ab81acf830e3a50b8ae3cfb9edc0abea635a11185ff4": "move-dollar", "aptos:861fb8e6/coin:0x2b3be0a97a73c87ff62cbdd36837a9fb5bbd1d7f06a73b7ed62ec15c5326c1b8": "layerzero-bridged-usdc-aptos", "aptos:861fb8e6/coin:0xe568e9322107a5c9ba4cbd05a630a5586aa73e744ada246c3efb0f4ce3e295f3": "layerzero-bridged-usdt-aptos", "aptos:861fb8e6/coin:0xae02f68520afd221a5cd6fda6f5500afedab8d0a2e19a916d6d8bc2b36e758db": "layerzero-bridged-weth-aptos", "aptos:861fb8e6/coin:0x54fc0d5fa5ad975ede1bf8b1c892ae018745a1afd4a4da9b70bb6e5448509fc0": "bridged-usd-coin-wormhole-ethereum", "aptos:861fb8e6/coin:0xf599112bc3a5b6092469890d6a2f353f485a6193c9d36626b480704467d3f4c8": "abtc", "aptos:861fb8e6/coin:0x8e51106b139001f1f25a320066621a2e0d140724ee9be1d49aaf9e76ceb24d75": "bedrock-btc", "aptos:861fb8e6/coin:0xf764dbfd6999067ac052a8e722ae359bec389bd7dba19ead586801b99b81b075": "universal-btc", "aptos:861fb8e6/coin:0x5915ae0eae3701833fa02e28bf530bc01ca96a5f010ac8deecb14c7a92661368": "uptos", "aptos:861fb8e6/coin:0x1fe81b3886ff129d42064f7ee934013de7ef968cb8f47adb5f7210192bcd4a23": "chewy-token", "aptos:861fb8e6/coin:0xa0fa5918da73235921c6120597db820df0be391d0056dc0a7ee7a80b83f29d64": "moo-moo", "aptos:861fb8e6/coin:0x4c3efb98d8d3662352f331b3465c6df263d1a7e84f002844348519614a5fea30": "movegpt", "aptos:861fb8e6/coin:0xd08a1ab00895c35dd19b356f5747355ebcd58cf5e684c15e6808d760ffd6beff": "hair", "aptos:861fb8e6/coin:0xad18575b0e51dd056e1e082223c0e014cbfe4b13bc55e92f450585884f4cf951": "pancakeswap-token", "aptos:861fb8e6/coin:0xaef6a8c3182e076db72d64324617114cacf9a52f28325edc10b483f7f05da0e7": "trufin-staked-apt", "aptos:861fb8e6/coin:0xa64d2d6f5e26daf6a3552f51d4110343b1a8c8046d0a9e72fa4086a337f3236c": "layerzero-bridged-wbtc-aptos", "aptos:861fb8e6/coin:0xc692943f7b340f02191c5de8dac2f827e0b66b3ed2206206a3526bcb0cae6e40": "cash-2", "aptos:861fb8e6/coin:0xb30a694a344edee467d9f82330bbe7c3b89f440a1ecd2da1f3bca266560fce69": "ethena-staked-usde", "aptos:861fb8e6/coin:0x92410a41654236295001f06375afbb1786dbd14bc1c42a33bfcf50204c248bb7": "ethereum-wormhole", "aptos:861fb8e6/coin:0x700e285ee9f4fc9b0e42a6217e329899e1353476bc532a484048008c8bc8e400": "stakestone-ether", "aptos:861fb8e6/coin:0xfbd6406c12cab2aef728c917a365cdb73883213f74af5e8a46c8fbd77b623ee7": "wrapped-ether-celer", "aptos:861fb8e6/coin:0x6dba1728c73363be1bdd4d504844c40fbb893e368ccbeff1d1bd83497dbc756d": "propbase", "aptos:861fb8e6/coin:0xe528f4df568eb9fff6398adc514bc9585fab397f478972bcbebf1e75dee40a88": "apollo-diversified-credit-securitize-fund", "aptos:861fb8e6/coin:0x50038be55be5b964cfa32cf128b5cf05f123959f286b4cc02b86cafd48945f89": "blackrock-usd-institutional-digital-liquidity-fund"}
2 changes: 2 additions & 0 deletions packages/caip/src/adapters/coingecko/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import tron from "./tron_0x2b6653dc/adapter.json";
import zcash from "./bip122_00040fe8ec8471911baa1db1266ea15d/adapter.json";
import near from "./near_mainnet/adapter.json";
import ton from "./ton_mainnet/adapter.json";
import aptos from "./aptos_861fb8e6/adapter.json";

export {
bitcoin,
Expand Down Expand Up @@ -96,4 +97,5 @@ export {
zcash,
near,
ton,
aptos,
};
13 changes: 13 additions & 0 deletions packages/caip/src/adapters/coingecko/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import type { ChainId } from '../../chainId/chainId'
import { fromChainId, toChainId } from '../../chainId/chainId'
import {
abstractChainId,
aptosChainId,
arbitrumChainId,
avalancheChainId,
baseChainId,
Expand Down Expand Up @@ -97,6 +98,7 @@ export enum CoingeckoAssetPlatform {
Starknet = 'starknet',
Tron = 'tron',
Sui = 'sui',
Aptos = 'aptos-network',
Ton = 'the-open-network',
Near = 'near-protocol',
Abstract = 'abstract',
Expand Down Expand Up @@ -243,6 +245,15 @@ export const chainIdToCoingeckoAssetPlatform = (chainId: ChainId): string => {
`chainNamespace ${chainNamespace}, chainReference ${chainReference} not supported.`,
)
}
case CHAIN_NAMESPACE.Aptos:
switch (chainReference) {
case CHAIN_REFERENCE.AptosMainnet:
return CoingeckoAssetPlatform.Aptos
default:
throw new Error(
`chainNamespace ${chainNamespace}, chainReference ${chainReference} not supported.`,
)
}
case CHAIN_NAMESPACE.Near:
switch (chainReference) {
case CHAIN_REFERENCE.NearMainnet:
Expand Down Expand Up @@ -363,6 +374,8 @@ export const coingeckoAssetPlatformToChainId = (
return tronChainId
case CoingeckoAssetPlatform.Sui:
return suiChainId
case CoingeckoAssetPlatform.Aptos:
return aptosChainId
case CoingeckoAssetPlatform.Ton:
return tonChainId
case CoingeckoAssetPlatform.Near:
Expand Down
17 changes: 17 additions & 0 deletions packages/caip/src/adapters/coingecko/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type { ChainId } from '../../chainId/chainId'
import {
abstractAssetId,
abstractChainId,
aptosAssetId,
aptosChainId,
arbitrumAssetId,
arbitrumChainId,
ASSET_NAMESPACE,
Expand Down Expand Up @@ -287,6 +289,20 @@ export const parseData = (coins: CoingeckoCoin[]): AssetMap => {
}
}

if (Object.keys(platforms).includes(CoingeckoAssetPlatform.Aptos)) {
try {
const assetId = toAssetId({
chainNamespace: CHAIN_NAMESPACE.Aptos,
chainReference: CHAIN_REFERENCE.AptosMainnet,
assetNamespace: ASSET_NAMESPACE.aptosCoin,
assetReference: platforms[CoingeckoAssetPlatform.Aptos],
})
prev[aptosChainId][assetId] = id
} catch {
// unable to create assetId, skip token
}
}

if (Object.keys(platforms).includes(CoingeckoAssetPlatform.Monad)) {
try {
const assetId = toAssetId({
Expand Down Expand Up @@ -707,6 +723,7 @@ export const parseData = (coins: CoingeckoCoin[]): AssetMap => {
[suiChainId]: { [suiAssetId]: 'sui' },
[nearChainId]: { [nearAssetId]: 'near' },
[tonChainId]: { [tonAssetId]: 'the-open-network' },
[aptosChainId]: { [aptosAssetId]: 'aptos' },
},
)

Expand Down
9 changes: 9 additions & 0 deletions packages/caip/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const suiAssetId: AssetId = 'sui:35834a8a/slip44:784'
export const nearAssetId: AssetId = 'near:mainnet/slip44:397'
export const starknetAssetId: AssetId = 'starknet:SN_MAIN/slip44:9004'
export const tonAssetId: AssetId = 'ton:mainnet/slip44:607'
export const aptosAssetId: AssetId = 'aptos:861fb8e6/slip44:637'
export const uniV2EthFoxArbitrumAssetId: AssetId =
'eip155:42161/erc20:0x5f6ce0ca13b87bd738519545d3e018e70e339c24'

Expand Down Expand Up @@ -142,6 +143,7 @@ export const suiChainId: ChainId = 'sui:35834a8a'
export const nearChainId: ChainId = 'near:mainnet'
export const starknetChainId: ChainId = 'starknet:SN_MAIN'
export const tonChainId: ChainId = 'ton:mainnet'
export const aptosChainId: ChainId = 'aptos:861fb8e6'

export const CHAIN_NAMESPACE = {
Evm: 'eip155',
Expand All @@ -153,6 +155,7 @@ export const CHAIN_NAMESPACE = {
Near: 'near',
Starknet: 'starknet',
Ton: 'ton',
Aptos: 'aptos',
} as const

type ValidChainMap = {
Expand Down Expand Up @@ -210,6 +213,7 @@ export const CHAIN_REFERENCE = {
StarknetMainnet: 'SN_MAIN', // https://namespaces.chainagnostic.org/starknet/caip2
TonMainnet: 'mainnet', // TON Mainnet
AbstractMainnet: '2741', // https://abscan.org
AptosMainnet: '861fb8e6', // First 8 chars of Aptos mainnet genesis hash
} as const

export const ASSET_NAMESPACE = {
Expand All @@ -224,6 +228,7 @@ export const ASSET_NAMESPACE = {
nep141: 'nep141', // NEAR fungible token standard: https://nomicon.io/Standards/Tokens/FungibleToken/Core
starknetToken: 'token',
jetton: 'jetton', // TON fungible token standard (TEP-74)
aptosCoin: 'coin', // Aptos native coin type
} as const

export const ASSET_REFERENCE = {
Expand Down Expand Up @@ -277,6 +282,7 @@ export const ASSET_REFERENCE = {
Starknet: '9004',
Ton: '607',
Abstract: '60', // evm chain which uses ethereum derivation path as common practice
Aptos: '637',
} as const

export const VALID_CHAIN_IDS: ValidChainMap = Object.freeze({
Expand Down Expand Up @@ -336,6 +342,7 @@ export const VALID_CHAIN_IDS: ValidChainMap = Object.freeze({
[CHAIN_NAMESPACE.Near]: [CHAIN_REFERENCE.NearMainnet],
[CHAIN_NAMESPACE.Starknet]: [CHAIN_REFERENCE.StarknetMainnet],
[CHAIN_NAMESPACE.Ton]: [CHAIN_REFERENCE.TonMainnet],
[CHAIN_NAMESPACE.Aptos]: [CHAIN_REFERENCE.AptosMainnet],
})

type ValidAssetNamespace = {
Expand All @@ -357,6 +364,7 @@ export const VALID_ASSET_NAMESPACE: ValidAssetNamespace = Object.freeze({
[CHAIN_NAMESPACE.Near]: [ASSET_NAMESPACE.slip44, ASSET_NAMESPACE.nep141],
[CHAIN_NAMESPACE.Starknet]: [ASSET_NAMESPACE.slip44, ASSET_NAMESPACE.starknetToken],
[CHAIN_NAMESPACE.Ton]: [ASSET_NAMESPACE.slip44, ASSET_NAMESPACE.jetton],
[CHAIN_NAMESPACE.Aptos]: [ASSET_NAMESPACE.slip44, ASSET_NAMESPACE.aptosCoin],
})

// We should prob change this once we add more chains
Expand Down Expand Up @@ -407,4 +415,5 @@ export const FEE_ASSET_IDS = [
katanaAssetId,
etherealAssetId,
flowEvmAssetId,
aptosAssetId,
]
1 change: 1 addition & 0 deletions packages/chain-adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"postbuild:cjs": "echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json"
},
"dependencies": {
"@aptos-labs/ts-sdk": "6.3.1",
"@mysten/sui": "1.45.0",
"@near-js/crypto": "^2.5.1",
"@near-js/providers": "^2.5.1",
Expand Down
Loading