@kontor/kontor-sdk 1.0.0-alpha.3 → 1.0.0-alpha.5

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.
Files changed (113) hide show
  1. package/dist/src/kwit/error.js +59 -0
  2. package/dist/src/kwit/error.js.map +1 -0
  3. package/dist/src/kwit/kwit-parser/core/errors/kwit-parameter.js +29 -0
  4. package/dist/src/kwit/kwit-parser/core/errors/kwit-parameter.js.map +1 -0
  5. package/dist/src/kwit/kwit-parser/core/errors/signature.js +42 -0
  6. package/dist/src/kwit/kwit-parser/core/errors/signature.js.map +1 -0
  7. package/dist/src/kwit/kwit-parser/core/errors/splitParameters.js +18 -0
  8. package/dist/src/kwit/kwit-parser/core/errors/splitParameters.js.map +1 -0
  9. package/dist/src/kwit/kwit-parser/core/records.js +73 -0
  10. package/dist/src/kwit/kwit-parser/core/records.js.map +1 -0
  11. package/dist/src/kwit/kwit-parser/core/records.test.js +53 -0
  12. package/dist/src/kwit/kwit-parser/core/records.test.js.map +1 -0
  13. package/dist/src/kwit/kwit-parser/core/signatures.js +33 -0
  14. package/dist/src/kwit/kwit-parser/core/signatures.js.map +1 -0
  15. package/dist/src/kwit/kwit-parser/core/signatures.test.js +54 -0
  16. package/dist/src/kwit/kwit-parser/core/signatures.test.js.map +1 -0
  17. package/dist/src/kwit/kwit-parser/core/types/records.js +2 -0
  18. package/dist/src/kwit/kwit-parser/core/types/records.js.map +1 -0
  19. package/dist/src/kwit/kwit-parser/core/types/records.test-d.js +19 -0
  20. package/dist/src/kwit/kwit-parser/core/types/records.test-d.js.map +1 -0
  21. package/dist/src/kwit/kwit-parser/core/types/signatures.js +3 -0
  22. package/dist/src/kwit/kwit-parser/core/types/signatures.js.map +1 -0
  23. package/dist/src/kwit/kwit-parser/core/types/signatures.test-d.js +18 -0
  24. package/dist/src/kwit/kwit-parser/core/types/signatures.test-d.js.map +1 -0
  25. package/dist/src/kwit/kwit-parser/core/types/utils.js +2 -0
  26. package/dist/src/kwit/kwit-parser/core/types/utils.js.map +1 -0
  27. package/dist/src/kwit/kwit-parser/core/types/utils.test-d.js +159 -0
  28. package/dist/src/kwit/kwit-parser/core/types/utils.test-d.js.map +1 -0
  29. package/dist/src/kwit/kwit-parser/core/utils.js +212 -0
  30. package/dist/src/kwit/kwit-parser/core/utils.js.map +1 -0
  31. package/dist/src/kwit/kwit-parser/core/utils.test.js +302 -0
  32. package/dist/src/kwit/kwit-parser/core/utils.test.js.map +1 -0
  33. package/dist/src/kwit/kwit-parser/parse-kwit-parameter.js +26 -0
  34. package/dist/src/kwit/kwit-parser/parse-kwit-parameter.js.map +1 -0
  35. package/dist/src/kwit/kwit-parser/parse-kwit-parameter.test.js +83 -0
  36. package/dist/src/kwit/kwit-parser/parse-kwit-parameter.test.js.map +1 -0
  37. package/dist/src/kwit/kwit-parser/parse-kwit.js +16 -0
  38. package/dist/src/kwit/kwit-parser/parse-kwit.js.map +1 -0
  39. package/dist/src/kwit/kwit-parser/parse-kwit.test.js +78 -0
  40. package/dist/src/kwit/kwit-parser/parse-kwit.test.js.map +1 -0
  41. package/dist/src/kwit/kwit.js +2 -0
  42. package/dist/src/kwit/kwit.js.map +1 -0
  43. package/dist/src/kwit/kwit.test.js +9 -0
  44. package/dist/src/kwit/kwit.test.js.map +1 -0
  45. package/dist/src/kwit/narrow.js +14 -0
  46. package/dist/src/kwit/narrow.js.map +1 -0
  47. package/dist/src/kwit/regex.js +6 -0
  48. package/dist/src/kwit/regex.js.map +1 -0
  49. package/dist/src/kwit/register.js +2 -0
  50. package/dist/src/kwit/register.js.map +1 -0
  51. package/dist/src/kwit/type-utils.js +2 -0
  52. package/dist/src/kwit/type-utils.js.map +1 -0
  53. package/dist/src/kwit/utils.js +2 -0
  54. package/dist/src/kwit/utils.js.map +1 -0
  55. package/dist/src/kwit/utils.test-d.js +17 -0
  56. package/dist/src/kwit/utils.test-d.js.map +1 -0
  57. package/dist/src/kwit/version.js +2 -0
  58. package/dist/src/kwit/version.js.map +1 -0
  59. package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js +19 -30
  60. package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
  61. package/dist/src/sdk/actions/public/test-mempool-accept.js +1 -1
  62. package/dist/src/sdk/actions/public/test-mempool-accept.js.map +1 -1
  63. package/dist/src/sdk/clients/decorators/public.js +2 -0
  64. package/dist/src/sdk/clients/decorators/public.js.map +1 -1
  65. package/dist/src/sdk/errors/kwit.js +19 -0
  66. package/dist/src/sdk/errors/kwit.js.map +1 -0
  67. package/dist/src/sdk/test/e2e.test.js +174 -14
  68. package/dist/src/sdk/test/e2e.test.js.map +1 -1
  69. package/dist/src/sdk/utils/kwit/codecs/decimal.js +165 -0
  70. package/dist/src/sdk/utils/kwit/codecs/decimal.js.map +1 -0
  71. package/dist/src/sdk/utils/kwit/codecs/enum.js +104 -0
  72. package/dist/src/sdk/utils/kwit/codecs/enum.js.map +1 -0
  73. package/dist/src/sdk/utils/kwit/codecs/integer.js +167 -0
  74. package/dist/src/sdk/utils/kwit/codecs/integer.js.map +1 -0
  75. package/dist/src/sdk/utils/kwit/codecs/list.js +117 -0
  76. package/dist/src/sdk/utils/kwit/codecs/list.js.map +1 -0
  77. package/dist/src/sdk/utils/kwit/codecs/option.js +91 -0
  78. package/dist/src/sdk/utils/kwit/codecs/option.js.map +1 -0
  79. package/dist/src/sdk/utils/kwit/codecs/string.js +27 -0
  80. package/dist/src/sdk/utils/kwit/codecs/string.js.map +1 -0
  81. package/dist/src/sdk/utils/kwit/codecs/types.js +45 -0
  82. package/dist/src/sdk/utils/kwit/codecs/types.js.map +1 -0
  83. package/dist/src/sdk/utils/kwit/codecs/unit.js +22 -0
  84. package/dist/src/sdk/utils/kwit/codecs/unit.js.map +1 -0
  85. package/dist/src/sdk/utils/kwit/decode-function-result.js +36 -0
  86. package/dist/src/sdk/utils/kwit/decode-function-result.js.map +1 -0
  87. package/dist/src/sdk/utils/kwit/decode-kwit-parameter.js +286 -0
  88. package/dist/src/sdk/utils/kwit/decode-kwit-parameter.js.map +1 -0
  89. package/dist/src/sdk/utils/kwit/decode-kwit-parameter.test.js +75 -0
  90. package/dist/src/sdk/utils/kwit/decode-kwit-parameter.test.js.map +1 -0
  91. package/dist/src/sdk/utils/kwit/encode-function-data.js +17 -0
  92. package/dist/src/sdk/utils/kwit/encode-function-data.js.map +1 -0
  93. package/dist/src/sdk/utils/kwit/encode-function-data.test-d.js +21 -0
  94. package/dist/src/sdk/utils/kwit/encode-function-data.test-d.js.map +1 -0
  95. package/dist/src/sdk/utils/kwit/encode-function-data.test.js +91 -0
  96. package/dist/src/sdk/utils/kwit/encode-function-data.test.js.map +1 -0
  97. package/dist/src/sdk/utils/kwit/encode-kwit-parameters.js +250 -0
  98. package/dist/src/sdk/utils/kwit/encode-kwit-parameters.js.map +1 -0
  99. package/dist/src/sdk/utils/kwit/encode-kwit-parameters.test.js +62 -0
  100. package/dist/src/sdk/utils/kwit/encode-kwit-parameters.test.js.map +1 -0
  101. package/dist/src/sdk/utils/kwit/get-kwit-item.js +186 -0
  102. package/dist/src/sdk/utils/kwit/get-kwit-item.js.map +1 -0
  103. package/dist/src/sdk/utils/kwit/get-kwit-item.test.js +119 -0
  104. package/dist/src/sdk/utils/kwit/get-kwit-item.test.js.map +1 -0
  105. package/dist/src/sdk/utils/kwit/prepare-encode-function-data.js +24 -0
  106. package/dist/src/sdk/utils/kwit/prepare-encode-function-data.js.map +1 -0
  107. package/dist/tsconfig.tsbuildinfo +1 -1
  108. package/package.json +1 -1
  109. package/src/sdk/actions/kontor/wallet/sign-reveal.ts +27 -34
  110. package/src/sdk/actions/public/test-mempool-accept.ts +2 -3
  111. package/src/sdk/clients/decorators/public.ts +11 -0
  112. package/src/sdk/test/e2e.test.ts +193 -15
  113. package/src/sdk/types/btc-rpc.ts +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontor/kontor-sdk",
3
- "version": "1.0.0-alpha.3",
3
+ "version": "1.0.0-alpha.5",
4
4
  "author": "Unspendable Labs <dev@unspendablelabs.com>",
5
5
  "description": "The official SDK to the Kontor Bitcoin metaprotocol",
6
6
  "repository": {
@@ -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 { p2tr, taprootListToTree, Transaction } from "@scure/btc-signer";
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,21 @@ 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 tree = taprootListToTree([
55
- {
56
- // TODO: fix this type error
57
- // @ts-ignore
58
- script: hex.decode(commit_tap_leaf_script.script),
59
- leafVersion: commit_tap_leaf_script.leafVersion,
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
+ const scriptWithVersion = u.concatBytes(
63
+ scriptBytes,
64
+ new Uint8Array([leafVersion]),
70
65
  );
71
66
 
67
+ const controlBlockStruct = TaprootControlBlock.decode(controlBlockBytes);
68
+
72
69
  tx.updateInput(
73
70
  i,
74
71
  {
75
- tapLeafScript: payment.tapLeafScript!,
76
- tapInternalKey: payment.tapInternalKey,
77
- tapMerkleRoot: payment.tapMerkleRoot,
72
+ tapLeafScript: [[controlBlockStruct, scriptWithVersion]],
78
73
  },
79
74
  true,
80
75
  );
@@ -113,20 +108,18 @@ export async function signReveal<
113
108
 
114
109
  // this is technically unnecessary as scure/btc-signer
115
110
  // will product this witness by default
116
- // for (let i = 0; i < params.parcipantScripts.length; i++) {
117
- // const input = signedTx.getInput(i);
118
- // const p = params.parcipantScripts[i]!;
119
- // console.log({ input, tapscriptsig: input.tapScriptSig });
120
- // signedTx.updateInput(i, {
121
- // finalScriptWitness: [
122
- // input.tapScriptSig![0]![1],
123
- // hex.decode(p.commit_tap_leaf_script.script),
124
- // hex.decode(p.commit_tap_leaf_script.controlBlock),
125
- // ],
126
- // });
127
- // }
128
-
129
- signedTx.finalize();
111
+ for (let i = 0; i < params.parcipantScripts.length; i++) {
112
+ const input = signedTx.getInput(i);
113
+ const p = params.parcipantScripts[i]!;
114
+ console.log({ input, tapscriptsig: input.tapScriptSig });
115
+ signedTx.updateInput(i, {
116
+ finalScriptWitness: [
117
+ input.tapScriptSig![0]![1],
118
+ hex.decode(p.commit_tap_leaf_script.script),
119
+ hex.decode(p.commit_tap_leaf_script.controlBlock),
120
+ ],
121
+ });
122
+ }
130
123
 
131
124
  return signedTx;
132
125
  }
@@ -25,12 +25,11 @@ export async function testMempoolAccept<
25
25
  ): Promise<TestMempoolAcceptReturnType> {
26
26
  const txs = Array.isArray(rawtx) ? rawtx : [rawtx];
27
27
 
28
- const params =
29
- options.maxfeerate !== undefined ? [txs, options.maxfeerate] : [txs];
28
+ const params = options.maxfeerate !== undefined ? [txs, options] : [txs];
30
29
 
31
30
  return client.request({
32
31
  method: "testmempoolaccept",
33
- params: params,
32
+ params: params as any,
34
33
  });
35
34
  }
36
35
 
@@ -8,6 +8,13 @@ import {
8
8
  type SendRawTransactionReturnType,
9
9
  sendRawTransaction,
10
10
  } from "../../actions/public/send-raw-transaction.js";
11
+
12
+ import {
13
+ type TestMempoolAcceptParams,
14
+ type TestMempoolAcceptReturnType,
15
+ testMempoolAccept,
16
+ } from "../../actions/public/test-mempool-accept.js";
17
+
11
18
  import type { PublicClient as PublicClient } from "../create-public-client.js";
12
19
 
13
20
  export type PublicActions<
@@ -20,6 +27,9 @@ export type PublicActions<
20
27
  sendRawTransaction: (
21
28
  parameters: SendRawTransactionParams,
22
29
  ) => Promise<SendRawTransactionReturnType>;
30
+ testMempoolAccept: (
31
+ parameters: TestMempoolAcceptParams,
32
+ ) => Promise<TestMempoolAcceptReturnType>;
23
33
  };
24
34
 
25
35
  export function publicActions<
@@ -31,5 +41,6 @@ export function publicActions<
31
41
  ): PublicActions<chain, account> {
32
42
  return {
33
43
  sendRawTransaction: (args) => sendRawTransaction(client, args),
44
+ testMempoolAccept: (args) => testMempoolAccept(client, args),
34
45
  };
35
46
  }
@@ -5,6 +5,7 @@ import { createPublicClient as createKontorPublicClient } from "../clients/konto
5
5
  import { http } from "../clients/transports/http.js";
6
6
  import { mnemonicToAccount } from "../accounts/mnemonic-to-account.js";
7
7
  import { createWalletClient as createKontorWalletClient } from "../clients/kontor/create-wallet-client.js";
8
+
8
9
  import { custom } from "../clients/transports/custom.js";
9
10
  import { Transaction } from "@scure/btc-signer";
10
11
  import { hex } from "@scure/base";
@@ -32,12 +33,168 @@ export const nativeTokenRaw = [
32
33
 
33
34
  export const wit = parseWit(nativeTokenRaw);
34
35
 
36
+ // test("e2e kontor wallet client", async () => {
37
+ // const account = mnemonicToAccount(process.env.TEST_MNEMONIC!);
38
+ //
39
+ // const kontorPublicClient = createKontorPublicClient({
40
+ // transport: http("https://signet-staging.kontor.network:35000/api"),
41
+ // account,
42
+ // chain: signet,
43
+ // });
44
+ //
45
+ // const kontorWalletClient = createKontorWalletClient({
46
+ // account,
47
+ // // TODO: transport is not used for local account.
48
+ // transport: custom({
49
+ // request: async (_args: any) => null,
50
+ // }),
51
+ // });
52
+ //
53
+ // const res = await kontorPublicClient.procContract({
54
+ // wit: wit,
55
+ // // TODO: add optional account override
56
+ //
57
+ // functionName: "mint", // functin name is only valid if it's got a proc-context
58
+ // contractAddress: "token_0_0",
59
+ // args: [[7n, 18]],
60
+ // satsPerVByte: 1,
61
+ // utxos: [
62
+ // "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
63
+ // ],
64
+ // gas: 10n,
65
+ // });
66
+ //
67
+ // const commit: Transaction = await kontorWalletClient.signCommit({
68
+ // account: account,
69
+ // chain: signet,
70
+ // psbt: res.result.commit_psbt_hex,
71
+ // });
72
+ //
73
+ // const reveal: Transaction = await kontorWalletClient.signReveal({
74
+ // account: account,
75
+ // chain: signet,
76
+ // psbt: res.result.reveal_psbt_hex,
77
+ // parcipantScripts: res.result.per_participant,
78
+ // });
79
+ //
80
+ // const commitExtracted = commit.extract();
81
+ // const revealExtracted = reveal.extract();
82
+ //
83
+ // // const m = await btcPublicClient.testMempoolAccept({
84
+ // // rawtx: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
85
+ // // options: {},
86
+ // // });
87
+ // //
88
+ //
89
+ // const r = await fetch("https://signet.kontor.network:38332", {
90
+ // method: "POST",
91
+ // headers: {
92
+ // "Content-Type": "application/json",
93
+ // Authorization: `Basic ${Buffer.from("rpc:rpc").toString("base64")}`,
94
+ // },
95
+ // body: JSON.stringify({
96
+ // method: "testmempoolaccept",
97
+ // params: [[hex.encode(commitExtracted), hex.encode(revealExtracted)]],
98
+ // }),
99
+ // });
100
+ // console.log({
101
+ // r,
102
+ // reveal: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
103
+ // });
104
+ //
105
+ // const j = await r.json();
106
+ //
107
+ // console.log(j);
108
+ // //
109
+ // // const op = await kontorPublicClient.inspect({
110
+ // // hex: hex.encode(revealExtracted),
111
+ // // });
112
+ //
113
+ // // console.log(JSON.stringify(op.result[0]!.op));
114
+ // //
115
+ // });
116
+
35
117
  test("e2e kontor wallet client", async () => {
36
118
  const account = mnemonicToAccount(process.env.TEST_MNEMONIC!);
37
119
 
120
+ const res = {
121
+ result: {
122
+ commit_transaction: {
123
+ version: 2,
124
+ lock_time: 0,
125
+ input: [
126
+ {
127
+ previous_output:
128
+ "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
129
+ script_sig: "",
130
+ sequence: 4294967295,
131
+ witness: [],
132
+ },
133
+ ],
134
+ output: [
135
+ {
136
+ value: 570,
137
+ script_pubkey:
138
+ "51207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f",
139
+ },
140
+ {
141
+ value: 8502,
142
+ script_pubkey:
143
+ "5120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f",
144
+ },
145
+ ],
146
+ },
147
+ commit_transaction_hex:
148
+ "0200000001332a0e2d0c369ebb984ce8addb4387bd6702f59b255ceada1c0fcff4ed401c640100000000ffffffff023a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f3621000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f00000000",
149
+ commit_psbt_hex:
150
+ "70736274ff0100890200000001332a0e2d0c369ebb984ce8addb4387bd6702f59b255ceada1c0fcff4ed401c640100000000ffffffff023a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f3621000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f000000000001012b8e24000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f0117202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f000000",
151
+ reveal_transaction: {
152
+ version: 2,
153
+ lock_time: 0,
154
+ input: [
155
+ {
156
+ previous_output:
157
+ "4b195fabb3bd5360de2e2db6821df9d8909f0dbd5f1ba50ae1ca71a841080c3d:0",
158
+ script_sig: "",
159
+ sequence: 4294967295,
160
+ witness: [],
161
+ },
162
+ ],
163
+ output: [
164
+ {
165
+ value: 330,
166
+ script_pubkey:
167
+ "5120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f",
168
+ },
169
+ ],
170
+ },
171
+ reveal_transaction_hex:
172
+ "02000000013d0c0841a871cae10aa51b5fbd0d9f90d8f91d82b62d2ede6053bdb3ab5f194b0000000000ffffffff014a01000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f00000000",
173
+ reveal_psbt_hex:
174
+ "70736274ff01005e02000000013d0c0841a871cae10aa51b5fbd0d9f90d8f91d82b62d2ede6053bdb3ab5f194b0000000000ffffffff014a01000000000000225120929c39410fb437b4ff387ec898cbc098365d91965073004fc43e013d410d417f000000000001012b3a020000000000002251207fe892a65813b770346d37f8fbbdf5c1e6bee0bc34b0c625e8f4ca5ff3ad144f0117202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f0000",
175
+ per_participant: [
176
+ {
177
+ address:
178
+ "tb1pj2wrjsg0ksmmflec0myf3j7qnqm9myvk2pesqn7y8cqn6sgdg9ls9u6tar",
179
+ x_only_public_key:
180
+ "2c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
181
+ commit_tap_leaf_script: {
182
+ leafVersion: 192,
183
+ script:
184
+ "202c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51fac0063036b6f6e00010268",
185
+ controlBlock:
186
+ "c12c7b730daa0036e8276cdd8fabe844b2dd324a6d227dd209663805189d03e51f",
187
+ },
188
+ chained_tap_leaf_script: null,
189
+ },
190
+ ],
191
+ },
192
+ };
193
+
38
194
  const kontorPublicClient = createKontorPublicClient({
39
195
  transport: http("https://signet-staging.kontor.network:35000/api"),
40
196
  account,
197
+ chain: signet,
41
198
  });
42
199
 
43
200
  const kontorWalletClient = createKontorWalletClient({
@@ -48,22 +205,21 @@ test("e2e kontor wallet client", async () => {
48
205
  }),
49
206
  });
50
207
 
51
- const res = await kontorPublicClient.procContract({
52
- wit: wit,
53
- // TODO: add optional account override
54
-
55
- functionName: "mint", // functin name is only valid if it's got a proc-context
56
- contractAddress: "token_0_0",
57
- args: [[7n, 18]],
58
- satsPerVByte: 1,
59
- utxos: [
60
- "57f1f46857ab12e20f32ecaac780b4096b0951458e15ab08e2ce0992f0521323:0",
61
- ],
62
- gas: 10n,
63
- });
208
+ // const res = await kontorPublicClient.procContract({
209
+ // wit: wit,
210
+ // // TODO: add optional account override
211
+ //
212
+ // functionName: "mint", // functin name is only valid if it's got a proc-context
213
+ // contractAddress: "token_0_0",
214
+ // args: [[7n, 18]],
215
+ // satsPerVByte: 1,
216
+ // utxos: [
217
+ // "641c40edf4cf0f1cdaea5c259bf50267bd8743dbade84c98bb9e360c2d0e2a33:1",
218
+ // ],
219
+ // gas: 10n,
220
+ // });
64
221
 
65
- // @ts-ignore
66
- const commit_: Transaction = await kontorWalletClient.signCommit({
222
+ const commit: Transaction = await kontorWalletClient.signCommit({
67
223
  account: account,
68
224
  chain: signet,
69
225
  psbt: res.result.commit_psbt_hex,
@@ -76,8 +232,30 @@ test("e2e kontor wallet client", async () => {
76
232
  parcipantScripts: res.result.per_participant,
77
233
  });
78
234
 
235
+ const commitExtracted = commit.extract();
79
236
  const revealExtracted = reveal.extract();
80
237
 
238
+ // const m = await btcPublicClient.testMempoolAccept({
239
+ // rawtx: [hex.encode(commitExtracted), hex.encode(revealExtracted)],
240
+ // options: {},
241
+ // });
242
+
243
+ const r = await fetch("https://signet.kontor.network:38332", {
244
+ method: "POST",
245
+ headers: {
246
+ "Content-Type": "application/json",
247
+ Authorization: `Basic ${Buffer.from("rpc:rpc").toString("base64")}`,
248
+ },
249
+ body: JSON.stringify({
250
+ method: "testmempoolaccept",
251
+ params: [[hex.encode(commitExtracted), hex.encode(revealExtracted)]],
252
+ }),
253
+ });
254
+
255
+ const mempoolAccept = await r.json();
256
+
257
+ console.log({ mempoolAccept: mempoolAccept.result });
258
+ //
81
259
  const op = await kontorPublicClient.inspect({
82
260
  hex: hex.encode(revealExtracted),
83
261
  });
@@ -13,7 +13,7 @@ export interface SendRawTransactionReturnType {
13
13
 
14
14
  export type TestMempoolAcceptParams = [
15
15
  txs: string[],
16
- maxFeeRate?: number | string,
16
+ opts?: { maxFeeRate: number | string },
17
17
  ];
18
18
 
19
19
  export type TestMempoolAcceptReturnType = any;