@buildonspark/spark-sdk 0.1.43 → 0.1.44
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 +7 -0
- package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-BxbCtwpV.d.cts} +43 -4
- package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-RGel43ks.d.ts} +43 -4
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +2 -2
- package/dist/{chunk-M6A4KFIG.js → chunk-4Q2ZDYYU.js} +332 -221
- package/dist/{chunk-WWOTVNPP.js → chunk-A2ZLMH6I.js} +323 -142
- package/dist/{chunk-VA7MV4MZ.js → chunk-B3AMIGJG.js} +1 -1
- package/dist/{chunk-DQYKQJRZ.js → chunk-CIZNCBKE.js} +29 -9
- package/dist/{chunk-BUTZWYBW.js → chunk-DAXGVPVM.js} +2 -2
- package/dist/{chunk-DOA6QXYQ.js → chunk-EKFD62HN.js} +2 -1
- package/dist/{chunk-TIUBYNN5.js → chunk-HTMXTJRK.js} +1 -1
- package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
- package/dist/{chunk-MIVX3GHD.js → chunk-K4BJARWM.js} +1 -1
- package/dist/{chunk-O4RYNJNB.js → chunk-KEKGSH7B.js} +1 -1
- package/dist/{chunk-GYQR4B4P.js → chunk-NBCNYDWJ.js} +2 -2
- package/dist/{chunk-ABZA6R5S.js → chunk-SQKXGAIR.js} +1 -1
- package/dist/{chunk-VFJQNBFX.js → chunk-UBT6EDVJ.js} +5 -2
- package/dist/{chunk-HRQRRDSS.js → chunk-WPTRVD2V.js} +3 -3
- package/dist/{chunk-IRW5TWMH.js → chunk-XX4RRWOX.js} +5 -5
- package/dist/graphql/objects/index.d.cts +5 -43
- package/dist/graphql/objects/index.d.ts +5 -43
- package/dist/graphql/objects/index.js +1 -1
- package/dist/{index-BJOc8Ur-.d.cts → index-CZmDdSts.d.cts} +24 -10
- package/dist/{index-7RYRH5wc.d.ts → index-ClIRO_3y.d.ts} +24 -10
- package/dist/index.cjs +827 -414
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +15 -15
- package/dist/index.node.cjs +830 -417
- package/dist/index.node.d.cts +7 -7
- package/dist/index.node.d.ts +7 -7
- package/dist/index.node.js +18 -18
- package/dist/native/index.cjs +827 -414
- package/dist/native/index.d.cts +88 -23
- package/dist/native/index.d.ts +88 -23
- package/dist/native/index.js +819 -407
- package/dist/{network-D5lKssVl.d.cts → network-CfxLnaot.d.cts} +1 -1
- package/dist/{network-xkBSpaTn.d.ts → network-CroCOQ0B.d.ts} +1 -1
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +2 -2
- package/dist/proto/spark.cjs +332 -221
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +3 -5
- package/dist/proto/spark_token.cjs +149 -9
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-BeCBoozO.d.cts} +1 -1
- package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-CTbTdDbE.d.ts} +1 -1
- package/dist/services/config.cjs +7 -3
- package/dist/services/config.d.cts +4 -4
- package/dist/services/config.d.ts +4 -4
- package/dist/services/config.js +5 -5
- package/dist/services/connection.cjs +334 -218
- package/dist/services/connection.d.cts +4 -4
- package/dist/services/connection.d.ts +4 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +364 -227
- package/dist/services/index.d.cts +4 -4
- package/dist/services/index.d.ts +4 -4
- package/dist/services/index.js +9 -9
- package/dist/services/lrc-connection.cjs +5 -2
- package/dist/services/lrc-connection.d.cts +4 -4
- package/dist/services/lrc-connection.d.ts +4 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +28 -8
- package/dist/services/token-transactions.d.cts +4 -4
- package/dist/services/token-transactions.d.ts +4 -4
- package/dist/services/token-transactions.js +3 -3
- package/dist/services/wallet-config.cjs +2 -1
- package/dist/services/wallet-config.d.cts +4 -4
- package/dist/services/wallet-config.d.ts +4 -4
- package/dist/services/wallet-config.js +1 -1
- package/dist/signer/signer.cjs +5 -2
- package/dist/signer/signer.d.cts +2 -2
- package/dist/signer/signer.d.ts +2 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-wqesWifN.d.ts → signer-D7vfYik9.d.ts} +1 -1
- package/dist/{signer-IO3oMRNj.d.cts → signer-DaY8c60s.d.cts} +1 -1
- package/dist/{spark-CDm4gqS6.d.ts → spark-C4ZrsgjC.d.cts} +47 -29
- package/dist/{spark-CDm4gqS6.d.cts → spark-C4ZrsgjC.d.ts} +47 -29
- package/dist/types/index.cjs +331 -219
- package/dist/types/index.d.cts +5 -5
- package/dist/types/index.d.ts +5 -5
- package/dist/types/index.js +3 -3
- package/dist/utils/index.cjs +298 -28
- package/dist/utils/index.d.cts +5 -5
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +6 -6
- package/package.json +1 -1
- package/src/constants.ts +5 -1
- package/src/graphql/client.ts +28 -0
- package/src/graphql/mutations/RequestCoopExit.ts +6 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
- package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
- package/src/proto/spark.ts +454 -322
- package/src/services/token-transactions.ts +12 -0
- package/src/services/transfer.ts +0 -3
- package/src/services/wallet-config.ts +1 -0
- package/src/spark-wallet/spark-wallet.node.ts +3 -3
- package/src/spark-wallet/spark-wallet.ts +301 -125
- package/src/tests/integration/deposit.test.ts +16 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
- package/src/tests/integration/ssp/swap.test.ts +47 -0
- package/src/tests/tokens.test.ts +3 -2
- package/src/utils/token-hashing.ts +28 -10
- package/src/utils/transaction.ts +2 -2
- package/src/logger.ts +0 -3
package/dist/index.cjs
CHANGED
|
@@ -1494,7 +1494,7 @@ var import_uuidv75 = require("uuidv7");
|
|
|
1494
1494
|
|
|
1495
1495
|
// src/graphql/client.ts
|
|
1496
1496
|
init_buffer();
|
|
1497
|
-
var
|
|
1497
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
1498
1498
|
var import_sha2 = require("@noble/hashes/sha2");
|
|
1499
1499
|
|
|
1500
1500
|
// src/graphql/mutations/ClaimStaticDeposit.ts
|
|
@@ -2063,6 +2063,9 @@ var RequestCoopExit = `
|
|
|
2063
2063
|
$withdrawal_address: String!
|
|
2064
2064
|
$idempotency_key: String!
|
|
2065
2065
|
$exit_speed: ExitSpeed!
|
|
2066
|
+
$withdraw_all: Boolean
|
|
2067
|
+
$fee_leaf_external_ids: [UUID!]
|
|
2068
|
+
$fee_quote_id: ID
|
|
2066
2069
|
) {
|
|
2067
2070
|
request_coop_exit(
|
|
2068
2071
|
input: {
|
|
@@ -2070,6 +2073,9 @@ var RequestCoopExit = `
|
|
|
2070
2073
|
withdrawal_address: $withdrawal_address
|
|
2071
2074
|
idempotency_key: $idempotency_key
|
|
2072
2075
|
exit_speed: $exit_speed
|
|
2076
|
+
withdraw_all: $withdraw_all
|
|
2077
|
+
fee_leaf_external_ids: $fee_leaf_external_ids
|
|
2078
|
+
fee_quote_id: $fee_quote_id
|
|
2073
2079
|
}
|
|
2074
2080
|
) {
|
|
2075
2081
|
request {
|
|
@@ -2314,6 +2320,7 @@ var RequestSwapLeaves = `
|
|
|
2314
2320
|
$fee_sats: Long!
|
|
2315
2321
|
$user_leaves: [UserLeafInput!]!
|
|
2316
2322
|
$idempotency_key: String!
|
|
2323
|
+
$target_amount_sats_list: [Long!]
|
|
2317
2324
|
) {
|
|
2318
2325
|
request_leaves_swap(input: {
|
|
2319
2326
|
adaptor_pubkey: $adaptor_pubkey
|
|
@@ -2322,6 +2329,7 @@ var RequestSwapLeaves = `
|
|
|
2322
2329
|
fee_sats: $fee_sats
|
|
2323
2330
|
user_leaves: $user_leaves
|
|
2324
2331
|
idempotency_key: $idempotency_key
|
|
2332
|
+
target_amount_sats_list: $target_amount_sats_list
|
|
2325
2333
|
}) {
|
|
2326
2334
|
request {
|
|
2327
2335
|
...LeavesSwapRequestFragment
|
|
@@ -2462,6 +2470,106 @@ fragment CoopExitFeeEstimatesOutputFragment on CoopExitFeeEstimatesOutput {
|
|
|
2462
2470
|
}
|
|
2463
2471
|
}`;
|
|
2464
2472
|
|
|
2473
|
+
// src/graphql/objects/CoopExitFeeQuote.ts
|
|
2474
|
+
init_buffer();
|
|
2475
|
+
var import_core5 = require("@lightsparkdev/core");
|
|
2476
|
+
var CoopExitFeeQuoteFromJson = (obj) => {
|
|
2477
|
+
return {
|
|
2478
|
+
id: obj["coop_exit_fee_quote_id"],
|
|
2479
|
+
createdAt: obj["coop_exit_fee_quote_created_at"],
|
|
2480
|
+
updatedAt: obj["coop_exit_fee_quote_updated_at"],
|
|
2481
|
+
network: BitcoinNetwork_default[obj["coop_exit_fee_quote_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
|
|
2482
|
+
totalAmount: CurrencyAmountFromJson(
|
|
2483
|
+
obj["coop_exit_fee_quote_total_amount"]
|
|
2484
|
+
),
|
|
2485
|
+
userFeeFast: CurrencyAmountFromJson(
|
|
2486
|
+
obj["coop_exit_fee_quote_user_fee_fast"]
|
|
2487
|
+
),
|
|
2488
|
+
userFeeMedium: CurrencyAmountFromJson(
|
|
2489
|
+
obj["coop_exit_fee_quote_user_fee_medium"]
|
|
2490
|
+
),
|
|
2491
|
+
userFeeSlow: CurrencyAmountFromJson(
|
|
2492
|
+
obj["coop_exit_fee_quote_user_fee_slow"]
|
|
2493
|
+
),
|
|
2494
|
+
l1BroadcastFeeFast: CurrencyAmountFromJson(
|
|
2495
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_fast"]
|
|
2496
|
+
),
|
|
2497
|
+
l1BroadcastFeeMedium: CurrencyAmountFromJson(
|
|
2498
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_medium"]
|
|
2499
|
+
),
|
|
2500
|
+
l1BroadcastFeeSlow: CurrencyAmountFromJson(
|
|
2501
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_slow"]
|
|
2502
|
+
),
|
|
2503
|
+
expiresAt: obj["coop_exit_fee_quote_expires_at"],
|
|
2504
|
+
typename: "CoopExitFeeQuote"
|
|
2505
|
+
};
|
|
2506
|
+
};
|
|
2507
|
+
var FRAGMENT10 = `
|
|
2508
|
+
fragment CoopExitFeeQuoteFragment on CoopExitFeeQuote {
|
|
2509
|
+
__typename
|
|
2510
|
+
coop_exit_fee_quote_id: id
|
|
2511
|
+
coop_exit_fee_quote_created_at: created_at
|
|
2512
|
+
coop_exit_fee_quote_updated_at: updated_at
|
|
2513
|
+
coop_exit_fee_quote_network: network
|
|
2514
|
+
coop_exit_fee_quote_total_amount: total_amount {
|
|
2515
|
+
__typename
|
|
2516
|
+
currency_amount_original_value: original_value
|
|
2517
|
+
currency_amount_original_unit: original_unit
|
|
2518
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2519
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2520
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2521
|
+
}
|
|
2522
|
+
coop_exit_fee_quote_user_fee_fast: user_fee_fast {
|
|
2523
|
+
__typename
|
|
2524
|
+
currency_amount_original_value: original_value
|
|
2525
|
+
currency_amount_original_unit: original_unit
|
|
2526
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2527
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2528
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2529
|
+
}
|
|
2530
|
+
coop_exit_fee_quote_user_fee_medium: user_fee_medium {
|
|
2531
|
+
__typename
|
|
2532
|
+
currency_amount_original_value: original_value
|
|
2533
|
+
currency_amount_original_unit: original_unit
|
|
2534
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2535
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2536
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2537
|
+
}
|
|
2538
|
+
coop_exit_fee_quote_user_fee_slow: user_fee_slow {
|
|
2539
|
+
__typename
|
|
2540
|
+
currency_amount_original_value: original_value
|
|
2541
|
+
currency_amount_original_unit: original_unit
|
|
2542
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2543
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2544
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2545
|
+
}
|
|
2546
|
+
coop_exit_fee_quote_l1_broadcast_fee_fast: l1_broadcast_fee_fast {
|
|
2547
|
+
__typename
|
|
2548
|
+
currency_amount_original_value: original_value
|
|
2549
|
+
currency_amount_original_unit: original_unit
|
|
2550
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2551
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2552
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2553
|
+
}
|
|
2554
|
+
coop_exit_fee_quote_l1_broadcast_fee_medium: l1_broadcast_fee_medium {
|
|
2555
|
+
__typename
|
|
2556
|
+
currency_amount_original_value: original_value
|
|
2557
|
+
currency_amount_original_unit: original_unit
|
|
2558
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2559
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2560
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2561
|
+
}
|
|
2562
|
+
coop_exit_fee_quote_l1_broadcast_fee_slow: l1_broadcast_fee_slow {
|
|
2563
|
+
__typename
|
|
2564
|
+
currency_amount_original_value: original_value
|
|
2565
|
+
currency_amount_original_unit: original_unit
|
|
2566
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
2567
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
2568
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
2569
|
+
}
|
|
2570
|
+
coop_exit_fee_quote_expires_at: expires_at
|
|
2571
|
+
}`;
|
|
2572
|
+
|
|
2465
2573
|
// src/graphql/objects/LeavesSwapFeeEstimateOutput.ts
|
|
2466
2574
|
init_buffer();
|
|
2467
2575
|
var LeavesSwapFeeEstimateOutputFromJson = (obj) => {
|
|
@@ -2469,7 +2577,7 @@ var LeavesSwapFeeEstimateOutputFromJson = (obj) => {
|
|
|
2469
2577
|
feeEstimate: CurrencyAmountFromJson(obj["leaves_swap_fee_estimate_output_fee_estimate"])
|
|
2470
2578
|
};
|
|
2471
2579
|
};
|
|
2472
|
-
var
|
|
2580
|
+
var FRAGMENT11 = `
|
|
2473
2581
|
fragment LeavesSwapFeeEstimateOutputFragment on LeavesSwapFeeEstimateOutput {
|
|
2474
2582
|
__typename
|
|
2475
2583
|
leaves_swap_fee_estimate_output_fee_estimate: fee_estimate {
|
|
@@ -2489,7 +2597,7 @@ var LightningSendFeeEstimateOutputFromJson = (obj) => {
|
|
|
2489
2597
|
feeEstimate: CurrencyAmountFromJson(obj["lightning_send_fee_estimate_output_fee_estimate"])
|
|
2490
2598
|
};
|
|
2491
2599
|
};
|
|
2492
|
-
var
|
|
2600
|
+
var FRAGMENT12 = `
|
|
2493
2601
|
fragment LightningSendFeeEstimateOutputFragment on LightningSendFeeEstimateOutput {
|
|
2494
2602
|
__typename
|
|
2495
2603
|
lightning_send_fee_estimate_output_fee_estimate: fee_estimate {
|
|
@@ -2513,7 +2621,7 @@ var StaticDepositQuoteOutputFromJson = (obj) => {
|
|
|
2513
2621
|
signature: obj["static_deposit_quote_output_signature"]
|
|
2514
2622
|
};
|
|
2515
2623
|
};
|
|
2516
|
-
var
|
|
2624
|
+
var FRAGMENT13 = `
|
|
2517
2625
|
fragment StaticDepositQuoteOutputFragment on StaticDepositQuoteOutput {
|
|
2518
2626
|
__typename
|
|
2519
2627
|
static_deposit_quote_output_transaction_id: transaction_id
|
|
@@ -2560,7 +2668,28 @@ var GetClaimDepositQuote = `
|
|
|
2560
2668
|
...StaticDepositQuoteOutputFragment
|
|
2561
2669
|
}
|
|
2562
2670
|
}
|
|
2563
|
-
${
|
|
2671
|
+
${FRAGMENT13}
|
|
2672
|
+
`;
|
|
2673
|
+
|
|
2674
|
+
// src/graphql/queries/GetCoopExitFeeQuote.ts
|
|
2675
|
+
init_buffer();
|
|
2676
|
+
var GetCoopExitFeeQuote = `
|
|
2677
|
+
query CoopExitFeeQuote(
|
|
2678
|
+
$leaf_external_ids: [UUID!]!
|
|
2679
|
+
$withdrawal_address: String!
|
|
2680
|
+
) {
|
|
2681
|
+
coop_exit_fee_quote(
|
|
2682
|
+
input: {
|
|
2683
|
+
leaf_external_ids: $leaf_external_ids,
|
|
2684
|
+
withdrawal_address: $withdrawal_address
|
|
2685
|
+
}
|
|
2686
|
+
) {
|
|
2687
|
+
quote {
|
|
2688
|
+
...CoopExitFeeQuoteFragment
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
${FRAGMENT10}
|
|
2564
2693
|
`;
|
|
2565
2694
|
|
|
2566
2695
|
// src/graphql/queries/LeavesSwapFeeEstimate.ts
|
|
@@ -2577,7 +2706,7 @@ var LeavesSwapFeeEstimate = `
|
|
|
2577
2706
|
...LeavesSwapFeeEstimateOutputFragment
|
|
2578
2707
|
}
|
|
2579
2708
|
}
|
|
2580
|
-
${
|
|
2709
|
+
${FRAGMENT11}
|
|
2581
2710
|
`;
|
|
2582
2711
|
|
|
2583
2712
|
// src/graphql/queries/LightningSendFeeEstimate.ts
|
|
@@ -2596,7 +2725,7 @@ var LightningSendFeeEstimate = `
|
|
|
2596
2725
|
...LightningSendFeeEstimateOutputFragment
|
|
2597
2726
|
}
|
|
2598
2727
|
}
|
|
2599
|
-
${
|
|
2728
|
+
${FRAGMENT12}
|
|
2600
2729
|
`;
|
|
2601
2730
|
|
|
2602
2731
|
// src/graphql/queries/Transfer.ts
|
|
@@ -2615,13 +2744,13 @@ init_buffer();
|
|
|
2615
2744
|
|
|
2616
2745
|
// src/graphql/objects/UserRequest.ts
|
|
2617
2746
|
init_buffer();
|
|
2618
|
-
var
|
|
2747
|
+
var import_core6 = require("@lightsparkdev/core");
|
|
2619
2748
|
|
|
2620
2749
|
// src/graphql/objects/ClaimStaticDepositStatus.ts
|
|
2621
2750
|
init_buffer();
|
|
2622
2751
|
|
|
2623
2752
|
// src/graphql/objects/UserRequest.ts
|
|
2624
|
-
var
|
|
2753
|
+
var FRAGMENT14 = `
|
|
2625
2754
|
fragment UserRequestFragment on UserRequest {
|
|
2626
2755
|
__typename
|
|
2627
2756
|
... on ClaimStaticDeposit {
|
|
@@ -2853,7 +2982,7 @@ var UserRequest2 = `
|
|
|
2853
2982
|
...UserRequestFragment
|
|
2854
2983
|
}
|
|
2855
2984
|
}
|
|
2856
|
-
${
|
|
2985
|
+
${FRAGMENT14}
|
|
2857
2986
|
`;
|
|
2858
2987
|
|
|
2859
2988
|
// src/graphql/client.ts
|
|
@@ -2866,13 +2995,13 @@ var SspClient = class {
|
|
|
2866
2995
|
this.authProvider = new SparkAuthProvider();
|
|
2867
2996
|
const fetchFunction = typeof window !== "undefined" ? window.fetch.bind(window) : fetch;
|
|
2868
2997
|
const options = config.sspClientOptions;
|
|
2869
|
-
this.requester = new
|
|
2870
|
-
new
|
|
2998
|
+
this.requester = new import_core7.Requester(
|
|
2999
|
+
new import_core7.NodeKeyCache(import_core7.DefaultCrypto),
|
|
2871
3000
|
options.schemaEndpoint || `graphql/spark/2025-03-19`,
|
|
2872
3001
|
`spark-sdk/0.0.0`,
|
|
2873
3002
|
this.authProvider,
|
|
2874
3003
|
options.baseUrl,
|
|
2875
|
-
|
|
3004
|
+
import_core7.DefaultCrypto,
|
|
2876
3005
|
void 0,
|
|
2877
3006
|
fetchFunction
|
|
2878
3007
|
);
|
|
@@ -2975,7 +3104,10 @@ var SspClient = class {
|
|
|
2975
3104
|
leafExternalIds,
|
|
2976
3105
|
withdrawalAddress,
|
|
2977
3106
|
idempotencyKey,
|
|
2978
|
-
exitSpeed
|
|
3107
|
+
exitSpeed,
|
|
3108
|
+
feeLeafExternalIds,
|
|
3109
|
+
feeQuoteId,
|
|
3110
|
+
withdrawAll
|
|
2979
3111
|
}) {
|
|
2980
3112
|
return await this.executeRawQuery({
|
|
2981
3113
|
queryPayload: RequestCoopExit,
|
|
@@ -2983,7 +3115,10 @@ var SspClient = class {
|
|
|
2983
3115
|
leaf_external_ids: leafExternalIds,
|
|
2984
3116
|
withdrawal_address: withdrawalAddress,
|
|
2985
3117
|
idempotency_key: idempotencyKey,
|
|
2986
|
-
exit_speed: exitSpeed
|
|
3118
|
+
exit_speed: exitSpeed,
|
|
3119
|
+
fee_leaf_external_ids: feeLeafExternalIds,
|
|
3120
|
+
fee_quote_id: feeQuoteId,
|
|
3121
|
+
withdraw_all: withdrawAll
|
|
2987
3122
|
},
|
|
2988
3123
|
constructObject: (response) => {
|
|
2989
3124
|
return CoopExitRequestFromJson(response.request_coop_exit.request);
|
|
@@ -3045,7 +3180,8 @@ var SspClient = class {
|
|
|
3045
3180
|
targetAmountSats,
|
|
3046
3181
|
feeSats,
|
|
3047
3182
|
userLeaves,
|
|
3048
|
-
idempotencyKey
|
|
3183
|
+
idempotencyKey,
|
|
3184
|
+
targetAmountSatsList
|
|
3049
3185
|
}) {
|
|
3050
3186
|
const query = {
|
|
3051
3187
|
queryPayload: RequestSwapLeaves,
|
|
@@ -3055,7 +3191,8 @@ var SspClient = class {
|
|
|
3055
3191
|
target_amount_sats: targetAmountSats,
|
|
3056
3192
|
fee_sats: feeSats,
|
|
3057
3193
|
user_leaves: userLeaves,
|
|
3058
|
-
idempotency_key: idempotencyKey
|
|
3194
|
+
idempotency_key: idempotencyKey,
|
|
3195
|
+
target_amount_sats_list: targetAmountSatsList
|
|
3059
3196
|
},
|
|
3060
3197
|
constructObject: (response) => {
|
|
3061
3198
|
if (!response.request_leaves_swap) {
|
|
@@ -3198,7 +3335,7 @@ var SspClient = class {
|
|
|
3198
3335
|
{
|
|
3199
3336
|
queryPayload: GetChallenge,
|
|
3200
3337
|
variables: {
|
|
3201
|
-
public_key: (0,
|
|
3338
|
+
public_key: (0, import_core7.bytesToHex)(await this.signer.getIdentityPublicKey())
|
|
3202
3339
|
},
|
|
3203
3340
|
constructObject: (response) => {
|
|
3204
3341
|
return GetChallengeOutputFromJson(response.get_challenge);
|
|
@@ -3214,7 +3351,7 @@ var SspClient = class {
|
|
|
3214
3351
|
variables: {
|
|
3215
3352
|
protected_challenge: protectedChallenge,
|
|
3216
3353
|
signature,
|
|
3217
|
-
identity_public_key: (0,
|
|
3354
|
+
identity_public_key: (0, import_core7.bytesToHex)(
|
|
3218
3355
|
await this.signer.getIdentityPublicKey()
|
|
3219
3356
|
)
|
|
3220
3357
|
},
|
|
@@ -3247,6 +3384,21 @@ var SspClient = class {
|
|
|
3247
3384
|
new Date(verifyChallenge.validUntil)
|
|
3248
3385
|
);
|
|
3249
3386
|
}
|
|
3387
|
+
async getCoopExitFeeQuote({
|
|
3388
|
+
leafExternalIds,
|
|
3389
|
+
withdrawalAddress
|
|
3390
|
+
}) {
|
|
3391
|
+
return await this.executeRawQuery({
|
|
3392
|
+
queryPayload: GetCoopExitFeeQuote,
|
|
3393
|
+
variables: {
|
|
3394
|
+
leaf_external_ids: leafExternalIds,
|
|
3395
|
+
withdrawal_address: withdrawalAddress
|
|
3396
|
+
},
|
|
3397
|
+
constructObject: (response) => {
|
|
3398
|
+
return CoopExitFeeQuoteFromJson(response.coop_exit_fee_quote.quote);
|
|
3399
|
+
}
|
|
3400
|
+
});
|
|
3401
|
+
}
|
|
3250
3402
|
};
|
|
3251
3403
|
var SparkAuthProvider = class {
|
|
3252
3404
|
sessionToken;
|
|
@@ -3288,10 +3440,6 @@ init_buffer();
|
|
|
3288
3440
|
|
|
3289
3441
|
// src/graphql/objects/ClaimStaticDeposit.ts
|
|
3290
3442
|
init_buffer();
|
|
3291
|
-
var import_core7 = require("@lightsparkdev/core");
|
|
3292
|
-
|
|
3293
|
-
// src/graphql/objects/CoopExitFeeQuote.ts
|
|
3294
|
-
init_buffer();
|
|
3295
3443
|
var import_core8 = require("@lightsparkdev/core");
|
|
3296
3444
|
|
|
3297
3445
|
// src/graphql/objects/SparkUserRequestStatus.ts
|
|
@@ -3680,7 +3828,7 @@ var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
|
|
|
3680
3828
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING"] = 1] = "TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING";
|
|
3681
3829
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_SENDER_KEY_TWEAKED"] = 2] = "TRANSFER_STATUS_SENDER_KEY_TWEAKED";
|
|
3682
3830
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RECEIVER_KEY_TWEAKED"] = 3] = "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED";
|
|
3683
|
-
TransferStatus2[TransferStatus2["
|
|
3831
|
+
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RECEIVER_REFUND_SIGNED"] = 4] = "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED";
|
|
3684
3832
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_COMPLETED"] = 5] = "TRANSFER_STATUS_COMPLETED";
|
|
3685
3833
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_EXPIRED"] = 6] = "TRANSFER_STATUS_EXPIRED";
|
|
3686
3834
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RETURNED"] = 7] = "TRANSFER_STATUS_RETURNED";
|
|
@@ -3705,8 +3853,8 @@ function transferStatusFromJSON(object) {
|
|
|
3705
3853
|
case "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED":
|
|
3706
3854
|
return 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */;
|
|
3707
3855
|
case 4:
|
|
3708
|
-
case "
|
|
3709
|
-
return 4 /*
|
|
3856
|
+
case "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED":
|
|
3857
|
+
return 4 /* TRANSFER_STATUS_RECEIVER_REFUND_SIGNED */;
|
|
3710
3858
|
case 5:
|
|
3711
3859
|
case "TRANSFER_STATUS_COMPLETED":
|
|
3712
3860
|
return 5 /* TRANSFER_STATUS_COMPLETED */;
|
|
@@ -3741,8 +3889,8 @@ function transferStatusToJSON(object) {
|
|
|
3741
3889
|
return "TRANSFER_STATUS_SENDER_KEY_TWEAKED";
|
|
3742
3890
|
case 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */:
|
|
3743
3891
|
return "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED";
|
|
3744
|
-
case 4 /*
|
|
3745
|
-
return "
|
|
3892
|
+
case 4 /* TRANSFER_STATUS_RECEIVER_REFUND_SIGNED */:
|
|
3893
|
+
return "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED";
|
|
3746
3894
|
case 5 /* TRANSFER_STATUS_COMPLETED */:
|
|
3747
3895
|
return "TRANSFER_STATUS_COMPLETED";
|
|
3748
3896
|
case 6 /* TRANSFER_STATUS_EXPIRED */:
|
|
@@ -4834,7 +4982,7 @@ var SigningJob = {
|
|
|
4834
4982
|
}
|
|
4835
4983
|
};
|
|
4836
4984
|
function createBaseSigningKeyshare() {
|
|
4837
|
-
return { ownerIdentifiers: [], threshold: 0, publicKey: new Uint8Array(0) };
|
|
4985
|
+
return { ownerIdentifiers: [], threshold: 0, publicKey: new Uint8Array(0), publicShares: {}, updatedTime: void 0 };
|
|
4838
4986
|
}
|
|
4839
4987
|
var SigningKeyshare = {
|
|
4840
4988
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -4847,6 +4995,12 @@ var SigningKeyshare = {
|
|
|
4847
4995
|
if (message.publicKey.length !== 0) {
|
|
4848
4996
|
writer.uint32(26).bytes(message.publicKey);
|
|
4849
4997
|
}
|
|
4998
|
+
Object.entries(message.publicShares).forEach(([key, value]) => {
|
|
4999
|
+
SigningKeyshare_PublicSharesEntry.encode({ key, value }, writer.uint32(34).fork()).join();
|
|
5000
|
+
});
|
|
5001
|
+
if (message.updatedTime !== void 0) {
|
|
5002
|
+
Timestamp.encode(toTimestamp(message.updatedTime), writer.uint32(42).fork()).join();
|
|
5003
|
+
}
|
|
4850
5004
|
return writer;
|
|
4851
5005
|
},
|
|
4852
5006
|
decode(input, length) {
|
|
@@ -4877,6 +5031,23 @@ var SigningKeyshare = {
|
|
|
4877
5031
|
message.publicKey = reader.bytes();
|
|
4878
5032
|
continue;
|
|
4879
5033
|
}
|
|
5034
|
+
case 4: {
|
|
5035
|
+
if (tag !== 34) {
|
|
5036
|
+
break;
|
|
5037
|
+
}
|
|
5038
|
+
const entry4 = SigningKeyshare_PublicSharesEntry.decode(reader, reader.uint32());
|
|
5039
|
+
if (entry4.value !== void 0) {
|
|
5040
|
+
message.publicShares[entry4.key] = entry4.value;
|
|
5041
|
+
}
|
|
5042
|
+
continue;
|
|
5043
|
+
}
|
|
5044
|
+
case 5: {
|
|
5045
|
+
if (tag !== 42) {
|
|
5046
|
+
break;
|
|
5047
|
+
}
|
|
5048
|
+
message.updatedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
5049
|
+
continue;
|
|
5050
|
+
}
|
|
4880
5051
|
}
|
|
4881
5052
|
if ((tag & 7) === 4 || tag === 0) {
|
|
4882
5053
|
break;
|
|
@@ -4889,7 +5060,12 @@ var SigningKeyshare = {
|
|
|
4889
5060
|
return {
|
|
4890
5061
|
ownerIdentifiers: globalThis.Array.isArray(object?.ownerIdentifiers) ? object.ownerIdentifiers.map((e) => globalThis.String(e)) : [],
|
|
4891
5062
|
threshold: isSet3(object.threshold) ? globalThis.Number(object.threshold) : 0,
|
|
4892
|
-
publicKey: isSet3(object.publicKey) ? bytesFromBase642(object.publicKey) : new Uint8Array(0)
|
|
5063
|
+
publicKey: isSet3(object.publicKey) ? bytesFromBase642(object.publicKey) : new Uint8Array(0),
|
|
5064
|
+
publicShares: isObject9(object.publicShares) ? Object.entries(object.publicShares).reduce((acc, [key, value]) => {
|
|
5065
|
+
acc[key] = bytesFromBase642(value);
|
|
5066
|
+
return acc;
|
|
5067
|
+
}, {}) : {},
|
|
5068
|
+
updatedTime: isSet3(object.updatedTime) ? fromJsonTimestamp(object.updatedTime) : void 0
|
|
4893
5069
|
};
|
|
4894
5070
|
},
|
|
4895
5071
|
toJSON(message) {
|
|
@@ -4903,6 +5079,18 @@ var SigningKeyshare = {
|
|
|
4903
5079
|
if (message.publicKey.length !== 0) {
|
|
4904
5080
|
obj.publicKey = base64FromBytes2(message.publicKey);
|
|
4905
5081
|
}
|
|
5082
|
+
if (message.publicShares) {
|
|
5083
|
+
const entries = Object.entries(message.publicShares);
|
|
5084
|
+
if (entries.length > 0) {
|
|
5085
|
+
obj.publicShares = {};
|
|
5086
|
+
entries.forEach(([k, v]) => {
|
|
5087
|
+
obj.publicShares[k] = base64FromBytes2(v);
|
|
5088
|
+
});
|
|
5089
|
+
}
|
|
5090
|
+
}
|
|
5091
|
+
if (message.updatedTime !== void 0) {
|
|
5092
|
+
obj.updatedTime = message.updatedTime.toISOString();
|
|
5093
|
+
}
|
|
4906
5094
|
return obj;
|
|
4907
5095
|
},
|
|
4908
5096
|
create(base) {
|
|
@@ -4913,6 +5101,84 @@ var SigningKeyshare = {
|
|
|
4913
5101
|
message.ownerIdentifiers = object.ownerIdentifiers?.map((e) => e) || [];
|
|
4914
5102
|
message.threshold = object.threshold ?? 0;
|
|
4915
5103
|
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
5104
|
+
message.publicShares = Object.entries(object.publicShares ?? {}).reduce(
|
|
5105
|
+
(acc, [key, value]) => {
|
|
5106
|
+
if (value !== void 0) {
|
|
5107
|
+
acc[key] = value;
|
|
5108
|
+
}
|
|
5109
|
+
return acc;
|
|
5110
|
+
},
|
|
5111
|
+
{}
|
|
5112
|
+
);
|
|
5113
|
+
message.updatedTime = object.updatedTime ?? void 0;
|
|
5114
|
+
return message;
|
|
5115
|
+
}
|
|
5116
|
+
};
|
|
5117
|
+
function createBaseSigningKeyshare_PublicSharesEntry() {
|
|
5118
|
+
return { key: "", value: new Uint8Array(0) };
|
|
5119
|
+
}
|
|
5120
|
+
var SigningKeyshare_PublicSharesEntry = {
|
|
5121
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
5122
|
+
if (message.key !== "") {
|
|
5123
|
+
writer.uint32(10).string(message.key);
|
|
5124
|
+
}
|
|
5125
|
+
if (message.value.length !== 0) {
|
|
5126
|
+
writer.uint32(18).bytes(message.value);
|
|
5127
|
+
}
|
|
5128
|
+
return writer;
|
|
5129
|
+
},
|
|
5130
|
+
decode(input, length) {
|
|
5131
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
5132
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
5133
|
+
const message = createBaseSigningKeyshare_PublicSharesEntry();
|
|
5134
|
+
while (reader.pos < end) {
|
|
5135
|
+
const tag = reader.uint32();
|
|
5136
|
+
switch (tag >>> 3) {
|
|
5137
|
+
case 1: {
|
|
5138
|
+
if (tag !== 10) {
|
|
5139
|
+
break;
|
|
5140
|
+
}
|
|
5141
|
+
message.key = reader.string();
|
|
5142
|
+
continue;
|
|
5143
|
+
}
|
|
5144
|
+
case 2: {
|
|
5145
|
+
if (tag !== 18) {
|
|
5146
|
+
break;
|
|
5147
|
+
}
|
|
5148
|
+
message.value = reader.bytes();
|
|
5149
|
+
continue;
|
|
5150
|
+
}
|
|
5151
|
+
}
|
|
5152
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
5153
|
+
break;
|
|
5154
|
+
}
|
|
5155
|
+
reader.skip(tag & 7);
|
|
5156
|
+
}
|
|
5157
|
+
return message;
|
|
5158
|
+
},
|
|
5159
|
+
fromJSON(object) {
|
|
5160
|
+
return {
|
|
5161
|
+
key: isSet3(object.key) ? globalThis.String(object.key) : "",
|
|
5162
|
+
value: isSet3(object.value) ? bytesFromBase642(object.value) : new Uint8Array(0)
|
|
5163
|
+
};
|
|
5164
|
+
},
|
|
5165
|
+
toJSON(message) {
|
|
5166
|
+
const obj = {};
|
|
5167
|
+
if (message.key !== "") {
|
|
5168
|
+
obj.key = message.key;
|
|
5169
|
+
}
|
|
5170
|
+
if (message.value.length !== 0) {
|
|
5171
|
+
obj.value = base64FromBytes2(message.value);
|
|
5172
|
+
}
|
|
5173
|
+
return obj;
|
|
5174
|
+
},
|
|
5175
|
+
create(base) {
|
|
5176
|
+
return SigningKeyshare_PublicSharesEntry.fromPartial(base ?? {});
|
|
5177
|
+
},
|
|
5178
|
+
fromPartial(object) {
|
|
5179
|
+
const message = createBaseSigningKeyshare_PublicSharesEntry();
|
|
5180
|
+
message.key = object.key ?? "";
|
|
5181
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
4916
5182
|
return message;
|
|
4917
5183
|
}
|
|
4918
5184
|
};
|
|
@@ -6609,7 +6875,8 @@ function createBaseStartTokenTransactionRequest() {
|
|
|
6609
6875
|
return {
|
|
6610
6876
|
identityPublicKey: new Uint8Array(0),
|
|
6611
6877
|
partialTokenTransaction: void 0,
|
|
6612
|
-
tokenTransactionSignatures: void 0
|
|
6878
|
+
tokenTransactionSignatures: void 0,
|
|
6879
|
+
sparkPaymentIntent: ""
|
|
6613
6880
|
};
|
|
6614
6881
|
}
|
|
6615
6882
|
var StartTokenTransactionRequest = {
|
|
@@ -6623,6 +6890,9 @@ var StartTokenTransactionRequest = {
|
|
|
6623
6890
|
if (message.tokenTransactionSignatures !== void 0) {
|
|
6624
6891
|
TokenTransactionSignatures.encode(message.tokenTransactionSignatures, writer.uint32(26).fork()).join();
|
|
6625
6892
|
}
|
|
6893
|
+
if (message.sparkPaymentIntent !== "") {
|
|
6894
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
6895
|
+
}
|
|
6626
6896
|
return writer;
|
|
6627
6897
|
},
|
|
6628
6898
|
decode(input, length) {
|
|
@@ -6653,6 +6923,13 @@ var StartTokenTransactionRequest = {
|
|
|
6653
6923
|
message.tokenTransactionSignatures = TokenTransactionSignatures.decode(reader, reader.uint32());
|
|
6654
6924
|
continue;
|
|
6655
6925
|
}
|
|
6926
|
+
case 4: {
|
|
6927
|
+
if (tag !== 34) {
|
|
6928
|
+
break;
|
|
6929
|
+
}
|
|
6930
|
+
message.sparkPaymentIntent = reader.string();
|
|
6931
|
+
continue;
|
|
6932
|
+
}
|
|
6656
6933
|
}
|
|
6657
6934
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6658
6935
|
break;
|
|
@@ -6665,7 +6942,8 @@ var StartTokenTransactionRequest = {
|
|
|
6665
6942
|
return {
|
|
6666
6943
|
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
6667
6944
|
partialTokenTransaction: isSet3(object.partialTokenTransaction) ? TokenTransaction.fromJSON(object.partialTokenTransaction) : void 0,
|
|
6668
|
-
tokenTransactionSignatures: isSet3(object.tokenTransactionSignatures) ? TokenTransactionSignatures.fromJSON(object.tokenTransactionSignatures) : void 0
|
|
6945
|
+
tokenTransactionSignatures: isSet3(object.tokenTransactionSignatures) ? TokenTransactionSignatures.fromJSON(object.tokenTransactionSignatures) : void 0,
|
|
6946
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
6669
6947
|
};
|
|
6670
6948
|
},
|
|
6671
6949
|
toJSON(message) {
|
|
@@ -6679,6 +6957,9 @@ var StartTokenTransactionRequest = {
|
|
|
6679
6957
|
if (message.tokenTransactionSignatures !== void 0) {
|
|
6680
6958
|
obj.tokenTransactionSignatures = TokenTransactionSignatures.toJSON(message.tokenTransactionSignatures);
|
|
6681
6959
|
}
|
|
6960
|
+
if (message.sparkPaymentIntent !== "") {
|
|
6961
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
6962
|
+
}
|
|
6682
6963
|
return obj;
|
|
6683
6964
|
},
|
|
6684
6965
|
create(base) {
|
|
@@ -6689,6 +6970,7 @@ var StartTokenTransactionRequest = {
|
|
|
6689
6970
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
6690
6971
|
message.partialTokenTransaction = object.partialTokenTransaction !== void 0 && object.partialTokenTransaction !== null ? TokenTransaction.fromPartial(object.partialTokenTransaction) : void 0;
|
|
6691
6972
|
message.tokenTransactionSignatures = object.tokenTransactionSignatures !== void 0 && object.tokenTransactionSignatures !== null ? TokenTransactionSignatures.fromPartial(object.tokenTransactionSignatures) : void 0;
|
|
6973
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
6692
6974
|
return message;
|
|
6693
6975
|
}
|
|
6694
6976
|
};
|
|
@@ -7186,7 +7468,12 @@ var RevocationSecretWithIndex = {
|
|
|
7186
7468
|
}
|
|
7187
7469
|
};
|
|
7188
7470
|
function createBaseFinalizeTokenTransactionRequest() {
|
|
7189
|
-
return {
|
|
7471
|
+
return {
|
|
7472
|
+
finalTokenTransaction: void 0,
|
|
7473
|
+
revocationSecrets: [],
|
|
7474
|
+
identityPublicKey: new Uint8Array(0),
|
|
7475
|
+
sparkPaymentIntent: ""
|
|
7476
|
+
};
|
|
7190
7477
|
}
|
|
7191
7478
|
var FinalizeTokenTransactionRequest = {
|
|
7192
7479
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -7199,6 +7486,9 @@ var FinalizeTokenTransactionRequest = {
|
|
|
7199
7486
|
if (message.identityPublicKey.length !== 0) {
|
|
7200
7487
|
writer.uint32(26).bytes(message.identityPublicKey);
|
|
7201
7488
|
}
|
|
7489
|
+
if (message.sparkPaymentIntent !== "") {
|
|
7490
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
7491
|
+
}
|
|
7202
7492
|
return writer;
|
|
7203
7493
|
},
|
|
7204
7494
|
decode(input, length) {
|
|
@@ -7229,6 +7519,13 @@ var FinalizeTokenTransactionRequest = {
|
|
|
7229
7519
|
message.identityPublicKey = reader.bytes();
|
|
7230
7520
|
continue;
|
|
7231
7521
|
}
|
|
7522
|
+
case 4: {
|
|
7523
|
+
if (tag !== 34) {
|
|
7524
|
+
break;
|
|
7525
|
+
}
|
|
7526
|
+
message.sparkPaymentIntent = reader.string();
|
|
7527
|
+
continue;
|
|
7528
|
+
}
|
|
7232
7529
|
}
|
|
7233
7530
|
if ((tag & 7) === 4 || tag === 0) {
|
|
7234
7531
|
break;
|
|
@@ -7241,7 +7538,8 @@ var FinalizeTokenTransactionRequest = {
|
|
|
7241
7538
|
return {
|
|
7242
7539
|
finalTokenTransaction: isSet3(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
|
|
7243
7540
|
revocationSecrets: globalThis.Array.isArray(object?.revocationSecrets) ? object.revocationSecrets.map((e) => RevocationSecretWithIndex.fromJSON(e)) : [],
|
|
7244
|
-
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0)
|
|
7541
|
+
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
7542
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
7245
7543
|
};
|
|
7246
7544
|
},
|
|
7247
7545
|
toJSON(message) {
|
|
@@ -7255,6 +7553,9 @@ var FinalizeTokenTransactionRequest = {
|
|
|
7255
7553
|
if (message.identityPublicKey.length !== 0) {
|
|
7256
7554
|
obj.identityPublicKey = base64FromBytes2(message.identityPublicKey);
|
|
7257
7555
|
}
|
|
7556
|
+
if (message.sparkPaymentIntent !== "") {
|
|
7557
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
7558
|
+
}
|
|
7258
7559
|
return obj;
|
|
7259
7560
|
},
|
|
7260
7561
|
create(base) {
|
|
@@ -7265,6 +7566,7 @@ var FinalizeTokenTransactionRequest = {
|
|
|
7265
7566
|
message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
|
|
7266
7567
|
message.revocationSecrets = object.revocationSecrets?.map((e) => RevocationSecretWithIndex.fromPartial(e)) || [];
|
|
7267
7568
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
7569
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
7268
7570
|
return message;
|
|
7269
7571
|
}
|
|
7270
7572
|
};
|
|
@@ -7957,7 +8259,10 @@ function createBaseTreeNode() {
|
|
|
7957
8259
|
ownerIdentityPublicKey: new Uint8Array(0),
|
|
7958
8260
|
signingKeyshare: void 0,
|
|
7959
8261
|
status: "",
|
|
7960
|
-
network: 0
|
|
8262
|
+
network: 0,
|
|
8263
|
+
createdTime: void 0,
|
|
8264
|
+
updatedTime: void 0,
|
|
8265
|
+
ownerSigningPublicKey: new Uint8Array(0)
|
|
7961
8266
|
};
|
|
7962
8267
|
}
|
|
7963
8268
|
var TreeNode = {
|
|
@@ -7998,6 +8303,15 @@ var TreeNode = {
|
|
|
7998
8303
|
if (message.network !== 0) {
|
|
7999
8304
|
writer.uint32(96).int32(message.network);
|
|
8000
8305
|
}
|
|
8306
|
+
if (message.createdTime !== void 0) {
|
|
8307
|
+
Timestamp.encode(toTimestamp(message.createdTime), writer.uint32(106).fork()).join();
|
|
8308
|
+
}
|
|
8309
|
+
if (message.updatedTime !== void 0) {
|
|
8310
|
+
Timestamp.encode(toTimestamp(message.updatedTime), writer.uint32(114).fork()).join();
|
|
8311
|
+
}
|
|
8312
|
+
if (message.ownerSigningPublicKey.length !== 0) {
|
|
8313
|
+
writer.uint32(122).bytes(message.ownerSigningPublicKey);
|
|
8314
|
+
}
|
|
8001
8315
|
return writer;
|
|
8002
8316
|
},
|
|
8003
8317
|
decode(input, length) {
|
|
@@ -8091,6 +8405,27 @@ var TreeNode = {
|
|
|
8091
8405
|
message.network = reader.int32();
|
|
8092
8406
|
continue;
|
|
8093
8407
|
}
|
|
8408
|
+
case 13: {
|
|
8409
|
+
if (tag !== 106) {
|
|
8410
|
+
break;
|
|
8411
|
+
}
|
|
8412
|
+
message.createdTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
8413
|
+
continue;
|
|
8414
|
+
}
|
|
8415
|
+
case 14: {
|
|
8416
|
+
if (tag !== 114) {
|
|
8417
|
+
break;
|
|
8418
|
+
}
|
|
8419
|
+
message.updatedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
8420
|
+
continue;
|
|
8421
|
+
}
|
|
8422
|
+
case 15: {
|
|
8423
|
+
if (tag !== 122) {
|
|
8424
|
+
break;
|
|
8425
|
+
}
|
|
8426
|
+
message.ownerSigningPublicKey = reader.bytes();
|
|
8427
|
+
continue;
|
|
8428
|
+
}
|
|
8094
8429
|
}
|
|
8095
8430
|
if ((tag & 7) === 4 || tag === 0) {
|
|
8096
8431
|
break;
|
|
@@ -8112,7 +8447,10 @@ var TreeNode = {
|
|
|
8112
8447
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
8113
8448
|
signingKeyshare: isSet3(object.signingKeyshare) ? SigningKeyshare.fromJSON(object.signingKeyshare) : void 0,
|
|
8114
8449
|
status: isSet3(object.status) ? globalThis.String(object.status) : "",
|
|
8115
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
8450
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
8451
|
+
createdTime: isSet3(object.createdTime) ? fromJsonTimestamp(object.createdTime) : void 0,
|
|
8452
|
+
updatedTime: isSet3(object.updatedTime) ? fromJsonTimestamp(object.updatedTime) : void 0,
|
|
8453
|
+
ownerSigningPublicKey: isSet3(object.ownerSigningPublicKey) ? bytesFromBase642(object.ownerSigningPublicKey) : new Uint8Array(0)
|
|
8116
8454
|
};
|
|
8117
8455
|
},
|
|
8118
8456
|
toJSON(message) {
|
|
@@ -8153,6 +8491,15 @@ var TreeNode = {
|
|
|
8153
8491
|
if (message.network !== 0) {
|
|
8154
8492
|
obj.network = networkToJSON(message.network);
|
|
8155
8493
|
}
|
|
8494
|
+
if (message.createdTime !== void 0) {
|
|
8495
|
+
obj.createdTime = message.createdTime.toISOString();
|
|
8496
|
+
}
|
|
8497
|
+
if (message.updatedTime !== void 0) {
|
|
8498
|
+
obj.updatedTime = message.updatedTime.toISOString();
|
|
8499
|
+
}
|
|
8500
|
+
if (message.ownerSigningPublicKey.length !== 0) {
|
|
8501
|
+
obj.ownerSigningPublicKey = base64FromBytes2(message.ownerSigningPublicKey);
|
|
8502
|
+
}
|
|
8156
8503
|
return obj;
|
|
8157
8504
|
},
|
|
8158
8505
|
create(base) {
|
|
@@ -8172,6 +8519,9 @@ var TreeNode = {
|
|
|
8172
8519
|
message.signingKeyshare = object.signingKeyshare !== void 0 && object.signingKeyshare !== null ? SigningKeyshare.fromPartial(object.signingKeyshare) : void 0;
|
|
8173
8520
|
message.status = object.status ?? "";
|
|
8174
8521
|
message.network = object.network ?? 0;
|
|
8522
|
+
message.createdTime = object.createdTime ?? void 0;
|
|
8523
|
+
message.updatedTime = object.updatedTime ?? void 0;
|
|
8524
|
+
message.ownerSigningPublicKey = object.ownerSigningPublicKey ?? new Uint8Array(0);
|
|
8175
8525
|
return message;
|
|
8176
8526
|
}
|
|
8177
8527
|
};
|
|
@@ -8774,7 +9124,8 @@ function createBaseStartTransferRequest() {
|
|
|
8774
9124
|
leavesToSend: [],
|
|
8775
9125
|
receiverIdentityPublicKey: new Uint8Array(0),
|
|
8776
9126
|
expiryTime: void 0,
|
|
8777
|
-
transferPackage: void 0
|
|
9127
|
+
transferPackage: void 0,
|
|
9128
|
+
sparkPaymentIntent: ""
|
|
8778
9129
|
};
|
|
8779
9130
|
}
|
|
8780
9131
|
var StartTransferRequest = {
|
|
@@ -8797,6 +9148,9 @@ var StartTransferRequest = {
|
|
|
8797
9148
|
if (message.transferPackage !== void 0) {
|
|
8798
9149
|
TransferPackage.encode(message.transferPackage, writer.uint32(58).fork()).join();
|
|
8799
9150
|
}
|
|
9151
|
+
if (message.sparkPaymentIntent !== "") {
|
|
9152
|
+
writer.uint32(74).string(message.sparkPaymentIntent);
|
|
9153
|
+
}
|
|
8800
9154
|
return writer;
|
|
8801
9155
|
},
|
|
8802
9156
|
decode(input, length) {
|
|
@@ -8848,6 +9202,13 @@ var StartTransferRequest = {
|
|
|
8848
9202
|
message.transferPackage = TransferPackage.decode(reader, reader.uint32());
|
|
8849
9203
|
continue;
|
|
8850
9204
|
}
|
|
9205
|
+
case 9: {
|
|
9206
|
+
if (tag !== 74) {
|
|
9207
|
+
break;
|
|
9208
|
+
}
|
|
9209
|
+
message.sparkPaymentIntent = reader.string();
|
|
9210
|
+
continue;
|
|
9211
|
+
}
|
|
8851
9212
|
}
|
|
8852
9213
|
if ((tag & 7) === 4 || tag === 0) {
|
|
8853
9214
|
break;
|
|
@@ -8863,7 +9224,8 @@ var StartTransferRequest = {
|
|
|
8863
9224
|
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : [],
|
|
8864
9225
|
receiverIdentityPublicKey: isSet3(object.receiverIdentityPublicKey) ? bytesFromBase642(object.receiverIdentityPublicKey) : new Uint8Array(0),
|
|
8865
9226
|
expiryTime: isSet3(object.expiryTime) ? fromJsonTimestamp(object.expiryTime) : void 0,
|
|
8866
|
-
transferPackage: isSet3(object.transferPackage) ? TransferPackage.fromJSON(object.transferPackage) : void 0
|
|
9227
|
+
transferPackage: isSet3(object.transferPackage) ? TransferPackage.fromJSON(object.transferPackage) : void 0,
|
|
9228
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
8867
9229
|
};
|
|
8868
9230
|
},
|
|
8869
9231
|
toJSON(message) {
|
|
@@ -8886,6 +9248,9 @@ var StartTransferRequest = {
|
|
|
8886
9248
|
if (message.transferPackage !== void 0) {
|
|
8887
9249
|
obj.transferPackage = TransferPackage.toJSON(message.transferPackage);
|
|
8888
9250
|
}
|
|
9251
|
+
if (message.sparkPaymentIntent !== "") {
|
|
9252
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
9253
|
+
}
|
|
8889
9254
|
return obj;
|
|
8890
9255
|
},
|
|
8891
9256
|
create(base) {
|
|
@@ -8899,6 +9264,7 @@ var StartTransferRequest = {
|
|
|
8899
9264
|
message.receiverIdentityPublicKey = object.receiverIdentityPublicKey ?? new Uint8Array(0);
|
|
8900
9265
|
message.expiryTime = object.expiryTime ?? void 0;
|
|
8901
9266
|
message.transferPackage = object.transferPackage !== void 0 && object.transferPackage !== null ? TransferPackage.fromPartial(object.transferPackage) : void 0;
|
|
9267
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
8902
9268
|
return message;
|
|
8903
9269
|
}
|
|
8904
9270
|
};
|
|
@@ -9418,7 +9784,7 @@ var SendLeafKeyTweak_PubkeySharesTweakEntry = {
|
|
|
9418
9784
|
}
|
|
9419
9785
|
};
|
|
9420
9786
|
function createBaseFinalizeTransferRequest() {
|
|
9421
|
-
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), leavesToSend: [] };
|
|
9787
|
+
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), leavesToSend: [], sparkPaymentIntent: "" };
|
|
9422
9788
|
}
|
|
9423
9789
|
var FinalizeTransferRequest = {
|
|
9424
9790
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -9431,6 +9797,9 @@ var FinalizeTransferRequest = {
|
|
|
9431
9797
|
for (const v of message.leavesToSend) {
|
|
9432
9798
|
SendLeafKeyTweak.encode(v, writer.uint32(26).fork()).join();
|
|
9433
9799
|
}
|
|
9800
|
+
if (message.sparkPaymentIntent !== "") {
|
|
9801
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
9802
|
+
}
|
|
9434
9803
|
return writer;
|
|
9435
9804
|
},
|
|
9436
9805
|
decode(input, length) {
|
|
@@ -9461,6 +9830,13 @@ var FinalizeTransferRequest = {
|
|
|
9461
9830
|
message.leavesToSend.push(SendLeafKeyTweak.decode(reader, reader.uint32()));
|
|
9462
9831
|
continue;
|
|
9463
9832
|
}
|
|
9833
|
+
case 4: {
|
|
9834
|
+
if (tag !== 34) {
|
|
9835
|
+
break;
|
|
9836
|
+
}
|
|
9837
|
+
message.sparkPaymentIntent = reader.string();
|
|
9838
|
+
continue;
|
|
9839
|
+
}
|
|
9464
9840
|
}
|
|
9465
9841
|
if ((tag & 7) === 4 || tag === 0) {
|
|
9466
9842
|
break;
|
|
@@ -9473,7 +9849,8 @@ var FinalizeTransferRequest = {
|
|
|
9473
9849
|
return {
|
|
9474
9850
|
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
9475
9851
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
9476
|
-
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => SendLeafKeyTweak.fromJSON(e)) : []
|
|
9852
|
+
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => SendLeafKeyTweak.fromJSON(e)) : [],
|
|
9853
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
9477
9854
|
};
|
|
9478
9855
|
},
|
|
9479
9856
|
toJSON(message) {
|
|
@@ -9487,6 +9864,9 @@ var FinalizeTransferRequest = {
|
|
|
9487
9864
|
if (message.leavesToSend?.length) {
|
|
9488
9865
|
obj.leavesToSend = message.leavesToSend.map((e) => SendLeafKeyTweak.toJSON(e));
|
|
9489
9866
|
}
|
|
9867
|
+
if (message.sparkPaymentIntent !== "") {
|
|
9868
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
9869
|
+
}
|
|
9490
9870
|
return obj;
|
|
9491
9871
|
},
|
|
9492
9872
|
create(base) {
|
|
@@ -9497,6 +9877,7 @@ var FinalizeTransferRequest = {
|
|
|
9497
9877
|
message.transferId = object.transferId ?? "";
|
|
9498
9878
|
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
9499
9879
|
message.leavesToSend = object.leavesToSend?.map((e) => SendLeafKeyTweak.fromPartial(e)) || [];
|
|
9880
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
9500
9881
|
return message;
|
|
9501
9882
|
}
|
|
9502
9883
|
};
|
|
@@ -9937,7 +10318,7 @@ var TransferLeaf = {
|
|
|
9937
10318
|
}
|
|
9938
10319
|
};
|
|
9939
10320
|
function createBaseTransferFilter() {
|
|
9940
|
-
return { participant: void 0, transferIds: [], limit: 0, offset: 0, types: [], network: 0 };
|
|
10321
|
+
return { participant: void 0, transferIds: [], limit: 0, offset: 0, types: [], network: 0, statuses: [] };
|
|
9941
10322
|
}
|
|
9942
10323
|
var TransferFilter = {
|
|
9943
10324
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -9969,6 +10350,11 @@ var TransferFilter = {
|
|
|
9969
10350
|
if (message.network !== 0) {
|
|
9970
10351
|
writer.uint32(32).int32(message.network);
|
|
9971
10352
|
}
|
|
10353
|
+
writer.uint32(642).fork();
|
|
10354
|
+
for (const v of message.statuses) {
|
|
10355
|
+
writer.int32(v);
|
|
10356
|
+
}
|
|
10357
|
+
writer.join();
|
|
9972
10358
|
return writer;
|
|
9973
10359
|
},
|
|
9974
10360
|
decode(input, length) {
|
|
@@ -10044,6 +10430,20 @@ var TransferFilter = {
|
|
|
10044
10430
|
message.network = reader.int32();
|
|
10045
10431
|
continue;
|
|
10046
10432
|
}
|
|
10433
|
+
case 80: {
|
|
10434
|
+
if (tag === 640) {
|
|
10435
|
+
message.statuses.push(reader.int32());
|
|
10436
|
+
continue;
|
|
10437
|
+
}
|
|
10438
|
+
if (tag === 642) {
|
|
10439
|
+
const end2 = reader.uint32() + reader.pos;
|
|
10440
|
+
while (reader.pos < end2) {
|
|
10441
|
+
message.statuses.push(reader.int32());
|
|
10442
|
+
}
|
|
10443
|
+
continue;
|
|
10444
|
+
}
|
|
10445
|
+
break;
|
|
10446
|
+
}
|
|
10047
10447
|
}
|
|
10048
10448
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10049
10449
|
break;
|
|
@@ -10065,7 +10465,8 @@ var TransferFilter = {
|
|
|
10065
10465
|
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
10066
10466
|
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
10067
10467
|
types: globalThis.Array.isArray(object?.types) ? object.types.map((e) => transferTypeFromJSON(e)) : [],
|
|
10068
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
10468
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
10469
|
+
statuses: globalThis.Array.isArray(object?.statuses) ? object.statuses.map((e) => transferStatusFromJSON(e)) : []
|
|
10069
10470
|
};
|
|
10070
10471
|
},
|
|
10071
10472
|
toJSON(message) {
|
|
@@ -10092,6 +10493,9 @@ var TransferFilter = {
|
|
|
10092
10493
|
if (message.network !== 0) {
|
|
10093
10494
|
obj.network = networkToJSON(message.network);
|
|
10094
10495
|
}
|
|
10496
|
+
if (message.statuses?.length) {
|
|
10497
|
+
obj.statuses = message.statuses.map((e) => transferStatusToJSON(e));
|
|
10498
|
+
}
|
|
10095
10499
|
return obj;
|
|
10096
10500
|
},
|
|
10097
10501
|
create(base) {
|
|
@@ -10133,6 +10537,7 @@ var TransferFilter = {
|
|
|
10133
10537
|
message.offset = object.offset ?? 0;
|
|
10134
10538
|
message.types = object.types?.map((e) => e) || [];
|
|
10135
10539
|
message.network = object.network ?? 0;
|
|
10540
|
+
message.statuses = object.statuses?.map((e) => e) || [];
|
|
10136
10541
|
return message;
|
|
10137
10542
|
}
|
|
10138
10543
|
};
|
|
@@ -10431,189 +10836,53 @@ var ClaimTransferTweakKeysRequest = {
|
|
|
10431
10836
|
return {
|
|
10432
10837
|
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
10433
10838
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
10434
|
-
leavesToReceive: globalThis.Array.isArray(object?.leavesToReceive) ? object.leavesToReceive.map((e) => ClaimLeafKeyTweak.fromJSON(e)) : []
|
|
10435
|
-
};
|
|
10436
|
-
},
|
|
10437
|
-
toJSON(message) {
|
|
10438
|
-
const obj = {};
|
|
10439
|
-
if (message.transferId !== "") {
|
|
10440
|
-
obj.transferId = message.transferId;
|
|
10441
|
-
}
|
|
10442
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10443
|
-
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
10444
|
-
}
|
|
10445
|
-
if (message.leavesToReceive?.length) {
|
|
10446
|
-
obj.leavesToReceive = message.leavesToReceive.map((e) => ClaimLeafKeyTweak.toJSON(e));
|
|
10447
|
-
}
|
|
10448
|
-
return obj;
|
|
10449
|
-
},
|
|
10450
|
-
create(base) {
|
|
10451
|
-
return ClaimTransferTweakKeysRequest.fromPartial(base ?? {});
|
|
10452
|
-
},
|
|
10453
|
-
fromPartial(object) {
|
|
10454
|
-
const message = createBaseClaimTransferTweakKeysRequest();
|
|
10455
|
-
message.transferId = object.transferId ?? "";
|
|
10456
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
10457
|
-
message.leavesToReceive = object.leavesToReceive?.map((e) => ClaimLeafKeyTweak.fromPartial(e)) || [];
|
|
10458
|
-
return message;
|
|
10459
|
-
}
|
|
10460
|
-
};
|
|
10461
|
-
function createBaseClaimTransferSignRefundsRequest() {
|
|
10462
|
-
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), signingJobs: [] };
|
|
10463
|
-
}
|
|
10464
|
-
var ClaimTransferSignRefundsRequest = {
|
|
10465
|
-
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
10466
|
-
if (message.transferId !== "") {
|
|
10467
|
-
writer.uint32(10).string(message.transferId);
|
|
10468
|
-
}
|
|
10469
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10470
|
-
writer.uint32(18).bytes(message.ownerIdentityPublicKey);
|
|
10471
|
-
}
|
|
10472
|
-
for (const v of message.signingJobs) {
|
|
10473
|
-
LeafRefundTxSigningJob.encode(v, writer.uint32(26).fork()).join();
|
|
10474
|
-
}
|
|
10475
|
-
return writer;
|
|
10476
|
-
},
|
|
10477
|
-
decode(input, length) {
|
|
10478
|
-
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
10479
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
10480
|
-
const message = createBaseClaimTransferSignRefundsRequest();
|
|
10481
|
-
while (reader.pos < end) {
|
|
10482
|
-
const tag = reader.uint32();
|
|
10483
|
-
switch (tag >>> 3) {
|
|
10484
|
-
case 1: {
|
|
10485
|
-
if (tag !== 10) {
|
|
10486
|
-
break;
|
|
10487
|
-
}
|
|
10488
|
-
message.transferId = reader.string();
|
|
10489
|
-
continue;
|
|
10490
|
-
}
|
|
10491
|
-
case 2: {
|
|
10492
|
-
if (tag !== 18) {
|
|
10493
|
-
break;
|
|
10494
|
-
}
|
|
10495
|
-
message.ownerIdentityPublicKey = reader.bytes();
|
|
10496
|
-
continue;
|
|
10497
|
-
}
|
|
10498
|
-
case 3: {
|
|
10499
|
-
if (tag !== 26) {
|
|
10500
|
-
break;
|
|
10501
|
-
}
|
|
10502
|
-
message.signingJobs.push(LeafRefundTxSigningJob.decode(reader, reader.uint32()));
|
|
10503
|
-
continue;
|
|
10504
|
-
}
|
|
10505
|
-
}
|
|
10506
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
10507
|
-
break;
|
|
10508
|
-
}
|
|
10509
|
-
reader.skip(tag & 7);
|
|
10510
|
-
}
|
|
10511
|
-
return message;
|
|
10512
|
-
},
|
|
10513
|
-
fromJSON(object) {
|
|
10514
|
-
return {
|
|
10515
|
-
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
10516
|
-
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
10517
|
-
signingJobs: globalThis.Array.isArray(object?.signingJobs) ? object.signingJobs.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : []
|
|
10518
|
-
};
|
|
10519
|
-
},
|
|
10520
|
-
toJSON(message) {
|
|
10521
|
-
const obj = {};
|
|
10522
|
-
if (message.transferId !== "") {
|
|
10523
|
-
obj.transferId = message.transferId;
|
|
10524
|
-
}
|
|
10525
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10526
|
-
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
10527
|
-
}
|
|
10528
|
-
if (message.signingJobs?.length) {
|
|
10529
|
-
obj.signingJobs = message.signingJobs.map((e) => LeafRefundTxSigningJob.toJSON(e));
|
|
10530
|
-
}
|
|
10531
|
-
return obj;
|
|
10532
|
-
},
|
|
10533
|
-
create(base) {
|
|
10534
|
-
return ClaimTransferSignRefundsRequest.fromPartial(base ?? {});
|
|
10535
|
-
},
|
|
10536
|
-
fromPartial(object) {
|
|
10537
|
-
const message = createBaseClaimTransferSignRefundsRequest();
|
|
10538
|
-
message.transferId = object.transferId ?? "";
|
|
10539
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
10540
|
-
message.signingJobs = object.signingJobs?.map((e) => LeafRefundTxSigningJob.fromPartial(e)) || [];
|
|
10541
|
-
return message;
|
|
10542
|
-
}
|
|
10543
|
-
};
|
|
10544
|
-
function createBaseClaimTransferSignRefundsResponse() {
|
|
10545
|
-
return { signingResults: [] };
|
|
10546
|
-
}
|
|
10547
|
-
var ClaimTransferSignRefundsResponse = {
|
|
10548
|
-
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
10549
|
-
for (const v of message.signingResults) {
|
|
10550
|
-
LeafRefundTxSigningResult.encode(v, writer.uint32(10).fork()).join();
|
|
10551
|
-
}
|
|
10552
|
-
return writer;
|
|
10553
|
-
},
|
|
10554
|
-
decode(input, length) {
|
|
10555
|
-
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
10556
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
10557
|
-
const message = createBaseClaimTransferSignRefundsResponse();
|
|
10558
|
-
while (reader.pos < end) {
|
|
10559
|
-
const tag = reader.uint32();
|
|
10560
|
-
switch (tag >>> 3) {
|
|
10561
|
-
case 1: {
|
|
10562
|
-
if (tag !== 10) {
|
|
10563
|
-
break;
|
|
10564
|
-
}
|
|
10565
|
-
message.signingResults.push(LeafRefundTxSigningResult.decode(reader, reader.uint32()));
|
|
10566
|
-
continue;
|
|
10567
|
-
}
|
|
10568
|
-
}
|
|
10569
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
10570
|
-
break;
|
|
10571
|
-
}
|
|
10572
|
-
reader.skip(tag & 7);
|
|
10573
|
-
}
|
|
10574
|
-
return message;
|
|
10575
|
-
},
|
|
10576
|
-
fromJSON(object) {
|
|
10577
|
-
return {
|
|
10578
|
-
signingResults: globalThis.Array.isArray(object?.signingResults) ? object.signingResults.map((e) => LeafRefundTxSigningResult.fromJSON(e)) : []
|
|
10839
|
+
leavesToReceive: globalThis.Array.isArray(object?.leavesToReceive) ? object.leavesToReceive.map((e) => ClaimLeafKeyTweak.fromJSON(e)) : []
|
|
10579
10840
|
};
|
|
10580
10841
|
},
|
|
10581
10842
|
toJSON(message) {
|
|
10582
10843
|
const obj = {};
|
|
10583
|
-
if (message.
|
|
10584
|
-
obj.
|
|
10844
|
+
if (message.transferId !== "") {
|
|
10845
|
+
obj.transferId = message.transferId;
|
|
10846
|
+
}
|
|
10847
|
+
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10848
|
+
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
10849
|
+
}
|
|
10850
|
+
if (message.leavesToReceive?.length) {
|
|
10851
|
+
obj.leavesToReceive = message.leavesToReceive.map((e) => ClaimLeafKeyTweak.toJSON(e));
|
|
10585
10852
|
}
|
|
10586
10853
|
return obj;
|
|
10587
10854
|
},
|
|
10588
10855
|
create(base) {
|
|
10589
|
-
return
|
|
10856
|
+
return ClaimTransferTweakKeysRequest.fromPartial(base ?? {});
|
|
10590
10857
|
},
|
|
10591
10858
|
fromPartial(object) {
|
|
10592
|
-
const message =
|
|
10593
|
-
message.
|
|
10859
|
+
const message = createBaseClaimTransferTweakKeysRequest();
|
|
10860
|
+
message.transferId = object.transferId ?? "";
|
|
10861
|
+
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
10862
|
+
message.leavesToReceive = object.leavesToReceive?.map((e) => ClaimLeafKeyTweak.fromPartial(e)) || [];
|
|
10594
10863
|
return message;
|
|
10595
10864
|
}
|
|
10596
10865
|
};
|
|
10597
|
-
function
|
|
10598
|
-
return {
|
|
10866
|
+
function createBaseClaimTransferSignRefundsRequest() {
|
|
10867
|
+
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), signingJobs: [] };
|
|
10599
10868
|
}
|
|
10600
|
-
var
|
|
10869
|
+
var ClaimTransferSignRefundsRequest = {
|
|
10601
10870
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
10602
|
-
|
|
10603
|
-
writer.uint32(10).string(
|
|
10604
|
-
}
|
|
10605
|
-
if (message.signingJob !== void 0) {
|
|
10606
|
-
SigningJob.encode(message.signingJob, writer.uint32(18).fork()).join();
|
|
10871
|
+
if (message.transferId !== "") {
|
|
10872
|
+
writer.uint32(10).string(message.transferId);
|
|
10607
10873
|
}
|
|
10608
10874
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10609
|
-
writer.uint32(
|
|
10875
|
+
writer.uint32(18).bytes(message.ownerIdentityPublicKey);
|
|
10876
|
+
}
|
|
10877
|
+
for (const v of message.signingJobs) {
|
|
10878
|
+
LeafRefundTxSigningJob.encode(v, writer.uint32(26).fork()).join();
|
|
10610
10879
|
}
|
|
10611
10880
|
return writer;
|
|
10612
10881
|
},
|
|
10613
10882
|
decode(input, length) {
|
|
10614
10883
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
10615
10884
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
10616
|
-
const message =
|
|
10885
|
+
const message = createBaseClaimTransferSignRefundsRequest();
|
|
10617
10886
|
while (reader.pos < end) {
|
|
10618
10887
|
const tag = reader.uint32();
|
|
10619
10888
|
switch (tag >>> 3) {
|
|
@@ -10621,21 +10890,21 @@ var AggregateNodesRequest = {
|
|
|
10621
10890
|
if (tag !== 10) {
|
|
10622
10891
|
break;
|
|
10623
10892
|
}
|
|
10624
|
-
message.
|
|
10893
|
+
message.transferId = reader.string();
|
|
10625
10894
|
continue;
|
|
10626
10895
|
}
|
|
10627
10896
|
case 2: {
|
|
10628
10897
|
if (tag !== 18) {
|
|
10629
10898
|
break;
|
|
10630
10899
|
}
|
|
10631
|
-
message.
|
|
10900
|
+
message.ownerIdentityPublicKey = reader.bytes();
|
|
10632
10901
|
continue;
|
|
10633
10902
|
}
|
|
10634
10903
|
case 3: {
|
|
10635
10904
|
if (tag !== 26) {
|
|
10636
10905
|
break;
|
|
10637
10906
|
}
|
|
10638
|
-
message.
|
|
10907
|
+
message.signingJobs.push(LeafRefundTxSigningJob.decode(reader, reader.uint32()));
|
|
10639
10908
|
continue;
|
|
10640
10909
|
}
|
|
10641
10910
|
}
|
|
@@ -10648,63 +10917,49 @@ var AggregateNodesRequest = {
|
|
|
10648
10917
|
},
|
|
10649
10918
|
fromJSON(object) {
|
|
10650
10919
|
return {
|
|
10651
|
-
|
|
10652
|
-
|
|
10653
|
-
|
|
10920
|
+
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
10921
|
+
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
10922
|
+
signingJobs: globalThis.Array.isArray(object?.signingJobs) ? object.signingJobs.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : []
|
|
10654
10923
|
};
|
|
10655
10924
|
},
|
|
10656
10925
|
toJSON(message) {
|
|
10657
10926
|
const obj = {};
|
|
10658
|
-
if (message.
|
|
10659
|
-
obj.
|
|
10660
|
-
}
|
|
10661
|
-
if (message.signingJob !== void 0) {
|
|
10662
|
-
obj.signingJob = SigningJob.toJSON(message.signingJob);
|
|
10927
|
+
if (message.transferId !== "") {
|
|
10928
|
+
obj.transferId = message.transferId;
|
|
10663
10929
|
}
|
|
10664
10930
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
10665
10931
|
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
10666
10932
|
}
|
|
10933
|
+
if (message.signingJobs?.length) {
|
|
10934
|
+
obj.signingJobs = message.signingJobs.map((e) => LeafRefundTxSigningJob.toJSON(e));
|
|
10935
|
+
}
|
|
10667
10936
|
return obj;
|
|
10668
10937
|
},
|
|
10669
10938
|
create(base) {
|
|
10670
|
-
return
|
|
10939
|
+
return ClaimTransferSignRefundsRequest.fromPartial(base ?? {});
|
|
10671
10940
|
},
|
|
10672
10941
|
fromPartial(object) {
|
|
10673
|
-
const message =
|
|
10674
|
-
message.
|
|
10675
|
-
message.signingJob = object.signingJob !== void 0 && object.signingJob !== null ? SigningJob.fromPartial(object.signingJob) : void 0;
|
|
10942
|
+
const message = createBaseClaimTransferSignRefundsRequest();
|
|
10943
|
+
message.transferId = object.transferId ?? "";
|
|
10676
10944
|
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
10945
|
+
message.signingJobs = object.signingJobs?.map((e) => LeafRefundTxSigningJob.fromPartial(e)) || [];
|
|
10677
10946
|
return message;
|
|
10678
10947
|
}
|
|
10679
10948
|
};
|
|
10680
|
-
function
|
|
10681
|
-
return {
|
|
10682
|
-
aggregateSignature: void 0,
|
|
10683
|
-
verifyingKey: new Uint8Array(0),
|
|
10684
|
-
parentNodeTx: new Uint8Array(0),
|
|
10685
|
-
parentNodeVout: 0
|
|
10686
|
-
};
|
|
10949
|
+
function createBaseClaimTransferSignRefundsResponse() {
|
|
10950
|
+
return { signingResults: [] };
|
|
10687
10951
|
}
|
|
10688
|
-
var
|
|
10952
|
+
var ClaimTransferSignRefundsResponse = {
|
|
10689
10953
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
}
|
|
10693
|
-
if (message.verifyingKey.length !== 0) {
|
|
10694
|
-
writer.uint32(18).bytes(message.verifyingKey);
|
|
10695
|
-
}
|
|
10696
|
-
if (message.parentNodeTx.length !== 0) {
|
|
10697
|
-
writer.uint32(26).bytes(message.parentNodeTx);
|
|
10698
|
-
}
|
|
10699
|
-
if (message.parentNodeVout !== 0) {
|
|
10700
|
-
writer.uint32(32).uint32(message.parentNodeVout);
|
|
10954
|
+
for (const v of message.signingResults) {
|
|
10955
|
+
LeafRefundTxSigningResult.encode(v, writer.uint32(10).fork()).join();
|
|
10701
10956
|
}
|
|
10702
10957
|
return writer;
|
|
10703
10958
|
},
|
|
10704
10959
|
decode(input, length) {
|
|
10705
10960
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
10706
10961
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
10707
|
-
const message =
|
|
10962
|
+
const message = createBaseClaimTransferSignRefundsResponse();
|
|
10708
10963
|
while (reader.pos < end) {
|
|
10709
10964
|
const tag = reader.uint32();
|
|
10710
10965
|
switch (tag >>> 3) {
|
|
@@ -10712,28 +10967,7 @@ var AggregateNodesResponse = {
|
|
|
10712
10967
|
if (tag !== 10) {
|
|
10713
10968
|
break;
|
|
10714
10969
|
}
|
|
10715
|
-
message.
|
|
10716
|
-
continue;
|
|
10717
|
-
}
|
|
10718
|
-
case 2: {
|
|
10719
|
-
if (tag !== 18) {
|
|
10720
|
-
break;
|
|
10721
|
-
}
|
|
10722
|
-
message.verifyingKey = reader.bytes();
|
|
10723
|
-
continue;
|
|
10724
|
-
}
|
|
10725
|
-
case 3: {
|
|
10726
|
-
if (tag !== 26) {
|
|
10727
|
-
break;
|
|
10728
|
-
}
|
|
10729
|
-
message.parentNodeTx = reader.bytes();
|
|
10730
|
-
continue;
|
|
10731
|
-
}
|
|
10732
|
-
case 4: {
|
|
10733
|
-
if (tag !== 32) {
|
|
10734
|
-
break;
|
|
10735
|
-
}
|
|
10736
|
-
message.parentNodeVout = reader.uint32();
|
|
10970
|
+
message.signingResults.push(LeafRefundTxSigningResult.decode(reader, reader.uint32()));
|
|
10737
10971
|
continue;
|
|
10738
10972
|
}
|
|
10739
10973
|
}
|
|
@@ -10746,37 +10980,22 @@ var AggregateNodesResponse = {
|
|
|
10746
10980
|
},
|
|
10747
10981
|
fromJSON(object) {
|
|
10748
10982
|
return {
|
|
10749
|
-
|
|
10750
|
-
verifyingKey: isSet3(object.verifyingKey) ? bytesFromBase642(object.verifyingKey) : new Uint8Array(0),
|
|
10751
|
-
parentNodeTx: isSet3(object.parentNodeTx) ? bytesFromBase642(object.parentNodeTx) : new Uint8Array(0),
|
|
10752
|
-
parentNodeVout: isSet3(object.parentNodeVout) ? globalThis.Number(object.parentNodeVout) : 0
|
|
10983
|
+
signingResults: globalThis.Array.isArray(object?.signingResults) ? object.signingResults.map((e) => LeafRefundTxSigningResult.fromJSON(e)) : []
|
|
10753
10984
|
};
|
|
10754
10985
|
},
|
|
10755
10986
|
toJSON(message) {
|
|
10756
10987
|
const obj = {};
|
|
10757
|
-
if (message.
|
|
10758
|
-
obj.
|
|
10759
|
-
}
|
|
10760
|
-
if (message.verifyingKey.length !== 0) {
|
|
10761
|
-
obj.verifyingKey = base64FromBytes2(message.verifyingKey);
|
|
10762
|
-
}
|
|
10763
|
-
if (message.parentNodeTx.length !== 0) {
|
|
10764
|
-
obj.parentNodeTx = base64FromBytes2(message.parentNodeTx);
|
|
10765
|
-
}
|
|
10766
|
-
if (message.parentNodeVout !== 0) {
|
|
10767
|
-
obj.parentNodeVout = Math.round(message.parentNodeVout);
|
|
10988
|
+
if (message.signingResults?.length) {
|
|
10989
|
+
obj.signingResults = message.signingResults.map((e) => LeafRefundTxSigningResult.toJSON(e));
|
|
10768
10990
|
}
|
|
10769
10991
|
return obj;
|
|
10770
10992
|
},
|
|
10771
10993
|
create(base) {
|
|
10772
|
-
return
|
|
10994
|
+
return ClaimTransferSignRefundsResponse.fromPartial(base ?? {});
|
|
10773
10995
|
},
|
|
10774
10996
|
fromPartial(object) {
|
|
10775
|
-
const message =
|
|
10776
|
-
message.
|
|
10777
|
-
message.verifyingKey = object.verifyingKey ?? new Uint8Array(0);
|
|
10778
|
-
message.parentNodeTx = object.parentNodeTx ?? new Uint8Array(0);
|
|
10779
|
-
message.parentNodeVout = object.parentNodeVout ?? 0;
|
|
10997
|
+
const message = createBaseClaimTransferSignRefundsResponse();
|
|
10998
|
+
message.signingResults = object.signingResults?.map((e) => LeafRefundTxSigningResult.fromPartial(e)) || [];
|
|
10780
10999
|
return message;
|
|
10781
11000
|
}
|
|
10782
11001
|
};
|
|
@@ -14180,7 +14399,7 @@ var CancelTransferResponse = {
|
|
|
14180
14399
|
}
|
|
14181
14400
|
};
|
|
14182
14401
|
function createBaseQueryUnusedDepositAddressesRequest() {
|
|
14183
|
-
return { identityPublicKey: new Uint8Array(0), network: 0 };
|
|
14402
|
+
return { identityPublicKey: new Uint8Array(0), network: 0, limit: 0, offset: 0 };
|
|
14184
14403
|
}
|
|
14185
14404
|
var QueryUnusedDepositAddressesRequest = {
|
|
14186
14405
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -14190,6 +14409,12 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
14190
14409
|
if (message.network !== 0) {
|
|
14191
14410
|
writer.uint32(16).int32(message.network);
|
|
14192
14411
|
}
|
|
14412
|
+
if (message.limit !== 0) {
|
|
14413
|
+
writer.uint32(24).int64(message.limit);
|
|
14414
|
+
}
|
|
14415
|
+
if (message.offset !== 0) {
|
|
14416
|
+
writer.uint32(32).int64(message.offset);
|
|
14417
|
+
}
|
|
14193
14418
|
return writer;
|
|
14194
14419
|
},
|
|
14195
14420
|
decode(input, length) {
|
|
@@ -14213,6 +14438,20 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
14213
14438
|
message.network = reader.int32();
|
|
14214
14439
|
continue;
|
|
14215
14440
|
}
|
|
14441
|
+
case 3: {
|
|
14442
|
+
if (tag !== 24) {
|
|
14443
|
+
break;
|
|
14444
|
+
}
|
|
14445
|
+
message.limit = longToNumber2(reader.int64());
|
|
14446
|
+
continue;
|
|
14447
|
+
}
|
|
14448
|
+
case 4: {
|
|
14449
|
+
if (tag !== 32) {
|
|
14450
|
+
break;
|
|
14451
|
+
}
|
|
14452
|
+
message.offset = longToNumber2(reader.int64());
|
|
14453
|
+
continue;
|
|
14454
|
+
}
|
|
14216
14455
|
}
|
|
14217
14456
|
if ((tag & 7) === 4 || tag === 0) {
|
|
14218
14457
|
break;
|
|
@@ -14224,7 +14463,9 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
14224
14463
|
fromJSON(object) {
|
|
14225
14464
|
return {
|
|
14226
14465
|
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
14227
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
14466
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
14467
|
+
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
14468
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
|
|
14228
14469
|
};
|
|
14229
14470
|
},
|
|
14230
14471
|
toJSON(message) {
|
|
@@ -14235,6 +14476,12 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
14235
14476
|
if (message.network !== 0) {
|
|
14236
14477
|
obj.network = networkToJSON(message.network);
|
|
14237
14478
|
}
|
|
14479
|
+
if (message.limit !== 0) {
|
|
14480
|
+
obj.limit = Math.round(message.limit);
|
|
14481
|
+
}
|
|
14482
|
+
if (message.offset !== 0) {
|
|
14483
|
+
obj.offset = Math.round(message.offset);
|
|
14484
|
+
}
|
|
14238
14485
|
return obj;
|
|
14239
14486
|
},
|
|
14240
14487
|
create(base) {
|
|
@@ -14244,6 +14491,8 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
14244
14491
|
const message = createBaseQueryUnusedDepositAddressesRequest();
|
|
14245
14492
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
14246
14493
|
message.network = object.network ?? 0;
|
|
14494
|
+
message.limit = object.limit ?? 0;
|
|
14495
|
+
message.offset = object.offset ?? 0;
|
|
14247
14496
|
return message;
|
|
14248
14497
|
}
|
|
14249
14498
|
};
|
|
@@ -14449,13 +14698,16 @@ var DepositAddressQueryResult = {
|
|
|
14449
14698
|
}
|
|
14450
14699
|
};
|
|
14451
14700
|
function createBaseQueryUnusedDepositAddressesResponse() {
|
|
14452
|
-
return { depositAddresses: [] };
|
|
14701
|
+
return { depositAddresses: [], offset: 0 };
|
|
14453
14702
|
}
|
|
14454
14703
|
var QueryUnusedDepositAddressesResponse = {
|
|
14455
14704
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
14456
14705
|
for (const v of message.depositAddresses) {
|
|
14457
14706
|
DepositAddressQueryResult.encode(v, writer.uint32(10).fork()).join();
|
|
14458
14707
|
}
|
|
14708
|
+
if (message.offset !== 0) {
|
|
14709
|
+
writer.uint32(16).int64(message.offset);
|
|
14710
|
+
}
|
|
14459
14711
|
return writer;
|
|
14460
14712
|
},
|
|
14461
14713
|
decode(input, length) {
|
|
@@ -14472,6 +14724,13 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
14472
14724
|
message.depositAddresses.push(DepositAddressQueryResult.decode(reader, reader.uint32()));
|
|
14473
14725
|
continue;
|
|
14474
14726
|
}
|
|
14727
|
+
case 2: {
|
|
14728
|
+
if (tag !== 16) {
|
|
14729
|
+
break;
|
|
14730
|
+
}
|
|
14731
|
+
message.offset = longToNumber2(reader.int64());
|
|
14732
|
+
continue;
|
|
14733
|
+
}
|
|
14475
14734
|
}
|
|
14476
14735
|
if ((tag & 7) === 4 || tag === 0) {
|
|
14477
14736
|
break;
|
|
@@ -14482,7 +14741,8 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
14482
14741
|
},
|
|
14483
14742
|
fromJSON(object) {
|
|
14484
14743
|
return {
|
|
14485
|
-
depositAddresses: globalThis.Array.isArray(object?.depositAddresses) ? object.depositAddresses.map((e) => DepositAddressQueryResult.fromJSON(e)) : []
|
|
14744
|
+
depositAddresses: globalThis.Array.isArray(object?.depositAddresses) ? object.depositAddresses.map((e) => DepositAddressQueryResult.fromJSON(e)) : [],
|
|
14745
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
|
|
14486
14746
|
};
|
|
14487
14747
|
},
|
|
14488
14748
|
toJSON(message) {
|
|
@@ -14490,6 +14750,9 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
14490
14750
|
if (message.depositAddresses?.length) {
|
|
14491
14751
|
obj.depositAddresses = message.depositAddresses.map((e) => DepositAddressQueryResult.toJSON(e));
|
|
14492
14752
|
}
|
|
14753
|
+
if (message.offset !== 0) {
|
|
14754
|
+
obj.offset = Math.round(message.offset);
|
|
14755
|
+
}
|
|
14493
14756
|
return obj;
|
|
14494
14757
|
},
|
|
14495
14758
|
create(base) {
|
|
@@ -14498,6 +14761,7 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
14498
14761
|
fromPartial(object) {
|
|
14499
14762
|
const message = createBaseQueryUnusedDepositAddressesResponse();
|
|
14500
14763
|
message.depositAddresses = object.depositAddresses?.map((e) => DepositAddressQueryResult.fromPartial(e)) || [];
|
|
14764
|
+
message.offset = object.offset ?? 0;
|
|
14501
14765
|
return message;
|
|
14502
14766
|
}
|
|
14503
14767
|
};
|
|
@@ -16084,6 +16348,11 @@ var SparkServiceDefinition = {
|
|
|
16084
16348
|
responseStream: false,
|
|
16085
16349
|
options: {}
|
|
16086
16350
|
},
|
|
16351
|
+
/**
|
|
16352
|
+
* This is deprecated, please use finalize_transfer_with_transfer_package instead.
|
|
16353
|
+
*
|
|
16354
|
+
* @deprecated
|
|
16355
|
+
*/
|
|
16087
16356
|
finalize_transfer: {
|
|
16088
16357
|
name: "finalize_transfer",
|
|
16089
16358
|
requestType: FinalizeTransferRequest,
|
|
@@ -16140,14 +16409,6 @@ var SparkServiceDefinition = {
|
|
|
16140
16409
|
responseStream: false,
|
|
16141
16410
|
options: {}
|
|
16142
16411
|
},
|
|
16143
|
-
aggregate_nodes: {
|
|
16144
|
-
name: "aggregate_nodes",
|
|
16145
|
-
requestType: AggregateNodesRequest,
|
|
16146
|
-
requestStream: false,
|
|
16147
|
-
responseType: AggregateNodesResponse,
|
|
16148
|
-
responseStream: false,
|
|
16149
|
-
options: {}
|
|
16150
|
-
},
|
|
16151
16412
|
store_preimage_share: {
|
|
16152
16413
|
name: "store_preimage_share",
|
|
16153
16414
|
requestType: StorePreimageShareRequest,
|
|
@@ -16481,9 +16742,12 @@ init_buffer();
|
|
|
16481
16742
|
var import_core10 = require("@lightsparkdev/core");
|
|
16482
16743
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
16483
16744
|
var isBun = globalThis.Bun !== void 0;
|
|
16484
|
-
var packageVersion = true ? "0.1.
|
|
16745
|
+
var packageVersion = true ? "0.1.44" : "unknown";
|
|
16485
16746
|
var baseEnvStr = "unknown";
|
|
16486
|
-
if (
|
|
16747
|
+
if (isBun) {
|
|
16748
|
+
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
16749
|
+
baseEnvStr = `bun/${bunVersion}`;
|
|
16750
|
+
} else if (import_core10.isNode) {
|
|
16487
16751
|
baseEnvStr = `node/${process.version}`;
|
|
16488
16752
|
} else if (isReactNative) {
|
|
16489
16753
|
baseEnvStr = "react-native";
|
|
@@ -17751,7 +18015,8 @@ var BASE_CONFIG = {
|
|
|
17751
18015
|
}
|
|
17752
18016
|
};
|
|
17753
18017
|
var LOCAL_WALLET_CONFIG = {
|
|
17754
|
-
...BASE_CONFIG
|
|
18018
|
+
...BASE_CONFIG,
|
|
18019
|
+
threshold: 3
|
|
17755
18020
|
};
|
|
17756
18021
|
var LOCAL_WALLET_CONFIG_SCHNORR = {
|
|
17757
18022
|
...LOCAL_WALLET_CONFIG,
|
|
@@ -20328,8 +20593,8 @@ function getNextTransactionSequence(currSequence, forRefresh) {
|
|
|
20328
20593
|
needRefresh: true
|
|
20329
20594
|
};
|
|
20330
20595
|
}
|
|
20331
|
-
if (nextTimelock <
|
|
20332
|
-
throw new ValidationError("timelock interval is less than
|
|
20596
|
+
if (nextTimelock < 0) {
|
|
20597
|
+
throw new ValidationError("timelock interval is less than 0", {
|
|
20333
20598
|
field: "nextTimelock",
|
|
20334
20599
|
value: nextTimelock
|
|
20335
20600
|
});
|
|
@@ -26267,17 +26532,30 @@ function hashTokenTransactionV1(tokenTransaction, partialHash = false) {
|
|
|
26267
26532
|
);
|
|
26268
26533
|
hashObj.update(networkBytes);
|
|
26269
26534
|
allHashes.push(hashObj.digest());
|
|
26270
|
-
const
|
|
26271
|
-
const
|
|
26272
|
-
const
|
|
26273
|
-
new
|
|
26535
|
+
const clientTimestampHashObj = import_sha211.sha256.create();
|
|
26536
|
+
const clientCreatedTs = tokenTransaction.clientCreatedTimestamp;
|
|
26537
|
+
const clientUnixTime = clientCreatedTs ? Math.floor(clientCreatedTs.getTime() / 1e3) : 0;
|
|
26538
|
+
const clientTimestampBytes = new Uint8Array(8);
|
|
26539
|
+
new DataView(clientTimestampBytes.buffer).setBigUint64(
|
|
26274
26540
|
0,
|
|
26275
|
-
BigInt(
|
|
26541
|
+
BigInt(clientUnixTime),
|
|
26276
26542
|
false
|
|
26277
|
-
// false for big-endian
|
|
26278
26543
|
);
|
|
26279
|
-
|
|
26280
|
-
allHashes.push(
|
|
26544
|
+
clientTimestampHashObj.update(clientTimestampBytes);
|
|
26545
|
+
allHashes.push(clientTimestampHashObj.digest());
|
|
26546
|
+
if (!partialHash) {
|
|
26547
|
+
const expiryHashObj = import_sha211.sha256.create();
|
|
26548
|
+
const expiryTimeBytes = new Uint8Array(8);
|
|
26549
|
+
const expiryUnixTime = tokenTransaction.expiryTime ? Math.floor(tokenTransaction.expiryTime.getTime() / 1e3) : 0;
|
|
26550
|
+
new DataView(expiryTimeBytes.buffer).setBigUint64(
|
|
26551
|
+
0,
|
|
26552
|
+
BigInt(expiryUnixTime),
|
|
26553
|
+
false
|
|
26554
|
+
// false for big-endian
|
|
26555
|
+
);
|
|
26556
|
+
expiryHashObj.update(expiryTimeBytes);
|
|
26557
|
+
allHashes.push(expiryHashObj.digest());
|
|
26558
|
+
}
|
|
26281
26559
|
const finalHashObj = import_sha211.sha256.create();
|
|
26282
26560
|
const concatenatedHashes = new Uint8Array(
|
|
26283
26561
|
allHashes.reduce((sum, hash) => sum + hash.length, 0)
|
|
@@ -26870,6 +27148,9 @@ var TokenTransactionService = class {
|
|
|
26870
27148
|
return txId;
|
|
26871
27149
|
}
|
|
26872
27150
|
async constructTransferTokenTransactionV0(selectedOutputs, tokenOutputData) {
|
|
27151
|
+
selectedOutputs.sort(
|
|
27152
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
27153
|
+
);
|
|
26873
27154
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
26874
27155
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
26875
27156
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -26905,6 +27186,9 @@ var TokenTransactionService = class {
|
|
|
26905
27186
|
};
|
|
26906
27187
|
}
|
|
26907
27188
|
async constructTransferTokenTransaction(selectedOutputs, tokenOutputData) {
|
|
27189
|
+
selectedOutputs.sort(
|
|
27190
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
27191
|
+
);
|
|
26908
27192
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
26909
27193
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
26910
27194
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -27371,6 +27655,7 @@ var TokenTransactionService = class {
|
|
|
27371
27655
|
await coordinatorClient.commit_transaction(
|
|
27372
27656
|
{
|
|
27373
27657
|
finalTokenTransaction,
|
|
27658
|
+
finalTokenTransactionHash,
|
|
27374
27659
|
inputTtxoSignaturesPerOperator,
|
|
27375
27660
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
27376
27661
|
},
|
|
@@ -27608,7 +27893,7 @@ var import_utils18 = require("@noble/curves/abstract/utils");
|
|
|
27608
27893
|
var import_sha212 = require("@noble/hashes/sha2");
|
|
27609
27894
|
var import_btc_signer5 = require("@scure/btc-signer");
|
|
27610
27895
|
var INITIAL_TIME_LOCK3 = 2e3;
|
|
27611
|
-
function
|
|
27896
|
+
function maybeApplyFee2(amount) {
|
|
27612
27897
|
if (amount > BigInt(DEFAULT_FEE_SATS)) {
|
|
27613
27898
|
return amount - BigInt(DEFAULT_FEE_SATS);
|
|
27614
27899
|
}
|
|
@@ -27877,7 +28162,7 @@ var TreeCreationService = class {
|
|
|
27877
28162
|
const refundPkScript = import_btc_signer5.OutScript.encode(refundAddress);
|
|
27878
28163
|
refundTx.addOutput({
|
|
27879
28164
|
script: refundPkScript,
|
|
27880
|
-
amount:
|
|
28165
|
+
amount: maybeApplyFee2(parentTxOut.amount)
|
|
27881
28166
|
});
|
|
27882
28167
|
refundTx.addOutput(getEphemeralAnchorOutput());
|
|
27883
28168
|
const refundSigningNonceCommitment = await this.config.signer.getRandomSigningCommitment();
|
|
@@ -28793,13 +29078,34 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
28793
29078
|
([_, node]) => node.status === "AVAILABLE" && !leavesToIgnore.has(node.id)
|
|
28794
29079
|
).map(([_, node]) => node);
|
|
28795
29080
|
}
|
|
28796
|
-
async selectLeaves(
|
|
28797
|
-
if (
|
|
29081
|
+
async selectLeaves(targetAmounts) {
|
|
29082
|
+
if (targetAmounts.length === 0) {
|
|
29083
|
+
throw new ValidationError("Target amounts must be non-empty", {
|
|
29084
|
+
field: "targetAmounts",
|
|
29085
|
+
value: targetAmounts
|
|
29086
|
+
});
|
|
29087
|
+
}
|
|
29088
|
+
if (targetAmounts.some((amount) => amount <= 0)) {
|
|
28798
29089
|
throw new ValidationError("Target amount must be positive", {
|
|
28799
|
-
field: "
|
|
28800
|
-
value:
|
|
29090
|
+
field: "targetAmounts",
|
|
29091
|
+
value: targetAmounts
|
|
28801
29092
|
});
|
|
28802
29093
|
}
|
|
29094
|
+
const totalTargetAmount = targetAmounts.reduce(
|
|
29095
|
+
(acc, amount) => acc + amount,
|
|
29096
|
+
0
|
|
29097
|
+
);
|
|
29098
|
+
const totalBalance = this.getInternalBalance();
|
|
29099
|
+
if (totalTargetAmount > totalBalance) {
|
|
29100
|
+
throw new ValidationError(
|
|
29101
|
+
"Total target amount exceeds available balance",
|
|
29102
|
+
{
|
|
29103
|
+
field: "targetAmounts",
|
|
29104
|
+
value: totalTargetAmount,
|
|
29105
|
+
expected: `less than or equal to ${totalBalance}`
|
|
29106
|
+
}
|
|
29107
|
+
);
|
|
29108
|
+
}
|
|
28803
29109
|
const leaves = await this.getLeaves();
|
|
28804
29110
|
if (leaves.length === 0) {
|
|
28805
29111
|
throw new ValidationError("No owned leaves found", {
|
|
@@ -28807,33 +29113,49 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
28807
29113
|
});
|
|
28808
29114
|
}
|
|
28809
29115
|
leaves.sort((a, b) => b.value - a.value);
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
nodes
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
amount += leaf.value;
|
|
28827
|
-
nodes.push(leaf);
|
|
29116
|
+
const selectLeavesForTargets = (targetAmounts2, leaves2) => {
|
|
29117
|
+
const usedLeaves = /* @__PURE__ */ new Set();
|
|
29118
|
+
const results2 = /* @__PURE__ */ new Map();
|
|
29119
|
+
let totalAmount = 0;
|
|
29120
|
+
for (const targetAmount of targetAmounts2) {
|
|
29121
|
+
const nodes = [];
|
|
29122
|
+
let amount = 0;
|
|
29123
|
+
for (const leaf of leaves2) {
|
|
29124
|
+
if (usedLeaves.has(leaf.id)) {
|
|
29125
|
+
continue;
|
|
29126
|
+
}
|
|
29127
|
+
if (targetAmount - amount >= leaf.value) {
|
|
29128
|
+
amount += leaf.value;
|
|
29129
|
+
nodes.push(leaf);
|
|
29130
|
+
usedLeaves.add(leaf.id);
|
|
29131
|
+
}
|
|
28828
29132
|
}
|
|
29133
|
+
totalAmount += amount;
|
|
29134
|
+
results2.set(targetAmount, nodes);
|
|
28829
29135
|
}
|
|
29136
|
+
return {
|
|
29137
|
+
results: results2,
|
|
29138
|
+
foundSelections: totalAmount === totalTargetAmount
|
|
29139
|
+
};
|
|
29140
|
+
};
|
|
29141
|
+
let { results, foundSelections } = selectLeavesForTargets(
|
|
29142
|
+
targetAmounts,
|
|
29143
|
+
leaves
|
|
29144
|
+
);
|
|
29145
|
+
if (!foundSelections) {
|
|
29146
|
+
const newLeaves = await this.requestLeavesSwap({ targetAmounts });
|
|
29147
|
+
newLeaves.sort((a, b) => b.value - a.value);
|
|
29148
|
+
({ results, foundSelections } = selectLeavesForTargets(
|
|
29149
|
+
targetAmounts,
|
|
29150
|
+
newLeaves
|
|
29151
|
+
));
|
|
28830
29152
|
}
|
|
28831
|
-
if (
|
|
29153
|
+
if (!foundSelections) {
|
|
28832
29154
|
throw new Error(
|
|
28833
|
-
`Failed to select leaves for target amount ${
|
|
29155
|
+
`Failed to select leaves for target amount ${totalTargetAmount}`
|
|
28834
29156
|
);
|
|
28835
29157
|
}
|
|
28836
|
-
return
|
|
29158
|
+
return results;
|
|
28837
29159
|
}
|
|
28838
29160
|
async selectLeavesForSwap(targetAmount) {
|
|
28839
29161
|
if (targetAmount == 0) {
|
|
@@ -29066,27 +29388,44 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29066
29388
|
* @private
|
|
29067
29389
|
*/
|
|
29068
29390
|
async requestLeavesSwap({
|
|
29069
|
-
|
|
29391
|
+
targetAmounts,
|
|
29070
29392
|
leaves
|
|
29071
29393
|
}) {
|
|
29072
|
-
if (
|
|
29073
|
-
throw new Error("targetAmount must be positive");
|
|
29394
|
+
if (targetAmounts && targetAmounts.some((amount) => amount <= 0)) {
|
|
29395
|
+
throw new Error("specified targetAmount must be positive");
|
|
29074
29396
|
}
|
|
29075
|
-
if (
|
|
29397
|
+
if (targetAmounts && targetAmounts.some((amount) => !Number.isSafeInteger(amount))) {
|
|
29076
29398
|
throw new ValidationError("targetAmount must be less than 2^53", {
|
|
29077
|
-
field: "
|
|
29078
|
-
value:
|
|
29399
|
+
field: "targetAmounts",
|
|
29400
|
+
value: targetAmounts,
|
|
29079
29401
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
29080
29402
|
});
|
|
29081
29403
|
}
|
|
29082
29404
|
let leavesToSwap;
|
|
29083
|
-
|
|
29084
|
-
|
|
29405
|
+
const totalTargetAmount = targetAmounts?.reduce(
|
|
29406
|
+
(acc, amount) => acc + amount,
|
|
29407
|
+
0
|
|
29408
|
+
);
|
|
29409
|
+
if (totalTargetAmount) {
|
|
29410
|
+
const totalBalance = this.getInternalBalance();
|
|
29411
|
+
if (totalTargetAmount > totalBalance) {
|
|
29412
|
+
throw new ValidationError(
|
|
29413
|
+
"Total target amount exceeds available balance",
|
|
29414
|
+
{
|
|
29415
|
+
field: "targetAmounts",
|
|
29416
|
+
value: totalTargetAmount,
|
|
29417
|
+
expected: `less than or equal to ${totalBalance}`
|
|
29418
|
+
}
|
|
29419
|
+
);
|
|
29420
|
+
}
|
|
29421
|
+
}
|
|
29422
|
+
if (totalTargetAmount && leaves && leaves.length > 0) {
|
|
29423
|
+
if (totalTargetAmount < leaves.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
29085
29424
|
throw new Error("targetAmount is less than the sum of leaves");
|
|
29086
29425
|
}
|
|
29087
29426
|
leavesToSwap = leaves;
|
|
29088
|
-
} else if (
|
|
29089
|
-
leavesToSwap = await this.selectLeavesForSwap(
|
|
29427
|
+
} else if (totalTargetAmount) {
|
|
29428
|
+
leavesToSwap = await this.selectLeavesForSwap(totalTargetAmount);
|
|
29090
29429
|
} else if (leaves && leaves.length > 0) {
|
|
29091
29430
|
leavesToSwap = leaves;
|
|
29092
29431
|
} else {
|
|
@@ -29096,15 +29435,15 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29096
29435
|
const batches = chunkArray(leavesToSwap, 100);
|
|
29097
29436
|
const results = [];
|
|
29098
29437
|
for (const batch of batches) {
|
|
29099
|
-
const result = await this.processSwapBatch(batch,
|
|
29100
|
-
results.push(...result
|
|
29438
|
+
const result = await this.processSwapBatch(batch, targetAmounts);
|
|
29439
|
+
results.push(...result);
|
|
29101
29440
|
}
|
|
29102
29441
|
return results;
|
|
29103
29442
|
}
|
|
29104
29443
|
/**
|
|
29105
29444
|
* Processes a single batch of leaves for swapping.
|
|
29106
29445
|
*/
|
|
29107
|
-
async processSwapBatch(leavesBatch,
|
|
29446
|
+
async processSwapBatch(leavesBatch, targetAmounts) {
|
|
29108
29447
|
const leafKeyTweaks = await Promise.all(
|
|
29109
29448
|
leavesBatch.map(async (leaf) => ({
|
|
29110
29449
|
leaf,
|
|
@@ -29168,8 +29507,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29168
29507
|
request = await sspClient.requestLeaveSwap({
|
|
29169
29508
|
userLeaves,
|
|
29170
29509
|
adaptorPubkey,
|
|
29171
|
-
targetAmountSats:
|
|
29510
|
+
targetAmountSats: targetAmounts?.reduce((acc, amount) => acc + amount, 0) || leavesBatch.reduce((acc, leaf) => acc + leaf.value, 0),
|
|
29172
29511
|
totalAmountSats: leavesBatch.reduce((acc, leaf) => acc + leaf.value, 0),
|
|
29512
|
+
targetAmountSatsList: targetAmounts,
|
|
29173
29513
|
// TODO: Request fee from SSP
|
|
29174
29514
|
feeSats: 0,
|
|
29175
29515
|
idempotencyKey: (0, import_uuidv75.uuidv7)()
|
|
@@ -29225,11 +29565,21 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29225
29565
|
userOutboundTransferExternalId: transfer.id,
|
|
29226
29566
|
leavesSwapRequestId: request.id
|
|
29227
29567
|
});
|
|
29228
|
-
if (!completeResponse) {
|
|
29568
|
+
if (!completeResponse || !completeResponse.inboundTransfer?.sparkId) {
|
|
29229
29569
|
throw new Error("Failed to complete leaves swap");
|
|
29230
29570
|
}
|
|
29231
|
-
await this.
|
|
29232
|
-
|
|
29571
|
+
const incomingTransfer = await this.transferService.queryTransfer(
|
|
29572
|
+
completeResponse.inboundTransfer.sparkId
|
|
29573
|
+
);
|
|
29574
|
+
if (!incomingTransfer) {
|
|
29575
|
+
throw new Error("Failed to get incoming transfer");
|
|
29576
|
+
}
|
|
29577
|
+
return await this.claimTransfer({
|
|
29578
|
+
transfer: incomingTransfer,
|
|
29579
|
+
emit: false,
|
|
29580
|
+
retryCount: 0,
|
|
29581
|
+
optimize: false
|
|
29582
|
+
});
|
|
29233
29583
|
} catch (e) {
|
|
29234
29584
|
await this.cancelAllSenderInitiatedTransfers();
|
|
29235
29585
|
throw new Error(`Failed to request leaves swap: ${e}`);
|
|
@@ -29766,13 +30116,45 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29766
30116
|
* @returns {Promise<string[]>} The unused deposit addresses
|
|
29767
30117
|
*/
|
|
29768
30118
|
async getUnusedDepositAddresses() {
|
|
30119
|
+
return (await this.queryAllUnusedDepositAddresses({})).map(
|
|
30120
|
+
(addr) => addr.depositAddress
|
|
30121
|
+
);
|
|
30122
|
+
}
|
|
30123
|
+
/**
|
|
30124
|
+
* Gets all unused deposit addresses for the wallet.
|
|
30125
|
+
*
|
|
30126
|
+
* @param {Object} params - Parameters for querying unused deposit addresses
|
|
30127
|
+
* @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
|
|
30128
|
+
* @param {NetworkProto} [params.network] - The network
|
|
30129
|
+
* @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
|
|
30130
|
+
*/
|
|
30131
|
+
async queryAllUnusedDepositAddresses({
|
|
30132
|
+
identityPublicKey,
|
|
30133
|
+
network
|
|
30134
|
+
}) {
|
|
29769
30135
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
29770
30136
|
this.config.getCoordinatorAddress()
|
|
29771
30137
|
);
|
|
29772
|
-
|
|
29773
|
-
|
|
29774
|
-
|
|
29775
|
-
|
|
30138
|
+
let limit = 100;
|
|
30139
|
+
let offset = 0;
|
|
30140
|
+
const pastOffsets = /* @__PURE__ */ new Set();
|
|
30141
|
+
const depositAddresses = [];
|
|
30142
|
+
while (offset >= 0) {
|
|
30143
|
+
if (pastOffsets.has(offset)) {
|
|
30144
|
+
console.warn("Offset has already been seen, stopping");
|
|
30145
|
+
break;
|
|
30146
|
+
}
|
|
30147
|
+
const response = await sparkClient.query_unused_deposit_addresses({
|
|
30148
|
+
identityPublicKey: identityPublicKey ?? await this.config.signer.getIdentityPublicKey(),
|
|
30149
|
+
network: network ?? NetworkToProto[this.config.getNetwork()],
|
|
30150
|
+
limit,
|
|
30151
|
+
offset
|
|
30152
|
+
});
|
|
30153
|
+
depositAddresses.push(...response.depositAddresses);
|
|
30154
|
+
pastOffsets.add(offset);
|
|
30155
|
+
offset = response.offset;
|
|
30156
|
+
}
|
|
30157
|
+
return depositAddresses;
|
|
29776
30158
|
}
|
|
29777
30159
|
/**
|
|
29778
30160
|
* Claims a deposit to the wallet.
|
|
@@ -29821,14 +30203,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29821
30203
|
});
|
|
29822
30204
|
}
|
|
29823
30205
|
const depositTx = getTxFromRawTxHex(txHex);
|
|
29824
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
29825
|
-
this.config.getCoordinatorAddress()
|
|
29826
|
-
);
|
|
29827
30206
|
const unusedDepositAddresses = new Map(
|
|
29828
|
-
(await
|
|
30207
|
+
(await this.queryAllUnusedDepositAddresses({
|
|
29829
30208
|
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
29830
30209
|
network: NetworkToProto[this.config.getNetwork()]
|
|
29831
|
-
})).
|
|
30210
|
+
})).map((addr) => [addr.depositAddress, addr])
|
|
29832
30211
|
);
|
|
29833
30212
|
let depositAddress;
|
|
29834
30213
|
let vout = 0;
|
|
@@ -29882,14 +30261,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29882
30261
|
*/
|
|
29883
30262
|
async advancedDeposit(txHex) {
|
|
29884
30263
|
const depositTx = getTxFromRawTxHex(txHex);
|
|
29885
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
29886
|
-
this.config.getCoordinatorAddress()
|
|
29887
|
-
);
|
|
29888
30264
|
const unusedDepositAddresses = new Map(
|
|
29889
|
-
(await
|
|
30265
|
+
(await this.queryAllUnusedDepositAddresses({
|
|
29890
30266
|
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
29891
30267
|
network: NetworkToProto[this.config.getNetwork()]
|
|
29892
|
-
})).
|
|
30268
|
+
})).map((addr) => [addr.depositAddress, addr])
|
|
29893
30269
|
);
|
|
29894
30270
|
let vout = 0;
|
|
29895
30271
|
const responses = [];
|
|
@@ -29993,7 +30369,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29993
30369
|
(0, import_utils23.hexToBytes)(receiverAddress.identityPublicKey)
|
|
29994
30370
|
);
|
|
29995
30371
|
return await this.withLeaves(async () => {
|
|
29996
|
-
let leavesToSend = await this.selectLeaves(amountSats)
|
|
30372
|
+
let leavesToSend = (await this.selectLeaves([amountSats])).get(
|
|
30373
|
+
amountSats
|
|
30374
|
+
);
|
|
29997
30375
|
leavesToSend = await this.checkRefreshTimelockNodes(leavesToSend);
|
|
29998
30376
|
leavesToSend = await this.checkExtendTimeLockNodes(leavesToSend);
|
|
29999
30377
|
const leafKeyTweaks = await Promise.all(
|
|
@@ -30236,7 +30614,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30236
30614
|
if (type && transfer.type !== type) {
|
|
30237
30615
|
continue;
|
|
30238
30616
|
}
|
|
30239
|
-
if (transfer.status !== 2 /* TRANSFER_STATUS_SENDER_KEY_TWEAKED */ && transfer.status !== 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */ && transfer.status !== 4 /*
|
|
30617
|
+
if (transfer.status !== 2 /* TRANSFER_STATUS_SENDER_KEY_TWEAKED */ && transfer.status !== 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */ && transfer.status !== 4 /* TRANSFER_STATUS_RECEIVER_REFUND_SIGNED */ && transfer.status !== 10 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAK_APPLIED */) {
|
|
30240
30618
|
continue;
|
|
30241
30619
|
}
|
|
30242
30620
|
promises.push(
|
|
@@ -30495,7 +30873,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30495
30873
|
expected: `${totalAmount} sats`
|
|
30496
30874
|
});
|
|
30497
30875
|
}
|
|
30498
|
-
let leaves = await this.selectLeaves(totalAmount);
|
|
30876
|
+
let leaves = (await this.selectLeaves([totalAmount])).get(totalAmount);
|
|
30499
30877
|
leaves = await this.checkRefreshTimelockNodes(leaves);
|
|
30500
30878
|
leaves = await this.checkExtendTimeLockNodes(leaves);
|
|
30501
30879
|
const leavesToSend = await Promise.all(
|
|
@@ -30605,13 +30983,18 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30605
30983
|
*
|
|
30606
30984
|
* @param {Object} params - Parameters for the withdrawal
|
|
30607
30985
|
* @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
|
|
30608
|
-
* @param {
|
|
30986
|
+
* @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
|
|
30987
|
+
* @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
|
|
30988
|
+
* @param {number} [params.amountSats] - The amount in satoshis to withdraw. If not specified, attempts to withdraw all available funds and deductFeeFromWithdrawalAmount is set to true.
|
|
30989
|
+
* @param {boolean} [params.deductFeeFromWithdrawalAmount] - Controls how the withdrawal fee is handled. If true, the fee is deducted from the withdrawal amount (amountSats), meaning the recipient will receive amountSats minus the fee. If false, the fee is paid separately from the wallet balance, meaning the recipient will receive the full amountSats.
|
|
30609
30990
|
* @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
|
|
30610
30991
|
*/
|
|
30611
30992
|
async withdraw({
|
|
30612
30993
|
onchainAddress,
|
|
30613
30994
|
exitSpeed,
|
|
30614
|
-
|
|
30995
|
+
feeQuote,
|
|
30996
|
+
amountSats,
|
|
30997
|
+
deductFeeFromWithdrawalAmount = true
|
|
30615
30998
|
}) {
|
|
30616
30999
|
if (!Number.isSafeInteger(amountSats)) {
|
|
30617
31000
|
throw new ValidationError("Sats amount must be less than 2^53", {
|
|
@@ -30621,7 +31004,13 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30621
31004
|
});
|
|
30622
31005
|
}
|
|
30623
31006
|
return await this.withLeaves(async () => {
|
|
30624
|
-
return await this.coopExit(
|
|
31007
|
+
return await this.coopExit(
|
|
31008
|
+
onchainAddress,
|
|
31009
|
+
feeQuote,
|
|
31010
|
+
exitSpeed,
|
|
31011
|
+
deductFeeFromWithdrawalAmount,
|
|
31012
|
+
amountSats
|
|
31013
|
+
);
|
|
30625
31014
|
});
|
|
30626
31015
|
}
|
|
30627
31016
|
/**
|
|
@@ -30632,7 +31021,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30632
31021
|
* @returns {Promise<Object | null | undefined>} The exit request details
|
|
30633
31022
|
* @private
|
|
30634
31023
|
*/
|
|
30635
|
-
async coopExit(onchainAddress, exitSpeed, targetAmountSats) {
|
|
31024
|
+
async coopExit(onchainAddress, feeEstimate, exitSpeed, deductFeeFromWithdrawalAmount, targetAmountSats) {
|
|
30636
31025
|
if (!Number.isSafeInteger(targetAmountSats)) {
|
|
30637
31026
|
throw new ValidationError("Sats amount must be less than 2^53", {
|
|
30638
31027
|
field: "targetAmountSats",
|
|
@@ -30640,41 +31029,34 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30640
31029
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
30641
31030
|
});
|
|
30642
31031
|
}
|
|
30643
|
-
|
|
30644
|
-
|
|
30645
|
-
leavesToSend = await this.selectLeaves(targetAmountSats);
|
|
30646
|
-
} else {
|
|
30647
|
-
leavesToSend = this.leaves.map((leaf) => ({
|
|
30648
|
-
...leaf
|
|
30649
|
-
}));
|
|
31032
|
+
if (!targetAmountSats) {
|
|
31033
|
+
deductFeeFromWithdrawalAmount = true;
|
|
30650
31034
|
}
|
|
30651
|
-
|
|
30652
|
-
|
|
30653
|
-
|
|
30654
|
-
|
|
30655
|
-
|
|
30656
|
-
|
|
30657
|
-
|
|
30658
|
-
|
|
30659
|
-
|
|
30660
|
-
|
|
30661
|
-
|
|
30662
|
-
|
|
30663
|
-
|
|
30664
|
-
|
|
30665
|
-
|
|
30666
|
-
|
|
30667
|
-
|
|
30668
|
-
|
|
30669
|
-
|
|
30670
|
-
|
|
30671
|
-
|
|
30672
|
-
|
|
30673
|
-
|
|
30674
|
-
}
|
|
30675
|
-
if (fee !== void 0 && fee > leavesToSend.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
31035
|
+
let fee;
|
|
31036
|
+
switch (exitSpeed) {
|
|
31037
|
+
case ExitSpeed_default.FAST:
|
|
31038
|
+
fee = (feeEstimate.l1BroadcastFeeFast?.originalValue || 0) + (feeEstimate.userFeeFast?.originalValue || 0);
|
|
31039
|
+
break;
|
|
31040
|
+
case ExitSpeed_default.MEDIUM:
|
|
31041
|
+
fee = (feeEstimate.l1BroadcastFeeMedium?.originalValue || 0) + (feeEstimate.userFeeMedium?.originalValue || 0);
|
|
31042
|
+
break;
|
|
31043
|
+
case ExitSpeed_default.SLOW:
|
|
31044
|
+
fee = (feeEstimate.l1BroadcastFeeSlow?.originalValue || 0) + (feeEstimate.userFeeSlow?.originalValue || 0);
|
|
31045
|
+
break;
|
|
31046
|
+
default:
|
|
31047
|
+
throw new ValidationError("Invalid exit speed", {
|
|
31048
|
+
field: "exitSpeed",
|
|
31049
|
+
value: exitSpeed,
|
|
31050
|
+
expected: "FAST, MEDIUM, or SLOW"
|
|
31051
|
+
});
|
|
31052
|
+
}
|
|
31053
|
+
let leavesToSendToSsp = [];
|
|
31054
|
+
let leavesToSendToSE = [];
|
|
31055
|
+
if (deductFeeFromWithdrawalAmount) {
|
|
31056
|
+
leavesToSendToSsp = targetAmountSats ? (await this.selectLeaves([targetAmountSats])).get(targetAmountSats) : this.leaves;
|
|
31057
|
+
if (fee > leavesToSendToSsp.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
30676
31058
|
throw new ValidationError(
|
|
30677
|
-
"The fee for the withdrawal is greater than the target amount",
|
|
31059
|
+
"The fee for the withdrawal is greater than the target withdrawal amount",
|
|
30678
31060
|
{
|
|
30679
31061
|
field: "fee",
|
|
30680
31062
|
value: fee,
|
|
@@ -30682,11 +31064,32 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30682
31064
|
}
|
|
30683
31065
|
);
|
|
30684
31066
|
}
|
|
31067
|
+
} else {
|
|
31068
|
+
if (!targetAmountSats) {
|
|
31069
|
+
throw new ValidationError(
|
|
31070
|
+
"targetAmountSats is required when deductFeeFromWithdrawalAmount is false",
|
|
31071
|
+
{
|
|
31072
|
+
field: "targetAmountSats",
|
|
31073
|
+
value: targetAmountSats,
|
|
31074
|
+
expected: "defined when deductFeeFromWithdrawalAmount is false"
|
|
31075
|
+
}
|
|
31076
|
+
);
|
|
31077
|
+
}
|
|
31078
|
+
const leaves = await this.selectLeaves([targetAmountSats, fee]);
|
|
31079
|
+
const leavesForTargetAmount = leaves.get(targetAmountSats);
|
|
31080
|
+
const leavesForFee = leaves.get(fee);
|
|
31081
|
+
if (!leavesForTargetAmount || !leavesForFee) {
|
|
31082
|
+
throw new Error("Failed to select leaves for target amount and fee");
|
|
31083
|
+
}
|
|
31084
|
+
leavesToSendToSsp = leavesForTargetAmount;
|
|
31085
|
+
leavesToSendToSE = leavesForFee;
|
|
30685
31086
|
}
|
|
30686
|
-
|
|
30687
|
-
|
|
31087
|
+
leavesToSendToSsp = await this.checkRefreshTimelockNodes(leavesToSendToSsp);
|
|
31088
|
+
leavesToSendToSsp = await this.checkExtendTimeLockNodes(leavesToSendToSsp);
|
|
31089
|
+
leavesToSendToSE = await this.checkRefreshTimelockNodes(leavesToSendToSE);
|
|
31090
|
+
leavesToSendToSE = await this.checkExtendTimeLockNodes(leavesToSendToSE);
|
|
30688
31091
|
const leafKeyTweaks = await Promise.all(
|
|
30689
|
-
|
|
31092
|
+
[...leavesToSendToSE, ...leavesToSendToSsp].map(async (leaf) => ({
|
|
30690
31093
|
leaf,
|
|
30691
31094
|
signingPubKey: await this.config.signer.generatePublicKey(
|
|
30692
31095
|
(0, import_sha213.sha256)(leaf.id)
|
|
@@ -30694,13 +31097,23 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30694
31097
|
newSigningPubKey: await this.config.signer.generatePublicKey()
|
|
30695
31098
|
}))
|
|
30696
31099
|
);
|
|
30697
|
-
const
|
|
30698
|
-
leafExternalIds:
|
|
31100
|
+
const requestCoopExitParams = {
|
|
31101
|
+
leafExternalIds: leavesToSendToSsp.map((leaf) => leaf.id),
|
|
30699
31102
|
withdrawalAddress: onchainAddress,
|
|
30700
31103
|
idempotencyKey: (0, import_uuidv75.uuidv7)(),
|
|
30701
31104
|
exitSpeed,
|
|
30702
|
-
withdrawAll:
|
|
30703
|
-
}
|
|
31105
|
+
withdrawAll: deductFeeFromWithdrawalAmount
|
|
31106
|
+
};
|
|
31107
|
+
if (!deductFeeFromWithdrawalAmount) {
|
|
31108
|
+
requestCoopExitParams.feeQuoteId = feeEstimate.id;
|
|
31109
|
+
requestCoopExitParams.feeLeafExternalIds = leavesToSendToSE.map(
|
|
31110
|
+
(leaf) => leaf.id
|
|
31111
|
+
);
|
|
31112
|
+
}
|
|
31113
|
+
const sspClient = this.getSspClient();
|
|
31114
|
+
const coopExitRequest = await sspClient.requestCoopExit(
|
|
31115
|
+
requestCoopExitParams
|
|
31116
|
+
);
|
|
30704
31117
|
if (!coopExitRequest?.rawConnectorTransaction) {
|
|
30705
31118
|
throw new Error("Failed to request coop exit");
|
|
30706
31119
|
}
|
|
@@ -30738,9 +31151,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30738
31151
|
* @param {Object} params - Input parameters for fee estimation
|
|
30739
31152
|
* @param {number} params.amountSats - The amount in satoshis to withdraw
|
|
30740
31153
|
* @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
|
|
30741
|
-
* @returns {Promise<
|
|
31154
|
+
* @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
|
|
30742
31155
|
*/
|
|
30743
|
-
async
|
|
31156
|
+
async getWithdrawalFeeQuote({
|
|
30744
31157
|
amountSats,
|
|
30745
31158
|
withdrawalAddress
|
|
30746
31159
|
}) {
|
|
@@ -30752,10 +31165,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30752
31165
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
30753
31166
|
});
|
|
30754
31167
|
}
|
|
30755
|
-
let leaves = await this.selectLeaves(amountSats);
|
|
31168
|
+
let leaves = (await this.selectLeaves([amountSats])).get(amountSats);
|
|
30756
31169
|
leaves = await this.checkRefreshTimelockNodes(leaves);
|
|
30757
31170
|
leaves = await this.checkExtendTimeLockNodes(leaves);
|
|
30758
|
-
const feeEstimate = await sspClient.
|
|
31171
|
+
const feeEstimate = await sspClient.getCoopExitFeeQuote({
|
|
30759
31172
|
leafExternalIds: leaves.map((leaf) => leaf.id),
|
|
30760
31173
|
withdrawalAddress
|
|
30761
31174
|
});
|