diff --git a/.changeset/honest-trainers-remain.md b/.changeset/honest-trainers-remain.md new file mode 100644 index 000000000..967f7c7b1 --- /dev/null +++ b/.changeset/honest-trainers-remain.md @@ -0,0 +1,6 @@ +--- +"@ckb-lumos/common-scripts": minor +"@ckb-lumos/config-manager": minor +--- + +feat: omnilock bitcoin auth message is changed to `CKB (Bitcoin Layer) transaction: 0x` diff --git a/examples/misc/config-manager.ts b/examples/misc/config-manager.ts index 355b56b5f..2b1cf62de 100644 --- a/examples/misc/config-manager.ts +++ b/examples/misc/config-manager.ts @@ -6,13 +6,10 @@ const script = { args: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", }; -/* DEPRECATED: initialize config via env mainnet */ -console.log("deprecated initialize", helpers.generateAddress(script)); - /* initialize config via AGGRON testnet */ config.initializeConfig(config.predefined.AGGRON4); -console.log("testnet address is:", helpers.generateAddress(script)); +console.log("testnet address is:", helpers.encodeToAddress(script)); /* initialize config via LINA testnet */ config.initializeConfig(config.predefined.LINA); -console.log("mainnet address is:", helpers.generateAddress(script)); +console.log("mainnet address is:", helpers.encodeToAddress(script)); diff --git a/packages/common-scripts/src/omnilock-bitcoin.ts b/packages/common-scripts/src/omnilock-bitcoin.ts index ee6d888ea..262adb276 100644 --- a/packages/common-scripts/src/omnilock-bitcoin.ts +++ b/packages/common-scripts/src/omnilock-bitcoin.ts @@ -2,8 +2,8 @@ import { bytes, BytesLike } from "@ckb-lumos/codec"; import { bech32 } from "bech32"; import bs58 from "bs58"; -// https://github.com/XuJiandong/ckb-production-scripts/blob/f884d97963ad553b91bfcc992f68d1ad90f9b244/c/ckb_identity.h#L28 -const BTC_PREFIX = "CKB (Bitcoin Layer-2) transaction: 0x"; +// https://github.com/cryptape/omnilock/blob/9419b7795641da0ade25a04127e25d8a0b709077/c/ckb_identity.h#L28 +const BTC_PREFIX = "CKB (Bitcoin Layer) transaction: 0x"; /** * Decode bitcoin address to public key hash in bytes @@ -28,7 +28,7 @@ export function decodeAddress(address: string): ArrayLike { } } catch { // https://bitcoin.design/guide/glossary/address/#taproot-address---p2tr - if (address.startsWith("bc1q")) { + if (address.startsWith("bc1p")) { throw new Error("Taproot address is not supported yet."); } } diff --git a/packages/common-scripts/tests/inputs.ts b/packages/common-scripts/tests/inputs.ts index 23cfa5007..5c3a4f4a5 100644 --- a/packages/common-scripts/tests/inputs.ts +++ b/packages/common-scripts/tests/inputs.ts @@ -7,7 +7,7 @@ export const charlesOmnilockInputs: Cell[] = [ capacity: "0x174876e800", lock: { codeHash: - "0xd83e7ec3ed31b24f7627af8d05d8da7a87fdf1afa120ef75a5c487464e8472aa", + "0x768f306681da232ceb0b94f436c5f813377179762a831c5ad8797bd4fd2d118d", hashType: "data", args: "0x00e3e0a82b199dceadb55e223c6e4b8e511d57d24900", }, @@ -28,7 +28,7 @@ export const charlesOmnilockInputs: Cell[] = [ capacity: "0x174876e800", lock: { codeHash: - "0xd83e7ec3ed31b24f7627af8d05d8da7a87fdf1afa120ef75a5c487464e8472aa", + "0x768f306681da232ceb0b94f436c5f813377179762a831c5ad8797bd4fd2d118d", hashType: "data", args: "0x00e3e0a82b199dceadb55e223c6e4b8e511d57d24900", }, diff --git a/packages/config-manager/src/predefined.ts b/packages/config-manager/src/predefined.ts index baf283f04..5724bda88 100644 --- a/packages/config-manager/src/predefined.ts +++ b/packages/config-manager/src/predefined.ts @@ -133,7 +133,7 @@ const AGGRON4 = createConfig({ "0xf329effd1c475a2978453c8600e1eaf0bc2087ee093c3ee64cc96ec6847752cb", HASH_TYPE: "type", TX_HASH: - "0xb50ef6f2e9138f4dbca7d5280e10d29c1a65e60e8a574c009a2fa4e4107e0750", + "0x3d4296df1bd2cc2bd3f483f61ab7ebeac462a2f336f2b944168fe6ba5d81c014", INDEX: "0x0", DEP_TYPE: "code", }, diff --git a/packages/debugger/contracts/omni_lock_f884d979 b/packages/debugger/contracts/omni_lock_9419b77 old mode 100644 new mode 100755 similarity index 99% rename from packages/debugger/contracts/omni_lock_f884d979 rename to packages/debugger/contracts/omni_lock_9419b77 index dc3c95f54..8840cbccf Binary files a/packages/debugger/contracts/omni_lock_f884d979 and b/packages/debugger/contracts/omni_lock_9419b77 differ diff --git a/packages/debugger/src/context.ts b/packages/debugger/src/context.ts index 784786f29..8081979f8 100644 --- a/packages/debugger/src/context.ts +++ b/packages/debugger/src/context.ts @@ -155,7 +155,7 @@ export function getDefaultConfig(): { }, OMNILOCK: { depType: "code", - path: path.join(__dirname, "../contracts/omni_lock_f884d979"), + path: path.join(__dirname, "../contracts/omni_lock_9419b77"), }, DAO: { depType: "code",