@ckb-ccc/core 1.14.0 → 1.16.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 +49 -0
- package/README.md +2 -0
- package/dist/address.advanced-8N_Hcv6p.mjs +2 -0
- package/dist/address.advanced-8N_Hcv6p.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-4xTrm-An.d.mts} +581 -16
- package/dist/advancedBarrel-4xTrm-An.d.mts.map +1 -0
- package/dist/advancedBarrel.d.mts +1 -1
- package/dist/advancedBarrel.mjs +1 -1
- package/dist/barrel-D3tMRxi5.mjs +7 -0
- package/dist/barrel-D3tMRxi5.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-CUIioHfv.js +2 -0
- package/dist.commonjs/address.advanced-CUIioHfv.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-XD_hMVay.d.ts} +582 -15
- package/dist.commonjs/advancedBarrel-XD_hMVay.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +1 -1
- package/dist.commonjs/barrel-D6tLiPED.js +21 -0
- package/dist.commonjs/barrel-D6tLiPED.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 +2 -2
- package/src/ckb/transaction.ts +20 -1
- package/src/client/cache/cache.ts +1 -2
- package/src/client/cache/memory.ts +1 -2
- package/src/client/client.ts +1 -2
- package/src/client/clientPublicMainnet.advanced.ts +34 -0
- package/src/client/clientPublicTestnet.advanced.ts +34 -0
- package/src/client/clientTypes.ts +1 -6
- package/src/client/jsonRpc/transformers.ts +1 -2
- package/src/client/knownScript.ts +2 -0
- package/src/codec/entity.ts +13 -6
- 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/src/utils/index.ts +3 -3
- 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-XD_hMVay.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-CUIioHfv.js"),t=require("./barrel-D6tLiPED.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-XD_hMVay.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-CUIioHfv.js"),t=require("./barrel-D6tLiPED.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Core of CCC - CKBer's Codebase",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"test": "vitest",
|
|
77
77
|
"test:ci": "vitest run",
|
|
78
78
|
"build": "tsdown",
|
|
79
|
-
"lint": "eslint ./src",
|
|
79
|
+
"lint": "tsc --noEmit && eslint ./src",
|
|
80
80
|
"format": "prettier --write . && eslint --fix ./src"
|
|
81
81
|
}
|
|
82
82
|
}
|
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)
|
|
@@ -97,8 +97,7 @@ export abstract class ClientCache {
|
|
|
97
97
|
*/
|
|
98
98
|
async recordTransactionResponses(
|
|
99
99
|
..._transactions: (
|
|
100
|
-
| ClientTransactionResponseLike
|
|
101
|
-
| ClientTransactionResponseLike[]
|
|
100
|
+
ClientTransactionResponseLike | ClientTransactionResponseLike[]
|
|
102
101
|
)[]
|
|
103
102
|
): Promise<void> {}
|
|
104
103
|
/**
|
|
@@ -148,8 +148,7 @@ export class ClientCacheMemory extends ClientCache {
|
|
|
148
148
|
|
|
149
149
|
async recordTransactionResponses(
|
|
150
150
|
...transactions: (
|
|
151
|
-
| ClientTransactionResponseLike
|
|
152
|
-
| ClientTransactionResponseLike[]
|
|
151
|
+
ClientTransactionResponseLike | ClientTransactionResponseLike[]
|
|
153
152
|
)[]
|
|
154
153
|
): Promise<void> {
|
|
155
154
|
transactions.flat().map((txLike) => {
|
package/src/client/client.ts
CHANGED
|
@@ -703,8 +703,7 @@ export abstract class Client {
|
|
|
703
703
|
transactions,
|
|
704
704
|
lastCursor,
|
|
705
705
|
}:
|
|
706
|
-
|
|
|
707
|
-
| ClientFindTransactionsGroupedResponse =
|
|
706
|
+
ClientFindTransactionsResponse | ClientFindTransactionsGroupedResponse =
|
|
708
707
|
await this.findTransactionsPaged(key, order, limit, last);
|
|
709
708
|
for (const tx of transactions) {
|
|
710
709
|
yield tx;
|
|
@@ -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",
|
|
@@ -94,6 +111,23 @@ export const MAINNET_SCRIPTS: Record<KnownScript, ScriptInfoLike | undefined> =
|
|
|
94
111
|
hashType: "type",
|
|
95
112
|
cellDeps: [],
|
|
96
113
|
},
|
|
114
|
+
[KnownScript.SUdt]: {
|
|
115
|
+
codeHash:
|
|
116
|
+
"0x5e7a36a77e68eecc013dfa2fe6a23f3b6c344b04005808694ae6dd45eea4cfd5",
|
|
117
|
+
hashType: "type",
|
|
118
|
+
cellDeps: [
|
|
119
|
+
{
|
|
120
|
+
cellDep: {
|
|
121
|
+
outPoint: {
|
|
122
|
+
txHash:
|
|
123
|
+
"0xc7813f6a415144643970c2e88e0bb6ca6a8edc5dd7c1022746f628284a9936d5",
|
|
124
|
+
index: 0,
|
|
125
|
+
},
|
|
126
|
+
depType: "code",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
97
131
|
[KnownScript.XUdt]: {
|
|
98
132
|
codeHash:
|
|
99
133
|
"0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",
|
|
@@ -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",
|
|
@@ -94,6 +111,23 @@ export const TESTNET_SCRIPTS: Record<KnownScript, ScriptInfoLike> =
|
|
|
94
111
|
hashType: "type",
|
|
95
112
|
cellDeps: [],
|
|
96
113
|
},
|
|
114
|
+
[KnownScript.SUdt]: {
|
|
115
|
+
codeHash:
|
|
116
|
+
"0xc5e5dcf215925f7ef4dfaf5f4b4f105bc321c02776d6e7d52a1db3fcd9d011a4",
|
|
117
|
+
hashType: "type",
|
|
118
|
+
cellDeps: [
|
|
119
|
+
{
|
|
120
|
+
cellDep: {
|
|
121
|
+
outPoint: {
|
|
122
|
+
txHash:
|
|
123
|
+
"0xe12877ebd2c3c364dc46c5c992bcfaf4fee33fa13eebdf82c591fc9825aab769",
|
|
124
|
+
index: 0,
|
|
125
|
+
},
|
|
126
|
+
depType: "code",
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
},
|
|
97
131
|
[KnownScript.XUdt]: {
|
|
98
132
|
codeHash:
|
|
99
133
|
"0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb",
|
|
@@ -93,12 +93,7 @@ export type OutputsValidator = "passthrough" | "well_known_scripts_only";
|
|
|
93
93
|
* @public
|
|
94
94
|
*/
|
|
95
95
|
export type TransactionStatus =
|
|
96
|
-
| "
|
|
97
|
-
| "pending"
|
|
98
|
-
| "proposed"
|
|
99
|
-
| "committed"
|
|
100
|
-
| "unknown"
|
|
101
|
-
| "rejected";
|
|
96
|
+
"sent" | "pending" | "proposed" | "committed" | "unknown" | "rejected";
|
|
102
97
|
/**
|
|
103
98
|
* @public
|
|
104
99
|
*/
|
|
@@ -322,8 +322,7 @@ export class JsonRpcTransformers {
|
|
|
322
322
|
}:
|
|
323
323
|
| JsonRpcIndexerFindTransactionsResponse
|
|
324
324
|
| JsonRpcIndexerFindTransactionsGroupedResponse):
|
|
325
|
-
|
|
|
326
|
-
| ClientFindTransactionsGroupedResponse {
|
|
325
|
+
ClientFindTransactionsResponse | ClientFindTransactionsGroupedResponse {
|
|
327
326
|
if (objects.length === 0) {
|
|
328
327
|
return {
|
|
329
328
|
lastCursor: last_cursor,
|
|
@@ -5,9 +5,11 @@ 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",
|
|
12
|
+
SUdt = "SUdt",
|
|
11
13
|
XUdt = "XUdt",
|
|
12
14
|
JoyId = "JoyId",
|
|
13
15
|
COTA = "COTA",
|
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.
|
|
@@ -15,7 +14,7 @@ export abstract class Entity {
|
|
|
15
14
|
* @public
|
|
16
15
|
*/
|
|
17
16
|
static Base<SubTypeLike, SubType = SubTypeLike>() {
|
|
18
|
-
abstract class Impl {
|
|
17
|
+
abstract class Impl extends Entity {
|
|
19
18
|
/**
|
|
20
19
|
* The bytes length of the entity, if it is fixed, otherwise undefined
|
|
21
20
|
* @public
|
|
@@ -91,6 +90,7 @@ export abstract class Entity {
|
|
|
91
90
|
* @public
|
|
92
91
|
* @returns A clone of the entity
|
|
93
92
|
*/
|
|
93
|
+
// @ts-expect-error SubType is always an Entity in practice, but TypeScript cannot infer this without a constraint on the type parameter
|
|
94
94
|
clone(): SubType {
|
|
95
95
|
return (this.constructor as typeof Impl).fromBytes(this.toBytes());
|
|
96
96
|
}
|
|
@@ -170,7 +170,14 @@ export function codec<
|
|
|
170
170
|
Encodable,
|
|
171
171
|
TypeLike extends Encodable,
|
|
172
172
|
Decoded extends TypeLike,
|
|
173
|
-
>(codec:
|
|
173
|
+
>(codec: {
|
|
174
|
+
encode: (encodable: Encodable) => Bytes;
|
|
175
|
+
decode: (
|
|
176
|
+
decodable: Bytes,
|
|
177
|
+
config?: { isExtraFieldIgnored?: boolean },
|
|
178
|
+
) => Decoded;
|
|
179
|
+
byteLength?: number;
|
|
180
|
+
}) {
|
|
174
181
|
return function <
|
|
175
182
|
Type extends TypeLike,
|
|
176
183
|
ConstructorType extends Constructor<Type> & {
|
|
@@ -189,12 +196,12 @@ export function codec<
|
|
|
189
196
|
}
|
|
190
197
|
if (Constructor.decode === undefined) {
|
|
191
198
|
Constructor.decode = function (bytesLike: BytesLike) {
|
|
192
|
-
return Constructor.from(codec.decode(bytesLike));
|
|
199
|
+
return Constructor.from(codec.decode(bytesFrom(bytesLike)));
|
|
193
200
|
};
|
|
194
201
|
}
|
|
195
202
|
if (Constructor.fromBytes === undefined) {
|
|
196
203
|
Constructor.fromBytes = function (bytes: BytesLike) {
|
|
197
|
-
return Constructor.from(codec.decode(bytes));
|
|
204
|
+
return Constructor.from(codec.decode(bytesFrom(bytes)));
|
|
198
205
|
};
|
|
199
206
|
}
|
|
200
207
|
|
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";
|