Skip to content

Commit

Permalink
fix: Merge branch 'main' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammeds1992 committed May 21, 2024
2 parents f5070a2 + 836e5c1 commit 8d360bc
Show file tree
Hide file tree
Showing 19 changed files with 426 additions and 111 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ const NETWORK_MAPPING: NwMappingType = {
122: 'FUSE_MAINNET',
123: 'FUSE_TESTNET',
80085: 'BERACHAIN_TESTNET',
111557560: 'CYBER_CONNECT_TESTNET',
7560: 'CYBER_CONNECT_MAINNET'
};

const injected = new InjectedConnector({
supportedChainIds: [
1, 3, 4, 11155111, 42, 137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614,
42161, 122, 123, 80085,
42161, 122, 123, 80085, 111557560, 7560
],
});

Expand Down
2 changes: 1 addition & 1 deletion packages/examples/sdk-frontend-react/src/app/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Constants = {
DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [
137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123,
80085,
80085, 111557560, 7560
],
ETH_CHAINS: [1, 11155111],
};
Expand Down
119 changes: 50 additions & 69 deletions packages/restapi/src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,75 +16,8 @@ import {
fuse,
fuseSparknet,
} from 'viem/chains';
import { defineChain } from 'viem';
import { berachainTestnet, polygonAmoy, polygonZkEvmCordona, cyberConnectMainnet, cyberConnectTestnet } from './customChains';

const polygonZkEvmCordona = defineChain({
id: 2442,
name: 'Polygon zkEVM Cardona Testnet',
network: 'polygon-zkevm-testnet',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: { http: ['https://rpc.cardona.zkevm-rpc.com/'] },
public: { http: ['https://rpc.cardona.zkevm-rpc.com/'] },
},
blockExplorers: {
default: {
name: 'Polygon zkEVM Cardona',
url: ' https://cardona-zkevm.polygonscan.com/',
},
},
testnet: true,
})

const polygonAmoy = defineChain({
id: 80002,
name: 'Polygon Amoy Testnet',
network: 'polygon-amoy',
nativeCurrency: {
decimals: 18,
name: 'MATIC',
symbol: 'MATIC',
},
rpcUrls: {
default: { http: ['https://rpc-amoy.polygon.technology/'] },
public: { http: ['https://rpc-amoy.polygon.technology/'] },
},
blockExplorers: {
default: {
name: 'Polygon Amoy',
url: 'https://www.oklink.com/amoy',
},
},
testnet: true,
});



const berachainTestnet = defineChain({
id: 80085,
name: 'Berachain Artio',
network: 'berachain-testnet',
nativeCurrency: {
decimals: 18,
name: 'BERA Token',
symbol: 'BERA',
},
rpcUrls: {
default: { http: ['https://artio.rpc.berachain.com'] },
public: { http: ['https://artio.rpc.berachain.com'] },
},
blockExplorers: {
default: {
name: 'Berachain',
url: 'https://artio.beratrail.io',
},
},
testnet: true,
});

// for methods not needing the entire config
export const API_BASE_URL = {
Expand Down Expand Up @@ -114,6 +47,8 @@ const BLOCKCHAIN_NETWORK = {
FUSE_TESTNET: 'eip155:123',
FUSE_MAINNET: 'eip155:122',
BERACHAIN_TESTNET: 'eip155:80085',
CYBER_CONNECT_TESTNET: 'eip155:111557560',
CYBER_CONNECT_MAINNET: 'eip155:7560'
};

export type ALIAS_CHAIN =
Expand All @@ -123,7 +58,8 @@ export type ALIAS_CHAIN =
| 'POLYGONZKEVM'
| 'ARBITRUMONE'
| 'FUSE'
| 'BERACHAIN';
| 'BERACHAIN'
| 'CYBERCONNECT';

export const ETH_CHAIN_ID = {
[ENV.PROD]: 1,
Expand Down Expand Up @@ -176,6 +112,12 @@ export const ALIAS_CHAIN_ID: {
[ENV.DEV]: 80085,
[ENV.LOCAL]: 80085,
},
CYBERCONNECT: {
[ENV.PROD]: 7560,
[ENV.STAGING]: 111557560,
[ENV.DEV]: 111557560,
[ENV.LOCAL]: 111557560,
}
};

export const CHAIN_ID = {
Expand Down Expand Up @@ -207,6 +149,9 @@ export const CHAIN_NAME: { [key: number]: string } = {
123: 'FUSE',
// berachain
80085: 'BERACHAIN',
// cyberconnect
7560: 'CYBER_CONNECT_MAINNET',
111557560: 'CYBER_CONNECT_TESTNET'
};
export interface ConfigType {
API_BASE_URL: string;
Expand Down Expand Up @@ -284,6 +229,10 @@ const CONFIG = {
[BLOCKCHAIN_NETWORK.FUSE_MAINNET]: {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_MAINNET]: {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xbf895df410b7fcbe093973600950ba392f7e1d8e',
},
},
[ENV.STAGING]: {
Expand Down Expand Up @@ -319,6 +268,10 @@ const CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x7b9C405e261ba671f008c20D0321f62d08C140EC',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x6e489B7af21cEb969f49A90E481274966ce9D74d',
},
},
[ENV.DEV]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -353,6 +306,10 @@ const CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550B5c92baA056Fc0F08132f49508145F',
},
},
[ENV.LOCAL]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -387,6 +344,10 @@ const CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550B5c92baA056Fc0F08132f49508145F',
},
},
};

Expand Down Expand Up @@ -459,6 +420,11 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xb3971BCef2D791bc4027BbfedFb47319A4AAaaAa',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_MAINNET]: {
NETWORK: cyberConnectMainnet,
API_BASE_URL: API_BASE_URL[ENV.PROD],
EPNS_COMMUNICATOR_CONTRACT: '0xbf895df410b7fcbe093973600950ba392f7e1d8e',
},
},
[ENV.STAGING]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -501,6 +467,11 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x7b9C405e261ba671f008c20D0321f62d08C140EC',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
NETWORK: cyberConnectTestnet,
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x6e489B7af21cEb969f49A90E481274966ce9D74d',
},
},
[ENV.DEV]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -543,6 +514,11 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.DEV],
EPNS_COMMUNICATOR_CONTRACT: '0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
NETWORK: cyberConnectTestnet,
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550B5c92baA056Fc0F08132f49508145F',
},
},
[ENV.LOCAL]: {
[BLOCKCHAIN_NETWORK.ETH_SEPOLIA]: {
Expand Down Expand Up @@ -585,6 +561,11 @@ export const VIEM_CONFIG = {
API_BASE_URL: API_BASE_URL[ENV.LOCAL],
EPNS_COMMUNICATOR_CONTRACT: '0xA1DF3E68D085aa6918bcc2506b24e499830Db0eB',
},
[BLOCKCHAIN_NETWORK.CYBER_CONNECT_TESTNET]: {
NETWORK: cyberConnectTestnet,
API_BASE_URL: API_BASE_URL[ENV.STAGING],
EPNS_COMMUNICATOR_CONTRACT: '0x9cb3bd7550B5c92baA056Fc0F08132f49508145F',
},
},
};

Expand Down
2 changes: 1 addition & 1 deletion packages/restapi/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const Constants = {
DEV_CHAIN_ID: 99999,
NON_ETH_CHAINS: [
137, 80002, 56, 97, 10, 11155420, 2442, 1101, 421614, 42161, 122, 123,
80085,
80085,111557560,7560
],
ETH_CHAINS: [1, 11155111],
ENC_TYPE_V1: 'x25519-xsalsa20-poly1305',
Expand Down
119 changes: 119 additions & 0 deletions packages/restapi/src/lib/customChains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
import { defineChain } from 'viem';

export const polygonZkEvmCordona = defineChain({
id: 2442,
name: 'Polygon zkEVM Cardona Testnet',
network: 'polygon-zkevm-testnet',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: { http: ['https://rpc.cardona.zkevm-rpc.com/'] },
public: { http: ['https://rpc.cardona.zkevm-rpc.com/'] },
},
blockExplorers: {
default: {
name: 'Polygon zkEVM Cardona',
url: ' https://cardona-zkevm.polygonscan.com/',
},
},
testnet: true,
});

export const polygonAmoy = defineChain({
id: 80002,
name: 'Polygon Amoy Testnet',
network: 'polygon-amoy',
nativeCurrency: {
decimals: 18,
name: 'MATIC',
symbol: 'MATIC',
},
rpcUrls: {
default: { http: ['https://rpc-amoy.polygon.technology/'] },
public: { http: ['https://rpc-amoy.polygon.technology/'] },
},
blockExplorers: {
default: {
name: 'Polygon Amoy',
url: 'https://www.oklink.com/amoy',
},
},
testnet: true,
});

export const berachainTestnet = defineChain({
id: 80085,
name: 'Berachain Artio',
network: 'berachain-testnet',
nativeCurrency: {
decimals: 18,
name: 'BERA Token',
symbol: 'BERA',
},
rpcUrls: {
default: { http: ['https://artio.rpc.berachain.com'] },
public: { http: ['https://artio.rpc.berachain.com'] },
},
blockExplorers: {
default: {
name: 'Berachain',
url: 'https://artio.beratrail.io',
},
},
testnet: true,
});

export const cyberConnectTestnet = defineChain({
id: 111_557_560,
name: 'Cyber Testnet',
network: 'cyberconnect-testent',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: { http: ['https://cyber-testnet.alt.technology'] },
public: { http: ['https://cyber-testnet.alt.technology'] },
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://testnet.cyberscan.co',
},
},
contracts: {
multicall3: {
address: '0xffc391F0018269d4758AEA1a144772E8FB99545E',
blockCreated: 304545,
},
},
testnet: true,
});

export const cyberConnectMainnet = defineChain({
id: 7_560,
name: 'Cyber',
network: 'cyberconnect-mainnet',
nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },
rpcUrls: {
default: {
http: ['https://cyber.alt.technology'],
},
public: {
http: ['https://cyber.alt.technology'],
},
},
blockExplorers: {
default: {
name: 'Blockscout',
url: 'https://cyberscan.co',
apiUrl: 'https://cyberscan.co/api',
},
},
contracts: {
multicall3: {
address: '0xcA11bde05977b3631167028862bE2a173976CA11',
blockCreated: 0,
},
},
});
Loading

0 comments on commit 8d360bc

Please sign in to comment.