diff --git a/.gitignore b/.gitignore index 489e49f..09ee604 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,6 @@ docs/ # Dotenv file .env + +# MacOS files +.DS_Store diff --git a/blocklock-solidity b/blocklock-solidity index 7395b1d..546c44a 160000 --- a/blocklock-solidity +++ b/blocklock-solidity @@ -1 +1 @@ -Subproject commit 7395b1d610d790fd576bdec817cee09080cfa66a +Subproject commit 546c44a78ea3653a9c0352581e34529b67b89106 diff --git a/package.json b/package.json index 33d16d6..063f432 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blocklock-js", - "version": "0.0.8-rc6", + "version": "1.0.0", "description": "A library for encrypting and decrypting data for the future", "source": "src/index.ts", "main": "./dist/cjs/index.cjs", diff --git a/src/blocklock.ts b/src/blocklock.ts index b93be1a..2c0658a 100644 --- a/src/blocklock.ts +++ b/src/blocklock.ts @@ -13,6 +13,7 @@ import { ARBITRUM_SEPOLIA, AVALANCHE_C_CHAIN, BASE_SEPOLIA, + BASE_MAINNET, FILECOIN_CALIBNET, FILECOIN_MAINNET, OPTIMISM_SEPOLIA, @@ -158,7 +159,7 @@ export class Blocklock { const request = await this.blocklockSender.getRequest.staticCall(requestId) const blockHeight = decodeCondition(request.condition) return { - id: request.decryptionRequestID, + id: request.decryptionRequestId, blockHeight: blockHeight, ciphertext: parseSolidityCiphertext(request.ciphertext) } @@ -174,7 +175,7 @@ export class Blocklock { return new Map(Array.from( requests.map((event) => { - const id = event.args.requestID + const id = event.args.requestId const blockHeight = decodeCondition(event.args.condition) return [id, { @@ -281,6 +282,10 @@ export class Blocklock { return new Blocklock(rpc, BASE_SEPOLIA) } + static createBaseMainnet(rpc: Signer | Provider): Blocklock { + return new Blocklock(rpc, BASE_MAINNET) + } + static createPolygonPos(rpc: Signer | Provider): Blocklock { return new Blocklock(rpc, POLYGON_POS) } diff --git a/src/networks.ts b/src/networks.ts index d91e6a2..54e8be5 100644 --- a/src/networks.ts +++ b/src/networks.ts @@ -23,7 +23,7 @@ export const FILECOIN_CALIBNET: NetworkConfig = { name: "filecoin_calibnet", chainId: 314159n, contractAddress: "0xF00aB3B64c81b6Ce51f8220EB2bFaa2D469cf702", - publicKey: BLOCKLOCK_TESTNET_PUBLIC_KEY, + publicKey: BLOCKLOCK_MAINNET_PUBLIC_KEY, ibeOpts: { hash: keccak_256, k: 128, @@ -91,6 +91,30 @@ export const BASE_SEPOLIA: NetworkConfig = { gasMultiplierDefault: 10n, } +export const BASE_MAINNET: NetworkConfig = { + name: "base_mainnet", + chainId: 8453n, + contractAddress: "0x8E7D2c0c968B5aCA6f7ce2ffaA76AEcf61235b9F", + 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_0x0000000000000000000000000000000000000000000000000000000000002105_`), + H2: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H2_0x0000000000000000000000000000000000000000000000000000000000002105_`), + H3: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H3_0x0000000000000000000000000000000000000000000000000000000000002105_`), + H4: encodeBytes(`BLOCKLOCK_BN254_XMD:KECCAK-256_H4_0x0000000000000000000000000000000000000000000000000000000000002105_`), + } + }, + 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 POLYGON_POS: NetworkConfig = { name: "polygon_pos", chainId: 137n, diff --git a/test/integration.test.ts b/test/integration.test.ts index 38b40a0..ae04ed7 100644 --- a/test/integration.test.ts +++ b/test/integration.test.ts @@ -35,6 +35,13 @@ describe("Blocklock integration tests with supported networks", () => { await runEncryptionTest(rpc, blocklock) }, TIMEOUT) + it.skip("should encrypt and decrypt for base mainnet", async () => { + const rpc = createProvider(process.env.BASE_RPC_URL || "") + const wallet = new NonceManager(new Wallet(process.env.BASE_PRIVATE_KEY || "", rpc)) + const blocklock = Blocklock.createBaseMainnet(wallet) + await runEncryptionTest(rpc, blocklock) + }, TIMEOUT) + it.skip("should encrypt and decrypt for filecoin mainnet", async () => { const rpc = createProvider(process.env.FILECOIN_MAINNET_RPC_URL || "") const wallet = new NonceManager(new Wallet(process.env.FILECOIN_MAINNET_PRIVATE_KEY || "", rpc))