@ckb-ccc/core 1.16.1 → 1.17.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 +30 -0
- package/dist/address.advanced-DpcI420e.mjs +2 -0
- package/dist/address.advanced-DpcI420e.mjs.map +1 -0
- package/dist/advanced.d.mts +1 -1
- package/dist/advanced.mjs +1 -1
- package/dist/{advancedBarrel-66JgvInl.d.mts → advancedBarrel-Bk19lQjR.d.mts} +1150 -160
- package/dist/advancedBarrel-Bk19lQjR.d.mts.map +1 -0
- package/dist/advancedBarrel.d.mts +1 -1
- package/dist/advancedBarrel.mjs +1 -1
- package/dist/barrel-BwuHQ4NS.mjs +7 -0
- package/dist/barrel-BwuHQ4NS.mjs.map +1 -0
- package/dist/barrel.d.mts +1 -1
- package/dist/barrel.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist.commonjs/address.advanced--1eOp1GP.js +2 -0
- package/dist.commonjs/address.advanced--1eOp1GP.js.map +1 -0
- package/dist.commonjs/advanced.d.ts +1 -1
- package/dist.commonjs/advanced.js +1 -1
- package/dist.commonjs/{advancedBarrel-CiJnF8me.d.ts → advancedBarrel-DrAHz5UG.d.ts} +1150 -160
- package/dist.commonjs/advancedBarrel-DrAHz5UG.d.ts.map +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +1 -1
- package/dist.commonjs/advancedBarrel.js +1 -1
- package/dist.commonjs/barrel-BIo8E9Ci.js +21 -0
- package/dist.commonjs/barrel-BIo8E9Ci.js.map +1 -0
- package/dist.commonjs/barrel.d.ts +1 -1
- package/dist.commonjs/barrel.js +1 -1
- package/dist.commonjs/index.d.ts +1 -1
- package/dist.commonjs/index.js +1 -1
- package/dist.commonjs/rolldown-runtime-DWNI8pZO.js +1 -0
- package/package.json +4 -3
- package/src/ckb/transaction.ts +256 -44
- package/src/client/jsonRpc/client.ts +7 -3
- package/src/codec/entity.ts +93 -0
- package/src/molecule/codec.ts +25 -5
- package/src/signer/btc/signerBtc.ts +1 -1
- package/src/signer/ckb/signerCkbPrivateKey.ts +2 -3
- package/src/signer/ckb/signerMultisigCkbReadonly.ts +5 -5
- package/src/signer/doge/signerDoge.ts +1 -1
- package/src/signer/evm/signerEvm.ts +2 -2
- package/src/signer/nostr/signerNostr.ts +1 -1
- package/dist/address.advanced-C5UrS2uk.mjs +0 -2
- package/dist/address.advanced-C5UrS2uk.mjs.map +0 -1
- package/dist/advancedBarrel-66JgvInl.d.mts.map +0 -1
- package/dist/barrel-yZm3ICzn.mjs +0 -7
- package/dist/barrel-yZm3ICzn.mjs.map +0 -1
- package/dist.commonjs/address.advanced-CQJ24Iei.js +0 -2
- package/dist.commonjs/address.advanced-CQJ24Iei.js.map +0 -1
- package/dist.commonjs/advancedBarrel-CiJnF8me.d.ts.map +0 -1
- package/dist.commonjs/barrel-CddEgDBp.js +0 -21
- package/dist.commonjs/barrel-CddEgDBp.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-DrAHz5UG.js";
|
|
2
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--1eOp1GP.js"),t=require("./barrel-BIo8E9Ci.js");exports.Address=t.Z,exports.Bytes=e.qr,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.Kr,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.Jr,exports.bytesConcatTo=e.Yr,exports.bytesEq=e.Xr,exports.bytesFrom=e.Zr,exports.bytesLen=e._r,exports.bytesLenUnsafe=e.vr,exports.bytesTo=e.Qr,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, $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-
|
|
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-DrAHz5UG.js";
|
|
2
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--1eOp1GP.js"),t=require("./barrel-BIo8E9Ci.js");exports.Address=t.Z,exports.Bytes=e.qr,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.Kr,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.Jr,exports.bytesConcatTo=e.Yr,exports.bytesEq=e.Xr,exports.bytesFrom=e.Zr,exports.bytesLen=e._r,exports.bytesLenUnsafe=e.vr,exports.bytesTo=e.Qr,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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.17.0",
|
|
4
4
|
"description": "Core of CCC - CKBer's Codebase",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,8 +40,9 @@
|
|
|
40
40
|
"eslint-plugin-prettier": "^5.5.6",
|
|
41
41
|
"prettier": "^3.8.4",
|
|
42
42
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
43
|
-
"tsdown": "0.22.
|
|
44
|
-
"typescript": "
|
|
43
|
+
"tsdown": "0.22.7",
|
|
44
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
45
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
45
46
|
"typescript-eslint": "^8.61.1",
|
|
46
47
|
"vitest": "^4.1.9"
|
|
47
48
|
},
|
package/src/ckb/transaction.ts
CHANGED
|
@@ -32,6 +32,30 @@ import {
|
|
|
32
32
|
} from "./transactionErrors.js";
|
|
33
33
|
import type { LumosTransactionSkeletonType } from "./transactionLumos.js";
|
|
34
34
|
|
|
35
|
+
const MAX_ARRAY_INDEX = 2n ** 32n - 2n;
|
|
36
|
+
|
|
37
|
+
function transactionIndexFrom(index: NumLike): number | undefined {
|
|
38
|
+
try {
|
|
39
|
+
const value = numFrom(index);
|
|
40
|
+
if (value < 0n || value > MAX_ARRAY_INDEX) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
return Number(value);
|
|
44
|
+
} catch (_) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function transactionIndexOrThrow(index: number): number {
|
|
50
|
+
const value = transactionIndexFrom(index);
|
|
51
|
+
if (value === undefined) {
|
|
52
|
+
throw new Error(
|
|
53
|
+
`Index ${index} must be a valid array index between 0 and ${MAX_ARRAY_INDEX}`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
export const DepTypeCodec: Codec<DepTypeLike, DepType> = Codec.from({
|
|
36
60
|
byteLength: 1,
|
|
37
61
|
encode: depTypeToBytes,
|
|
@@ -1620,41 +1644,75 @@ export class Transaction extends Entity.Base<TransactionLike, Transaction>() {
|
|
|
1620
1644
|
}
|
|
1621
1645
|
|
|
1622
1646
|
/**
|
|
1623
|
-
*
|
|
1647
|
+
* Sets output data at an index.
|
|
1648
|
+
*
|
|
1649
|
+
* @deprecated Use {@link setOutputData} instead.
|
|
1650
|
+
*/
|
|
1651
|
+
setOutputDataAt(index: number, data: HexLike): void {
|
|
1652
|
+
this.setOutputData(index, data);
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Sets output data at an index, filling any skipped positions with empty data.
|
|
1624
1657
|
*
|
|
1625
1658
|
* @param index - The index of the output data.
|
|
1626
1659
|
* @param data - The data to set.
|
|
1660
|
+
* @throws If `index` is invalid or does not identify an existing output.
|
|
1627
1661
|
*
|
|
1628
1662
|
* @example
|
|
1629
1663
|
* ```typescript
|
|
1630
|
-
* tx.
|
|
1664
|
+
* tx.setOutputData(0, "0x00");
|
|
1631
1665
|
* ```
|
|
1632
1666
|
*/
|
|
1633
|
-
|
|
1634
|
-
|
|
1667
|
+
setOutputData(index: number, data: HexLike): void {
|
|
1668
|
+
const i = transactionIndexOrThrow(index);
|
|
1669
|
+
if (i >= this.outputs.length) {
|
|
1670
|
+
throw new Error(
|
|
1671
|
+
`Index ${index} is out of bounds for outputs of length ${this.outputs.length}`,
|
|
1672
|
+
);
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
if (this.outputsData.length < i) {
|
|
1635
1676
|
this.outputsData.push(
|
|
1636
|
-
...Array.from(
|
|
1637
|
-
new Array(index - this.outputsData.length),
|
|
1638
|
-
(): Hex => "0x",
|
|
1639
|
-
),
|
|
1677
|
+
...Array.from(new Array(i - this.outputsData.length), (): Hex => "0x"),
|
|
1640
1678
|
);
|
|
1641
1679
|
}
|
|
1642
1680
|
|
|
1643
|
-
this.outputsData[
|
|
1681
|
+
this.outputsData[i] = hexFrom(data);
|
|
1644
1682
|
}
|
|
1645
1683
|
|
|
1646
1684
|
/**
|
|
1647
|
-
*
|
|
1685
|
+
* Gets the data associated with an output.
|
|
1648
1686
|
*
|
|
1649
|
-
* @param index - The
|
|
1687
|
+
* @param index - The output index.
|
|
1688
|
+
* @returns The output data, or `undefined` if the index is invalid or out of bounds.
|
|
1650
1689
|
*
|
|
1651
1690
|
* @example
|
|
1652
1691
|
* ```typescript
|
|
1653
|
-
*
|
|
1692
|
+
* const data = tx.getOutputData(0);
|
|
1693
|
+
* ```
|
|
1694
|
+
*/
|
|
1695
|
+
getOutputData(index: NumLike): Hex | undefined {
|
|
1696
|
+
const i = transactionIndexFrom(index);
|
|
1697
|
+
return i !== undefined && i < this.outputs.length
|
|
1698
|
+
? (this.outputsData[i] ?? "0x")
|
|
1699
|
+
: undefined;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* Gets an input.
|
|
1704
|
+
*
|
|
1705
|
+
* @param index - The cell input index.
|
|
1706
|
+
* @returns The input, or `undefined` if the index is invalid or out of bounds.
|
|
1707
|
+
*
|
|
1708
|
+
* @example
|
|
1709
|
+
* ```typescript
|
|
1710
|
+
* tx.getInput(0);
|
|
1654
1711
|
* ```
|
|
1655
1712
|
*/
|
|
1656
1713
|
getInput(index: NumLike): CellInput | undefined {
|
|
1657
|
-
|
|
1714
|
+
const i = transactionIndexFrom(index);
|
|
1715
|
+
return i === undefined ? undefined : this.inputs[i];
|
|
1658
1716
|
}
|
|
1659
1717
|
/**
|
|
1660
1718
|
* add input
|
|
@@ -1675,18 +1733,19 @@ export class Transaction extends Entity.Base<TransactionLike, Transaction>() {
|
|
|
1675
1733
|
}
|
|
1676
1734
|
|
|
1677
1735
|
/**
|
|
1678
|
-
*
|
|
1736
|
+
* Gets an output cell together with its data.
|
|
1679
1737
|
*
|
|
1680
|
-
* @param index - The cell output index
|
|
1738
|
+
* @param index - The cell output index.
|
|
1739
|
+
* @returns The output cell, or `undefined` if the index is invalid or out of bounds.
|
|
1681
1740
|
*
|
|
1682
1741
|
* @example
|
|
1683
1742
|
* ```typescript
|
|
1684
|
-
*
|
|
1743
|
+
* tx.getOutput(0);
|
|
1685
1744
|
* ```
|
|
1686
1745
|
*/
|
|
1687
1746
|
getOutput(index: NumLike): CellAny | undefined {
|
|
1688
|
-
const i =
|
|
1689
|
-
if (i >= this.outputs.length) {
|
|
1747
|
+
const i = transactionIndexFrom(index);
|
|
1748
|
+
if (i === undefined || i >= this.outputs.length) {
|
|
1690
1749
|
return;
|
|
1691
1750
|
}
|
|
1692
1751
|
return CellAny.from({
|
|
@@ -1769,85 +1828,238 @@ export class Transaction extends Entity.Base<TransactionLike, Transaction>() {
|
|
|
1769
1828
|
});
|
|
1770
1829
|
|
|
1771
1830
|
const len = this.outputs.push(cell.cellOutput);
|
|
1772
|
-
this.
|
|
1831
|
+
this.setOutputData(len - 1, cell.outputData);
|
|
1773
1832
|
|
|
1774
1833
|
return len;
|
|
1775
1834
|
}
|
|
1776
1835
|
|
|
1777
1836
|
/**
|
|
1778
|
-
*
|
|
1837
|
+
* Sets or appends an output cell.
|
|
1838
|
+
*
|
|
1839
|
+
* An index equal to the current output count appends the cell. Existing
|
|
1840
|
+
* outputs are replaced together with their corresponding output data.
|
|
1841
|
+
*
|
|
1842
|
+
* @param index - The output index to set, from zero through the current output count.
|
|
1843
|
+
* @param cellLike - A cell-like object containing both the output and its data.
|
|
1844
|
+
* @throws If `index` is not a valid array index or is greater than the output count.
|
|
1845
|
+
*
|
|
1846
|
+
* @example
|
|
1847
|
+
* ```typescript
|
|
1848
|
+
* tx.setOutput(0, {
|
|
1849
|
+
* cellOutput: { lock: recipientLock },
|
|
1850
|
+
* outputData: "0x1234",
|
|
1851
|
+
* });
|
|
1852
|
+
* ```
|
|
1853
|
+
*/
|
|
1854
|
+
setOutput(index: number, cellLike: CellAnyLike): void;
|
|
1855
|
+
|
|
1856
|
+
/**
|
|
1857
|
+
* Sets or appends an output and its data.
|
|
1858
|
+
*
|
|
1859
|
+
* @param index - The output index to set, from zero through the current output count.
|
|
1860
|
+
* @param outputLike - The cell output to set.
|
|
1861
|
+
* @param outputDataLike - The output data, defaulting to `"0x"`.
|
|
1862
|
+
* @throws If `index` is not a valid array index or is greater than the output count.
|
|
1863
|
+
*
|
|
1864
|
+
* @example
|
|
1865
|
+
* ```typescript
|
|
1866
|
+
* tx.setOutput(0, { lock: recipientLock }, "0x1234");
|
|
1867
|
+
* ```
|
|
1868
|
+
*/
|
|
1869
|
+
setOutput(
|
|
1870
|
+
index: number,
|
|
1871
|
+
outputLike: CellOutputLike,
|
|
1872
|
+
outputDataLike?: HexLike | null,
|
|
1873
|
+
): void;
|
|
1874
|
+
setOutput(
|
|
1875
|
+
index: number,
|
|
1876
|
+
cellOrOutputLike: CellAnyLike | CellOutputLike,
|
|
1877
|
+
outputDataLike?: HexLike | null,
|
|
1878
|
+
): void {
|
|
1879
|
+
const i = transactionIndexOrThrow(index);
|
|
1880
|
+
if (i > this.outputs.length) {
|
|
1881
|
+
throw new Error(
|
|
1882
|
+
`Index ${index} is out of bounds for outputs of length ${this.outputs.length}`,
|
|
1883
|
+
);
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
const cell =
|
|
1887
|
+
"cellOutput" in cellOrOutputLike
|
|
1888
|
+
? CellAny.from(cellOrOutputLike)
|
|
1889
|
+
: CellAny.from({
|
|
1890
|
+
cellOutput: cellOrOutputLike,
|
|
1891
|
+
outputData: outputDataLike,
|
|
1892
|
+
});
|
|
1893
|
+
|
|
1894
|
+
if (i === this.outputs.length) {
|
|
1895
|
+
this.addOutput(cell);
|
|
1896
|
+
} else {
|
|
1897
|
+
this.outputs[i] = cell.cellOutput;
|
|
1898
|
+
this.setOutputData(i, cell.outputData);
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* Sets or appends an input.
|
|
1904
|
+
*
|
|
1905
|
+
* An index equal to the current input count appends the input using
|
|
1906
|
+
* {@link addInput}, preserving witness alignment. An existing index replaces
|
|
1907
|
+
* only that input.
|
|
1908
|
+
*
|
|
1909
|
+
* @param index - The input index to set, from zero through the current input count.
|
|
1910
|
+
* @param inputLike - The cell input to set.
|
|
1911
|
+
* @throws If `index` is not a valid array index or is greater than the input count.
|
|
1912
|
+
*
|
|
1913
|
+
* @example
|
|
1914
|
+
* ```typescript
|
|
1915
|
+
* tx.setInput(0, {
|
|
1916
|
+
* previousOutput: { txHash: "0x...", index: 0 },
|
|
1917
|
+
* });
|
|
1918
|
+
* ```
|
|
1919
|
+
*/
|
|
1920
|
+
setInput(index: number, inputLike: CellInputLike): void {
|
|
1921
|
+
const i = transactionIndexOrThrow(index);
|
|
1922
|
+
if (i > this.inputs.length) {
|
|
1923
|
+
throw new Error(
|
|
1924
|
+
`Index ${index} is out of bounds for inputs of length ${this.inputs.length}`,
|
|
1925
|
+
);
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
if (i === this.inputs.length) {
|
|
1929
|
+
this.addInput(inputLike);
|
|
1930
|
+
} else {
|
|
1931
|
+
this.inputs[i] = CellInput.from(inputLike);
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
|
|
1935
|
+
/**
|
|
1936
|
+
* Gets a raw witness.
|
|
1937
|
+
*
|
|
1938
|
+
* @param index - The witness index.
|
|
1939
|
+
* @returns The witness, or `undefined` if the index is invalid or out of bounds.
|
|
1940
|
+
*
|
|
1941
|
+
* @example
|
|
1942
|
+
* ```typescript
|
|
1943
|
+
* const witness = tx.getWitness(0);
|
|
1944
|
+
* ```
|
|
1945
|
+
*/
|
|
1946
|
+
getWitness(index: NumLike): Hex | undefined {
|
|
1947
|
+
const i = transactionIndexFrom(index);
|
|
1948
|
+
return i === undefined ? undefined : this.witnesses[i];
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
/**
|
|
1952
|
+
* Gets the witness at an index as `WitnessArgs`.
|
|
1779
1953
|
*
|
|
1780
1954
|
* @param index - The index of the witness.
|
|
1781
1955
|
* @returns The witness parsed as WitnessArgs.
|
|
1782
1956
|
*
|
|
1783
1957
|
* @example
|
|
1784
1958
|
* ```typescript
|
|
1785
|
-
* const witnessArgs = tx.
|
|
1959
|
+
* const witnessArgs = tx.getWitnessArgs(0);
|
|
1786
1960
|
* ```
|
|
1787
1961
|
*/
|
|
1788
|
-
|
|
1962
|
+
getWitnessArgs(index: NumLike): WitnessArgs | undefined {
|
|
1789
1963
|
try {
|
|
1790
|
-
return this.
|
|
1964
|
+
return this.getWitnessArgsUnsafe(index);
|
|
1791
1965
|
} catch (_) {
|
|
1792
1966
|
return undefined;
|
|
1793
1967
|
}
|
|
1794
1968
|
}
|
|
1795
1969
|
|
|
1796
1970
|
/**
|
|
1797
|
-
*
|
|
1971
|
+
* Gets the witness at an index as `WitnessArgs`, throwing if decoding fails.
|
|
1798
1972
|
*
|
|
1799
1973
|
* @param index - The index of the witness.
|
|
1800
1974
|
* @returns The witness parsed as WitnessArgs.
|
|
1975
|
+
* @throws If the witness cannot be decoded as `WitnessArgs`.
|
|
1801
1976
|
*
|
|
1802
1977
|
* @example
|
|
1803
1978
|
* ```typescript
|
|
1804
|
-
* const witnessArgs = tx.
|
|
1979
|
+
* const witnessArgs = tx.getWitnessArgsUnsafe(0);
|
|
1805
1980
|
* ```
|
|
1806
1981
|
*/
|
|
1807
|
-
|
|
1808
|
-
const rawWitness = this.
|
|
1809
|
-
return
|
|
1982
|
+
getWitnessArgsUnsafe(index: NumLike): WitnessArgs | undefined {
|
|
1983
|
+
const rawWitness = this.getWitness(index);
|
|
1984
|
+
return rawWitness && rawWitness !== "0x"
|
|
1810
1985
|
? WitnessArgs.fromBytes(rawWitness)
|
|
1811
1986
|
: undefined;
|
|
1812
1987
|
}
|
|
1813
1988
|
|
|
1814
1989
|
/**
|
|
1815
|
-
*
|
|
1990
|
+
* Sets a witness at an index from `WitnessArgs`.
|
|
1816
1991
|
*
|
|
1817
1992
|
* @param index - The index of the witness.
|
|
1818
|
-
* @param
|
|
1993
|
+
* @param witnessLike - The WitnessArgs-like value to set.
|
|
1994
|
+
* @throws If `index` is not a valid array index.
|
|
1819
1995
|
*
|
|
1820
1996
|
* @example
|
|
1821
1997
|
* ```typescript
|
|
1822
|
-
*
|
|
1998
|
+
* tx.setWitnessArgs(0, witnessArgs);
|
|
1823
1999
|
* ```
|
|
1824
2000
|
*/
|
|
1825
|
-
|
|
1826
|
-
this.
|
|
2001
|
+
setWitnessArgs(index: number, witnessLike: WitnessArgsLike): void {
|
|
2002
|
+
this.setWitness(index, WitnessArgs.from(witnessLike).toBytes());
|
|
1827
2003
|
}
|
|
1828
2004
|
|
|
1829
2005
|
/**
|
|
1830
|
-
*
|
|
2006
|
+
* Sets a witness at an index, filling any skipped positions with empty witnesses.
|
|
1831
2007
|
*
|
|
1832
2008
|
* @param index - The index of the witness.
|
|
1833
2009
|
* @param witness - The witness to set.
|
|
2010
|
+
* @throws If `index` is not a valid array index.
|
|
1834
2011
|
*
|
|
1835
2012
|
* @example
|
|
1836
2013
|
* ```typescript
|
|
1837
|
-
*
|
|
2014
|
+
* tx.setWitness(0, witness);
|
|
1838
2015
|
* ```
|
|
1839
2016
|
*/
|
|
1840
|
-
|
|
1841
|
-
|
|
2017
|
+
setWitness(index: number, witness: HexLike): void {
|
|
2018
|
+
const i = transactionIndexOrThrow(index);
|
|
2019
|
+
|
|
2020
|
+
if (this.witnesses.length < i) {
|
|
1842
2021
|
this.witnesses.push(
|
|
1843
|
-
...Array.from(
|
|
1844
|
-
new Array(index - this.witnesses.length),
|
|
1845
|
-
(): Hex => "0x",
|
|
1846
|
-
),
|
|
2022
|
+
...Array.from(new Array(i - this.witnesses.length), (): Hex => "0x"),
|
|
1847
2023
|
);
|
|
1848
2024
|
}
|
|
1849
2025
|
|
|
1850
|
-
this.witnesses[
|
|
2026
|
+
this.witnesses[i] = hexFrom(witness);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/**
|
|
2030
|
+
* Gets the witness at an index as `WitnessArgs`.
|
|
2031
|
+
*
|
|
2032
|
+
* @deprecated Use {@link getWitnessArgs} instead.
|
|
2033
|
+
*/
|
|
2034
|
+
getWitnessArgsAt(index: NumLike): WitnessArgs | undefined {
|
|
2035
|
+
return this.getWitnessArgs(index);
|
|
2036
|
+
}
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* Gets the witness at an index as `WitnessArgs`, throwing if decoding fails.
|
|
2040
|
+
*
|
|
2041
|
+
* @deprecated Use {@link getWitnessArgsUnsafe} instead.
|
|
2042
|
+
*/
|
|
2043
|
+
getWitnessArgsAtUnsafe(index: NumLike): WitnessArgs | undefined {
|
|
2044
|
+
return this.getWitnessArgsUnsafe(index);
|
|
2045
|
+
}
|
|
2046
|
+
|
|
2047
|
+
/**
|
|
2048
|
+
* Sets a witness at an index from `WitnessArgs`.
|
|
2049
|
+
*
|
|
2050
|
+
* @deprecated Use {@link setWitnessArgs} instead.
|
|
2051
|
+
*/
|
|
2052
|
+
setWitnessArgsAt(index: number, witnessLike: WitnessArgsLike): void {
|
|
2053
|
+
this.setWitnessArgs(index, witnessLike);
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
/**
|
|
2057
|
+
* Sets a witness at an index.
|
|
2058
|
+
*
|
|
2059
|
+
* @deprecated Use {@link setWitness} instead.
|
|
2060
|
+
*/
|
|
2061
|
+
setWitnessAt(index: number, witness: HexLike): void {
|
|
2062
|
+
this.setWitness(index, witness);
|
|
1851
2063
|
}
|
|
1852
2064
|
|
|
1853
2065
|
/**
|
|
@@ -1873,9 +2085,9 @@ export class Transaction extends Entity.Base<TransactionLike, Transaction>() {
|
|
|
1873
2085
|
return;
|
|
1874
2086
|
}
|
|
1875
2087
|
|
|
1876
|
-
const witness = this.
|
|
2088
|
+
const witness = this.getWitnessArgs(position) ?? WitnessArgs.from({});
|
|
1877
2089
|
witness.lock = hexFrom(Array.from(new Array(lockLen), () => 0));
|
|
1878
|
-
this.
|
|
2090
|
+
this.setWitnessArgs(position, witness);
|
|
1879
2091
|
}
|
|
1880
2092
|
|
|
1881
2093
|
async getInputsCapacityExtra(client: Client): Promise<Num> {
|
|
@@ -13,6 +13,7 @@ import { Num, NumLike, numFrom, numToHex } from "../../num/index.js";
|
|
|
13
13
|
import { apply } from "../../utils/index.js";
|
|
14
14
|
import { ClientCache } from "../cache/index.js";
|
|
15
15
|
import { Client } from "../client.js";
|
|
16
|
+
import { DEFAULT_MIN_FEE_RATE } from "../clientTypes.advanced.js";
|
|
16
17
|
import {
|
|
17
18
|
ClientFindCellsResponse,
|
|
18
19
|
ClientIndexerSearchKeyLike,
|
|
@@ -131,9 +132,12 @@ export abstract class ClientJsonRpc extends Client {
|
|
|
131
132
|
getFeeRateStatistics = this.buildSender(
|
|
132
133
|
"get_fee_rate_statistics",
|
|
133
134
|
[(n: NumLike) => apply(numFrom, n)],
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
// TODO: This is a temporary workaround for the fact that the node may return null for fee rate statistics.
|
|
136
|
+
// We should change the method signature to return null instead of falling back to the default value,
|
|
137
|
+
// but this would be a breaking change.
|
|
138
|
+
(res: { mean: NumLike; median: NumLike } | null) => ({
|
|
139
|
+
mean: numFrom(res?.mean ?? DEFAULT_MIN_FEE_RATE),
|
|
140
|
+
median: numFrom(res?.median ?? DEFAULT_MIN_FEE_RATE),
|
|
137
141
|
}),
|
|
138
142
|
) as Client["getFeeRateStatistics"];
|
|
139
143
|
|