@kontor/kontor-sdk 1.0.0-alpha.27 → 1.0.0-alpha.29
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.map +1 -1
- package/dist/cjs/sdk/accounts/hd-key-to-account.js +1 -0
- package/dist/cjs/sdk/accounts/hd-key-to-account.js.map +1 -1
- package/dist/cjs/sdk/accounts/mnemonic-to-account.js +2 -4
- package/dist/cjs/sdk/accounts/mnemonic-to-account.js.map +1 -1
- package/dist/cjs/sdk/accounts/private-key-to-account.js +3 -8
- package/dist/cjs/sdk/accounts/private-key-to-account.js.map +1 -1
- package/dist/cjs/sdk/accounts/to-local-account.js.map +1 -1
- package/dist/cjs/sdk/actions/get-contract.js +36 -16
- package/dist/cjs/sdk/actions/get-contract.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/build-compose-query.js +9 -12
- package/dist/cjs/sdk/actions/kontor/public/build-compose-query.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js +13 -33
- package/dist/cjs/sdk/actions/kontor/public/build-instruction-query.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/call-compose.js +6 -4
- package/dist/cjs/sdk/actions/kontor/public/call-compose.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/inspect.js +1 -2
- package/dist/cjs/sdk/actions/kontor/public/inspect.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js +5 -5
- package/dist/cjs/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/cjs/sdk/actions/kontor/public/view-contract.js +2 -1
- package/dist/cjs/sdk/actions/kontor/public/view-contract.js.map +1 -1
- package/dist/cjs/sdk/chains/definitions/signet.js +0 -1
- package/dist/cjs/sdk/chains/definitions/signet.js.map +1 -1
- package/dist/cjs/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/cjs/sdk/errors/chain.js +44 -0
- package/dist/cjs/sdk/errors/chain.js.map +1 -0
- package/dist/cjs/sdk/utils/chain/assert-current-chain.js +11 -0
- package/dist/cjs/sdk/utils/chain/assert-current-chain.js.map +1 -0
- package/dist/cjs/sdk/utils/kontor/build-compose-query.js +19 -0
- package/dist/cjs/sdk/utils/kontor/build-compose-query.js.map +1 -0
- package/dist/cjs/sdk/utils/kontor/build-instruction-query.js +36 -0
- package/dist/cjs/sdk/utils/kontor/build-instruction-query.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/bool.js +29 -0
- package/dist/cjs/sdk/utils/wit/codecs/bool.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/codecs/s64.js +57 -0
- package/dist/cjs/sdk/utils/wit/codecs/s64.js.map +1 -0
- package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js +134 -131
- package/dist/cjs/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
- package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js +74 -26
- package/dist/cjs/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/cjs/wit/wit-parser/core/errors/{splitParameters.js → split-parameters.js} +1 -1
- package/dist/cjs/wit/wit-parser/core/errors/split-parameters.js.map +1 -0
- package/dist/cjs/wit/wit-parser/core/utils.js +3 -3
- package/dist/cjs/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/esm/exports/index.js +1 -1
- package/dist/esm/exports/index.js.map +1 -1
- package/dist/esm/sdk/accounts/hd-key-to-account.js +2 -5
- package/dist/esm/sdk/accounts/hd-key-to-account.js.map +1 -1
- package/dist/esm/sdk/accounts/mnemonic-to-account.js +2 -10
- package/dist/esm/sdk/accounts/mnemonic-to-account.js.map +1 -1
- package/dist/esm/sdk/accounts/private-key-to-account.js +3 -15
- package/dist/esm/sdk/accounts/private-key-to-account.js.map +1 -1
- package/dist/esm/sdk/accounts/to-local-account.js +0 -5
- package/dist/esm/sdk/accounts/to-local-account.js.map +1 -1
- package/dist/esm/sdk/actions/get-contract.js +37 -35
- package/dist/esm/sdk/actions/get-contract.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/build-compose-query.js +9 -13
- package/dist/esm/sdk/actions/kontor/public/build-compose-query.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/build-instruction-query.js +13 -36
- package/dist/esm/sdk/actions/kontor/public/build-instruction-query.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/call-compose.js +6 -4
- package/dist/esm/sdk/actions/kontor/public/call-compose.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/call-view.js +1 -0
- package/dist/esm/sdk/actions/kontor/public/call-view.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/inspect.js +9 -4
- package/dist/esm/sdk/actions/kontor/public/inspect.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js +5 -6
- package/dist/esm/sdk/actions/kontor/public/proc-contract.js.map +1 -1
- package/dist/esm/sdk/actions/kontor/public/view-contract.js +3 -5
- package/dist/esm/sdk/actions/kontor/public/view-contract.js.map +1 -1
- package/dist/esm/sdk/chains/definitions/signet.js +0 -1
- package/dist/esm/sdk/chains/definitions/signet.js.map +1 -1
- package/dist/esm/sdk/clients/decorators/kontor/public.js.map +1 -1
- package/dist/esm/sdk/errors/chain.js +37 -0
- package/dist/esm/sdk/errors/chain.js.map +1 -0
- package/dist/esm/sdk/utils/chain/assert-current-chain.js +8 -0
- package/dist/esm/sdk/utils/chain/assert-current-chain.js.map +1 -0
- package/dist/esm/sdk/utils/kontor/build-compose-query.js +16 -0
- package/dist/esm/sdk/utils/kontor/build-compose-query.js.map +1 -0
- package/dist/esm/sdk/utils/kontor/build-instruction-query.js +36 -0
- package/dist/esm/sdk/utils/kontor/build-instruction-query.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/bool.js +26 -0
- package/dist/esm/sdk/utils/wit/codecs/bool.js.map +1 -0
- package/dist/esm/sdk/utils/wit/codecs/s64.js +65 -0
- package/dist/esm/sdk/utils/wit/codecs/s64.js.map +1 -0
- package/dist/esm/sdk/utils/wit/decode-wit-parameter.js +155 -147
- package/dist/esm/sdk/utils/wit/decode-wit-parameter.js.map +1 -1
- package/dist/esm/sdk/utils/wit/encode-wit-parameters.js +74 -72
- package/dist/esm/sdk/utils/wit/encode-wit-parameters.js.map +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/wit/wit-parser/core/errors/{splitParameters.js → split-parameters.js} +1 -1
- package/dist/esm/wit/wit-parser/core/errors/split-parameters.js.map +1 -0
- package/dist/esm/wit/wit-parser/core/utils.js +1 -1
- package/dist/esm/wit/wit-parser/core/utils.js.map +1 -1
- package/dist/types/exports/index.d.ts +1 -1
- package/dist/types/exports/index.d.ts.map +1 -1
- package/dist/types/sdk/accounts/hd-key-to-account.d.ts +0 -5
- package/dist/types/sdk/accounts/hd-key-to-account.d.ts.map +1 -1
- package/dist/types/sdk/accounts/mnemonic-to-account.d.ts +1 -6
- package/dist/types/sdk/accounts/mnemonic-to-account.d.ts.map +1 -1
- package/dist/types/sdk/accounts/private-key-to-account.d.ts +5 -3
- package/dist/types/sdk/accounts/private-key-to-account.d.ts.map +1 -1
- package/dist/types/sdk/accounts/to-local-account.d.ts +0 -5
- package/dist/types/sdk/accounts/to-local-account.d.ts.map +1 -1
- package/dist/types/sdk/actions/get-contract.d.ts +28 -5
- package/dist/types/sdk/actions/get-contract.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts +5 -5
- package/dist/types/sdk/actions/kontor/public/build-compose-query.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts +6 -6
- package/dist/types/sdk/actions/kontor/public/build-instruction-query.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts +1 -1
- package/dist/types/sdk/actions/kontor/public/call-compose.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/call-view.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/inspect.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/inspect.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/proc-contract.d.ts.map +1 -1
- package/dist/types/sdk/actions/kontor/public/view-contract.d.ts +3 -3
- package/dist/types/sdk/actions/kontor/public/view-contract.d.ts.map +1 -1
- package/dist/types/sdk/chains/definitions/signet.d.ts +0 -1
- package/dist/types/sdk/chains/definitions/signet.d.ts.map +1 -1
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts +6 -6
- package/dist/types/sdk/clients/decorators/kontor/public.d.ts.map +1 -1
- package/dist/types/sdk/errors/chain.d.ts +32 -0
- package/dist/types/sdk/errors/chain.d.ts.map +1 -0
- package/dist/types/sdk/types/chain.d.ts +0 -2
- package/dist/types/sdk/types/chain.d.ts.map +1 -1
- package/dist/types/sdk/types/contract.d.ts.map +1 -1
- package/dist/types/sdk/utils/chain/assert-current-chain.d.ts +10 -0
- package/dist/types/sdk/utils/chain/assert-current-chain.d.ts.map +1 -0
- package/dist/types/sdk/utils/kontor/build-compose-query.d.ts +13 -0
- package/dist/types/sdk/utils/kontor/build-compose-query.d.ts.map +1 -0
- package/dist/types/sdk/utils/kontor/build-instruction-query.d.ts +22 -0
- package/dist/types/sdk/utils/kontor/build-instruction-query.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/bool.d.ts +3 -0
- package/dist/types/sdk/utils/wit/codecs/bool.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/codecs/s64.d.ts +23 -0
- package/dist/types/sdk/utils/wit/codecs/s64.d.ts.map +1 -0
- package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts +12 -3
- package/dist/types/sdk/utils/wit/decode-wit-parameter.d.ts.map +1 -1
- package/dist/types/sdk/utils/wit/encode-wit-parameters.d.ts.map +1 -1
- package/dist/types/wit/type-utils.d.ts.map +1 -1
- package/dist/types/wit/utils.d.ts.map +1 -1
- package/dist/types/wit/wit-parser/core/errors/{splitParameters.d.ts → split-parameters.d.ts} +1 -1
- package/dist/types/wit/wit-parser/core/errors/split-parameters.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/exports/index.ts +1 -1
- package/src/sdk/accounts/hd-key-to-account.ts +2 -5
- package/src/sdk/accounts/mnemonic-to-account.test.ts +7 -81
- package/src/sdk/accounts/mnemonic-to-account.ts +2 -11
- package/src/sdk/accounts/private-key-to-account.ts +10 -16
- package/src/sdk/accounts/to-local-account.ts +0 -5
- package/src/sdk/actions/get-contract.test-d.ts +10 -9
- package/src/sdk/actions/get-contract.test.ts +49 -0
- package/src/sdk/actions/get-contract.ts +312 -91
- package/src/sdk/actions/kontor/public/build-compose-query.ts +23 -25
- package/src/sdk/actions/kontor/public/build-instruction-query.ts +27 -53
- package/src/sdk/actions/kontor/public/call-compose.ts +8 -4
- package/src/sdk/actions/kontor/public/call-view.ts +5 -4
- package/src/sdk/actions/kontor/public/inspect.ts +20 -9
- package/src/sdk/actions/kontor/public/proc-contract.test.ts +1 -2
- package/src/sdk/actions/kontor/public/proc-contract.ts +21 -55
- package/src/sdk/actions/kontor/public/{view-contract.test-d.ts → view-contract.test.ts} +2 -2
- package/src/sdk/actions/kontor/public/view-contract.ts +10 -9
- package/src/sdk/chains/definitions/signet.ts +0 -1
- package/src/sdk/clients/base/create-rpc-client.test.ts +0 -1
- package/src/sdk/clients/create-public-client.test.ts +0 -1
- package/src/sdk/clients/decorators/kontor/public.ts +21 -12
- package/src/sdk/clients/kontor/create-public-client.test.ts +0 -7
- package/src/sdk/errors/chain.ts +64 -0
- package/src/sdk/test/e2e.test.ts +25 -1
- package/src/sdk/types/chain.ts +0 -2
- package/src/sdk/types/contract.ts +3 -14
- package/src/sdk/utils/chain/assert-current-chain.ts +28 -0
- package/src/sdk/utils/kontor/build-compose-query.ts +33 -0
- package/src/sdk/utils/kontor/build-instruction-query.ts +75 -0
- package/src/sdk/utils/wit/codecs/bool.ts +29 -0
- package/src/sdk/utils/wit/codecs/s64.ts +76 -0
- package/src/sdk/utils/wit/decode-wit-parameter.ts +167 -164
- package/src/sdk/utils/wit/encode-wit-parameters.ts +78 -75
- package/src/wit/type-utils.ts +0 -2
- package/src/wit/utils.ts +3 -6
- package/src/wit/wit-parser/core/utils.ts +1 -1
- package/dist/cjs/wit/wit-parser/core/errors/splitParameters.js.map +0 -1
- package/dist/esm/wit/wit-parser/core/errors/splitParameters.js.map +0 -1
- package/dist/types/wit/wit-parser/core/errors/splitParameters.d.ts.map +0 -1
- /package/src/wit/wit-parser/core/errors/{splitParameters.ts → split-parameters.ts} +0 -0
|
@@ -34,7 +34,7 @@ export type CallComposeParameters<
|
|
|
34
34
|
| [Address, XOnlyPubKey]
|
|
35
35
|
| undefined,
|
|
36
36
|
> = CallComposeRequest &
|
|
37
|
-
GetAccountParameter<account, accountOverride,
|
|
37
|
+
GetAccountParameter<account, accountOverride, true, true> &
|
|
38
38
|
GetChainParameter<chain, chainOverride>;
|
|
39
39
|
|
|
40
40
|
// TODO: organize these types or just refernece direc
|
|
@@ -56,6 +56,7 @@ export async function callCompose<
|
|
|
56
56
|
): Promise<CallComposeReturnType> {
|
|
57
57
|
const {
|
|
58
58
|
account: account_ = client.account,
|
|
59
|
+
chain = client.chain,
|
|
59
60
|
utxos,
|
|
60
61
|
satsPerVByte,
|
|
61
62
|
instruction,
|
|
@@ -66,6 +67,10 @@ export async function callCompose<
|
|
|
66
67
|
throw new Error("Account is required");
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
if (!chain) {
|
|
71
|
+
throw new Error("Chain is required");
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
if (utxos.length === 0) {
|
|
70
75
|
// TODO: add custom error
|
|
71
76
|
throw new Error("at least one funding UTXO is required");
|
|
@@ -74,15 +79,14 @@ export async function callCompose<
|
|
|
74
79
|
//
|
|
75
80
|
const account = parseAccount(account_);
|
|
76
81
|
|
|
77
|
-
const composeCall =
|
|
82
|
+
const composeCall = getKontorAction(
|
|
78
83
|
client,
|
|
79
84
|
buildComposeQuery,
|
|
80
85
|
"buildComposeQuery",
|
|
81
86
|
)({
|
|
82
87
|
instruction,
|
|
83
88
|
utxos,
|
|
84
|
-
|
|
85
|
-
address: account.address,
|
|
89
|
+
account,
|
|
86
90
|
satsPerVByte,
|
|
87
91
|
});
|
|
88
92
|
|
|
@@ -5,15 +5,15 @@ import type {
|
|
|
5
5
|
import type { ResolvedRegister } from "../../../../wit/register.js";
|
|
6
6
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
7
7
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
8
|
-
import type { Chain } from "../../../types/chain.js";
|
|
8
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
9
9
|
|
|
10
10
|
export type CallViewParameters<
|
|
11
|
-
|
|
11
|
+
chain extends Chain | undefined = Chain,
|
|
12
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
12
13
|
> = {
|
|
13
14
|
contractAddress: ResolvedRegister["contractAddress"];
|
|
14
15
|
wave: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
16
|
+
} & GetChainParameter<chain, chainOverride>;
|
|
17
17
|
// TODO: refine this type
|
|
18
18
|
export type CallViewReturnType = ResultResponse<ViewResult>;
|
|
19
19
|
|
|
@@ -24,6 +24,7 @@ export async function callView<
|
|
|
24
24
|
params: CallViewParameters<chain>,
|
|
25
25
|
): Promise<CallViewReturnType> {
|
|
26
26
|
const { contractAddress, wave } = params;
|
|
27
|
+
// TODO: assert chain
|
|
27
28
|
|
|
28
29
|
try {
|
|
29
30
|
const response = await client.request({
|
|
@@ -5,19 +5,34 @@ import type {
|
|
|
5
5
|
} from "../../../types/kontor.js";
|
|
6
6
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
7
7
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
8
|
-
import type { Chain } from "../../../types/chain.js";
|
|
9
|
-
|
|
10
|
-
export type InspectParameters = TransactionHex;
|
|
8
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
9
|
+
// import { assertCurrentChain } from "../../../utils/chain/assert-current-chain.js";
|
|
11
10
|
|
|
11
|
+
export type InspectParameters<
|
|
12
|
+
chain extends Chain | undefined = Chain | undefined,
|
|
13
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
14
|
+
> = TransactionHex & GetChainParameter<chain, chainOverride>;
|
|
12
15
|
export type InspectReturnType = ResultResponse<OpWithResult[]>;
|
|
13
16
|
|
|
14
17
|
export async function inspect<
|
|
15
18
|
chain extends Chain | undefined = Chain | undefined,
|
|
19
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
16
20
|
>(
|
|
17
21
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
18
|
-
params: InspectParameters,
|
|
22
|
+
params: InspectParameters<chain, chainOverride>,
|
|
19
23
|
): Promise<InspectReturnType> {
|
|
20
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
hex,
|
|
26
|
+
// chain: chain_ = client.chain
|
|
27
|
+
} = params;
|
|
28
|
+
|
|
29
|
+
// TODO: chain assertions everywhere ( need to get current chain )
|
|
30
|
+
|
|
31
|
+
// assertCurrentChain({
|
|
32
|
+
// currentChain: client.chain,
|
|
33
|
+
// chain: chain_
|
|
34
|
+
// });
|
|
35
|
+
//
|
|
21
36
|
|
|
22
37
|
try {
|
|
23
38
|
const response = await client.request({
|
|
@@ -27,10 +42,6 @@ export async function inspect<
|
|
|
27
42
|
body: { hex: hex },
|
|
28
43
|
});
|
|
29
44
|
|
|
30
|
-
console.log("callView response:", response);
|
|
31
|
-
|
|
32
|
-
// TODO: fix CallViwewReturnType
|
|
33
|
-
// @ts-ignore
|
|
34
45
|
return response;
|
|
35
46
|
} catch (e) {
|
|
36
47
|
// TODO: augment error handling
|
|
@@ -31,13 +31,12 @@ test.skip("e2e", async () => {
|
|
|
31
31
|
"tb1pj2wrjsg0ksmmflec0myf3j7qnqm9myvk2pesqn7y8cqn6sgdg9ls9u6tar",
|
|
32
32
|
"2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
|
|
33
33
|
],
|
|
34
|
+
chain: signet,
|
|
34
35
|
});
|
|
35
36
|
|
|
36
37
|
// proc contract action defined on client
|
|
37
38
|
// response is correctly typed
|
|
38
39
|
const res = await client.procContract({
|
|
39
|
-
account: client.account!,
|
|
40
|
-
chain: signet,
|
|
41
40
|
wit: wit,
|
|
42
41
|
// can also be injected
|
|
43
42
|
|
|
@@ -18,52 +18,6 @@ import {
|
|
|
18
18
|
} from "../../../utils/wit/encode-function-data.js";
|
|
19
19
|
import { callCompose, type CallComposeReturnType } from "./call-compose.js";
|
|
20
20
|
|
|
21
|
-
// export type WriteContractParameters<
|
|
22
|
-
// abi extends Abi | readonly unknown[] = Abi,
|
|
23
|
-
// functionName extends ContractFunctionName<
|
|
24
|
-
// abi,
|
|
25
|
-
// 'nonpayable' | 'payable'
|
|
26
|
-
// > = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
27
|
-
// args extends ContractFunctionArgs<
|
|
28
|
-
// abi,
|
|
29
|
-
// 'nonpayable' | 'payable',
|
|
30
|
-
// functionName
|
|
31
|
-
// > = ContractFunctionArgs<abi, 'nonpayable' | 'payable', functionName>,
|
|
32
|
-
// chain extends Chain | undefined = Chain | undefined,
|
|
33
|
-
// account extends Account | undefined = Account | undefined,
|
|
34
|
-
// chainOverride extends Chain | undefined = Chain | undefined,
|
|
35
|
-
// ///
|
|
36
|
-
// allFunctionNames = ContractFunctionName<abi, 'nonpayable' | 'payable'>,
|
|
37
|
-
// derivedChain extends Chain | undefined = DeriveChain<chain, chainOverride>,
|
|
38
|
-
// > = ContractFunctionParameters<
|
|
39
|
-
// abi,
|
|
40
|
-
// 'nonpayable' | 'payable',
|
|
41
|
-
// functionName,
|
|
42
|
-
// args,
|
|
43
|
-
// false,
|
|
44
|
-
// allFunctionNames
|
|
45
|
-
// > &
|
|
46
|
-
// GetChainParameter<chain, chainOverride> &
|
|
47
|
-
// Prettify<
|
|
48
|
-
// GetAccountParameter<account, Account | Address, true, true> &
|
|
49
|
-
// GetMutabilityAwareValue<
|
|
50
|
-
// abi,
|
|
51
|
-
// 'nonpayable' | 'payable',
|
|
52
|
-
// functionName,
|
|
53
|
-
// FormattedTransactionRequest<derivedChain>['value'],
|
|
54
|
-
// args
|
|
55
|
-
// > & {
|
|
56
|
-
// /** Data to append to the end of the calldata. Useful for adding a ["domain" tag](https://opensea.notion.site/opensea/Seaport-Order-Attributions-ec2d69bf455041a5baa490941aad307f). */
|
|
57
|
-
// dataSuffix?: Hex | undefined
|
|
58
|
-
// }
|
|
59
|
-
// > &
|
|
60
|
-
// UnionEvaluate<
|
|
61
|
-
// UnionOmit<
|
|
62
|
-
// FormattedTransactionRequest<derivedChain>,
|
|
63
|
-
// 'data' | 'from' | 'to' | 'value'
|
|
64
|
-
// >
|
|
65
|
-
// >
|
|
66
|
-
|
|
67
21
|
export type ProcContractParameters<
|
|
68
22
|
wit extends Wit | readonly unknown[] = Wit,
|
|
69
23
|
functionName extends ContractFunctionName<wit, "proc"> = ContractFunctionName<
|
|
@@ -78,12 +32,16 @@ export type ProcContractParameters<
|
|
|
78
32
|
chain extends Chain | undefined = Chain | undefined,
|
|
79
33
|
account extends Account | undefined = Account | undefined,
|
|
80
34
|
chainOverride extends Chain | undefined = Chain | undefined,
|
|
35
|
+
accountOverride extends Account | [Address, XOnlyPubKey] | undefined =
|
|
36
|
+
| Account
|
|
37
|
+
| [Address, XOnlyPubKey]
|
|
38
|
+
| undefined,
|
|
81
39
|
> = ContractFunctionParameters<wit, "proc", functionName, args> & {
|
|
82
40
|
utxos: UtxoId[];
|
|
83
41
|
gas: bigint;
|
|
84
42
|
satsPerVByte: number;
|
|
85
43
|
} & GetChainParameter<chain, chainOverride> &
|
|
86
|
-
GetAccountParameter<account,
|
|
44
|
+
GetAccountParameter<account, accountOverride, true, true>;
|
|
87
45
|
|
|
88
46
|
export type ProcContractReturnType = CallComposeReturnType;
|
|
89
47
|
|
|
@@ -93,9 +51,18 @@ export async function procContract<
|
|
|
93
51
|
const wit extends Wit | readonly unknown[],
|
|
94
52
|
functionName extends ContractFunctionName<wit, "proc">,
|
|
95
53
|
const args extends ContractFunctionArgs<wit, "proc", functionName>,
|
|
54
|
+
account extends Account | undefined,
|
|
55
|
+
chainOverride extends Chain | undefined = undefined,
|
|
96
56
|
>(
|
|
97
57
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
98
|
-
parameters: ProcContractParameters<
|
|
58
|
+
parameters: ProcContractParameters<
|
|
59
|
+
wit,
|
|
60
|
+
functionName,
|
|
61
|
+
args,
|
|
62
|
+
chain,
|
|
63
|
+
account,
|
|
64
|
+
chainOverride
|
|
65
|
+
>,
|
|
99
66
|
): Promise<ProcContractReturnType> {
|
|
100
67
|
const {
|
|
101
68
|
wit: wit,
|
|
@@ -111,13 +78,6 @@ export async function procContract<
|
|
|
111
78
|
...rest
|
|
112
79
|
} = parameters as ProcContractParameters;
|
|
113
80
|
|
|
114
|
-
// @ts-ignore
|
|
115
|
-
const wave = encodeFunctionData({
|
|
116
|
-
wit: wit,
|
|
117
|
-
args,
|
|
118
|
-
functionName,
|
|
119
|
-
} as EncodeFunctionDataParameters);
|
|
120
|
-
|
|
121
81
|
if (!account_) {
|
|
122
82
|
// TODO: add custom error
|
|
123
83
|
throw new Error("account is required");
|
|
@@ -128,6 +88,12 @@ export async function procContract<
|
|
|
128
88
|
throw new Error("at least one funding UTXO is required");
|
|
129
89
|
}
|
|
130
90
|
|
|
91
|
+
const wave = encodeFunctionData({
|
|
92
|
+
wit: wit,
|
|
93
|
+
args,
|
|
94
|
+
functionName,
|
|
95
|
+
} as EncodeFunctionDataParameters);
|
|
96
|
+
|
|
131
97
|
try {
|
|
132
98
|
const response = await getKontorAction(
|
|
133
99
|
client,
|
|
@@ -4,16 +4,16 @@ import { parseWit } from "../../../../wit/wit-parser/parse-wit.js";
|
|
|
4
4
|
import { createPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
5
5
|
import { http } from "../../../clients/transports/http.js";
|
|
6
6
|
import { nativeToken } from "../../../contracts/wits.js";
|
|
7
|
+
import { signet } from "../../../chains/definitions/signet.js";
|
|
7
8
|
|
|
8
9
|
const wit = parseWit(nativeToken.raw);
|
|
9
10
|
|
|
10
11
|
test("e2e", async () => {
|
|
11
12
|
const client = createPublicClient({
|
|
12
13
|
transport: http("https://signet-staging.kontor.network:35000/api"),
|
|
14
|
+
chain: signet,
|
|
13
15
|
});
|
|
14
16
|
|
|
15
|
-
// view contract action defined on client
|
|
16
|
-
// response is correctly typed
|
|
17
17
|
const res = await client.viewContract({
|
|
18
18
|
wit: wit,
|
|
19
19
|
functionName: "balances", // functin name is only valid if it's got a view-context
|
|
@@ -2,7 +2,7 @@ import type { Wit } from "../../../../wit/wit.js";
|
|
|
2
2
|
import type { Prettify } from "../../../../wit/type-utils.js";
|
|
3
3
|
import type { KontorPublicClient } from "../../../clients/kontor/create-public-client.js";
|
|
4
4
|
import type { HttpTransport } from "../../../clients/transports/create-http-transport.js";
|
|
5
|
-
import type { Chain } from "../../../types/chain.js";
|
|
5
|
+
import type { Chain, GetChainParameter } from "../../../types/chain.js";
|
|
6
6
|
import type {
|
|
7
7
|
ContractFunctionArgs,
|
|
8
8
|
ContractFunctionName,
|
|
@@ -11,7 +11,6 @@ import type {
|
|
|
11
11
|
} from "../../../types/contract.js";
|
|
12
12
|
import { getKontorAction } from "../../../utils/get-action.js";
|
|
13
13
|
import { decodeFunctionResult } from "../../../utils/wit/decode-function-result.js";
|
|
14
|
-
// import { getAction } from "../../utils/getAction.js";
|
|
15
14
|
import {
|
|
16
15
|
encodeFunctionData,
|
|
17
16
|
type EncodeFunctionDataParameters,
|
|
@@ -29,7 +28,10 @@ export type ViewContractParameters<
|
|
|
29
28
|
"view",
|
|
30
29
|
functionName
|
|
31
30
|
> = ContractFunctionArgs<wit, "view", functionName>,
|
|
32
|
-
|
|
31
|
+
chain extends Chain | undefined = Chain,
|
|
32
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
|
33
|
+
> = ContractFunctionParameters<wit, "view", functionName, args> &
|
|
34
|
+
GetChainParameter<chain, chainOverride>;
|
|
33
35
|
|
|
34
36
|
export type ViewContractReturnType<
|
|
35
37
|
wit extends Wit | readonly unknown[] = Wit,
|
|
@@ -46,26 +48,24 @@ export type ViewContractReturnType<
|
|
|
46
48
|
> = Prettify<ContractFunctionReturnType<wit, "view", functionName, args>>;
|
|
47
49
|
|
|
48
50
|
export async function viewContract<
|
|
49
|
-
// chain exhttps://viem.sh/tends Chain | undefined,
|
|
50
51
|
chain extends Chain | undefined,
|
|
51
52
|
const wit extends Wit | readonly unknown[],
|
|
52
53
|
functionName extends ContractFunctionName<wit, "view">,
|
|
53
54
|
const args extends ContractFunctionArgs<wit, "view", functionName>,
|
|
54
55
|
>(
|
|
55
56
|
client: KontorPublicClient<HttpTransport, chain>,
|
|
56
|
-
parameters: ViewContractParameters<wit, functionName, args>,
|
|
57
|
+
parameters: ViewContractParameters<wit, functionName, args, chain>,
|
|
57
58
|
): Promise<ViewContractReturnType<wit, functionName, args>> {
|
|
58
59
|
const {
|
|
59
60
|
wit: wit,
|
|
60
61
|
contractAddress,
|
|
61
62
|
args,
|
|
62
63
|
functionName,
|
|
63
|
-
|
|
64
|
-
// @ts-ignore
|
|
65
|
-
...rest
|
|
64
|
+
chain: chain_ = client.chain,
|
|
66
65
|
} = parameters as ViewContractParameters;
|
|
67
66
|
|
|
68
|
-
//
|
|
67
|
+
//TODO: assert chain ( or delegate to downstream call )
|
|
68
|
+
|
|
69
69
|
const wave = encodeFunctionData({
|
|
70
70
|
wit: wit,
|
|
71
71
|
args,
|
|
@@ -80,6 +80,7 @@ export async function viewContract<
|
|
|
80
80
|
)({
|
|
81
81
|
contractAddress: contractAddress,
|
|
82
82
|
wave: wave,
|
|
83
|
+
chain: chain_,
|
|
83
84
|
});
|
|
84
85
|
|
|
85
86
|
console.log(response.result.type);
|
|
@@ -59,35 +59,44 @@ export type KontorPublicActions<
|
|
|
59
59
|
const wit extends Wit | readonly unknown[],
|
|
60
60
|
functionName extends ContractFunctionName<wit, "view">,
|
|
61
61
|
const args extends ContractFunctionArgs<wit, "view", functionName>,
|
|
62
|
+
chainOverride extends Chain | undefined,
|
|
62
63
|
>(
|
|
63
|
-
args: ViewContractParameters<wit, functionName, args>,
|
|
64
|
+
args: ViewContractParameters<wit, functionName, args, chain, chainOverride>,
|
|
64
65
|
) => Promise<ViewContractReturnType<wit, functionName, args>>;
|
|
65
66
|
|
|
66
67
|
procContract: <
|
|
67
68
|
const wit extends Wit | readonly unknown[],
|
|
68
69
|
functionName extends ContractFunctionName<wit, "proc">,
|
|
69
70
|
const args extends ContractFunctionArgs<wit, "proc", functionName>,
|
|
71
|
+
chainOverride extends Chain | undefined,
|
|
70
72
|
>(
|
|
71
|
-
args: ProcContractParameters<
|
|
73
|
+
args: ProcContractParameters<
|
|
74
|
+
wit,
|
|
75
|
+
functionName,
|
|
76
|
+
args,
|
|
77
|
+
chain,
|
|
78
|
+
account,
|
|
79
|
+
chainOverride
|
|
80
|
+
>,
|
|
72
81
|
) => Promise<ProcContractReturnType>;
|
|
73
82
|
|
|
74
|
-
callView: <
|
|
75
|
-
args: CallViewParameters<chain>,
|
|
83
|
+
callView: <chainOverride extends Chain | undefined>(
|
|
84
|
+
args: CallViewParameters<chain, chainOverride>,
|
|
76
85
|
) => Promise<CallViewReturnType>;
|
|
77
86
|
|
|
78
|
-
buildInstructionQuery:
|
|
79
|
-
args: BuildInstructionQueryParameters<
|
|
80
|
-
) =>
|
|
87
|
+
buildInstructionQuery: (
|
|
88
|
+
args: BuildInstructionQueryParameters<account>,
|
|
89
|
+
) => BuildInstructionQueryReturnType;
|
|
81
90
|
|
|
82
|
-
buildComposeQuery:
|
|
83
|
-
args: BuildComposeQueryParameters<
|
|
84
|
-
) =>
|
|
91
|
+
buildComposeQuery: (
|
|
92
|
+
args: BuildComposeQueryParameters<account>,
|
|
93
|
+
) => BuildComposeQueryReturnType;
|
|
85
94
|
|
|
86
95
|
callCompose: <chainOverride extends Chain | undefined>(
|
|
87
96
|
args: CallComposeParameters<chain, account, chainOverride>,
|
|
88
97
|
) => Promise<CallComposeReturnType>;
|
|
89
|
-
inspect: <
|
|
90
|
-
args: InspectParameters,
|
|
98
|
+
inspect: <chainOverride extends Chain | undefined>(
|
|
99
|
+
args: InspectParameters<chain, chainOverride>,
|
|
91
100
|
) => Promise<InspectReturnType>;
|
|
92
101
|
};
|
|
93
102
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { Chain } from "../types/chain.js";
|
|
2
|
+
|
|
3
|
+
import { BaseError } from "./base.js";
|
|
4
|
+
|
|
5
|
+
export type ChainMismatchErrorType = ChainMismatchError & {
|
|
6
|
+
name: "ChainMismatchError";
|
|
7
|
+
};
|
|
8
|
+
export class ChainMismatchError extends BaseError {
|
|
9
|
+
constructor({ chain, currentChain }: { chain: Chain; currentChain: Chain }) {
|
|
10
|
+
super(
|
|
11
|
+
`The current chain of the wallet (name: ${currentChain.name}) does not match the target chain for the transaction (name: ${chain.name}).`,
|
|
12
|
+
{
|
|
13
|
+
metaMessages: [
|
|
14
|
+
`Current Chain: ${currentChain.name}`,
|
|
15
|
+
`Expected Chain: ${chain.name}`,
|
|
16
|
+
],
|
|
17
|
+
name: "ChainMismatchError",
|
|
18
|
+
},
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type ChainNotFoundErrorType = ChainNotFoundError & {
|
|
24
|
+
name: "ChainNotFoundError";
|
|
25
|
+
};
|
|
26
|
+
export class ChainNotFoundError extends BaseError {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(
|
|
29
|
+
[
|
|
30
|
+
"No chain was provided to the request.",
|
|
31
|
+
"Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient.",
|
|
32
|
+
].join("\n"),
|
|
33
|
+
{
|
|
34
|
+
name: "ChainNotFoundError",
|
|
35
|
+
},
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ClientChainNotConfiguredErrorType =
|
|
41
|
+
ClientChainNotConfiguredError & {
|
|
42
|
+
name: "ClientChainNotConfiguredError";
|
|
43
|
+
};
|
|
44
|
+
export class ClientChainNotConfiguredError extends BaseError {
|
|
45
|
+
constructor() {
|
|
46
|
+
super("No chain was provided to the Client.", {
|
|
47
|
+
name: "ClientChainNotConfiguredError",
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type InvalidChainIdErrorType = InvalidChainIdError & {
|
|
53
|
+
name: "InvalidChainIdError";
|
|
54
|
+
};
|
|
55
|
+
export class InvalidChainIdError extends BaseError {
|
|
56
|
+
constructor({ chainId }: { chainId?: number | undefined }) {
|
|
57
|
+
super(
|
|
58
|
+
typeof chainId === "number"
|
|
59
|
+
? `Chain ID "${chainId}" is invalid.`
|
|
60
|
+
: "Chain ID is invalid.",
|
|
61
|
+
{ name: "InvalidChainIdError" },
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/sdk/test/e2e.test.ts
CHANGED
|
@@ -116,7 +116,10 @@ export const wit = parseWit(nativeTokenRaw);
|
|
|
116
116
|
// });
|
|
117
117
|
|
|
118
118
|
test("e2e kontor wallet client", async () => {
|
|
119
|
-
const account = mnemonicToAccount(process.env.TEST_MNEMONIC
|
|
119
|
+
const account = mnemonicToAccount(process.env.TEST_MNEMONIC!, {
|
|
120
|
+
coinType: 1,
|
|
121
|
+
networkConfig: signet.networkConfig,
|
|
122
|
+
});
|
|
120
123
|
|
|
121
124
|
const kontorPublicClient = createKontorPublicClient({
|
|
122
125
|
transport: http("https://signet-staging.kontor.network:35000/api"),
|
|
@@ -140,6 +143,27 @@ test("e2e kontor wallet client", async () => {
|
|
|
140
143
|
satsPerVByte: 1,
|
|
141
144
|
});
|
|
142
145
|
|
|
146
|
+
// TODO: add separate tests for these
|
|
147
|
+
// const instructionQuery_ = kontorPublicClient.buildInstructionQuery({
|
|
148
|
+
// utxos: [
|
|
149
|
+
// "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
|
|
150
|
+
// ],
|
|
151
|
+
// instruction: Instruction.issuance(),
|
|
152
|
+
// });
|
|
153
|
+
//
|
|
154
|
+
// const composeQuery_ = kontorPublicClient.buildComposeQuery({
|
|
155
|
+
// utxos: [
|
|
156
|
+
// "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
|
|
157
|
+
// ],
|
|
158
|
+
//
|
|
159
|
+
// instruction: Instruction.issuance(),
|
|
160
|
+
// satsPerVByte: 1,
|
|
161
|
+
// });
|
|
162
|
+
// const x = await kontorPublicClient.callView({
|
|
163
|
+
// contractAddress: "token_0_0",
|
|
164
|
+
// wave: "balances()",
|
|
165
|
+
// });
|
|
166
|
+
|
|
143
167
|
const commit: Transaction = await kontorWalletClient.signCommit({
|
|
144
168
|
psbt: res.result.commit_psbt_hex,
|
|
145
169
|
});
|
package/src/sdk/types/chain.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
// Address,
|
|
3
2
|
Wit,
|
|
4
3
|
WitFunction,
|
|
5
4
|
WitParameter,
|
|
@@ -26,10 +25,6 @@ export type ContractFunctionName<
|
|
|
26
25
|
: functionName
|
|
27
26
|
: string;
|
|
28
27
|
|
|
29
|
-
// AbiParametersToPrimitiveTypes,
|
|
30
|
-
// AbiParameterToPrimitiveType,
|
|
31
|
-
// ExtractAbiFunction,
|
|
32
|
-
|
|
33
28
|
export type ContractFunctionArgs<
|
|
34
29
|
wit extends Wit | readonly unknown[] = Wit,
|
|
35
30
|
mutability extends WitStateMutability = WitStateMutability,
|
|
@@ -107,12 +102,8 @@ export type ContractFunctionParameters<
|
|
|
107
102
|
mutability,
|
|
108
103
|
functionName
|
|
109
104
|
> = ContractFunctionArgs<wit, mutability, functionName>,
|
|
110
|
-
// deployless extends boolean = false,
|
|
111
|
-
///
|
|
112
105
|
allFunctionNames = ContractFunctionName<wit, mutability>,
|
|
113
106
|
allArgs = ContractFunctionArgs<wit, mutability, functionName>,
|
|
114
|
-
// when `args` is inferred to `readonly []` ("inputs": []) or `never` (`abi` declared as `Abi` or not inferrable), allow `args` to be optional.
|
|
115
|
-
// important that both branches return same structural type
|
|
116
107
|
> = {
|
|
117
108
|
wit: wit;
|
|
118
109
|
functionName:
|
|
@@ -224,23 +215,21 @@ export type ExtractWitItemForArgs<
|
|
|
224
215
|
ExtractWitItem<wit, name> extends infer witItem extends WitItem & {
|
|
225
216
|
inputs: readonly WitParameter[];
|
|
226
217
|
}
|
|
227
|
-
? IsUnion<witItem> extends true
|
|
218
|
+
? IsUnion<witItem> extends true
|
|
228
219
|
? UnionToTuple<witItem> extends infer witItems extends
|
|
229
220
|
readonly (WitItem & {
|
|
230
221
|
inputs: readonly WitParameter[];
|
|
231
222
|
})[]
|
|
232
223
|
? {
|
|
233
224
|
[k in keyof witItems]: (
|
|
234
|
-
readonly [] extends args
|
|
235
|
-
? readonly [] // fallback to `readonly []` if `args` has no value (e.g. `args` property not provided)
|
|
236
|
-
: args
|
|
225
|
+
readonly [] extends args ? readonly [] : args
|
|
237
226
|
) extends WitParametersToPrimitiveTypes<
|
|
238
227
|
witItems[k]["inputs"],
|
|
239
228
|
"inputs"
|
|
240
229
|
>
|
|
241
230
|
? witItems[k]
|
|
242
231
|
: never;
|
|
243
|
-
}[number]
|
|
232
|
+
}[number]
|
|
244
233
|
: never
|
|
245
234
|
: witItem
|
|
246
235
|
: never;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChainMismatchError,
|
|
3
|
+
type ChainMismatchErrorType,
|
|
4
|
+
ChainNotFoundError,
|
|
5
|
+
type ChainNotFoundErrorType,
|
|
6
|
+
} from "../../errors/chain.js";
|
|
7
|
+
|
|
8
|
+
import type { ErrorType } from "../../errors/utils.js";
|
|
9
|
+
import type { Chain } from "../../types/chain.js";
|
|
10
|
+
|
|
11
|
+
export type AssertCurrentChainParameters = {
|
|
12
|
+
chain?: Chain | undefined;
|
|
13
|
+
currentChain: Chain;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type AssertCurrentChainErrorType =
|
|
17
|
+
| ChainNotFoundErrorType
|
|
18
|
+
| ChainMismatchErrorType
|
|
19
|
+
| ErrorType;
|
|
20
|
+
|
|
21
|
+
export function assertCurrentChain({
|
|
22
|
+
chain,
|
|
23
|
+
currentChain,
|
|
24
|
+
}: AssertCurrentChainParameters): void {
|
|
25
|
+
if (!chain) throw new ChainNotFoundError();
|
|
26
|
+
if (currentChain.name !== chain.name)
|
|
27
|
+
throw new ChainMismatchError({ chain, currentChain });
|
|
28
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Address, UtxoId, XOnlyPubKey } from "../../types/misc.js";
|
|
2
|
+
import type { ComposeQuery } from "@kontor/kontor-ts";
|
|
3
|
+
import type { Inst } from "../../../sdk/types/kontor.js";
|
|
4
|
+
import { buildInstructionQuery } from "./build-instruction-query.js";
|
|
5
|
+
|
|
6
|
+
export type BuildComposeQueryParameters = {
|
|
7
|
+
instruction: Inst;
|
|
8
|
+
address: Address;
|
|
9
|
+
xOnlyPubKey: XOnlyPubKey; // TODO: maybe this should be wrapped in a single object
|
|
10
|
+
utxos: UtxoId[];
|
|
11
|
+
satsPerVByte: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type BuildComposeQueryReturnType = ComposeQuery;
|
|
15
|
+
|
|
16
|
+
export function buildComposeQuery(
|
|
17
|
+
params: BuildComposeQueryParameters,
|
|
18
|
+
): BuildComposeQueryReturnType {
|
|
19
|
+
const { instruction: inst, utxos, address, xOnlyPubKey } = params;
|
|
20
|
+
|
|
21
|
+
const instruction = buildInstructionQuery({
|
|
22
|
+
instruction: inst,
|
|
23
|
+
utxos,
|
|
24
|
+
xOnlyPubKey,
|
|
25
|
+
address,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
instructions: [instruction],
|
|
30
|
+
sat_per_vbyte: params.satsPerVByte,
|
|
31
|
+
envelope: null,
|
|
32
|
+
};
|
|
33
|
+
}
|