Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
add etherlink
Browse files Browse the repository at this point in the history
  • Loading branch information
hcote committed Apr 4, 2024
1 parent a4ef8a4 commit 4c172d5
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 5 deletions.
3 changes: 2 additions & 1 deletion core/utils/templateMappings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ export const buildTemplate = async (appConfig: ConfigType): Promise<ConfigType>
config.network === 'ethereum' ||
config.network === 'ethereum-sepolia' ||
config.network === 'polygon' ||
config.network === 'polygon-amoy'
config.network === 'polygon-amoy' ||
config.network === 'etherlink-testnet'
) {
config.chain = 'evm';
} else if (config.network === 'solana-devnet' || config.network === 'solana-mainnet') {
Expand Down
13 changes: 13 additions & 0 deletions scaffolds/nextjs-dedicated-wallet/template/src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum Network {
POLYGON = 'polygon',
ETHEREUM_SEPOLIA = 'ethereum-sepolia',
ETHEREUM = 'ethereum',
ETHERLINK_TESTNET = 'etherlink-testnet',
}

export const getNetworkUrl = () => {
Expand All @@ -15,6 +16,8 @@ export const getNetworkUrl = () => {
return 'https://eth-sepolia.g.alchemy.com/v2/fYFybLQFR9Zr2GCRcgALmAktStFKr0i0';
case Network.ETHEREUM:
return 'https://eth-mainnet.g.alchemy.com/v2/fYFybLQFR9Zr2GCRcgALmAktStFKr0i0';
case Network.ETHERLINK_TESTNET:
return 'https://node.ghostnet.etherlink.com';
default:
throw new Error('Network not supported');
}
Expand All @@ -30,6 +33,8 @@ export const getChainId = () => {
return 11155111;
case Network.ETHEREUM:
return 1;
case Network.ETHERLINK_TESTNET:
return 128123;
}
};

Expand All @@ -41,6 +46,8 @@ export const getNetworkToken = () => {
case Network.ETHEREUM:
case Network.ETHEREUM_SEPOLIA:
return 'ETH';
case Network.ETHERLINK_TESTNET:
return 'XTZ';
}
};

Expand All @@ -50,6 +57,8 @@ export const getFaucetUrl = () => {
return 'https://faucet.polygon.technology/';
case Network.ETHEREUM_SEPOLIA:
return 'https://sepoliafaucet.com/';
case Network.ETHERLINK_TESTNET:
return 'https://faucet.etherlink.com/';
}
};

Expand All @@ -63,6 +72,8 @@ export const getNetworkName = () => {
return 'Ethereum (Sepolia)';
case Network.ETHEREUM:
return 'Ethereum (Mainnet)';
case Network.ETHERLINK_TESTNET:
return 'Etherlink (Testnet)';
}
};

Expand All @@ -76,5 +87,7 @@ export const getBlockExplorer = (address: string) => {
return `https://etherscan.io/address/${address}`;
case Network.ETHEREUM_SEPOLIA:
return `https://sepolia.etherscan.io/address/${address}`;
case Network.ETHERLINK_TESTNET:
return `https://testnet-explorer.etherlink.com//address/${address}`;
}
};
20 changes: 17 additions & 3 deletions scaffolds/nextjs-universal-wallet/template/src/utils/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export enum Network {
POLYGON = 'polygon',
ETHEREUM_SEPOLIA = 'ethereum-sepolia',
ETHEREUM = 'ethereum',
ETHERLINK_TESTNET = 'etherlink-testnet',
}

export const getNetworkUrl = () => {
Expand All @@ -15,6 +16,9 @@ export const getNetworkUrl = () => {
return 'https://eth-sepolia.g.alchemy.com/v2/3jKhhva6zBqwp_dnwPlF4d0rFZhu2pjD';
case Network.ETHEREUM:
return 'https://eth-mainnet.g.alchemy.com/v2/3jKhhva6zBqwp_dnwPlF4d0rFZhu2pjD';
case Network.ETHERLINK_TESTNET:
return 'https://node.ghostnet.etherlink.com';

default:
throw new Error('Network not supported');
}
Expand All @@ -25,11 +29,13 @@ export const getChainId = () => {
case Network.POLYGON:
return 137;
case Network.POLYGON_AMOY:
return 80001;
return 80002;
case Network.ETHEREUM_SEPOLIA:
return 1155111;
return 11155111;
case Network.ETHEREUM:
return 1;
case Network.ETHERLINK_TESTNET:
return 128123;
}
};

Expand All @@ -41,6 +47,8 @@ export const getNetworkToken = () => {
case Network.ETHEREUM:
case Network.ETHEREUM_SEPOLIA:
return 'ETH';
case Network.ETHERLINK_TESTNET:
return 'XTZ';
}
};

Expand All @@ -50,6 +58,8 @@ export const getFaucetUrl = () => {
return 'https://faucet.polygon.technology/';
case Network.ETHEREUM_SEPOLIA:
return 'https://sepoliafaucet.com/';
case Network.ETHERLINK_TESTNET:
return 'https://faucet.etherlink.com/';
}
};

Expand All @@ -58,11 +68,13 @@ export const getNetworkName = () => {
case Network.POLYGON:
return 'Polygon (Mainnet)';
case Network.POLYGON_AMOY:
return 'Polygon (Mumbai)';
return 'Polygon (Amoy)';
case Network.ETHEREUM_SEPOLIA:
return 'Ethereum (Sepolia)';
case Network.ETHEREUM:
return 'Ethereum (Mainnet)';
case Network.ETHERLINK_TESTNET:
return 'Etherlink (Testnet)';
}
};

Expand All @@ -76,5 +88,7 @@ export const getBlockExplorer = (address: string) => {
return `https://etherscan.io/address/${address}`;
case Network.ETHEREUM_SEPOLIA:
return `https://sepolia.etherscan.io/address/${address}`;
case Network.ETHERLINK_TESTNET:
return `https://testnet-explorer.etherlink.com//address/${address}`;
}
};
3 changes: 2 additions & 1 deletion scaffolds/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export namespace BlockchainNetworkPrompt {
name: 'chain',
message: 'Which blockchain do you want to use?',
choices: [
{ name: 'evm', message: 'EVM (Ethereum, Polygon, etc.)' },
{ name: 'evm', message: 'EVM (Ethereum, Etherlink, Polygon, etc.)' },
{ name: 'solana', message: 'Solana' },
{ name: 'flow', message: 'Flow' },
],
Expand Down Expand Up @@ -173,6 +173,7 @@ export namespace BlockchainNetworkPrompt {
choices: [
{ name: 'ethereum', message: 'Ethereum (Mainnet)' },
{ name: 'ethereum-sepolia', message: 'Ethereum (Sepolia Testnet)' },
{ name: 'etherlink-testnet', message: 'Etherlink (Testnet)' },
{ name: 'polygon', message: 'Polygon (Mainnet)' },
{ name: 'polygon-amoy', message: 'Polygon (Amoy Testnet)' },
],
Expand Down

0 comments on commit 4c172d5

Please sign in to comment.