@ckb-ccc/core 1.22.0 → 1.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/dist/advanced.d.mts +1 -1
  3. package/dist/advanced.mjs +1 -1
  4. package/dist/{advancedBarrel-Daj_LJkz.d.mts → advancedBarrel-BBbQZ2OW.d.mts} +480 -379
  5. package/dist/advancedBarrel-BBbQZ2OW.d.mts.map +1 -0
  6. package/dist/advancedBarrel.d.mts +1 -1
  7. package/dist/advancedBarrel.mjs +1 -1
  8. package/dist/barrel-Dz1WLXRX.mjs +7 -0
  9. package/dist/barrel-Dz1WLXRX.mjs.map +1 -0
  10. package/dist/barrel.d.mts +2 -2
  11. package/dist/barrel.mjs +1 -1
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.mjs +1 -1
  14. package/dist/transformers-BHt442Nd.mjs +2 -0
  15. package/dist/transformers-BHt442Nd.mjs.map +1 -0
  16. package/dist.commonjs/advanced.d.ts +1 -1
  17. package/dist.commonjs/advanced.js +1 -1
  18. package/dist.commonjs/{advancedBarrel-CJL3rfuW.d.ts → advancedBarrel-BS4zFcFI.d.ts} +480 -379
  19. package/dist.commonjs/advancedBarrel-BS4zFcFI.d.ts.map +1 -0
  20. package/dist.commonjs/advancedBarrel.d.ts +1 -1
  21. package/dist.commonjs/advancedBarrel.js +1 -1
  22. package/dist.commonjs/{barrel-DZkApbAR.js → barrel-CZYID7jh.js} +10 -10
  23. package/dist.commonjs/barrel-CZYID7jh.js.map +1 -0
  24. package/dist.commonjs/barrel.d.ts +2 -2
  25. package/dist.commonjs/barrel.js +1 -1
  26. package/dist.commonjs/index.d.ts +2 -2
  27. package/dist.commonjs/index.js +1 -1
  28. package/dist.commonjs/transformers-CYUULrnt.js +2 -0
  29. package/dist.commonjs/transformers-CYUULrnt.js.map +1 -0
  30. package/package.json +1 -1
  31. package/src/address/index.ts +32 -4
  32. package/src/ckb/transaction.ts +79 -31
  33. package/src/client/cache/memory.advanced.ts +18 -3
  34. package/src/client/client.ts +41 -2
  35. package/src/client/clientPublicMainnet.ts +9 -2
  36. package/src/client/clientPublicTestnet.ts +9 -2
  37. package/src/client/jsonRpc/client.ts +8 -8
  38. package/src/codec/codec.ts +51 -27
  39. package/src/codec/entity.ts +26 -16
  40. package/src/fixedPoint/index.ts +17 -8
  41. package/src/jsonRpc/transports/webSocket.ts +3 -1
  42. package/src/molecule/codec.ts +437 -202
  43. package/src/utils/index.ts +3 -1
  44. package/dist/advancedBarrel-Daj_LJkz.d.mts.map +0 -1
  45. package/dist/barrel-CFOWSjcM.mjs +0 -7
  46. package/dist/barrel-CFOWSjcM.mjs.map +0 -1
  47. package/dist/transformers-DAMi6ZOq.mjs +0 -2
  48. package/dist/transformers-DAMi6ZOq.mjs.map +0 -1
  49. package/dist.commonjs/advancedBarrel-CJL3rfuW.d.ts.map +0 -1
  50. package/dist.commonjs/barrel-DZkApbAR.js.map +0 -1
  51. package/dist.commonjs/transformers-C6jbFO7W.js +0 -2
  52. package/dist.commonjs/transformers-C6jbFO7W.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,76 @@
1
1
  # @ckb-ccc/core
2
2
 
3
+ ## 1.23.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#575](https://github.com/ckb-devrel/ccc/pull/575) [`bb6cbf4`](https://github.com/ckb-devrel/ccc/commit/bb6cbf4ad68438c84faed61d8516530c643f3f4e) Thanks [@LusoCryptoLabs](https://github.com/LusoCryptoLabs)! - Add `AddressResolver` and `ClientConfig.addressResolver`, so `Address.fromString` can resolve representations it cannot parse, such as names, with a single Client. Passing a prefix-keyed record of Clients to `Address.fromString` is now deprecated; callers supporting multiple prefixes should try each Client themselves.
8
+
9
+ - [#578](https://github.com/ckb-devrel/ccc/pull/578) [`21bf250`](https://github.com/ckb-devrel/ccc/commit/21bf2505cd9992a000da7a0c6a18b78aac67b34a) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Generalize codec decode configuration into composable decode contexts.
10
+
11
+ - Add a backward-compatible `Context` parameter to `Codec` and `CodecLike`.
12
+ - Infer decoder contexts in `Codec.from` and preserve them through mapping APIs.
13
+ - Propagate and combine child contexts across Molecule codec combinators.
14
+ - Forward optional decode contexts through `Entity.decode` and `Entity.fromBytes`.
15
+ - Keep `isExtraFieldIgnored` as Table-specific behavior while supporting deeply nested compatible decoding.
16
+
17
+ - [#573](https://github.com/ckb-devrel/ccc/pull/573) [`8b650f0`](https://github.com/ckb-devrel/ccc/commit/8b650f0f06853923a6fa8cf9202f2854d215cf33) Thanks [@Hanssen0](https://github.com/Hanssen0)! - feat(core): add fixedUnion for fixed-size molecule union compositions
18
+
19
+ - Introduce `mol.fixedUnion` to support fixed-size Molecule union extensions.
20
+ - Require all variants to have the same positive safe integer `byteLength`.
21
+ - Produce fixed-size codec (`byteLength = variantByteLength + 4`) that can be embedded into `mol.struct`, `mol.array`, and produces FixVec binary format in `mol.vector`.
22
+ - Support custom tag ID mappings with strict schema validation.
23
+
24
+ - [#573](https://github.com/ckb-devrel/ccc/pull/573) [`de94e2c`](https://github.com/ckb-devrel/ccc/commit/de94e2c06778af3bcc413dd10f755806874afe45) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core)!: treat molecule union as dynamic-size type
25
+
26
+ **BREAKING CHANGE**: In compliance with the Molecule specification (RFC 0008), standard `mol.union` is now strictly treated as a dynamic-size type (`byteLength` is `undefined`), regardless of whether all variants share identical byte lengths.
27
+
28
+ Impact & Migration:
29
+ - When composed inside `mol.vector`, `mol.vector(mol.union(...))` now produces the canonical Molecule dynamic vector (DynVec) binary layout (`[full_size: uint32][offset_0]...[item_0]...`) instead of fixed vector (FixVec).
30
+ - Standalone encoding/decoding of a union item (`[item_id: uint32][payload]`) is unchanged.
31
+ - Standard `mol.union` can no longer be nested directly inside fixed-size containers (`mol.struct`, `mol.array`, `mol.fixedItemVec`).
32
+ - If you require fixed-size union layout for equal-length variants (FixVec in vector, or embedding in struct/array), use `mol.fixedUnion` (available via `@ckb-ccc/core`).
33
+
34
+ ### Patch Changes
35
+
36
+ - [#577](https://github.com/ckb-devrel/ccc/pull/577) [`b21b27d`](https://github.com/ckb-devrel/ccc/commit/b21b27d4d29484b255d95105f6079ebb688b0e5c) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Deprecate the ineffective `verbosity` and `withCycles` parameters on Client methods.
37
+
38
+ - [#574](https://github.com/ckb-devrel/ccc/pull/574) [`a7bcb6d`](https://github.com/ckb-devrel/ccc/commit/a7bcb6d4db3e5255d9178a654a872050f86523ce) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Fix in-memory cache partial matching to support interior byte sequences.
39
+
40
+ - [#571](https://github.com/ckb-devrel/ccc/pull/571) [`6946dd1`](https://github.com/ckb-devrel/ccc/commit/6946dd123400954a21eccfa71a0fb5b4af271051) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): avoid mutating existing transaction entities during capacity normalization
41
+
42
+ Invalid existing `CellOutput`, `Cell`, `CellAny`, and `Transaction` instances are now reconstructed instead of being repaired in place.
43
+
44
+ - [#573](https://github.com/ckb-devrel/ccc/pull/573) [`3506c09`](https://github.com/ckb-devrel/ccc/commit/3506c09a5d16f4ec33ed379b73951b47434e2370) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Reject zero-size and non-safe-integer parameters in Molecule fixed-size types.
45
+
46
+ - Validate constructor arguments for `mol.fixedItemVec`, `mol.array`, and `mol.struct` with `Number.isSafeInteger(val) && val > 0`.
47
+ - Reject zero-item or non-safe-integer count in `mol.array(itemCodec, 0)`.
48
+ - Reject empty-field structs `mol.struct({})` and structs containing zero-length fields.
49
+ - Validate that cumulative struct byte length and array byte length remain within the JavaScript safe integer range.
50
+
51
+ - [#573](https://github.com/ckb-devrel/ccc/pull/573) [`665931f`](https://github.com/ckb-devrel/ccc/commit/665931f2e040cc19503f4924453cf9d8d8bec5e8) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Validate Molecule Table and DynVec headers and offsets strictly.
52
+
53
+ - Validate header total size matches buffer byte length.
54
+ - Validate field offsets count, 4-byte alignment, non-decreasing order, and offsets within payload bounds.
55
+ - Validate offsets for all fields in the Table header, including trailing fields omitted by the schema for forward compatibility.
56
+ - Disallow non-empty Table schemas from matching empty byte buffers, while properly supporting empty Table schemas.
57
+
58
+ - [#573](https://github.com/ckb-devrel/ccc/pull/573) [`2c91baa`](https://github.com/ckb-devrel/ccc/commit/2c91baaeb7090442264c2067defaa2c34d1d067f) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Validate tag length, schema, and custom field IDs in Molecule Union.
59
+
60
+ - Reject inputs with fewer than 4 bytes during Union decoding.
61
+ - Strictly validate custom variant ID mappings: require unique valid uint32 IDs with an exact key match to the union layout, and reject non-enumerable or prototype-inherited properties.
62
+ - Throw structured and descriptive errors (`unknown union field index ...`) when decoding an unrecognized tag ID.
63
+
64
+ ## 1.22.1
65
+
66
+ ### Patch Changes
67
+
68
+ - [#565](https://github.com/ckb-devrel/ccc/pull/565) [`90891c1`](https://github.com/ckb-devrel/ccc/commit/90891c15049cba439e041acb93868d0d9865d848) Thanks [@Hanssen0](https://github.com/Hanssen0)! - fix(core): ensure fee-completion convergence and prevent sub-occupied outputs
69
+
70
+ - [#567](https://github.com/ckb-devrel/ccc/pull/567) [`5be7663`](https://github.com/ckb-devrel/ccc/commit/5be7663ce5857f75c349d111fd6983396365f308) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Serialize `getFeeRateStatistics` block range parameter to hex to avoid BigInt serialization error.
71
+
72
+ - [#563](https://github.com/ckb-devrel/ccc/pull/563) [`99c24ee`](https://github.com/ckb-devrel/ccc/commit/99c24ee6b93ed909aa601c3b4580732d320c14ec) Thanks [@Hanssen0](https://github.com/Hanssen0)! - Fix `fixedPointFrom` and `fixedPointToString` handling of negative fractional values.
73
+
3
74
  ## 1.22.0
4
75
 
5
76
  ### Minor Changes
@@ -1,2 +1,2 @@
1
- import { A as filterScriptByLenRange, B as addressPayloadFromString, C as CellRecord, D as filterData, Dn as DEFAULT_MIN_FEE_RATE, E as filterCell, En as DEFAULT_MAX_FEE_RATE, F as HASH_TYPE_TO_NUM, Ga as BytesFromEncoding, Gn as SignerJsonRpcInfo, I as NUM_TO_HASH_TYPE, Jn as SignerJsonRpcTransformers, Kn as SignerJsonRpcInfoPayload, L as ADDRESS_BECH32_LIMIT, M as DEP_TYPE_TO_NUM, N as NUM_TO_DEP_TYPE, O as filterNumByRange, On as clientSearchKeyRangeFrom, P as HASH_TYPES, R as AddressFormat, S as MAINNET_SCRIPTS, T as MapLru, Tn as ClientCollectableSearchKeyLike, _ as JsonRpcIndexerSearchKeyTransaction, a as JsonRpcBlock, b as JsonRpcTransaction, c as JsonRpcCellDep, d as JsonRpcDepType, f as JsonRpcHashType, g as JsonRpcIndexerSearchKeyFilter, h as JsonRpcIndexerSearchKey, i as JsonRpcTransformers, j as DEP_TYPES, k as filterScript, l as JsonRpcCellInput, m as JsonRpcIndexerFindTransactionsResponse, n as jsonRpcTransportFromUri, o as JsonRpcBlockHeader, p as JsonRpcIndexerFindTransactionsGroupedResponse, qn as SignerJsonRpcMessageToSign, r as CKB_BLAKE2B_PERSONAL, s as JsonRpcBlockUncle, t as advancedBarrel_d_exports, u as JsonRpcCellOutput, v as JsonRpcOutPoint, w as DEFAULT_CONFIRMED_BLOCK_TIME, wn as ClientCollectableSearchKeyFilterLike, x as TESTNET_SCRIPTS, y as JsonRpcScript, z as addressFromPayload } from "./advancedBarrel-Daj_LJkz.mjs";
1
+ import { A as filterScriptByLenRange, B as addressPayloadFromString, C as CellRecord, D as filterData, Dn as DEFAULT_MAX_FEE_RATE, E as filterCell, En as ClientCollectableSearchKeyLike, F as HASH_TYPE_TO_NUM, I as NUM_TO_HASH_TYPE, Ja as BytesFromEncoding, Jn as SignerJsonRpcMessageToSign, Kn as SignerJsonRpcInfo, L as ADDRESS_BECH32_LIMIT, M as DEP_TYPE_TO_NUM, N as NUM_TO_DEP_TYPE, O as filterNumByRange, On as DEFAULT_MIN_FEE_RATE, P as HASH_TYPES, R as AddressFormat, S as MAINNET_SCRIPTS, T as MapLru, Tn as ClientCollectableSearchKeyFilterLike, Yn as SignerJsonRpcTransformers, _ as JsonRpcIndexerSearchKeyTransaction, a as JsonRpcBlock, b as JsonRpcTransaction, c as JsonRpcCellDep, d as JsonRpcDepType, f as JsonRpcHashType, g as JsonRpcIndexerSearchKeyFilter, h as JsonRpcIndexerSearchKey, i as JsonRpcTransformers, j as DEP_TYPES, k as filterScript, kn as clientSearchKeyRangeFrom, l as JsonRpcCellInput, m as JsonRpcIndexerFindTransactionsResponse, n as jsonRpcTransportFromUri, o as JsonRpcBlockHeader, p as JsonRpcIndexerFindTransactionsGroupedResponse, qn as SignerJsonRpcInfoPayload, r as CKB_BLAKE2B_PERSONAL, s as JsonRpcBlockUncle, t as advancedBarrel_d_exports, u as JsonRpcCellOutput, v as JsonRpcOutPoint, w as DEFAULT_CONFIRMED_BLOCK_TIME, x as TESTNET_SCRIPTS, y as JsonRpcScript, z as addressFromPayload } from "./advancedBarrel-BBbQZ2OW.mjs";
2
2
  export { ADDRESS_BECH32_LIMIT, AddressFormat, BytesFromEncoding, CKB_BLAKE2B_PERSONAL, CellRecord, ClientCollectableSearchKeyFilterLike, ClientCollectableSearchKeyLike, DEFAULT_CONFIRMED_BLOCK_TIME, DEFAULT_MAX_FEE_RATE, DEFAULT_MIN_FEE_RATE, DEP_TYPES, DEP_TYPE_TO_NUM, HASH_TYPES, HASH_TYPE_TO_NUM, JsonRpcBlock, JsonRpcBlockHeader, JsonRpcBlockUncle, JsonRpcCellDep, JsonRpcCellInput, JsonRpcCellOutput, JsonRpcDepType, JsonRpcHashType, JsonRpcIndexerFindTransactionsGroupedResponse, JsonRpcIndexerFindTransactionsResponse, JsonRpcIndexerSearchKey, JsonRpcIndexerSearchKeyFilter, JsonRpcIndexerSearchKeyTransaction, JsonRpcOutPoint, JsonRpcScript, JsonRpcTransaction, JsonRpcTransformers, MAINNET_SCRIPTS, MapLru, NUM_TO_DEP_TYPE, NUM_TO_HASH_TYPE, SignerJsonRpcInfo, SignerJsonRpcInfoPayload, SignerJsonRpcMessageToSign, SignerJsonRpcTransformers, TESTNET_SCRIPTS, addressFromPayload, addressPayloadFromString, advancedBarrel_d_exports as cccA, clientSearchKeyRangeFrom, filterCell, filterData, filterNumByRange, filterScript, filterScriptByLenRange, jsonRpcTransportFromUri };
package/dist/advanced.mjs CHANGED
@@ -1 +1 @@
1
- import{$ as e,Cr as t,H as n,Q as r,U as i,W as a,_ as o,a as s,bt as c,c as l,d as u,et as d,f,g as p,h as m,i as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,v as C,vt as w,yt as T}from"./transformers-DAMi6ZOq.mjs";import{t as E}from"./advancedBarrel.mjs";export{_ as ADDRESS_BECH32_LIMIT,b as AddressFormat,t as CKB_BLAKE2B_PERSONAL,f as DEFAULT_CONFIRMED_BLOCK_TIME,w as DEFAULT_MAX_FEE_RATE,T as DEFAULT_MIN_FEE_RATE,n as DEP_TYPES,i as DEP_TYPE_TO_NUM,r as HASH_TYPES,e as HASH_TYPE_TO_NUM,x as JsonRpcTransformers,u as MAINNET_SCRIPTS,y as MapLru,a as NUM_TO_DEP_TYPE,d as NUM_TO_HASH_TYPE,S as SignerJsonRpcTransformers,v as TESTNET_SCRIPTS,h as addressFromPayload,s as addressPayloadFromString,E as cccA,c as clientSearchKeyRangeFrom,g as filterCell,m as filterData,p as filterNumByRange,o as filterScript,C as filterScriptByLenRange,l as jsonRpcTransportFromUri};
1
+ import{$ as e,H as t,Q as n,U as r,W as i,_ as a,a as o,bt as s,c,d as l,et as u,f as d,g as f,h as p,i as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,v as S,vt as C,wr as w,yt as T}from"./transformers-BHt442Nd.mjs";import{t as E}from"./advancedBarrel.mjs";export{g as ADDRESS_BECH32_LIMIT,y as AddressFormat,w as CKB_BLAKE2B_PERSONAL,d as DEFAULT_CONFIRMED_BLOCK_TIME,C as DEFAULT_MAX_FEE_RATE,T as DEFAULT_MIN_FEE_RATE,t as DEP_TYPES,r as DEP_TYPE_TO_NUM,n as HASH_TYPES,e as HASH_TYPE_TO_NUM,b as JsonRpcTransformers,l as MAINNET_SCRIPTS,v as MapLru,i as NUM_TO_DEP_TYPE,u as NUM_TO_HASH_TYPE,x as SignerJsonRpcTransformers,_ as TESTNET_SCRIPTS,m as addressFromPayload,o as addressPayloadFromString,E as cccA,s as clientSearchKeyRangeFrom,h as filterCell,p as filterData,f as filterNumByRange,a as filterScript,S as filterScriptByLenRange,c as jsonRpcTransportFromUri};