Skip to content

Commit

Permalink
added zkSync mainnet support
Browse files Browse the repository at this point in the history
  • Loading branch information
sepehr2github committed Jun 25, 2024
1 parent 749494d commit 15c7d7c
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 78 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"dependencies": {
"@apollo/client": "^3.5.8",
"@aragon/ods": "^1.0.20",
"@aragon/osx-commons-configs": "^0.5.0",
"@aragon/sdk-client": "^1.24.0",
"@aragon/sdk-client-common": "^1.16.0",
"@aragon/osx-commons-configs": "^0.6.0",
"@aragon/sdk-client": "^1.25.0",
"@aragon/sdk-client-common": "^1.17.0",
"@playwright/test": "^1.42.1",
"@radix-ui/react-accordion": "^1.1.2",
"@radix-ui/react-dialog": "^1.0.4",
Expand Down
6 changes: 3 additions & 3 deletions src/containers/selectChainForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ type SelectableNetworks = Record<

const networks: SelectableNetworks = {
main: {
cost: ['polygon', 'base', 'arbitrum', 'ethereum'],
popularity: ['ethereum', 'polygon', 'arbitrum', 'base'],
security: ['ethereum', 'base', 'arbitrum', 'polygon'],
cost: ['polygon', 'zksync', 'base', 'arbitrum', 'ethereum'],
popularity: ['ethereum', 'zksync', 'polygon', 'arbitrum', 'base'],
security: ['ethereum', 'zksync', 'base', 'arbitrum', 'polygon'],
},
test: {
cost: ['sepolia', 'zksyncSepolia'],
Expand Down
3 changes: 2 additions & 1 deletion src/hooks/useDaoMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ export const useDaoMembers = (
const covalentSupportedNetwork = !(
network === 'arbitrum' ||
network === 'base' ||
network === 'zksyncSepolia'
network === 'zksyncSepolia' ||
network === 'zksync'
);

const useGraphql =
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const useWallet = (): IUseWallet => {

const provider = useMemo(
() =>
['mumbai', 'polygon'].includes(network)
['mumbai', 'polygon', 'zkSepolia'].includes(network)
? aragonGateway.getRpcProvider(network)
: signer?.provider,
[network, signer?.provider]
Expand Down
2 changes: 2 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
polygon,
sepolia,
zkSyncSepoliaTestnet,
zkSync,
} from 'wagmi/chains';
import {AlertProvider} from 'context/alert';
import {GlobalModalsProvider} from 'context/globalModals';
Expand Down Expand Up @@ -47,6 +48,7 @@ const chains = [
arbitrum,
sepolia,
zkSyncSepoliaTestnet,
zkSync,
] as [Chain, ...Chain[]];

const transports = chains.reduce(
Expand Down
8 changes: 6 additions & 2 deletions src/utils/aragonGateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class AragonGateway {
): JsonRpcProvider => {
let network = this.parseNetwork(chainIdOrNetwork);

console.log('chainIdOrNetwork', chainIdOrNetwork);

// Default provider to ethereum for unsupported networks
if (network == null || network === 'unsupported') {
network = 'ethereum';
Expand All @@ -40,6 +42,8 @@ class AragonGateway {
getLatestNetworkDeployment(sdkNetwork)?.ENSRegistry?.address;
}

console.log('viewview', options);

const rpcUrl = this.buildRpcUrl(network)!;
return new JsonRpcProvider(rpcUrl, options);
};
Expand All @@ -55,12 +59,12 @@ class AragonGateway {

const {gatewayNetwork} = CHAIN_METADATA[network];
const gatewayKey =
network === 'zksyncSepolia'
network === 'zksyncSepolia' || network === 'zksync'
? import.meta.env.VITE_GATEWAY_RPC_API_KEY_ALCHEMY
: import.meta.env.VITE_GATEWAY_RPC_API_KEY;

const baseUrl =
network === 'zksyncSepolia'
network === 'zksyncSepolia' || network === 'zksync'
? this.baseUrl.replace('app', 'alchemy')
: this.baseUrl;

Expand Down
2 changes: 2 additions & 0 deletions src/utils/constants/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const SUBGRAPH_API_URL: SubgraphNetworkUrl = {
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-polygon/version/1.4.2/api',
sepolia:
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-sepolia/version/1.4.2/api',
zksync:
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-zksync-era/version/1.4.3/api',
zksyncSepolia:
'https://subgraph.satsuma-prod.com/qHR2wGfc5RLi6/aragon/osx-zksync-era-sepolia/version/1.4.2/api',
unsupported: undefined,
Expand Down
50 changes: 25 additions & 25 deletions src/utils/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const NETWORKS_WITH_CUSTOM_REGISTRY: SupportedNetworks[] = [
'base',
'polygon',
'sepolia',
// 'zksync',
'zksync',
'zksyncSepolia',
];

Expand All @@ -35,7 +35,7 @@ const SUPPORTED_NETWORKS = [
'ethereum',
'polygon',
'sepolia',
// 'zksync',
'zksync',
'zksyncSepolia',
] as const;

Expand Down Expand Up @@ -234,29 +234,29 @@ export const CHAIN_METADATA: Record<SupportedNetworks, ChainData> = {
},
supportsEns: false,
},
// zksync: {
// id: 324,
// name: i18n.t('explore.modal.filterDAOs.label.zksync'),
// domain: 'L2 Blockchain',
// logo: 'https://static.debank.com/image/chain/logo_url/era/2cfcd0c8436b05d811b03935f6c1d7da.png',
// explorer: 'https://explorer.zksync.io/',
// isTestnet: false,
// explorerName: 'zkSync Explorer',
// publicRpc: 'https://zksync.meowrpc.com',
// gatewayNetwork: 'ethereum/zksync',
// nativeCurrency: {
// name: 'Ether',
// symbol: 'ETH',
// decimals: 18,
// },
// etherscanApi: 'https://block-explorer-api.mainnet.zksync.io/api',
// etherscanApiKey: '',
// covalent: {
// networkId: 'zksync-mainnet',
// nativeTokenId: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
// },
// supportsEns: false,
// },
zksync: {
id: 324,
name: i18n.t('explore.modal.filterDAOs.label.zksync'),
domain: 'L2 Blockchain',
logo: 'https://static.debank.com/image/chain/logo_url/era/2cfcd0c8436b05d811b03935f6c1d7da.png',
explorer: 'https://explorer.zksync.io/',
isTestnet: false,
explorerName: 'zkSync Explorer',
publicRpc: 'https://zksync.meowrpc.com',
gatewayNetwork: 'zksync',
nativeCurrency: {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
},
etherscanApi: 'https://block-explorer-api.mainnet.zksync.io/api',
etherscanApiKey: '',
covalent: {
networkId: 'zksync-mainnet',
nativeTokenId: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
},
supportsEns: false,
},
zksyncSepolia: {
id: 300,
name: i18n.t('explore.modal.filterDAOs.label.zksyncSepolia'),
Expand Down
4 changes: 4 additions & 0 deletions src/utils/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@ export const translateToAppNetwork = (
return 'sepolia';
case SdkSupportedNetworks.ZKSYNC_SEPOLIA:
return 'zksyncSepolia';
case SdkSupportedNetworks.ZKSYNC_MAINNET:
return 'zksync';
default:
return 'unsupported';
}
Expand Down Expand Up @@ -901,6 +903,8 @@ export function translateToNetworkishName(
return SdkSupportedNetworks.SEPOLIA;
case 'zksyncSepolia':
return SdkSupportedNetworks.ZKSYNC_SEPOLIA;
case 'zksync':
return SdkSupportedNetworks.ZKSYNC_MAINNET;
}

return 'unsupported';
Expand Down
61 changes: 18 additions & 43 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,10 @@
dependencies:
tslib "^2.6.2"

"@aragon/osx-commons-configs@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@aragon/osx-commons-configs/-/osx-commons-configs-0.5.0.tgz#4c9006d61dbec8f13af5f5110f2d84ab00986ded"
integrity sha512-1ylzs0sbb9sOSisQc01IOXdC7rVhxuRD64GRtwE5KUCq8nyzQ1jk+yXscYh3Uw+B6B8DLKeLN9xFquR7y1grZA==
"@aragon/osx-commons-configs@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@aragon/osx-commons-configs/-/osx-commons-configs-0.6.0.tgz#8c1198e0d2d8cdf8b021ae4709a79955a936ab70"
integrity sha512-wypaD0epzD+IY0GmgvYlYgJzJuvxkFW+L0nH6e1tzA1jsvgnxfln0Tk4q86xBp6sfuoybh5atKziQyXbRGLHKA==
dependencies:
tslib "^2.6.2"

Expand Down Expand Up @@ -132,12 +132,12 @@
graphql-request "^4.3.0"
yup "^1.2.0"

"@aragon/sdk-client-common@^1.16.0":
version "1.16.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client-common/-/sdk-client-common-1.16.0.tgz#7d1ee5a8d68f3ddf5394773c5cf2161d048c5a95"
integrity sha512-ELWO7+8PrjZ6yqW1rEqFlDljp6G04aAji1pPTEp+MU9a+TMWZno2yQgvGCT492IK1EMSQATblEczVZ7PkP04rQ==
"@aragon/sdk-client-common@^1.17.0":
version "1.17.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client-common/-/sdk-client-common-1.17.0.tgz#0709ef8f368a17a172d8899b78c557c570571758"
integrity sha512-YZkIyI3LSyQ/Z9iV1O8gdMGHUuM36Vt6Gsc7cSurnhCE+csV1Boir4pseV+0HJStO12/e6a4EW9x1i625TY+iA==
dependencies:
"@aragon/osx-commons-configs" "^0.5.0"
"@aragon/osx-commons-configs" "^0.6.0"
"@aragon/osx-ethers" "^1.3.1"
"@aragon/osx-ethers-v1.0.0" "npm:@aragon/osx-ethers@1.2.1"
"@aragon/sdk-ipfs" "^1.1.0"
Expand Down Expand Up @@ -171,14 +171,14 @@
graphql-request "^4.3.0"
yup "^1.2.0"

"@aragon/sdk-client@^1.24.0":
version "1.24.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client/-/sdk-client-1.24.0.tgz#a2312d47354ee390d099f829dd5df94bc92aede9"
integrity sha512-U99kX4+PM2TPQJ+OfZ08jN5EhcXZzgwMr9wQYmAexOTnjSE9ec1TvmkydBfDAuHGW8eNyNzJIu5Uze8gqXw6Ug==
"@aragon/sdk-client@^1.25.0":
version "1.25.0"
resolved "https://registry.yarnpkg.com/@aragon/sdk-client/-/sdk-client-1.25.0.tgz#1287b7df9d2aaea2d5b57b345f0f291c8a974a8e"
integrity sha512-lQfAHxYMOZT5Q2z4zYASXfIyOelChOvnWUY2/AzdeYSEcqTz6keGozTPXof2CZX8M2T8li+zl929VI+6NYV1/Q==
dependencies:
"@aragon/osx-commons-configs" "^0.5.0"
"@aragon/osx-commons-configs" "^0.6.0"
"@aragon/osx-ethers" "1.3.0"
"@aragon/sdk-client-common" "^1.16.0"
"@aragon/sdk-client-common" "^1.17.0"
"@aragon/sdk-ipfs" "^1.1.0"
"@ethersproject/abstract-signer" "^5.5.0"
"@ethersproject/bignumber" "^5.6.0"
Expand Down Expand Up @@ -10911,16 +10911,7 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
dependencies:
emoji-regex "^8.0.0"
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"

string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand Down Expand Up @@ -10991,14 +10982,7 @@ string_decoder@~1.1.1:
dependencies:
safe-buffer "~5.1.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -11910,7 +11894,7 @@ which@^2.0.1, which@^2.0.2:
dependencies:
isexe "^2.0.0"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand All @@ -11928,15 +11912,6 @@ wrap-ansi@^6.2.0:
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^8.1.0:
version "8.1.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"
Expand Down

0 comments on commit 15c7d7c

Please sign in to comment.