@kontor/kontor-sdk 1.0.0-alpha.1 → 1.0.0-alpha.3
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/src/sdk/actions/kontor/wallet/sign-reveal.js +12 -14
- package/dist/src/sdk/actions/kontor/wallet/sign-reveal.js.map +1 -1
- package/dist/src/sdk/actions/public/test-mempool-accept.js +8 -32
- package/dist/src/sdk/actions/public/test-mempool-accept.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -2
- package/src/sdk/actions/kontor/wallet/sign-reveal.ts +12 -14
- package/src/sdk/actions/public/test-mempool-accept.ts +35 -31
- package/src/sdk/types/btc-rpc.ts +12 -11
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.3",
|
|
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
|
}
|
|
@@ -113,20 +113,18 @@ export async function signReveal<
|
|
|
113
113
|
|
|
114
114
|
// this is technically unnecessary as scure/btc-signer
|
|
115
115
|
// will product this witness by default
|
|
116
|
-
for (let i = 0; i < params.parcipantScripts.length; i++) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
}
|
|
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
|
+
// }
|
|
130
128
|
|
|
131
129
|
signedTx.finalize();
|
|
132
130
|
|
|
@@ -1,34 +1,38 @@
|
|
|
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 =
|
|
29
|
+
options.maxfeerate !== undefined ? [txs, options.maxfeerate] : [txs];
|
|
30
|
+
|
|
31
|
+
return client.request({
|
|
32
|
+
method: "testmempoolaccept",
|
|
33
|
+
params: params,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
32
36
|
|
|
33
37
|
// export async function testMempoolAccept(
|
|
34
38
|
// rawtx: string | string[],
|
package/src/sdk/types/btc-rpc.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type { Prettify } from "../../wit/type-utils.js";
|
|
2
2
|
|
|
3
|
-
// import type {
|
|
4
|
-
// TestMempoolAcceptParams,
|
|
5
|
-
// TestMempoolAcceptReturnType,
|
|
6
|
-
// } from "../actions/public/test-mempool-accept.js";
|
|
7
|
-
|
|
8
3
|
import type { RpcRequestFn, RpcSchema, RpcSchemaEntry } from "./rpc-schema.js";
|
|
9
4
|
|
|
10
5
|
export type SendRawTransactionParams = [
|
|
@@ -16,18 +11,24 @@ export interface SendRawTransactionReturnType {
|
|
|
16
11
|
txid: string;
|
|
17
12
|
}
|
|
18
13
|
|
|
14
|
+
export type TestMempoolAcceptParams = [
|
|
15
|
+
txs: string[],
|
|
16
|
+
maxFeeRate?: number | string,
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
export type TestMempoolAcceptReturnType = any;
|
|
20
|
+
|
|
19
21
|
export type BtcRpcSchema = readonly [
|
|
20
22
|
RpcSchemaEntry<
|
|
21
23
|
"sendrawtransaction",
|
|
22
24
|
SendRawTransactionParams,
|
|
23
25
|
SendRawTransactionReturnType
|
|
24
26
|
>,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// >,
|
|
27
|
+
RpcSchemaEntry<
|
|
28
|
+
"testmempoolaccept",
|
|
29
|
+
TestMempoolAcceptParams,
|
|
30
|
+
TestMempoolAcceptReturnType
|
|
31
|
+
>,
|
|
31
32
|
];
|
|
32
33
|
|
|
33
34
|
export type BtcNodeRequestFn<
|