@gfxlabs/oku-chains 1.11.28 → 1.11.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +149 -0
- package/dist/index-mjs.js +150 -2
- package/dist/index.js +149 -0
- package/dist/types/definitions/index.d.ts +1 -0
- package/dist/types/definitions/pharos.d.ts +118 -0
- package/dist/types/index.d.ts +117 -0
- package/dist/types/internal-chains/index.d.ts +18 -0
- package/dist/types/internal-chains/pharos.d.ts +13 -0
- package/dist/types/internal-chains/util.d.ts +85 -0
- package/package.json +1 -1
- package/readme.md +40 -2
package/dist/browser.js
CHANGED
|
@@ -4269,6 +4269,153 @@
|
|
|
4269
4269
|
},
|
|
4270
4270
|
});
|
|
4271
4271
|
|
|
4272
|
+
/**
|
|
4273
|
+
* Define a chain internally when `viem/chains` does not yet export it
|
|
4274
|
+
* (or ships it too slowly).
|
|
4275
|
+
*
|
|
4276
|
+
* Wraps viem's own {@link defineChain} so the result is a valid `Chain` and
|
|
4277
|
+
* can be consumed anywhere a `viem/chains` import would be. The intent is
|
|
4278
|
+
* that once viem merges the chain upstream, a definition in
|
|
4279
|
+
* `src/definitions/<chain>.ts` can swap
|
|
4280
|
+
*
|
|
4281
|
+
* import { foo as chain } from "../internal-chains";
|
|
4282
|
+
*
|
|
4283
|
+
* for
|
|
4284
|
+
*
|
|
4285
|
+
* import { foo as chain } from "viem/chains";
|
|
4286
|
+
*
|
|
4287
|
+
* with no other code changes.
|
|
4288
|
+
*
|
|
4289
|
+
* @example
|
|
4290
|
+
* ```ts
|
|
4291
|
+
* // src/internal-chains/mychain.ts
|
|
4292
|
+
* import { makeInternalChain } from "./util";
|
|
4293
|
+
*
|
|
4294
|
+
* export const mychain = makeInternalChain({
|
|
4295
|
+
* id: 123456,
|
|
4296
|
+
* name: "My Chain",
|
|
4297
|
+
* nativeCurrency: { name: "MyToken", symbol: "MYT", decimals: 18 },
|
|
4298
|
+
* rpcUrls: { default: { http: ["https://rpc.mychain.example"] } },
|
|
4299
|
+
* blockExplorers: {
|
|
4300
|
+
* default: { name: "MyScan", url: "https://explorer.mychain.example" },
|
|
4301
|
+
* },
|
|
4302
|
+
* contracts: {
|
|
4303
|
+
* multicall3: {
|
|
4304
|
+
* address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
4305
|
+
* blockCreated: 1,
|
|
4306
|
+
* },
|
|
4307
|
+
* },
|
|
4308
|
+
* });
|
|
4309
|
+
* ```
|
|
4310
|
+
*/
|
|
4311
|
+
const makeInternalChain = (params) => {
|
|
4312
|
+
return viem.defineChain(params);
|
|
4313
|
+
};
|
|
4314
|
+
|
|
4315
|
+
/**
|
|
4316
|
+
* Pharos Mainnet.
|
|
4317
|
+
*
|
|
4318
|
+
* Not (yet) exported by `viem/chains`; defined internally so we can ship
|
|
4319
|
+
* chain-config support ahead of upstream. Swap this import for
|
|
4320
|
+
* `viem/chains` once viem adds it.
|
|
4321
|
+
*
|
|
4322
|
+
* Refs:
|
|
4323
|
+
* - https://rpc.pharos.xyz
|
|
4324
|
+
* - https://pharos.socialscan.io
|
|
4325
|
+
* - https://linear.app/gfx-labs/project/pharos-morpho-985c928b0010
|
|
4326
|
+
*/
|
|
4327
|
+
const pharos$1 = makeInternalChain({
|
|
4328
|
+
id: 1672,
|
|
4329
|
+
name: "Pharos Mainnet",
|
|
4330
|
+
nativeCurrency: {
|
|
4331
|
+
name: "Pharos",
|
|
4332
|
+
symbol: "PROS",
|
|
4333
|
+
decimals: 18,
|
|
4334
|
+
},
|
|
4335
|
+
rpcUrls: {
|
|
4336
|
+
default: {
|
|
4337
|
+
http: ["https://rpc.pharos.xyz"],
|
|
4338
|
+
},
|
|
4339
|
+
},
|
|
4340
|
+
blockExplorers: {
|
|
4341
|
+
default: {
|
|
4342
|
+
name: "SocialScan",
|
|
4343
|
+
url: "https://pharos.socialscan.io",
|
|
4344
|
+
},
|
|
4345
|
+
},
|
|
4346
|
+
contracts: {
|
|
4347
|
+
// No canonical multicall3 deployment confirmed yet; add when known.
|
|
4348
|
+
},
|
|
4349
|
+
});
|
|
4350
|
+
|
|
4351
|
+
const pharos = makeConfig({
|
|
4352
|
+
...pharos$1,
|
|
4353
|
+
blockTimeSeconds: 2,
|
|
4354
|
+
launchTime: 1777014000,
|
|
4355
|
+
transactionType: "eip1559",
|
|
4356
|
+
sortIndex: 46,
|
|
4357
|
+
logoUrl: "https://cms.oku.trade/cdn/public/chains/pharos-logo.svg",
|
|
4358
|
+
deprecated: false,
|
|
4359
|
+
liteChain: true,
|
|
4360
|
+
estimatedSwapGas: 300000,
|
|
4361
|
+
estimatedBridgeGas: 200000,
|
|
4362
|
+
estimatedWrapGas: 60000,
|
|
4363
|
+
safeReorgDistance: 90000,
|
|
4364
|
+
blockAid: "",
|
|
4365
|
+
externalId: {},
|
|
4366
|
+
markets: {},
|
|
4367
|
+
bridges: {},
|
|
4368
|
+
oracles: {},
|
|
4369
|
+
morpho: {
|
|
4370
|
+
deployBlock: 4202147,
|
|
4371
|
+
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb",
|
|
4372
|
+
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120",
|
|
4373
|
+
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498",
|
|
4374
|
+
morphoMarketV1AdapterV2Factory: "0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403",
|
|
4375
|
+
},
|
|
4376
|
+
initCodeHash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",
|
|
4377
|
+
uniswap: {},
|
|
4378
|
+
token: {
|
|
4379
|
+
usdcAddress: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4380
|
+
wethAddress: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4381
|
+
},
|
|
4382
|
+
oku: {
|
|
4383
|
+
limitOrderRegistry: viem.zeroAddress,
|
|
4384
|
+
limitOrderRegistryDeployBlock: 0,
|
|
4385
|
+
pricing: {
|
|
4386
|
+
nativeWrappedToken: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4387
|
+
nativeWrappedName: "PROS",
|
|
4388
|
+
},
|
|
4389
|
+
},
|
|
4390
|
+
defaultPool: viem.zeroAddress,
|
|
4391
|
+
defaultToken0: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4392
|
+
defaultToken1: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4393
|
+
tokenList: [
|
|
4394
|
+
{ symbol: "WPROS", address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0" },
|
|
4395
|
+
{
|
|
4396
|
+
symbol: "USDC",
|
|
4397
|
+
address: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4398
|
+
},
|
|
4399
|
+
],
|
|
4400
|
+
stables: ["0xc879c018db60520f4355c26ed1a6d572cdac1815"],
|
|
4401
|
+
watchlist: [],
|
|
4402
|
+
internalName: "pharos",
|
|
4403
|
+
nativeLogoUrl: "https://cms.oku.trade/cdn/public/natives/pros.png",
|
|
4404
|
+
contracts: {
|
|
4405
|
+
...pharos$1.contracts,
|
|
4406
|
+
limitOrder: {
|
|
4407
|
+
address: viem.zeroAddress,
|
|
4408
|
+
blockCreated: 0,
|
|
4409
|
+
},
|
|
4410
|
+
nftManager: {
|
|
4411
|
+
address: viem.zeroAddress,
|
|
4412
|
+
},
|
|
4413
|
+
weth9: {
|
|
4414
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4415
|
+
},
|
|
4416
|
+
},
|
|
4417
|
+
});
|
|
4418
|
+
|
|
4272
4419
|
const plasma = makeConfig({
|
|
4273
4420
|
...chains.plasma,
|
|
4274
4421
|
name: "Plasma",
|
|
@@ -6758,6 +6905,7 @@
|
|
|
6758
6905
|
monad,
|
|
6759
6906
|
hyperevm,
|
|
6760
6907
|
gensyn,
|
|
6908
|
+
pharos,
|
|
6761
6909
|
];
|
|
6762
6910
|
|
|
6763
6911
|
exports.MAINNET_CHAINS = MAINNET_CHAINS;
|
|
@@ -6793,6 +6941,7 @@
|
|
|
6793
6941
|
exports.nibiru = nibiru;
|
|
6794
6942
|
exports.optimism = optimism;
|
|
6795
6943
|
exports.parseCAIP2 = parseCAIP2;
|
|
6944
|
+
exports.pharos = pharos;
|
|
6796
6945
|
exports.plasma = plasma;
|
|
6797
6946
|
exports.polygon = polygon;
|
|
6798
6947
|
exports.polygonZkEvm = polygonZkEvm;
|
package/dist/index-mjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { arbitrum as arbitrum$1, avalanche as avalanche$1, base as base$1, blast as blast$1, bob as bob$1, boba as boba$1, bsc as bsc$1, celo as celo$1, corn as corn$1, etherlink as etherlink$1, filecoin as filecoin$1, gensyn as gensyn$1, gnosis as gnosis$1, goat as goat$1, hemi as hemi$1, hyperEvm, lens as lens$1, lightlinkPhoenix, linea as linea$1, lisk as lisk$1, mainnet as mainnet$1, manta as manta$1, mantle as mantle$1, matchain as matchain$1, metalL2, monad as monad$1, moonbeam as moonbeam$1, nibiru as nibiru$1, optimism as optimism$1, plasma as plasma$1, polygon as polygon$1, redbellyMainnet, ronin as ronin$1, rootstock as rootstock$1, saga as saga$1, scroll as scroll$1, sei as sei$1, sonic as sonic$1, taiko as taiko$1, telos as telos$1, tronShasta as tronShasta$1, unichain as unichain$1, worldchain as worldchain$1, xdc as xdc$1, zeroGMainnet, polygonZkEvm as polygonZkEvm$1, zksync } from 'viem/chains';
|
|
2
|
-
import { zeroAddress } from 'viem';
|
|
2
|
+
import { zeroAddress, defineChain } from 'viem';
|
|
3
3
|
|
|
4
4
|
const makeConfig = (x) => {
|
|
5
5
|
return { caip2Namespace: "eip155", ...x };
|
|
@@ -4266,6 +4266,153 @@ const optimism = makeConfig({
|
|
|
4266
4266
|
},
|
|
4267
4267
|
});
|
|
4268
4268
|
|
|
4269
|
+
/**
|
|
4270
|
+
* Define a chain internally when `viem/chains` does not yet export it
|
|
4271
|
+
* (or ships it too slowly).
|
|
4272
|
+
*
|
|
4273
|
+
* Wraps viem's own {@link defineChain} so the result is a valid `Chain` and
|
|
4274
|
+
* can be consumed anywhere a `viem/chains` import would be. The intent is
|
|
4275
|
+
* that once viem merges the chain upstream, a definition in
|
|
4276
|
+
* `src/definitions/<chain>.ts` can swap
|
|
4277
|
+
*
|
|
4278
|
+
* import { foo as chain } from "../internal-chains";
|
|
4279
|
+
*
|
|
4280
|
+
* for
|
|
4281
|
+
*
|
|
4282
|
+
* import { foo as chain } from "viem/chains";
|
|
4283
|
+
*
|
|
4284
|
+
* with no other code changes.
|
|
4285
|
+
*
|
|
4286
|
+
* @example
|
|
4287
|
+
* ```ts
|
|
4288
|
+
* // src/internal-chains/mychain.ts
|
|
4289
|
+
* import { makeInternalChain } from "./util";
|
|
4290
|
+
*
|
|
4291
|
+
* export const mychain = makeInternalChain({
|
|
4292
|
+
* id: 123456,
|
|
4293
|
+
* name: "My Chain",
|
|
4294
|
+
* nativeCurrency: { name: "MyToken", symbol: "MYT", decimals: 18 },
|
|
4295
|
+
* rpcUrls: { default: { http: ["https://rpc.mychain.example"] } },
|
|
4296
|
+
* blockExplorers: {
|
|
4297
|
+
* default: { name: "MyScan", url: "https://explorer.mychain.example" },
|
|
4298
|
+
* },
|
|
4299
|
+
* contracts: {
|
|
4300
|
+
* multicall3: {
|
|
4301
|
+
* address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
4302
|
+
* blockCreated: 1,
|
|
4303
|
+
* },
|
|
4304
|
+
* },
|
|
4305
|
+
* });
|
|
4306
|
+
* ```
|
|
4307
|
+
*/
|
|
4308
|
+
const makeInternalChain = (params) => {
|
|
4309
|
+
return defineChain(params);
|
|
4310
|
+
};
|
|
4311
|
+
|
|
4312
|
+
/**
|
|
4313
|
+
* Pharos Mainnet.
|
|
4314
|
+
*
|
|
4315
|
+
* Not (yet) exported by `viem/chains`; defined internally so we can ship
|
|
4316
|
+
* chain-config support ahead of upstream. Swap this import for
|
|
4317
|
+
* `viem/chains` once viem adds it.
|
|
4318
|
+
*
|
|
4319
|
+
* Refs:
|
|
4320
|
+
* - https://rpc.pharos.xyz
|
|
4321
|
+
* - https://pharos.socialscan.io
|
|
4322
|
+
* - https://linear.app/gfx-labs/project/pharos-morpho-985c928b0010
|
|
4323
|
+
*/
|
|
4324
|
+
const pharos$1 = makeInternalChain({
|
|
4325
|
+
id: 1672,
|
|
4326
|
+
name: "Pharos Mainnet",
|
|
4327
|
+
nativeCurrency: {
|
|
4328
|
+
name: "Pharos",
|
|
4329
|
+
symbol: "PROS",
|
|
4330
|
+
decimals: 18,
|
|
4331
|
+
},
|
|
4332
|
+
rpcUrls: {
|
|
4333
|
+
default: {
|
|
4334
|
+
http: ["https://rpc.pharos.xyz"],
|
|
4335
|
+
},
|
|
4336
|
+
},
|
|
4337
|
+
blockExplorers: {
|
|
4338
|
+
default: {
|
|
4339
|
+
name: "SocialScan",
|
|
4340
|
+
url: "https://pharos.socialscan.io",
|
|
4341
|
+
},
|
|
4342
|
+
},
|
|
4343
|
+
contracts: {
|
|
4344
|
+
// No canonical multicall3 deployment confirmed yet; add when known.
|
|
4345
|
+
},
|
|
4346
|
+
});
|
|
4347
|
+
|
|
4348
|
+
const pharos = makeConfig({
|
|
4349
|
+
...pharos$1,
|
|
4350
|
+
blockTimeSeconds: 2,
|
|
4351
|
+
launchTime: 1777014000,
|
|
4352
|
+
transactionType: "eip1559",
|
|
4353
|
+
sortIndex: 46,
|
|
4354
|
+
logoUrl: "https://cms.oku.trade/cdn/public/chains/pharos-logo.svg",
|
|
4355
|
+
deprecated: false,
|
|
4356
|
+
liteChain: true,
|
|
4357
|
+
estimatedSwapGas: 300000,
|
|
4358
|
+
estimatedBridgeGas: 200000,
|
|
4359
|
+
estimatedWrapGas: 60000,
|
|
4360
|
+
safeReorgDistance: 90000,
|
|
4361
|
+
blockAid: "",
|
|
4362
|
+
externalId: {},
|
|
4363
|
+
markets: {},
|
|
4364
|
+
bridges: {},
|
|
4365
|
+
oracles: {},
|
|
4366
|
+
morpho: {
|
|
4367
|
+
deployBlock: 4202147,
|
|
4368
|
+
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb",
|
|
4369
|
+
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120",
|
|
4370
|
+
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498",
|
|
4371
|
+
morphoMarketV1AdapterV2Factory: "0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403",
|
|
4372
|
+
},
|
|
4373
|
+
initCodeHash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",
|
|
4374
|
+
uniswap: {},
|
|
4375
|
+
token: {
|
|
4376
|
+
usdcAddress: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4377
|
+
wethAddress: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4378
|
+
},
|
|
4379
|
+
oku: {
|
|
4380
|
+
limitOrderRegistry: zeroAddress,
|
|
4381
|
+
limitOrderRegistryDeployBlock: 0,
|
|
4382
|
+
pricing: {
|
|
4383
|
+
nativeWrappedToken: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4384
|
+
nativeWrappedName: "PROS",
|
|
4385
|
+
},
|
|
4386
|
+
},
|
|
4387
|
+
defaultPool: zeroAddress,
|
|
4388
|
+
defaultToken0: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4389
|
+
defaultToken1: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4390
|
+
tokenList: [
|
|
4391
|
+
{ symbol: "WPROS", address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0" },
|
|
4392
|
+
{
|
|
4393
|
+
symbol: "USDC",
|
|
4394
|
+
address: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4395
|
+
},
|
|
4396
|
+
],
|
|
4397
|
+
stables: ["0xc879c018db60520f4355c26ed1a6d572cdac1815"],
|
|
4398
|
+
watchlist: [],
|
|
4399
|
+
internalName: "pharos",
|
|
4400
|
+
nativeLogoUrl: "https://cms.oku.trade/cdn/public/natives/pros.png",
|
|
4401
|
+
contracts: {
|
|
4402
|
+
...pharos$1.contracts,
|
|
4403
|
+
limitOrder: {
|
|
4404
|
+
address: zeroAddress,
|
|
4405
|
+
blockCreated: 0,
|
|
4406
|
+
},
|
|
4407
|
+
nftManager: {
|
|
4408
|
+
address: zeroAddress,
|
|
4409
|
+
},
|
|
4410
|
+
weth9: {
|
|
4411
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4412
|
+
},
|
|
4413
|
+
},
|
|
4414
|
+
});
|
|
4415
|
+
|
|
4269
4416
|
const plasma = makeConfig({
|
|
4270
4417
|
...plasma$1,
|
|
4271
4418
|
name: "Plasma",
|
|
@@ -6755,6 +6902,7 @@ const MAINNET_CHAINS = [
|
|
|
6755
6902
|
monad,
|
|
6756
6903
|
hyperevm,
|
|
6757
6904
|
gensyn,
|
|
6905
|
+
pharos,
|
|
6758
6906
|
];
|
|
6759
6907
|
|
|
6760
|
-
export { MAINNET_CHAINS, arbitrum, avalanche, base, blast, bob, boba, bsc, celo, corn, etherlink, filecoin, formatCAIP2, fromCAIP2, gensyn, gnosis, goat, hemi, hyperevm, lens, lightlink, linea, lisk, mainnet, manta, mantle, matchain, metal, monad, moonbeam, nibiru, optimism, parseCAIP2, plasma, polygon, polygonZkEvm, redbelly, ronin, rootstock, saga, scroll, sei, sonic, taiko, telos, toCAIP2, tronShasta, unichain, worldchain, xdc, zerog, zkSync };
|
|
6908
|
+
export { MAINNET_CHAINS, arbitrum, avalanche, base, blast, bob, boba, bsc, celo, corn, etherlink, filecoin, formatCAIP2, fromCAIP2, gensyn, gnosis, goat, hemi, hyperevm, lens, lightlink, linea, lisk, mainnet, manta, mantle, matchain, metal, monad, moonbeam, nibiru, optimism, parseCAIP2, pharos, plasma, polygon, polygonZkEvm, redbelly, ronin, rootstock, saga, scroll, sei, sonic, taiko, telos, toCAIP2, tronShasta, unichain, worldchain, xdc, zerog, zkSync };
|
package/dist/index.js
CHANGED
|
@@ -4268,6 +4268,153 @@ const optimism = makeConfig({
|
|
|
4268
4268
|
},
|
|
4269
4269
|
});
|
|
4270
4270
|
|
|
4271
|
+
/**
|
|
4272
|
+
* Define a chain internally when `viem/chains` does not yet export it
|
|
4273
|
+
* (or ships it too slowly).
|
|
4274
|
+
*
|
|
4275
|
+
* Wraps viem's own {@link defineChain} so the result is a valid `Chain` and
|
|
4276
|
+
* can be consumed anywhere a `viem/chains` import would be. The intent is
|
|
4277
|
+
* that once viem merges the chain upstream, a definition in
|
|
4278
|
+
* `src/definitions/<chain>.ts` can swap
|
|
4279
|
+
*
|
|
4280
|
+
* import { foo as chain } from "../internal-chains";
|
|
4281
|
+
*
|
|
4282
|
+
* for
|
|
4283
|
+
*
|
|
4284
|
+
* import { foo as chain } from "viem/chains";
|
|
4285
|
+
*
|
|
4286
|
+
* with no other code changes.
|
|
4287
|
+
*
|
|
4288
|
+
* @example
|
|
4289
|
+
* ```ts
|
|
4290
|
+
* // src/internal-chains/mychain.ts
|
|
4291
|
+
* import { makeInternalChain } from "./util";
|
|
4292
|
+
*
|
|
4293
|
+
* export const mychain = makeInternalChain({
|
|
4294
|
+
* id: 123456,
|
|
4295
|
+
* name: "My Chain",
|
|
4296
|
+
* nativeCurrency: { name: "MyToken", symbol: "MYT", decimals: 18 },
|
|
4297
|
+
* rpcUrls: { default: { http: ["https://rpc.mychain.example"] } },
|
|
4298
|
+
* blockExplorers: {
|
|
4299
|
+
* default: { name: "MyScan", url: "https://explorer.mychain.example" },
|
|
4300
|
+
* },
|
|
4301
|
+
* contracts: {
|
|
4302
|
+
* multicall3: {
|
|
4303
|
+
* address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
4304
|
+
* blockCreated: 1,
|
|
4305
|
+
* },
|
|
4306
|
+
* },
|
|
4307
|
+
* });
|
|
4308
|
+
* ```
|
|
4309
|
+
*/
|
|
4310
|
+
const makeInternalChain = (params) => {
|
|
4311
|
+
return viem.defineChain(params);
|
|
4312
|
+
};
|
|
4313
|
+
|
|
4314
|
+
/**
|
|
4315
|
+
* Pharos Mainnet.
|
|
4316
|
+
*
|
|
4317
|
+
* Not (yet) exported by `viem/chains`; defined internally so we can ship
|
|
4318
|
+
* chain-config support ahead of upstream. Swap this import for
|
|
4319
|
+
* `viem/chains` once viem adds it.
|
|
4320
|
+
*
|
|
4321
|
+
* Refs:
|
|
4322
|
+
* - https://rpc.pharos.xyz
|
|
4323
|
+
* - https://pharos.socialscan.io
|
|
4324
|
+
* - https://linear.app/gfx-labs/project/pharos-morpho-985c928b0010
|
|
4325
|
+
*/
|
|
4326
|
+
const pharos$1 = makeInternalChain({
|
|
4327
|
+
id: 1672,
|
|
4328
|
+
name: "Pharos Mainnet",
|
|
4329
|
+
nativeCurrency: {
|
|
4330
|
+
name: "Pharos",
|
|
4331
|
+
symbol: "PROS",
|
|
4332
|
+
decimals: 18,
|
|
4333
|
+
},
|
|
4334
|
+
rpcUrls: {
|
|
4335
|
+
default: {
|
|
4336
|
+
http: ["https://rpc.pharos.xyz"],
|
|
4337
|
+
},
|
|
4338
|
+
},
|
|
4339
|
+
blockExplorers: {
|
|
4340
|
+
default: {
|
|
4341
|
+
name: "SocialScan",
|
|
4342
|
+
url: "https://pharos.socialscan.io",
|
|
4343
|
+
},
|
|
4344
|
+
},
|
|
4345
|
+
contracts: {
|
|
4346
|
+
// No canonical multicall3 deployment confirmed yet; add when known.
|
|
4347
|
+
},
|
|
4348
|
+
});
|
|
4349
|
+
|
|
4350
|
+
const pharos = makeConfig({
|
|
4351
|
+
...pharos$1,
|
|
4352
|
+
blockTimeSeconds: 2,
|
|
4353
|
+
launchTime: 1777014000,
|
|
4354
|
+
transactionType: "eip1559",
|
|
4355
|
+
sortIndex: 46,
|
|
4356
|
+
logoUrl: "https://cms.oku.trade/cdn/public/chains/pharos-logo.svg",
|
|
4357
|
+
deprecated: false,
|
|
4358
|
+
liteChain: true,
|
|
4359
|
+
estimatedSwapGas: 300000,
|
|
4360
|
+
estimatedBridgeGas: 200000,
|
|
4361
|
+
estimatedWrapGas: 60000,
|
|
4362
|
+
safeReorgDistance: 90000,
|
|
4363
|
+
blockAid: "",
|
|
4364
|
+
externalId: {},
|
|
4365
|
+
markets: {},
|
|
4366
|
+
bridges: {},
|
|
4367
|
+
oracles: {},
|
|
4368
|
+
morpho: {
|
|
4369
|
+
deployBlock: 4202147,
|
|
4370
|
+
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb",
|
|
4371
|
+
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120",
|
|
4372
|
+
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498",
|
|
4373
|
+
morphoMarketV1AdapterV2Factory: "0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403",
|
|
4374
|
+
},
|
|
4375
|
+
initCodeHash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54",
|
|
4376
|
+
uniswap: {},
|
|
4377
|
+
token: {
|
|
4378
|
+
usdcAddress: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4379
|
+
wethAddress: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4380
|
+
},
|
|
4381
|
+
oku: {
|
|
4382
|
+
limitOrderRegistry: viem.zeroAddress,
|
|
4383
|
+
limitOrderRegistryDeployBlock: 0,
|
|
4384
|
+
pricing: {
|
|
4385
|
+
nativeWrappedToken: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4386
|
+
nativeWrappedName: "PROS",
|
|
4387
|
+
},
|
|
4388
|
+
},
|
|
4389
|
+
defaultPool: viem.zeroAddress,
|
|
4390
|
+
defaultToken0: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4391
|
+
defaultToken1: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4392
|
+
tokenList: [
|
|
4393
|
+
{ symbol: "WPROS", address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0" },
|
|
4394
|
+
{
|
|
4395
|
+
symbol: "USDC",
|
|
4396
|
+
address: "0xc879c018db60520f4355c26ed1a6d572cdac1815",
|
|
4397
|
+
},
|
|
4398
|
+
],
|
|
4399
|
+
stables: ["0xc879c018db60520f4355c26ed1a6d572cdac1815"],
|
|
4400
|
+
watchlist: [],
|
|
4401
|
+
internalName: "pharos",
|
|
4402
|
+
nativeLogoUrl: "https://cms.oku.trade/cdn/public/natives/pros.png",
|
|
4403
|
+
contracts: {
|
|
4404
|
+
...pharos$1.contracts,
|
|
4405
|
+
limitOrder: {
|
|
4406
|
+
address: viem.zeroAddress,
|
|
4407
|
+
blockCreated: 0,
|
|
4408
|
+
},
|
|
4409
|
+
nftManager: {
|
|
4410
|
+
address: viem.zeroAddress,
|
|
4411
|
+
},
|
|
4412
|
+
weth9: {
|
|
4413
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0",
|
|
4414
|
+
},
|
|
4415
|
+
},
|
|
4416
|
+
});
|
|
4417
|
+
|
|
4271
4418
|
const plasma = makeConfig({
|
|
4272
4419
|
...chains.plasma,
|
|
4273
4420
|
name: "Plasma",
|
|
@@ -6757,6 +6904,7 @@ const MAINNET_CHAINS = [
|
|
|
6757
6904
|
monad,
|
|
6758
6905
|
hyperevm,
|
|
6759
6906
|
gensyn,
|
|
6907
|
+
pharos,
|
|
6760
6908
|
];
|
|
6761
6909
|
|
|
6762
6910
|
exports.MAINNET_CHAINS = MAINNET_CHAINS;
|
|
@@ -6792,6 +6940,7 @@ exports.moonbeam = moonbeam;
|
|
|
6792
6940
|
exports.nibiru = nibiru;
|
|
6793
6941
|
exports.optimism = optimism;
|
|
6794
6942
|
exports.parseCAIP2 = parseCAIP2;
|
|
6943
|
+
exports.pharos = pharos;
|
|
6795
6944
|
exports.plasma = plasma;
|
|
6796
6945
|
exports.polygon = polygon;
|
|
6797
6946
|
exports.polygonZkEvm = polygonZkEvm;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export declare const pharos: Readonly<{
|
|
2
|
+
blockTimeSeconds: 2;
|
|
3
|
+
launchTime: 1777014000;
|
|
4
|
+
transactionType: "eip1559";
|
|
5
|
+
sortIndex: 46;
|
|
6
|
+
logoUrl: "https://cms.oku.trade/cdn/public/chains/pharos-logo.svg";
|
|
7
|
+
deprecated: false;
|
|
8
|
+
liteChain: true;
|
|
9
|
+
estimatedSwapGas: 300000;
|
|
10
|
+
estimatedBridgeGas: 200000;
|
|
11
|
+
estimatedWrapGas: 60000;
|
|
12
|
+
safeReorgDistance: 90000;
|
|
13
|
+
blockAid: "";
|
|
14
|
+
externalId: {};
|
|
15
|
+
markets: {};
|
|
16
|
+
bridges: {};
|
|
17
|
+
oracles: {};
|
|
18
|
+
morpho: {
|
|
19
|
+
deployBlock: number;
|
|
20
|
+
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb";
|
|
21
|
+
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120";
|
|
22
|
+
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498";
|
|
23
|
+
morphoMarketV1AdapterV2Factory: "0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403";
|
|
24
|
+
};
|
|
25
|
+
initCodeHash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54";
|
|
26
|
+
uniswap: {};
|
|
27
|
+
token: {
|
|
28
|
+
usdcAddress: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
29
|
+
wethAddress: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
30
|
+
};
|
|
31
|
+
oku: {
|
|
32
|
+
limitOrderRegistry: "0x0000000000000000000000000000000000000000";
|
|
33
|
+
limitOrderRegistryDeployBlock: number;
|
|
34
|
+
pricing: {
|
|
35
|
+
nativeWrappedToken: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
36
|
+
nativeWrappedName: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
defaultPool: "0x0000000000000000000000000000000000000000";
|
|
40
|
+
defaultToken0: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
41
|
+
defaultToken1: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
42
|
+
tokenList: ({
|
|
43
|
+
symbol: string;
|
|
44
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
45
|
+
} | {
|
|
46
|
+
symbol: string;
|
|
47
|
+
address: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
48
|
+
})[];
|
|
49
|
+
stables: "0xc879c018db60520f4355c26ed1a6d572cdac1815"[];
|
|
50
|
+
watchlist: never[];
|
|
51
|
+
internalName: "pharos";
|
|
52
|
+
nativeLogoUrl: "https://cms.oku.trade/cdn/public/natives/pros.png";
|
|
53
|
+
contracts: {
|
|
54
|
+
limitOrder: {
|
|
55
|
+
address: "0x0000000000000000000000000000000000000000";
|
|
56
|
+
blockCreated: number;
|
|
57
|
+
};
|
|
58
|
+
nftManager: {
|
|
59
|
+
address: "0x0000000000000000000000000000000000000000";
|
|
60
|
+
};
|
|
61
|
+
weth9: {
|
|
62
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
63
|
+
};
|
|
64
|
+
ensRegistry?: import("viem").ChainContract | undefined;
|
|
65
|
+
ensUniversalResolver?: import("viem").ChainContract | undefined;
|
|
66
|
+
multicall3?: import("viem").ChainContract | undefined;
|
|
67
|
+
erc6492Verifier?: import("viem").ChainContract | undefined;
|
|
68
|
+
};
|
|
69
|
+
blockExplorers?: {
|
|
70
|
+
[key: string]: {
|
|
71
|
+
name: string;
|
|
72
|
+
url: string;
|
|
73
|
+
apiUrl?: string | undefined;
|
|
74
|
+
};
|
|
75
|
+
default: {
|
|
76
|
+
name: string;
|
|
77
|
+
url: string;
|
|
78
|
+
apiUrl?: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
} | undefined | undefined;
|
|
81
|
+
blockTime?: number | undefined | undefined;
|
|
82
|
+
ensTlds?: readonly string[] | undefined;
|
|
83
|
+
id: number;
|
|
84
|
+
name: string;
|
|
85
|
+
nativeCurrency: {
|
|
86
|
+
name: string;
|
|
87
|
+
symbol: string;
|
|
88
|
+
decimals: number;
|
|
89
|
+
};
|
|
90
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
91
|
+
rpcUrls: {
|
|
92
|
+
[key: string]: {
|
|
93
|
+
http: readonly string[];
|
|
94
|
+
webSocket?: readonly string[] | undefined;
|
|
95
|
+
};
|
|
96
|
+
default: {
|
|
97
|
+
http: readonly string[];
|
|
98
|
+
webSocket?: readonly string[] | undefined;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
sourceId?: number | undefined | undefined;
|
|
102
|
+
testnet?: boolean | undefined | undefined;
|
|
103
|
+
custom?: Record<string, unknown> | undefined;
|
|
104
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
105
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
106
|
+
formatters?: undefined;
|
|
107
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
108
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
109
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
110
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
111
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
112
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
113
|
+
}] | undefined;
|
|
114
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
115
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
116
|
+
} & {
|
|
117
|
+
caip2Namespace: string;
|
|
118
|
+
}>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10580,4 +10580,121 @@ export declare const MAINNET_CHAINS: readonly [Readonly<{
|
|
|
10580
10580
|
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined | undefined;
|
|
10581
10581
|
} & {
|
|
10582
10582
|
caip2Namespace: string;
|
|
10583
|
+
}>, Readonly<{
|
|
10584
|
+
blockTimeSeconds: 2;
|
|
10585
|
+
launchTime: 1777014000;
|
|
10586
|
+
transactionType: "eip1559";
|
|
10587
|
+
sortIndex: 46;
|
|
10588
|
+
logoUrl: "https://cms.oku.trade/cdn/public/chains/pharos-logo.svg";
|
|
10589
|
+
deprecated: false;
|
|
10590
|
+
liteChain: true;
|
|
10591
|
+
estimatedSwapGas: 300000;
|
|
10592
|
+
estimatedBridgeGas: 200000;
|
|
10593
|
+
estimatedWrapGas: 60000;
|
|
10594
|
+
safeReorgDistance: 90000;
|
|
10595
|
+
blockAid: "";
|
|
10596
|
+
externalId: {};
|
|
10597
|
+
markets: {};
|
|
10598
|
+
bridges: {};
|
|
10599
|
+
oracles: {};
|
|
10600
|
+
morpho: {
|
|
10601
|
+
deployBlock: number;
|
|
10602
|
+
morpho: "0x18573fA18fd17dDfD790B4a5B5b2977aad3b4Efb";
|
|
10603
|
+
bundler3: "0x3c90c09F8c5d927a117F681fB924952DbbD99120";
|
|
10604
|
+
vaultV2Factory: "0x8E01ed1E1A41029b3137FcE9Aa880c0A54827498";
|
|
10605
|
+
morphoMarketV1AdapterV2Factory: "0xe510e1fcC429943cA3455A7bfBD79f0307Cd8403";
|
|
10606
|
+
};
|
|
10607
|
+
initCodeHash: "0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54";
|
|
10608
|
+
uniswap: {};
|
|
10609
|
+
token: {
|
|
10610
|
+
usdcAddress: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
10611
|
+
wethAddress: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
10612
|
+
};
|
|
10613
|
+
oku: {
|
|
10614
|
+
limitOrderRegistry: "0x0000000000000000000000000000000000000000";
|
|
10615
|
+
limitOrderRegistryDeployBlock: number;
|
|
10616
|
+
pricing: {
|
|
10617
|
+
nativeWrappedToken: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
10618
|
+
nativeWrappedName: string;
|
|
10619
|
+
};
|
|
10620
|
+
};
|
|
10621
|
+
defaultPool: "0x0000000000000000000000000000000000000000";
|
|
10622
|
+
defaultToken0: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
10623
|
+
defaultToken1: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
10624
|
+
tokenList: ({
|
|
10625
|
+
symbol: string;
|
|
10626
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
10627
|
+
} | {
|
|
10628
|
+
symbol: string;
|
|
10629
|
+
address: "0xc879c018db60520f4355c26ed1a6d572cdac1815";
|
|
10630
|
+
})[];
|
|
10631
|
+
stables: "0xc879c018db60520f4355c26ed1a6d572cdac1815"[];
|
|
10632
|
+
watchlist: never[];
|
|
10633
|
+
internalName: "pharos";
|
|
10634
|
+
nativeLogoUrl: "https://cms.oku.trade/cdn/public/natives/pros.png";
|
|
10635
|
+
contracts: {
|
|
10636
|
+
limitOrder: {
|
|
10637
|
+
address: "0x0000000000000000000000000000000000000000";
|
|
10638
|
+
blockCreated: number;
|
|
10639
|
+
};
|
|
10640
|
+
nftManager: {
|
|
10641
|
+
address: "0x0000000000000000000000000000000000000000";
|
|
10642
|
+
};
|
|
10643
|
+
weth9: {
|
|
10644
|
+
address: "0x52c48d4213107b20bc583832b0d951fb9ca8f0b0";
|
|
10645
|
+
};
|
|
10646
|
+
ensRegistry?: import("viem/_types/types/chain").ChainContract | undefined;
|
|
10647
|
+
ensUniversalResolver?: import("viem/_types/types/chain").ChainContract | undefined;
|
|
10648
|
+
multicall3?: import("viem/_types/types/chain").ChainContract | undefined;
|
|
10649
|
+
erc6492Verifier?: import("viem/_types/types/chain").ChainContract | undefined;
|
|
10650
|
+
};
|
|
10651
|
+
blockExplorers?: {
|
|
10652
|
+
[key: string]: {
|
|
10653
|
+
name: string;
|
|
10654
|
+
url: string;
|
|
10655
|
+
apiUrl?: string | undefined;
|
|
10656
|
+
};
|
|
10657
|
+
default: {
|
|
10658
|
+
name: string;
|
|
10659
|
+
url: string;
|
|
10660
|
+
apiUrl?: string | undefined;
|
|
10661
|
+
};
|
|
10662
|
+
} | undefined | undefined;
|
|
10663
|
+
blockTime?: number | undefined | undefined;
|
|
10664
|
+
ensTlds?: readonly string[] | undefined;
|
|
10665
|
+
id: number;
|
|
10666
|
+
name: string;
|
|
10667
|
+
nativeCurrency: {
|
|
10668
|
+
name: string;
|
|
10669
|
+
symbol: string;
|
|
10670
|
+
decimals: number;
|
|
10671
|
+
};
|
|
10672
|
+
experimental_preconfirmationTime?: number | undefined | undefined;
|
|
10673
|
+
rpcUrls: {
|
|
10674
|
+
[key: string]: {
|
|
10675
|
+
http: readonly string[];
|
|
10676
|
+
webSocket?: readonly string[] | undefined;
|
|
10677
|
+
};
|
|
10678
|
+
default: {
|
|
10679
|
+
http: readonly string[];
|
|
10680
|
+
webSocket?: readonly string[] | undefined;
|
|
10681
|
+
};
|
|
10682
|
+
};
|
|
10683
|
+
sourceId?: number | undefined | undefined;
|
|
10684
|
+
testnet?: boolean | undefined | undefined;
|
|
10685
|
+
custom?: Record<string, unknown> | undefined;
|
|
10686
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
10687
|
+
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
10688
|
+
formatters?: undefined;
|
|
10689
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
10690
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
10691
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
10692
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
10693
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
10694
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
10695
|
+
}] | undefined;
|
|
10696
|
+
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
10697
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
10698
|
+
} & {
|
|
10699
|
+
caip2Namespace: string;
|
|
10583
10700
|
}>];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal chain definitions.
|
|
3
|
+
*
|
|
4
|
+
* This folder holds chains that are not (yet) exported by `viem/chains`.
|
|
5
|
+
* Each file exports a viem-compatible `Chain` object built via
|
|
6
|
+
* {@link makeInternalChain}. Consumers in `src/definitions/` import from
|
|
7
|
+
* here exactly as they would from `viem/chains`:
|
|
8
|
+
*
|
|
9
|
+
* import { mychain as chain } from "../internal-chains";
|
|
10
|
+
*
|
|
11
|
+
* When viem upstream adds the chain, the import path is the only thing
|
|
12
|
+
* that needs to change.
|
|
13
|
+
*
|
|
14
|
+
* This barrel is maintained by hand (barrelsby only regenerates
|
|
15
|
+
* `src/definitions/`). Re-export new chains here when you add them.
|
|
16
|
+
*/
|
|
17
|
+
export * from "./pharos";
|
|
18
|
+
export * from "./util";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pharos Mainnet.
|
|
3
|
+
*
|
|
4
|
+
* Not (yet) exported by `viem/chains`; defined internally so we can ship
|
|
5
|
+
* chain-config support ahead of upstream. Swap this import for
|
|
6
|
+
* `viem/chains` once viem adds it.
|
|
7
|
+
*
|
|
8
|
+
* Refs:
|
|
9
|
+
* - https://rpc.pharos.xyz
|
|
10
|
+
* - https://pharos.socialscan.io
|
|
11
|
+
* - https://linear.app/gfx-labs/project/pharos-morpho-985c928b0010
|
|
12
|
+
*/
|
|
13
|
+
export declare const pharos: import("viem").Chain<undefined>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Chain, ChainContract, ChainFormatters } from "viem";
|
|
2
|
+
/**
|
|
3
|
+
* Parameters accepted by {@link makeInternalChain}.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the shape of `viem`'s {@link Chain}, but is exposed separately so
|
|
6
|
+
* we can add internal conventions without coupling to viem's generics.
|
|
7
|
+
*
|
|
8
|
+
* Use this to define a chain that `viem/chains` does not yet export. The
|
|
9
|
+
* returned value is a fully-typed viem `Chain` and can be spread into a
|
|
10
|
+
* `makeConfig` call in `src/definitions/<chain>.ts` exactly like the
|
|
11
|
+
* `viem/chains` imports used elsewhere in this repo.
|
|
12
|
+
*/
|
|
13
|
+
export interface InternalChainParams<formatters extends ChainFormatters | undefined = undefined> {
|
|
14
|
+
/** EVM chain id. */
|
|
15
|
+
id: number;
|
|
16
|
+
/** Human-readable display name, e.g. "My Chain". */
|
|
17
|
+
name: string;
|
|
18
|
+
/** Native currency descriptor (name, symbol, decimals). */
|
|
19
|
+
nativeCurrency: Chain["nativeCurrency"];
|
|
20
|
+
/** RPC endpoints. `default` is required; additional named endpoints are allowed. */
|
|
21
|
+
rpcUrls: Chain["rpcUrls"];
|
|
22
|
+
/** Optional block explorers. */
|
|
23
|
+
blockExplorers?: Chain["blockExplorers"];
|
|
24
|
+
/**
|
|
25
|
+
* Optional contract registry. Values here are inherited by definitions
|
|
26
|
+
* that spread `{ ...chain }` (see how `viem/chains` configs behave).
|
|
27
|
+
*/
|
|
28
|
+
contracts?: {
|
|
29
|
+
[key: string]: ChainContract | {
|
|
30
|
+
[sourceId: number]: ChainContract | undefined;
|
|
31
|
+
} | undefined;
|
|
32
|
+
ensRegistry?: ChainContract;
|
|
33
|
+
ensUniversalResolver?: ChainContract;
|
|
34
|
+
multicall3?: ChainContract;
|
|
35
|
+
erc6492Verifier?: ChainContract;
|
|
36
|
+
};
|
|
37
|
+
/** Flag for test networks. */
|
|
38
|
+
testnet?: boolean;
|
|
39
|
+
/** Source chain id (L1) for rollups / L2s. */
|
|
40
|
+
sourceId?: number;
|
|
41
|
+
/** Typical block time in milliseconds (viem convention). */
|
|
42
|
+
blockTime?: number;
|
|
43
|
+
/** Optional custom formatters for blocks / transactions. */
|
|
44
|
+
formatters?: formatters;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Define a chain internally when `viem/chains` does not yet export it
|
|
48
|
+
* (or ships it too slowly).
|
|
49
|
+
*
|
|
50
|
+
* Wraps viem's own {@link defineChain} so the result is a valid `Chain` and
|
|
51
|
+
* can be consumed anywhere a `viem/chains` import would be. The intent is
|
|
52
|
+
* that once viem merges the chain upstream, a definition in
|
|
53
|
+
* `src/definitions/<chain>.ts` can swap
|
|
54
|
+
*
|
|
55
|
+
* import { foo as chain } from "../internal-chains";
|
|
56
|
+
*
|
|
57
|
+
* for
|
|
58
|
+
*
|
|
59
|
+
* import { foo as chain } from "viem/chains";
|
|
60
|
+
*
|
|
61
|
+
* with no other code changes.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* // src/internal-chains/mychain.ts
|
|
66
|
+
* import { makeInternalChain } from "./util";
|
|
67
|
+
*
|
|
68
|
+
* export const mychain = makeInternalChain({
|
|
69
|
+
* id: 123456,
|
|
70
|
+
* name: "My Chain",
|
|
71
|
+
* nativeCurrency: { name: "MyToken", symbol: "MYT", decimals: 18 },
|
|
72
|
+
* rpcUrls: { default: { http: ["https://rpc.mychain.example"] } },
|
|
73
|
+
* blockExplorers: {
|
|
74
|
+
* default: { name: "MyScan", url: "https://explorer.mychain.example" },
|
|
75
|
+
* },
|
|
76
|
+
* contracts: {
|
|
77
|
+
* multicall3: {
|
|
78
|
+
* address: "0xca11bde05977b3631167028862be2a173976ca11",
|
|
79
|
+
* blockCreated: 1,
|
|
80
|
+
* },
|
|
81
|
+
* },
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare const makeInternalChain: <formatters extends ChainFormatters | undefined = undefined>(params: InternalChainParams<formatters>) => Chain<formatters>;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,9 +1,47 @@
|
|
|
1
1
|
# chain configs
|
|
2
2
|
|
|
3
|
+
`yarn add @gfxlabs/oku-chains`
|
|
3
4
|
|
|
5
|
+
`go get gfx.cafe/gfx/chain-config/dist/networks`
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
## Adding a chain viem doesn't ship yet
|
|
6
8
|
|
|
9
|
+
When a chain is not exported from `viem/chains`, define it under
|
|
10
|
+
`src/internal-chains/` using `makeInternalChain` and then consume it
|
|
11
|
+
from `src/definitions/` just like any `viem/chains` import.
|
|
7
12
|
|
|
8
|
-
|
|
13
|
+
1. Create `src/internal-chains/<chain>.ts`:
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { makeInternalChain } from "./util";
|
|
17
|
+
|
|
18
|
+
export const mychain = makeInternalChain({
|
|
19
|
+
id: 1234,
|
|
20
|
+
name: "My Chain",
|
|
21
|
+
nativeCurrency: { name: "Token", symbol: "TKN", decimals: 18 },
|
|
22
|
+
rpcUrls: { default: { http: ["https://rpc.mychain.example"] } },
|
|
23
|
+
blockExplorers: {
|
|
24
|
+
default: { name: "Explorer", url: "https://explorer.example" },
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
2. Re-export it from `src/internal-chains/index.ts` (this barrel is
|
|
30
|
+
maintained by hand; `barrelsby` only regenerates
|
|
31
|
+
`src/definitions/`).
|
|
32
|
+
|
|
33
|
+
3. Create `src/definitions/<chain>.ts` and import from
|
|
34
|
+
`../internal-chains` instead of `viem/chains`:
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { mychain as chain } from "../internal-chains";
|
|
38
|
+
import { makeConfig } from "../util";
|
|
39
|
+
|
|
40
|
+
export const mychain = makeConfig({ ...chain /* oku fields */ });
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
4. Register it in the `MAINNET_CHAINS` array in `src/index.ts`.
|
|
9
44
|
|
|
45
|
+
When viem upstream merges the chain, swap the import in step 3 back to
|
|
46
|
+
`viem/chains` and delete the internal definition. No other consumer
|
|
47
|
+
changes are required — `makeInternalChain` returns a full viem `Chain`.
|