Skip to content

Commit

Permalink
Add real
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Jul 25, 2024
1 parent bb3de85 commit d8beac1
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ In case you want to contribute, please follow next steps:
- update the addressbook version: `npx ncu --upgrade blockchain-addressbook`
- update the viem version: `npx ncu --upgrade viem`
- install the new addressbook: `yarn`
- Fix TS errors `yarn test:ts`
- apply migrations (only needed locally, migrations are applied on deploy): `yarn db:migrate`
- create an explorer api key (important to verify the lens contract later on)
- add the rpc url, explorer url and api key in `.env`
- Fix TS errors `yarn test:ts`
- inspect the final chain config: `LOG_LEVEL=error yarn --silent ts-node ./src/script/inspect/config.ts -c <chain>`
- test the api is working: `LOG_LEVEL=trace yarn --silent ts-node ./src/script/inspect/api.ts -c <chain> -h 0 > api.log`
- test we can get a contract balance: `LOG_LEVEL=trace yarn ts-node ./src/script/inspect/balance.ts -c <chain> -a <some address> > balance.log`
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
"@openzeppelin/contracts": "^4.9.3",
"async-lock": "^1.4.0",
"axios": "^1.5.0",
"blockchain-addressbook": "^0.46.162",
"blockchain-addressbook": "^0.46.205",
"dotenv": "^16.3.1",
"lodash": "^4.17.21",
"pg": "^8.11.3",
"pg-connection-string": "^2.6.2",
"pg-format": "^1.0.4",
"pino": "^8.15.1",
"table": "^6.8.1",
"viem": "^2.16.1",
"viem": "^2.18.1",
"yaml": "^2.3.2",
"yargs": "^17.7.2"
},
Expand Down
30 changes: 30 additions & 0 deletions src/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,30 @@ export const RPC_CONFIG: Record<Chain, RpcConfig> = {
maxAmountOfNativeWei: bigintMultiplyFloat(ONE_ETHER, 5.0),
},
},
real: {
...defaultConfig,
url: RPC_FORCE_URL || process.env.REAL_RPC_URL || 'https://real.drpc.org',

transaction: {
...defaultTransactionConfig,
type: 'legacy',
maxNativePerTransactionWei: bigintMultiplyFloat(ONE_ETHER, 0.01),
},
harvest: {
...defaultHarvestConfig,
setTransactionGasLimit: false,
},
unwrap: {
...defaultUnwrapConfig,
minAmountOfWNativeWei: bigintMultiplyFloat(ONE_ETHER, 0.00005),
maxAmountOfNativeWei: bigintMultiplyFloat(ONE_ETHER, 0.0001),
setTransactionGasLimit: false,
},
revenueBridgeHarvest: {
...defaultRevenueBridgeHarvestConfig,
setTransactionGasLimit: false,
},
},
scroll: {
...defaultConfig,
url: RPC_FORCE_URL || process.env.SCROLL_RPC_URL || 'https://rpc.scroll.io',
Expand Down Expand Up @@ -990,6 +1014,12 @@ export const EXPLORER_CONFIG: Record<Chain, ExplorerConfig> = {
apiKey: process.env.POLYGON_EXPLORER_API_KEY || '',
type: 'etherscan',
},
real: {
addressLinkTemplate: 'https://explorer.re.al//address/${address}',
transactionLinkTemplate: 'https://explorer.re.al//tx/${hash}',
apiUrl: process.env.REAL_EXPLORER_API_URL || 'https://explorer.re.al/api?',
type: 'blockscout',
},
scroll: {
addressLinkTemplate: 'https://scrollscan.com/address/${address}',
transactionLinkTemplate: 'https://scrollscan.com/tx/${hash}',
Expand Down
2 changes: 2 additions & 0 deletions src/lib/rpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
optimism,
polygon,
polygonZkEvm,
real,
scroll,
zkSync,
} from 'viem/chains';
Expand Down Expand Up @@ -80,6 +81,7 @@ const VIEM_CHAINS: Record<Chain, ViemChain | null> = {
one: applyConfig('one', harmonyOne),
optimism: applyConfig('optimism', optimism),
polygon: applyConfig('polygon', polygon),
real: applyConfig('real', real),
scroll: applyConfig('scroll', scroll),
zkevm: applyConfig('zkevm', polygonZkEvm),
zksync: applyConfig('zksync', zkSync),
Expand Down
142 changes: 88 additions & 54 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -628,17 +628,24 @@
"@jridgewell/resolve-uri" "^3.1.0"
"@jridgewell/sourcemap-codec" "^1.4.14"

"@noble/curves@1.2.0", "@noble/curves@~1.2.0":
version "1.2.0"
resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz"
integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==
"@noble/curves@1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6"
integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg==
dependencies:
"@noble/hashes" "1.3.2"
"@noble/hashes" "1.4.0"

"@noble/[email protected]", "@noble/hashes@~1.3.0", "@noble/hashes@~1.3.2":
version "1.3.2"
resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz"
integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==
"@noble/curves@^1.4.0", "@noble/curves@~1.4.0":
version "1.4.2"
resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9"
integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw==
dependencies:
"@noble/hashes" "1.4.0"

"@noble/[email protected]", "@noble/hashes@^1.4.0", "@noble/hashes@~1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426"
integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==

"@nodelib/[email protected]":
version "2.1.5"
Expand Down Expand Up @@ -744,32 +751,27 @@
"@pnpm/network.ca-file" "^1.0.1"
config-chain "^1.1.11"

"@scure/base@~1.1.0":
version "1.1.1"
resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz"
integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==

"@scure/base@~1.1.2":
version "1.1.3"
resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz"
integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==
"@scure/base@~1.1.6":
version "1.1.7"
resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.7.tgz#fe973311a5c6267846aa131bc72e96c5d40d2b30"
integrity sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==

"@scure/bip32@1.3.2":
version "1.3.2"
resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz"
integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==
"@scure/bip32@1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67"
integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg==
dependencies:
"@noble/curves" "~1.2.0"
"@noble/hashes" "~1.3.2"
"@scure/base" "~1.1.2"
"@noble/curves" "~1.4.0"
"@noble/hashes" "~1.4.0"
"@scure/base" "~1.1.6"

"@scure/bip39@1.2.1":
version "1.2.1"
resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz"
integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==
"@scure/bip39@1.3.0":
version "1.3.0"
resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3"
integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ==
dependencies:
"@noble/hashes" "~1.3.0"
"@scure/base" "~1.1.0"
"@noble/hashes" "~1.4.0"
"@scure/base" "~1.1.6"

"@sigstore/bundle@^1.0.0":
version "1.0.0"
Expand Down Expand Up @@ -947,7 +949,7 @@
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.198.tgz"
integrity sha512-trNJ/vtMZYMLhfN45uLq4ShQSw0/S7xCTLLVM+WM1rmFpba/VS42jVUgaO3w/NOLiWR/09lnYk0yMaA/atdIsg==

"@types/node@*", "@types/node@^20.6.0", "@types/node@^20.9.0":
"@types/node@*", "@types/node@^20.6.0":
version "20.14.8"
resolved "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz"
integrity sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==
Expand Down Expand Up @@ -990,10 +992,10 @@ abbrev@^1.0.0:
resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz"
integrity sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==

[email protected].4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.4.tgz#a817ff44860e8a84e9a37ed22aa9b738dbb51dba"
integrity sha512-UivtYZOGJGE8rsrM/N5vdRkUpqEZVmuTumfTuolm7m/6O09wprd958rx8kUBwVAAAhQDveGAgD0GJdBuR8s6tw==
[email protected].5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.5.tgz#29d0daa3eea867ca90f7e4123144c1d1270774b6"
integrity sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==

abort-controller@^3.0.0:
version "3.0.0"
Expand Down Expand Up @@ -1241,12 +1243,10 @@ base64-js@^1.3.1:
resolved "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz"
integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==

blockchain-addressbook@^0.46.162:
version "0.46.162"
resolved "https://registry.yarnpkg.com/blockchain-addressbook/-/blockchain-addressbook-0.46.162.tgz#1508c8de4038878383213756d7fc532fb799bfae"
integrity sha512-+B/uB1/hE77aJ92o6ZDEnFDBKcU0ZjY0YutPvCM4sRsnEsMQIWs9An5PK1WqQ/RvnN/n2xQrMJ81ALSMH8Zo7w==
dependencies:
"@types/node" "^20.9.0"
blockchain-addressbook@^0.46.205:
version "0.46.205"
resolved "https://registry.yarnpkg.com/blockchain-addressbook/-/blockchain-addressbook-0.46.205.tgz#9adf792afb5421aec9764844e00da72f01835a4d"
integrity sha512-WQSKKiQicVuDq271B2aKyM7JDM6zs4AMvj+IOA+43aWbhWIvT2yZVC1stHFIquQXpHHctYk4Eg6ltFa0Fs7HAQ==

boxen@^7.0.0:
version "7.1.1"
Expand Down Expand Up @@ -4334,7 +4334,16 @@ string-length@^4.0.1:
char-regex "^1.0.2"
strip-ansi "^6.0.0"

"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
"string-width-cjs@npm:string-width@^4.2.0":
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
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@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
Expand All @@ -4359,7 +4368,14 @@ string_decoder@^1.1.1, string_decoder@^1.3.0:
dependencies:
safe-buffer "~5.2.0"

"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
dependencies:
ansi-regex "^5.0.1"

strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
Expand Down Expand Up @@ -4682,18 +4698,19 @@ validate-npm-package-name@^5.0.0:
dependencies:
builtins "^5.0.0"

viem@^2.16.1:
version "2.16.1"
resolved "https://registry.yarnpkg.com/viem/-/viem-2.16.1.tgz#6be85ab69e2948d878d7b42f5d0e22333a8f6b33"
integrity sha512-rmgXcxif740m2ARqPFoiXRHkljXhsruCZgRXf6XuS6n+Lymy7X2ma5vuzBw3mDKiA2BmxjbyJC4Wxi7kaIwHhw==
viem@^2.18.1:
version "2.18.1"
resolved "https://registry.yarnpkg.com/viem/-/viem-2.18.1.tgz#91fcd5c3021d220d7c95312d0b3c35c94dc95963"
integrity sha512-QWeIZjai9IqRVd1DxXhDZ77OcXuRJX+fRGZJfSE/tj9Zi5vmTmWegFbA8DU4bEZZUFchakxz3o18fW4C8FKzjQ==
dependencies:
"@adraffy/ens-normalize" "1.10.0"
"@noble/curves" "1.2.0"
"@noble/hashes" "1.3.2"
"@scure/bip32" "1.3.2"
"@scure/bip39" "1.2.1"
abitype "1.0.4"
"@noble/curves" "1.4.0"
"@noble/hashes" "1.4.0"
"@scure/bip32" "1.4.0"
"@scure/bip39" "1.3.0"
abitype "1.0.5"
isows "1.0.4"
webauthn-p256 "0.0.5"
ws "8.17.1"

walker@^1.0.8:
Expand All @@ -4703,6 +4720,14 @@ walker@^1.0.8:
dependencies:
makeerror "1.0.12"

[email protected]:
version "0.0.5"
resolved "https://registry.yarnpkg.com/webauthn-p256/-/webauthn-p256-0.0.5.tgz#0baebd2ba8a414b21cc09c0d40f9dd0be96a06bd"
integrity sha512-drMGNWKdaixZNobeORVIqq7k5DsRC9FnG201K2QjeOoQLmtSDaSsVZdkg6n5jUALJKcAG++zBPJXmv6hy0nWFg==
dependencies:
"@noble/curves" "^1.4.0"
"@noble/hashes" "^1.4.0"

which@^2.0.1, which@^2.0.2:
version "2.0.2"
resolved "https://registry.npmjs.org/which/-/which-2.0.2.tgz"
Expand Down Expand Up @@ -4731,7 +4756,16 @@ widest-line@^4.0.1:
dependencies:
string-width "^5.0.1"

"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
dependencies:
ansi-styles "^4.0.0"
string-width "^4.1.0"
strip-ansi "^6.0.0"

wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
Expand Down

0 comments on commit d8beac1

Please sign in to comment.