@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
package/src/graphql/client.ts
CHANGED
|
@@ -309,6 +309,8 @@ export default class SspClient {
|
|
|
309
309
|
|
|
310
310
|
async requestLeaveSwap({
|
|
311
311
|
adaptorPubkey,
|
|
312
|
+
directAdaptorPubkey,
|
|
313
|
+
directFromCpfpAdaptorPubkey,
|
|
312
314
|
totalAmountSats,
|
|
313
315
|
targetAmountSats,
|
|
314
316
|
feeSats,
|
|
@@ -320,6 +322,8 @@ export default class SspClient {
|
|
|
320
322
|
queryPayload: RequestSwapLeaves,
|
|
321
323
|
variables: {
|
|
322
324
|
adaptor_pubkey: adaptorPubkey,
|
|
325
|
+
direct_adaptor_pubkey: directAdaptorPubkey,
|
|
326
|
+
direct_from_cpfp_adaptor_pubkey: directFromCpfpAdaptorPubkey,
|
|
323
327
|
total_amount_sats: totalAmountSats,
|
|
324
328
|
target_amount_sats: targetAmountSats,
|
|
325
329
|
fee_sats: feeSats,
|
|
@@ -340,6 +344,8 @@ export default class SspClient {
|
|
|
340
344
|
|
|
341
345
|
async completeLeaveSwap({
|
|
342
346
|
adaptorSecretKey,
|
|
347
|
+
directAdaptorSecretKey,
|
|
348
|
+
directFromCpfpAdaptorSecretKey,
|
|
343
349
|
userOutboundTransferExternalId,
|
|
344
350
|
leavesSwapRequestId,
|
|
345
351
|
}: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null> {
|
|
@@ -347,6 +353,8 @@ export default class SspClient {
|
|
|
347
353
|
queryPayload: CompleteLeavesSwap,
|
|
348
354
|
variables: {
|
|
349
355
|
adaptor_secret_key: adaptorSecretKey,
|
|
356
|
+
direct_adaptor_secret_key: directAdaptorSecretKey,
|
|
357
|
+
direct_from_cpfp_adaptor_secret_key: directFromCpfpAdaptorSecretKey,
|
|
350
358
|
user_outbound_transfer_external_id: userOutboundTransferExternalId,
|
|
351
359
|
leaves_swap_request_id: leavesSwapRequestId,
|
|
352
360
|
},
|
|
@@ -3,10 +3,18 @@ import { FRAGMENT as LeavesSwapRequestFragment } from "../objects/LeavesSwapRequ
|
|
|
3
3
|
export const CompleteLeavesSwap = `
|
|
4
4
|
mutation CompleteLeavesSwap(
|
|
5
5
|
$adaptor_secret_key: String!
|
|
6
|
+
$direct_adaptor_secret_key: String!
|
|
7
|
+
$direct_from_cpfp_adaptor_secret_key: String!
|
|
6
8
|
$user_outbound_transfer_external_id: UUID!
|
|
7
9
|
$leaves_swap_request_id: ID!
|
|
8
10
|
) {
|
|
9
|
-
complete_leaves_swap(input: {
|
|
11
|
+
complete_leaves_swap(input: {
|
|
12
|
+
adaptor_secret_key: $adaptor_secret_key,
|
|
13
|
+
direct_adaptor_secret_key: $direct_adaptor_secret_key,
|
|
14
|
+
direct_from_cpfp_adaptor_secret_key: $direct_from_cpfp_adaptor_secret_key,
|
|
15
|
+
user_outbound_transfer_external_id: $user_outbound_transfer_external_id,
|
|
16
|
+
leaves_swap_request_id: $leaves_swap_request_id
|
|
17
|
+
}) {
|
|
10
18
|
request {
|
|
11
19
|
...LeavesSwapRequestFragment
|
|
12
20
|
}
|
|
@@ -3,6 +3,8 @@ import { FRAGMENT as LeavesSwapRequestFragment } from "../objects/LeavesSwapRequ
|
|
|
3
3
|
export const RequestSwapLeaves = `
|
|
4
4
|
mutation RequestSwapLeaves(
|
|
5
5
|
$adaptor_pubkey: PublicKey!
|
|
6
|
+
$direct_adaptor_pubkey: PublicKey
|
|
7
|
+
$direct_from_cpfp_adaptor_pubkey: PublicKey
|
|
6
8
|
$total_amount_sats: Long!
|
|
7
9
|
$target_amount_sats: Long!
|
|
8
10
|
$fee_sats: Long!
|
|
@@ -12,6 +14,8 @@ export const RequestSwapLeaves = `
|
|
|
12
14
|
) {
|
|
13
15
|
request_leaves_swap(input: {
|
|
14
16
|
adaptor_pubkey: $adaptor_pubkey
|
|
17
|
+
direct_adaptor_pubkey: $direct_adaptor_pubkey
|
|
18
|
+
direct_from_cpfp_adaptor_pubkey: $direct_from_cpfp_adaptor_pubkey
|
|
15
19
|
total_amount_sats: $total_amount_sats
|
|
16
20
|
target_amount_sats: $target_amount_sats
|
|
17
21
|
fee_sats: $fee_sats
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
3
|
interface CompleteLeavesSwapInput {
|
|
4
|
+
adaptorSecretKey: string;
|
|
9
5
|
|
|
6
|
+
directAdaptorSecretKey: string;
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
userOutboundTransferExternalId: string;
|
|
14
|
-
|
|
15
|
-
leavesSwapRequestId: string;
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
directFromCpfpAdaptorSecretKey: string;
|
|
18
9
|
|
|
10
|
+
userOutboundTransferExternalId: string;
|
|
19
11
|
|
|
12
|
+
leavesSwapRequestId: string;
|
|
20
13
|
}
|
|
21
14
|
|
|
22
|
-
export const CompleteLeavesSwapInputFromJson = (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
15
|
+
export const CompleteLeavesSwapInputFromJson = (
|
|
16
|
+
obj: any,
|
|
17
|
+
): CompleteLeavesSwapInput => {
|
|
18
|
+
return {
|
|
19
|
+
adaptorSecretKey: obj["complete_leaves_swap_input_adaptor_secret_key"],
|
|
20
|
+
directAdaptorSecretKey:
|
|
21
|
+
obj["complete_leaves_swap_input_direct_adaptor_secret_key"],
|
|
22
|
+
directFromCpfpAdaptorSecretKey:
|
|
23
|
+
obj["complete_leaves_swap_input_direct_from_cpfp_adaptor_secret_key"],
|
|
24
|
+
userOutboundTransferExternalId:
|
|
25
|
+
obj["complete_leaves_swap_input_user_outbound_transfer_external_id"],
|
|
26
|
+
leavesSwapRequestId:
|
|
27
|
+
obj["complete_leaves_swap_input_leaves_swap_request_id"],
|
|
28
|
+
} as CompleteLeavesSwapInput;
|
|
29
|
+
};
|
|
30
|
+
export const CompleteLeavesSwapInputToJson = (
|
|
31
|
+
obj: CompleteLeavesSwapInput,
|
|
32
|
+
): any => {
|
|
33
|
+
return {
|
|
34
|
+
complete_leaves_swap_input_adaptor_secret_key: obj.adaptorSecretKey,
|
|
35
|
+
complete_leaves_swap_input_direct_adaptor_secret_key:
|
|
36
|
+
obj.directAdaptorSecretKey,
|
|
37
|
+
complete_leaves_swap_input_direct_from_cpfp_adaptor_secret_key:
|
|
38
|
+
obj.directFromCpfpAdaptorSecretKey,
|
|
39
|
+
complete_leaves_swap_input_user_outbound_transfer_external_id:
|
|
40
|
+
obj.userOutboundTransferExternalId,
|
|
41
|
+
complete_leaves_swap_input_leaves_swap_request_id: obj.leavesSwapRequestId,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
44
|
|
|
45
45
|
export default CompleteLeavesSwapInput;
|
|
@@ -175,6 +175,10 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
|
|
|
175
175
|
swap_leaf_leaf_id: leaf_id
|
|
176
176
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
177
177
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
178
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
179
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
180
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
181
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
178
182
|
}
|
|
179
183
|
}`;
|
|
180
184
|
|
|
@@ -1,63 +1,64 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
import UserLeafInput, {
|
|
4
|
+
UserLeafInputFromJson,
|
|
5
|
+
UserLeafInputToJson,
|
|
6
|
+
} from "./UserLeafInput.js";
|
|
9
7
|
|
|
10
8
|
interface RequestLeavesSwapInput {
|
|
9
|
+
adaptorPubkey: string;
|
|
11
10
|
|
|
11
|
+
directAdaptorPubkey?: string;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
totalAmountSats: number;
|
|
16
|
-
|
|
17
|
-
targetAmountSats: number;
|
|
18
|
-
|
|
19
|
-
feeSats: number;
|
|
20
|
-
|
|
21
|
-
userLeaves: UserLeafInput[];
|
|
22
|
-
|
|
23
|
-
idempotencyKey: string;
|
|
13
|
+
directFromCpfpAdaptorPubkey?: string;
|
|
24
14
|
|
|
25
|
-
|
|
15
|
+
totalAmountSats: number;
|
|
26
16
|
|
|
17
|
+
targetAmountSats: number;
|
|
27
18
|
|
|
19
|
+
feeSats: number;
|
|
28
20
|
|
|
21
|
+
userLeaves: UserLeafInput[];
|
|
29
22
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
export const RequestLeavesSwapInputFromJson = (obj: any): RequestLeavesSwapInput => {
|
|
33
|
-
return {
|
|
34
|
-
adaptorPubkey: obj["request_leaves_swap_input_adaptor_pubkey"],
|
|
35
|
-
totalAmountSats: obj["request_leaves_swap_input_total_amount_sats"],
|
|
36
|
-
targetAmountSats: obj["request_leaves_swap_input_target_amount_sats"],
|
|
37
|
-
feeSats: obj["request_leaves_swap_input_fee_sats"],
|
|
38
|
-
userLeaves: obj["request_leaves_swap_input_user_leaves"].map((e) => UserLeafInputFromJson(e)),
|
|
39
|
-
idempotencyKey: obj["request_leaves_swap_input_idempotency_key"],
|
|
40
|
-
targetAmountSatsList: obj["request_leaves_swap_input_target_amount_sats_list"],
|
|
41
|
-
|
|
42
|
-
} as RequestLeavesSwapInput;
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
export const RequestLeavesSwapInputToJson = (obj: RequestLeavesSwapInput): any => {
|
|
46
|
-
return {
|
|
47
|
-
request_leaves_swap_input_adaptor_pubkey: obj.adaptorPubkey,
|
|
48
|
-
request_leaves_swap_input_total_amount_sats: obj.totalAmountSats,
|
|
49
|
-
request_leaves_swap_input_target_amount_sats: obj.targetAmountSats,
|
|
50
|
-
request_leaves_swap_input_fee_sats: obj.feeSats,
|
|
51
|
-
request_leaves_swap_input_user_leaves: obj.userLeaves.map((e) => UserLeafInputToJson(e)),
|
|
52
|
-
request_leaves_swap_input_idempotency_key: obj.idempotencyKey,
|
|
53
|
-
request_leaves_swap_input_target_amount_sats_list: obj.targetAmountSatsList,
|
|
54
|
-
|
|
55
|
-
}
|
|
23
|
+
idempotencyKey: string;
|
|
56
24
|
|
|
25
|
+
targetAmountSatsList?: number[] | undefined;
|
|
57
26
|
}
|
|
58
27
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
28
|
+
export const RequestLeavesSwapInputFromJson = (
|
|
29
|
+
obj: any,
|
|
30
|
+
): RequestLeavesSwapInput => {
|
|
31
|
+
return {
|
|
32
|
+
adaptorPubkey: obj["request_leaves_swap_input_adaptor_pubkey"],
|
|
33
|
+
directAdaptorPubkey: obj["request_leaves_swap_input_direct_adaptor_pubkey"],
|
|
34
|
+
directFromCpfpAdaptorPubkey: obj["request_leaves_swap_input_direct_from_cpfp_adaptor_pubkey"],
|
|
35
|
+
totalAmountSats: obj["request_leaves_swap_input_total_amount_sats"],
|
|
36
|
+
targetAmountSats: obj["request_leaves_swap_input_target_amount_sats"],
|
|
37
|
+
feeSats: obj["request_leaves_swap_input_fee_sats"],
|
|
38
|
+
userLeaves: obj["request_leaves_swap_input_user_leaves"].map((e) =>
|
|
39
|
+
UserLeafInputFromJson(e),
|
|
40
|
+
),
|
|
41
|
+
idempotencyKey: obj["request_leaves_swap_input_idempotency_key"],
|
|
42
|
+
targetAmountSatsList:
|
|
43
|
+
obj["request_leaves_swap_input_target_amount_sats_list"],
|
|
44
|
+
} as RequestLeavesSwapInput;
|
|
45
|
+
};
|
|
46
|
+
export const RequestLeavesSwapInputToJson = (
|
|
47
|
+
obj: RequestLeavesSwapInput,
|
|
48
|
+
): any => {
|
|
49
|
+
return {
|
|
50
|
+
request_leaves_swap_input_adaptor_pubkey: obj.adaptorPubkey,
|
|
51
|
+
request_leaves_swap_input_direct_adaptor_pubkey: obj.directAdaptorPubkey,
|
|
52
|
+
request_leaves_swap_input_direct_from_cpfp_adaptor_pubkey: obj.directFromCpfpAdaptorPubkey,
|
|
53
|
+
request_leaves_swap_input_total_amount_sats: obj.totalAmountSats,
|
|
54
|
+
request_leaves_swap_input_target_amount_sats: obj.targetAmountSats,
|
|
55
|
+
request_leaves_swap_input_fee_sats: obj.feeSats,
|
|
56
|
+
request_leaves_swap_input_user_leaves: obj.userLeaves.map((e) =>
|
|
57
|
+
UserLeafInputToJson(e),
|
|
58
|
+
),
|
|
59
|
+
request_leaves_swap_input_idempotency_key: obj.idempotencyKey,
|
|
60
|
+
request_leaves_swap_input_target_amount_sats_list: obj.targetAmountSatsList,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
62
63
|
|
|
63
64
|
export default RequestLeavesSwapInput;
|
|
@@ -1,53 +1,61 @@
|
|
|
1
|
-
|
|
2
1
|
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
3
|
interface SwapLeaf {
|
|
4
|
+
leafId: string;
|
|
9
5
|
|
|
6
|
+
rawUnsignedRefundTransaction: string;
|
|
10
7
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
rawUnsignedRefundTransaction: string;
|
|
14
|
-
|
|
15
|
-
adaptorSignedSignature: string;
|
|
8
|
+
adaptorSignedSignature: string;
|
|
16
9
|
|
|
10
|
+
directRawUnsignedRefundTransaction?: string;
|
|
17
11
|
|
|
12
|
+
directAdaptorSignedSignature?: string;
|
|
18
13
|
|
|
14
|
+
directFromCpfpRawUnsignedRefundTransaction?: string;
|
|
19
15
|
|
|
16
|
+
directFromCpfpAdaptorSignedSignature?: string;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
19
|
export const SwapLeafFromJson = (obj: any): SwapLeaf => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
20
|
+
return {
|
|
21
|
+
leafId: obj["swap_leaf_leaf_id"],
|
|
22
|
+
rawUnsignedRefundTransaction:
|
|
23
|
+
obj["swap_leaf_raw_unsigned_refund_transaction"],
|
|
24
|
+
adaptorSignedSignature: obj["swap_leaf_adaptor_signed_signature"],
|
|
25
|
+
directRawUnsignedRefundTransaction:
|
|
26
|
+
obj["swap_leaf_direct_raw_unsigned_refund_transaction"],
|
|
27
|
+
directAdaptorSignedSignature:
|
|
28
|
+
obj["swap_leaf_direct_adaptor_signed_signature"],
|
|
29
|
+
directFromCpfpRawUnsignedRefundTransaction:
|
|
30
|
+
obj["swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction"],
|
|
31
|
+
directFromCpfpAdaptorSignedSignature:
|
|
32
|
+
obj["swap_leaf_direct_from_cpfp_adaptor_signed_signature"],
|
|
33
|
+
} as SwapLeaf;
|
|
34
|
+
};
|
|
31
35
|
export const SwapLeafToJson = (obj: SwapLeaf): any => {
|
|
32
|
-
return {
|
|
33
|
-
swap_leaf_leaf_id: obj.leafId,
|
|
34
|
-
swap_leaf_raw_unsigned_refund_transaction: obj.rawUnsignedRefundTransaction,
|
|
35
|
-
swap_leaf_adaptor_signed_signature: obj.adaptorSignedSignature,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
return {
|
|
37
|
+
swap_leaf_leaf_id: obj.leafId,
|
|
38
|
+
swap_leaf_raw_unsigned_refund_transaction: obj.rawUnsignedRefundTransaction,
|
|
39
|
+
swap_leaf_adaptor_signed_signature: obj.adaptorSignedSignature,
|
|
40
|
+
swap_leaf_direct_raw_unsigned_refund_transaction:
|
|
41
|
+
obj.directRawUnsignedRefundTransaction,
|
|
42
|
+
swap_leaf_direct_adaptor_signed_signature: obj.directAdaptorSignedSignature,
|
|
43
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction:
|
|
44
|
+
obj.directFromCpfpRawUnsignedRefundTransaction,
|
|
45
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: obj.directFromCpfpAdaptorSignedSignature,
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const FRAGMENT = `
|
|
43
50
|
fragment SwapLeafFragment on SwapLeaf {
|
|
44
51
|
__typename
|
|
45
52
|
swap_leaf_leaf_id: leaf_id
|
|
46
53
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
47
54
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
55
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
56
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
57
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
58
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
48
59
|
}`;
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
61
|
export default SwapLeaf;
|
|
@@ -5,7 +5,15 @@ interface UserLeafInput {
|
|
|
5
5
|
|
|
6
6
|
raw_unsigned_refund_transaction: string;
|
|
7
7
|
|
|
8
|
+
direct_raw_unsigned_refund_transaction: string;
|
|
9
|
+
|
|
10
|
+
direct_from_cpfp_raw_unsigned_refund_transaction: string;
|
|
11
|
+
|
|
8
12
|
adaptor_added_signature: string;
|
|
13
|
+
|
|
14
|
+
direct_adaptor_added_signature: string;
|
|
15
|
+
|
|
16
|
+
direct_from_cpfp_adaptor_added_signature: string;
|
|
9
17
|
}
|
|
10
18
|
|
|
11
19
|
export const UserLeafInputFromJson = (obj: any): UserLeafInput => {
|
|
@@ -13,7 +21,15 @@ export const UserLeafInputFromJson = (obj: any): UserLeafInput => {
|
|
|
13
21
|
leaf_id: obj["user_leaf_input_leaf_id"],
|
|
14
22
|
raw_unsigned_refund_transaction:
|
|
15
23
|
obj["user_leaf_input_raw_unsigned_refund_transaction"],
|
|
24
|
+
direct_raw_unsigned_refund_transaction:
|
|
25
|
+
obj["user_leaf_input_direct_raw_unsigned_refund_transaction"],
|
|
26
|
+
direct_from_cpfp_raw_unsigned_refund_transaction:
|
|
27
|
+
obj["user_leaf_input_direct_from_cpfp_unsigned_refund_transaction"],
|
|
16
28
|
adaptor_added_signature: obj["user_leaf_input_adaptor_added_signature"],
|
|
29
|
+
direct_adaptor_added_signature:
|
|
30
|
+
obj["user_leaf_input_direct_adaptor_added_signature"],
|
|
31
|
+
direct_from_cpfp_adaptor_added_signature:
|
|
32
|
+
obj["user_leaf_input_direct_from_cpfp_adaptor_added_signature"],
|
|
17
33
|
} as UserLeafInput;
|
|
18
34
|
};
|
|
19
35
|
export const UserLeafInputToJson = (obj: UserLeafInput): any => {
|
|
@@ -21,7 +37,15 @@ export const UserLeafInputToJson = (obj: UserLeafInput): any => {
|
|
|
21
37
|
user_leaf_input_leaf_id: obj.leaf_id,
|
|
22
38
|
user_leaf_input_raw_unsigned_refund_transaction:
|
|
23
39
|
obj.raw_unsigned_refund_transaction,
|
|
40
|
+
user_leaf_input_direct_raw_unsigned_refund_transaction:
|
|
41
|
+
obj.direct_raw_unsigned_refund_transaction,
|
|
42
|
+
user_leaf_input_direct_from_cpfp_raw_unsigned_refund_transaction:
|
|
43
|
+
obj.direct_from_cpfp_raw_unsigned_refund_transaction,
|
|
24
44
|
user_leaf_input_adaptor_added_signature: obj.adaptor_added_signature,
|
|
45
|
+
user_leaf_input_direct_adaptor_added_signature:
|
|
46
|
+
obj.direct_adaptor_added_signature,
|
|
47
|
+
user_leaf_input_direct_from_cpfp_adaptor_added_signature:
|
|
48
|
+
obj.direct_from_cpfp_adaptor_added_signature,
|
|
25
49
|
};
|
|
26
50
|
};
|
|
27
51
|
|
|
@@ -448,6 +448,10 @@ fragment UserRequestFragment on UserRequest {
|
|
|
448
448
|
swap_leaf_leaf_id: leaf_id
|
|
449
449
|
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
450
450
|
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
451
|
+
swap_leaf_direct_raw_unsigned_refund_transaction: direct_raw_unsigned_refund_transaction
|
|
452
|
+
swap_leaf_direct_adaptor_signed_signature: direct_adaptor_signed_signature
|
|
453
|
+
swap_leaf_direct_from_cpfp_raw_unsigned_refund_transaction: direct_from_cpfp_raw_unsigned_refund_transaction
|
|
454
|
+
swap_leaf_direct_from_cpfp_adaptor_signed_signature: direct_from_cpfp_adaptor_signed_signature
|
|
451
455
|
}
|
|
452
456
|
}
|
|
453
457
|
... on LightningReceiveRequest {
|
package/src/index.node.ts
CHANGED
|
@@ -21,7 +21,7 @@ export {
|
|
|
21
21
|
} from "./signer/signer.js";
|
|
22
22
|
export * from "./signer/types.js";
|
|
23
23
|
|
|
24
|
-
export { SparkWallet } from "./spark-wallet/spark-wallet.js";
|
|
24
|
+
export { SparkWallet } from "./spark-wallet/spark-wallet.node.js";
|
|
25
25
|
export * from "./spark-wallet/types.js";
|
|
26
26
|
|
|
27
27
|
export { type WalletConfigService } from "./services/config.js";
|
package/src/native/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* Root React Native entrypoint */
|
|
2
2
|
|
|
3
|
-
import { setCrypto
|
|
3
|
+
import { setCrypto } from "../utils/crypto.js";
|
|
4
4
|
|
|
5
5
|
setCrypto(globalThis.crypto);
|
|
6
6
|
|
|
@@ -14,8 +14,7 @@ export { ReactNativeSparkSigner as DefaultSparkSigner } from "../signer/signer.r
|
|
|
14
14
|
export { SparkWallet } from "../spark-wallet/spark-wallet.js";
|
|
15
15
|
export * from "../spark-wallet/types.js";
|
|
16
16
|
|
|
17
|
-
export { WalletConfig } from "../services/wallet-config.js";
|
|
18
|
-
export { TokenTransactionService } from "../services/token-transactions.js";
|
|
19
|
-
export { type ConnectionManager } from "../services/connection.js";
|
|
20
17
|
export { type WalletConfigService } from "../services/config.js";
|
|
21
|
-
export { type
|
|
18
|
+
export { type ConnectionManager } from "../services/connection.js";
|
|
19
|
+
export { TokenTransactionService } from "../services/token-transactions.js";
|
|
20
|
+
export { WalletConfig, type ConfigOptions } from "../services/wallet-config.js";
|