Skip to content

Commit 5693049

Browse files
authored
Support base mainnet (#18)
* update calibration testnet public key and npm library version * update request id and version * add support for base mainnet * update gitignore * merge with master
1 parent c341972 commit 5693049

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,6 @@ docs/
2626

2727
# Dotenv file
2828
.env
29+
30+
# MacOS files
31+
.DS_Store

src/blocklock.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
ARBITRUM_SEPOLIA,
1414
AVALANCHE_C_CHAIN,
1515
BASE_SEPOLIA,
16+
BASE_MAINNET,
1617
FILECOIN_CALIBNET,
1718
FILECOIN_MAINNET,
1819
OPTIMISM_SEPOLIA,
@@ -281,6 +282,10 @@ export class Blocklock {
281282
return new Blocklock(rpc, BASE_SEPOLIA)
282283
}
283284

285+
static createBaseMainnet(rpc: Signer | Provider): Blocklock {
286+
return new Blocklock(rpc, BASE_MAINNET)
287+
}
288+
284289
static createPolygonPos(rpc: Signer | Provider): Blocklock {
285290
return new Blocklock(rpc, POLYGON_POS)
286291
}

src/networks.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,30 @@ export const BASE_SEPOLIA: NetworkConfig = {
9191
gasMultiplierDefault: 10n,
9292
}
9393

94+
export const BASE_MAINNET: NetworkConfig = {
95+
name: "base_mainnet",
96+
chainId: 8453n,
97+
contractAddress: "0x8E7D2c0c968B5aCA6f7ce2ffaA76AEcf61235b9F",
98+
publicKey: BLOCKLOCK_MAINNET_PUBLIC_KEY,
99+
ibeOpts: {
100+
hash: keccak_256,
101+
k: 128,
102+
expand_fn: "xmd",
103+
dsts: {
104+
H1_G1: encodeBytes(`BLOCKLOCK_BN254G1_XMD:KECCAK-256_SVDW_RO_H1_0x0000000000000000000000000000000000000000000000000000000000002105_`),
105+
H2: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H2_0x0000000000000000000000000000000000000000000000000000000000002105_`),
106+
H3: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H3_0x0000000000000000000000000000000000000000000000000000000000002105_`),
107+
H4: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H4_0x0000000000000000000000000000000000000000000000000000000000002105_`),
108+
}
109+
},
110+
gasLimit: 100_000,
111+
maxFeePerGas: ethers.parseUnits("0.2", "gwei"),
112+
maxPriorityFeePerGas: ethers.parseUnits("0.2", "gwei"),
113+
gasBufferPercent: 100n,
114+
callbackGasLimitDefault: 1_000_000n,
115+
gasMultiplierDefault: 10n,
116+
}
117+
94118
export const POLYGON_POS: NetworkConfig = {
95119
name: "polygon_pos",
96120
chainId: 137n,

test/integration.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ describe("Blocklock integration tests with supported networks", () => {
3535
await runEncryptionTest(rpc, blocklock)
3636
}, TIMEOUT)
3737

38+
it.skip("should encrypt and decrypt for base mainnet", async () => {
39+
const rpc = createProvider(process.env.BASE_RPC_URL || "")
40+
const wallet = new NonceManager(new Wallet(process.env.BASE_PRIVATE_KEY || "", rpc))
41+
const blocklock = Blocklock.createBaseMainnet(wallet)
42+
await runEncryptionTest(rpc, blocklock)
43+
}, TIMEOUT)
44+
3845
it.skip("should encrypt and decrypt for filecoin mainnet", async () => {
3946
const rpc = createProvider(process.env.FILECOIN_MAINNET_RPC_URL || "")
4047
const wallet = new NonceManager(new Wallet(process.env.FILECOIN_MAINNET_PRIVATE_KEY || "", rpc))

0 commit comments

Comments
 (0)