@ckb-ccc/core 1.11.4 → 1.12.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 (64) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/ckb/transaction.d.ts +160 -29
  3. package/dist/ckb/transaction.d.ts.map +1 -1
  4. package/dist/ckb/transaction.js +185 -39
  5. package/dist/client/jsonRpc/client.d.ts +1 -1
  6. package/dist/client/jsonRpc/client.d.ts.map +1 -1
  7. package/dist/client/jsonRpc/client.js +4 -1
  8. package/dist/client/jsonRpc/transformers.d.ts +1 -1
  9. package/dist/client/jsonRpc/transformers.d.ts.map +1 -1
  10. package/dist/client/jsonRpc/transformers.js +2 -1
  11. package/dist/jsonRpc/requestor.js +1 -1
  12. package/dist/molecule/entity.d.ts +3 -3
  13. package/dist/molecule/entity.d.ts.map +1 -1
  14. package/dist/molecule/entity.js +1 -1
  15. package/dist/signer/btc/verify.d.ts +21 -0
  16. package/dist/signer/btc/verify.d.ts.map +1 -1
  17. package/dist/signer/btc/verify.js +38 -2
  18. package/dist/signer/doge/signerDogePrivateKey.d.ts.map +1 -1
  19. package/dist/signer/doge/signerDogePrivateKey.js +2 -2
  20. package/dist/signer/doge/verify.d.ts +12 -1
  21. package/dist/signer/doge/verify.d.ts.map +1 -1
  22. package/dist/signer/doge/verify.js +15 -5
  23. package/dist/signer/nostr/verify.js +4 -4
  24. package/dist/signer/signer/index.d.ts +14 -5
  25. package/dist/signer/signer/index.d.ts.map +1 -1
  26. package/dist/signer/signer/index.js +19 -11
  27. package/dist.commonjs/ckb/transaction.d.ts +160 -29
  28. package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
  29. package/dist.commonjs/ckb/transaction.js +187 -40
  30. package/dist.commonjs/client/jsonRpc/client.d.ts +1 -1
  31. package/dist.commonjs/client/jsonRpc/client.d.ts.map +1 -1
  32. package/dist.commonjs/client/jsonRpc/client.js +4 -1
  33. package/dist.commonjs/client/jsonRpc/transformers.d.ts +1 -1
  34. package/dist.commonjs/client/jsonRpc/transformers.d.ts.map +1 -1
  35. package/dist.commonjs/client/jsonRpc/transformers.js +2 -1
  36. package/dist.commonjs/jsonRpc/requestor.js +1 -1
  37. package/dist.commonjs/molecule/entity.d.ts +3 -3
  38. package/dist.commonjs/molecule/entity.d.ts.map +1 -1
  39. package/dist.commonjs/molecule/entity.js +1 -1
  40. package/dist.commonjs/signer/btc/verify.d.ts +21 -0
  41. package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
  42. package/dist.commonjs/signer/btc/verify.js +40 -2
  43. package/dist.commonjs/signer/doge/signerDogePrivateKey.d.ts.map +1 -1
  44. package/dist.commonjs/signer/doge/signerDogePrivateKey.js +2 -2
  45. package/dist.commonjs/signer/doge/verify.d.ts +12 -1
  46. package/dist.commonjs/signer/doge/verify.d.ts.map +1 -1
  47. package/dist.commonjs/signer/doge/verify.js +15 -4
  48. package/dist.commonjs/signer/nostr/verify.js +5 -5
  49. package/dist.commonjs/signer/signer/index.d.ts +14 -5
  50. package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
  51. package/dist.commonjs/signer/signer/index.js +21 -13
  52. package/package.json +3 -4
  53. package/{prettier.config.mjs → prettier.config.cjs} +2 -4
  54. package/src/ckb/transaction.ts +254 -80
  55. package/src/client/jsonRpc/client.ts +5 -2
  56. package/src/client/jsonRpc/transformers.ts +6 -1
  57. package/src/jsonRpc/requestor.ts +2 -2
  58. package/src/molecule/entity.ts +10 -9
  59. package/src/signer/btc/verify.ts +52 -3
  60. package/src/signer/doge/signerDogePrivateKey.ts +2 -2
  61. package/src/signer/doge/verify.ts +23 -7
  62. package/src/signer/nostr/verify.ts +4 -4
  63. package/src/signer/signer/index.ts +20 -10
  64. /package/{vitest.config.ts → vitest.config.mts} +0 -0
@@ -96,11 +96,12 @@ export abstract class Signer {
96
96
  ): NetworkPreference | undefined {
97
97
  if (
98
98
  currentNetwork !== undefined &&
99
- preferences.some(({ signerType, addressPrefix, network }) => {
100
- signerType === this.type &&
99
+ preferences.some(
100
+ ({ signerType, addressPrefix, network }) =>
101
+ signerType === this.type &&
101
102
  addressPrefix === this.client.addressPrefix &&
102
- network === currentNetwork;
103
- })
103
+ network === currentNetwork,
104
+ )
104
105
  ) {
105
106
  return;
106
107
  }
@@ -459,14 +460,23 @@ export abstract class Signer {
459
460
  }
460
461
 
461
462
  /**
462
- * prepare a transaction before signing. This method is not implemented and should be overridden by subclasses.
463
+ * Prepares a transaction before signing.
464
+ * This method can be overridden by subclasses to perform any necessary steps,
465
+ * such as adding cell dependencies or witnesses, before the transaction is signed.
466
+ * The default implementation converts the {@link TransactionLike} object to a {@link Transaction} object
467
+ * without modification.
463
468
  *
464
- * @param _ - The transaction to prepare, represented as a TransactionLike object.
465
- * @returns A promise that resolves to the prepared Transaction object.
466
- * @throws Will throw an error if not implemented.
469
+ * @remarks
470
+ * Note that this default implementation does not add any cell dependencies or dummy witnesses.
471
+ * This may lead to an underestimation of transaction size and fees if used with methods
472
+ * like `Transaction.completeFee`. Subclasses for signers that are intended to sign
473
+ * transactions should override this method to perform necessary preparations.
474
+ *
475
+ * @param tx - The transaction to prepare.
476
+ * @returns A promise that resolves to the prepared {@link Transaction} object.
467
477
  */
468
- prepareTransaction(_: TransactionLike): Promise<Transaction> {
469
- throw Error("Signer.prepareTransaction not implemented");
478
+ async prepareTransaction(tx: TransactionLike): Promise<Transaction> {
479
+ return Transaction.from(tx);
470
480
  }
471
481
 
472
482
  /**
File without changes