@kontor/kontor-sdk 1.0.0-alpha.1 → 1.0.0-alpha.11
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/sdk/actions/kontor/wallet/sign-reveal.js +10 -14
- package/dist/cjs/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/cjs/sdk/actions/public/test-mempool-accept.js +10 -0
- package/dist/cjs/sdk/actions/public/test-mempool-accept.js.map +1 -1
- package/dist/cjs/sdk/clients/decorators/public.js +2 -0
- package/dist/cjs/sdk/clients/decorators/public.js.map +1 -1
- package/dist/cjs/sdk/clients/transports/custom.js.map +1 -1
- package/dist/cjs/sdk/utils/build-rpc-request.js +1 -0
- package/dist/cjs/sdk/utils/build-rpc-request.js.map +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js +37 -23
- package/dist/esm/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/esm/sdk/actions/public/test-mempool-accept.js +8 -32
- package/dist/esm/sdk/actions/public/test-mempool-accept.js.map +1 -1
- package/dist/esm/sdk/clients/decorators/public.js +2 -0
- package/dist/esm/sdk/clients/decorators/public.js.map +1 -1
- package/dist/esm/sdk/clients/transports/custom.js.map +1 -1
- package/dist/esm/sdk/utils/build-rpc-request.js +1 -0
- package/dist/esm/sdk/utils/build-rpc-request.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/src/sdk/actions/kontor/public/build-compose-call.js +5 -6
- package/dist/src/sdk/actions/kontor/public/build-compose-call.js.map +1 -1
- package/dist/src/sdk/actions/kontor/public/build-compose-query.js +30 -0
- package/dist/src/sdk/actions/kontor/public/build-compose-query.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js +45 -0
- package/dist/src/sdk/actions/kontor/public/build-instruction-query.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/build-instruction.js +13 -16
- package/dist/src/sdk/actions/kontor/public/build-instruction.js.map +1 -1
- package/dist/src/sdk/actions/kontor/public/call-compose.js +38 -0
- package/dist/src/sdk/actions/kontor/public/call-compose.js.map +1 -0
- package/dist/src/sdk/actions/kontor/public/call-proc.js +6 -2
- package/dist/src/sdk/actions/kontor/public/call-proc.js.map +1 -1
- package/dist/src/sdk/actions/kontor/public/proc-contract.js +8 -5
- package/dist/src/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +37 -25
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/src/sdk/clients/decorators/kontor/public.js +6 -6
- package/dist/src/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/src/sdk/types/kontor.js +27 -1
- package/dist/src/sdk/types/kontor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/sdk/actions/kontor/wallet/sign-reveal.d.ts.map +1 -1
- package/dist/types/sdk/actions/public/test-mempool-accept.d.ts +14 -1
- package/dist/types/sdk/actions/public/test-mempool-accept.d.ts.map +1 -1
- package/dist/types/sdk/clients/decorators/public.d.ts +2 -0
- package/dist/types/sdk/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/sdk/clients/transports/custom.d.ts.map +1 -1
- package/dist/types/sdk/types/btc-rpc.d.ts +9 -1
- package/dist/types/sdk/types/btc-rpc.d.ts.map +1 -1
- package/dist/types/sdk/utils/build-rpc-request.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/sdk/actions/kontor/public/{build-compose-call.ts → build-compose-query.ts} +15 -25
- package/src/sdk/actions/kontor/public/{build-instruction.ts → build-instruction-query.ts} +35 -29
- package/src/sdk/actions/kontor/public/{call-proc.ts → call-compose.ts} +16 -19
- package/src/sdk/actions/kontor/public/proc-contract.ts +9 -6
- package/src/sdk/actions/kontor/wallet/sign-reveal.ts +49 -28
- package/src/sdk/actions/public/test-mempool-accept.ts +34 -31
- package/src/sdk/clients/decorators/kontor/public.ts +23 -23
- package/src/sdk/clients/decorators/public.ts +11 -0
- package/src/sdk/test/e2e.test.ts +193 -15
- package/src/sdk/types/btc-rpc.ts +12 -11
- package/src/sdk/types/kontor.ts +38 -0
- 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/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/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/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 -44
- package/dist/src/sdk/actions/public/test-mempool-accept.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-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.test.js +0 -113
- package/dist/src/sdk/clients/create-public-client.test.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 -7
- 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.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.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 -75
- 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/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.test-d.js +0 -133
- package/dist/src/sdk/types/http-schema.test-d.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.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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign-reveal.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/wallet/sign-reveal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,OAAO,
|
|
1
|
+
{"version":3,"file":"sign-reveal.d.ts","sourceRoot":"","sources":["../../../../../../src/sdk/actions/kontor/wallet/sign-reveal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGxE,OAAO,EAEL,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,MAAM,oBAAoB,CAC9B,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,IACjC,mBAAmB,CAAC,OAAO,CAAC,GAE9B,iBAAiB,CAAC,KAAK,CAAC,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,kBAAkB,EAAE,CAAC;CACxC,CAAC;AAEJ,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAE/C,wBAAsB,UAAU,CAE9B,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,EAEnC,MAAM,EAAE,kBAAkB,CAAC,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,EACxD,UAAU,EAAE,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,GAC/C,OAAO,CAAC,oBAAoB,CAAC,CAwH/B"}
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Chain } from "../../types/chain.js";
|
|
2
|
+
import type { RpcTransport } from "../../clients/transports/create-rpc-transport.js";
|
|
3
|
+
import type { PublicClient } from "../../clients/create-public-client.js";
|
|
4
|
+
import type { Account } from "../../accounts/types.js";
|
|
5
|
+
export type TestMempoolAcceptOptions = {
|
|
6
|
+
/** Max feerate in BTC/kvB. If omitted, Core uses default relay feerate. */
|
|
7
|
+
maxfeerate?: string | number;
|
|
8
|
+
};
|
|
9
|
+
export interface TestMempoolAcceptParams {
|
|
10
|
+
rawtx: string | string[];
|
|
11
|
+
options: TestMempoolAcceptOptions;
|
|
12
|
+
}
|
|
13
|
+
export type TestMempoolAcceptReturnType = any;
|
|
14
|
+
export declare function testMempoolAccept<chain extends Chain | undefined, account extends Account | undefined = Account | undefined>(client: PublicClient<RpcTransport, chain, account>, { rawtx, options }: TestMempoolAcceptParams): Promise<TestMempoolAcceptReturnType>;
|
|
2
15
|
//# sourceMappingURL=test-mempool-accept.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-mempool-accept.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/actions/public/test-mempool-accept.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"test-mempool-accept.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/actions/public/test-mempool-accept.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AACrF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD,MAAM,MAAM,wBAAwB,GAAG;IACrC,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,wBAAwB,CAAC;CACnC;AAED,MAAM,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE9C,wBAAsB,iBAAiB,CACrC,KAAK,SAAS,KAAK,GAAG,SAAS,EAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAEzD,MAAM,EAAE,YAAY,CAAC,YAAY,EAAE,KAAK,EAAE,OAAO,CAAC,EAClD,EAAE,KAAK,EAAE,OAAY,EAAE,EAAE,uBAAuB,GAC/C,OAAO,CAAC,2BAA2B,CAAC,CAStC"}
|
|
@@ -3,9 +3,11 @@ import type { Chain } from "../../types/chain.js";
|
|
|
3
3
|
import type { Address, XOnlyPubKey } from "../../types/misc.js";
|
|
4
4
|
import type { RpcTransport } from "../transports/create-rpc-transport.js";
|
|
5
5
|
import { type SendRawTransactionParams, type SendRawTransactionReturnType } from "../../actions/public/send-raw-transaction.js";
|
|
6
|
+
import { type TestMempoolAcceptParams, type TestMempoolAcceptReturnType } from "../../actions/public/test-mempool-accept.js";
|
|
6
7
|
import type { PublicClient as PublicClient } from "../create-public-client.js";
|
|
7
8
|
export type PublicActions<_chain extends Chain | undefined = Chain | undefined, _account extends Account | [Address, XOnlyPubKey] | undefined = Account | [Address, XOnlyPubKey] | undefined> = {
|
|
8
9
|
sendRawTransaction: (parameters: SendRawTransactionParams) => Promise<SendRawTransactionReturnType>;
|
|
10
|
+
testMempoolAccept: (parameters: TestMempoolAcceptParams) => Promise<TestMempoolAcceptReturnType>;
|
|
9
11
|
};
|
|
10
12
|
export declare function publicActions<transport extends RpcTransport = RpcTransport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined>(client: PublicClient<transport, chain, account>): PublicActions<chain, account>;
|
|
11
13
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/clients/decorators/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAElC,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/clients/decorators/public.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EAElC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,2BAA2B,EAEjC,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/E,MAAM,MAAM,aAAa,CACvB,MAAM,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACpD,QAAQ,SAAS,OAAO,GAAG,CAAC,OAAO,EAAE,WAAW,CAAC,GAAG,SAAS,GACzD,OAAO,GACP,CAAC,OAAO,EAAE,WAAW,CAAC,GACtB,SAAS,IACX;IACF,kBAAkB,EAAE,CAClB,UAAU,EAAE,wBAAwB,KACjC,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,iBAAiB,EAAE,CACjB,UAAU,EAAE,uBAAuB,KAChC,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC3C,CAAC;AAEF,wBAAgB,aAAa,CAC3B,SAAS,SAAS,YAAY,GAAG,YAAY,EAC7C,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACnD,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAEzD,MAAM,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,GAC9C,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAK/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/clients/transports/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,KAAK,2BAA2B,EAEhC,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../../../src/sdk/clients/transports/custom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EACL,KAAK,2BAA2B,EAEhC,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAC;AAEnC,KAAK,eAAe,GAAG;IAAE,OAAO,CAAC,GAAG,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAAG;IAClC,gCAAgC;IAChC,GAAG,CAAC,EAAE,kBAAkB,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;IAC5C,iEAAiE;IACjE,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;IACpD,iCAAiC;IACjC,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9C,wCAAwC;IACxC,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IAC1D,8CAA8C;IAC9C,UAAU,CAAC,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;CAC3D,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CACxC,QAAQ,EACR,EAAE,EACF,aAAa,CAEd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,2BAA2B,GAAG,SAAS,CAAC;AAE/E,wBAAgB,MAAM,CAAC,QAAQ,SAAS,eAAe,EACrD,QAAQ,EAAE,QAAQ,EAClB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAiBjB"}
|
|
@@ -7,8 +7,16 @@ export type SendRawTransactionParams = [
|
|
|
7
7
|
export interface SendRawTransactionReturnType {
|
|
8
8
|
txid: string;
|
|
9
9
|
}
|
|
10
|
+
export type TestMempoolAcceptParams = [
|
|
11
|
+
txs: string[],
|
|
12
|
+
opts?: {
|
|
13
|
+
maxFeeRate: number | string;
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
export type TestMempoolAcceptReturnType = any;
|
|
10
17
|
export type BtcRpcSchema = readonly [
|
|
11
|
-
RpcSchemaEntry<"sendrawtransaction", SendRawTransactionParams, SendRawTransactionReturnType
|
|
18
|
+
RpcSchemaEntry<"sendrawtransaction", SendRawTransactionParams, SendRawTransactionReturnType>,
|
|
19
|
+
RpcSchemaEntry<"testmempoolaccept", TestMempoolAcceptParams, TestMempoolAcceptReturnType>
|
|
12
20
|
];
|
|
13
21
|
export type BtcNodeRequestFn<Schema extends RpcSchema | undefined = BtcRpcSchema> = RpcRequestFn<Schema>;
|
|
14
22
|
export type BtcNodeProvider = Prettify<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"btc-rpc.d.ts","sourceRoot":"","sources":["../../../../src/sdk/types/btc-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"btc-rpc.d.ts","sourceRoot":"","sources":["../../../../src/sdk/types/btc-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAE/E,MAAM,MAAM,wBAAwB,GAAG;IACrC,GAAG,EAAE,MAAM;IACX,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM;CAC7B,CAAC;AAEF,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,GAAG,EAAE,MAAM,EAAE;IACb,IAAI,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE;CACvC,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,GAAG,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,SAAS;IAClC,cAAc,CACZ,oBAAoB,EACpB,wBAAwB,EACxB,4BAA4B,CAC7B;IACD,cAAc,CACZ,mBAAmB,EACnB,uBAAuB,EACvB,2BAA2B,CAC5B;CACF,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,MAAM,SAAS,SAAS,GAAG,SAAS,GAAG,YAAY,IACjD,YAAY,CAAC,MAAM,CAAC,CAAC;AAEzB,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,CAAC;CACzC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-rpc-request.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/build-rpc-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE5E,wBAAgB,eAAe,CAC7B,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EAC3C,SAAS,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EACnD,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,iBAAsB,GAAG,YAAY,CAAC,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"build-rpc-request.d.ts","sourceRoot":"","sources":["../../../../src/sdk/utils/build-rpc-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EACV,YAAY,EACZ,SAAS,EACT,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE5E,wBAAgB,eAAe,CAC7B,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,EAC3C,SAAS,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EACnD,OAAO,EAAE,OAAO,EAAE,OAAO,GAAE,iBAAsB,GAAG,YAAY,CAAC,SAAS,CAAC,CA6C5E;AAGD,gBAAgB;AAChB,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,WA2BvC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontor/kontor-sdk",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.11",
|
|
4
4
|
"author": "Unspendable Labs <dev@unspendablelabs.com>",
|
|
5
5
|
"description": "The official SDK to the Kontor Bitcoin metaprotocol",
|
|
6
6
|
"repository": {
|
|
@@ -65,5 +65,9 @@
|
|
|
65
65
|
"micro-packed": "^0.8.0",
|
|
66
66
|
"sats-connect": "^4.2.1",
|
|
67
67
|
"zod": "^4.1.12"
|
|
68
|
-
}
|
|
68
|
+
},
|
|
69
|
+
"workspaces": [
|
|
70
|
+
".",
|
|
71
|
+
"demo"
|
|
72
|
+
]
|
|
69
73
|
}
|
|
@@ -1,44 +1,35 @@
|
|
|
1
|
-
import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
1
|
+
// import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
2
2
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
3
3
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
4
4
|
import type { Chain } from "../../../types/chain.js";
|
|
5
5
|
import type { Address, UtxoId, XOnlyPubKey } from "../../../types/misc.js";
|
|
6
|
-
import {
|
|
7
|
-
buildInstruction,
|
|
8
|
-
type BuildInstructionReturnType,
|
|
9
|
-
} from "./build-instruction.js";
|
|
6
|
+
import { buildInstructionQuery } from "./build-instruction-query.js";
|
|
10
7
|
import { getKontorAction } from "../../../utils/get-action.js";
|
|
8
|
+
import type { ComposeQuery } from "@kontor/kontor-ts";
|
|
9
|
+
import type { Inst } from "src/sdk/types/kontor.js";
|
|
11
10
|
|
|
12
|
-
export type
|
|
11
|
+
export type BuildComposeQueryParameters<
|
|
13
12
|
_chain extends Chain | undefined = Chain | undefined,
|
|
14
13
|
> = {
|
|
14
|
+
instruction: Inst;
|
|
15
15
|
address?: Address;
|
|
16
16
|
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
17
17
|
utxos: UtxoId[];
|
|
18
|
-
contractAddress: ResolvedRegister["contractAddress"];
|
|
19
|
-
wave: string;
|
|
20
|
-
gas: bigint;
|
|
21
18
|
satsPerVByte: number;
|
|
22
19
|
};
|
|
23
20
|
|
|
24
|
-
export type
|
|
25
|
-
instructions: BuildInstructionReturnType[];
|
|
26
|
-
// TODO: this should be changed upstream or encoded in a formatter
|
|
27
|
-
sat_per_vbyte: number;
|
|
28
|
-
};
|
|
21
|
+
export type BuildComposeQueryReturnType = ComposeQuery;
|
|
29
22
|
|
|
30
|
-
export async function
|
|
23
|
+
export async function buildComposeQuery<
|
|
31
24
|
chain extends Chain | undefined = Chain | undefined,
|
|
32
25
|
>(
|
|
33
26
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
34
|
-
params:
|
|
35
|
-
): Promise<
|
|
27
|
+
params: BuildComposeQueryParameters<chain>,
|
|
28
|
+
): Promise<BuildComposeQueryReturnType> {
|
|
36
29
|
const account = client.account;
|
|
37
30
|
|
|
38
31
|
const {
|
|
39
|
-
|
|
40
|
-
wave,
|
|
41
|
-
gas,
|
|
32
|
+
instruction: inst,
|
|
42
33
|
utxos,
|
|
43
34
|
address = account?.address,
|
|
44
35
|
xOnlyPubKey = account?.xOnlyPubKey,
|
|
@@ -61,12 +52,10 @@ export async function buildComposeCall<
|
|
|
61
52
|
|
|
62
53
|
const instruction = await getKontorAction(
|
|
63
54
|
client,
|
|
64
|
-
|
|
65
|
-
"
|
|
55
|
+
buildInstructionQuery,
|
|
56
|
+
"buildInstructionQuery",
|
|
66
57
|
)({
|
|
67
|
-
|
|
68
|
-
wave,
|
|
69
|
-
gas,
|
|
58
|
+
instruction: inst,
|
|
70
59
|
utxos,
|
|
71
60
|
xOnlyPubKey,
|
|
72
61
|
address,
|
|
@@ -75,5 +64,6 @@ export async function buildComposeCall<
|
|
|
75
64
|
return {
|
|
76
65
|
instructions: [instruction],
|
|
77
66
|
sat_per_vbyte: params.satsPerVByte,
|
|
67
|
+
envelope: null,
|
|
78
68
|
};
|
|
79
69
|
}
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
-
import type { InstructionQuery } from "../../../types/kontor.js";
|
|
2
|
-
import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
1
|
+
import type { Inst, InstructionQuery } from "../../../types/kontor.js";
|
|
3
2
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
4
3
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
5
4
|
import type { Chain } from "../../../types/chain.js";
|
|
6
5
|
import type { Address, UtxoId, XOnlyPubKey } from "../../../types/misc.js";
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
// If InstructionQuery already uses this Inst shape internally, you don't need to touch it.
|
|
8
|
+
// Otherwise you can make InstructionQuery generic over Inst and plug this in.
|
|
9
|
+
export type BuildInstructionQueryReturnType = InstructionQuery;
|
|
10
|
+
|
|
11
|
+
export type BuildInstructionQueryParameters<
|
|
9
12
|
_chain extends Chain | undefined = Chain | undefined,
|
|
10
13
|
> = {
|
|
11
14
|
address?: Address;
|
|
12
15
|
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
13
16
|
utxos: UtxoId[];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The concrete instruction to send (Publish | Call | Issuance).
|
|
19
|
+
* Example:
|
|
20
|
+
* { Call: { gas_limit: 100000, contract: "addr", expr: "balance(...)" } }
|
|
21
|
+
* { Publish: { gas_limit: 100000, name: "token", bytes: [0,1,2,...] } }
|
|
22
|
+
* "Issuance"
|
|
23
|
+
*/
|
|
24
|
+
instruction: Inst;
|
|
25
|
+
/**
|
|
26
|
+
* Optional chained instruction if you want to send two instructions atomically.
|
|
27
|
+
*/
|
|
28
|
+
chainedInstruction?: Inst | null;
|
|
17
29
|
};
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
// ------------------ helpers ------------------
|
|
20
32
|
|
|
21
|
-
// TODO: these normalize methods probably belong somewhere else
|
|
22
33
|
function normalizeXOnly(pub: string): string {
|
|
23
34
|
if (!/^[0-9a-fA-F]{64}$/.test(pub)) {
|
|
24
35
|
throw new Error(
|
|
@@ -40,19 +51,20 @@ function normalizeUtxoIds(u: UtxoId | UtxoId[]): string[] {
|
|
|
40
51
|
return Array.isArray(u) ? u.map(normalizeUtxoId) : [normalizeUtxoId(u)];
|
|
41
52
|
}
|
|
42
53
|
|
|
43
|
-
|
|
54
|
+
// ------------------ main builder ------------------
|
|
55
|
+
|
|
56
|
+
export async function buildInstructionQuery<
|
|
44
57
|
chain extends Chain | undefined = Chain | undefined,
|
|
45
58
|
>(
|
|
46
59
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
47
|
-
params:
|
|
48
|
-
): Promise<
|
|
60
|
+
params: BuildInstructionQueryParameters<chain>,
|
|
61
|
+
): Promise<BuildInstructionQueryReturnType> {
|
|
49
62
|
const account = client.account;
|
|
50
63
|
|
|
51
64
|
const {
|
|
52
|
-
contractAddress,
|
|
53
|
-
wave,
|
|
54
|
-
gas,
|
|
55
65
|
utxos,
|
|
66
|
+
instruction,
|
|
67
|
+
chainedInstruction = null,
|
|
56
68
|
address = account?.address,
|
|
57
69
|
xOnlyPubKey = account?.xOnlyPubKey,
|
|
58
70
|
} = params;
|
|
@@ -62,6 +74,11 @@ export async function buildInstruction<
|
|
|
62
74
|
throw new Error("x_only_public_key is required");
|
|
63
75
|
}
|
|
64
76
|
|
|
77
|
+
if (!address) {
|
|
78
|
+
// TODO: add custom error
|
|
79
|
+
throw new Error("address is required");
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
if (utxos.length === 0) {
|
|
66
83
|
// TODO: add custom error
|
|
67
84
|
throw new Error("at least one funding UTXO is required");
|
|
@@ -70,22 +87,11 @@ export async function buildInstruction<
|
|
|
70
87
|
const xOnly = normalizeXOnly(xOnlyPubKey);
|
|
71
88
|
const fundingIds = normalizeUtxoIds(utxos);
|
|
72
89
|
|
|
73
|
-
// const sciptData = buildCallScriptDataBytes(contractAddress, wave, gas);
|
|
74
|
-
|
|
75
90
|
return {
|
|
76
|
-
address
|
|
91
|
+
address,
|
|
77
92
|
x_only_public_key: xOnly,
|
|
78
|
-
funding_utxo_ids:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
: fundingIds.join(","),
|
|
82
|
-
instruction: {
|
|
83
|
-
Call: {
|
|
84
|
-
gas_limit: Number(gas), // TODO: refine type
|
|
85
|
-
contract: contractAddress,
|
|
86
|
-
expr: wave,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
chained_instruction: null,
|
|
93
|
+
funding_utxo_ids: fundingIds.join(","),
|
|
94
|
+
instruction,
|
|
95
|
+
chained_instruction: chainedInstruction ?? null,
|
|
90
96
|
};
|
|
91
97
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
2
1
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
3
2
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
4
3
|
import type { Chain } from "../../../types/chain.js";
|
|
@@ -9,20 +8,22 @@ import type {
|
|
|
9
8
|
XOnlyPubKey,
|
|
10
9
|
} from "../../../types/misc.js";
|
|
11
10
|
|
|
12
|
-
import {
|
|
11
|
+
import { buildComposeQuery } from "./build-compose-query.js";
|
|
13
12
|
import { getKontorAction } from "../../../utils/get-action.js";
|
|
14
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
type ComposeOutputs,
|
|
15
|
+
type Inst,
|
|
16
|
+
type ResultResponse,
|
|
17
|
+
} from "../../../types/kontor.js";
|
|
15
18
|
|
|
16
|
-
export type
|
|
19
|
+
export type CallComposeParameters<
|
|
17
20
|
_chain extends Chain | undefined = Chain | undefined,
|
|
18
21
|
> = {
|
|
19
22
|
address?: Address;
|
|
20
23
|
xOnlyPubKey?: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
21
24
|
utxos: UtxoId[];
|
|
22
|
-
contractAddress: ResolvedRegister["contractAddress"];
|
|
23
|
-
wave: string;
|
|
24
|
-
gas: bigint;
|
|
25
25
|
satsPerVByte: number;
|
|
26
|
+
instruction: Inst;
|
|
26
27
|
};
|
|
27
28
|
|
|
28
29
|
// TODO: organize these types or just refernece direc
|
|
@@ -32,24 +33,22 @@ export interface TapLeafScript {
|
|
|
32
33
|
controlBlock: number[];
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
export type
|
|
36
|
+
export type CallComposeReturnType = ResultResponse<ComposeOutputs>;
|
|
36
37
|
|
|
37
|
-
export async function
|
|
38
|
+
export async function callCompose<
|
|
38
39
|
chain extends Chain | undefined = Chain | undefined,
|
|
39
40
|
>(
|
|
40
41
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
41
|
-
params:
|
|
42
|
-
): Promise<
|
|
42
|
+
params: CallComposeParameters<chain>,
|
|
43
|
+
): Promise<CallComposeReturnType> {
|
|
43
44
|
const account = client.account;
|
|
44
45
|
|
|
45
46
|
const {
|
|
46
|
-
contractAddress,
|
|
47
|
-
wave,
|
|
48
|
-
gas,
|
|
49
47
|
utxos,
|
|
50
48
|
address = account?.address,
|
|
51
49
|
xOnlyPubKey = account?.xOnlyPubKey,
|
|
52
50
|
satsPerVByte,
|
|
51
|
+
instruction,
|
|
53
52
|
} = params;
|
|
54
53
|
|
|
55
54
|
if (!xOnlyPubKey) {
|
|
@@ -70,12 +69,10 @@ export async function callProc<
|
|
|
70
69
|
|
|
71
70
|
const composeCall = await getKontorAction(
|
|
72
71
|
client,
|
|
73
|
-
|
|
74
|
-
"
|
|
72
|
+
buildComposeQuery,
|
|
73
|
+
"buildComposeQuery",
|
|
75
74
|
)({
|
|
76
|
-
|
|
77
|
-
wave,
|
|
78
|
-
gas,
|
|
75
|
+
instruction,
|
|
79
76
|
utxos,
|
|
80
77
|
xOnlyPubKey,
|
|
81
78
|
address,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Instruction } from "../../../../sdk/types/kontor.js";
|
|
1
2
|
import type { Wit } from "../../../../wit/wit.js";
|
|
2
3
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
3
4
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
encodeFunctionData,
|
|
14
15
|
type EncodeFunctionDataParameters,
|
|
15
16
|
} from "../../../utils/wit/encode-function-data.js";
|
|
16
|
-
import {
|
|
17
|
+
import { callCompose, type CallComposeReturnType } from "./call-compose.js";
|
|
17
18
|
|
|
18
19
|
export type ProcContractParameters<
|
|
19
20
|
wit extends Wit | readonly unknown[] = Wit,
|
|
@@ -34,7 +35,7 @@ export type ProcContractParameters<
|
|
|
34
35
|
satsPerVByte: number;
|
|
35
36
|
};
|
|
36
37
|
|
|
37
|
-
export type ProcContractReturnType =
|
|
38
|
+
export type ProcContractReturnType = CallComposeReturnType;
|
|
38
39
|
|
|
39
40
|
export async function procContract<
|
|
40
41
|
// chain exhttps://viem.sh/tends Chain | undefined,
|
|
@@ -85,16 +86,18 @@ export async function procContract<
|
|
|
85
86
|
try {
|
|
86
87
|
const response = await getKontorAction(
|
|
87
88
|
client,
|
|
88
|
-
|
|
89
|
+
callCompose,
|
|
89
90
|
"callProc",
|
|
90
91
|
)({
|
|
91
|
-
contractAddress: contractAddress,
|
|
92
|
-
wave: wave,
|
|
93
92
|
utxos,
|
|
94
93
|
satsPerVByte,
|
|
95
94
|
address,
|
|
96
95
|
xOnlyPubKey,
|
|
97
|
-
|
|
96
|
+
instruction: Instruction.call({
|
|
97
|
+
contract: contractAddress,
|
|
98
|
+
gasLimit: gas,
|
|
99
|
+
expr: wave,
|
|
100
|
+
}),
|
|
98
101
|
});
|
|
99
102
|
|
|
100
103
|
return response;
|
|
@@ -7,7 +7,11 @@ import type { GetAccountParameter } from "../../../types/account.js";
|
|
|
7
7
|
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
8
8
|
import { getAction } from "../../../utils/get-action.js";
|
|
9
9
|
import { signPsbt } from "../../wallet/sign-psbt.js";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
TaprootControlBlock,
|
|
12
|
+
Transaction,
|
|
13
|
+
utils as u,
|
|
14
|
+
} from "@scure/btc-signer";
|
|
11
15
|
import { hex } from "@scure/base";
|
|
12
16
|
import type { ParticipantScripts } from "@kontor/kontor-ts";
|
|
13
17
|
|
|
@@ -51,30 +55,22 @@ export async function signReveal<
|
|
|
51
55
|
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
52
56
|
const { commit_tap_leaf_script } = params.parcipantScripts[i]!;
|
|
53
57
|
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const payment = p2tr(
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
undefined,
|
|
66
|
-
tree,
|
|
67
|
-
// TODO: must assert chain or default to mainnet
|
|
68
|
-
chain!.networkConfig,
|
|
69
|
-
true,
|
|
58
|
+
const scriptBytes = hex.decode(commit_tap_leaf_script.script);
|
|
59
|
+
const controlBlockBytes = hex.decode(commit_tap_leaf_script.controlBlock);
|
|
60
|
+
const leafVersion = commit_tap_leaf_script.leafVersion;
|
|
61
|
+
|
|
62
|
+
// scure expects script || leafVersion as one buffer
|
|
63
|
+
const scriptWithVersion = u.concatBytes(
|
|
64
|
+
scriptBytes,
|
|
65
|
+
new Uint8Array([leafVersion]),
|
|
70
66
|
);
|
|
71
67
|
|
|
68
|
+
const controlBlockStruct = TaprootControlBlock.decode(controlBlockBytes);
|
|
69
|
+
|
|
72
70
|
tx.updateInput(
|
|
73
71
|
i,
|
|
74
72
|
{
|
|
75
|
-
tapLeafScript:
|
|
76
|
-
tapInternalKey: payment.tapInternalKey,
|
|
77
|
-
tapMerkleRoot: payment.tapMerkleRoot,
|
|
73
|
+
tapLeafScript: [[controlBlockStruct, scriptWithVersion]],
|
|
78
74
|
},
|
|
79
75
|
true,
|
|
80
76
|
);
|
|
@@ -111,24 +107,49 @@ export async function signReveal<
|
|
|
111
107
|
allowUnknownInputs: true,
|
|
112
108
|
});
|
|
113
109
|
|
|
114
|
-
//
|
|
115
|
-
//
|
|
110
|
+
// for (let i = 0; i < signedTx.inputsLength; i++) {
|
|
111
|
+
// const input = signedTx.getInput(i);
|
|
112
|
+
// if (input.tapLeafScript && input.tapLeafScript.length > 0) {
|
|
113
|
+
// const [cbStruct, scriptWithVersion] = input.tapLeafScript[0]!;
|
|
114
|
+
// console.log("SIGNED TAPLEAF", i, {
|
|
115
|
+
// cbStruct,
|
|
116
|
+
// cbEncoded: hex.encode(TaprootControlBlock.encode(cbStruct)),
|
|
117
|
+
// scriptWithVersion: hex.encode(scriptWithVersion),
|
|
118
|
+
// });
|
|
119
|
+
// }
|
|
120
|
+
// }
|
|
121
|
+
//
|
|
122
|
+
//
|
|
123
|
+
|
|
124
|
+
// finalize
|
|
116
125
|
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
117
126
|
const input = signedTx.getInput(i);
|
|
118
127
|
const p = params.parcipantScripts[i]!;
|
|
119
|
-
|
|
128
|
+
|
|
129
|
+
const scriptHex = p.commit_tap_leaf_script.script;
|
|
130
|
+
const cbHex = p.commit_tap_leaf_script.controlBlock;
|
|
131
|
+
|
|
132
|
+
// console.log("USING SCRIPT/CB", {
|
|
133
|
+
// scriptHex,
|
|
134
|
+
// cbHex,
|
|
135
|
+
// cbDecodedRoundtrip: hex.encode(hex.decode(cbHex)),
|
|
136
|
+
// });
|
|
137
|
+
|
|
120
138
|
signedTx.updateInput(i, {
|
|
121
139
|
finalScriptWitness: [
|
|
122
140
|
input.tapScriptSig![0]![1],
|
|
123
|
-
|
|
124
|
-
hex.decode(
|
|
125
|
-
// @ts-ignore
|
|
126
|
-
hex.decode(p.commit_tap_leaf_script.controlBlock),
|
|
141
|
+
hex.decode(scriptHex),
|
|
142
|
+
hex.decode(cbHex),
|
|
127
143
|
],
|
|
128
144
|
});
|
|
129
145
|
}
|
|
130
146
|
|
|
131
|
-
signedTx.
|
|
147
|
+
// for (let i = 0; i < signedTx.inputsLength; i++) {
|
|
148
|
+
// const input = signedTx.getInput(i);
|
|
149
|
+
// console.log("FINAL INPUT", i, {
|
|
150
|
+
// finalScriptWitness: input.finalScriptWitness?.map((w) => hex.encode(w)),
|
|
151
|
+
// });
|
|
152
|
+
// }
|
|
132
153
|
|
|
133
154
|
return signedTx;
|
|
134
155
|
}
|
|
@@ -1,34 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
import type { Chain } from "../../types/chain.js";
|
|
2
|
+
|
|
3
|
+
import type { RpcTransport } from "../../clients/transports/create-rpc-transport.js";
|
|
4
|
+
import type { PublicClient } from "../../clients/create-public-client.js";
|
|
5
|
+
import type { Account } from "../../accounts/types.js";
|
|
6
|
+
|
|
7
|
+
export type TestMempoolAcceptOptions = {
|
|
8
|
+
/** Max feerate in BTC/kvB. If omitted, Core uses default relay feerate. */
|
|
9
|
+
maxfeerate?: string | number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export interface TestMempoolAcceptParams {
|
|
13
|
+
rawtx: string | string[];
|
|
14
|
+
options: TestMempoolAcceptOptions;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type TestMempoolAcceptReturnType = any;
|
|
18
|
+
|
|
19
|
+
export async function testMempoolAccept<
|
|
20
|
+
chain extends Chain | undefined,
|
|
21
|
+
account extends Account | undefined = Account | undefined,
|
|
22
|
+
>(
|
|
23
|
+
client: PublicClient<RpcTransport, chain, account>,
|
|
24
|
+
{ rawtx, options = {} }: TestMempoolAcceptParams,
|
|
25
|
+
): Promise<TestMempoolAcceptReturnType> {
|
|
26
|
+
const txs = Array.isArray(rawtx) ? rawtx : [rawtx];
|
|
27
|
+
|
|
28
|
+
const params = options.maxfeerate !== undefined ? [txs, options] : [txs];
|
|
29
|
+
|
|
30
|
+
return client.request({
|
|
31
|
+
method: "testmempoolaccept",
|
|
32
|
+
params: params as any,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
32
35
|
|
|
33
36
|
// export async function testMempoolAccept(
|
|
34
37
|
// rawtx: string | string[],
|