Merge releases/next into release since a minor version has been released#383
Conversation
feat(btc): add PSBT signing and broadcasting support
base32 (RFC 4648 lowercase no-padding) plus argsToDid, didToArgs, and isDidCkb for converting between the 20-byte Type ID args returned by createDidCkb and the human-readable did:ckb URI form per WIP-01. Vitest covers known vectors and edge cases.
…istDidCkbsByLock) findDidCkbCell wraps findSingletonCellByType and decodes DidCkbData. resolveDidCkb takes a did:ckb string instead of raw Type ID args. listDidCkbsByLock enumerates every live DID owned by a lock, useful for wallet/dashboard reverse lookup. Bad cells are skipped rather than fail the whole listing.
Walks backward through the DID cell chain by reading each transferring tx and matching its inputs against the DID Type ID. Returns ordered entries with action (CREATE for fresh mint, MIGRATE for did:plc import, UPDATE for transfers), tx hash, output index, block number, capacity, and decoded DidCkbData. maxSteps caps the walk to prevent runaways.
Minimal did:plc surface scoped to what a did:ckb migration needs. - fetchPlcLog: read the op log from the public PLC directory - getGenesisOperation / getRotationKeys: extract genesis and parse modern (rotationKeys) and legacy (signingKey + recoveryKey) shapes - parseDidKey: decode multicodec-tagged did:key (secp256k1 / p256) - signRotationHash: ECDSA sign a 32-byte CKB tx hash with prehash enabled so SHA-256 is applied internally, matching the on-chain k256/p256 Verifier - verifyPrivateKeyMatch: sanity check before sending Adds @noble/curves as a dependency. Exposed via the ./plc subpath so consumers who only need history or resolution don't pull the curve code into their bundle.
migrateDidCkb wraps createDidCkb and stamps the source did:plc into
the DidCkbDataV1.localId field. Returns the same {tx, id, index}
shape so callers can drop it in wherever createDidCkb fits.
buildMigrationWitness is a pure helper: takes a tx hash, the genesis
PLC operation, and the chosen rotation key, signs the hash via the
PLC subpath, and returns a typed DidCkbWitness ready to be set on
the first input. The curve is inferred from the genesis op's
rotation key unless the caller overrides it.
…ples Three runnable examples for the new did-ckb advanced surface. - resolveDid: resolveDidCkb on a known identifier and listDidCkbsByLock on the signer's address - didHistory: getDidCkbHistory walking the cell chain back to genesis - migrateDid: end-to-end did:plc import via fetchPlcLog, migrateDidCkb, and buildMigrationWitness, including the verifyPrivateKeyMatch sanity check before sending
resolver.test covers findDidCkbCell hit/miss, resolveDidCkb rejecting non-did:ckb strings, and listDidCkbsByLock decoding the cells findCells yields (skipping any without a type script). history.test simulates a three-step cell chain (genesis + two transfers) and asserts the walk returns UPDATE, UPDATE, CREATE newest-first. A second case flips the genesis to MIGRATE when localId is set.
Per Hanssen0's review, switch findPriorDidCell to accept TransactionLike and fetch each input's previous output via input.getCell(client) instead of manually reading prevTx.transaction.outputs[idx]. input.getCell uses the client's cell cache, so repeat walks across the same chain reuse fetched cells instead of redoing getTransaction calls. Inputs whose previous output can't be fetched are skipped rather than aborting the walk.
Per Hanssen0's review on the example, the id field now accepts either a 20-byte Type ID args hex (what createDidCkb returns) or a did:ckb string. Strings are sniffed via isDidCkb and converted with didToArgs; hex inputs go through ccc.hexFrom as before. Test covers the URI input path. Example calls getDidCkbHistory with the did variable directly instead of pre-converting via didToArgs.
Per Hanssen0's review: - resolver.didCkbTypeScript: Script.from already runs args through hexFrom, no need to do it ourselves - examples/migrateDid: WitnessArgs.from accepts a BytesLike for outputType, so witness.toBytes() can go in raw
…y prettier The hexFrom removal in the previous commit shrunk the expression enough that prettier wants the call on one line.
feat(did-ckb): identifier helpers, resolver, history walk, did:plc migration
chore: bump pnpm to v11.8.0
feat: bump @noble packages
chore: bump packages
chore(releases/next): bump packages version
chore(releases/next): bump packages version
|
✅ Deploy Preview for liveccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for docsccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for appccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for apiccc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |

See #341 and #382