@ckb-ccc/core 1.14.0 → 1.15.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.
- package/CHANGELOG.md +34 -0
- package/dist/address.advanced-BHxWrbFc.mjs +2 -0
- package/dist/address.advanced-BHxWrbFc.mjs.map +1 -0
- package/dist/advanced.d.mts +1 -1
- package/dist/advanced.mjs +1 -1
- package/{dist.commonjs/advancedBarrel-DRDT4GBS.d.ts → dist/advancedBarrel-Dwyn3WMm.d.mts} +437 -14
- package/dist/advancedBarrel-Dwyn3WMm.d.mts.map +1 -0
- package/dist/advancedBarrel.d.mts +1 -1
- package/dist/advancedBarrel.mjs +1 -1
- package/dist/barrel-DO-IW8Ui.mjs +7 -0
- package/dist/barrel-DO-IW8Ui.mjs.map +1 -0
- package/dist/barrel.d.mts +2 -2
- package/dist/barrel.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist.commonjs/address.advanced-UCU9Hn8t.js +2 -0
- package/dist.commonjs/address.advanced-UCU9Hn8t.js.map +1 -0
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +1 -1
- package/{dist/advancedBarrel-BD7EAPVd.d.mts → dist.commonjs/advancedBarrel-D97MfkUZ.d.ts} +438 -13
- package/dist.commonjs/advancedBarrel-D97MfkUZ.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +1 -1
- package/dist.commonjs/barrel-D5PRJCB6.js +21 -0
- package/dist.commonjs/barrel-D5PRJCB6.js.map +1 -0
- package/dist.commonjs/barrel.d.ts +2 -2
- package/dist.commonjs/barrel.js +1 -1
- package/dist.commonjs/index.d.ts +2 -2
- package/dist.commonjs/index.js +1 -1
- package/package.json +1 -1
- package/src/ckb/transaction.ts +20 -1
- package/src/client/clientPublicMainnet.advanced.ts +17 -0
- package/src/client/clientPublicTestnet.advanced.ts +17 -0
- package/src/client/knownScript.ts +1 -0
- package/src/codec/entity.ts +11 -5
- package/src/hasher/hasherCkb.ts +7 -1
- package/src/hex/index.ts +82 -2
- package/src/num/index.ts +17 -4
- package/src/signer/ckb/index.ts +3 -1
- package/src/signer/ckb/secp256k1Signing.ts +94 -0
- package/src/signer/ckb/signerCkbPrivateKey.ts +6 -11
- package/src/signer/ckb/signerCkbPublicKey.ts +8 -3
- package/src/signer/ckb/signerMultisigCkbPrivateKey.ts +129 -0
- package/src/signer/ckb/signerMultisigCkbReadonly.ts +713 -0
- package/src/signer/signer/index.ts +100 -1
- package/dist/address.advanced-BmJKF_Lg.mjs +0 -2
- package/dist/address.advanced-BmJKF_Lg.mjs.map +0 -1
- package/dist/advancedBarrel-BD7EAPVd.d.mts.map +0 -1
- package/dist/barrel-C-sr5NLL.mjs +0 -7
- package/dist/barrel-C-sr5NLL.mjs.map +0 -1
- package/dist.commonjs/address.advanced-D9nKvIr3.js +0 -2
- package/dist.commonjs/address.advanced-D9nKvIr3.js.map +0 -1
- package/dist.commonjs/advancedBarrel-DRDT4GBS.d.ts.map +0 -1
- package/dist.commonjs/barrel-SuR9mcfv.js +0 -21
- package/dist.commonjs/barrel-SuR9mcfv.js.map +0 -1
- package/src/signer/ckb/verifyCkbSecp256k1.ts +0 -31
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as CellDep, $n as
|
|
2
|
-
export { Address, AddressLike, Bytes, BytesLike, Cell, CellAny, CellAnyLike, CellDep, CellDepInfo, CellDepInfoLike, CellDepLike, CellDepVec, CellInput, CellInputLike, CellInputVec, CellLike, CellOutput, CellOutputLike, CellOutputVec, Client, ClientBlock, ClientBlockHeader, ClientBlockHeaderLike, ClientBlockLike, ClientBlockUncle, ClientBlockUncleLike, ClientCache, ClientCacheMemory, ClientFindCellsResponse, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse, ClientIndexerSearchKey, ClientIndexerSearchKeyFilter, ClientIndexerSearchKeyFilterLike, ClientIndexerSearchKeyLike, ClientIndexerSearchKeyTransaction, ClientIndexerSearchKeyTransactionLike, ClientJsonRpc, ClientJsonRpcConfig, ClientPublicMainnet, ClientPublicTestnet, ClientTransactionResponse, ClientTransactionResponseLike, Codec, CodecBool, CodecByte, CodecByte16, CodecByte32, CodecByte4, CodecByte8, CodecBytes, CodecLike, CodecRaw, CodecUint128, CodecUint128BE, CodecUint128LE, CodecUint16, CodecUint16BE, CodecUint16LE, CodecUint256, CodecUint256BE, CodecUint256LE, CodecUint32, CodecUint32BE, CodecUint32LE, CodecUint512, CodecUint512BE, CodecUint512LE, CodecUint64, CodecUint64BE, CodecUint64LE, CodecUint8, Constructor, DecodedType, DepType, DepTypeCodec, DepTypeLike, EncodableType, Entity, Epoch, EpochLike, ErrorClientBase, ErrorClientBaseLike, ErrorClientDuplicatedTransaction, ErrorClientMaxFeeRateExceeded, ErrorClientRBFRejected, ErrorClientResolveUnknown, ErrorClientVerification, ErrorClientWaitTransactionTimeout, ErrorTransactionInsufficientCapacity, ErrorTransactionInsufficientCoin, FixedPoint, FixedPointLike, HashType, HashTypeCodec, HashTypeLike, Hasher, HasherCkb, HasherKeecak256, Hex, HexLike, InputToSign, InputToSignLike, KnownScript, LumosTransactionSkeletonType, NetworkPreference, NostrEvent, Num, NumLike, One, OutPoint, OutPointLike, OutputsValidator, RawTransaction, RequestorJsonRpc, RequestorJsonRpcConfig, Script, ScriptInfo, ScriptInfoLike, ScriptLike, ScriptOpt, ScriptVec, SignPsbtOptions, SignPsbtOptionsLike, Signature, Signer, SignerAlwaysError, SignerBtc, SignerBtcPublicKeyReadonly, SignerCkbPrivateKey, SignerCkbPublicKey, SignerCkbScriptReadonly, SignerDoge, SignerDogeAddressReadonly, SignerDogePrivateKey, SignerDummy, SignerEvm, SignerEvmAddressReadonly, SignerInfo, SignerNostr, SignerNostrPrivateKey, SignerNostrPublicKeyReadonly, SignerOpenLink, SignerSignType, SignerType, Since, SinceLike, Transaction, TransactionLike, TransactionStatus, Wallet, WitnessArgs, WitnessArgsLike, Zero, apply, btcEcdsaPublicKeyHash, btcP2pkhAddressFromPublicKey, btcPublicKeyFromP2pkhAddress, btcVarLengthBytesFrom, buildNostrEventFromMessage, bytesConcat, bytesConcatTo, bytesEq, bytesFrom, bytesTo, calcDaoClaimEpoch, calcDaoProfit, codec, codecPadding, codecUint, codecUintNumber, depTypeFrom, depTypeFromBytes, depTypeToBytes, epochFrom, epochFromHex, epochToHex, fixedPointFrom, fixedPointToString, gcd, hashCkb, hashTypeFrom, hashTypeFromBytes, hashTypeId, hashTypeToBytes, hexFrom, isDaoOutputLimitExceeded, isWebview, keystoreDecrypt, keystoreEncrypt, messageHashBtcEcdsa, messageHashCkbSecp256k1, messageHashDogeEcdsa, barrel_d_exports as mol, nostrEventHash, numBeFromBytes, numBeToBytes, numFrom, numFromBytes, numLeFromBytes, numLeToBytes, numMax, numMin, numToBytes, numToHex, reduceAsync, sleep, stringify, udtBalanceFrom, verifyMessageBtcEcdsa, verifyMessageCkbSecp256k1, verifyMessageDogeEcdsa, verifyMessageEvmPersonal, verifyMessageJoyId, verifyMessageNostrEvent };
|
|
1
|
+
import { $ as CellDep, $i as AddressLike, $n as SignerCkbPublicKey, $r as CodecByte16, $t as ClientFindCellsResponse, Ai as apply, An as verifyMessageNostrEvent, Ar as RequestorJsonRpc, At as HashTypeCodec, B as ClientPublicTestnet, Bi as numFrom, Bn as SignerDummy, Br as HASH_CKB_SHORT_LENGTH, Bt as Epoch, Ci as CodecUint8, Cr as InputToSign, Ct as depTypeFrom, Di as Entity, Dr as barrel_d_exports, Dt as udtBalanceFrom, Ei as codecUintNumber, Er as SignPsbtOptionsLike, Et as isDaoOutputLimitExceeded, Fi as stringify, Fn as verifyMessageEvmPersonal, Ft as ScriptVec, G as ClientCacheMemory, Gi as numMin, Gn as SignerDoge, Gr as FixedPoint, Gt as CellDepInfo, H as ClientJsonRpc, Hi as numLeFromBytes, Hn as verifyMessageDogeEcdsa, Hr as hashCkb, Ht as epochFrom, Ii as Num, In as SignerEvmAddressReadonly, It as hashTypeFrom, J as ErrorTransactionInsufficientCoin, Ji as Codec, Jn as MultisigCkbWitness, Jr as Zero, Jt as ClientBlockHeader, K as ClientCache, Ki as numToBytes, Kn as verifyMessageJoyId, Kr as FixedPointLike, Kt as CellDepInfoLike, Li as NumLike, Ln as SignerEvm, Lt as hashTypeFromBytes, Mi as isWebview, Mn as SignerNostrPublicKeyReadonly, Mt as Script, Ni as reduceAsync, Nn as NostrEvent, Nt as ScriptLike, Oi as codec, On as buildNostrEventFromMessage, Or as keystoreDecrypt, Ot as LumosTransactionSkeletonType, Pi as sleep, Pn as SignerNostr, Pt as ScriptOpt, Q as CellAnyLike, Qi as Address, Qn as SignerCkbPrivateKey, Qr as CodecByte, Qt as ClientBlockUncleLike, Ri as numBeFromBytes, Rn as SignerOpenLink, Rr as HasherKeecak256, Rt as hashTypeToBytes, Si as CodecUint64LE, Sr as Wallet, St as calcDaoProfit, Ti as codecUint, Tr as SignPsbtOptions, Tt as depTypeToBytes, U as ClientJsonRpcConfig, Ui as numLeToBytes, Un as SignerDogePrivateKey, Ur as hashCkbShort, Ut as epochFromHex, V as ClientPublicMainnet, Vi as numFromBytes, Vn as messageHashDogeEcdsa, Vr as HasherCkb, Vt as EpochLike, W as Client, Wi as numMax, Wn as SignerDogeAddressReadonly, Wr as Hasher, Wt as epochToHex, X as Cell, Xi as DecodedType, Xn as SignerMultisigCkbReadonly, Xr as fixedPointToString, Xt as ClientBlockLike, Y as hashTypeId, Yi as CodecLike, Yn as MultisigCkbWitnessLike, Yr as fixedPointFrom, Yt as ClientBlockHeaderLike, Z as CellAny, Zi as EncodableType, Zn as SignerCkbScriptReadonly, Zr as CodecBool, Zt as ClientBlockUncle, _i as CodecUint512, _n as ErrorClientWaitTransactionTimeout, _r as SignerInfo, _t as Transaction, aa as Bytes, ai as CodecUint128, an as ClientIndexerSearchKeyLike, ar as verifyMessageSecp256k1, at as CellLike, bi as CodecUint64, bn as ScriptInfoLike, br as SignerSignType, bt as WitnessArgsLike, ca as bytesConcatTo, ci as CodecUint16, cn as ClientTransactionResponse, cr as btcPublicKeyFromP2pkhAddress, ct as CellOutputVec, da as bytesTo, di as CodecUint256, dn as ErrorClientBaseLike, dr as verifyMessageBtcEcdsa, dt as DepTypeLike, ea as Hex, ei as CodecByte32, en as ClientFindTransactionsGroupedResponse, er as SECP256K1_SIGNATURE_LENGTH, et as CellDepLike, fi as CodecUint256BE, fn as ErrorClientDuplicatedTransaction, fr as SignerBtcPublicKeyReadonly, ft as OutPoint, gi as CodecUint32LE, gn as ErrorClientVerification, gr as Signer, gt as SinceLike, hi as CodecUint32BE, hn as ErrorClientResolveUnknown, hr as Signature, ht as Since, ia as hexFrom, ii as CodecRaw, in as ClientIndexerSearchKeyFilterLike, ir as verifyMessageCkbSecp256k1, it as CellInputVec, ji as gcd, jn as SignerNostrPrivateKey, jr as RequestorJsonRpcConfig, jt as HashTypeLike, ki as Constructor, kn as nostrEventHash, kr as keystoreEncrypt, kt as HashType, la as bytesEq, li as CodecUint16BE, ln as ClientTransactionResponseLike, lr as btcVarLengthBytesFrom, lt as DepType, mi as CodecUint32, mn as ErrorClientRBFRejected, mr as NetworkPreference, mt as RawTransaction, na as bytesLen, ni as CodecByte8, nn as ClientIndexerSearchKey, nr as recoverMessageSecp256k1, nt as CellInput, oa as BytesLike, oi as CodecUint128BE, on as ClientIndexerSearchKeyTransaction, or as btcEcdsaPublicKeyHash, ot as CellOutput, pi as CodecUint256LE, pn as ErrorClientMaxFeeRateExceeded, pr as SignerBtc, pt as OutPointLike, q as ErrorTransactionInsufficientCapacity, qi as numToHex, qn as SignerMultisigCkbPrivateKey, qr as One, qt as ClientBlock, ra as bytesLenUnsafe, ri as CodecBytes, rn as ClientIndexerSearchKeyFilter, rr as signMessageSecp256k1, rt as CellInputLike, sa as bytesConcat, si as CodecUint128LE, sn as ClientIndexerSearchKeyTransactionLike, sr as btcP2pkhAddressFromPublicKey, st as CellOutputLike, ta as HexLike, ti as CodecByte4, tn as ClientFindTransactionsResponse, tr as messageHashCkbSecp256k1, tt as CellDepVec, ua as bytesFrom, ui as CodecUint16LE, un as ErrorClientBase, ur as messageHashBtcEcdsa, ut as DepTypeCodec, vi as CodecUint512BE, vn as OutputsValidator, vr as SignerMultisig, vt as TransactionLike, wi as codecPadding, wr as InputToSignLike, wt as depTypeFromBytes, xi as CodecUint64BE, xn as TransactionStatus, xr as SignerType, xt as calcDaoClaimEpoch, yi as CodecUint512LE, yn as ScriptInfo, yr as SignerMultisigNotEnoughSignaturesError, yt as WitnessArgs, zi as numBeToBytes, zn as SignerAlwaysError, zr as HASH_CKB_LENGTH, zt as KnownScript } from "./advancedBarrel-D97MfkUZ.js";
|
|
2
|
+
export { Address, AddressLike, Bytes, BytesLike, Cell, CellAny, CellAnyLike, CellDep, CellDepInfo, CellDepInfoLike, CellDepLike, CellDepVec, CellInput, CellInputLike, CellInputVec, CellLike, CellOutput, CellOutputLike, CellOutputVec, Client, ClientBlock, ClientBlockHeader, ClientBlockHeaderLike, ClientBlockLike, ClientBlockUncle, ClientBlockUncleLike, ClientCache, ClientCacheMemory, ClientFindCellsResponse, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse, ClientIndexerSearchKey, ClientIndexerSearchKeyFilter, ClientIndexerSearchKeyFilterLike, ClientIndexerSearchKeyLike, ClientIndexerSearchKeyTransaction, ClientIndexerSearchKeyTransactionLike, ClientJsonRpc, ClientJsonRpcConfig, ClientPublicMainnet, ClientPublicTestnet, ClientTransactionResponse, ClientTransactionResponseLike, Codec, CodecBool, CodecByte, CodecByte16, CodecByte32, CodecByte4, CodecByte8, CodecBytes, CodecLike, CodecRaw, CodecUint128, CodecUint128BE, CodecUint128LE, CodecUint16, CodecUint16BE, CodecUint16LE, CodecUint256, CodecUint256BE, CodecUint256LE, CodecUint32, CodecUint32BE, CodecUint32LE, CodecUint512, CodecUint512BE, CodecUint512LE, CodecUint64, CodecUint64BE, CodecUint64LE, CodecUint8, Constructor, DecodedType, DepType, DepTypeCodec, DepTypeLike, EncodableType, Entity, Epoch, EpochLike, ErrorClientBase, ErrorClientBaseLike, ErrorClientDuplicatedTransaction, ErrorClientMaxFeeRateExceeded, ErrorClientRBFRejected, ErrorClientResolveUnknown, ErrorClientVerification, ErrorClientWaitTransactionTimeout, ErrorTransactionInsufficientCapacity, ErrorTransactionInsufficientCoin, FixedPoint, FixedPointLike, HASH_CKB_LENGTH, HASH_CKB_SHORT_LENGTH, HashType, HashTypeCodec, HashTypeLike, Hasher, HasherCkb, HasherKeecak256, Hex, HexLike, InputToSign, InputToSignLike, KnownScript, LumosTransactionSkeletonType, MultisigCkbWitness, MultisigCkbWitnessLike, NetworkPreference, NostrEvent, Num, NumLike, One, OutPoint, OutPointLike, OutputsValidator, RawTransaction, RequestorJsonRpc, RequestorJsonRpcConfig, SECP256K1_SIGNATURE_LENGTH, Script, ScriptInfo, ScriptInfoLike, ScriptLike, ScriptOpt, ScriptVec, SignPsbtOptions, SignPsbtOptionsLike, Signature, Signer, SignerAlwaysError, SignerBtc, SignerBtcPublicKeyReadonly, SignerCkbPrivateKey, SignerCkbPublicKey, SignerCkbScriptReadonly, SignerDoge, SignerDogeAddressReadonly, SignerDogePrivateKey, SignerDummy, SignerEvm, SignerEvmAddressReadonly, SignerInfo, SignerMultisig, SignerMultisigCkbPrivateKey, SignerMultisigCkbReadonly, SignerMultisigNotEnoughSignaturesError, SignerNostr, SignerNostrPrivateKey, SignerNostrPublicKeyReadonly, SignerOpenLink, SignerSignType, SignerType, Since, SinceLike, Transaction, TransactionLike, TransactionStatus, Wallet, WitnessArgs, WitnessArgsLike, Zero, apply, btcEcdsaPublicKeyHash, btcP2pkhAddressFromPublicKey, btcPublicKeyFromP2pkhAddress, btcVarLengthBytesFrom, buildNostrEventFromMessage, bytesConcat, bytesConcatTo, bytesEq, bytesFrom, bytesLen, bytesLenUnsafe, bytesTo, calcDaoClaimEpoch, calcDaoProfit, codec, codecPadding, codecUint, codecUintNumber, depTypeFrom, depTypeFromBytes, depTypeToBytes, epochFrom, epochFromHex, epochToHex, fixedPointFrom, fixedPointToString, gcd, hashCkb, hashCkbShort, hashTypeFrom, hashTypeFromBytes, hashTypeId, hashTypeToBytes, hexFrom, isDaoOutputLimitExceeded, isWebview, keystoreDecrypt, keystoreEncrypt, messageHashBtcEcdsa, messageHashCkbSecp256k1, messageHashDogeEcdsa, barrel_d_exports as mol, nostrEventHash, numBeFromBytes, numBeToBytes, numFrom, numFromBytes, numLeFromBytes, numLeToBytes, numMax, numMin, numToBytes, numToHex, recoverMessageSecp256k1, reduceAsync, signMessageSecp256k1, sleep, stringify, udtBalanceFrom, verifyMessageBtcEcdsa, verifyMessageCkbSecp256k1, verifyMessageDogeEcdsa, verifyMessageEvmPersonal, verifyMessageJoyId, verifyMessageNostrEvent, verifyMessageSecp256k1 };
|
package/dist.commonjs/barrel.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./address.advanced-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./address.advanced-UCU9Hn8t.js"),t=require("./barrel-D5PRJCB6.js");exports.Address=t.Z,exports.Bytes=e.Zr,exports.Cell=e.a,exports.CellAny=e.o,Object.defineProperty(exports,"CellDep",{enumerable:!0,get:function(){return e.s}}),exports.CellDepInfo=e.nt,exports.CellDepVec=e.c,Object.defineProperty(exports,"CellInput",{enumerable:!0,get:function(){return e.l}}),exports.CellInputVec=e.u,Object.defineProperty(exports,"CellOutput",{enumerable:!0,get:function(){return e.d}}),exports.CellOutputVec=e.f,exports.Client=t.rt,exports.ClientBlock=e.rt,exports.ClientBlockHeader=e.it,exports.ClientBlockUncle=e.at,exports.ClientCache=t.at,exports.ClientCacheMemory=t.it,exports.ClientIndexerSearchKey=e.ot,exports.ClientIndexerSearchKeyFilter=e.st,exports.ClientIndexerSearchKeyTransaction=e.ct,exports.ClientJsonRpc=t.tt,exports.ClientPublicMainnet=t.et,exports.ClientPublicTestnet=t.$,exports.ClientTransactionResponse=e.lt,exports.Codec=e.Xr,exports.CodecBool=e.yn,exports.CodecByte=e.bn,exports.CodecByte16=e.xn,exports.CodecByte32=e.Sn,exports.CodecByte4=e.Cn,exports.CodecByte8=e.wn,exports.CodecBytes=e.Tn,exports.CodecRaw=e.En,exports.CodecUint128=e.Dn,exports.CodecUint128BE=e.On,exports.CodecUint128LE=e.kn,exports.CodecUint16=e.An,exports.CodecUint16BE=e.jn,exports.CodecUint16LE=e.Mn,exports.CodecUint256=e.Nn,exports.CodecUint256BE=e.Pn,exports.CodecUint256LE=e.Fn,exports.CodecUint32=e.In,exports.CodecUint32BE=e.Ln,exports.CodecUint32LE=e.Rn,exports.CodecUint512=e.zn,exports.CodecUint512BE=e.Bn,exports.CodecUint512LE=e.Vn,exports.CodecUint64=e.Hn,exports.CodecUint64BE=e.Un,exports.CodecUint64LE=e.Wn,exports.CodecUint8=e.Gn,exports.DepTypeCodec=e.p,exports.Entity=e.lr,Object.defineProperty(exports,"Epoch",{enumerable:!0,get:function(){return e.xt}}),exports.ErrorClientBase=e.ut,exports.ErrorClientDuplicatedTransaction=e.dt,exports.ErrorClientMaxFeeRateExceeded=e.ft,exports.ErrorClientRBFRejected=e.pt,exports.ErrorClientResolveUnknown=e.mt,exports.ErrorClientVerification=e.ht,exports.ErrorClientWaitTransactionTimeout=e.gt,exports.ErrorTransactionInsufficientCapacity=e.E,exports.ErrorTransactionInsufficientCoin=e.D,exports.HASH_CKB_LENGTH=e.dr,exports.HASH_CKB_SHORT_LENGTH=e.fr,exports.HashTypeCodec=e.j,exports.HasherCkb=e.pr,exports.HasherKeecak256=t.st,exports.InputToSign=t.q,exports.KnownScript=e.J,Object.defineProperty(exports,"MultisigCkbWitness",{enumerable:!0,get:function(){return t.m}}),exports.One=e.ar,Object.defineProperty(exports,"OutPoint",{enumerable:!0,get:function(){return e.m}}),exports.RawTransaction=e.h,exports.RequestorJsonRpc=t.nt,exports.SECP256K1_SIGNATURE_LENGTH=t.F,Object.defineProperty(exports,"Script",{enumerable:!0,get:function(){return e.M}}),exports.ScriptInfo=e._t,exports.ScriptOpt=e.N,exports.ScriptVec=e.P,exports.SignPsbtOptions=t.J,exports.Signature=t.x,exports.Signer=t.S,exports.SignerAlwaysError=t.c,exports.SignerBtc=t.b,exports.SignerBtcPublicKeyReadonly=t.y,exports.SignerCkbPrivateKey=t._,exports.SignerCkbPublicKey=t.v,exports.SignerCkbScriptReadonly=t.g,exports.SignerDoge=t.f,exports.SignerDogeAddressReadonly=t.d,exports.SignerDogePrivateKey=t.u,exports.SignerDummy=t.l,exports.SignerEvm=t.o,exports.SignerEvmAddressReadonly=t.a,exports.SignerInfo=t.C,exports.SignerMultisig=t.w,exports.SignerMultisigCkbPrivateKey=t.p,exports.SignerMultisigCkbReadonly=t.h,exports.SignerMultisigNotEnoughSignaturesError=t.T,exports.SignerNostr=t.i,exports.SignerNostrPrivateKey=t.n,exports.SignerNostrPublicKeyReadonly=t.r,exports.SignerOpenLink=t.s,exports.SignerSignType=t.E,exports.SignerType=t.D,Object.defineProperty(exports,"Since",{enumerable:!0,get:function(){return e.g}}),Object.defineProperty(exports,"Transaction",{enumerable:!0,get:function(){return e._}}),Object.defineProperty(exports,"WitnessArgs",{enumerable:!0,get:function(){return e.v}}),exports.Zero=e.or,exports.apply=e.Et,exports.btcEcdsaPublicKeyHash=t.V,exports.btcP2pkhAddressFromPublicKey=t.H,exports.btcPublicKeyFromP2pkhAddress=t.U,exports.btcVarLengthBytesFrom=t.W,exports.buildNostrEventFromMessage=t.O,exports.bytesConcat=e.Qr,exports.bytesConcatTo=e.$r,exports.bytesEq=e.ei,exports.bytesFrom=e.ti,exports.bytesLen=e._r,exports.bytesLenUnsafe=e.vr,exports.bytesTo=e.ni,exports.calcDaoClaimEpoch=e.y,exports.calcDaoProfit=e.b,exports.codec=e.ur,exports.codecPadding=e.Kn,exports.codecUint=e.qn,exports.codecUintNumber=e.Jn,exports.depTypeFrom=e.x,exports.depTypeFromBytes=e.S,exports.depTypeToBytes=e.C,exports.epochFrom=e.St,exports.epochFromHex=e.Ct,exports.epochToHex=e.wt,exports.fixedPointFrom=e.sr,exports.fixedPointToString=e.cr,exports.gcd=e.Dt,exports.hashCkb=e.mr,exports.hashCkbShort=e.hr,exports.hashTypeFrom=e.F,exports.hashTypeFromBytes=e.I,exports.hashTypeId=t.Q,exports.hashTypeToBytes=e.L,exports.hexFrom=e.yr,exports.isDaoOutputLimitExceeded=e.w,exports.isWebview=e.Ot,exports.keystoreDecrypt=t.Y,exports.keystoreEncrypt=t.X,exports.messageHashBtcEcdsa=t.G,exports.messageHashCkbSecp256k1=t.I,exports.messageHashDogeEcdsa=t.M,Object.defineProperty(exports,"mol",{enumerable:!0,get:function(){return t.ot}}),exports.nostrEventHash=t.k,exports.numBeFromBytes=e.Yn,exports.numBeToBytes=e.Xn,exports.numFrom=e.Zn,exports.numFromBytes=e.Qn,exports.numLeFromBytes=e.$n,exports.numLeToBytes=e.er,exports.numMax=e.tr,exports.numMin=e.nr,exports.numToBytes=e.rr,exports.numToHex=e.ir,exports.recoverMessageSecp256k1=t.L,exports.reduceAsync=e.kt,exports.signMessageSecp256k1=t.R,exports.sleep=e.At,exports.stringify=e.jt,exports.udtBalanceFrom=e.T,exports.verifyMessageBtcEcdsa=t.K,exports.verifyMessageCkbSecp256k1=t.z,exports.verifyMessageDogeEcdsa=t.N,exports.verifyMessageEvmPersonal=t.j,exports.verifyMessageJoyId=t.P,exports.verifyMessageNostrEvent=t.A,exports.verifyMessageSecp256k1=t.B;
|
package/dist.commonjs/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as CellDep, $n as
|
|
2
|
-
export { Address, AddressLike, Bytes, BytesLike, Cell, CellAny, CellAnyLike, CellDep, CellDepInfo, CellDepInfoLike, CellDepLike, CellDepVec, CellInput, CellInputLike, CellInputVec, CellLike, CellOutput, CellOutputLike, CellOutputVec, Client, ClientBlock, ClientBlockHeader, ClientBlockHeaderLike, ClientBlockLike, ClientBlockUncle, ClientBlockUncleLike, ClientCache, ClientCacheMemory, ClientFindCellsResponse, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse, ClientIndexerSearchKey, ClientIndexerSearchKeyFilter, ClientIndexerSearchKeyFilterLike, ClientIndexerSearchKeyLike, ClientIndexerSearchKeyTransaction, ClientIndexerSearchKeyTransactionLike, ClientJsonRpc, ClientJsonRpcConfig, ClientPublicMainnet, ClientPublicTestnet, ClientTransactionResponse, ClientTransactionResponseLike, Codec, CodecBool, CodecByte, CodecByte16, CodecByte32, CodecByte4, CodecByte8, CodecBytes, CodecLike, CodecRaw, CodecUint128, CodecUint128BE, CodecUint128LE, CodecUint16, CodecUint16BE, CodecUint16LE, CodecUint256, CodecUint256BE, CodecUint256LE, CodecUint32, CodecUint32BE, CodecUint32LE, CodecUint512, CodecUint512BE, CodecUint512LE, CodecUint64, CodecUint64BE, CodecUint64LE, CodecUint8, Constructor, DecodedType, DepType, DepTypeCodec, DepTypeLike, EncodableType, Entity, Epoch, EpochLike, ErrorClientBase, ErrorClientBaseLike, ErrorClientDuplicatedTransaction, ErrorClientMaxFeeRateExceeded, ErrorClientRBFRejected, ErrorClientResolveUnknown, ErrorClientVerification, ErrorClientWaitTransactionTimeout, ErrorTransactionInsufficientCapacity, ErrorTransactionInsufficientCoin, FixedPoint, FixedPointLike, HashType, HashTypeCodec, HashTypeLike, Hasher, HasherCkb, HasherKeecak256, Hex, HexLike, InputToSign, InputToSignLike, KnownScript, LumosTransactionSkeletonType, NetworkPreference, NostrEvent, Num, NumLike, One, OutPoint, OutPointLike, OutputsValidator, RawTransaction, RequestorJsonRpc, RequestorJsonRpcConfig, Script, ScriptInfo, ScriptInfoLike, ScriptLike, ScriptOpt, ScriptVec, SignPsbtOptions, SignPsbtOptionsLike, Signature, Signer, SignerAlwaysError, SignerBtc, SignerBtcPublicKeyReadonly, SignerCkbPrivateKey, SignerCkbPublicKey, SignerCkbScriptReadonly, SignerDoge, SignerDogeAddressReadonly, SignerDogePrivateKey, SignerDummy, SignerEvm, SignerEvmAddressReadonly, SignerInfo, SignerNostr, SignerNostrPrivateKey, SignerNostrPublicKeyReadonly, SignerOpenLink, SignerSignType, SignerType, Since, SinceLike, Transaction, TransactionLike, TransactionStatus, Wallet, WitnessArgs, WitnessArgsLike, Zero, apply, btcEcdsaPublicKeyHash, btcP2pkhAddressFromPublicKey, btcPublicKeyFromP2pkhAddress, btcVarLengthBytesFrom, buildNostrEventFromMessage, bytesConcat, bytesConcatTo, bytesEq, bytesFrom, bytesTo, calcDaoClaimEpoch, calcDaoProfit, barrel_d_exports as ccc, codec, codecPadding, codecUint, codecUintNumber, depTypeFrom, depTypeFromBytes, depTypeToBytes, epochFrom, epochFromHex, epochToHex, fixedPointFrom, fixedPointToString, gcd, hashCkb, hashTypeFrom, hashTypeFromBytes, hashTypeId, hashTypeToBytes, hexFrom, isDaoOutputLimitExceeded, isWebview, keystoreDecrypt, keystoreEncrypt, messageHashBtcEcdsa, messageHashCkbSecp256k1, messageHashDogeEcdsa, barrel_d_exports$1 as mol, nostrEventHash, numBeFromBytes, numBeToBytes, numFrom, numFromBytes, numLeFromBytes, numLeToBytes, numMax, numMin, numToBytes, numToHex, reduceAsync, sleep, stringify, udtBalanceFrom, verifyMessageBtcEcdsa, verifyMessageCkbSecp256k1, verifyMessageDogeEcdsa, verifyMessageEvmPersonal, verifyMessageJoyId, verifyMessageNostrEvent };
|
|
1
|
+
import { $ as CellDep, $i as AddressLike, $n as SignerCkbPublicKey, $r as CodecByte16, $t as ClientFindCellsResponse, Ai as apply, An as verifyMessageNostrEvent, Ar as RequestorJsonRpc, At as HashTypeCodec, B as ClientPublicTestnet, Bi as numFrom, Bn as SignerDummy, Br as HASH_CKB_SHORT_LENGTH, Bt as Epoch, Ci as CodecUint8, Cr as InputToSign, Ct as depTypeFrom, Di as Entity, Dn as barrel_d_exports, Dr as barrel_d_exports$1, Dt as udtBalanceFrom, Ei as codecUintNumber, Er as SignPsbtOptionsLike, Et as isDaoOutputLimitExceeded, Fi as stringify, Fn as verifyMessageEvmPersonal, Ft as ScriptVec, G as ClientCacheMemory, Gi as numMin, Gn as SignerDoge, Gr as FixedPoint, Gt as CellDepInfo, H as ClientJsonRpc, Hi as numLeFromBytes, Hn as verifyMessageDogeEcdsa, Hr as hashCkb, Ht as epochFrom, Ii as Num, In as SignerEvmAddressReadonly, It as hashTypeFrom, J as ErrorTransactionInsufficientCoin, Ji as Codec, Jn as MultisigCkbWitness, Jr as Zero, Jt as ClientBlockHeader, K as ClientCache, Ki as numToBytes, Kn as verifyMessageJoyId, Kr as FixedPointLike, Kt as CellDepInfoLike, Li as NumLike, Ln as SignerEvm, Lt as hashTypeFromBytes, Mi as isWebview, Mn as SignerNostrPublicKeyReadonly, Mt as Script, Ni as reduceAsync, Nn as NostrEvent, Nt as ScriptLike, Oi as codec, On as buildNostrEventFromMessage, Or as keystoreDecrypt, Ot as LumosTransactionSkeletonType, Pi as sleep, Pn as SignerNostr, Pt as ScriptOpt, Q as CellAnyLike, Qi as Address, Qn as SignerCkbPrivateKey, Qr as CodecByte, Qt as ClientBlockUncleLike, Ri as numBeFromBytes, Rn as SignerOpenLink, Rr as HasherKeecak256, Rt as hashTypeToBytes, Si as CodecUint64LE, Sr as Wallet, St as calcDaoProfit, Ti as codecUint, Tr as SignPsbtOptions, Tt as depTypeToBytes, U as ClientJsonRpcConfig, Ui as numLeToBytes, Un as SignerDogePrivateKey, Ur as hashCkbShort, Ut as epochFromHex, V as ClientPublicMainnet, Vi as numFromBytes, Vn as messageHashDogeEcdsa, Vr as HasherCkb, Vt as EpochLike, W as Client, Wi as numMax, Wn as SignerDogeAddressReadonly, Wr as Hasher, Wt as epochToHex, X as Cell, Xi as DecodedType, Xn as SignerMultisigCkbReadonly, Xr as fixedPointToString, Xt as ClientBlockLike, Y as hashTypeId, Yi as CodecLike, Yn as MultisigCkbWitnessLike, Yr as fixedPointFrom, Yt as ClientBlockHeaderLike, Z as CellAny, Zi as EncodableType, Zn as SignerCkbScriptReadonly, Zr as CodecBool, Zt as ClientBlockUncle, _i as CodecUint512, _n as ErrorClientWaitTransactionTimeout, _r as SignerInfo, _t as Transaction, aa as Bytes, ai as CodecUint128, an as ClientIndexerSearchKeyLike, ar as verifyMessageSecp256k1, at as CellLike, bi as CodecUint64, bn as ScriptInfoLike, br as SignerSignType, bt as WitnessArgsLike, ca as bytesConcatTo, ci as CodecUint16, cn as ClientTransactionResponse, cr as btcPublicKeyFromP2pkhAddress, ct as CellOutputVec, da as bytesTo, di as CodecUint256, dn as ErrorClientBaseLike, dr as verifyMessageBtcEcdsa, dt as DepTypeLike, ea as Hex, ei as CodecByte32, en as ClientFindTransactionsGroupedResponse, er as SECP256K1_SIGNATURE_LENGTH, et as CellDepLike, fi as CodecUint256BE, fn as ErrorClientDuplicatedTransaction, fr as SignerBtcPublicKeyReadonly, ft as OutPoint, gi as CodecUint32LE, gn as ErrorClientVerification, gr as Signer, gt as SinceLike, hi as CodecUint32BE, hn as ErrorClientResolveUnknown, hr as Signature, ht as Since, ia as hexFrom, ii as CodecRaw, in as ClientIndexerSearchKeyFilterLike, ir as verifyMessageCkbSecp256k1, it as CellInputVec, ji as gcd, jn as SignerNostrPrivateKey, jr as RequestorJsonRpcConfig, jt as HashTypeLike, ki as Constructor, kn as nostrEventHash, kr as keystoreEncrypt, kt as HashType, la as bytesEq, li as CodecUint16BE, ln as ClientTransactionResponseLike, lr as btcVarLengthBytesFrom, lt as DepType, mi as CodecUint32, mn as ErrorClientRBFRejected, mr as NetworkPreference, mt as RawTransaction, na as bytesLen, ni as CodecByte8, nn as ClientIndexerSearchKey, nr as recoverMessageSecp256k1, nt as CellInput, oa as BytesLike, oi as CodecUint128BE, on as ClientIndexerSearchKeyTransaction, or as btcEcdsaPublicKeyHash, ot as CellOutput, pi as CodecUint256LE, pn as ErrorClientMaxFeeRateExceeded, pr as SignerBtc, pt as OutPointLike, q as ErrorTransactionInsufficientCapacity, qi as numToHex, qn as SignerMultisigCkbPrivateKey, qr as One, qt as ClientBlock, ra as bytesLenUnsafe, ri as CodecBytes, rn as ClientIndexerSearchKeyFilter, rr as signMessageSecp256k1, rt as CellInputLike, sa as bytesConcat, si as CodecUint128LE, sn as ClientIndexerSearchKeyTransactionLike, sr as btcP2pkhAddressFromPublicKey, st as CellOutputLike, ta as HexLike, ti as CodecByte4, tn as ClientFindTransactionsResponse, tr as messageHashCkbSecp256k1, tt as CellDepVec, ua as bytesFrom, ui as CodecUint16LE, un as ErrorClientBase, ur as messageHashBtcEcdsa, ut as DepTypeCodec, vi as CodecUint512BE, vn as OutputsValidator, vr as SignerMultisig, vt as TransactionLike, wi as codecPadding, wr as InputToSignLike, wt as depTypeFromBytes, xi as CodecUint64BE, xn as TransactionStatus, xr as SignerType, xt as calcDaoClaimEpoch, yi as CodecUint512LE, yn as ScriptInfo, yr as SignerMultisigNotEnoughSignaturesError, yt as WitnessArgs, zi as numBeToBytes, zn as SignerAlwaysError, zr as HASH_CKB_LENGTH, zt as KnownScript } from "./advancedBarrel-D97MfkUZ.js";
|
|
2
|
+
export { Address, AddressLike, Bytes, BytesLike, Cell, CellAny, CellAnyLike, CellDep, CellDepInfo, CellDepInfoLike, CellDepLike, CellDepVec, CellInput, CellInputLike, CellInputVec, CellLike, CellOutput, CellOutputLike, CellOutputVec, Client, ClientBlock, ClientBlockHeader, ClientBlockHeaderLike, ClientBlockLike, ClientBlockUncle, ClientBlockUncleLike, ClientCache, ClientCacheMemory, ClientFindCellsResponse, ClientFindTransactionsGroupedResponse, ClientFindTransactionsResponse, ClientIndexerSearchKey, ClientIndexerSearchKeyFilter, ClientIndexerSearchKeyFilterLike, ClientIndexerSearchKeyLike, ClientIndexerSearchKeyTransaction, ClientIndexerSearchKeyTransactionLike, ClientJsonRpc, ClientJsonRpcConfig, ClientPublicMainnet, ClientPublicTestnet, ClientTransactionResponse, ClientTransactionResponseLike, Codec, CodecBool, CodecByte, CodecByte16, CodecByte32, CodecByte4, CodecByte8, CodecBytes, CodecLike, CodecRaw, CodecUint128, CodecUint128BE, CodecUint128LE, CodecUint16, CodecUint16BE, CodecUint16LE, CodecUint256, CodecUint256BE, CodecUint256LE, CodecUint32, CodecUint32BE, CodecUint32LE, CodecUint512, CodecUint512BE, CodecUint512LE, CodecUint64, CodecUint64BE, CodecUint64LE, CodecUint8, Constructor, DecodedType, DepType, DepTypeCodec, DepTypeLike, EncodableType, Entity, Epoch, EpochLike, ErrorClientBase, ErrorClientBaseLike, ErrorClientDuplicatedTransaction, ErrorClientMaxFeeRateExceeded, ErrorClientRBFRejected, ErrorClientResolveUnknown, ErrorClientVerification, ErrorClientWaitTransactionTimeout, ErrorTransactionInsufficientCapacity, ErrorTransactionInsufficientCoin, FixedPoint, FixedPointLike, HASH_CKB_LENGTH, HASH_CKB_SHORT_LENGTH, HashType, HashTypeCodec, HashTypeLike, Hasher, HasherCkb, HasherKeecak256, Hex, HexLike, InputToSign, InputToSignLike, KnownScript, LumosTransactionSkeletonType, MultisigCkbWitness, MultisigCkbWitnessLike, NetworkPreference, NostrEvent, Num, NumLike, One, OutPoint, OutPointLike, OutputsValidator, RawTransaction, RequestorJsonRpc, RequestorJsonRpcConfig, SECP256K1_SIGNATURE_LENGTH, Script, ScriptInfo, ScriptInfoLike, ScriptLike, ScriptOpt, ScriptVec, SignPsbtOptions, SignPsbtOptionsLike, Signature, Signer, SignerAlwaysError, SignerBtc, SignerBtcPublicKeyReadonly, SignerCkbPrivateKey, SignerCkbPublicKey, SignerCkbScriptReadonly, SignerDoge, SignerDogeAddressReadonly, SignerDogePrivateKey, SignerDummy, SignerEvm, SignerEvmAddressReadonly, SignerInfo, SignerMultisig, SignerMultisigCkbPrivateKey, SignerMultisigCkbReadonly, SignerMultisigNotEnoughSignaturesError, SignerNostr, SignerNostrPrivateKey, SignerNostrPublicKeyReadonly, SignerOpenLink, SignerSignType, SignerType, Since, SinceLike, Transaction, TransactionLike, TransactionStatus, Wallet, WitnessArgs, WitnessArgsLike, Zero, apply, btcEcdsaPublicKeyHash, btcP2pkhAddressFromPublicKey, btcPublicKeyFromP2pkhAddress, btcVarLengthBytesFrom, buildNostrEventFromMessage, bytesConcat, bytesConcatTo, bytesEq, bytesFrom, bytesLen, bytesLenUnsafe, bytesTo, calcDaoClaimEpoch, calcDaoProfit, barrel_d_exports as ccc, codec, codecPadding, codecUint, codecUintNumber, depTypeFrom, depTypeFromBytes, depTypeToBytes, epochFrom, epochFromHex, epochToHex, fixedPointFrom, fixedPointToString, gcd, hashCkb, hashCkbShort, hashTypeFrom, hashTypeFromBytes, hashTypeId, hashTypeToBytes, hexFrom, isDaoOutputLimitExceeded, isWebview, keystoreDecrypt, keystoreEncrypt, messageHashBtcEcdsa, messageHashCkbSecp256k1, messageHashDogeEcdsa, barrel_d_exports$1 as mol, nostrEventHash, numBeFromBytes, numBeToBytes, numFrom, numFromBytes, numLeFromBytes, numLeToBytes, numMax, numMin, numToBytes, numToHex, recoverMessageSecp256k1, reduceAsync, signMessageSecp256k1, sleep, stringify, udtBalanceFrom, verifyMessageBtcEcdsa, verifyMessageCkbSecp256k1, verifyMessageDogeEcdsa, verifyMessageEvmPersonal, verifyMessageJoyId, verifyMessageNostrEvent, verifyMessageSecp256k1 };
|
package/dist.commonjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./address.advanced-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./address.advanced-UCU9Hn8t.js"),t=require("./barrel-D5PRJCB6.js");exports.Address=t.Z,exports.Bytes=e.Zr,exports.Cell=e.a,exports.CellAny=e.o,Object.defineProperty(exports,"CellDep",{enumerable:!0,get:function(){return e.s}}),exports.CellDepInfo=e.nt,exports.CellDepVec=e.c,Object.defineProperty(exports,"CellInput",{enumerable:!0,get:function(){return e.l}}),exports.CellInputVec=e.u,Object.defineProperty(exports,"CellOutput",{enumerable:!0,get:function(){return e.d}}),exports.CellOutputVec=e.f,exports.Client=t.rt,exports.ClientBlock=e.rt,exports.ClientBlockHeader=e.it,exports.ClientBlockUncle=e.at,exports.ClientCache=t.at,exports.ClientCacheMemory=t.it,exports.ClientIndexerSearchKey=e.ot,exports.ClientIndexerSearchKeyFilter=e.st,exports.ClientIndexerSearchKeyTransaction=e.ct,exports.ClientJsonRpc=t.tt,exports.ClientPublicMainnet=t.et,exports.ClientPublicTestnet=t.$,exports.ClientTransactionResponse=e.lt,exports.Codec=e.Xr,exports.CodecBool=e.yn,exports.CodecByte=e.bn,exports.CodecByte16=e.xn,exports.CodecByte32=e.Sn,exports.CodecByte4=e.Cn,exports.CodecByte8=e.wn,exports.CodecBytes=e.Tn,exports.CodecRaw=e.En,exports.CodecUint128=e.Dn,exports.CodecUint128BE=e.On,exports.CodecUint128LE=e.kn,exports.CodecUint16=e.An,exports.CodecUint16BE=e.jn,exports.CodecUint16LE=e.Mn,exports.CodecUint256=e.Nn,exports.CodecUint256BE=e.Pn,exports.CodecUint256LE=e.Fn,exports.CodecUint32=e.In,exports.CodecUint32BE=e.Ln,exports.CodecUint32LE=e.Rn,exports.CodecUint512=e.zn,exports.CodecUint512BE=e.Bn,exports.CodecUint512LE=e.Vn,exports.CodecUint64=e.Hn,exports.CodecUint64BE=e.Un,exports.CodecUint64LE=e.Wn,exports.CodecUint8=e.Gn,exports.DepTypeCodec=e.p,exports.Entity=e.lr,Object.defineProperty(exports,"Epoch",{enumerable:!0,get:function(){return e.xt}}),exports.ErrorClientBase=e.ut,exports.ErrorClientDuplicatedTransaction=e.dt,exports.ErrorClientMaxFeeRateExceeded=e.ft,exports.ErrorClientRBFRejected=e.pt,exports.ErrorClientResolveUnknown=e.mt,exports.ErrorClientVerification=e.ht,exports.ErrorClientWaitTransactionTimeout=e.gt,exports.ErrorTransactionInsufficientCapacity=e.E,exports.ErrorTransactionInsufficientCoin=e.D,exports.HASH_CKB_LENGTH=e.dr,exports.HASH_CKB_SHORT_LENGTH=e.fr,exports.HashTypeCodec=e.j,exports.HasherCkb=e.pr,exports.HasherKeecak256=t.st,exports.InputToSign=t.q,exports.KnownScript=e.J,Object.defineProperty(exports,"MultisigCkbWitness",{enumerable:!0,get:function(){return t.m}}),exports.One=e.ar,Object.defineProperty(exports,"OutPoint",{enumerable:!0,get:function(){return e.m}}),exports.RawTransaction=e.h,exports.RequestorJsonRpc=t.nt,exports.SECP256K1_SIGNATURE_LENGTH=t.F,Object.defineProperty(exports,"Script",{enumerable:!0,get:function(){return e.M}}),exports.ScriptInfo=e._t,exports.ScriptOpt=e.N,exports.ScriptVec=e.P,exports.SignPsbtOptions=t.J,exports.Signature=t.x,exports.Signer=t.S,exports.SignerAlwaysError=t.c,exports.SignerBtc=t.b,exports.SignerBtcPublicKeyReadonly=t.y,exports.SignerCkbPrivateKey=t._,exports.SignerCkbPublicKey=t.v,exports.SignerCkbScriptReadonly=t.g,exports.SignerDoge=t.f,exports.SignerDogeAddressReadonly=t.d,exports.SignerDogePrivateKey=t.u,exports.SignerDummy=t.l,exports.SignerEvm=t.o,exports.SignerEvmAddressReadonly=t.a,exports.SignerInfo=t.C,exports.SignerMultisig=t.w,exports.SignerMultisigCkbPrivateKey=t.p,exports.SignerMultisigCkbReadonly=t.h,exports.SignerMultisigNotEnoughSignaturesError=t.T,exports.SignerNostr=t.i,exports.SignerNostrPrivateKey=t.n,exports.SignerNostrPublicKeyReadonly=t.r,exports.SignerOpenLink=t.s,exports.SignerSignType=t.E,exports.SignerType=t.D,Object.defineProperty(exports,"Since",{enumerable:!0,get:function(){return e.g}}),Object.defineProperty(exports,"Transaction",{enumerable:!0,get:function(){return e._}}),Object.defineProperty(exports,"WitnessArgs",{enumerable:!0,get:function(){return e.v}}),exports.Zero=e.or,exports.apply=e.Et,exports.btcEcdsaPublicKeyHash=t.V,exports.btcP2pkhAddressFromPublicKey=t.H,exports.btcPublicKeyFromP2pkhAddress=t.U,exports.btcVarLengthBytesFrom=t.W,exports.buildNostrEventFromMessage=t.O,exports.bytesConcat=e.Qr,exports.bytesConcatTo=e.$r,exports.bytesEq=e.ei,exports.bytesFrom=e.ti,exports.bytesLen=e._r,exports.bytesLenUnsafe=e.vr,exports.bytesTo=e.ni,exports.calcDaoClaimEpoch=e.y,exports.calcDaoProfit=e.b,Object.defineProperty(exports,"ccc",{enumerable:!0,get:function(){return t.t}}),exports.codec=e.ur,exports.codecPadding=e.Kn,exports.codecUint=e.qn,exports.codecUintNumber=e.Jn,exports.depTypeFrom=e.x,exports.depTypeFromBytes=e.S,exports.depTypeToBytes=e.C,exports.epochFrom=e.St,exports.epochFromHex=e.Ct,exports.epochToHex=e.wt,exports.fixedPointFrom=e.sr,exports.fixedPointToString=e.cr,exports.gcd=e.Dt,exports.hashCkb=e.mr,exports.hashCkbShort=e.hr,exports.hashTypeFrom=e.F,exports.hashTypeFromBytes=e.I,exports.hashTypeId=t.Q,exports.hashTypeToBytes=e.L,exports.hexFrom=e.yr,exports.isDaoOutputLimitExceeded=e.w,exports.isWebview=e.Ot,exports.keystoreDecrypt=t.Y,exports.keystoreEncrypt=t.X,exports.messageHashBtcEcdsa=t.G,exports.messageHashCkbSecp256k1=t.I,exports.messageHashDogeEcdsa=t.M,Object.defineProperty(exports,"mol",{enumerable:!0,get:function(){return t.ot}}),exports.nostrEventHash=t.k,exports.numBeFromBytes=e.Yn,exports.numBeToBytes=e.Xn,exports.numFrom=e.Zn,exports.numFromBytes=e.Qn,exports.numLeFromBytes=e.$n,exports.numLeToBytes=e.er,exports.numMax=e.tr,exports.numMin=e.nr,exports.numToBytes=e.rr,exports.numToHex=e.ir,exports.recoverMessageSecp256k1=t.L,exports.reduceAsync=e.kt,exports.signMessageSecp256k1=t.R,exports.sleep=e.At,exports.stringify=e.jt,exports.udtBalanceFrom=e.T,exports.verifyMessageBtcEcdsa=t.K,exports.verifyMessageCkbSecp256k1=t.z,exports.verifyMessageDogeEcdsa=t.N,exports.verifyMessageEvmPersonal=t.j,exports.verifyMessageJoyId=t.P,exports.verifyMessageNostrEvent=t.A,exports.verifyMessageSecp256k1=t.B;
|
package/package.json
CHANGED
package/src/ckb/transaction.ts
CHANGED
|
@@ -1768,10 +1768,29 @@ export class Transaction extends Entity.Base<TransactionLike, Transaction>() {
|
|
|
1768
1768
|
*
|
|
1769
1769
|
* @example
|
|
1770
1770
|
* ```typescript
|
|
1771
|
-
* const witnessArgs =
|
|
1771
|
+
* const witnessArgs = tx.getWitnessArgsAt(0);
|
|
1772
1772
|
* ```
|
|
1773
1773
|
*/
|
|
1774
1774
|
getWitnessArgsAt(index: number): WitnessArgs | undefined {
|
|
1775
|
+
try {
|
|
1776
|
+
return this.getWitnessArgsAtUnsafe(index);
|
|
1777
|
+
} catch (_) {
|
|
1778
|
+
return undefined;
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* Get witness at index as WitnessArgs, throw if failed to decode
|
|
1784
|
+
*
|
|
1785
|
+
* @param index - The index of the witness.
|
|
1786
|
+
* @returns The witness parsed as WitnessArgs.
|
|
1787
|
+
*
|
|
1788
|
+
* @example
|
|
1789
|
+
* ```typescript
|
|
1790
|
+
* const witnessArgs = tx.getWitnessArgsAtUnsafe(0);
|
|
1791
|
+
* ```
|
|
1792
|
+
*/
|
|
1793
|
+
getWitnessArgsAtUnsafe(index: number): WitnessArgs | undefined {
|
|
1775
1794
|
const rawWitness = this.witnesses[index];
|
|
1776
1795
|
return (rawWitness ?? "0x") !== "0x"
|
|
1777
1796
|
? WitnessArgs.fromBytes(rawWitness)
|
|
@@ -54,6 +54,23 @@ export const MAINNET_SCRIPTS: Record<KnownScript, ScriptInfoLike | undefined> =
|
|
|
54
54
|
},
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
|
+
[KnownScript.Secp256k1MultisigV2Beta]: {
|
|
58
|
+
codeHash:
|
|
59
|
+
"0xd1a9f877aed3f5e07cb9c52b61ab96d06f250ae6883cc7f0a2423db0976fc821",
|
|
60
|
+
hashType: "type",
|
|
61
|
+
cellDeps: [
|
|
62
|
+
{
|
|
63
|
+
cellDep: {
|
|
64
|
+
outPoint: {
|
|
65
|
+
txHash:
|
|
66
|
+
"0x44be4f4feda80c0e41783ab10e191df3b2bb5c3731b0970c916dbec385dcdc60",
|
|
67
|
+
index: 0,
|
|
68
|
+
},
|
|
69
|
+
depType: "depGroup",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
57
74
|
[KnownScript.Secp256k1MultisigV2]: {
|
|
58
75
|
codeHash:
|
|
59
76
|
"0x36c971b8d41fbd94aabca77dc75e826729ac98447b46f91e00796155dddb0d29",
|
|
@@ -54,6 +54,23 @@ export const TESTNET_SCRIPTS: Record<KnownScript, ScriptInfoLike> =
|
|
|
54
54
|
},
|
|
55
55
|
],
|
|
56
56
|
},
|
|
57
|
+
[KnownScript.Secp256k1MultisigV2Beta]: {
|
|
58
|
+
codeHash:
|
|
59
|
+
"0x765b3ed6ae264b335d07e73ac332bf2c0f38f8d3340ed521cb447b4c42dd5f09",
|
|
60
|
+
hashType: "type",
|
|
61
|
+
cellDeps: [
|
|
62
|
+
{
|
|
63
|
+
cellDep: {
|
|
64
|
+
outPoint: {
|
|
65
|
+
txHash:
|
|
66
|
+
"0xf2013f123b2cb745e3fdf5c935a3925647496f88090503eef58332a9245b4172",
|
|
67
|
+
index: 0,
|
|
68
|
+
},
|
|
69
|
+
depType: "depGroup",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
},
|
|
57
74
|
[KnownScript.Secp256k1MultisigV2]: {
|
|
58
75
|
codeHash:
|
|
59
76
|
"0x36c971b8d41fbd94aabca77dc75e826729ac98447b46f91e00796155dddb0d29",
|
|
@@ -5,6 +5,7 @@ export enum KnownScript {
|
|
|
5
5
|
NervosDao = "NervosDao",
|
|
6
6
|
Secp256k1Blake160 = "Secp256k1Blake160",
|
|
7
7
|
Secp256k1Multisig = "Secp256k1Multisig",
|
|
8
|
+
Secp256k1MultisigV2Beta = "Secp256k1MultisigV2Beta", // Fix rare failing case (https://github.com/nervosnetwork/ckb-system-scripts/pull/98)
|
|
8
9
|
Secp256k1MultisigV2 = "Secp256k1MultisigV2", // Enhanced since handling (https://github.com/nervosnetwork/ckb-system-scripts/pull/99)
|
|
9
10
|
AnyoneCanPay = "AnyoneCanPay",
|
|
10
11
|
TypeId = "TypeId",
|
package/src/codec/entity.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Bytes, bytesEq, BytesLike } from "../bytes/index.js";
|
|
1
|
+
import { Bytes, bytesEq, bytesFrom, BytesLike } from "../bytes/index.js";
|
|
2
2
|
import { hashCkb } from "../hasher/index.js";
|
|
3
3
|
import { Hex, hexFrom } from "../hex/index.js";
|
|
4
4
|
import { Constructor } from "../utils/index.js";
|
|
5
|
-
import { Codec } from "./codec.js";
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* The base class of CCC to create a serializable instance. This should be used with the {@link codec} decorator.
|
|
@@ -170,7 +169,14 @@ export function codec<
|
|
|
170
169
|
Encodable,
|
|
171
170
|
TypeLike extends Encodable,
|
|
172
171
|
Decoded extends TypeLike,
|
|
173
|
-
>(codec:
|
|
172
|
+
>(codec: {
|
|
173
|
+
encode: (encodable: Encodable) => Bytes;
|
|
174
|
+
decode: (
|
|
175
|
+
decodable: Bytes,
|
|
176
|
+
config?: { isExtraFieldIgnored?: boolean },
|
|
177
|
+
) => Decoded;
|
|
178
|
+
byteLength?: number;
|
|
179
|
+
}) {
|
|
174
180
|
return function <
|
|
175
181
|
Type extends TypeLike,
|
|
176
182
|
ConstructorType extends Constructor<Type> & {
|
|
@@ -189,12 +195,12 @@ export function codec<
|
|
|
189
195
|
}
|
|
190
196
|
if (Constructor.decode === undefined) {
|
|
191
197
|
Constructor.decode = function (bytesLike: BytesLike) {
|
|
192
|
-
return Constructor.from(codec.decode(bytesLike));
|
|
198
|
+
return Constructor.from(codec.decode(bytesFrom(bytesLike)));
|
|
193
199
|
};
|
|
194
200
|
}
|
|
195
201
|
if (Constructor.fromBytes === undefined) {
|
|
196
202
|
Constructor.fromBytes = function (bytes: BytesLike) {
|
|
197
|
-
return Constructor.from(codec.decode(bytes));
|
|
203
|
+
return Constructor.from(codec.decode(bytesFrom(bytes)));
|
|
198
204
|
};
|
|
199
205
|
}
|
|
200
206
|
|
package/src/hasher/hasherCkb.ts
CHANGED
|
@@ -4,6 +4,9 @@ import { Hex, hexFrom } from "../hex/index.js";
|
|
|
4
4
|
import { CKB_BLAKE2B_PERSONAL } from "./advanced.js";
|
|
5
5
|
import { Hasher } from "./hasher.js";
|
|
6
6
|
|
|
7
|
+
export const HASH_CKB_LENGTH = 32;
|
|
8
|
+
export const HASH_CKB_SHORT_LENGTH = 20;
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* @public
|
|
9
12
|
*/
|
|
@@ -73,9 +76,12 @@ export class HasherCkb implements Hasher {
|
|
|
73
76
|
* const hash = hashCkb("some data"); // Outputs something like "0x..."
|
|
74
77
|
* ```
|
|
75
78
|
*/
|
|
76
|
-
|
|
77
79
|
export function hashCkb(...data: BytesLike[]): Hex {
|
|
78
80
|
const hasher = new HasherCkb();
|
|
79
81
|
data.forEach((d) => hasher.update(d));
|
|
80
82
|
return hasher.digest();
|
|
81
83
|
}
|
|
84
|
+
|
|
85
|
+
export function hashCkbShort(...data: BytesLike[]): Hex {
|
|
86
|
+
return hashCkb(...data).slice(0, HASH_CKB_SHORT_LENGTH * 2 + 2) as Hex;
|
|
87
|
+
}
|
package/src/hex/index.ts
CHANGED
|
@@ -13,8 +13,33 @@ export type Hex = `0x${string}`;
|
|
|
13
13
|
export type HexLike = BytesLike;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
16
|
+
* Determines whether a given value is a properly formatted hexadecimal string (ccc.Hex).
|
|
17
|
+
*
|
|
18
|
+
* A valid hexadecimal string:
|
|
19
|
+
* - Has at least two characters.
|
|
20
|
+
* - Starts with "0x".
|
|
21
|
+
* - Has an even length.
|
|
22
|
+
* - Contains only characters representing digits (0-9) or lowercase letters (a-f) after the "0x" prefix.
|
|
23
|
+
*
|
|
24
|
+
* @param v - The value to validate as a hexadecimal (ccc.Hex) string.
|
|
25
|
+
* @returns True if the string is a valid hex string, false otherwise.
|
|
26
|
+
*/
|
|
27
|
+
function isNormalizedHex(v: unknown): v is Hex {
|
|
28
|
+
if (!(typeof v === "string" && v.length % 2 === 0 && v.startsWith("0x"))) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
for (let i = 2; i < v.length; i++) {
|
|
33
|
+
const c = v.charAt(i);
|
|
34
|
+
if (!(("0" <= c && c <= "9") || ("a" <= c && c <= "f"))) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Returns the hexadecimal representation of the given value.
|
|
18
43
|
*
|
|
19
44
|
* @param hex - The value to convert, which can be a string, Uint8Array, ArrayBuffer, or number array.
|
|
20
45
|
* @returns A Hex string representing the value.
|
|
@@ -26,5 +51,60 @@ export type HexLike = BytesLike;
|
|
|
26
51
|
* ```
|
|
27
52
|
*/
|
|
28
53
|
export function hexFrom(hex: HexLike): Hex {
|
|
54
|
+
// Pass through already-normalized hex to avoid allocating a new string.
|
|
55
|
+
if (isNormalizedHex(hex)) {
|
|
56
|
+
return hex;
|
|
57
|
+
}
|
|
58
|
+
|
|
29
59
|
return `0x${bytesTo(bytesFrom(hex), "hex")}`;
|
|
30
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Return the number of bytes occupied by `hexLike`.
|
|
64
|
+
*
|
|
65
|
+
* @param hexLike - Hex-like value
|
|
66
|
+
* @returns Byte length of `hexLike`.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* bytesLen("0x48656c6c6f") // 5
|
|
71
|
+
* bytesLen(new Uint8Array([1, 2, 3])) // 3
|
|
72
|
+
* bytesLen(new ArrayBuffer(4)) // 4
|
|
73
|
+
* bytesLen([1, 2]) // 2
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @see bytesLenUnsafe - Fast version for already-normalized Hex strings
|
|
77
|
+
*
|
|
78
|
+
* @note Prefer direct `.length`/`.byteLength` access on Uint8Array/ArrayBuffer when you already have bytes.
|
|
79
|
+
* Use `bytesLen()` only when you need length without performing additional operations.
|
|
80
|
+
* @see bytesFrom - Convert values to Bytes (Uint8Array)
|
|
81
|
+
*/
|
|
82
|
+
export function bytesLen(hexLike: HexLike): number {
|
|
83
|
+
if (isNormalizedHex(hexLike)) {
|
|
84
|
+
return bytesLenUnsafe(hexLike);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return bytesFrom(hexLike).length;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Fast byte length for Hex strings.
|
|
92
|
+
*
|
|
93
|
+
* This function efficiently calculates the byte length of Hex values:
|
|
94
|
+
* - Skips validation (caller must ensure input is valid Hex)
|
|
95
|
+
* - Handles odd-digit hex as if it were padded with a leading zero (e.g., "0x123" is treated as "0x0123").
|
|
96
|
+
*
|
|
97
|
+
* @param hex - A valid Hex string (with "0x" prefix).
|
|
98
|
+
* @returns Byte length of the hex string.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```typescript
|
|
102
|
+
* bytesLenUnsafe("0x48656c6c6f") // 5
|
|
103
|
+
* bytesLenUnsafe("0x123") // 2 (odd digits round up via padding)
|
|
104
|
+
* ```
|
|
105
|
+
*
|
|
106
|
+
* @see bytesLen - Validated version for untrusted input
|
|
107
|
+
*/
|
|
108
|
+
export function bytesLenUnsafe(hex: Hex): number {
|
|
109
|
+
return Math.floor((hex.length - 1) / 2);
|
|
110
|
+
}
|
package/src/num/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Bytes, BytesLike, bytesConcat, bytesFrom } from "../bytes/index.js";
|
|
2
|
+
import { Zero } from "../fixedPoint/index.js";
|
|
2
3
|
import { Hex, HexLike, hexFrom } from "../hex/index.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -90,19 +91,31 @@ export function numFrom(val: NumLike): Num {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
/**
|
|
93
|
-
* Converts a NumLike value
|
|
94
|
+
* Converts a {@link NumLike} value into its hexadecimal string representation, prefixed with `0x`.
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* This function returns the direct hexadecimal representation of the number, which may have an odd number of digits.
|
|
98
|
+
* 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.
|
|
99
|
+
*
|
|
94
100
|
* @public
|
|
95
101
|
*
|
|
96
102
|
* @param val - The value to convert, which can be a string, number, bigint, or HexLike.
|
|
97
|
-
* @returns A Hex string representing the
|
|
103
|
+
* @returns A Hex string representing the number.
|
|
104
|
+
*
|
|
105
|
+
* @throws {Error} If the normalized numeric value is negative.
|
|
98
106
|
*
|
|
99
107
|
* @example
|
|
100
108
|
* ```typescript
|
|
101
|
-
* const hex = numToHex(
|
|
109
|
+
* const hex = numToHex(4660); // "0x1234"
|
|
110
|
+
* const oddLengthHex = numToHex(10); // "0xa"
|
|
102
111
|
* ```
|
|
103
112
|
*/
|
|
104
113
|
export function numToHex(val: NumLike): Hex {
|
|
105
|
-
|
|
114
|
+
const v = numFrom(val);
|
|
115
|
+
if (v < Zero) {
|
|
116
|
+
throw new Error("value must be non-negative");
|
|
117
|
+
}
|
|
118
|
+
return `0x${v.toString(16)}`;
|
|
106
119
|
}
|
|
107
120
|
|
|
108
121
|
/**
|
package/src/signer/ckb/index.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
export * from "./secp256k1Signing.js";
|
|
1
2
|
export * from "./signerCkbPrivateKey.js";
|
|
2
3
|
export * from "./signerCkbPublicKey.js";
|
|
3
4
|
export * from "./signerCkbScriptReadonly.js";
|
|
4
|
-
export * from "./
|
|
5
|
+
export * from "./signerMultisigCkbPrivateKey.js";
|
|
6
|
+
export * from "./signerMultisigCkbReadonly.js";
|
|
5
7
|
export * from "./verifyJoyId.js";
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
|
+
import { bytesConcat, bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
|
+
import { hashCkb } from "../../hasher/index.js";
|
|
4
|
+
import { Hex, hexFrom } from "../../hex/index.js";
|
|
5
|
+
|
|
6
|
+
export const SECP256K1_SIGNATURE_LENGTH = 65;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Sign a message using Secp256k1.
|
|
10
|
+
*
|
|
11
|
+
* @param message - The message to sign.
|
|
12
|
+
* @param privateKey - The private key.
|
|
13
|
+
* @returns The signature.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export function signMessageSecp256k1(
|
|
17
|
+
message: BytesLike,
|
|
18
|
+
privateKey: BytesLike,
|
|
19
|
+
): Hex {
|
|
20
|
+
const signature = secp256k1.sign(bytesFrom(message), bytesFrom(privateKey), {
|
|
21
|
+
format: "recovered",
|
|
22
|
+
prehash: false,
|
|
23
|
+
});
|
|
24
|
+
return hexFrom(bytesConcat(signature.slice(1), signature.slice(0, 1)));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Verify a message using Secp256k1.
|
|
29
|
+
*
|
|
30
|
+
* @param message - The message to verify.
|
|
31
|
+
* @param signature - The signature.
|
|
32
|
+
* @param publicKey - The public key.
|
|
33
|
+
* @returns True if the signature is valid, false otherwise.
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export function verifyMessageSecp256k1(
|
|
37
|
+
message: BytesLike,
|
|
38
|
+
signature: BytesLike,
|
|
39
|
+
publicKey: BytesLike,
|
|
40
|
+
): boolean {
|
|
41
|
+
const signatureBytes = bytesFrom(signature);
|
|
42
|
+
return secp256k1.verify(
|
|
43
|
+
bytesConcat(signatureBytes.slice(64), signatureBytes.slice(0, 64)),
|
|
44
|
+
bytesFrom(message),
|
|
45
|
+
bytesFrom(publicKey),
|
|
46
|
+
{ format: "recovered", prehash: false },
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Recover the public key from a Secp256k1 signature.
|
|
52
|
+
*
|
|
53
|
+
* @param message - The message.
|
|
54
|
+
* @param signature - The signature.
|
|
55
|
+
* @returns The recovered public key.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export function recoverMessageSecp256k1(
|
|
59
|
+
message: BytesLike,
|
|
60
|
+
signature: BytesLike,
|
|
61
|
+
): Hex {
|
|
62
|
+
const signatureBytes = bytesFrom(signature);
|
|
63
|
+
return hexFrom(
|
|
64
|
+
secp256k1.recoverPublicKey(
|
|
65
|
+
bytesConcat(signatureBytes.slice(64), signatureBytes.slice(0, 64)),
|
|
66
|
+
bytesFrom(message),
|
|
67
|
+
{ prehash: false },
|
|
68
|
+
),
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export function messageHashCkbSecp256k1(message: string | BytesLike): Hex {
|
|
76
|
+
const msg = typeof message === "string" ? message : hexFrom(message);
|
|
77
|
+
const buffer = bytesFrom(`Nervos Message:${msg}`, "utf8");
|
|
78
|
+
return hashCkb(buffer);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
*/
|
|
84
|
+
export function verifyMessageCkbSecp256k1(
|
|
85
|
+
message: string | BytesLike,
|
|
86
|
+
signature: string,
|
|
87
|
+
publicKey: string,
|
|
88
|
+
): boolean {
|
|
89
|
+
return verifyMessageSecp256k1(
|
|
90
|
+
messageHashCkbSecp256k1(message),
|
|
91
|
+
signature,
|
|
92
|
+
publicKey,
|
|
93
|
+
);
|
|
94
|
+
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
|
-
import {
|
|
2
|
+
import { bytesFrom, BytesLike } from "../../bytes/index.js";
|
|
3
3
|
import { Transaction, TransactionLike, WitnessArgs } from "../../ckb/index.js";
|
|
4
4
|
import { Client } from "../../client/index.js";
|
|
5
5
|
import { Hex, hexFrom, HexLike } from "../../hex/index.js";
|
|
6
|
+
import {
|
|
7
|
+
messageHashCkbSecp256k1,
|
|
8
|
+
signMessageSecp256k1,
|
|
9
|
+
} from "./secp256k1Signing.js";
|
|
6
10
|
import { SignerCkbPublicKey } from "./signerCkbPublicKey.js";
|
|
7
|
-
import { messageHashCkbSecp256k1 } from "./verifyCkbSecp256k1.js";
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* @public
|
|
@@ -23,15 +26,7 @@ export class SignerCkbPrivateKey extends SignerCkbPublicKey {
|
|
|
23
26
|
}
|
|
24
27
|
|
|
25
28
|
async _signMessage(message: HexLike): Promise<Hex> {
|
|
26
|
-
|
|
27
|
-
bytesFrom(message),
|
|
28
|
-
bytesFrom(this.privateKey),
|
|
29
|
-
{
|
|
30
|
-
format: "recovered",
|
|
31
|
-
prehash: false,
|
|
32
|
-
},
|
|
33
|
-
);
|
|
34
|
-
return hexFrom(bytesConcat(signature.slice(1), signature.slice(0, 1)));
|
|
29
|
+
return signMessageSecp256k1(message, this.privateKey);
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
async signMessageRaw(message: string | BytesLike): Promise<Hex> {
|
|
@@ -2,9 +2,10 @@ import { Address } from "../../address/index.js";
|
|
|
2
2
|
import { bytesFrom } from "../../bytes/index.js";
|
|
3
3
|
import { Script, Transaction, TransactionLike } from "../../ckb/index.js";
|
|
4
4
|
import { CellDepInfo, Client, KnownScript } from "../../client/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { hashCkbShort } from "../../hasher/index.js";
|
|
6
6
|
import { Hex, HexLike, hexFrom } from "../../hex/index.js";
|
|
7
7
|
import { Signer, SignerSignType, SignerType } from "../signer/index.js";
|
|
8
|
+
import { SECP256K1_SIGNATURE_LENGTH } from "./secp256k1Signing.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* @public
|
|
@@ -47,7 +48,7 @@ export class SignerCkbPublicKey extends Signer {
|
|
|
47
48
|
return Address.fromKnownScript(
|
|
48
49
|
this.client,
|
|
49
50
|
KnownScript.Secp256k1Blake160,
|
|
50
|
-
|
|
51
|
+
hashCkbShort(this.publicKey),
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
|
|
@@ -140,7 +141,11 @@ export class SignerCkbPublicKey extends Signer {
|
|
|
140
141
|
|
|
141
142
|
await Promise.all(
|
|
142
143
|
(await this.getRelatedScripts(tx)).map(async ({ script, cellDeps }) => {
|
|
143
|
-
await tx.prepareSighashAllWitness(
|
|
144
|
+
await tx.prepareSighashAllWitness(
|
|
145
|
+
script,
|
|
146
|
+
SECP256K1_SIGNATURE_LENGTH,
|
|
147
|
+
this.client,
|
|
148
|
+
);
|
|
144
149
|
await tx.addCellDepInfos(this.client, cellDeps);
|
|
145
150
|
}),
|
|
146
151
|
);
|