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

Commit

Permalink
Merge branch 'master' into hcote-add-etherlink
Browse files Browse the repository at this point in the history
  • Loading branch information
hcote committed Apr 4, 2024
2 parents 4c172d5 + 657709f commit c263453
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# v4.12.0 (Mon Mar 11 2024)

#### 🚀 Enhancement

- Adds zkSync support

#### Authors: 2

- James ([@jamesrp13](https://github.com/jamesrp13))
- pbillingsby ([@PBillingsby](https://github.com/PBillingsby))

# v4.4.2 (Wed Sep 27 2023)

#### 🚀 Enhancement
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "make-magic",
"version": "4.4.2",
"version": "4.12.0",
"description": "A tool for quickly scaffolding an app with Magic authentication baked-in!",
"repository": "magiclabs/create-magic-app",
"license": "MIT",
Expand Down
22 changes: 22 additions & 0 deletions scaffolds/nextjs-dedicated-wallet/template/src/utils/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export enum Network {
ETHEREUM_SEPOLIA = 'ethereum-sepolia',
ETHEREUM = 'ethereum',
ETHERLINK_TESTNET = 'etherlink-testnet',
ZKSYNC = 'zksync',
ZKSYNC_SEPOLIA = 'zksync-sepolia',
}

export const getNetworkUrl = () => {
Expand All @@ -18,6 +20,10 @@ export const getNetworkUrl = () => {
return 'https://eth-mainnet.g.alchemy.com/v2/fYFybLQFR9Zr2GCRcgALmAktStFKr0i0';
case Network.ETHERLINK_TESTNET:
return 'https://node.ghostnet.etherlink.com';
case Network.ZKSYNC:
return 'https://mainnet.era.zksync.io';
case Network.ZKSYNC_SEPOLIA:
return 'https://sepolia.era.zksync.dev';
default:
throw new Error('Network not supported');
}
Expand All @@ -31,6 +37,10 @@ export const getChainId = () => {
return 80002;
case Network.ETHEREUM_SEPOLIA:
return 11155111;
case Network.ZKSYNC:
return 324;
case Network.ZKSYNC_SEPOLIA:
return 300;
case Network.ETHEREUM:
return 1;
case Network.ETHERLINK_TESTNET:
Expand All @@ -45,6 +55,8 @@ export const getNetworkToken = () => {
return 'MATIC';
case Network.ETHEREUM:
case Network.ETHEREUM_SEPOLIA:
case Network.ZKSYNC:
case Network.ZKSYNC_SEPOLIA:
return 'ETH';
case Network.ETHERLINK_TESTNET:
return 'XTZ';
Expand All @@ -59,6 +71,8 @@ export const getFaucetUrl = () => {
return 'https://sepoliafaucet.com/';
case Network.ETHERLINK_TESTNET:
return 'https://faucet.etherlink.com/';
case Network.ZKSYNC_SEPOLIA:
return 'https://faucet.quicknode.com/ethereum/sepolia';
}
};

Expand All @@ -74,6 +88,10 @@ export const getNetworkName = () => {
return 'Ethereum (Mainnet)';
case Network.ETHERLINK_TESTNET:
return 'Etherlink (Testnet)';
case Network.ZKSYNC:
return 'zkSync (Mainnet)';
case Network.ZKSYNC_SEPOLIA:
return 'zkSync (Sepolia)';
}
};

Expand All @@ -89,5 +107,9 @@ export const getBlockExplorer = (address: string) => {
return `https://sepolia.etherscan.io/address/${address}`;
case Network.ETHERLINK_TESTNET:
return `https://testnet-explorer.etherlink.com//address/${address}`;
case Network.ZKSYNC:
return `https://explorer.zksync.io/address/${address}`;
case Network.ZKSYNC_SEPOLIA:
return `https://sepolia.explorer.zksync.io/address/${address}`;
}
};
23 changes: 22 additions & 1 deletion scaffolds/nextjs-universal-wallet/template/src/utils/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export enum Network {
ETHEREUM_SEPOLIA = 'ethereum-sepolia',
ETHEREUM = 'ethereum',
ETHERLINK_TESTNET = 'etherlink-testnet',
ZKSYNC = 'zksync',
ZKSYNC_SEPOLIA = 'zksync-sepolia',
}

export const getNetworkUrl = () => {
Expand All @@ -18,7 +20,10 @@ export const getNetworkUrl = () => {
return 'https://eth-mainnet.g.alchemy.com/v2/3jKhhva6zBqwp_dnwPlF4d0rFZhu2pjD';
case Network.ETHERLINK_TESTNET:
return 'https://node.ghostnet.etherlink.com';

case Network.ZKSYNC:
return 'https://mainnet.era.zksync.io';
case Network.ZKSYNC_SEPOLIA:
return 'https://sepolia.era.zksync.dev';
default:
throw new Error('Network not supported');
}
Expand All @@ -32,6 +37,10 @@ export const getChainId = () => {
return 80002;
case Network.ETHEREUM_SEPOLIA:
return 11155111;
case Network.ZKSYNC:
return 324;
case Network.ZKSYNC_SEPOLIA:
return 300;
case Network.ETHEREUM:
return 1;
case Network.ETHERLINK_TESTNET:
Expand All @@ -46,6 +55,8 @@ export const getNetworkToken = () => {
return 'MATIC';
case Network.ETHEREUM:
case Network.ETHEREUM_SEPOLIA:
case Network.ZKSYNC:
case Network.ZKSYNC_SEPOLIA:
return 'ETH';
case Network.ETHERLINK_TESTNET:
return 'XTZ';
Expand All @@ -60,6 +71,8 @@ export const getFaucetUrl = () => {
return 'https://sepoliafaucet.com/';
case Network.ETHERLINK_TESTNET:
return 'https://faucet.etherlink.com/';
case Network.ZKSYNC_SEPOLIA:
return 'https://faucet.quicknode.com/ethereum/sepolia';
}
};

Expand All @@ -75,6 +88,10 @@ export const getNetworkName = () => {
return 'Ethereum (Mainnet)';
case Network.ETHERLINK_TESTNET:
return 'Etherlink (Testnet)';
case Network.ZKSYNC:
return 'zkSync (Mainnet)';
case Network.ZKSYNC_SEPOLIA:
return 'zkSync (Sepolia)';
}
};

Expand All @@ -90,5 +107,9 @@ export const getBlockExplorer = (address: string) => {
return `https://sepolia.etherscan.io/address/${address}`;
case Network.ETHERLINK_TESTNET:
return `https://testnet-explorer.etherlink.com//address/${address}`;
case Network.ZKSYNC:
return `https://explorer.zksync.io/address/${address}`;
case Network.ZKSYNC_SEPOLIA:
return `https://sepolia.explorer.zksync.io/address/${address}`;
}
};
2 changes: 2 additions & 0 deletions scaffolds/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ export namespace BlockchainNetworkPrompt {
{ name: 'etherlink-testnet', message: 'Etherlink (Testnet)' },
{ name: 'polygon', message: 'Polygon (Mainnet)' },
{ name: 'polygon-amoy', message: 'Polygon (Amoy Testnet)' },
{ name: 'zksync', message: 'zkSync (Mainnet)' },
{ name: 'zksync-sepolia', message: 'zkSync (Sepolia Testnet)' },
],
}).run();

Expand Down

0 comments on commit c263453

Please sign in to comment.