Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove peerDependency of toolkit #560

Merged
merged 9 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions .changeset/green-tips-accept.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-lumos/toolkit": patch
---

remove peer dependencies in toolkit
10 changes: 4 additions & 6 deletions packages/toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
4 changes: 2 additions & 2 deletions packages/toolkit/src/normalizers.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
// 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}
*/
function normalizeHexNumber(length) {
return function (debugPath, value) {
if (!(value instanceof ArrayBuffer)) {
let intValue = JSBI.BigInt(value).toString(16);
let intValue = BI.from(value).toHexString();
homura marked this conversation as resolved.
Show resolved Hide resolved
if (intValue.length % 2 !== 0) {
intValue = "0" + intValue;
}
Expand Down
10 changes: 10 additions & 0 deletions packages/toolkit/tests/normailizers.js
Original file line number Diff line number Diff line change
@@ -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();
});
11 changes: 0 additions & 11 deletions packages/toolkit/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import JSBI from "jsbi";

export * as validators from "./validators";

/**
Expand All @@ -17,15 +15,6 @@ export class Reader {
serializeJson(): string;
}

/**
* @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
*/
export function HexStringToBigInt(hexString: string): JSBI;
/**
* @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
*/
export function BigIntToHexString(i: JSBI): string;

/**
* @deprecated please follow the {@link https://lumos-website.vercel.app/migrations/migrate-to-v0.19 migration-guide}
*/
Expand Down
9 changes: 3 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading