Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: add CreditCoin chain support
  • Loading branch information
DBosley committed Oct 6, 2025
commit 11876931d845ee7e79ebe82d65abfd9ef45587b6
8 changes: 8 additions & 0 deletions src/config/mainnet/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,4 +233,12 @@ export const MAINNET_CHAINS: ChainsConfig = {
icon: 'XRPLEVM',
symbol: 'XRP',
},
CreditCoin: {
displayName: 'Creditcoin',
sdkName: 'CreditCoin',
explorerUrl: 'https://creditcoin.blockscout.com',
explorerName: 'Blockscout',
icon: 'CreditCoin',
symbol: 'CTC',
},
};
2 changes: 2 additions & 0 deletions src/config/mainnet/rpcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {
REACT_APP_HYPEREVM_RPC,
REACT_APP_XRPL_RPC,
REACT_APP_HYPERCORE_RPC,
REACT_APP_CREDITCOIN_RPC,
} = import.meta.env;

export const MAINNET_RPC_MAPPING = {
Expand Down Expand Up @@ -61,4 +62,5 @@ export const MAINNET_RPC_MAPPING = {
...populateRpcField('HyperEVM', REACT_APP_HYPEREVM_RPC),
...populateRpcField('XRPLEVM', REACT_APP_XRPL_RPC),
...populateRpcField('HyperCore', REACT_APP_HYPERCORE_RPC),
...populateRpcField('CreditCoin', REACT_APP_CREDITCOIN_RPC),
};
18 changes: 18 additions & 0 deletions src/config/mainnet/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ export const MAINNET_TOKENS: TokenConfig[] = [
address: '0x4Fabb145d64652a948d72533023f6E7A623C7C53',
},
},
{
symbol: 'wCTC',
decimals: 18,
icon: TokenIcon.CTC,
tokenId: {
chain: 'Ethereum',
address: '0xaafec8e08d524d534327fa13fb306f440b5f88eb',
},
},
{
symbol: 'POL',
decimals: 18,
Expand Down Expand Up @@ -804,4 +813,13 @@ export const MAINNET_TOKENS: TokenConfig[] = [
decimals: 18,
icon: TokenIcon.XRP,
},
{
symbol: 'CTC',
tokenId: {
chain: 'CreditCoin',
address: 'native',
},
decimals: 18,
icon: TokenIcon.CTC,
},
];
1 change: 1 addition & 0 deletions src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export enum TokenIcon {
'FOGO',
'HYPE',
'XRP',
'CTC',
}

// Used in bridging components
Expand Down
5 changes: 5 additions & 0 deletions src/hooks/useConfigUpdate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ describe('[Integration] Bridge component config updates', () => {
'Solana',
'HyperEVM',
'Unichain',
'CreditCoin',
]),
};
mockConfig.routes = newRoutes;
Expand Down Expand Up @@ -99,6 +100,7 @@ describe('[Integration] Bridge component config updates', () => {
'Solana',
'HyperEVM',
'Unichain',
'CreditCoin',
]),
};
mockConfig.routes = newRoutes;
Expand All @@ -113,6 +115,7 @@ describe('[Integration] Bridge component config updates', () => {
'Solana',
'HyperEVM',
'Unichain',
'CreditCoin',
]);
});

Expand Down Expand Up @@ -148,6 +151,7 @@ describe('[Integration] Bridge component config updates', () => {
'Solana',
'HyperEVM',
'Unichain',
'CreditCoin',
]),
};
mockConfig.routes = newRoutes;
Expand All @@ -164,6 +168,7 @@ describe('[Integration] Bridge component config updates', () => {
'Solana',
'HyperEVM',
'Unichain',
'CreditCoin',
]);
});
});
2 changes: 2 additions & 0 deletions src/icons/ChainIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import FOGO from './Chains/FOGO';
import INK from './Chains/INK';
import HyperEVM from './Chains/HYPEREVM';
import XRPLEVM from './Chains/XRPLEVM';
import CreditCoin from './Chains/CreditCoin';

const iconMap: { [key in Chain]?: React.JSX.Element } = {
Moonbeam: GLMR(),
Expand Down Expand Up @@ -66,6 +67,7 @@ const iconMap: { [key in Chain]?: React.JSX.Element } = {
HyperEVM: HyperEVM(),
HyperCore: HYPERCORE(),
XRPLEVM: XRPLEVM(),
CreditCoin: CreditCoin(),
};

function isBuiltinChainIcon(icon?: Chain | string): icon is Chain {
Expand Down
24 changes: 24 additions & 0 deletions src/icons/Chains/CreditCoin.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

function CreditCoin() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="481"
height="481"
fill="none"
viewBox="0 0 481 481"
>
<path
fill="#2D353F"
d="M364.64 312.16C339.72 355.11 293.23 384 240 384c-79.53 0-144-64.47-144-144S160.47 96 240 96c53.29 0 99.81 28.95 124.71 71.97l31.16-18.04C364.73 96.17 306.59 60 240 60c-99.41 0-180 80.59-180 180s80.59 180 180 180c66.56 0 124.67-36.13 155.82-89.84l-31.18-18Z"
/>
<path
fill="#2D353F"
d="M420 222H271.14c-6.23-10.75-17.83-18-31.14-18-19.88 0-36 16.12-36 36s16.12 36 36 36c13.32 0 24.92-7.25 31.14-18H420v-36Z"
/>
</svg>
);
}

export default CreditCoin;
2 changes: 2 additions & 0 deletions src/icons/TokenIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import PLUME from './Tokens/PLUME';
import FOGO from './Tokens/FOGO';
import HYPE from './Tokens/HYPE';
import XRP from './Tokens/XRP';
import CTC from './Tokens/CTC';

const iconMap: { [key in TokenIcon]: React.JSX.Element } = {
[TokenIcon.WBTC]: WBTC(),
Expand Down Expand Up @@ -99,6 +100,7 @@ const iconMap: { [key in TokenIcon]: React.JSX.Element } = {
[TokenIcon.FOGO]: FOGO(),
[TokenIcon.HYPE]: HYPE(),
[TokenIcon.XRP]: XRP(),
[TokenIcon.CTC]: CTC(),
};

function isBuiltinTokenIcon(icon?: TokenIcon | string): icon is TokenIcon {
Expand Down
24 changes: 24 additions & 0 deletions src/icons/Tokens/CTC.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

function CTC() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width="481"
height="481"
fill="none"
viewBox="0 0 481 481"
>
<path
fill="#2D353F"
d="M364.64 312.16C339.72 355.11 293.23 384 240 384c-79.53 0-144-64.47-144-144S160.47 96 240 96c53.29 0 99.81 28.95 124.71 71.97l31.16-18.04C364.73 96.17 306.59 60 240 60c-99.41 0-180 80.59-180 180s80.59 180 180 180c66.56 0 124.67-36.13 155.82-89.84l-31.18-18Z"
/>
<path
fill="#2D353F"
d="M420 222H271.14c-6.23-10.75-17.83-18-31.14-18-19.88 0-36 16.12-36 36s16.12 36 36 36c13.32 0 24.92-7.25 31.14-18H420v-36Z"
/>
</svg>
);
}

export default CTC;
6 changes: 4 additions & 2 deletions src/routes/operator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,15 @@ describe('RouteOperator Chain Support', () => {
expect(initialChains).toContain('Ethereum');

// Dynamically update NTT configuration to include new chains
nttConfig = { HYPE: ['HyperEVM', 'Unichain'] };
nttConfig = { HYPE: ['HyperEVM', 'Unichain', 'CreditCoin'] };

// The operator should reflect the new supported chains from the route constructors
const chainsAfterUpdate = operator.allSupportedChains();

// This should pass with our fix that calls route.rc.supportedChains()
expect(chainsAfterUpdate).toContain('HyperEVM');
expect(chainsAfterUpdate).toContain('Unichain');
expect(chainsAfterUpdate).toContain('CreditCoin');
});

it('should support recreating operator with updated route configurations', () => {
Expand Down Expand Up @@ -83,7 +84,7 @@ describe('RouteOperator Chain Support', () => {
expect(initialChains).not.toContain('HyperEVM');

// Configuration updates to include new chains
nttConfig = { HYPE: ['HyperEVM', 'Unichain'] };
nttConfig = { HYPE: ['HyperEVM', 'Unichain', 'CreditCoin'] };

// Creating a new operator with updated routes should reflect new chains
const operator2 = new RouteOperator(createRoutes() as any);
Expand All @@ -92,6 +93,7 @@ describe('RouteOperator Chain Support', () => {
// New operator instance should have updated chain support
expect(updatedChains).toContain('HyperEVM');
expect(updatedChains).toContain('Unichain');
expect(updatedChains).toContain('CreditCoin');
});

it('should handle dynamic configuration updates in UI components', () => {
Expand Down
1 change: 1 addition & 0 deletions src/sdklegacy/config/MAINNET.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const MAINNET_CONFIG: WormholeConfig = {
XRPLEVM: 'https://rpc.xrplevm.org/',
Plume: 'https://rpc.plume.org',
Ink: 'https://ink.drpc.org',
CreditCoin: 'https://mainnet3.creditcoin.network',
},
};

Expand Down
1 change: 1 addition & 0 deletions src/utils/coingecko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const NATIVE_TOKEN_IDS: Partial<Record<Chain, string>> = {
Ink: 'ethereum',
HyperEVM: 'hyperliquid',
HyperCore: 'usd-coin',
CreditCoin: 'creditcoin',
};

// This refers to Coingecko API's platform names: https://api.coingecko.com/api/v3/asset_platforms
Expand Down