Skip to content
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

Nautilus #108

Open
wants to merge 100 commits into
base: main
Choose a base branch
from
Open
Changes from 21 commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
0294a61
Make name, symbol, decimals optional in config
jmrossy Aug 10, 2023
eaf3793
Revert token config changes
jmrossy Aug 10, 2023
efe3bec
Use chain metadata for token protocol
jmrossy Aug 13, 2023
940a211
Update tokendata schema
jmrossy Aug 13, 2023
fc1596b
Setup Eclipse tokens and chains
jmrossy Aug 13, 2023
898bcd6
Fix solanadevnet token config
jmrossy Aug 13, 2023
eb0b2a1
Fetch remote router decimal values during init
jmrossy Aug 13, 2023
ec3a863
Merge branch 'rossy/multi-collateral' into eclipse
jmrossy Aug 13, 2023
a36f1c9
ZBC symbol, hide routes we don't want to see, fix Solana remote balan…
tkporter Aug 14, 2023
fb7da5a
Fix check if there's sufficient collateral at the dest
tkporter Aug 14, 2023
07531fd
Remove Hyperlane explorer link
jmrossy Aug 14, 2023
9aa7126
Merge pull request #44 from hyperlane-xyz/trevor/eclipse-testnet
nambrot Aug 14, 2023
1066e3f
Merge branch 'eclipse' into rossy/eclipse-fixes
nambrot Aug 14, 2023
1c4cdeb
Merge pull request #45 from hyperlane-xyz/rossy/eclipse-fixes
nambrot Aug 14, 2023
35c7246
Catch destination balance checking
nambrot Aug 14, 2023
9a63c29
Merge pull request #46 from hyperlane-xyz/nambrot/catch-destination-b…
nambrot Aug 14, 2023
3f9b6a5
Fix lint
nambrot Aug 14, 2023
8cf1808
Brand Nautilus
nambrot Aug 14, 2023
577670d
Merge pull request #47 from hyperlane-xyz/nambrot/brand-naut
nambrot Aug 14, 2023
5a6e13d
Support deposit-only mode
nambrot Aug 14, 2023
b02b4d6
Reverse direction
nambrot Aug 15, 2023
af7ddaf
Fix collateral checking to Solana; fix nautilus tx explorer url
tkporter Aug 15, 2023
322b406
mainnet
tkporter Aug 15, 2023
30f7a02
Set Rainbowkit initialChain to Proteus
jmrossy Aug 15, 2023
5e99116
Merge pull request #48 from hyperlane-xyz/nambrot/deposit-only-mode
nambrot Aug 15, 2023
db8273c
new warp route deploy
tkporter Aug 15, 2023
4ece298
Merge branch 'eclipse' into eclipse-mainnet
nambrot Aug 15, 2023
1afa6a4
Default to Nautilus
nambrot Aug 15, 2023
5f93080
Branding
nambrot Aug 15, 2023
e61eddd
Small change
nambrot Aug 15, 2023
b6f0834
Undo
nambrot Aug 15, 2023
ca305b1
Update meta
nambrot Aug 15, 2023
13e42c6
Add Nautilus chain logo
nambrot Aug 21, 2023
a5f960b
Merge branch 'main' into eclipse
jmrossy Aug 21, 2023
0ebb55f
Merge branch 'eclipse' of github.com:hyperlane-xyz/hyperlane-warp-ui-…
jmrossy Aug 21, 2023
49cda5b
Fix build error in balances
jmrossy Aug 21, 2023
1014966
Setup Jest unit testing
jmrossy Aug 22, 2023
4d4dffe
Port fixes for collateral balance checking
jmrossy Aug 22, 2023
994b7e0
Merge branch 'improved-multi-collateral' into eclipse
jmrossy Aug 22, 2023
c2bd6da
Remove balance and route hacks
jmrossy Aug 22, 2023
c9e2e1b
Remove dead const
jmrossy Aug 22, 2023
1232b9f
Merge branch 'eclipse' into eclipse-mainnet-test
jmrossy Aug 22, 2023
8b6bc70
Revert minor chains.ts change
jmrossy Aug 22, 2023
e791e29
Fix build error from merge conflict
jmrossy Aug 22, 2023
1e4cda7
Merge branch 'eclipse' into eclipse-mainnet-test
jmrossy Aug 22, 2023
41f93b4
Merge branch 'main' into eclipse
jmrossy Aug 25, 2023
5015bed
Merge branch 'eclipse' into eclipse-mainnet-test
jmrossy Aug 25, 2023
0235fc0
Update zebec token name and logo
jmrossy Aug 25, 2023
6600ac0
Merge branch 'eclipse' into eclipse-mainnet-test
jmrossy Aug 25, 2023
11acfbd
Merge branch 'main' into eclipse
jmrossy Aug 25, 2023
ce5ec5e
Merge branch 'eclipse' into eclipse-mainnet-test
jmrossy Aug 25, 2023
266742f
Remove learn more link
jmrossy Aug 28, 2023
3737166
Set default network to sol mainnet
jmrossy Aug 28, 2023
09b2d61
Merge pull request #52 from hyperlane-xyz/eclipse-mainnet-test
jmrossy Aug 28, 2023
a6eed4b
Fix bug whenever a very small amount is passed in
tkporter Sep 5, 2023
3c64770
Rm console.log
tkporter Sep 5, 2023
e1ab103
Add new warps
tkporter Sep 5, 2023
a2205f9
Merge branch 'main' into eclipse
jmrossy Sep 5, 2023
963bbc3
Merge branch 'eclipse' into eclipse-mainnet
jmrossy Sep 5, 2023
51c42d2
Merge branch 'eclipse-mainnet' into trevor/more-nautilus-warps
jmrossy Sep 5, 2023
fa2ed10
Add token logos
jmrossy Sep 5, 2023
19d52d3
Rm POSE
tkporter Sep 6, 2023
66b854f
Merge pull request #54 from hyperlane-xyz/trevor/more-nautilus-warps
tkporter Sep 6, 2023
c0f5d84
Update TipCard.tsx
nambrot Sep 7, 2023
8386af1
Merge branch 'main' into eclipse
jmrossy Sep 13, 2023
022eb47
Merge branch 'eclipse' into eclipse-mainnet
jmrossy Sep 14, 2023
80f28a2
Merge branch 'eclipse-mainnet' of github.com:hyperlane-xyz/hyperlane-…
jmrossy Sep 14, 2023
0c1489d
Merge pull request #58 from hyperlane-xyz/eclipse-mainnet-test
jmrossy Sep 14, 2023
38bb74e
Merge branch 'main' into eclipse
jmrossy Sep 15, 2023
6202caf
Merge branch 'main' of github.com:hyperlane-xyz/hyperlane-warp-ui-tem…
tkporter Sep 27, 2023
703c17c
Add warning if not enough funds
tkporter Sep 27, 2023
65c6bcb
Merge pull request #60 from hyperlane-xyz/trevor/eclipse-mainnet-no-d…
tkporter Sep 27, 2023
38c1fca
Can't change env vars on vercel atm
tkporter Sep 27, 2023
6b7ef95
Remove deposit only mode part
tkporter Sep 27, 2023
0ba8413
New POSE token
tkporter Sep 27, 2023
b8deeb8
Only wZBC on Solana
tkporter Sep 28, 2023
a2f2895
Merge branch 'main' into eclipse
jmrossy Oct 2, 2023
d6b6409
Merge remote-tracking branch 'origin' into eclipse-mainnet-test
jmrossy Oct 2, 2023
df839ed
Merge branch 'eclipse-mainnet' into eclipse-mainnet-test
jmrossy Oct 2, 2023
fa687d0
Merge pull request #63 from hyperlane-xyz/eclipse-mainnet-test
jmrossy Oct 2, 2023
f58ff19
Merge branch 'eclipse' into eclipse-mainnet
jmrossy Oct 2, 2023
87cd43c
Use token 1.5.1-beta2, which will increase the compute limit to 500k
tkporter Oct 3, 2023
4c4b1e0
Merge branch 'main' into eclipse
jmrossy Oct 3, 2023
ffbbb15
Merge branch 'eclipse' into eclipse-mainnet
jmrossy Oct 3, 2023
7276b10
Disable ledger connector
jmrossy Dec 14, 2023
2a1f74d
Update tip card text
jmrossy Jan 9, 2024
9c1660c
Merge pull request #110 from hyperlane-xyz/rossy/naut-tip-card-text
jmrossy Jan 9, 2024
07b76e8
Replace favicon
jmrossy Feb 1, 2024
5ab8c95
Merge branch 'nautilus' of github.com:hyperlane-xyz/hyperlane-warp-ui…
jmrossy Feb 1, 2024
249e4a7
twitter link from hyperlane_xyz to hyperlane
avious00 May 29, 2024
5a1625a
update rpc url
cmcewen Aug 21, 2024
e0f2b64
add warning
cmcewen Aug 29, 2024
7f3e83c
clarify language
cmcewen Aug 29, 2024
6f4743e
Add destination blacklist and update tip card text
jmrossy Aug 30, 2024
cbc1c96
Merge pull request #235 from hyperlane-xyz/rossy/nautilus-disable-in-…
cmcewen Aug 30, 2024
cde7b64
feat(warpui): Nautilus shutdown
Mo-Hussain Sep 6, 2024
9ef3d0d
Update src/pages/index.tsx
cmcewen Sep 6, 2024
45a994a
Merge pull request #239 from hyperlane-xyz/nautilus-shutdown
cmcewen Sep 10, 2024
699cfc9
Revert "feat(warpui): Nautilus shutdown"
cmcewen Oct 21, 2024
d81032d
Merge pull request #297 from hyperlane-xyz/revert-239-nautilus-shutdown
cmcewen Oct 21, 2024
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
14 changes: 1 addition & 13 deletions src/components/tip/TipCard.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import Image from 'next/image';
import { useState } from 'react';

import { IconButton } from '../../components/buttons/IconButton';
import { config } from '../../consts/config';
import { links } from '../../consts/links';
import InfoCircle from '../../images/icons/info-circle.svg';
import XCircle from '../../images/icons/x-circle.svg';

export function TipCard() {
@@ -14,19 +11,10 @@ export function TipCard() {
<div className="relative px-3 py-3 w-100 sm:w-[31rem] bg-blue-500 shadow-lg rounded opacity-95">
<h2 className="text-white sm:text-lg"> ⚠️ Nautilus Bridge is in deposit-only mode.</h2>
<div className="flex items-end justify-between">
<p className="text-white mt-1.5 text-xs sm:text-sm max-w-[70%]">
<p className="text-white mt-1.5 text-xs sm:text-sm">
Currently, you can bridge from BSC and Solana to Nautilus. Transfers originating Nautilus
are expected to go live September 1st.
</p>
<a
href={links.github}
target="_blank"
rel="noopener noreferrer"
className="ml-2 px-3 py-1.5 flex items-center bg-gray-100 hover:bg-gray-200 active:bg-gray-300 text-xs sm:text-sm text-blue-500 rounded-md transition-all"
>
<Image src={InfoCircle} width={16} alt="" />
<span className="ml-1.5">Learn More</span>
</a>
</div>
<div className="absolute right-3 top-3 invert">
<IconButton
17 changes: 16 additions & 1 deletion src/consts/chains.ts
Original file line number Diff line number Diff line change
@@ -39,7 +39,16 @@ export const chains: ChainMap<ChainMetadataWithArtifacts> = {
...solana,
rpcUrls: [
{
http: process.env.NEXT_PUBLIC_SOLANA_RPC_URL ?? 'https://api.mainnet-beta.solana.com',
http: process.env.NEXT_PUBLIC_SOLANA_RPC_URL || 'https://api.mainnet-beta.solana.com',
},
],
// TODO move up to SDK
blockExplorers: [
{
name: 'Solana Explorer',
url: 'https://explorer.solana.com',
apiUrl: 'https://explorer.solana.com',
family: ExplorerFamily.Other,
},
],
mailbox: 'Ge9atjAc3Ltu91VTbNpJDCjZ9CFxFyck4h3YBcTF9XPq',
@@ -130,3 +139,9 @@ export const chains: ChainMap<ChainMetadataWithArtifacts> = {
validatorAnnounce: '0x23ce76645EC601148fa451e751eeB75785b97A00',
},
};

export const solanaChainToClusterName = {
solana: 'mainnet-beta',
solanatestnet: 'testnet',
solanadevnet: 'devnet',
};
2 changes: 1 addition & 1 deletion src/consts/config.ts
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ interface Config {
explorerApiKeys: Record<string, string>; // Optional map of API keys for block explorer
showTipBox: boolean; // Show/Hide the blue tip box above the main form
showDisabledTokens: boolean; // Show/Hide invalid token options in the selection modal
walletConnectProjectId: string;
walletConnectProjectId: string; // Project ID provided by walletconnect
withdrawalWhitelist: string; // comma-separated list of CAIP2 domains to which transfers are supported
}

13 changes: 6 additions & 7 deletions src/consts/tokens.ts
Original file line number Diff line number Diff line change
@@ -7,34 +7,33 @@ export const tokenList: WarpTokenConfig = [
chainId: 56,
address: '0x37a56cdcD83Dce2868f721De58cB3830C44C6303',
hypCollateralAddress: '0xC27980812E2E66491FD457D488509b7E04144b98',
symbol: 'ZBC',
name: 'Zebec',
symbol: 'wZBC',
decimals: 9,
logoURI: '/logos/zebec.png',
},

// nautilus
{
type: 'native',
chainId: 22222,
hypNativeAddress: '0x4501bBE6e731A4bC5c60C03A77435b2f6d5e9Fe7',
symbol: 'ZBC',
name: 'Zebec',
symbol: 'wZBC',
decimals: 18,
logoURI: '/logos/zebec.png',
},

// solana
{
chainId: 5,
name: 'Test721',
symbol: 'TEST721',
decimals: 0,
type: 'collateral',
chainId: 1399811149,
address: 'wzbcJyhGhQDLTV1S99apZiiBdE4jmYfbw99saMMdP59',
hypCollateralAddress: 'EJqwFjvVJSAxH8Ur2PYuMfdvoJeutjmH6GkoEFQ4MdSa',
name: 'Zebec',
symbol: 'ZBC',
symbol: 'wZBC',
decimals: 9,
isSpl2022: false,
logoURI: '/logos/zebec.png',
},
];
20 changes: 11 additions & 9 deletions src/features/multiProvider.ts
Original file line number Diff line number Diff line change
@@ -46,31 +46,33 @@ class MultiProtocolProvider extends MultiProvider {
return super.tryGetSigner(chainNameOrId);
}

// TODO Add special-case handling to to SDK
override async tryGetExplorerAddressUrl(
chainNameOrId: ChainName | number,
address?: string,
): Promise<string | null> {
const url = await super.tryGetExplorerAddressUrl(chainNameOrId, address);
// TODO hacking fix for solana explorer url here
if (this.getChainName(chainNameOrId) === 'solanadevnet') {
return `${url}?cluster=devnet`;
if (!url) return null;
const metadata = this.getChainMetadata(chainNameOrId);
const chainName = metadata.name;
if (metadata.protocol === ProtocolType.Sealevel && solanaChainToClusterName[chainName]) {
return `${url}?cluster=${solanaChainToClusterName[chainName]}`;
}
return url;
}

// TODO Add special-case handling to to SDK
override tryGetExplorerTxUrl(
chainNameOrId: ChainName | number,
response: { hash: string },
): string | null {
const url = super.tryGetExplorerTxUrl(chainNameOrId, response);
if (!url) return null;

const chainName = this.getChainName(chainNameOrId);
// TODO hacking fix for solana explorer url here
if (chainName === 'solanadevnet') {
return `${url}?cluster=devnet`;
const metadata = this.getChainMetadata(chainNameOrId);
const chainName = metadata.name;
if (metadata.protocol === ProtocolType.Sealevel && solanaChainToClusterName[chainName]) {
return `${url}?cluster=${solanaChainToClusterName[chainName]}`;
} else if (chainName === 'nautilus' || chainName === 'proteustestnet') {
// TODO hacking fix for nautilus explorer url here
return url.replaceAll('/tx/', '/transaction/');
}
return url;
16 changes: 8 additions & 8 deletions src/features/tokens/adapters/AdapterFactory.ts
Original file line number Diff line number Diff line change
@@ -55,25 +55,25 @@ export class AdapterFactory {
}
}

static HypCollateralAdapterFromAddress(baseCaip19Id: Caip19Id, routerAddress: Address) {
static HypCollateralAdapterFromAddress(baseTokenCaip19Id: TokenCaip19Id, routerAddress: Address) {
return AdapterFactory.selectHypAdapter(
getCaip2FromToken(baseCaip19Id),
getChainIdFromToken(baseTokenCaip19Id),
routerAddress,
baseCaip19Id,
baseTokenCaip19Id,
EvmHypCollateralAdapter,
isNativeToken(baseCaip19Id) ? SealevelHypNativeAdapter : SealevelHypCollateralAdapter,
isNativeToken(baseTokenCaip19Id) ? SealevelHypNativeAdapter : SealevelHypCollateralAdapter,
);
}

static HypSyntheticTokenAdapterFromAddress(
baseCaip19Id: Caip19Id,
caip2Id: Caip2Id,
baseTokenCaip19Id: TokenCaip19Id,
chainCaip2Id: ChainCaip2Id,
routerAddress: Address,
) {
return AdapterFactory.selectHypAdapter(
getChainIdFromToken(baseTokenCaip19Id),
chainCaip2Id,
routerAddress,
baseCaip19Id,
baseTokenCaip19Id,
EvmHypSyntheticAdapter,
SealevelHypSyntheticAdapter,
);
3 changes: 1 addition & 2 deletions src/features/tokens/adapters/SealevelTokenAdapter.ts
Original file line number Diff line number Diff line change
@@ -364,7 +364,7 @@ export class SealevelHypNativeAdapter extends SealevelHypTokenAdapter {

// Interacts with Hyp Collateral token programs
export class SealevelHypCollateralAdapter extends SealevelHypTokenAdapter {
async getBalance(owner: Address): Promise<string> {
override async getBalance(owner: Address): Promise<string> {
// Special case where the owner is the warp route program ID.
// This is because collateral warp routes don't hold escrowed collateral
// tokens in their associated token account - instead, they hold them in
@@ -374,7 +374,6 @@ export class SealevelHypCollateralAdapter extends SealevelHypTokenAdapter {
const response = await this.connection.getTokenAccountBalance(collateralAccount);
return response.value.amount;
}

return super.getBalance(owner);
}

21 changes: 3 additions & 18 deletions src/features/tokens/balances.ts
Original file line number Diff line number Diff line change
@@ -71,27 +71,12 @@ export function useDestinationBalance(
tokenRoutes,
],
queryFn: async () => {
// NOTE: this is a hack to accommodate destination balances, specifically the case
// when the destination is a Sealevel chain and is a non-synthetic warp route.
// This only really works with the specific setup of tokens.ts.

// This searches for the route where the origin chain is destinationCaip2Id
// and the destination chain is originCaip2Id and where the origin is a base token.
const targetBaseCaip19Id = tokenRoutes[destinationCaip2Id][originCaip2Id].find((r) =>
r.baseCaip19Id.startsWith(destinationCaip2Id),
)!.baseCaip19Id;
const route = getTokenRoute(
destinationCaip2Id,
originCaip2Id,
targetBaseCaip19Id,
tokenRoutes,
);
const route = getTokenRoute(originCaip2Id, destinationCaip2Id, tokenCaip19Id, tokenRoutes);
const protocol = getProtocolType(destinationCaip2Id);
if (!route || !recipientAddress || !isValidAddress(recipientAddress, protocol)) return null;

const adapter = AdapterFactory.HypTokenAdapterFromRouteOrigin(route);
const adapter = AdapterFactory.HypTokenAdapterFromRouteDest(route);
const balance = await adapter.getBalance(recipientAddress);
return { balance, decimals: route.originDecimals };
return { balance, decimals: route.destDecimals };
},
refetchInterval: 5000,
});
8 changes: 4 additions & 4 deletions src/features/tokens/metadata.ts
Original file line number Diff line number Diff line change
@@ -23,8 +23,8 @@ export function getTokens() {
return tokens || [];
}

export function getToken(caip19Id: Caip19Id) {
return getTokens().find((t) => t.caip19Id === caip19Id);
export function getToken(tokenCaip19Id: TokenCaip19Id) {
return getTokens().find((t) => t.tokenCaip19Id === tokenCaip19Id);
}

export async function parseTokens() {
@@ -50,7 +50,7 @@ async function parseTokenConfigs(configList: WarpTokenConfig): Promise<TokenMeta
const { type, chainId, logoURI } = config;

const protocol = multiProvider.getChainMetadata(chainId).protocol || ProtocolType.Ethereum;
const caip2Id = getCaip2Id(protocol, chainId);
const chainCaip2Id = getCaip2Id(protocol, chainId);
const isNative = type == TokenType.native;
const isNft = type === TokenType.collateral && config.isNft;
const isSpl2022 = type === TokenType.collateral && config.isSpl2022;
@@ -59,7 +59,7 @@ async function parseTokenConfigs(configList: WarpTokenConfig): Promise<TokenMeta
const routerAddress =
type === TokenType.collateral ? config.hypCollateralAddress : config.hypNativeAddress;
const namespace = resolveAssetNamespace(protocol, isNative, isNft, isSpl2022);
const caip19Id = getCaip19Id(caip2Id, namespace, address);
const tokenCaip19Id = getCaip19Id(chainCaip2Id, namespace, address);

const { name, symbol, decimals } = await fetchNameAndDecimals(
config,
Loading