Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6f3a026
feat(core): optional `shouldAddInputs` for `Transaction.completeFee`
fghdotio Apr 17, 2026
9b4c649
fix(core): `Transaction.clone` should clone inputs' cache
Hanssen0 Jun 13, 2025
5c3ce80
chore: update pnpm `onlyBuiltDependencies`
Hanssen0 Jun 23, 2025
11f2ebf
chore: add google analytics
Hanssen0 Jun 23, 2025
b991113
perf(playground): cache console messages
Hanssen0 Jul 10, 2025
28b0f8f
Simplify MapLru, while improving Complexity (#244)
phroi Aug 8, 2025
07cecb3
feat: add RGB++ known scripts (RgbppLock, BtcTimeLock)
fghdotio Jul 15, 2025
8221a03
Improve performance of Script & OutPoint eq (#248)
phroi Aug 10, 2025
748d48f
fix(core): avoid circular dependency
Hanssen0 Aug 14, 2025
81b2f20
feat(core): `Signer.findCellsOnChain`
Hanssen0 Jun 20, 2025
2c40489
feat(core): auto capacity completion
Hanssen0 Jun 14, 2025
1c58c29
perf(core): optimize Transaction.completeFee
Hanssen0 Jun 14, 2025
2e622db
feat(udt): `Udt.complete*` methods
Hanssen0 Aug 16, 2025
34655a8
feat(core): multiple scripts for `SignerCkbScriptReadonly`
Hanssen0 Aug 17, 2025
55a7823
feat(core): add `CellAny`
Hanssen0 Aug 16, 2025
55ba50f
feat(core): `reduce` and `reduceAsync` for `Iterable`
Hanssen0 Aug 17, 2025
0dd3976
fix(core)!: `getFeeRateStatistics` may returns `null` on devnet
Hanssen0 Aug 20, 2025
9143d3d
feat(core): default `Signer.prepareTransaction`
Hanssen0 Aug 17, 2025
9aa9bd2
Revert "feat(udt): `Udt.complete*` methods"
Hanssen0 Sep 9, 2025
e64753d
Revert "feat: add RGB++ known scripts (RgbppLock, BtcTimeLock)"
Hanssen0 Sep 9, 2025
83f6eb4
feat(core): improve hex utils (#268)
phroi Sep 16, 2025
0b4b112
fix(core): Invalid Uint64 0x00: with redundant leading zeros.
Hanssen0 Sep 18, 2025
5beebca
feat(core): add RGB++ script support to known scripts
fghdotio Dec 30, 2025
25c3e9c
feat: add udt code of @ckb-ccc/rgbpp package
fghdotio Dec 30, 2025
de0cc05
fix(rgbpp): remove duplicate @ckb-lumos deps from devDependencies and…
fghdotio Dec 30, 2025
7223779
refactor: replace custom encoding utilities with `@ckb-ccc/core` and …
fghdotio Feb 11, 2026
aeb3155
refactor: centralize dust limit and fee rate constants, refine RGBPP …
fghdotio Feb 11, 2026
3445b8d
Refactor: Sort `rgbppLiveCells` for consistent processing, remove `re…
fghdotio Feb 11, 2026
f750bf3
refactor: Refactor RGB++ commitment calculation to use partial transa…
fghdotio Feb 11, 2026
de3e36f
refactor: delegate RGBPP script info fetching to script manager, rena…
fghdotio Feb 11, 2026
0d1022f
refactor: enhance OP_RETURN output validation, sequentialize cell inp…
fghdotio Feb 11, 2026
40a870c
feat: rgbpp btc
fghdotio Mar 4, 2026
4f36050
refactor(rgbpp): reorganize udt and bitcoin module
fghdotio Mar 10, 2026
e5055f1
refactor(rgbpp): align package structure with ccc standards
fghdotio Mar 10, 2026
9e9bb1e
refactor: migrate SHA256 implementation from js-sha256 to @noble/hash…
fghdotio Mar 10, 2026
288cd0c
feat: add bitcoinjs-lib dependency to `xverse` package.
fghdotio Mar 10, 2026
d2a8ada
feat: enhance error handling and validation in Bitcoin wallet operati…
fghdotio Mar 11, 2026
b1917ca
refactor: Extract Bitcoin transaction building, fee estimation, and A…
fghdotio Mar 11, 2026
dd6d494
feat: RGBPP unlock signer with SPV proof and BTC transaction data pro…
fghdotio Mar 11, 2026
c08ea45
refactor: split BTC client interface into granular providers
fghdotio Mar 11, 2026
52077b7
feat: add script providers and btc time lock utils
fghdotio Mar 11, 2026
b78b302
feat: Add RGB++ Spore and UDT examples
fghdotio Mar 11, 2026
3efa1af
chore: update pnpm dependencies
fghdotio Mar 11, 2026
01a9210
fix(bitcoin): improve transaction fee estimation and type exports
fghdotio Mar 24, 2026
aeb2ce6
refactor(rgbpp): reorganize modules by domain cohesion
fghdotio Apr 15, 2026
7bded51
refactor(rgbpp): remove redundant NetworkType enum
fghdotio Apr 15, 2026
e3bbf65
refactor(rgbpp): standardize error handling
fghdotio Apr 15, 2026
c534227
fix: resolve conflicts and cleanup codebase after rebase
fghdotio Apr 17, 2026
5b07b9c
feat(rgbpp): upgrade to bitcoinjs-lib v7 and ecpair v3, fix legacy pa…
fghdotio Apr 18, 2026
13bd255
refactor(rgbpp): Implement type-safe .unref() for SPV proof cache cle…
fghdotio Apr 18, 2026
d70ac9e
feat(rgbpp): implement concurrency control and retry logic for BTC tr…
fghdotio Apr 18, 2026
956e3f5
feat(rgbpp): implement configurable logger and replace hardcoded cons…
fghdotio Apr 18, 2026
dc72c80
refactor(rgbpp): split prepareUtxoSeal into composable buildSealPsbt …
fghdotio Apr 29, 2026
75d2cb9
fix(rgbpp): complete barrel exports and move @ckb-ccc/spore to depend…
fghdotio May 12, 2026
1db1545
feat(rgbpp): add spore transfer and leap examples
fghdotio May 12, 2026
f9fb64f
chore(rgbpp): move @ckb-ccc/spore to dependencies
fghdotio May 12, 2026
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
6 changes: 6 additions & 0 deletions .changeset/clean-chefs-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": patch
---

fix(core): avoid circular dependency

6 changes: 6 additions & 0 deletions .changeset/clean-shoes-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": minor
---

feat(core): `Signer.findCellsOnChain`

6 changes: 6 additions & 0 deletions .changeset/curvy-baboons-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": minor
---

feat(core): optional `shouldAddInputs` for `Transaction.completeFee`

6 changes: 6 additions & 0 deletions .changeset/empty-shrimps-buy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": patch
---

perf(core): optimize Transaction.completeFee

6 changes: 6 additions & 0 deletions .changeset/green-news-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": minor
---

feat(core): auto capacity completion

6 changes: 6 additions & 0 deletions .changeset/old-eagles-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": patch
---

feat(core): default `Signer.prepareTransaction`

9 changes: 9 additions & 0 deletions .changeset/salty-apples-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@ckb-ccc/core": minor
"@ckb-ccc/ssri": patch
---

feat(core): add `CellAny`

It's definitely a mistake to name `CellOnChain` `Cell`, but there is nothing we can do with that right now. To avoid more duplicate code, `CellAny` was added to represent a cell that's on-chain or off-chain.

5 changes: 5 additions & 0 deletions .changeset/shiny-ants-say.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-ccc/core": patch
---

`hexFrom` passthru normalized hex and `numToHex` enforce hex normalization
5 changes: 5 additions & 0 deletions .changeset/six-steaks-grab.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-ccc/core": patch
---

Simplify MapLru, while improving Complexity
5 changes: 5 additions & 0 deletions .changeset/sixty-games-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@ckb-ccc/core": major
---

fix(core)!: `getFeeRateStatistics` may returns `null` on devnet
6 changes: 6 additions & 0 deletions .changeset/tangy-memes-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": major
---

feat(core): `reduce` and `reduceAsync` for `Iterable`

6 changes: 6 additions & 0 deletions .changeset/ten-ties-kiss.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": minor
---

feat(core): multiple scripts for `SignerCkbScriptReadonly`

6 changes: 6 additions & 0 deletions .changeset/weak-otters-dance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": patch
---

fix(core): `Transaction.clone` should clone inputs' cache

6 changes: 6 additions & 0 deletions .changeset/wise-news-admire.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ckb-ccc/core": patch
---

fix(core): Invalid Uint64 0x00: with redundant leading zeros.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@
]
},
"packageManager": "pnpm@10.8.1"
}
}
4 changes: 2 additions & 2 deletions packages/core/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ export abstract class Client {

abstract getFeeRateStatistics(
blockRange?: NumLike,
): Promise<{ mean: Num; median: Num }>;
): Promise<{ mean?: Num; median?: Num }>;
async getFeeRate(
blockRange?: NumLike,
options?: { maxFeeRate?: NumLike },
): Promise<Num> {
const feeRate = numMax(
(await this.getFeeRateStatistics(blockRange)).median,
(await this.getFeeRateStatistics(blockRange)).median ?? Zero,
DEFAULT_MIN_FEE_RATE,
);

Expand Down
68 changes: 68 additions & 0 deletions packages/core/src/client/clientPublicMainnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,72 @@ export const MAINNET_SCRIPTS: Record<KnownScript, ScriptInfoLike | undefined> =
},
],
},
[KnownScript.RgbppLock]: {
codeHash:
"0xbc6c568a1a0d0a09f6844dc9d74ddb4343c32143ff25f727c59edf4fb72d6936",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0xcb4d9f9726e66306bfda6359d39d3bea8b4e5345d0f95f26a3e51626ebe82a63",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0x68ad3d9e0bb9ea841a5d1fcd600137bd3f45401e759e353121f26cd0d981452f",
},
},
// Rgbpp lock config cell dep
{
cellDep: {
outPoint: {
txHash:
"0xcb4d9f9726e66306bfda6359d39d3bea8b4e5345d0f95f26a3e51626ebe82a63",
index: 1,
},
depType: "code",
},
},
],
},
[KnownScript.BtcTimeLock]: {
codeHash:
"0x70d64497a075bd651e98ac030455ea200637ee325a12ad08aff03f1a117e5a62",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x3d1c26b966504b09253ad84173bf3baa7b8135c5ff520c32cf70b631c1d08b9b",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0x44b8253ae18e913a2845b0d548eaf6b3ba1099ed26835888932a754194028a8a",
},
},
// btc time lock config cell dep
{
cellDep: {
outPoint: {
txHash:
"0x3d1c26b966504b09253ad84173bf3baa7b8135c5ff520c32cf70b631c1d08b9b",
index: 1,
},
depType: "code",
},
},
],
},
});
68 changes: 68 additions & 0 deletions packages/core/src/client/clientPublicTestnet.advanced.ts
Original file line number Diff line number Diff line change
Expand Up @@ -492,4 +492,72 @@ export const TESTNET_SCRIPTS: Record<KnownScript, ScriptInfoLike> =
},
],
},
[KnownScript.RgbppLock]: {
codeHash:
"0x61ca7a4796a4eb19ca4f0d065cb9b10ddcf002f10f7cbb810c706cb6bb5c3248",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x0d1567da0979f78b297d5311442669fbd1bd853c8be324c5ab6da41e7a1ed6e5",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0xa3bc8441df149def76cfe15fec7b1e51d949548bc27fb7a75e9d4b3ef1c12c7f",
},
},
// Rgbpp lock config cell dep for Bitcoin Testnet3
{
cellDep: {
outPoint: {
txHash:
"0x0d1567da0979f78b297d5311442669fbd1bd853c8be324c5ab6da41e7a1ed6e5",
index: 1,
},
depType: "code",
},
},
],
},
[KnownScript.BtcTimeLock]: {
codeHash:
"0x00cdf8fab0f8ac638758ebf5ea5e4052b1d71e8a77b9f43139718621f6849326",
hashType: "type",
cellDeps: [
{
cellDep: {
outPoint: {
txHash:
"0x8fb747ff0416a43e135c583b028f98c7b81d3770551b196eb7ba1062dd9acc94",
index: 0,
},
depType: "code",
},
type: {
codeHash:
"0x00000000000000000000000000000000000000000000000000545950455f4944",
hashType: "type",
args: "0xc9828585e6dd2afacb9e6e8ca7deb0975121aabee5c7983178a45509ffaec984",
},
},
// btc time lock config cell dep for Bitcoin Testnet3
{
cellDep: {
outPoint: {
txHash:
"0x8fb747ff0416a43e135c583b028f98c7b81d3770551b196eb7ba1062dd9acc94",
index: 1,
},
depType: "code",
},
},
],
},
});
6 changes: 3 additions & 3 deletions packages/core/src/client/jsonRpc/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export abstract class ClientJsonRpc extends Client {
getFeeRateStatistics = this.buildSender(
"get_fee_rate_statistics",
[(n: NumLike) => apply(numFrom, n)],
({ mean, median }: { mean: NumLike; median: NumLike }) => ({
mean: numFrom(mean),
median: numFrom(median),
(res: { mean: NumLike; median: NumLike } | null | undefined) => ({
mean: apply(numFrom, res?.mean),
median: apply(numFrom, res?.median),
}),
) as Client["getFeeRateStatistics"];

Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/client/knownScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ export enum KnownScript {
TypeBurnLock = "TypeBurnLock",
EasyToDiscoverType = "EasyToDiscoverType",
TimeLock = "TimeLock",

// RGB++ related scripts
RgbppLock = "RgbppLock",
BtcTimeLock = "BtcTimeLock",
}
34 changes: 32 additions & 2 deletions packages/core/src/hex/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,33 @@ export type Hex = `0x${string}`;
export type HexLike = BytesLike;

/**
* Converts a HexLike value to a Hex string.
* @public
* Determines whether a given value is a properly formatted hexadecimal string (ccc.Hex).
*
* A valid hexadecimal string:
* - Has at least two characters.
* - Starts with "0x".
* - Has an even length.
* - Contains only characters representing digits (0-9) or lowercase letters (a-f) after the "0x" prefix.
*
* @param v - The value to validate as a hexadecimal (ccc.Hex) string.
* @returns True if the string is a valid hex string, false otherwise.
*/
export function isHex(v: unknown): v is Hex {
if (!(typeof v === "string" && v.length % 2 === 0 && v.startsWith("0x"))) {
return false;
}

for (let i = 2; i < v.length; i++) {
const c = v.charAt(i);
if (!(("0" <= c && c <= "9") || ("a" <= c && c <= "f"))) {
return false;
}
}
return true;
}

/**
* Returns the hexadecimal representation of the given value.
*
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
* @returns A Hex string representing the value.
Expand All @@ -26,5 +51,10 @@ export type HexLike = BytesLike;
* ```
*/
export function hexFrom(hex: HexLike): Hex {
// Passthru an already normalized hex. V8 optimization: maintain existing hidden string fields.
if (isHex(hex)) {
return hex;
}

return `0x${bytesTo(bytesFrom(hex), "hex")}`;
}
21 changes: 17 additions & 4 deletions packages/core/src/num/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Bytes, BytesLike, bytesConcat, bytesFrom } from "../bytes/index.js";
import { Zero } from "../fixedPoint/index.js";
import { Hex, HexLike, hexFrom } from "../hex/index.js";

/**
Expand Down Expand Up @@ -90,19 +91,31 @@ export function numFrom(val: NumLike): Num {
}

/**
* Converts a NumLike value to a hexadecimal string.
* Converts a {@link NumLike} value into its hexadecimal string representation, prefixed with `0x`.
*
* @remarks
* This function returns the direct hexadecimal representation of the number, which may have an odd number of digits.
* For a full-byte representation (an even number of hex digits), consider using {@link numToBytes}, {@link numLeToBytes}, or {@link numBeToBytes} and then converting the resulting byte array to a hex string.
*
* @public
*
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
* @returns A Hex string representing the numeric value.
* @returns A Hex string representing the number.
*
* @throws {Error} If the normalized numeric value is negative.
*
* @example
* ```typescript
* const hex = numToHex(12345); // Outputs "0x3039"
* const hex = numToHex(4660); // "0x1234"
* const oddLengthHex = numToHex(10); // "0xa"
* ```
*/
export function numToHex(val: NumLike): Hex {
return `0x${numFrom(val).toString(16)}`;
const v = numFrom(val);
if (v < Zero) {
throw new Error("value must be non-negative");
}
return `0x${v.toString(16)}`;
}

/**
Expand Down
Loading
Loading