Skip to content

Commit

Permalink
refactor: use molecule to refactor ckb entities
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanssen0 committed Dec 20, 2024
1 parent 7118921 commit e5964ac
Show file tree
Hide file tree
Showing 16 changed files with 332 additions and 3,004 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/barrel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export * from "./fixedPoint/index.js";
export * from "./hasher/index.js";
export * from "./hex/index.js";
export * from "./keystore/index.js";
export * as mol from "./molecule/index.js";
export * from "./molecule/index.js";
export * from "./num/index.js";
export * from "./signer/index.js";
export * from "./utils/index.js";
34 changes: 34 additions & 0 deletions packages/core/src/bytes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,37 @@ export function bytesFrom(
}
return new Uint8Array(bytes);
}

/**
* Compares two byte-like values for equality.
* @public
*
* @param a - The first byte-like value to compare.
* @param b - The second byte-like value to compare.
* @returns A boolean indicating whether the two byte-like values are equal.
*
* @example
* ```typescript
* bytesEq([1], Uint8Array.from([1])) // true
* ```
*/
export function bytesEq(a: BytesLike, b: BytesLike): boolean {
if (a === b) {
return true;
}

const x = bytesFrom(a);
const y = bytesFrom(b);

if (x.length !== y.length) {
return false;
}

for (let i = 0; i < x.length; i++) {
if (x[i] !== y[i]) {
return false;
}
}

return true;
}
1 change: 0 additions & 1 deletion packages/core/src/ckb/advanced.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export * as moleculeCodecCkb from "./molecule.advanced/index.js";
export * from "./script.advanced.js";
export * from "./transaction.advanced.js";
118 changes: 0 additions & 118 deletions packages/core/src/ckb/molecule.advanced/blockchain.mol

This file was deleted.

Loading

0 comments on commit e5964ac

Please sign in to comment.