@kontor/kontor-sdk 1.0.0-alpha.15 → 1.0.0-alpha.16
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/dist/cjs/exports/index.js +17 -1
- package/dist/cjs/exports/index.js.map +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/exports/index.js +8 -0
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/exports/index.d.ts +8 -0
- package/dist/types/exports/index.d.ts.map +1 -1
- package/package.json +2 -6
- package/src/exports/index.ts +44 -0
- package/dist/src/exports/index.js +0 -11
- package/dist/src/exports/index.js.map +0 -1
- package/dist/src/exports/index.test.js +0 -10
- package/dist/src/exports/index.test.js.map +0 -1
- package/dist/src/sdk/accounts/hd-key-to-account.js +0 -20
- package/dist/src/sdk/accounts/hd-key-to-account.js.map +0 -1
- package/dist/src/sdk/accounts/mnemonic-to-account.js +0 -16
- package/dist/src/sdk/accounts/mnemonic-to-account.js.map +0 -1
- package/dist/src/sdk/accounts/mnemonic-to-account.test.js +0 -96
- package/dist/src/sdk/accounts/mnemonic-to-account.test.js.map +0 -1
- package/dist/src/sdk/accounts/private-key-to-account.js +0 -42
- package/dist/src/sdk/accounts/private-key-to-account.js.map +0 -1
- package/dist/src/sdk/accounts/to-local-account.js +0 -28
- package/dist/src/sdk/accounts/to-local-account.js.map +0 -1
- package/dist/src/sdk/accounts/types.js +0 -2
- package/dist/src/sdk/accounts/types.js.map +0 -1
- package/dist/src/sdk/accounts/utils/parse-account.js +0 -10
- package/dist/src/sdk/accounts/utils/parse-account.js.map +0 -1
- package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js +0 -14
- package/dist/src/sdk/accounts/utils/public-key-to-p2tr-payment.js.map +0 -1
- package/dist/src/sdk/accounts/utils/sign-psbt.js +0 -17
- package/dist/src/sdk/accounts/utils/sign-psbt.js.map +0 -1
- package/dist/src/sdk/actions/get-contract.js +0 -50
- package/dist/src/sdk/actions/get-contract.js.map +0 -1
- package/dist/src/sdk/actions/get-contract.test-d.js +0 -43
- package/dist/src/sdk/actions/get-contract.test-d.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/build-compose-query.js +0 -30
- package/dist/src/sdk/actions/kontor/public/build-compose-query.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js +0 -45
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/call-compose.js +0 -38
- package/dist/src/sdk/actions/kontor/public/call-compose.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/call-view.js +0 -21
- package/dist/src/sdk/actions/kontor/public/call-view.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/inspect.js +0 -20
- package/dist/src/sdk/actions/kontor/public/inspect.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/proc-contract.js +0 -54
- package/dist/src/sdk/actions/kontor/public/proc-contract.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js +0 -47
- package/dist/src/sdk/actions/kontor/public/proc-contract.test.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/view-contract.js +0 -43
- package/dist/src/sdk/actions/kontor/public/view-contract.js.map +0 -1
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js +0 -43
- package/dist/src/sdk/actions/kontor/public/view-contract.test-d.js.map +0 -1
- package/dist/src/sdk/actions/kontor/wallet/sign-commit.js +0 -34
- package/dist/src/sdk/actions/kontor/wallet/sign-commit.js.map +0 -1
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +0 -88
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +0 -1
- package/dist/src/sdk/actions/public/send-raw-transaction.js +0 -7
- package/dist/src/sdk/actions/public/send-raw-transaction.js.map +0 -1
- package/dist/src/sdk/actions/public/test-mempool-accept.js +0 -20
- package/dist/src/sdk/actions/public/test-mempool-accept.js.map +0 -1
- package/dist/src/sdk/actions/wallet/get-addresses.js +0 -20
- package/dist/src/sdk/actions/wallet/get-addresses.js.map +0 -1
- package/dist/src/sdk/actions/wallet/sign-psbt.js +0 -28
- package/dist/src/sdk/actions/wallet/sign-psbt.js.map +0 -1
- package/dist/src/sdk/chains/definitions/index.js +0 -2
- package/dist/src/sdk/chains/definitions/index.js.map +0 -1
- package/dist/src/sdk/chains/definitions/signet.js +0 -36
- package/dist/src/sdk/chains/definitions/signet.js.map +0 -1
- package/dist/src/sdk/clients/base/create-http-client.js +0 -41
- package/dist/src/sdk/clients/base/create-http-client.js.map +0 -1
- package/dist/src/sdk/clients/base/create-rpc-client.js +0 -41
- package/dist/src/sdk/clients/base/create-rpc-client.js.map +0 -1
- package/dist/src/sdk/clients/base/create-rpc-client.test.js +0 -145
- package/dist/src/sdk/clients/base/create-rpc-client.test.js.map +0 -1
- package/dist/src/sdk/clients/create-public-client.js +0 -13
- package/dist/src/sdk/clients/create-public-client.js.map +0 -1
- package/dist/src/sdk/clients/create-public-client.test.js +0 -113
- package/dist/src/sdk/clients/create-public-client.test.js.map +0 -1
- package/dist/src/sdk/clients/create-wallet-client.js +0 -14
- package/dist/src/sdk/clients/create-wallet-client.js.map +0 -1
- package/dist/src/sdk/clients/decorators/kontor/public.js +0 -19
- package/dist/src/sdk/clients/decorators/kontor/public.js.map +0 -1
- package/dist/src/sdk/clients/decorators/kontor/wallet.js +0 -13
- package/dist/src/sdk/clients/decorators/kontor/wallet.js.map +0 -1
- package/dist/src/sdk/clients/decorators/public.js +0 -9
- package/dist/src/sdk/clients/decorators/public.js.map +0 -1
- package/dist/src/sdk/clients/decorators/wallet.js +0 -9
- package/dist/src/sdk/clients/decorators/wallet.js.map +0 -1
- package/dist/src/sdk/clients/kontor/create-public-client.js +0 -14
- package/dist/src/sdk/clients/kontor/create-public-client.js.map +0 -1
- package/dist/src/sdk/clients/kontor/create-public-client.test.js +0 -44
- package/dist/src/sdk/clients/kontor/create-public-client.test.js.map +0 -1
- package/dist/src/sdk/clients/kontor/create-wallet-client.js +0 -14
- package/dist/src/sdk/clients/kontor/create-wallet-client.js.map +0 -1
- package/dist/src/sdk/clients/transports/create-http-transport.js +0 -25
- package/dist/src/sdk/clients/transports/create-http-transport.js.map +0 -1
- package/dist/src/sdk/clients/transports/create-rpc-transport.js +0 -36
- package/dist/src/sdk/clients/transports/create-rpc-transport.js.map +0 -1
- package/dist/src/sdk/clients/transports/create-rpc-transport.test.js +0 -58
- package/dist/src/sdk/clients/transports/create-rpc-transport.test.js.map +0 -1
- package/dist/src/sdk/clients/transports/custom.js +0 -14
- package/dist/src/sdk/clients/transports/custom.js.map +0 -1
- package/dist/src/sdk/clients/transports/http-rpc.js +0 -84
- package/dist/src/sdk/clients/transports/http-rpc.js.map +0 -1
- package/dist/src/sdk/clients/transports/http-rpc.test.js +0 -147
- package/dist/src/sdk/clients/transports/http-rpc.test.js.map +0 -1
- package/dist/src/sdk/clients/transports/http.js +0 -45
- package/dist/src/sdk/clients/transports/http.js.map +0 -1
- package/dist/src/sdk/contracts/wits.js +0 -26
- package/dist/src/sdk/contracts/wits.js.map +0 -1
- package/dist/src/sdk/errors/address.js +0 -13
- package/dist/src/sdk/errors/address.js.map +0 -1
- package/dist/src/sdk/errors/base.js +0 -92
- package/dist/src/sdk/errors/base.js.map +0 -1
- package/dist/src/sdk/errors/request.js +0 -100
- package/dist/src/sdk/errors/request.js.map +0 -1
- package/dist/src/sdk/errors/rpc.js +0 -30
- package/dist/src/sdk/errors/rpc.js.map +0 -1
- package/dist/src/sdk/errors/transport.js +0 -10
- package/dist/src/sdk/errors/transport.js.map +0 -1
- package/dist/src/sdk/errors/utils.js +0 -2
- package/dist/src/sdk/errors/utils.js.map +0 -1
- package/dist/src/sdk/errors/version.js +0 -2
- package/dist/src/sdk/errors/version.js.map +0 -1
- package/dist/src/sdk/errors/wit.js +0 -19
- package/dist/src/sdk/errors/wit.js.map +0 -1
- package/dist/src/sdk/test/e2e.test.js +0 -166
- package/dist/src/sdk/test/e2e.test.js.map +0 -1
- package/dist/src/sdk/types/account.js +0 -2
- package/dist/src/sdk/types/account.js.map +0 -1
- package/dist/src/sdk/types/btc-rpc.js +0 -2
- package/dist/src/sdk/types/btc-rpc.js.map +0 -1
- package/dist/src/sdk/types/chain.js +0 -2
- package/dist/src/sdk/types/chain.js.map +0 -1
- package/dist/src/sdk/types/contract.js +0 -2
- package/dist/src/sdk/types/contract.js.map +0 -1
- package/dist/src/sdk/types/contract.test-d.js +0 -35
- package/dist/src/sdk/types/contract.test-d.js.map +0 -1
- package/dist/src/sdk/types/http-schema.js +0 -73
- package/dist/src/sdk/types/http-schema.js.map +0 -1
- package/dist/src/sdk/types/http-schema.test-d.js +0 -133
- package/dist/src/sdk/types/http-schema.test-d.js.map +0 -1
- package/dist/src/sdk/types/kontor.js +0 -28
- package/dist/src/sdk/types/kontor.js.map +0 -1
- package/dist/src/sdk/types/misc.js +0 -2
- package/dist/src/sdk/types/misc.js.map +0 -1
- package/dist/src/sdk/types/rpc-schema.js +0 -2
- package/dist/src/sdk/types/rpc-schema.js.map +0 -1
- package/dist/src/sdk/types/rpc.js +0 -19
- package/dist/src/sdk/types/rpc.js.map +0 -1
- package/dist/src/sdk/types/utils.js +0 -2
- package/dist/src/sdk/types/utils.js.map +0 -1
- package/dist/src/sdk/types/wbip001.js +0 -3
- package/dist/src/sdk/types/wbip001.js.map +0 -1
- package/dist/src/sdk/utils/build-http-request.js +0 -55
- package/dist/src/sdk/utils/build-http-request.js.map +0 -1
- package/dist/src/sdk/utils/build-request.js +0 -35
- package/dist/src/sdk/utils/build-request.js.map +0 -1
- package/dist/src/sdk/utils/build-rpc-request.js +0 -84
- package/dist/src/sdk/utils/build-rpc-request.js.map +0 -1
- package/dist/src/sdk/utils/chain/defineChain.js +0 -9
- package/dist/src/sdk/utils/chain/defineChain.js.map +0 -1
- package/dist/src/sdk/utils/encoding/to-hex.js +0 -23
- package/dist/src/sdk/utils/encoding/to-hex.js.map +0 -1
- package/dist/src/sdk/utils/get-action.js +0 -27
- package/dist/src/sdk/utils/get-action.js.map +0 -1
- package/dist/src/sdk/utils/http.js +0 -137
- package/dist/src/sdk/utils/http.js.map +0 -1
- package/dist/src/sdk/utils/lru.js +0 -35
- package/dist/src/sdk/utils/lru.js.map +0 -1
- package/dist/src/sdk/utils/promise/create-batch-scheduler.js +0 -49
- package/dist/src/sdk/utils/promise/create-batch-scheduler.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-dedupe.js +0 -14
- package/dist/src/sdk/utils/promise/with-dedupe.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-resolvers.js +0 -10
- package/dist/src/sdk/utils/promise/with-resolvers.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-retry.js +0 -25
- package/dist/src/sdk/utils/promise/with-retry.js.map +0 -1
- package/dist/src/sdk/utils/promise/with-timeout.js +0 -30
- package/dist/src/sdk/utils/promise/with-timeout.js.map +0 -1
- package/dist/src/sdk/utils/rpc/http.js +0 -86
- package/dist/src/sdk/utils/rpc/http.js.map +0 -1
- package/dist/src/sdk/utils/rpc/id.js +0 -13
- package/dist/src/sdk/utils/rpc/id.js.map +0 -1
- package/dist/src/sdk/utils/stringify.js +0 -5
- package/dist/src/sdk/utils/stringify.js.map +0 -1
- package/dist/src/sdk/utils/uid.js +0 -14
- package/dist/src/sdk/utils/uid.js.map +0 -1
- package/dist/src/sdk/utils/wait.js +0 -4
- package/dist/src/sdk/utils/wait.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/decimal.js +0 -165
- package/dist/src/sdk/utils/wit/codecs/decimal.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/enum.js +0 -104
- package/dist/src/sdk/utils/wit/codecs/enum.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/integer.js +0 -167
- package/dist/src/sdk/utils/wit/codecs/integer.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/list.js +0 -117
- package/dist/src/sdk/utils/wit/codecs/list.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/option.js +0 -91
- package/dist/src/sdk/utils/wit/codecs/option.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/string.js +0 -27
- package/dist/src/sdk/utils/wit/codecs/string.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/types.js +0 -45
- package/dist/src/sdk/utils/wit/codecs/types.js.map +0 -1
- package/dist/src/sdk/utils/wit/codecs/unit.js +0 -22
- package/dist/src/sdk/utils/wit/codecs/unit.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-function-result.js +0 -36
- package/dist/src/sdk/utils/wit/decode-function-result.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js +0 -286
- package/dist/src/sdk/utils/wit/decode-wit-parameter.js.map +0 -1
- package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js +0 -75
- package/dist/src/sdk/utils/wit/decode-wit-parameter.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.js +0 -17
- package/dist/src/sdk/utils/wit/encode-function-data.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js +0 -21
- package/dist/src/sdk/utils/wit/encode-function-data.test-d.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-function-data.test.js +0 -91
- package/dist/src/sdk/utils/wit/encode-function-data.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js +0 -250
- package/dist/src/sdk/utils/wit/encode-wit-parameters.js.map +0 -1
- package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js +0 -62
- package/dist/src/sdk/utils/wit/encode-wit-parameters.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/get-wit-item.js +0 -15
- package/dist/src/sdk/utils/wit/get-wit-item.js.map +0 -1
- package/dist/src/sdk/utils/wit/get-wit-item.test.js +0 -118
- package/dist/src/sdk/utils/wit/get-wit-item.test.js.map +0 -1
- package/dist/src/sdk/utils/wit/prepare-encode-function-data.js +0 -24
- package/dist/src/sdk/utils/wit/prepare-encode-function-data.js.map +0 -1
- package/dist/src/wit/error.js +0 -59
- package/dist/src/wit/error.js.map +0 -1
- package/dist/src/wit/narrow.js +0 -14
- package/dist/src/wit/narrow.js.map +0 -1
- package/dist/src/wit/regex.js +0 -6
- package/dist/src/wit/regex.js.map +0 -1
- package/dist/src/wit/register.js +0 -2
- package/dist/src/wit/register.js.map +0 -1
- package/dist/src/wit/type-utils.js +0 -2
- package/dist/src/wit/type-utils.js.map +0 -1
- package/dist/src/wit/utils.js +0 -2
- package/dist/src/wit/utils.js.map +0 -1
- package/dist/src/wit/utils.test-d.js +0 -16
- package/dist/src/wit/utils.test-d.js.map +0 -1
- package/dist/src/wit/version.js +0 -2
- package/dist/src/wit/version.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/signature.js +0 -42
- package/dist/src/wit/wit-parser/core/errors/signature.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/splitParameters.js +0 -18
- package/dist/src/wit/wit-parser/core/errors/splitParameters.js.map +0 -1
- package/dist/src/wit/wit-parser/core/errors/wit-parameter.js +0 -29
- package/dist/src/wit/wit-parser/core/errors/wit-parameter.js.map +0 -1
- package/dist/src/wit/wit-parser/core/records.js +0 -73
- package/dist/src/wit/wit-parser/core/records.js.map +0 -1
- package/dist/src/wit/wit-parser/core/records.test.js +0 -53
- package/dist/src/wit/wit-parser/core/records.test.js.map +0 -1
- package/dist/src/wit/wit-parser/core/signatures.js +0 -32
- package/dist/src/wit/wit-parser/core/signatures.js.map +0 -1
- package/dist/src/wit/wit-parser/core/signatures.test.js +0 -54
- package/dist/src/wit/wit-parser/core/signatures.test.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/records.js +0 -2
- package/dist/src/wit/wit-parser/core/types/records.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/records.test-d.js +0 -19
- package/dist/src/wit/wit-parser/core/types/records.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/signatures.js +0 -3
- package/dist/src/wit/wit-parser/core/types/signatures.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/signatures.test-d.js +0 -18
- package/dist/src/wit/wit-parser/core/types/signatures.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/utils.js +0 -2
- package/dist/src/wit/wit-parser/core/types/utils.js.map +0 -1
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js +0 -138
- package/dist/src/wit/wit-parser/core/types/utils.test-d.js.map +0 -1
- package/dist/src/wit/wit-parser/core/utils.js +0 -212
- package/dist/src/wit/wit-parser/core/utils.js.map +0 -1
- package/dist/src/wit/wit-parser/core/utils.test.js +0 -302
- package/dist/src/wit/wit-parser/core/utils.test.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit-parameter.js +0 -26
- package/dist/src/wit/wit-parser/parse-wit-parameter.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js +0 -77
- package/dist/src/wit/wit-parser/parse-wit-parameter.test.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit.js +0 -16
- package/dist/src/wit/wit-parser/parse-wit.js.map +0 -1
- package/dist/src/wit/wit-parser/parse-wit.test.js +0 -78
- package/dist/src/wit/wit-parser/parse-wit.test.js.map +0 -1
- package/dist/src/wit/wit.js +0 -2
- package/dist/src/wit/wit.js.map +0 -1
- package/dist/src/wit/wit.test.js +0 -6
- package/dist/src/wit/wit.test.js.map +0 -1
- package/dist/test/globalSetup.js +0 -14
- package/dist/test/globalSetup.js.map +0 -1
- package/dist/test/src/wits.js +0 -21
- package/dist/test/src/wits.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
|
@@ -8,4 +8,12 @@ export { type KontorPublicClientConfig, type KontorPublicClient, type CreateKont
|
|
|
8
8
|
export { type KontorWalletClientConfig, type KontorWalletClient, type CreateKontorWalletClientErrorType, createWalletClient as createKontorWalletClient, } from "../sdk/clients/kontor/create-wallet-client.js";
|
|
9
9
|
export { type PublicClientConfig, type PublicClient, type CreatePublicClientErrorType, createPublicClient as createBtcPublicClient, } from "../sdk/clients/create-public-client.js";
|
|
10
10
|
export { type WalletClientConfig, type WalletClient, type CreateWalletClientErrorType, createWalletClient as createBtcWalletClient, } from "../sdk/clients/create-wallet-client.js";
|
|
11
|
+
export { Instruction } from "../sdk/types/kontor.js";
|
|
12
|
+
export { viewContract, type ViewContractParameters, type ViewContractReturnType, } from "../sdk/actions/kontor/public/view-contract.js";
|
|
13
|
+
export { procContract, type ProcContractParameters, type ProcContractReturnType, } from "../sdk/actions/kontor/public/proc-contract.js";
|
|
14
|
+
export { callView, type CallViewParameters, type CallViewReturnType, } from "../sdk/actions/kontor/public/call-view.js";
|
|
15
|
+
export { callCompose, type CallComposeParameters, type CallComposeReturnType, } from "../sdk/actions/kontor/public/call-compose.js";
|
|
16
|
+
export { buildInstructionQuery, type BuildInstructionQueryParameters, type BuildInstructionQueryReturnType, } from "../sdk/actions/kontor/public/build-instruction-query.js";
|
|
17
|
+
export { buildComposeQuery, type BuildComposeQueryParameters, type BuildComposeQueryReturnType, } from "../sdk/actions/kontor/public/build-compose-query.js";
|
|
18
|
+
export { inspect, type InspectParameters, type InspectReturnType, } from "../sdk/actions/kontor/public/inspect.js";
|
|
11
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,MAAM,GACP,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,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 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontor/kontor-sdk",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.16",
|
|
4
4
|
"author": "Unspendable Labs <dev@unspendablelabs.com>",
|
|
5
5
|
"description": "The official SDK to the Kontor Bitcoin metaprotocol",
|
|
6
6
|
"repository": {
|
|
@@ -65,9 +65,5 @@
|
|
|
65
65
|
"micro-packed": "^0.8.0",
|
|
66
66
|
"sats-connect": "^4.2.1",
|
|
67
67
|
"zod": "^4.1.12"
|
|
68
|
-
}
|
|
69
|
-
"workspaces": [
|
|
70
|
-
".",
|
|
71
|
-
"demo"
|
|
72
|
-
]
|
|
68
|
+
}
|
|
73
69
|
}
|
package/src/exports/index.ts
CHANGED
|
@@ -51,3 +51,47 @@ export {
|
|
|
51
51
|
type CreateWalletClientErrorType,
|
|
52
52
|
createWalletClient as createBtcWalletClient,
|
|
53
53
|
} from "../sdk/clients/create-wallet-client.js";
|
|
54
|
+
|
|
55
|
+
export { Instruction } from "../sdk/types/kontor.js";
|
|
56
|
+
|
|
57
|
+
export {
|
|
58
|
+
viewContract,
|
|
59
|
+
type ViewContractParameters,
|
|
60
|
+
type ViewContractReturnType,
|
|
61
|
+
} from "../sdk/actions/kontor/public/view-contract.js";
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
procContract,
|
|
65
|
+
type ProcContractParameters,
|
|
66
|
+
type ProcContractReturnType,
|
|
67
|
+
} from "../sdk/actions/kontor/public/proc-contract.js";
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
callView,
|
|
71
|
+
type CallViewParameters,
|
|
72
|
+
type CallViewReturnType,
|
|
73
|
+
} from "../sdk/actions/kontor/public/call-view.js";
|
|
74
|
+
|
|
75
|
+
export {
|
|
76
|
+
callCompose,
|
|
77
|
+
type CallComposeParameters,
|
|
78
|
+
type CallComposeReturnType,
|
|
79
|
+
} from "../sdk/actions/kontor/public/call-compose.js";
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
buildInstructionQuery,
|
|
83
|
+
type BuildInstructionQueryParameters,
|
|
84
|
+
type BuildInstructionQueryReturnType,
|
|
85
|
+
} from "../sdk/actions/kontor/public/build-instruction-query.js";
|
|
86
|
+
|
|
87
|
+
export {
|
|
88
|
+
buildComposeQuery,
|
|
89
|
+
type BuildComposeQueryParameters,
|
|
90
|
+
type BuildComposeQueryReturnType,
|
|
91
|
+
} from "../sdk/actions/kontor/public/build-compose-query.js";
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
inspect,
|
|
95
|
+
type InspectParameters,
|
|
96
|
+
type InspectReturnType,
|
|
97
|
+
} from "../sdk/actions/kontor/public/inspect.js";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { parseWit } from "../wit/wit-parser/parse-wit.js";
|
|
2
|
-
export { nativeToken } from "../sdk/contracts/wits.js";
|
|
3
|
-
export { signet } from "../sdk/chains/definitions/index.js";
|
|
4
|
-
export { custom, } from "../sdk/clients/transports/custom.js";
|
|
5
|
-
export { http, } from "../sdk/clients/transports/http.js";
|
|
6
|
-
export { mnemonicToAccount, } from "../sdk/accounts/mnemonic-to-account.js";
|
|
7
|
-
export { createPublicClient as createKontorPublicClient, } from "../sdk/clients/kontor/create-public-client.js";
|
|
8
|
-
export { createWalletClient as createKontorWalletClient, } from "../sdk/clients/kontor/create-wallet-client.js";
|
|
9
|
-
export { createPublicClient as createBtcPublicClient, } from "../sdk/clients/create-public-client.js";
|
|
10
|
-
export { createWalletClient as createBtcWalletClient, } from "../sdk/clients/create-wallet-client.js";
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAEzE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,OAAO,EAIL,MAAM,GACP,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAIL,IAAI,GACL,MAAM,mCAAmC,CAAC;AAE3C,OAAO,EAGL,iBAAiB,GAClB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAIL,kBAAkB,IAAI,wBAAwB,GAC/C,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAIL,kBAAkB,IAAI,wBAAwB,GAC/C,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAIL,kBAAkB,IAAI,qBAAqB,GAC5C,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAIL,kBAAkB,IAAI,qBAAqB,GAC5C,MAAM,wCAAwC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../../src/exports/index.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AAEtC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;GAIlD,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { toHex } from "../utils/encoding/to-hex.js";
|
|
2
|
-
import { privateKeyToAccount, } from "./private-key-to-account.js";
|
|
3
|
-
/**
|
|
4
|
-
* @description Creates an Account from a HD Key.
|
|
5
|
-
*
|
|
6
|
-
* @returns A HD Account.
|
|
7
|
-
*/
|
|
8
|
-
export function hdKeyToAccount(hdKey_, { coinType = 0, // 0 = mainnet, 1 =
|
|
9
|
-
accountIndex = 0, addressIndex = 0, changeIndex = 0, path, ...options } = {}) {
|
|
10
|
-
// https://bips.dev/86/
|
|
11
|
-
const hdKey = hdKey_.derive(path ||
|
|
12
|
-
`m/86'/${coinType}'/${accountIndex}'/${changeIndex}/${addressIndex}`);
|
|
13
|
-
const account = privateKeyToAccount(toHex(hdKey.privateKey), options);
|
|
14
|
-
return {
|
|
15
|
-
...account,
|
|
16
|
-
getHdKey: () => hdKey,
|
|
17
|
-
source: "hd",
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=hd-key-to-account.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hd-key-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/hd-key-to-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAGL,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;AAWrC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAa,EACb,EACE,QAAQ,GAAG,CAAC,EAAE,mBAAmB;AACjC,YAAY,GAAG,CAAC,EAChB,YAAY,GAAG,CAAC,EAChB,WAAW,GAAG,CAAC,EACf,IAAI,EACJ,GAAG,OAAO,KACe,EAAE;IAE7B,uBAAuB;IACvB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,IAAI;QACF,SAAS,QAAQ,KAAK,YAAY,KAAK,WAAW,IAAI,YAAY,EAAE,CACvE,CAAC;IACF,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,UAAW,CAAC,EAAE,OAAO,CAAC,CAAC;IACvE,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;QACrB,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { HDKey } from "@scure/bip32";
|
|
2
|
-
import { mnemonicToSeedSync } from "@scure/bip39";
|
|
3
|
-
import { hdKeyToAccount, } from "./hd-key-to-account.js";
|
|
4
|
-
/**
|
|
5
|
-
* @description Creates an Account from a mnemonic phrase.
|
|
6
|
-
*
|
|
7
|
-
* @returns A HD Account.
|
|
8
|
-
*/
|
|
9
|
-
export function mnemonicToAccount(mnemonic, _opts = {}) {
|
|
10
|
-
const seed = mnemonicToSeedSync(mnemonic);
|
|
11
|
-
return hdKeyToAccount(HDKey.fromMasterSeed(seed), {
|
|
12
|
-
// TODO: this should not be hardcoded
|
|
13
|
-
coinType: 1,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=mnemonic-to-account.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mnemonic-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/mnemonic-to-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAGL,cAAc,GACf,MAAM,wBAAwB,CAAC;AAOhC;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,QAAkC,EAAE;IAEpC,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,OAAO,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAChD,qCAAqC;QACrC,QAAQ,EAAE,CAAC;KACZ,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { mnemonicToAccount } from "./mnemonic-to-account.js";
|
|
3
|
-
const mnemonic = "test test test test test test test test test test test junk";
|
|
4
|
-
// TODO: should take a network argument
|
|
5
|
-
test("default", () => {
|
|
6
|
-
expect(mnemonicToAccount(mnemonic)).toMatchInlineSnapshot(`
|
|
7
|
-
{
|
|
8
|
-
"address": "tb1pfewlxm8meyyvgjydfu7v8j4ej64symj6ut8sf66h9germp94qgzsgnnjhk",
|
|
9
|
-
"getHdKey": [Function],
|
|
10
|
-
"signMessage": [Function],
|
|
11
|
-
"signPsbt": [Function],
|
|
12
|
-
"source": "hd",
|
|
13
|
-
"type": "local",
|
|
14
|
-
"xOnlyPubKey": "8c7fc6552af4384a13791e63bac79ff2bcfeedf143a88d6dc4b6080a8829cdc1",
|
|
15
|
-
}
|
|
16
|
-
`);
|
|
17
|
-
});
|
|
18
|
-
// describe('args: addressIndex', () => {
|
|
19
|
-
// Array.from({ length: 10 }).forEach((_, index) => {
|
|
20
|
-
// test(`addressIndex: ${index}`, () => {
|
|
21
|
-
// const account = mnemonicToAccount(mnemonic, {
|
|
22
|
-
// addressIndex: index,
|
|
23
|
-
// })
|
|
24
|
-
// expect(account.address).toEqual(getAddress(accounts[index].address))
|
|
25
|
-
// })
|
|
26
|
-
// })
|
|
27
|
-
// })
|
|
28
|
-
//
|
|
29
|
-
// describe('args: path', () => {
|
|
30
|
-
// Array.from({ length: 10 }).forEach((_, index) => {
|
|
31
|
-
// test(`path: m/44'/60'/0'/0/${index}`, () => {
|
|
32
|
-
// const account = mnemonicToAccount(mnemonic, {
|
|
33
|
-
// path: `m/44'/60'/0'/0/${index}`,
|
|
34
|
-
// })
|
|
35
|
-
// expect(account.address).toEqual(getAddress(accounts[index].address))
|
|
36
|
-
// })
|
|
37
|
-
// })
|
|
38
|
-
// })
|
|
39
|
-
//
|
|
40
|
-
// test('args: accountIndex', () => {
|
|
41
|
-
// expect(
|
|
42
|
-
// mnemonicToAccount(mnemonic, { accountIndex: 1 }).address,
|
|
43
|
-
// ).toMatchInlineSnapshot('"0x8C8d35429F74ec245F8Ef2f4Fd1e551cFF97d650"')
|
|
44
|
-
// expect(
|
|
45
|
-
// mnemonicToAccount(mnemonic, { accountIndex: 2 }).address,
|
|
46
|
-
// ).toMatchInlineSnapshot('"0x98e503f35D0a019cB0a251aD243a4cCFCF371F46"')
|
|
47
|
-
// expect(
|
|
48
|
-
// mnemonicToAccount(mnemonic, { accountIndex: 3 }).address,
|
|
49
|
-
// ).toMatchInlineSnapshot('"0xCB9fA1eA9b8A3bf422a8639f23Df77ea66020eC2"')
|
|
50
|
-
// })
|
|
51
|
-
//
|
|
52
|
-
// test('args: changeIndex', () => {
|
|
53
|
-
// expect(
|
|
54
|
-
// mnemonicToAccount(mnemonic, { changeIndex: 1 }).address,
|
|
55
|
-
// ).toMatchInlineSnapshot('"0x4b39F7b0624b9dB86AD293686bc38B903142dbBc"')
|
|
56
|
-
// expect(
|
|
57
|
-
// mnemonicToAccount(mnemonic, { changeIndex: 2 }).address,
|
|
58
|
-
// ).toMatchInlineSnapshot('"0xe0Ff44FDb999d485DCFe6B0840f0d14EEA8a08A0"')
|
|
59
|
-
// expect(
|
|
60
|
-
// mnemonicToAccount(mnemonic, { changeIndex: 3 }).address,
|
|
61
|
-
// ).toMatchInlineSnapshot('"0x4E0eBc370cAdc5d152505EA4FEbcf839E7E2D3F8"')
|
|
62
|
-
// })
|
|
63
|
-
//
|
|
64
|
-
// test('sign message', async () => {
|
|
65
|
-
// const account = mnemonicToAccount(mnemonic)
|
|
66
|
-
// expect(
|
|
67
|
-
// await account.signMessage({ message: 'hello world' }),
|
|
68
|
-
// ).toMatchInlineSnapshot(
|
|
69
|
-
// '"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
|
70
|
-
// )
|
|
71
|
-
// })
|
|
72
|
-
//
|
|
73
|
-
// test('sign transaction', async () => {
|
|
74
|
-
// const account = mnemonicToAccount(mnemonic)
|
|
75
|
-
// expect(
|
|
76
|
-
// await account.signTransaction({
|
|
77
|
-
// chainId: 1,
|
|
78
|
-
// maxFeePerGas: parseGwei('20'),
|
|
79
|
-
// gas: 21000n,
|
|
80
|
-
// to: accounts[1].address,
|
|
81
|
-
// value: parseEther('1'),
|
|
82
|
-
// }),
|
|
83
|
-
// ).toMatchInlineSnapshot(
|
|
84
|
-
// '"0x02f86f0180808504a817c8008252089470997970c51812dc3a010c7d01b50e0d17dc79c8880de0b6b3a764000080c001a0f40a2d2ae9638056cafbe9083c7125edc8555e0e715db0984dd859a5c6dfac57a020f36fd0b32bef4d6d75c62f220e59c5fb60c244ca3b361e750985ee5c3a0931"',
|
|
85
|
-
// )
|
|
86
|
-
// })
|
|
87
|
-
//
|
|
88
|
-
// test('sign typed data', async () => {
|
|
89
|
-
// const account = mnemonicToAccount(mnemonic)
|
|
90
|
-
// expect(
|
|
91
|
-
// await account.signTypedData({ ...typedData.basic, primaryType: 'Mail' }),
|
|
92
|
-
// ).toMatchInlineSnapshot(
|
|
93
|
-
// '"0x32f3d5975ba38d6c2fba9b95d5cbed1febaa68003d3d588d51f2de522ad54117760cfc249470a75232552e43991f53953a3d74edf6944553c6bef2469bb9e5921b"',
|
|
94
|
-
// )
|
|
95
|
-
// })
|
|
96
|
-
//# sourceMappingURL=mnemonic-to-account.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mnemonic-to-account.test.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/mnemonic-to-account.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,QAAQ,GAAG,6DAA6D,CAAC;AAE/E,uCAAuC;AACvC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;IACnB,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC;;;;;;;;;;YAUhD,CAAC,CAAC;AACd,CAAC,CAAC,CAAC;AAEH,yCAAyC;AACzC,uDAAuD;AACvD,6CAA6C;AAC7C,sDAAsD;AACtD,+BAA+B;AAC/B,WAAW;AACX,6EAA6E;AAC7E,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,iCAAiC;AACjC,uDAAuD;AACvD,oDAAoD;AACpD,sDAAsD;AACtD,2CAA2C;AAC3C,WAAW;AACX,6EAA6E;AAC7E,SAAS;AACT,OAAO;AACP,KAAK;AACL,EAAE;AACF,qCAAqC;AACrC,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,YAAY;AACZ,gEAAgE;AAChE,4EAA4E;AAC5E,KAAK;AACL,EAAE;AACF,oCAAoC;AACpC,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,YAAY;AACZ,+DAA+D;AAC/D,4EAA4E;AAC5E,KAAK;AACL,EAAE;AACF,qCAAqC;AACrC,gDAAgD;AAChD,YAAY;AACZ,6DAA6D;AAC7D,6BAA6B;AAC7B,gJAAgJ;AAChJ,MAAM;AACN,KAAK;AACL,EAAE;AACF,yCAAyC;AACzC,gDAAgD;AAChD,YAAY;AACZ,sCAAsC;AACtC,oBAAoB;AACpB,uCAAuC;AACvC,qBAAqB;AACrB,iCAAiC;AACjC,gCAAgC;AAChC,UAAU;AACV,6BAA6B;AAC7B,kPAAkP;AAClP,MAAM;AACN,KAAK;AACL,EAAE;AACF,wCAAwC;AACxC,gDAAgD;AAChD,YAAY;AACZ,gFAAgF;AAChF,6BAA6B;AAC7B,gJAAgJ;AAChJ,MAAM;AACN,KAAK"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
2
|
-
import { hex } from "@scure/base";
|
|
3
|
-
import {
|
|
4
|
-
// type ToHexErrorType,
|
|
5
|
-
toHex, } from "../utils/encoding/to-hex.js";
|
|
6
|
-
import {
|
|
7
|
-
// type ToLocalAccountErrorType,
|
|
8
|
-
toLocalAccount, } from "./to-local-account.js";
|
|
9
|
-
import { publicKeyToP2TRPayment, } from "./utils/public-key-to-p2tr-payment.js";
|
|
10
|
-
import { signPsbt } from "./utils/sign-psbt.js";
|
|
11
|
-
//
|
|
12
|
-
// /**
|
|
13
|
-
// * @description Creates an Account from a private key.
|
|
14
|
-
// *
|
|
15
|
-
// * @returns A Private Key Account.
|
|
16
|
-
// */
|
|
17
|
-
const signet = {
|
|
18
|
-
bech32: "tb",
|
|
19
|
-
pubKeyHash: 0x6f, // 111 in decimal
|
|
20
|
-
scriptHash: 0xc4, // 196 in decimal
|
|
21
|
-
wif: 0xef, // 239 in decimal
|
|
22
|
-
};
|
|
23
|
-
export function privateKeyToAccount(privateKey, _options = {}) {
|
|
24
|
-
const publicKey = toHex(secp256k1.getPublicKey(hex.decode(privateKey.slice(2)), true));
|
|
25
|
-
// TODO: don't hardcode network
|
|
26
|
-
const address = publicKeyToP2TRPayment(publicKey.slice(2), signet);
|
|
27
|
-
const account = toLocalAccount({
|
|
28
|
-
address: address.address,
|
|
29
|
-
xOnlyPubKey: hex.encode(address.tapInternalKey),
|
|
30
|
-
signMessage: async (_) => {
|
|
31
|
-
throw new Error("signMessage not implemented for PrivateKeyAccount");
|
|
32
|
-
},
|
|
33
|
-
signPsbt: (params) => {
|
|
34
|
-
return signPsbt({ privateKey: privateKey.slice(2), ...params });
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
...account,
|
|
39
|
-
source: "privateKey",
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=private-key-to-account.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"private-key-to-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/private-key-to-account.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAKlC,OAAO;AACL,uBAAuB;AACvB,KAAK,GACN,MAAM,6BAA6B,CAAC;AAErC,OAAO;AACL,gCAAgC;AAChC,cAAc,GAC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@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { InvalidAddressError, } from "../errors/address.js";
|
|
2
|
-
const isAddress = (_, __) => true;
|
|
3
|
-
/**
|
|
4
|
-
* @description Creates an Account from a custom signing implementation.
|
|
5
|
-
*
|
|
6
|
-
* @returns A Local Account.
|
|
7
|
-
*/
|
|
8
|
-
export function toLocalAccount(source) {
|
|
9
|
-
if (typeof source === "string") {
|
|
10
|
-
if (!isAddress(source, { strict: false }))
|
|
11
|
-
throw new InvalidAddressError({ address: source });
|
|
12
|
-
return {
|
|
13
|
-
address: source,
|
|
14
|
-
type: "json-rpc",
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
if (!isAddress(source.address, { strict: false }))
|
|
18
|
-
throw new InvalidAddressError({ address: source.address });
|
|
19
|
-
return {
|
|
20
|
-
address: source.address,
|
|
21
|
-
xOnlyPubKey: source.xOnlyPubKey,
|
|
22
|
-
signMessage: source.signMessage,
|
|
23
|
-
signPsbt: source.signPsbt,
|
|
24
|
-
source: "custom",
|
|
25
|
-
type: "local",
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=to-local-account.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"to-local-account.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/to-local-account.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,GAEpB,MAAM,sBAAsB,CAAC;AAiB9B,MAAM,SAAS,GAAG,CAAC,CAAS,EAAE,EAAM,EAAE,EAAE,CAAC,IAAI,CAAC;AAW9C;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAqB;IAErB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YACvC,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACrD,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,UAAU;SACsB,CAAC;IAC3C,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC/C,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,OAAO;KACyB,CAAC;AAC3C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sdk/accounts/types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-account.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/parse-account.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,YAAY,CAG1B,OAAyB;IAIzB,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACxB,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;YACnB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;YACvB,IAAI,EAAE,UAAU;SACV,CAAC;IACX,OAAO,OAAc,CAAC;AACxB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { p2tr } from "@scure/btc-signer";
|
|
2
|
-
import { hex } from "@scure/base";
|
|
3
|
-
const ecdsaPublicKeyLength = 33;
|
|
4
|
-
function ecdsaPublicKeyToSchnorr(pubKey) {
|
|
5
|
-
if (pubKey.byteLength !== ecdsaPublicKeyLength)
|
|
6
|
-
throw new Error(`Invalid public key length. \nExpected ${ecdsaPublicKeyLength} bytes. \nGot ${pubKey.length} `);
|
|
7
|
-
return pubKey.slice(1);
|
|
8
|
-
}
|
|
9
|
-
export function publicKeyToP2TRPayment(publicKey, network) {
|
|
10
|
-
const pubKey = hex.decode(publicKey);
|
|
11
|
-
console.log("pubkey length:", pubKey.length);
|
|
12
|
-
return p2tr(ecdsaPublicKeyToSchnorr(pubKey), undefined, network);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=public-key-to-p2tr-payment.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"public-key-to-p2tr-payment.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/public-key-to-p2tr-payment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAOlC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC,SAAS,uBAAuB,CAAC,MAAkB;IACjD,IAAI,MAAM,CAAC,UAAU,KAAK,oBAAoB;QAC5C,MAAM,IAAI,KAAK,CACb,yCAAyC,oBAAoB,iBAAiB,MAAM,CAAC,MAAM,GAAG,CAC/F,CAAC;IACJ,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAc,EAAE,OAAoB;IACzE,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAErC,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { hex } from "@scure/base";
|
|
2
|
-
import { SigHash, Transaction } from "@scure/btc-signer";
|
|
3
|
-
export async function signPsbt(params) {
|
|
4
|
-
const { privateKey, signInputs, psbt } = params;
|
|
5
|
-
const privKey = hex.decode(privateKey);
|
|
6
|
-
const tx = Transaction.fromPSBT(hex.decode(psbt));
|
|
7
|
-
for (const input of signInputs) {
|
|
8
|
-
if (typeof input == "number") {
|
|
9
|
-
tx.signIdx(privKey, input);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
tx.signIdx(privKey, input.index, input.allowedSighash);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
return { txid: tx.id, psbt: hex.encode(tx.toPSBT()) };
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=sign-psbt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sign-psbt.js","sourceRoot":"","sources":["../../../../../src/sdk/accounts/utils/sign-psbt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAwBzD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,MAA+B;IAE/B,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAEhD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACvC,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAElD,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;QAC/B,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE,CAAC;YAC7B,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// import { getAction } from "../utils/getAction.js";
|
|
2
|
-
import {} from "./kontor/public/view-contract.js";
|
|
3
|
-
// TODO: move to utils
|
|
4
|
-
function camelToKebab(str) {
|
|
5
|
-
return str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
6
|
-
}
|
|
7
|
-
export function getContract({ wit: wit, }) {
|
|
8
|
-
const hasPublicClient = true;
|
|
9
|
-
const contract = {};
|
|
10
|
-
// TODO: actually introspect this
|
|
11
|
-
let hasReadFunction = true;
|
|
12
|
-
if (hasPublicClient) {
|
|
13
|
-
if (hasReadFunction) {
|
|
14
|
-
console.log("we are defining a proxy");
|
|
15
|
-
contract.view = new Proxy({}, {
|
|
16
|
-
get(_, functionName) {
|
|
17
|
-
// @ts-ignore
|
|
18
|
-
const witFunctionName = camelToKebab(functionName);
|
|
19
|
-
return (...parameters) => {
|
|
20
|
-
// @ts-ignore
|
|
21
|
-
const { args, options } = getFunctionParameters(parameters);
|
|
22
|
-
// return getAction(
|
|
23
|
-
// {
|
|
24
|
-
// viewContract: () => {},
|
|
25
|
-
// call: () => {},
|
|
26
|
-
// },
|
|
27
|
-
// viewContract,
|
|
28
|
-
// "viewContract",
|
|
29
|
-
// )({
|
|
30
|
-
// wit,
|
|
31
|
-
// functionName: witFunctionName,
|
|
32
|
-
// // address,
|
|
33
|
-
// args,
|
|
34
|
-
// ...options,
|
|
35
|
-
// } as ViewContractParameters);
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
contract.wit = wit;
|
|
42
|
-
return contract;
|
|
43
|
-
}
|
|
44
|
-
export function getFunctionParameters(values) {
|
|
45
|
-
const hasArgs = values.length && Array.isArray(values[0]);
|
|
46
|
-
const args = hasArgs ? values[0] : [];
|
|
47
|
-
const options = (hasArgs ? values[1] : values[0]) ?? {};
|
|
48
|
-
return { args, options };
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=get-contract.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.js","sourceRoot":"","sources":["../../../../src/sdk/actions/get-contract.ts"],"names":[],"mappings":"AAiBA,qDAAqD;AACrD,OAAO,EAIN,MAAM,kCAAkC,CAAC;AAE1C,sBAAsB;AACtB,SAAS,YAAY,CAAC,GAAW;IAC/B,OAAO,GAAG,CAAC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;AAClE,CAAC;AAqED,MAAM,UAAU,WAAW,CAA6C,EACtE,GAAG,EAAE,GAAG,GACmB;IAC3B,MAAM,eAAe,GAAG,IAAI,CAAC;IAE7B,MAAM,QAAQ,GAEV,EAAE,CAAC;IAEP,iCAAiC;IACjC,IAAI,eAAe,GAAG,IAAI,CAAC;IAE3B,IAAI,eAAe,EAAE,CAAC;QACpB,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;YAEvC,QAAQ,CAAC,IAAI,GAAG,IAAI,KAAK,CACvB,EAAE,EACF;gBACE,GAAG,CAAC,CAAC,EAAE,YAAoB;oBACzB,aAAa;oBACb,MAAM,eAAe,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC;oBAEnD,OAAO,CACL,GAAG,UAMF,EACD,EAAE;wBACF,aAAa;wBACb,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,qBAAqB,CAAC,UAAU,CAAC,CAAC;wBAE5D,oBAAoB;wBACpB,MAAM;wBACN,8BAA8B;wBAC9B,sBAAsB;wBACtB,OAAO;wBACP,kBAAkB;wBAClB,oBAAoB;wBACpB,MAAM;wBACN,SAAS;wBACT,mCAAmC;wBACnC,gBAAgB;wBAChB,UAAU;wBACV,gBAAgB;wBAChB,gCAAgC;oBAClC,CAAC,CAAC;gBACJ,CAAC;aACF,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,QAAQ,CAAC,GAAG,GAAG,GAAG,CAAC;IAEnB,OAAO,QAAiD,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,MAA6E;IAE7E,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,MAAM,OAAO,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { expectTypeOf, test } from "vitest";
|
|
2
|
-
import { parseWit } from "../../wit/wit-parser/parse-wit.js";
|
|
3
|
-
import {} from "./get-contract.js";
|
|
4
|
-
const input = [
|
|
5
|
-
// TODO: build in record defs should be defined under the hood
|
|
6
|
-
// "record tool { name: string, isHammer: bool }",
|
|
7
|
-
"export fib: func(ctx: borrow<proc-context>, arith-address: contract-address, n: u64) -> u64;",
|
|
8
|
-
"export fib-of-sub: func(ctx: borrow<proc-context>, arith-address: contract-address, x: string, y: string) -> result<u64, error>;",
|
|
9
|
-
"export cached-values: func(ctx: borrow<view-context>) -> list<u64>;",
|
|
10
|
-
"export fib-as-view: func(ctx: borrow<view-context>, n: u64) -> u64;",
|
|
11
|
-
"export read-with-record-arg: func(ctx: borrow<view-context>, contract-address: contract-address) -> u64;",
|
|
12
|
-
// "export read-tools: func(ctx: borrow<view-context>) -> list<tool>;",
|
|
13
|
-
];
|
|
14
|
-
const wit = parseWit(input);
|
|
15
|
-
test("KebabToCamel basic mapping", () => {
|
|
16
|
-
expectTypeOf().toEqualTypeOf();
|
|
17
|
-
expectTypeOf().toEqualTypeOf();
|
|
18
|
-
expectTypeOf().toEqualTypeOf();
|
|
19
|
-
});
|
|
20
|
-
test("GetContractReturnType", () => {
|
|
21
|
-
expectTypeOf().toEqualTypeOf;
|
|
22
|
-
});
|
|
23
|
-
test("GetContractReturnType view keys are camelCased", () => {
|
|
24
|
-
// For FibAbi, the only view fn is "cached-values", so this should be just "cachedValues"
|
|
25
|
-
expectTypeOf().toEqualTypeOf();
|
|
26
|
-
});
|
|
27
|
-
test("getContract", async () => {
|
|
28
|
-
// const contract = getContract({
|
|
29
|
-
// wit: wit,
|
|
30
|
-
// });
|
|
31
|
-
// const res0 = contract.view.readWithRecordArg(["token_10_11"]);
|
|
32
|
-
//
|
|
33
|
-
// const res = contract.view.cachedValues();
|
|
34
|
-
//
|
|
35
|
-
// const res_2 = contract.view.fibAsView([10n]);
|
|
36
|
-
// const re3 = contract.view.readTools();
|
|
37
|
-
});
|
|
38
|
-
test("GetViewFunction for cached-values (no inputs)", () => {
|
|
39
|
-
// return type: Promise<ViewContractReturnType<...>>
|
|
40
|
-
// kay
|
|
41
|
-
expectTypeOf().toEqualTypeOf();
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=get-contract.test-d.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-contract.test-d.js","sourceRoot":"","sources":["../../../../src/sdk/actions/get-contract.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAMN,MAAM,mBAAmB,CAAC;AAE3B,MAAM,KAAK,GAAG;IACZ,8DAA8D;IAC9D,mDAAmD;IACnD,8FAA8F;IAC9F,kIAAkI;IAClI,qEAAqE;IACrE,qEAAqE;IACrE,0GAA0G;IAC1G,uEAAuE;CAC/D,CAAC;AAEX,MAAM,GAAG,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AAE5B,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAKtC,YAAY,EAAK,CAAC,aAAa,EAAkB,CAAC;IAClD,YAAY,EAAK,CAAC,aAAa,EAAc,CAAC;IAC9C,YAAY,EAAK,CAAC,aAAa,EAAS,CAAC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACjC,YAAY,EAAqC,CAAC,aAOhD,CAAC;AACL,CAAC,CAAC,CAAC;AACH,IAAI,CAAC,gDAAgD,EAAE,GAAG,EAAE;IAG1D,yFAAyF;IACzF,YAAY,EAAY,CAAC,aAAa,EAEnC,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;IAC7B,iCAAiC;IACjC,cAAc;IACd,MAAM;IACN,iEAAiE;IACjE,EAAE;IACF,4CAA4C;IAC5C,EAAE;IACF,gDAAgD;IAChD,yCAAyC;AAC3C,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,+CAA+C,EAAE,GAAG,EAAE;IAGzD,oDAAoD;IACpD,MAAM;IACN,YAAY,EAA2B,CAAC,aAAa,EAAqB,CAAC;AAC7E,CAAC,CAAC,CAAC"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { buildInstructionQuery } from "./build-instruction-query.js";
|
|
2
|
-
import { getKontorAction } from "../../../utils/get-action.js";
|
|
3
|
-
export async function buildComposeQuery(client, params) {
|
|
4
|
-
const account = client.account;
|
|
5
|
-
const { instruction: inst, utxos, address = account?.address, xOnlyPubKey = account?.xOnlyPubKey, } = params;
|
|
6
|
-
if (!xOnlyPubKey) {
|
|
7
|
-
// TODO: add custom error
|
|
8
|
-
throw new Error("x_only_public_key is required");
|
|
9
|
-
}
|
|
10
|
-
if (!address) {
|
|
11
|
-
// TODO: add custom error
|
|
12
|
-
throw new Error("address is required");
|
|
13
|
-
}
|
|
14
|
-
if (utxos.length === 0) {
|
|
15
|
-
// TODO: add custom error
|
|
16
|
-
throw new Error("at least one funding UTXO is required");
|
|
17
|
-
}
|
|
18
|
-
const instruction = await getKontorAction(client, buildInstructionQuery, "buildInstructionQuery")({
|
|
19
|
-
instruction: inst,
|
|
20
|
-
utxos,
|
|
21
|
-
xOnlyPubKey,
|
|
22
|
-
address,
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
instructions: [instruction],
|
|
26
|
-
sat_per_vbyte: params.satsPerVByte,
|
|
27
|
-
envelope: null,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=build-compose-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-compose-query.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/build-compose-query.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAgB/D,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAGrC,MAAgD,EAChD,MAA0C;IAE1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,MAAM,EACJ,WAAW,EAAE,IAAI,EACjB,KAAK,EACL,OAAO,GAAG,OAAO,EAAE,OAAO,EAC1B,WAAW,GAAG,OAAO,EAAE,WAAW,GACnC,GAAG,MAAM,CAAC;IAEX,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,yBAAyB;QACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,WAAW,GAAG,MAAM,eAAe,CACvC,MAAM,EACN,qBAAqB,EACrB,uBAAuB,CACxB,CAAC;QACA,WAAW,EAAE,IAAI;QACjB,KAAK;QACL,WAAW;QACX,OAAO;KACR,CAAC,CAAC;IAEH,OAAO;QACL,YAAY,EAAE,CAAC,WAAW,CAAC;QAC3B,aAAa,EAAE,MAAM,CAAC,YAAY;QAClC,QAAQ,EAAE,IAAI;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// ------------------ helpers ------------------
|
|
2
|
-
function normalizeXOnly(pub) {
|
|
3
|
-
if (!/^[0-9a-fA-F]{64}$/.test(pub)) {
|
|
4
|
-
throw new Error("x_only_public_key must be 32-byte (64 hex chars) x-only pubkey");
|
|
5
|
-
}
|
|
6
|
-
return pub.toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
function normalizeUtxoId(u) {
|
|
9
|
-
if (typeof u === "string")
|
|
10
|
-
return u;
|
|
11
|
-
if (!u?.txid || typeof u.vout !== "number") {
|
|
12
|
-
throw new Error("funding UTXO must be 'txid:vout' or { txid, vout }");
|
|
13
|
-
}
|
|
14
|
-
return `${u.txid}:${u.vout}`;
|
|
15
|
-
}
|
|
16
|
-
function normalizeUtxoIds(u) {
|
|
17
|
-
return Array.isArray(u) ? u.map(normalizeUtxoId) : [normalizeUtxoId(u)];
|
|
18
|
-
}
|
|
19
|
-
// ------------------ main builder ------------------
|
|
20
|
-
export async function buildInstructionQuery(client, params) {
|
|
21
|
-
const account = client.account;
|
|
22
|
-
const { utxos, instruction, chainedInstruction = null, address = account?.address, xOnlyPubKey = account?.xOnlyPubKey, } = params;
|
|
23
|
-
if (!xOnlyPubKey) {
|
|
24
|
-
// TODO: add custom error
|
|
25
|
-
throw new Error("x_only_public_key is required");
|
|
26
|
-
}
|
|
27
|
-
if (!address) {
|
|
28
|
-
// TODO: add custom error
|
|
29
|
-
throw new Error("address is required");
|
|
30
|
-
}
|
|
31
|
-
if (utxos.length === 0) {
|
|
32
|
-
// TODO: add custom error
|
|
33
|
-
throw new Error("at least one funding UTXO is required");
|
|
34
|
-
}
|
|
35
|
-
const xOnly = normalizeXOnly(xOnlyPubKey);
|
|
36
|
-
const fundingIds = normalizeUtxoIds(utxos);
|
|
37
|
-
return {
|
|
38
|
-
address,
|
|
39
|
-
x_only_public_key: xOnly,
|
|
40
|
-
funding_utxo_ids: fundingIds.join(","),
|
|
41
|
-
instruction,
|
|
42
|
-
chained_instruction: chainedInstruction ?? null,
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=build-instruction-query.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-instruction-query.js","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/public/build-instruction-query.ts"],"names":[],"mappings":"AA8BA,gDAAgD;AAEhD,SAAS,cAAc,CAAC,GAAW;IACjC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC3B,CAAC;AAED,SAAS,eAAe,CAAC,CAAS;IAChC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,EAAE,IAAI,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3C,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,GAAG,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EA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