@buildonspark/spark-sdk 0.2.2 → 0.2.4
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/CHANGELOG.md +15 -0
- package/dist/{chunk-TM6CHQXC.js → chunk-3SEOTO43.js} +1 -1
- package/dist/{chunk-2ENZX6LT.js → chunk-AAZWSPUK.js} +84 -8
- package/dist/{chunk-4JD4HIAN.js → chunk-G4MSZ6DE.js} +299 -1
- package/dist/{chunk-S2AL73MZ.js → chunk-TVUMSHWA.js} +1 -1
- package/dist/{chunk-2TUM3R6C.js → chunk-W4ZRBSWM.js} +2351 -797
- package/dist/{chunk-CDLETEDT.js → chunk-WAQKYSDI.js} +13 -1
- package/dist/{client-CGTRS23n.d.ts → client-BF4cn8F4.d.ts} +15 -3
- package/dist/{client-CcYzmpmj.d.cts → client-KhNkrXz4.d.cts} +15 -3
- package/dist/debug.cjs +2948 -1023
- package/dist/debug.d.cts +19 -6
- package/dist/debug.d.ts +19 -6
- package/dist/debug.js +5 -5
- package/dist/graphql/objects/index.cjs +13 -1
- package/dist/graphql/objects/index.d.cts +2 -2
- package/dist/graphql/objects/index.d.ts +2 -2
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +2794 -858
- package/dist/index.d.cts +190 -9
- package/dist/index.d.ts +190 -9
- package/dist/index.js +32 -6
- package/dist/index.node.cjs +2931 -892
- package/dist/index.node.d.cts +10 -188
- package/dist/index.node.d.ts +10 -188
- package/dist/index.node.js +134 -6
- package/dist/native/index.cjs +2794 -858
- package/dist/native/index.d.cts +148 -40
- package/dist/native/index.d.ts +148 -40
- package/dist/native/index.js +2799 -877
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +1 -1
- package/dist/proto/spark.cjs +84 -8
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +1 -1
- package/dist/proto/spark_token.cjs +301 -0
- package/dist/proto/spark_token.d.cts +35 -2
- package/dist/proto/spark_token.d.ts +35 -2
- package/dist/proto/spark_token.js +8 -2
- package/dist/{sdk-types-DJ2ve9YY.d.cts → sdk-types-CB9HrW5O.d.cts} +1 -1
- package/dist/{sdk-types-DCIVdKUT.d.ts → sdk-types-CkRNraXT.d.ts} +1 -1
- package/dist/{spark-BUOx3U7Q.d.cts → spark-B_7nZx6T.d.cts} +112 -10
- package/dist/{spark-BUOx3U7Q.d.ts → spark-B_7nZx6T.d.ts} +112 -10
- package/dist/{spark-wallet-B_96y9BS.d.ts → spark-wallet-C1Tr_VKI.d.ts} +38 -28
- package/dist/{spark-wallet-CHwKQYJu.d.cts → spark-wallet-DG3x2obf.d.cts} +38 -28
- package/dist/spark-wallet.node-CGxoeCpH.d.ts +13 -0
- package/dist/spark-wallet.node-CN9LoB_O.d.cts +13 -0
- package/dist/tests/test-utils.cjs +1086 -218
- package/dist/tests/test-utils.d.cts +13 -13
- package/dist/tests/test-utils.d.ts +13 -13
- package/dist/tests/test-utils.js +56 -19
- package/dist/types/index.cjs +97 -9
- package/dist/types/index.d.cts +3 -3
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.js +3 -3
- package/dist/{xchain-address-D5MIHCDL.d.cts → xchain-address-BHu6CpZC.d.ts} +55 -8
- package/dist/{xchain-address-DLbW1iDh.d.ts → xchain-address-HBr6isnc.d.cts} +55 -8
- package/package.json +1 -1
- package/src/graphql/client.ts +8 -0
- package/src/graphql/mutations/CompleteLeavesSwap.ts +9 -1
- package/src/graphql/mutations/RequestSwapLeaves.ts +4 -0
- package/src/graphql/objects/CompleteLeavesSwapInput.ts +34 -34
- package/src/graphql/objects/LeavesSwapRequest.ts +4 -0
- package/src/graphql/objects/RequestLeavesSwapInput.ts +48 -47
- package/src/graphql/objects/SwapLeaf.ts +40 -32
- package/src/graphql/objects/UserLeafInput.ts +24 -0
- package/src/graphql/objects/UserRequest.ts +4 -0
- package/src/index.node.ts +1 -1
- package/src/native/index.ts +4 -5
- package/src/proto/spark.ts +172 -16
- package/src/proto/spark_token.ts +369 -0
- package/src/services/coop-exit.ts +171 -36
- package/src/services/deposit.ts +471 -74
- package/src/services/lightning.ts +18 -5
- package/src/services/signing.ts +162 -50
- package/src/services/token-transactions.ts +6 -2
- package/src/services/transfer.ts +950 -384
- package/src/services/tree-creation.ts +342 -121
- package/src/spark-wallet/spark-wallet.node.ts +71 -66
- package/src/spark-wallet/spark-wallet.ts +459 -166
- package/src/tests/integration/coop-exit.test.ts +3 -8
- package/src/tests/integration/deposit.test.ts +3 -3
- package/src/tests/integration/lightning.test.ts +521 -466
- package/src/tests/integration/swap.test.ts +559 -307
- package/src/tests/integration/transfer.test.ts +625 -623
- package/src/tests/integration/wallet.test.ts +2 -2
- package/src/tests/integration/watchtower.test.ts +211 -0
- package/src/tests/test-utils.ts +63 -14
- package/src/tests/utils/test-faucet.ts +4 -2
- package/src/utils/adaptor-signature.ts +15 -5
- package/src/utils/fetch.ts +75 -0
- package/src/utils/mempool.ts +9 -4
- package/src/utils/transaction.ts +388 -26
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.cjs';
|
|
2
|
+
import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-DG3x2obf.cjs';
|
|
3
|
+
import { S as SparkSigner, D as DefaultSparkSigner } from '../client-KhNkrXz4.cjs';
|
|
4
|
+
import { S as SparkWallet } from '../spark-wallet.node-CN9LoB_O.cjs';
|
|
4
5
|
import { Transaction } from '@scure/btc-signer';
|
|
5
6
|
import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
|
|
6
7
|
import '@bufbuild/protobuf/wire';
|
|
@@ -11,19 +12,11 @@ import 'nice-grpc';
|
|
|
11
12
|
import 'nice-grpc-web';
|
|
12
13
|
import '../proto/spark_token.cjs';
|
|
13
14
|
import 'eventemitter3';
|
|
14
|
-
import '../sdk-types-
|
|
15
|
+
import '../sdk-types-CB9HrW5O.cjs';
|
|
15
16
|
import '@lightsparkdev/core';
|
|
16
17
|
import '@scure/bip32';
|
|
17
18
|
import '../types-BADxR3bm.cjs';
|
|
18
19
|
|
|
19
|
-
declare class SparkWallet extends SparkWallet$1 {
|
|
20
|
-
private tracer;
|
|
21
|
-
protected wrapWithOtelSpan<T>(name: string, fn: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
|
|
22
|
-
protected initializeTracer(tracerName: string): Promise<void>;
|
|
23
|
-
private wrapSparkWalletWithTracing;
|
|
24
|
-
protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
interface ISparkWalletTesting extends SparkWallet {
|
|
28
21
|
getSigner(): SparkSigner;
|
|
29
22
|
queryPendingTransfers(): Promise<QueryTransfersResponse>;
|
|
@@ -75,9 +68,16 @@ declare class BitcoinFaucet {
|
|
|
75
68
|
declare function getTestWalletConfig(): ConfigOptions;
|
|
76
69
|
declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
|
|
77
70
|
declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
|
|
71
|
+
declare function createNewTreeWithoutDirectTx(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
|
|
78
72
|
declare const signerTypes: {
|
|
79
73
|
name: string;
|
|
80
74
|
Signer: typeof DefaultSparkSigner;
|
|
75
|
+
createTree: typeof createNewTree;
|
|
76
|
+
}[];
|
|
77
|
+
declare const walletTypes: {
|
|
78
|
+
name: string;
|
|
79
|
+
Signer: typeof DefaultSparkSigner;
|
|
80
|
+
createTree: typeof createNewTree;
|
|
81
81
|
}[];
|
|
82
82
|
|
|
83
|
-
export { BitcoinFaucet, createNewTree, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes };
|
|
83
|
+
export { BitcoinFaucet, createNewTree, createNewTreeWithoutDirectTx, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes, walletTypes };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Q as QueryTransfersResponse, f as Transfer, d as TreeNode } from '../spark-B_7nZx6T.js';
|
|
2
|
+
import { b as ConfigOptions, w as SparkWalletProps } from '../spark-wallet-C1Tr_VKI.js';
|
|
3
|
+
import { S as SparkSigner, D as DefaultSparkSigner } from '../client-BF4cn8F4.js';
|
|
4
|
+
import { S as SparkWallet } from '../spark-wallet.node-CGxoeCpH.js';
|
|
4
5
|
import { Transaction } from '@scure/btc-signer';
|
|
5
6
|
import { TransactionInput, TransactionOutput } from '@scure/btc-signer/psbt';
|
|
6
7
|
import '@bufbuild/protobuf/wire';
|
|
@@ -11,19 +12,11 @@ import 'nice-grpc';
|
|
|
11
12
|
import 'nice-grpc-web';
|
|
12
13
|
import '../proto/spark_token.js';
|
|
13
14
|
import 'eventemitter3';
|
|
14
|
-
import '../sdk-types-
|
|
15
|
+
import '../sdk-types-CkRNraXT.js';
|
|
15
16
|
import '@lightsparkdev/core';
|
|
16
17
|
import '@scure/bip32';
|
|
17
18
|
import '../types-BADxR3bm.js';
|
|
18
19
|
|
|
19
|
-
declare class SparkWallet extends SparkWallet$1 {
|
|
20
|
-
private tracer;
|
|
21
|
-
protected wrapWithOtelSpan<T>(name: string, fn: (...args: any[]) => Promise<T>): (...args: any[]) => Promise<T>;
|
|
22
|
-
protected initializeTracer(tracerName: string): Promise<void>;
|
|
23
|
-
private wrapSparkWalletWithTracing;
|
|
24
|
-
protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
20
|
interface ISparkWalletTesting extends SparkWallet {
|
|
28
21
|
getSigner(): SparkSigner;
|
|
29
22
|
queryPendingTransfers(): Promise<QueryTransfersResponse>;
|
|
@@ -75,9 +68,16 @@ declare class BitcoinFaucet {
|
|
|
75
68
|
declare function getTestWalletConfig(): ConfigOptions;
|
|
76
69
|
declare function getTestWalletConfigWithIdentityKey(identityPrivateKey: Uint8Array): ConfigOptions;
|
|
77
70
|
declare function createNewTree(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
|
|
71
|
+
declare function createNewTreeWithoutDirectTx(wallet: SparkWalletTesting, leafId: string, faucet: BitcoinFaucet, amountSats?: bigint): Promise<TreeNode>;
|
|
78
72
|
declare const signerTypes: {
|
|
79
73
|
name: string;
|
|
80
74
|
Signer: typeof DefaultSparkSigner;
|
|
75
|
+
createTree: typeof createNewTree;
|
|
76
|
+
}[];
|
|
77
|
+
declare const walletTypes: {
|
|
78
|
+
name: string;
|
|
79
|
+
Signer: typeof DefaultSparkSigner;
|
|
80
|
+
createTree: typeof createNewTree;
|
|
81
81
|
}[];
|
|
82
82
|
|
|
83
|
-
export { BitcoinFaucet, createNewTree, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes };
|
|
83
|
+
export { BitcoinFaucet, createNewTree, createNewTreeWithoutDirectTx, getTestWalletConfig, getTestWalletConfigWithIdentityKey, signerTypes, walletTypes };
|
package/dist/tests/test-utils.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-TVUMSHWA.js";
|
|
2
2
|
import "../chunk-BYXBJQAS.js";
|
|
3
3
|
import {
|
|
4
4
|
BitcoinFaucet,
|
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
WalletConfigService,
|
|
12
12
|
getNetwork,
|
|
13
13
|
getP2TRAddressFromPublicKey
|
|
14
|
-
} from "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
14
|
+
} from "../chunk-W4ZRBSWM.js";
|
|
15
|
+
import "../chunk-G4MSZ6DE.js";
|
|
16
|
+
import "../chunk-3SEOTO43.js";
|
|
17
|
+
import "../chunk-WAQKYSDI.js";
|
|
18
|
+
import "../chunk-AAZWSPUK.js";
|
|
19
19
|
import "../chunk-MVRQ5US7.js";
|
|
20
20
|
|
|
21
21
|
// src/tests/test-utils.ts
|
|
@@ -31,7 +31,7 @@ function getTestWalletConfigWithIdentityKey(identityPrivateKey) {
|
|
|
31
31
|
identityPrivateKey
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
async function
|
|
34
|
+
async function createDeposit(wallet, leafId, faucet, amountSats = 100000n, includeDirectTx = true) {
|
|
35
35
|
const faucetCoin = await faucet.fund();
|
|
36
36
|
const configService = new WalletConfigService(
|
|
37
37
|
{
|
|
@@ -62,15 +62,28 @@ async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
|
|
|
62
62
|
);
|
|
63
63
|
const script = OutScript.encode(addr);
|
|
64
64
|
depositTx.addOutput({ script, amount: amountSats });
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
let treeResp;
|
|
66
|
+
if (includeDirectTx) {
|
|
67
|
+
treeResp = await depositService.createTreeRoot({
|
|
68
|
+
keyDerivation: {
|
|
69
|
+
type: "leaf" /* LEAF */,
|
|
70
|
+
path: leafId
|
|
71
|
+
},
|
|
72
|
+
verifyingKey: depositResp.depositAddress.verifyingKey,
|
|
73
|
+
depositTx,
|
|
74
|
+
vout: 0
|
|
75
|
+
});
|
|
76
|
+
} else {
|
|
77
|
+
treeResp = await depositService.createTreeWithoutDirectTx({
|
|
78
|
+
keyDerivation: {
|
|
79
|
+
type: "leaf" /* LEAF */,
|
|
80
|
+
path: leafId
|
|
81
|
+
},
|
|
82
|
+
verifyingKey: depositResp.depositAddress.verifyingKey,
|
|
83
|
+
depositTx,
|
|
84
|
+
vout: 0
|
|
85
|
+
});
|
|
86
|
+
}
|
|
74
87
|
const signedDepositTx = await faucet.signFaucetCoin(
|
|
75
88
|
depositTx,
|
|
76
89
|
faucetCoin.txout,
|
|
@@ -87,14 +100,38 @@ async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
|
|
|
87
100
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
88
101
|
return treeResp.nodes[0];
|
|
89
102
|
}
|
|
103
|
+
async function createNewTree(wallet, leafId, faucet, amountSats = 100000n) {
|
|
104
|
+
return await createDeposit(wallet, leafId, faucet, amountSats, true);
|
|
105
|
+
}
|
|
106
|
+
async function createNewTreeWithoutDirectTx(wallet, leafId, faucet, amountSats = 100000n) {
|
|
107
|
+
return await createDeposit(wallet, leafId, faucet, amountSats, false);
|
|
108
|
+
}
|
|
90
109
|
var signerTypes = [
|
|
91
|
-
{
|
|
92
|
-
|
|
110
|
+
{
|
|
111
|
+
name: "DefaultSparkSigner",
|
|
112
|
+
Signer: DefaultSparkSigner,
|
|
113
|
+
createTree: createNewTree
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "UnsafeStatelessSparkSigner",
|
|
117
|
+
Signer: UnsafeStatelessSparkSigner,
|
|
118
|
+
createTree: createNewTree
|
|
119
|
+
}
|
|
120
|
+
];
|
|
121
|
+
var walletTypes = [
|
|
122
|
+
...signerTypes,
|
|
123
|
+
{
|
|
124
|
+
name: "DefaultSparkSignerWithoutDirectTx",
|
|
125
|
+
Signer: UnsafeStatelessSparkSigner,
|
|
126
|
+
createTree: createNewTreeWithoutDirectTx
|
|
127
|
+
}
|
|
93
128
|
];
|
|
94
129
|
export {
|
|
95
130
|
BitcoinFaucet,
|
|
96
131
|
createNewTree,
|
|
132
|
+
createNewTreeWithoutDirectTx,
|
|
97
133
|
getTestWalletConfig,
|
|
98
134
|
getTestWalletConfigWithIdentityKey,
|
|
99
|
-
signerTypes
|
|
135
|
+
signerTypes,
|
|
136
|
+
walletTypes
|
|
100
137
|
};
|
package/dist/types/index.cjs
CHANGED
|
@@ -353,7 +353,11 @@ var SwapLeafFromJson = (obj) => {
|
|
|
353
353
|
return {
|
|
354
354
|
leafId: obj["swap_leaf_leaf_id"],
|
|
355
355
|
rawUnsignedRefundTransaction: obj["swap_leaf_raw_unsigned_refund_transaction"],
|
|
356
|
-
adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"]
|
|
356
|
+
adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"],
|
|
357
|
+
directRawUnsignedRefundTransaction: obj["swap_leaf_direct_raw_unsigned_refund_transaction"],
|
|
358
|
+
directAdaptorSignedSignature: obj["swap_leaf_direct_adaptor_signed_signature"],
|
|
359
|
+
directFromCpfpRawUnsignedRefundTransaction: obj["swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction"],
|
|
360
|
+
directFromCpfpAdaptorSignedSignature: obj["swap_leaf_direct_from_cpfp_adaptor_signed_signature"]
|
|
357
361
|
};
|
|
358
362
|
};
|
|
359
363
|
|
|
@@ -584,6 +588,10 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
|
|
|
584
588
|
swap_leaf_leaf_id: leaf_id
|
|
585
589
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
586
590
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
591
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
592
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
593
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
594
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
587
595
|
}
|
|
588
596
|
}`;
|
|
589
597
|
var getLeavesSwapRequestQuery = (id) => {
|
|
@@ -1088,6 +1096,10 @@ fragment UserRequestFragment on UserRequest {
|
|
|
1088
1096
|
swap_leaf_leaf_id: leaf_id
|
|
1089
1097
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
1090
1098
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
1099
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
1100
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
1101
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
1102
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
1091
1103
|
}
|
|
1092
1104
|
}
|
|
1093
1105
|
... on LightningReceiveRequest {
|
|
@@ -16342,14 +16354,6 @@ var SparkServiceDefinition = {
|
|
|
16342
16354
|
responseStream: false,
|
|
16343
16355
|
options: {}
|
|
16344
16356
|
},
|
|
16345
|
-
create_tree_v2: {
|
|
16346
|
-
name: "create_tree_v2",
|
|
16347
|
-
requestType: CreateTreeRequest,
|
|
16348
|
-
requestStream: false,
|
|
16349
|
-
responseType: CreateTreeResponse,
|
|
16350
|
-
responseStream: false,
|
|
16351
|
-
options: {}
|
|
16352
|
-
},
|
|
16353
16357
|
get_signing_operator_list: {
|
|
16354
16358
|
name: "get_signing_operator_list",
|
|
16355
16359
|
requestType: Empty,
|
|
@@ -16516,6 +16520,90 @@ var SparkServiceDefinition = {
|
|
|
16516
16520
|
responseType: ExitSingleNodeTreesResponse,
|
|
16517
16521
|
responseStream: false,
|
|
16518
16522
|
options: {}
|
|
16523
|
+
},
|
|
16524
|
+
/**
|
|
16525
|
+
* The following endpoints enforce inclusion of Direct Transactions used
|
|
16526
|
+
* for unilateral exits
|
|
16527
|
+
*/
|
|
16528
|
+
create_tree_v2: {
|
|
16529
|
+
name: "create_tree_v2",
|
|
16530
|
+
requestType: CreateTreeRequest,
|
|
16531
|
+
requestStream: false,
|
|
16532
|
+
responseType: CreateTreeResponse,
|
|
16533
|
+
responseStream: false,
|
|
16534
|
+
options: {}
|
|
16535
|
+
},
|
|
16536
|
+
cooperative_exit_v2: {
|
|
16537
|
+
name: "cooperative_exit_v2",
|
|
16538
|
+
requestType: CooperativeExitRequest,
|
|
16539
|
+
requestStream: false,
|
|
16540
|
+
responseType: CooperativeExitResponse,
|
|
16541
|
+
responseStream: false,
|
|
16542
|
+
options: {}
|
|
16543
|
+
},
|
|
16544
|
+
extend_leaf_v2: {
|
|
16545
|
+
name: "extend_leaf_v2",
|
|
16546
|
+
requestType: ExtendLeafRequest,
|
|
16547
|
+
requestStream: false,
|
|
16548
|
+
responseType: ExtendLeafResponse,
|
|
16549
|
+
responseStream: false,
|
|
16550
|
+
options: {}
|
|
16551
|
+
},
|
|
16552
|
+
claim_transfer_sign_refunds_v2: {
|
|
16553
|
+
name: "claim_transfer_sign_refunds_v2",
|
|
16554
|
+
requestType: ClaimTransferSignRefundsRequest,
|
|
16555
|
+
requestStream: false,
|
|
16556
|
+
responseType: ClaimTransferSignRefundsResponse,
|
|
16557
|
+
responseStream: false,
|
|
16558
|
+
options: {}
|
|
16559
|
+
},
|
|
16560
|
+
finalize_node_signatures_v2: {
|
|
16561
|
+
name: "finalize_node_signatures_v2",
|
|
16562
|
+
requestType: FinalizeNodeSignaturesRequest,
|
|
16563
|
+
requestStream: false,
|
|
16564
|
+
responseType: FinalizeNodeSignaturesResponse,
|
|
16565
|
+
responseStream: false,
|
|
16566
|
+
options: {}
|
|
16567
|
+
},
|
|
16568
|
+
initiate_preimage_swap_v2: {
|
|
16569
|
+
name: "initiate_preimage_swap_v2",
|
|
16570
|
+
requestType: InitiatePreimageSwapRequest,
|
|
16571
|
+
requestStream: false,
|
|
16572
|
+
responseType: InitiatePreimageSwapResponse,
|
|
16573
|
+
responseStream: false,
|
|
16574
|
+
options: {}
|
|
16575
|
+
},
|
|
16576
|
+
start_leaf_swap_v2: {
|
|
16577
|
+
name: "start_leaf_swap_v2",
|
|
16578
|
+
requestType: StartTransferRequest,
|
|
16579
|
+
requestStream: false,
|
|
16580
|
+
responseType: StartTransferResponse,
|
|
16581
|
+
responseStream: false,
|
|
16582
|
+
options: {}
|
|
16583
|
+
},
|
|
16584
|
+
counter_leaf_swap_v2: {
|
|
16585
|
+
name: "counter_leaf_swap_v2",
|
|
16586
|
+
requestType: CounterLeafSwapRequest,
|
|
16587
|
+
requestStream: false,
|
|
16588
|
+
responseType: CounterLeafSwapResponse,
|
|
16589
|
+
responseStream: false,
|
|
16590
|
+
options: {}
|
|
16591
|
+
},
|
|
16592
|
+
start_transfer_v2: {
|
|
16593
|
+
name: "start_transfer_v2",
|
|
16594
|
+
requestType: StartTransferRequest,
|
|
16595
|
+
requestStream: false,
|
|
16596
|
+
responseType: StartTransferResponse,
|
|
16597
|
+
responseStream: false,
|
|
16598
|
+
options: {}
|
|
16599
|
+
},
|
|
16600
|
+
refresh_timelock_v2: {
|
|
16601
|
+
name: "refresh_timelock_v2",
|
|
16602
|
+
requestType: RefreshTimelockRequest,
|
|
16603
|
+
requestStream: false,
|
|
16604
|
+
responseType: RefreshTimelockResponse,
|
|
16605
|
+
responseStream: false,
|
|
16606
|
+
options: {}
|
|
16519
16607
|
}
|
|
16520
16608
|
}
|
|
16521
16609
|
};
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BitcoinNetwork, C as ClaimStaticDepositOutput,
|
|
1
|
+
export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, t as CompleteCoopExitInput, u as CompleteLeavesSwapInput, w as CoopExitFeeEstimate, x as CoopExitFeeEstimatesInput, y as CoopExitFeeEstimatesOutput, E as CoopExitFeeQuote, F as CoopExitFeeQuoteInput, G as CoopExitRequest, I as CurrencyAmount, J as CurrencyUnit, L as ExitSpeed, M as GetChallengeOutput, N as Invoice, O as Leaf, P as LeavesSwapFeeEstimateOutput, R as LeavesSwapRequest, X as LightningReceiveRequest, Y as LightningReceiveRequestStatus, Z as LightningSendFeeEstimateInput, _ as LightningSendFeeEstimateOutput, a0 as LightningSendRequest, a1 as LightningSendRequestStatus, a2 as PageInfo, a3 as RequestCoopExitInput, a4 as RequestLeavesSwapInput, a5 as RequestLightningReceiveInput, a6 as RequestLightningSendInput, a7 as SparkCoopExitRequestStatus, a8 as SparkLeavesSwapRequestStatus, a9 as SparkTransferToLeavesConnection, aa as StaticDepositQuoteInput, ab as StaticDepositQuoteOutput, ac as SwapLeaf, ad as Transfer, ae as UserLeafInput, af as VerifyChallengeOutput, z as getCoopExitFeeQuoteQuery, H as getCoopExitRequestQuery, Q as getLeavesSwapRequestQuery, W as getLightningReceiveRequestQuery, $ as getLightningSendRequestQuery } from '../client-KhNkrXz4.cjs';
|
|
2
2
|
export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.cjs';
|
|
3
|
-
export { c as CommonProto, s as SparkProto } from '../spark-
|
|
4
|
-
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-
|
|
3
|
+
export { c as CommonProto, s as SparkProto } from '../spark-B_7nZx6T.cjs';
|
|
4
|
+
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-CB9HrW5O.cjs';
|
|
5
5
|
import '@lightsparkdev/core';
|
|
6
6
|
import '@buildonspark/lrc20-sdk';
|
|
7
7
|
import '@scure/btc-signer';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BitcoinNetwork, C as ClaimStaticDepositOutput,
|
|
1
|
+
export { B as BitcoinNetwork, C as ClaimStaticDepositOutput, t as CompleteCoopExitInput, u as CompleteLeavesSwapInput, w as CoopExitFeeEstimate, x as CoopExitFeeEstimatesInput, y as CoopExitFeeEstimatesOutput, E as CoopExitFeeQuote, F as CoopExitFeeQuoteInput, G as CoopExitRequest, I as CurrencyAmount, J as CurrencyUnit, L as ExitSpeed, M as GetChallengeOutput, N as Invoice, O as Leaf, P as LeavesSwapFeeEstimateOutput, R as LeavesSwapRequest, X as LightningReceiveRequest, Y as LightningReceiveRequestStatus, Z as LightningSendFeeEstimateInput, _ as LightningSendFeeEstimateOutput, a0 as LightningSendRequest, a1 as LightningSendRequestStatus, a2 as PageInfo, a3 as RequestCoopExitInput, a4 as RequestLeavesSwapInput, a5 as RequestLightningReceiveInput, a6 as RequestLightningSendInput, a7 as SparkCoopExitRequestStatus, a8 as SparkLeavesSwapRequestStatus, a9 as SparkTransferToLeavesConnection, aa as StaticDepositQuoteInput, ab as StaticDepositQuoteOutput, ac as SwapLeaf, ad as Transfer, ae as UserLeafInput, af as VerifyChallengeOutput, z as getCoopExitFeeQuoteQuery, H as getCoopExitRequestQuery, Q as getLeavesSwapRequestQuery, W as getLightningReceiveRequestQuery, $ as getLightningSendRequestQuery } from '../client-BF4cn8F4.js';
|
|
2
2
|
export { ClaimStaticDeposit, ClaimStaticDepositInput, ClaimStaticDepositRequestType, ClaimStaticDepositStatus, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getClaimStaticDepositQuery, getUserRequestQuery } from '../graphql/objects/index.js';
|
|
3
|
-
export { c as CommonProto, s as SparkProto } from '../spark-
|
|
4
|
-
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-
|
|
3
|
+
export { c as CommonProto, s as SparkProto } from '../spark-B_7nZx6T.js';
|
|
4
|
+
export { T as TransferDirection, W as WalletLeaf, a as WalletTransfer, b as WalletTransferLeaf, c as mapTransferLeafToWalletTransferLeaf, d as mapTransferToWalletTransfer, m as mapTreeNodeToWalletLeaf } from '../sdk-types-CkRNraXT.js';
|
|
5
5
|
import '@lightsparkdev/core';
|
|
6
6
|
import '@buildonspark/lrc20-sdk';
|
|
7
7
|
import '@scure/btc-signer';
|
package/dist/types/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
mapTransferLeafToWalletTransferLeaf,
|
|
4
4
|
mapTransferToWalletTransfer,
|
|
5
5
|
mapTreeNodeToWalletLeaf
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-3SEOTO43.js";
|
|
7
7
|
import {
|
|
8
8
|
BitcoinNetwork_default,
|
|
9
9
|
ClaimStaticDepositRequestType_default,
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
getLightningReceiveRequestQuery,
|
|
25
25
|
getLightningSendRequestQuery,
|
|
26
26
|
getUserRequestQuery
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-WAQKYSDI.js";
|
|
28
28
|
import {
|
|
29
29
|
common_exports,
|
|
30
30
|
spark_exports
|
|
31
|
-
} from "../chunk-
|
|
31
|
+
} from "../chunk-AAZWSPUK.js";
|
|
32
32
|
import "../chunk-MVRQ5US7.js";
|
|
33
33
|
export {
|
|
34
34
|
BitcoinNetwork_default as BitcoinNetwork,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network,
|
|
5
|
-
import {
|
|
6
|
-
import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-
|
|
4
|
+
import { N as Network, u as TokenOutputsMap, B as Bech32mTokenIdentifier, t as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-C1Tr_VKI.js';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-BF4cn8F4.js';
|
|
6
|
+
import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-B_7nZx6T.js';
|
|
7
7
|
|
|
8
8
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
9
9
|
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
@@ -56,19 +56,66 @@ declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalance
|
|
|
56
56
|
|
|
57
57
|
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
58
58
|
|
|
59
|
+
declare const DIRECT_TIMELOCK_OFFSET = 50;
|
|
60
|
+
declare const INITIAL_SEQUENCE: number;
|
|
61
|
+
declare const INITIAL_DIRECT_SEQUENCE: number;
|
|
62
|
+
declare const TEST_UNILATERAL_SEQUENCE: number;
|
|
63
|
+
declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
|
|
59
64
|
declare const DEFAULT_FEE_SATS: number;
|
|
60
65
|
/**
|
|
61
66
|
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
62
67
|
* Returns the original amount if it's less than or equal to the fee.
|
|
63
68
|
*/
|
|
64
69
|
declare function maybeApplyFee(amount: bigint): bigint;
|
|
65
|
-
declare function
|
|
70
|
+
declare function createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
|
|
71
|
+
declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
|
|
72
|
+
interface CreateNodeTxInput {
|
|
73
|
+
txOut: TransactionOutput;
|
|
74
|
+
parentOutPoint: TransactionInput;
|
|
75
|
+
applyFee?: boolean;
|
|
76
|
+
includeAnchor?: boolean;
|
|
77
|
+
}
|
|
78
|
+
declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
|
|
79
|
+
declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
|
|
80
|
+
cpfpNodeTx: Transaction;
|
|
81
|
+
directNodeTx?: Transaction;
|
|
82
|
+
};
|
|
83
|
+
declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
|
|
84
|
+
interface CreateRefundTxInput {
|
|
85
|
+
sequence: number;
|
|
86
|
+
input: TransactionInput;
|
|
87
|
+
amountSats: bigint;
|
|
88
|
+
receivingPubkey: Uint8Array;
|
|
89
|
+
network: Network;
|
|
90
|
+
shouldCalculateFee: boolean;
|
|
91
|
+
includeAnchor: boolean;
|
|
92
|
+
}
|
|
93
|
+
declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
|
|
94
|
+
interface CreateRefundTxsInput {
|
|
95
|
+
sequence: number;
|
|
96
|
+
directSequence?: number;
|
|
97
|
+
input: TransactionInput;
|
|
98
|
+
directInput?: TransactionInput;
|
|
99
|
+
amountSats: bigint;
|
|
100
|
+
receivingPubkey: Uint8Array;
|
|
101
|
+
network: Network;
|
|
102
|
+
}
|
|
103
|
+
declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
|
|
104
|
+
cpfpRefundTx: Transaction;
|
|
105
|
+
directRefundTx?: Transaction;
|
|
106
|
+
directFromCpfpRefundTx?: Transaction;
|
|
107
|
+
};
|
|
108
|
+
declare function createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
|
|
66
109
|
declare function getCurrentTimelock(currSequence?: number): number;
|
|
67
|
-
declare function getTransactionSequence(currSequence?: number):
|
|
110
|
+
declare function getTransactionSequence(currSequence?: number): {
|
|
111
|
+
nextSequence: number;
|
|
112
|
+
nextDirectSequence: number;
|
|
113
|
+
};
|
|
68
114
|
declare function checkIfValidSequence(currSequence?: number): void;
|
|
69
|
-
declare function
|
|
115
|
+
declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
|
|
116
|
+
declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
70
117
|
nextSequence: number;
|
|
71
|
-
|
|
118
|
+
nextDirectSequence: number;
|
|
72
119
|
};
|
|
73
120
|
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
74
121
|
|
|
@@ -123,4 +170,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
|
|
|
123
170
|
|
|
124
171
|
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
125
172
|
|
|
126
|
-
export {
|
|
173
|
+
export { getTransactionSequence as $, createSigningNonce as A, getSigningCommitmentFromNonce as B, encodeSigningNonceToBytes as C, decodeBytesToSigningNonce as D, createSigningCommitment as E, encodeSigningCommitmentToBytes as F, decodeBytesToSigningCommitment as G, sumAvailableTokens as H, checkIfSelectedOutputsAreAvailable as I, filterTokenBalanceForTokenPublicKey as J, getTransferPackageSigningPayload as K, DIRECT_TIMELOCK_OFFSET as L, INITIAL_SEQUENCE as M, INITIAL_DIRECT_SEQUENCE as N, TEST_UNILATERAL_DIRECT_SEQUENCE as O, DEFAULT_FEE_SATS as P, maybeApplyFee as Q, createRootTx as R, createSplitTx as S, TEST_UNILATERAL_SEQUENCE as T, createNodeTx as U, createNodeTxs as V, createLeafNodeTx as W, createRefundTx as X, createRefundTxs as Y, createConnectorRefundTransactions as Z, getCurrentTimelock as _, generateAdaptorFromSignature as a, checkIfValidSequence as a0, doesLeafNeedRefresh as a1, getNextTransactionSequence as a2, getEphemeralAnchorOutput as a3, type LeafInfo as a4, type Utxo as a5, type FeeRate as a6, type FeeBumpTxPackage as a7, type FeeBumpTxChain as a8, type TxChain as a9, type BroadcastConfig as aa, type BroadcastResult as ab, isEphemeralAnchorOutput as ac, constructUnilateralExitTxs as ad, constructUnilateralExitFeeBumpPackages as ae, constructFeeBumpTx as af, getSparkAddressFromTaproot as ag, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, addPublicKeys as n, applyAdditiveTweakToPublicKey as o, addPrivateKeys as p, subtractPrivateKeys as q, sumOfPrivateKeys as r, subtractPublicKeys as s, lastKeyWithTarget as t, getLatestDepositTxId as u, validateOutboundAdaptorSignature as v, isTxBroadcast as w, proofOfPossessionMessageHashForDepositAddress as x, collectResponses as y, getRandomSigningNonce as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network,
|
|
5
|
-
import {
|
|
6
|
-
import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-
|
|
4
|
+
import { N as Network, u as TokenOutputsMap, B as Bech32mTokenIdentifier, t as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-DG3x2obf.cjs';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-KhNkrXz4.cjs';
|
|
6
|
+
import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient } from './spark-B_7nZx6T.cjs';
|
|
7
7
|
|
|
8
8
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
9
9
|
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
@@ -56,19 +56,66 @@ declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalance
|
|
|
56
56
|
|
|
57
57
|
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
58
58
|
|
|
59
|
+
declare const DIRECT_TIMELOCK_OFFSET = 50;
|
|
60
|
+
declare const INITIAL_SEQUENCE: number;
|
|
61
|
+
declare const INITIAL_DIRECT_SEQUENCE: number;
|
|
62
|
+
declare const TEST_UNILATERAL_SEQUENCE: number;
|
|
63
|
+
declare const TEST_UNILATERAL_DIRECT_SEQUENCE: number;
|
|
59
64
|
declare const DEFAULT_FEE_SATS: number;
|
|
60
65
|
/**
|
|
61
66
|
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
62
67
|
* Returns the original amount if it's less than or equal to the fee.
|
|
63
68
|
*/
|
|
64
69
|
declare function maybeApplyFee(amount: bigint): bigint;
|
|
65
|
-
declare function
|
|
70
|
+
declare function createRootTx(depositOutPoint: TransactionInput, depositTxOut: TransactionOutput): [Transaction, Transaction];
|
|
71
|
+
declare function createSplitTx(parentOutPoint: TransactionInput, childTxOuts: TransactionOutput[]): [Transaction, Transaction];
|
|
72
|
+
interface CreateNodeTxInput {
|
|
73
|
+
txOut: TransactionOutput;
|
|
74
|
+
parentOutPoint: TransactionInput;
|
|
75
|
+
applyFee?: boolean;
|
|
76
|
+
includeAnchor?: boolean;
|
|
77
|
+
}
|
|
78
|
+
declare function createNodeTx({ txOut, parentOutPoint, applyFee, includeAnchor, }: CreateNodeTxInput): Transaction;
|
|
79
|
+
declare function createNodeTxs(txOut: TransactionOutput, txIn: TransactionInput, directTxIn?: TransactionInput): {
|
|
80
|
+
cpfpNodeTx: Transaction;
|
|
81
|
+
directNodeTx?: Transaction;
|
|
82
|
+
};
|
|
83
|
+
declare function createLeafNodeTx(sequence: number, directSequence: number, parentOutPoint: TransactionInput, txOut: TransactionOutput, shouldCalculateFee: boolean): [Transaction, Transaction];
|
|
84
|
+
interface CreateRefundTxInput {
|
|
85
|
+
sequence: number;
|
|
86
|
+
input: TransactionInput;
|
|
87
|
+
amountSats: bigint;
|
|
88
|
+
receivingPubkey: Uint8Array;
|
|
89
|
+
network: Network;
|
|
90
|
+
shouldCalculateFee: boolean;
|
|
91
|
+
includeAnchor: boolean;
|
|
92
|
+
}
|
|
93
|
+
declare function createRefundTx({ sequence, input, amountSats, receivingPubkey, network, shouldCalculateFee, includeAnchor, }: CreateRefundTxInput): Transaction;
|
|
94
|
+
interface CreateRefundTxsInput {
|
|
95
|
+
sequence: number;
|
|
96
|
+
directSequence?: number;
|
|
97
|
+
input: TransactionInput;
|
|
98
|
+
directInput?: TransactionInput;
|
|
99
|
+
amountSats: bigint;
|
|
100
|
+
receivingPubkey: Uint8Array;
|
|
101
|
+
network: Network;
|
|
102
|
+
}
|
|
103
|
+
declare function createRefundTxs({ sequence, directSequence, input, directInput, amountSats, receivingPubkey, network, }: CreateRefundTxsInput): {
|
|
104
|
+
cpfpRefundTx: Transaction;
|
|
105
|
+
directRefundTx?: Transaction;
|
|
106
|
+
directFromCpfpRefundTx?: Transaction;
|
|
107
|
+
};
|
|
108
|
+
declare function createConnectorRefundTransactions(sequence: number, cpfpNodeOutPoint: TransactionInput, directNodeOutPoint: TransactionInput, connectorOutput: TransactionInput, amountSats: bigint, receiverPubKey: Uint8Array, network: Network, shouldCalculateFee: boolean): [Transaction, Transaction, Transaction];
|
|
66
109
|
declare function getCurrentTimelock(currSequence?: number): number;
|
|
67
|
-
declare function getTransactionSequence(currSequence?: number):
|
|
110
|
+
declare function getTransactionSequence(currSequence?: number): {
|
|
111
|
+
nextSequence: number;
|
|
112
|
+
nextDirectSequence: number;
|
|
113
|
+
};
|
|
68
114
|
declare function checkIfValidSequence(currSequence?: number): void;
|
|
69
|
-
declare function
|
|
115
|
+
declare function doesLeafNeedRefresh(currSequence: number, isNodeTx?: boolean): boolean;
|
|
116
|
+
declare function getNextTransactionSequence(currSequence: number, isNodeTx?: boolean): {
|
|
70
117
|
nextSequence: number;
|
|
71
|
-
|
|
118
|
+
nextDirectSequence: number;
|
|
72
119
|
};
|
|
73
120
|
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
74
121
|
|
|
@@ -123,4 +170,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
|
|
|
123
170
|
|
|
124
171
|
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
125
172
|
|
|
126
|
-
export {
|
|
173
|
+
export { getTransactionSequence as $, createSigningNonce as A, getSigningCommitmentFromNonce as B, encodeSigningNonceToBytes as C, decodeBytesToSigningNonce as D, createSigningCommitment as E, encodeSigningCommitmentToBytes as F, decodeBytesToSigningCommitment as G, sumAvailableTokens as H, checkIfSelectedOutputsAreAvailable as I, filterTokenBalanceForTokenPublicKey as J, getTransferPackageSigningPayload as K, DIRECT_TIMELOCK_OFFSET as L, INITIAL_SEQUENCE as M, INITIAL_DIRECT_SEQUENCE as N, TEST_UNILATERAL_DIRECT_SEQUENCE as O, DEFAULT_FEE_SATS as P, maybeApplyFee as Q, createRootTx as R, createSplitTx as S, TEST_UNILATERAL_SEQUENCE as T, createNodeTx as U, createNodeTxs as V, createLeafNodeTx as W, createRefundTx as X, createRefundTxs as Y, createConnectorRefundTransactions as Z, getCurrentTimelock as _, generateAdaptorFromSignature as a, checkIfValidSequence as a0, doesLeafNeedRefresh as a1, getNextTransactionSequence as a2, getEphemeralAnchorOutput as a3, type LeafInfo as a4, type Utxo as a5, type FeeRate as a6, type FeeBumpTxPackage as a7, type FeeBumpTxChain as a8, type TxChain as a9, type BroadcastConfig as aa, type BroadcastResult as ab, isEphemeralAnchorOutput as ac, constructUnilateralExitTxs as ad, constructUnilateralExitFeeBumpPackages as ae, constructFeeBumpTx as af, getSparkAddressFromTaproot as ag, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, addPublicKeys as n, applyAdditiveTweakToPublicKey as o, addPrivateKeys as p, subtractPrivateKeys as q, sumOfPrivateKeys as r, subtractPublicKeys as s, lastKeyWithTarget as t, getLatestDepositTxId as u, validateOutboundAdaptorSignature as v, isTxBroadcast as w, proofOfPossessionMessageHashForDepositAddress as x, collectResponses as y, getRandomSigningNonce as z };
|