diff --git a/packages/toolkit/package.json b/packages/toolkit/package.json index 5953ccc82..f831283e1 100644 --- a/packages/toolkit/package.json +++ b/packages/toolkit/package.json @@ -26,16 +26,14 @@ }, "author": "Xuejie Xiao", "license": "MIT", - "peerDependencies": { - "cross-fetch": "^3.1.4", - "jsbi": "^4.1.0" - }, "publishConfig": { "access": "public" }, + "dependencies": { + "@ckb-lumos/bi": "0.21.0-next.0" + }, "devDependencies": { "@babel/plugin-proposal-export-namespace-from": "^7.18.9", - "@babel/plugin-transform-modules-commonjs": "^7.21.5", - "jsbi": "^4.1.0" + "@babel/plugin-transform-modules-commonjs": "^7.21.5" } } diff --git a/packages/toolkit/src/normalizers.js b/packages/toolkit/src/normalizers.js index d0934fb72..af5581135 100644 --- a/packages/toolkit/src/normalizers.js +++ b/packages/toolkit/src/normalizers.js @@ -10,7 +10,7 @@ // Note this is only used when you need to deal with CKB structures in molecule // format. If you are using RPCs or GraphQL to interact with CKB, chances are you // will not need this package. -import JSBI from "jsbi"; +import { BI } from "@ckb-lumos/bi"; import { Reader } from "./reader"; /** * @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide} @@ -18,7 +18,7 @@ import { Reader } from "./reader"; function normalizeHexNumber(length) { return function (debugPath, value) { if (!(value instanceof ArrayBuffer)) { - let intValue = JSBI.BigInt(value).toString(16); + let intValue = BI.from(value).toHexString(); if (intValue.length % 2 !== 0) { intValue = "0" + intValue; } diff --git a/packages/toolkit/tests/normailizers.js b/packages/toolkit/tests/normailizers.js new file mode 100644 index 000000000..c23c5e87b --- /dev/null +++ b/packages/toolkit/tests/normailizers.js @@ -0,0 +1,10 @@ +const test = require("ava"); +const { normalizers } = require("../lib"); + +test("correct outPoint should pass validation", (t) => { + normalizers.NormalizeOutPoint({ + txHash: `0x${'00'.repeat(32)}`, + index: '0x1', + }); + t.pass(); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f324315a4..a957f8213 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' settings: autoInstallPeers: true @@ -720,9 +720,9 @@ importers: packages/toolkit: dependencies: - cross-fetch: - specifier: ^3.1.4 - version: 3.1.5 + '@ckb-lumos/bi': + specifier: 0.21.0-next.0 + version: link:../bi devDependencies: '@babel/plugin-proposal-export-namespace-from': specifier: ^7.18.9 @@ -730,9 +730,6 @@ importers: '@babel/plugin-transform-modules-commonjs': specifier: ^7.21.5 version: 7.21.5(@babel/core@7.21.8) - jsbi: - specifier: ^4.1.0 - version: 4.1.0 packages/transaction-manager: dependencies: