Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ OPTIMISM_SEPOLIA_RPC_URL=https://sepolia.optimism.io
ARBITRUM_SEPOLIA_PRIVATE_KEY=somehexstringwithoutthe0xprefix
ARBITRUM_SEPOLIA_RPC_URL=https://api.zan.top/arb-sepolia

# arbitrum mainnet
ARBITRUM_MAINNET_PRIVATE_KEY=somehexstringwithoutthe0xprefix
ARBITRUM_MAINNET_RPC_URL=wss://arbitrum-one-rpc.publicnode.com

# Sei testnet
SEI_TESTNET_PRIVATE_KEY=somehexstringwithoutthe0xprefix
SEI_TESTNET_RPC_URL=wss://sei-testnet.drpc.org
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ env:
BLS_KEY: ${{ secrets.BLS_KEY }}
ARBITRUM_SEPOLIA_PRIVATE_KEY: ${{ secrets.ARBITRUM_SEPOLIA_PRIVATE_KEY }}
ARBITRUM_SEPOLIA_RPC_URL: ${{ secrets.ARBITRUM_SEPOLIA_RPC_URL }}
ARBITRUM_MAINNET_PRIVATE_KEY: ${{ secrets.ARBITRUM_MAINNET_PRIVATE_KEY }}
ARBITRUM_MAINNET_RPC_URL: ${{ secrets.ARBITRUM_MAINNET_RPC_URL }}
AVALANCHE_C_CHAIN_PRIVATE_KEY: ${{ secrets.AVALANCHE_C_CHAIN_PRIVATE_KEY }}
AVALANCHE_C_CHAIN_RPC_URL: ${{ secrets.AVALANCHE_C_CHAIN_RPC_URL }}
BASE_PRIVATE_KEY: ${{ secrets.BASE_PRIVATE_KEY }}
Expand Down
5 changes: 5 additions & 0 deletions src/blocklock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
configForChainId,
NetworkConfig,
ARBITRUM_SEPOLIA,
ARBITRUM_MAINNET,
AVALANCHE_C_CHAIN,
BASE_SEPOLIA,
BASE_MAINNET,
Expand Down Expand Up @@ -310,6 +311,10 @@ export class Blocklock {
return new Blocklock(rpc, ARBITRUM_SEPOLIA)
}

static createArbitrumMainnet(rpc: Signer | Provider): Blocklock {
return new Blocklock(rpc, ARBITRUM_MAINNET)
}

static createSeiTestnet(rpc: Signer | Provider): Blocklock {
return new Blocklock(rpc, SEI_TESTNET)
}
Expand Down
26 changes: 25 additions & 1 deletion src/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,30 @@ export const OPTIMISM_SEPOLIA: NetworkConfig = {
gasMultiplierDefault: 10n,
}

export const ARBITRUM_MAINNET: NetworkConfig = {
name: "arbitrum_mainnet",
chainId: 42161n,
contractAddress: "0x78ebbbc39f7244bE80C76f11248f5a2645978e25",
publicKey: BLOCKLOCK_MAINNET_PUBLIC_KEY,
ibeOpts: {
hash: keccak_256,
k: 128,
expand_fn: "xmd",
dsts: {
H1_G1: encodeBytes(`BLOCKLOCK_BN254G1_XMD:KECCAK-256_SVDW_RO_H1_0x000000000000000000000000000000000000000000000000000000000000a4b1_`),
H2: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H2_0x000000000000000000000000000000000000000000000000000000000000a4b1_`),
H3: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H3_0x000000000000000000000000000000000000000000000000000000000000a4b1_`),
H4: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H4_0x000000000000000000000000000000000000000000000000000000000000a4b1_`),
}
},
gasLimit: 100_000,
maxFeePerGas: ethers.parseUnits("0.2", "gwei"),
maxPriorityFeePerGas: ethers.parseUnits("0.2", "gwei"),
gasBufferPercent: 100n,
callbackGasLimitDefault: 1_000_000n,
gasMultiplierDefault: 10n,
}

export const ARBITRUM_SEPOLIA: NetworkConfig = {
name: "arbitrum_sepolia",
chainId: 421614n,
Expand Down Expand Up @@ -236,7 +260,7 @@ export const SEI_TESTNET: NetworkConfig = {
}

export const SUPPORTED_TESTNETS = [FILECOIN_CALIBNET, BASE_SEPOLIA, AVALANCHE_C_CHAIN, OPTIMISM_SEPOLIA, ARBITRUM_SEPOLIA, SEI_TESTNET]
export const SUPPORTED_MAINNETS = [FILECOIN_MAINNET, POLYGON_POS]
export const SUPPORTED_MAINNETS = [FILECOIN_MAINNET, POLYGON_POS, ARBITRUM_MAINNET, BASE_MAINNET]

export function configForChainId(chainId: bigint | number | string): NetworkConfig {
chainId = BigInt(chainId)
Expand Down
7 changes: 7 additions & 0 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ describe("Blocklock integration tests with supported networks", () => {
await runEncryptionTest(rpc, blocklock)
}, TIMEOUT)

it.skip("should encrypt and decrypt for arbitrum mainnet", async () => {
const rpc = createProvider(process.env.ARBITRUM_MAINNET_RPC_URL || "")
const wallet = new NonceManager(new Wallet(process.env.ARBITRUM_MAINNET_PRIVATE_KEY || "", rpc))
const blocklock = Blocklock.createArbitrumMainnet(wallet)
await runEncryptionTest(rpc, blocklock)
}, TIMEOUT)

// skipping temporarily because there's some weirdness with their RPC
it.skip("should encrypt and decrypt for sei testnet", async () => {
const rpc = createProvider(process.env.SEI_TESTNET_RPC_URL || "")
Expand Down
Loading