Skip to content

feat: paradexsepolia<>sepolia warp deployment #551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
383b1c3
feat: enable Starknet wallet & message ID parsing on UI
ljankovic-txfusion Apr 2, 2025
3546142
Merge remote-tracking branch 'origin/main' into feat/starknet-wallet-…
ljankovic-txfusion Apr 8, 2025
eecf652
refactor: format code with prettier
ljankovic-txfusion Apr 8, 2025
5713873
Merge remote-tracking branch 'origin/main' into feat/starknet-wallet-…
ljankovic-txfusion Apr 15, 2025
790c42b
chore: update dependencies and add Sepolia testnet configuration
ljankovic-txfusion Apr 15, 2025
fda30a6
Merge remote-tracking branch 'origin/main' into feat/starknet-wallet-…
ljankovic-txfusion Apr 25, 2025
7fb40ef
Refactor StarknetWalletContext to improve chain handling
ljankovic-txfusion Apr 25, 2025
6b31246
chore: todo comment for starknet uniqueChains
ljankovic-txfusion Apr 25, 2025
57ea92a
Merge remote-tracking branch 'origin/main' into feat/starknet-wallet-…
ljankovic-txfusion Apr 28, 2025
8c01a9e
fix: prettier StarknetWalletContext
ljankovic-txfusion Apr 28, 2025
1cb6d76
Merge remote-tracking branch 'origin/main' into feat/starknet-wallet-…
ljankovic-txfusion Apr 29, 2025
8c24060
new registry
aroralanuk May 1, 2025
a6648d1
include only starknetsepolia and sepolia
aroralanuk May 1, 2025
64ea60e
yarn lock
aroralanuk May 1, 2025
cc13387
prettier
aroralanuk May 1, 2025
04aa040
rm dup warp route
aroralanuk May 1, 2025
01d01d9
revert starknetsepolia version
aroralanuk May 1, 2025
d6cf8a8
ignore warp route from registry
aroralanuk May 1, 2025
f20c304
in consts chains
aroralanuk May 1, 2025
423f39c
paradexsepolia artifacts
aroralanuk May 2, 2025
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: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@headlessui/react": "^2.2.0",
"@hyperlane-xyz/registry": "13.13.0",
"@hyperlane-xyz/sdk": "12.4.0",
"@hyperlane-xyz/utils": "12.4.0",
"@hyperlane-xyz/widgets": "12.4.0",
"@hyperlane-xyz/registry": "13.14.1",
"@hyperlane-xyz/sdk": "13.0.0-starknet.1",
"@hyperlane-xyz/utils": "13.0.0-starknet.1",
"@hyperlane-xyz/widgets": "13.0.0-starknet.1",
"@interchain-ui/react": "^1.23.28",
"@metamask/post-message-stream": "6.1.2",
"@metamask/providers": "10.2.1",
Expand All @@ -43,7 +43,7 @@
"cosmjs-types": "^0.9.0",
"formik": "^2.4.6",
"framer-motion": "^10.16.4",
"next": "^15.0.3",
"next": "^15.3.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-toastify": "^10.0.6",
Expand Down
1 change: 1 addition & 0 deletions public/logo/paradex.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/logo/starknet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 47 additions & 27 deletions src/consts/chains.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,56 @@
import {
eclipsemainnet,
eclipsemainnetAddresses,
solanamainnet,
solanamainnetAddresses,
sonicsvm,
sonicsvmAddresses,
soon,
soonAddresses,
} from '@hyperlane-xyz/registry';
import { ChainMap, ChainMetadata } from '@hyperlane-xyz/sdk';
import { ChainMap, ChainMetadata, ExplorerFamily } from '@hyperlane-xyz/sdk';
import { ProtocolType } from '@hyperlane-xyz/utils';

// A map of chain names to ChainMetadata
// Chains can be defined here, in chains.json, or in chains.yaml
// Chains already in the SDK need not be included here unless you want to override some fields
// Schema here: https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/typescript/sdk/src/metadata/chainMetadataTypes.ts
export const chains: ChainMap<ChainMetadata & { mailbox?: Address }> = {
solanamainnet: {
...solanamainnet,
// SVM chains require mailbox addresses for the token adapters
mailbox: solanamainnetAddresses.mailbox,
},
eclipsemainnet: {
...eclipsemainnet,
mailbox: eclipsemainnetAddresses.mailbox,
},
soon: {
...soon,
mailbox: soonAddresses.mailbox,
},
sonicsvm: {
...sonicsvm,
mailbox: sonicsvmAddresses.mailbox,
// solanamainnet: {
// ...solanamainnet,
// // SVM chains require mailbox addresses for the token adapters
// mailbox: solanamainnetAddresses.mailbox,
// },
// eclipsemainnet: {
// ...eclipsemainnet,
// mailbox: eclipsemainnetAddresses.mailbox,
// },
// soon: {
// ...soon,
// mailbox: soonAddresses.mailbox,
// },
// sonicsvm: {
// ...sonicsvm,
// mailbox: sonicsvmAddresses.mailbox,
// },
paradexsepolia: {
chainId: '0x505249564154455f534e5f504f54435f5345504f4c4941',
domainId: 12263410,
name: 'paradexsepolia',
protocol: ProtocolType.Starknet,
rpcUrls: [{ http: 'https://pathfinder.api.testnet.paradex.trade/rpc/v0_7' }],
blocks: {
confirmations: 0,
estimateBlockTime: 4,
reorgPeriod: 0,
},
isTestnet: true,
displayName: 'Paradex Sepolia',
nativeToken: {
name: 'EtherDUMMY_TOKEN',
symbol: 'DT',
decimals: 18,
denom: '0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7',
},
blockExplorers: [
{
name: 'Paradex Sepolia',
url: 'https://voyager.testnet.paradex.trade',
apiUrl: 'https://voyager.testnet.paradex.trade/api',
family: ExplorerFamily.Other,
},
],
logoURI: '/logo/paradex.svg',
},
// mycustomchain: {
// protocol: ProtocolType.Ethereum,
Expand Down
2 changes: 2 additions & 0 deletions src/consts/chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
# protocol: ethereum
# rpcUrls:
# - http: http://127.0.0.1:8555

# yaml-language-server: $schema=../schema.json
7 changes: 6 additions & 1 deletion src/consts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ export const config: Config = Object.freeze({
version,
transferBlacklist,
walletConnectProjectId,
walletProtocols: [ProtocolType.Ethereum, ProtocolType.Sealevel, ProtocolType.Cosmos],
walletProtocols: [
ProtocolType.Ethereum,
ProtocolType.Sealevel,
ProtocolType.Cosmos,
ProtocolType.Starknet,
],
shouldDisableChains: false,
rpcOverrides,
});
2 changes: 1 addition & 1 deletion src/consts/warpRouteWhitelist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Warp Route IDs use format `SYMBOL/chainname1-chainname2...` where chains are ordered alphabetically
// If left null, all warp routes in the configured registry will be included
// If set to a list (including an empty list), only the specified routes will be included
export const warpRouteWhitelist: Array<string> | null = null;
export const warpRouteWhitelist: Array<string> | null = ['USDC/paradexsepolia-sepolia'];
// Example:
// [
// // 'ETH/ethereum-viction'
Expand Down
21 changes: 20 additions & 1 deletion src/consts/warpRoutes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,24 @@
# These configs will be merged with the warp routes in the configured registry
# The input here is typically the output of the Hyperlane CLI warp deploy command
---
tokens: []
options: {}
tokens:
- addressOrDenom: '0x42f919945D740A3b6172a4FE320d20CC23B4Ac36'
chainName: sepolia
collateralAddressOrDenom: '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238'
connections:
- token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a
- token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a
Comment on lines +10 to +12
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The connections array contains a duplicate entry for the same token address. This appears to be unintentional and should be fixed by removing one of the entries:

connections:
  - token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a
  - token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a  # Duplicate entry

Having duplicate connections could potentially cause issues with the warp route configuration or lead to unexpected behavior.

Suggested change
connections:
- token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a
- token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a
connections:
- token: ethereum|paradexsepolia|0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

decimals: 6
name: USDC
standard: EvmHypCollateral
symbol: USDC
- addressOrDenom: '0x0417c1391aba15b35373012970386f8096887c74504b7381d94e646ee9c3815a'
chainName: paradexsepolia
connections:
- token: ethereum|sepolia|0x42f919945D740A3b6172a4FE320d20CC23B4Ac36
- token: ethereum|sepolia|0x42f919945D740A3b6172a4FE320d20CC23B4Ac36
decimals: 6
name: USDC
standard: StarknetHypSynthetic
symbol: USDC
8 changes: 6 additions & 2 deletions src/features/transfer/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,12 @@ export function tryGetMsgIdFromTransferReceipt(
// IBC transfers have no message IDs
if (receipt.type === ProviderType.CosmJs) return undefined;

// TODO: Remove this once we have a way to get the message ID from SDK
if (receipt.type === ProviderType.Starknet) return undefined;
if (receipt.type === ProviderType.Starknet) {
receipt = {
type: ProviderType.Starknet,
receipt: receipt.receipt as any,
};
}

if (receipt.type === ProviderType.Viem) {
// Massage viem type into ethers type because that's still what the
Expand Down
34 changes: 32 additions & 2 deletions src/features/wallet/context/StarknetWalletContext.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { getStarknetChains } from '@hyperlane-xyz/widgets';
import { Chain } from '@starknet-react/chains';
import { StarknetConfig, publicProvider, voyager } from '@starknet-react/core';
import { PropsWithChildren } from 'react';
import { PropsWithChildren, useMemo } from 'react';
import { InjectedConnector } from 'starknetkit/injected';
import { useMultiProvider } from '../../chains/hooks';

// temporary using const sepolia chain
const sepolia: Chain = {
Expand Down Expand Up @@ -47,8 +50,35 @@ const sepolia: Chain = {
};

export function StarknetWalletContext({ children }: PropsWithChildren<unknown>) {
const multiProvider = useMultiProvider();
const chainsFromRegistry = getStarknetChains(multiProvider);
const connectors = useMemo(
() => [
new InjectedConnector({ options: { id: 'braavos', name: 'Braavos' } }),
new InjectedConnector({ options: { id: 'argentX', name: 'Argent X' } }),
],
[],
);

// TODO: remove after sepolia is included in registry
const uniqueChains = useMemo(() => {
const combinedChains = [...chainsFromRegistry, sepolia];
const chainMap = combinedChains.reduce((map, chain) => {
if (!map.has(chain.id)) {
map.set(chain.id, chain);
}
return map;
}, new Map<bigint, Chain>());
return Array.from(chainMap.values());
}, [chainsFromRegistry]);

return (
<StarknetConfig chains={[sepolia]} provider={publicProvider()} explorer={voyager}>
<StarknetConfig
chains={uniqueChains}
provider={publicProvider()}
connectors={connectors}
explorer={voyager}
>
{children}
</StarknetConfig>
);
Expand Down
Loading
Loading