@ckb-ccc/core 0.0.12-alpha.1 → 0.0.12
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 +3 -0
- package/README.md +5 -5
- package/dist/address/index.d.ts +4 -0
- package/dist/address/index.d.ts.map +1 -1
- package/dist/address/index.js +1 -0
- package/dist/advancedBarrel.d.ts +1 -0
- package/dist/advancedBarrel.d.ts.map +1 -1
- package/dist/advancedBarrel.js +1 -0
- package/dist/bytes/advanced.d.ts +1 -0
- package/dist/bytes/advanced.d.ts.map +1 -1
- package/dist/bytes/index.d.ts +9 -0
- package/dist/bytes/index.d.ts.map +1 -1
- package/dist/bytes/index.js +3 -0
- package/dist/ckb/index.d.ts +1 -0
- package/dist/ckb/index.d.ts.map +1 -1
- package/dist/ckb/index.js +1 -0
- package/dist/ckb/script.d.ts +15 -0
- package/dist/ckb/script.d.ts.map +1 -1
- package/dist/ckb/script.js +6 -0
- package/dist/ckb/transaction.d.ts +65 -11
- package/dist/ckb/transaction.d.ts.map +1 -1
- package/dist/ckb/transaction.js +41 -14
- package/dist/ckb/transactionLumos.d.ts +29 -0
- package/dist/ckb/transactionLumos.d.ts.map +1 -0
- package/dist/ckb/transactionLumos.js +1 -0
- package/dist/client/client.d.ts +13 -1
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +10 -1
- package/dist/client/clientPublicMainnet.d.ts +3 -0
- package/dist/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist/client/clientPublicMainnet.js +3 -0
- package/dist/client/clientPublicTestnet.d.ts +3 -0
- package/dist/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist/client/clientPublicTestnet.js +3 -0
- package/dist/client/clientTypes.d.ts +45 -0
- package/dist/client/clientTypes.d.ts.map +1 -1
- package/dist/client/clientTypes.js +9 -0
- package/dist/client/jsonRpc/index.d.ts +6 -6
- package/dist/client/jsonRpc/index.d.ts.map +1 -1
- package/dist/client/jsonRpc/index.js +3 -3
- package/dist/fixedPoint/index.d.ts +6 -0
- package/dist/fixedPoint/index.d.ts.map +1 -1
- package/dist/fixedPoint/index.js +5 -0
- package/dist/hasher/hasher.d.ts +3 -0
- package/dist/hasher/hasher.d.ts.map +1 -1
- package/dist/hasher/hasherCkb.d.ts +6 -1
- package/dist/hasher/hasherCkb.d.ts.map +1 -1
- package/dist/hasher/hasherCkb.js +6 -1
- package/dist/hasher/hasherKeecak256.d.ts +3 -0
- package/dist/hasher/hasherKeecak256.d.ts.map +1 -1
- package/dist/hasher/hasherKeecak256.js +3 -0
- package/dist/hex/index.d.ts +3 -0
- package/dist/hex/index.d.ts.map +1 -1
- package/dist/hex/index.js +1 -0
- package/dist/keystore/index.d.ts +6 -0
- package/dist/keystore/index.d.ts.map +1 -1
- package/dist/keystore/index.js +6 -0
- package/dist/num/index.d.ts +11 -0
- package/dist/num/index.d.ts.map +1 -1
- package/dist/num/index.js +9 -0
- package/dist/package.json +1 -1
- package/dist/signer/btc/signerBtc.d.ts +1 -0
- package/dist/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist/signer/btc/signerBtc.js +1 -0
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
- package/dist/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
- package/dist/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
- package/dist/signer/btc/verify.d.ts +3 -0
- package/dist/signer/btc/verify.d.ts.map +1 -1
- package/dist/signer/btc/verify.js +3 -0
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
- package/dist/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbPrivateKey.js +3 -0
- package/dist/signer/ckb/signerCkbPublicKey.d.ts +3 -0
- package/dist/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbPublicKey.js +3 -0
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
- package/dist/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
- package/dist/signer/ckb/signerCkbScriptReadonly.js +1 -0
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
- package/dist/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
- package/dist/signer/ckb/verifyCkbSecp256k1.js +6 -0
- package/dist/signer/ckb/verifyJoyId.d.ts +3 -0
- package/dist/signer/ckb/verifyJoyId.d.ts.map +1 -1
- package/dist/signer/ckb/verifyJoyId.js +3 -0
- package/dist/signer/dummy/alwaysError.d.ts +3 -0
- package/dist/signer/dummy/alwaysError.d.ts.map +1 -1
- package/dist/signer/dummy/alwaysError.js +3 -0
- package/dist/signer/dummy/dummy.d.ts +3 -0
- package/dist/signer/dummy/dummy.d.ts.map +1 -1
- package/dist/signer/dummy/dummy.js +3 -0
- package/dist/signer/dummy/openLink.d.ts +3 -0
- package/dist/signer/dummy/openLink.d.ts.map +1 -1
- package/dist/signer/dummy/openLink.js +3 -0
- package/dist/signer/evm/signerEvm.d.ts +1 -0
- package/dist/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist/signer/evm/signerEvm.js +1 -0
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
- package/dist/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
- package/dist/signer/evm/signerEvmAddressReadonly.js +1 -0
- package/dist/signer/evm/verify.d.ts +3 -0
- package/dist/signer/evm/verify.d.ts.map +1 -1
- package/dist/signer/evm/verify.js +3 -0
- package/dist/signer/nostr/signerNostr.d.ts +6 -0
- package/dist/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist/signer/nostr/signerNostr.js +3 -0
- package/dist/signer/nostr/verify.d.ts +3 -0
- package/dist/signer/nostr/verify.d.ts.map +1 -1
- package/dist/signer/nostr/verify.js +3 -0
- package/dist/signer/signer/index.d.ts +26 -3
- package/dist/signer/signer/index.d.ts.map +1 -1
- package/dist/signer/signer/index.js +12 -3
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +13 -0
- package/dist.commonjs/address/index.d.ts +4 -0
- package/dist.commonjs/address/index.d.ts.map +1 -1
- package/dist.commonjs/address/index.js +1 -0
- package/dist.commonjs/advancedBarrel.d.ts +1 -0
- package/dist.commonjs/advancedBarrel.d.ts.map +1 -1
- package/dist.commonjs/advancedBarrel.js +1 -0
- package/dist.commonjs/bytes/advanced.d.ts +1 -0
- package/dist.commonjs/bytes/advanced.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.d.ts +9 -0
- package/dist.commonjs/bytes/index.d.ts.map +1 -1
- package/dist.commonjs/bytes/index.js +3 -0
- package/dist.commonjs/ckb/index.d.ts +1 -0
- package/dist.commonjs/ckb/index.d.ts.map +1 -1
- package/dist.commonjs/ckb/index.js +1 -0
- package/dist.commonjs/ckb/script.d.ts +15 -0
- package/dist.commonjs/ckb/script.d.ts.map +1 -1
- package/dist.commonjs/ckb/script.js +6 -0
- package/dist.commonjs/ckb/transaction.d.ts +65 -11
- package/dist.commonjs/ckb/transaction.d.ts.map +1 -1
- package/dist.commonjs/ckb/transaction.js +41 -14
- package/dist.commonjs/ckb/transactionLumos.d.ts +29 -0
- package/dist.commonjs/ckb/transactionLumos.d.ts.map +1 -0
- package/dist.commonjs/ckb/transactionLumos.js +2 -0
- package/dist.commonjs/client/client.d.ts +13 -1
- package/dist.commonjs/client/client.d.ts.map +1 -1
- package/dist.commonjs/client/client.js +10 -1
- package/dist.commonjs/client/clientPublicMainnet.d.ts +3 -0
- package/dist.commonjs/client/clientPublicMainnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicMainnet.js +3 -0
- package/dist.commonjs/client/clientPublicTestnet.d.ts +3 -0
- package/dist.commonjs/client/clientPublicTestnet.d.ts.map +1 -1
- package/dist.commonjs/client/clientPublicTestnet.js +3 -0
- package/dist.commonjs/client/clientTypes.d.ts +45 -0
- package/dist.commonjs/client/clientTypes.d.ts.map +1 -1
- package/dist.commonjs/client/clientTypes.js +9 -0
- package/dist.commonjs/client/jsonRpc/index.d.ts +6 -6
- package/dist.commonjs/client/jsonRpc/index.d.ts.map +1 -1
- package/dist.commonjs/client/jsonRpc/index.js +3 -3
- package/dist.commonjs/fixedPoint/index.d.ts +6 -0
- package/dist.commonjs/fixedPoint/index.d.ts.map +1 -1
- package/dist.commonjs/fixedPoint/index.js +5 -0
- package/dist.commonjs/hasher/hasher.d.ts +3 -0
- package/dist.commonjs/hasher/hasher.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherCkb.d.ts +6 -1
- package/dist.commonjs/hasher/hasherCkb.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherCkb.js +6 -1
- package/dist.commonjs/hasher/hasherKeecak256.d.ts +3 -0
- package/dist.commonjs/hasher/hasherKeecak256.d.ts.map +1 -1
- package/dist.commonjs/hasher/hasherKeecak256.js +3 -0
- package/dist.commonjs/hex/index.d.ts +3 -0
- package/dist.commonjs/hex/index.d.ts.map +1 -1
- package/dist.commonjs/hex/index.js +1 -0
- package/dist.commonjs/keystore/index.d.ts +6 -0
- package/dist.commonjs/keystore/index.d.ts.map +1 -1
- package/dist.commonjs/keystore/index.js +6 -0
- package/dist.commonjs/num/index.d.ts +11 -0
- package/dist.commonjs/num/index.d.ts.map +1 -1
- package/dist.commonjs/num/index.js +9 -0
- package/dist.commonjs/signer/btc/signerBtc.d.ts +1 -0
- package/dist.commonjs/signer/btc/signerBtc.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtc.js +1 -0
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts +1 -0
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/signerBtcPublicKeyReadonly.js +1 -0
- package/dist.commonjs/signer/btc/verify.d.ts +3 -0
- package/dist.commonjs/signer/btc/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/btc/verify.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbPrivateKey.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts +3 -0
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbPublicKey.js +3 -0
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts +1 -0
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/signerCkbScriptReadonly.js +1 -0
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts +6 -0
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/verifyCkbSecp256k1.js +6 -0
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts +3 -0
- package/dist.commonjs/signer/ckb/verifyJoyId.d.ts.map +1 -1
- package/dist.commonjs/signer/ckb/verifyJoyId.js +3 -0
- package/dist.commonjs/signer/dummy/alwaysError.d.ts +3 -0
- package/dist.commonjs/signer/dummy/alwaysError.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/alwaysError.js +3 -0
- package/dist.commonjs/signer/dummy/dummy.d.ts +3 -0
- package/dist.commonjs/signer/dummy/dummy.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/dummy.js +3 -0
- package/dist.commonjs/signer/dummy/openLink.d.ts +3 -0
- package/dist.commonjs/signer/dummy/openLink.d.ts.map +1 -1
- package/dist.commonjs/signer/dummy/openLink.js +3 -0
- package/dist.commonjs/signer/evm/signerEvm.d.ts +1 -0
- package/dist.commonjs/signer/evm/signerEvm.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvm.js +1 -0
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts +1 -0
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/signerEvmAddressReadonly.js +1 -0
- package/dist.commonjs/signer/evm/verify.d.ts +3 -0
- package/dist.commonjs/signer/evm/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/evm/verify.js +3 -0
- package/dist.commonjs/signer/nostr/signerNostr.d.ts +6 -0
- package/dist.commonjs/signer/nostr/signerNostr.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/signerNostr.js +3 -0
- package/dist.commonjs/signer/nostr/verify.d.ts +3 -0
- package/dist.commonjs/signer/nostr/verify.d.ts.map +1 -1
- package/dist.commonjs/signer/nostr/verify.js +3 -0
- package/dist.commonjs/signer/signer/index.d.ts +26 -3
- package/dist.commonjs/signer/signer/index.d.ts.map +1 -1
- package/dist.commonjs/signer/signer/index.js +12 -3
- package/dist.commonjs/utils/index.d.ts +12 -0
- package/dist.commonjs/utils/index.d.ts.map +1 -1
- package/dist.commonjs/utils/index.js +13 -0
- package/package.json +8 -10
- package/src/address/index.ts +4 -1
- package/src/advancedBarrel.ts +1 -0
- package/src/bytes/advanced.ts +1 -0
- package/src/bytes/index.ts +9 -0
- package/src/ckb/index.ts +1 -0
- package/src/ckb/script.ts +15 -0
- package/src/ckb/transaction.ts +72 -16
- package/src/ckb/transactionLumos.ts +26 -0
- package/src/client/client.ts +13 -1
- package/src/client/clientPublicMainnet.ts +3 -0
- package/src/client/clientPublicTestnet.ts +3 -0
- package/src/client/clientTypes.ts +45 -0
- package/src/client/jsonRpc/index.ts +5 -6
- package/src/fixedPoint/index.ts +6 -0
- package/src/hasher/hasher.ts +3 -0
- package/src/hasher/hasherCkb.ts +6 -1
- package/src/hasher/hasherKeecak256.ts +3 -0
- package/src/hex/index.ts +3 -0
- package/src/keystore/index.ts +6 -0
- package/src/num/index.ts +11 -0
- package/src/signer/btc/signerBtc.ts +1 -0
- package/src/signer/btc/signerBtcPublicKeyReadonly.ts +1 -0
- package/src/signer/btc/verify.ts +3 -0
- package/src/signer/ckb/signerCkbPrivateKey.ts +3 -0
- package/src/signer/ckb/signerCkbPublicKey.ts +3 -0
- package/src/signer/ckb/signerCkbScriptReadonly.ts +1 -0
- package/src/signer/ckb/verifyCkbSecp256k1.ts +6 -0
- package/src/signer/ckb/verifyJoyId.ts +3 -0
- package/src/signer/dummy/alwaysError.ts +3 -0
- package/src/signer/dummy/dummy.ts +3 -0
- package/src/signer/dummy/openLink.ts +3 -0
- package/src/signer/evm/signerEvm.ts +1 -0
- package/src/signer/evm/signerEvmAddressReadonly.ts +1 -0
- package/src/signer/evm/verify.ts +3 -0
- package/src/signer/nostr/signerNostr.ts +6 -0
- package/src/signer/nostr/verify.ts +3 -0
- package/src/signer/signer/index.ts +26 -14
- package/src/utils/index.ts +22 -0
- package/typedoc.json +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signerNostr.d.ts","sourceRoot":"","sources":["../../../src/signer/nostr/signerNostr.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,SAAS,EAA0B,MAAM,sBAAsB,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,eAAe,EAAe,MAAM,oBAAoB,CAAC;AAG/E,OAAO,EAAE,GAAG,EAAW,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGxE,MAAM,WAAW,UAAU;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,8BAAsB,WAAY,SAAQ,MAAM;IAC9C,MAAM,CAAC,oBAAoB,SAAqB;IAChD,MAAM,CAAC,qBAAqB,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UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,8BAAsB,WAAY,SAAQ,MAAM;IAC9C,MAAM,CAAC,oBAAoB,SAAqB;IAChD,MAAM,CAAC,qBAAqB,SAAS;IACrC,MAAM,CAAC,wBAAwB,SACkH;IAEjJ,IAAI,IAAI,IAAI,UAAU,CAErB;IAED,IAAI,QAAQ,IAAI,cAAc,CAE7B;IAED;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,IAAI,OAAO,CAAC,GAAG,CAAC;IAE1C;;;;OAIG;IACH,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;IAEzE;;;;OAIG;IACG,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;IAM/D;;;;OAIG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,CAAC;IAO3C;;;;OAIG;IACG,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAW1C;;;;;OAKG;IACG,kBAAkB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;IAQvE;;;;;OAKG;IACG,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,WAAW,CAAC;CA2BzE"}
|
|
@@ -10,6 +10,9 @@ const index_js_5 = require("../../hasher/index.js");
|
|
|
10
10
|
const index_js_6 = require("../../hex/index.js");
|
|
11
11
|
const index_js_7 = require("../signer/index.js");
|
|
12
12
|
const verify_js_1 = require("./verify.js");
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
13
16
|
class SignerNostr extends index_js_7.Signer {
|
|
14
17
|
get type() {
|
|
15
18
|
return index_js_7.SignerType.Nostr;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BytesLike } from "../../bytes/index.js";
|
|
2
2
|
import { NostrEvent } from "./signerNostr.js";
|
|
3
|
+
/**
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
3
6
|
export declare function buildNostrEventFromMessage(message: string | BytesLike): NostrEvent;
|
|
4
7
|
export declare function verifyMessageNostrEvent(message: string | BytesLike, signature: string, address: string): boolean;
|
|
5
8
|
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/signer/nostr/verify.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,UAAU,CA2BZ;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAoBT"}
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../../src/signer/nostr/verify.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAa,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,GAAG,SAAS,GAC1B,UAAU,CA2BZ;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAoBT"}
|
|
@@ -6,6 +6,9 @@ const sha256_1 = require("@noble/hashes/sha256");
|
|
|
6
6
|
const bech32_1 = require("bech32");
|
|
7
7
|
const index_js_1 = require("../../bytes/index.js");
|
|
8
8
|
const index_js_2 = require("../../hex/index.js");
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
function buildNostrEventFromMessage(message) {
|
|
10
13
|
if (typeof message === "string") {
|
|
11
14
|
try {
|
|
@@ -4,6 +4,9 @@ import { Transaction, TransactionLike } from "../../ckb/index.js";
|
|
|
4
4
|
import { Client } from "../../client/index.js";
|
|
5
5
|
import { Hex } from "../../hex/index.js";
|
|
6
6
|
import { Num } from "../../num/index.js";
|
|
7
|
+
/**
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
7
10
|
export declare enum SignerSignType {
|
|
8
11
|
Unknown = "Unknown",
|
|
9
12
|
BtcEcdsa = "BtcEcdsa",
|
|
@@ -14,6 +17,7 @@ export declare enum SignerSignType {
|
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* An enumeration of signer display types in wallet.
|
|
20
|
+
* @public
|
|
17
21
|
*/
|
|
18
22
|
export declare enum SignerType {
|
|
19
23
|
EVM = "EVM",
|
|
@@ -21,11 +25,27 @@ export declare enum SignerType {
|
|
|
21
25
|
CKB = "CKB",
|
|
22
26
|
Nostr = "Nostr"
|
|
23
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
24
31
|
export type NetworkPreference = {
|
|
25
32
|
addressPrefix: string;
|
|
26
33
|
signerType: SignerType;
|
|
34
|
+
/**
|
|
35
|
+
* Wallet signers should check if the wallet is using preferred networks.
|
|
36
|
+
* If not, try to switch to the first preferred network.
|
|
37
|
+
* If non preferred, let users choose what they want.
|
|
38
|
+
* BTC: // They made a mess...
|
|
39
|
+
* btc
|
|
40
|
+
* btcTestnet
|
|
41
|
+
* btcSignet // OKX
|
|
42
|
+
* fractalBtc // UniSat
|
|
43
|
+
*/
|
|
27
44
|
network: string;
|
|
28
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
29
49
|
export declare class Signature {
|
|
30
50
|
signature: string;
|
|
31
51
|
identity: string;
|
|
@@ -35,6 +55,7 @@ export declare class Signature {
|
|
|
35
55
|
/**
|
|
36
56
|
* An abstract class representing a generic signer.
|
|
37
57
|
* This class provides methods to connect, get addresses, and sign transactions.
|
|
58
|
+
* @public
|
|
38
59
|
*/
|
|
39
60
|
export declare abstract class Signer {
|
|
40
61
|
protected client_: Client;
|
|
@@ -115,7 +136,7 @@ export declare abstract class Signer {
|
|
|
115
136
|
/**
|
|
116
137
|
* Signs a message.
|
|
117
138
|
*
|
|
118
|
-
* @param
|
|
139
|
+
* @param message - The message to sign, as a string or BytesLike object.
|
|
119
140
|
* @returns A promise that resolves to the signature info.
|
|
120
141
|
* @throws Will throw an error if not implemented.
|
|
121
142
|
*/
|
|
@@ -131,8 +152,8 @@ export declare abstract class Signer {
|
|
|
131
152
|
/**
|
|
132
153
|
* Verify a signature.
|
|
133
154
|
*
|
|
134
|
-
* @param
|
|
135
|
-
* @param
|
|
155
|
+
* @param message - The original message.
|
|
156
|
+
* @param signature - The signature to verify.
|
|
136
157
|
* @returns A promise that resolves to the verification result.
|
|
137
158
|
* @throws Will throw an error if not implemented.
|
|
138
159
|
*/
|
|
@@ -170,6 +191,7 @@ export declare abstract class Signer {
|
|
|
170
191
|
}
|
|
171
192
|
/**
|
|
172
193
|
* A class representing information about a signer, including its type and the signer instance.
|
|
194
|
+
* @public
|
|
173
195
|
*/
|
|
174
196
|
export declare class SignerInfo {
|
|
175
197
|
name: string;
|
|
@@ -178,6 +200,7 @@ export declare class SignerInfo {
|
|
|
178
200
|
}
|
|
179
201
|
/**
|
|
180
202
|
* Represents a wallet with a name, icon, and an array of signer information.
|
|
203
|
+
* @public
|
|
181
204
|
*/
|
|
182
205
|
export type Wallet = {
|
|
183
206
|
name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/signer/signer/index.ts"],"names":[],"mappings":"AAAA,OAAO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JoyId_js_1 = require("../ckb/verifyJoyId.js");
|
|
7
7
|
const verify_js_1 = require("../evm/verify.js");
|
|
8
8
|
const verify_js_2 = require("../nostr/verify.js");
|
|
9
|
+
/**
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
9
12
|
var SignerSignType;
|
|
10
13
|
(function (SignerSignType) {
|
|
11
14
|
SignerSignType["Unknown"] = "Unknown";
|
|
@@ -17,6 +20,7 @@ var SignerSignType;
|
|
|
17
20
|
})(SignerSignType || (exports.SignerSignType = SignerSignType = {}));
|
|
18
21
|
/**
|
|
19
22
|
* An enumeration of signer display types in wallet.
|
|
23
|
+
* @public
|
|
20
24
|
*/
|
|
21
25
|
var SignerType;
|
|
22
26
|
(function (SignerType) {
|
|
@@ -25,6 +29,9 @@ var SignerType;
|
|
|
25
29
|
SignerType["CKB"] = "CKB";
|
|
26
30
|
SignerType["Nostr"] = "Nostr";
|
|
27
31
|
})(SignerType || (exports.SignerType = SignerType = {}));
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
28
35
|
class Signature {
|
|
29
36
|
constructor(signature, identity, signType) {
|
|
30
37
|
this.signature = signature;
|
|
@@ -36,6 +43,7 @@ exports.Signature = Signature;
|
|
|
36
43
|
/**
|
|
37
44
|
* An abstract class representing a generic signer.
|
|
38
45
|
* This class provides methods to connect, get addresses, and sign transactions.
|
|
46
|
+
* @public
|
|
39
47
|
*/
|
|
40
48
|
class Signer {
|
|
41
49
|
constructor(client_) {
|
|
@@ -131,7 +139,7 @@ class Signer {
|
|
|
131
139
|
/**
|
|
132
140
|
* Signs a message.
|
|
133
141
|
*
|
|
134
|
-
* @param
|
|
142
|
+
* @param message - The message to sign, as a string or BytesLike object.
|
|
135
143
|
* @returns A promise that resolves to the signature info.
|
|
136
144
|
* @throws Will throw an error if not implemented.
|
|
137
145
|
*/
|
|
@@ -155,8 +163,8 @@ class Signer {
|
|
|
155
163
|
/**
|
|
156
164
|
* Verify a signature.
|
|
157
165
|
*
|
|
158
|
-
* @param
|
|
159
|
-
* @param
|
|
166
|
+
* @param message - The original message.
|
|
167
|
+
* @param signature - The signature to verify.
|
|
160
168
|
* @returns A promise that resolves to the verification result.
|
|
161
169
|
* @throws Will throw an error if not implemented.
|
|
162
170
|
*/
|
|
@@ -217,6 +225,7 @@ class Signer {
|
|
|
217
225
|
exports.Signer = Signer;
|
|
218
226
|
/**
|
|
219
227
|
* A class representing information about a signer, including its type and the signer instance.
|
|
228
|
+
* @public
|
|
220
229
|
*/
|
|
221
230
|
class SignerInfo {
|
|
222
231
|
constructor(name, signer) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
3
|
+
* @public
|
|
3
4
|
*
|
|
4
5
|
* @param transformer - The transformer.
|
|
5
6
|
* @param value - The value to be transformed.
|
|
@@ -8,6 +9,7 @@
|
|
|
8
9
|
export declare function apply<T, R>(transformer: (val: T) => R, value: undefined): undefined;
|
|
9
10
|
/**
|
|
10
11
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
12
|
+
* @public
|
|
11
13
|
*
|
|
12
14
|
* @param transformer - The transformer.
|
|
13
15
|
* @param value - The value to be transformed.
|
|
@@ -16,6 +18,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: undefined
|
|
|
16
18
|
export declare function apply<T, R>(transformer: (val: T) => R, value: null): undefined;
|
|
17
19
|
/**
|
|
18
20
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
21
|
+
* @public
|
|
19
22
|
*
|
|
20
23
|
* @param transformer - The transformer.
|
|
21
24
|
* @param value - The value to be transformed.
|
|
@@ -24,6 +27,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: null): un
|
|
|
24
27
|
export declare function apply<T, R>(transformer: (val: T) => R, value: T): R;
|
|
25
28
|
/**
|
|
26
29
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
30
|
+
* @public
|
|
27
31
|
*
|
|
28
32
|
* @param transformer - The transformer.
|
|
29
33
|
* @param value - The value to be transformed.
|
|
@@ -32,6 +36,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: T): R;
|
|
|
32
36
|
export declare function apply<T, R>(transformer: (val: T) => R, value: T | undefined): R | undefined;
|
|
33
37
|
/**
|
|
34
38
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
39
|
+
* @public
|
|
35
40
|
*
|
|
36
41
|
* @param transformer - The transformer.
|
|
37
42
|
* @param value - The value to be transformed.
|
|
@@ -40,6 +45,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: T | undef
|
|
|
40
45
|
export declare function apply<T, R>(transformer: (val: T) => R, value: T | null): R | undefined;
|
|
41
46
|
/**
|
|
42
47
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
48
|
+
* @public
|
|
43
49
|
*
|
|
44
50
|
* @param transformer - The transformer.
|
|
45
51
|
* @param value - The value to be transformed.
|
|
@@ -49,6 +55,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: undefined
|
|
|
49
55
|
/**
|
|
50
56
|
/**
|
|
51
57
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
58
|
+
* @public
|
|
52
59
|
*
|
|
53
60
|
* @param transformer - The transformer.
|
|
54
61
|
* @param value - The value to be transformed.
|
|
@@ -57,6 +64,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: undefined
|
|
|
57
64
|
export declare function apply<T, R>(transformer: (val: T) => R, value: T | undefined | null): R | undefined;
|
|
58
65
|
/**
|
|
59
66
|
* Similar to Array.reduce, but the accumulator can returns Promise.
|
|
67
|
+
* @public
|
|
60
68
|
*
|
|
61
69
|
* @param values - The array to be reduced.
|
|
62
70
|
* @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
|
|
@@ -65,6 +73,7 @@ export declare function apply<T, R>(transformer: (val: T) => R, value: T | undef
|
|
|
65
73
|
export declare function reduceAsync<T, V>(values: T[], accumulator: (a: T, b: T) => Promise<T | undefined | null | void> | T | undefined | null | void): Promise<T>;
|
|
66
74
|
/**
|
|
67
75
|
* Similar to Array.reduce, but the accumulator can returns Promise.
|
|
76
|
+
* @public
|
|
68
77
|
*
|
|
69
78
|
* @param values - The array to be reduced.
|
|
70
79
|
* @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
|
|
@@ -72,5 +81,8 @@ export declare function reduceAsync<T, V>(values: T[], accumulator: (a: T, b: T)
|
|
|
72
81
|
* @returns The accumulated result.
|
|
73
82
|
*/
|
|
74
83
|
export declare function reduceAsync<T, V>(values: V[], accumulator: (a: T, b: V, i: number, values: V[]) => Promise<T | undefined | null | void> | T | undefined | null | void, init: T | Promise<T>): Promise<T>;
|
|
84
|
+
/**
|
|
85
|
+
* @public
|
|
86
|
+
*/
|
|
75
87
|
export declare function isWebview(userAgent: string): boolean;
|
|
76
88
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EACxB,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAC1B,KAAK,EAAE,SAAS,GACf,SAAS,CAAC;AACb;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC;AAChF;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;AACrE;;;;;;;GAOG;AACH,wBAA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AO,CAAC,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,EACvE,IAAI,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAAC;AAqCd;;GAEG;AACH,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEpD"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isWebview = exports.reduceAsync = exports.apply = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* A type safe way to apply a transformer on a value if it's not empty.
|
|
6
|
+
* @public
|
|
6
7
|
*
|
|
7
8
|
* @param transformer - The transformer.
|
|
8
9
|
* @param value - The value to be transformed.
|
|
@@ -15,6 +16,15 @@ function apply(transformer, value) {
|
|
|
15
16
|
return transformer(value);
|
|
16
17
|
}
|
|
17
18
|
exports.apply = apply;
|
|
19
|
+
/**
|
|
20
|
+
* Similar to Array.reduce, but the accumulator can returns Promise.
|
|
21
|
+
* @public
|
|
22
|
+
*
|
|
23
|
+
* @param values - The array to be reduced.
|
|
24
|
+
* @param accumulator - A callback to be called for each value. If it returns null, the previous result will be kept.
|
|
25
|
+
* @param init - The initial value.
|
|
26
|
+
* @returns The accumulated result.
|
|
27
|
+
*/
|
|
18
28
|
async function reduceAsync(values, accumulator, init) {
|
|
19
29
|
if (init === undefined) {
|
|
20
30
|
if (values.length === 0) {
|
|
@@ -26,6 +36,9 @@ async function reduceAsync(values, accumulator, init) {
|
|
|
26
36
|
return values.reduce((current, b, i, array) => current.then((v) => Promise.resolve(accumulator(v, b, i, array)).then((r) => r ?? v)), Promise.resolve(init));
|
|
27
37
|
}
|
|
28
38
|
exports.reduceAsync = reduceAsync;
|
|
39
|
+
/**
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
29
42
|
function isWebview(userAgent) {
|
|
30
43
|
return /webview|wv|ip((?!.*Safari)|(?=.*like Safari))/i.test(userAgent);
|
|
31
44
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckb-ccc/core",
|
|
3
|
-
"version": "0.0.12
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Core of CCC - CKBer's Codebase",
|
|
5
5
|
"author": "Hanssen0 <hanssen0@hanssen0.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,12 +30,6 @@
|
|
|
30
30
|
"default": "./dist.commonjs/advanced.js"
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
"scripts": {
|
|
34
|
-
"test": "jest",
|
|
35
|
-
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
|
|
36
|
-
"lint": "eslint",
|
|
37
|
-
"format": "prettier --write . && eslint --fix"
|
|
38
|
-
},
|
|
39
33
|
"devDependencies": {
|
|
40
34
|
"@eslint/js": "^9.1.1",
|
|
41
35
|
"@types/blake2b": "^2.1.3",
|
|
@@ -57,7 +51,6 @@
|
|
|
57
51
|
"access": "public"
|
|
58
52
|
},
|
|
59
53
|
"dependencies": {
|
|
60
|
-
"@ckb-lumos/helpers": "^0.22.2",
|
|
61
54
|
"@joyid/ckb": "^1.0.1",
|
|
62
55
|
"@noble/ciphers": "^0.5.3",
|
|
63
56
|
"@noble/curves": "^1.4.2",
|
|
@@ -69,5 +62,10 @@
|
|
|
69
62
|
"cross-fetch": "^4.0.0",
|
|
70
63
|
"ethers": "^6.13.1"
|
|
71
64
|
},
|
|
72
|
-
"
|
|
73
|
-
|
|
65
|
+
"scripts": {
|
|
66
|
+
"test": "jest",
|
|
67
|
+
"build": "rimraf ./dist && rimraf ./dist.commonjs && tsc && tsc --project tsconfig.commonjs.json && copyfiles -u 2 misc/basedirs/**/* .",
|
|
68
|
+
"lint": "eslint",
|
|
69
|
+
"format": "prettier --write . && eslint --fix"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/src/address/index.ts
CHANGED
|
@@ -10,6 +10,9 @@ import {
|
|
|
10
10
|
addressPayloadFromString,
|
|
11
11
|
} from "./address.advanced.js";
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
13
16
|
export type AddressLike = {
|
|
14
17
|
script: ScriptLike;
|
|
15
18
|
prefix: string;
|
|
@@ -17,8 +20,8 @@ export type AddressLike = {
|
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Represents a ckb address with associated script and prefix.
|
|
23
|
+
* @public
|
|
20
24
|
*/
|
|
21
|
-
|
|
22
25
|
export class Address {
|
|
23
26
|
/**
|
|
24
27
|
* Creates an instance of Address.
|
package/src/advancedBarrel.ts
CHANGED
package/src/bytes/advanced.ts
CHANGED
package/src/bytes/index.ts
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { Buffer } from "buffer/index.js";
|
|
2
2
|
import { BytesFromEncoding } from "./advanced.js";
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
4
7
|
export type Bytes = Uint8Array;
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
5
11
|
export type BytesLike = string | Uint8Array | ArrayBuffer | number[];
|
|
6
12
|
|
|
7
13
|
/**
|
|
8
14
|
* Concatenates multiple byte-like arrays into a single byte array.
|
|
15
|
+
* @public
|
|
9
16
|
*
|
|
10
17
|
* @param args - The byte-like arrays to concatenate.
|
|
11
18
|
* @returns A Uint8Array containing the concatenated bytes.
|
|
@@ -33,6 +40,7 @@ export function bytesConcat(...args: BytesLike[]): Bytes {
|
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* Converts a byte-like value to a string using the specified encoding.
|
|
43
|
+
* @public
|
|
36
44
|
*
|
|
37
45
|
* @param val - The byte-like value to convert.
|
|
38
46
|
* @param encoding - The encoding to use for the conversion, as defined by the BytesFromEncoding type.
|
|
@@ -54,6 +62,7 @@ export function bytesTo(val: BytesLike, encoding: BytesFromEncoding): string {
|
|
|
54
62
|
|
|
55
63
|
/**
|
|
56
64
|
* Converts various types of byte-like values to a Uint8Array.
|
|
65
|
+
* @public
|
|
57
66
|
*
|
|
58
67
|
* @param bytes - The byte-like value to convert. It can be a string, Uint8Array, ArrayBuffer, or number array.
|
|
59
68
|
* @param encoding - Optional encoding to use if the input is a string. Defaults to hexadecimal if not specified.
|
package/src/ckb/index.ts
CHANGED
package/src/ckb/script.ts
CHANGED
|
@@ -9,11 +9,18 @@ import {
|
|
|
9
9
|
NUM_TO_HASH_TYPE,
|
|
10
10
|
} from "./script.advanced.js";
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
12
15
|
export type HashTypeLike = string | number | bigint;
|
|
16
|
+
/**
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
13
19
|
export type HashType = "type" | "data" | "data1" | "data2";
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* Converts a HashTypeLike value to a HashType.
|
|
23
|
+
* @public
|
|
17
24
|
*
|
|
18
25
|
* @param val - The value to convert, which can be a string, number, or bigint.
|
|
19
26
|
* @returns The corresponding HashType.
|
|
@@ -50,6 +57,7 @@ export function hashTypeFrom(val: HashTypeLike): HashType {
|
|
|
50
57
|
|
|
51
58
|
/**
|
|
52
59
|
* Converts a HashTypeLike value to its corresponding byte representation.
|
|
60
|
+
* @public
|
|
53
61
|
*
|
|
54
62
|
* @param hashType - The hash type value to convert.
|
|
55
63
|
* @returns A Uint8Array containing the byte representation of the hash type.
|
|
@@ -66,6 +74,7 @@ export function hashTypeToBytes(hashType: HashTypeLike): Bytes {
|
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
76
|
* Converts a byte-like value to a HashType.
|
|
77
|
+
* @public
|
|
69
78
|
*
|
|
70
79
|
* @param bytes - The byte-like value to convert.
|
|
71
80
|
* @returns The corresponding HashType.
|
|
@@ -82,11 +91,17 @@ export function hashTypeFromBytes(bytes: BytesLike): HashType {
|
|
|
82
91
|
return NUM_TO_HASH_TYPE[bytesFrom(bytes)[0]];
|
|
83
92
|
}
|
|
84
93
|
|
|
94
|
+
/**
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
85
97
|
export type ScriptLike = {
|
|
86
98
|
codeHash: BytesLike;
|
|
87
99
|
hashType: HashTypeLike;
|
|
88
100
|
args: BytesLike;
|
|
89
101
|
};
|
|
102
|
+
/**
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
90
105
|
export class Script {
|
|
91
106
|
/**
|
|
92
107
|
* Creates an instance of Script.
|