@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/native/index.cjs
CHANGED
|
@@ -1631,9 +1631,12 @@ init_buffer();
|
|
|
1631
1631
|
var import_core = require("@lightsparkdev/core");
|
|
1632
1632
|
var isReactNative = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
1633
1633
|
var isBun = globalThis.Bun !== void 0;
|
|
1634
|
-
var packageVersion = true ? "0.1.
|
|
1634
|
+
var packageVersion = true ? "0.1.44" : "unknown";
|
|
1635
1635
|
var baseEnvStr = "unknown";
|
|
1636
|
-
if (
|
|
1636
|
+
if (isBun) {
|
|
1637
|
+
const bunVersion = "version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
1638
|
+
baseEnvStr = `bun/${bunVersion}`;
|
|
1639
|
+
} else if (import_core.isNode) {
|
|
1637
1640
|
baseEnvStr = `node/${process.version}`;
|
|
1638
1641
|
} else if (isReactNative) {
|
|
1639
1642
|
baseEnvStr = "react-native";
|
|
@@ -2753,7 +2756,7 @@ var import_uuidv75 = require("uuidv7");
|
|
|
2753
2756
|
|
|
2754
2757
|
// src/graphql/client.ts
|
|
2755
2758
|
init_buffer();
|
|
2756
|
-
var
|
|
2759
|
+
var import_core8 = require("@lightsparkdev/core");
|
|
2757
2760
|
var import_sha22 = require("@noble/hashes/sha2");
|
|
2758
2761
|
|
|
2759
2762
|
// src/graphql/mutations/ClaimStaticDeposit.ts
|
|
@@ -3322,6 +3325,9 @@ var RequestCoopExit = `
|
|
|
3322
3325
|
$withdrawal_address: String!
|
|
3323
3326
|
$idempotency_key: String!
|
|
3324
3327
|
$exit_speed: ExitSpeed!
|
|
3328
|
+
$withdraw_all: Boolean
|
|
3329
|
+
$fee_leaf_external_ids: [UUID!]
|
|
3330
|
+
$fee_quote_id: ID
|
|
3325
3331
|
) {
|
|
3326
3332
|
request_coop_exit(
|
|
3327
3333
|
input: {
|
|
@@ -3329,6 +3335,9 @@ var RequestCoopExit = `
|
|
|
3329
3335
|
withdrawal_address: $withdrawal_address
|
|
3330
3336
|
idempotency_key: $idempotency_key
|
|
3331
3337
|
exit_speed: $exit_speed
|
|
3338
|
+
withdraw_all: $withdraw_all
|
|
3339
|
+
fee_leaf_external_ids: $fee_leaf_external_ids
|
|
3340
|
+
fee_quote_id: $fee_quote_id
|
|
3332
3341
|
}
|
|
3333
3342
|
) {
|
|
3334
3343
|
request {
|
|
@@ -3573,6 +3582,7 @@ var RequestSwapLeaves = `
|
|
|
3573
3582
|
$fee_sats: Long!
|
|
3574
3583
|
$user_leaves: [UserLeafInput!]!
|
|
3575
3584
|
$idempotency_key: String!
|
|
3585
|
+
$target_amount_sats_list: [Long!]
|
|
3576
3586
|
) {
|
|
3577
3587
|
request_leaves_swap(input: {
|
|
3578
3588
|
adaptor_pubkey: $adaptor_pubkey
|
|
@@ -3581,6 +3591,7 @@ var RequestSwapLeaves = `
|
|
|
3581
3591
|
fee_sats: $fee_sats
|
|
3582
3592
|
user_leaves: $user_leaves
|
|
3583
3593
|
idempotency_key: $idempotency_key
|
|
3594
|
+
target_amount_sats_list: $target_amount_sats_list
|
|
3584
3595
|
}) {
|
|
3585
3596
|
request {
|
|
3586
3597
|
...LeavesSwapRequestFragment
|
|
@@ -3721,6 +3732,106 @@ fragment CoopExitFeeEstimatesOutputFragment on CoopExitFeeEstimatesOutput {
|
|
|
3721
3732
|
}
|
|
3722
3733
|
}`;
|
|
3723
3734
|
|
|
3735
|
+
// src/graphql/objects/CoopExitFeeQuote.ts
|
|
3736
|
+
init_buffer();
|
|
3737
|
+
var import_core6 = require("@lightsparkdev/core");
|
|
3738
|
+
var CoopExitFeeQuoteFromJson = (obj) => {
|
|
3739
|
+
return {
|
|
3740
|
+
id: obj["coop_exit_fee_quote_id"],
|
|
3741
|
+
createdAt: obj["coop_exit_fee_quote_created_at"],
|
|
3742
|
+
updatedAt: obj["coop_exit_fee_quote_updated_at"],
|
|
3743
|
+
network: BitcoinNetwork_default[obj["coop_exit_fee_quote_network"]] ?? BitcoinNetwork_default.FUTURE_VALUE,
|
|
3744
|
+
totalAmount: CurrencyAmountFromJson(
|
|
3745
|
+
obj["coop_exit_fee_quote_total_amount"]
|
|
3746
|
+
),
|
|
3747
|
+
userFeeFast: CurrencyAmountFromJson(
|
|
3748
|
+
obj["coop_exit_fee_quote_user_fee_fast"]
|
|
3749
|
+
),
|
|
3750
|
+
userFeeMedium: CurrencyAmountFromJson(
|
|
3751
|
+
obj["coop_exit_fee_quote_user_fee_medium"]
|
|
3752
|
+
),
|
|
3753
|
+
userFeeSlow: CurrencyAmountFromJson(
|
|
3754
|
+
obj["coop_exit_fee_quote_user_fee_slow"]
|
|
3755
|
+
),
|
|
3756
|
+
l1BroadcastFeeFast: CurrencyAmountFromJson(
|
|
3757
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_fast"]
|
|
3758
|
+
),
|
|
3759
|
+
l1BroadcastFeeMedium: CurrencyAmountFromJson(
|
|
3760
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_medium"]
|
|
3761
|
+
),
|
|
3762
|
+
l1BroadcastFeeSlow: CurrencyAmountFromJson(
|
|
3763
|
+
obj["coop_exit_fee_quote_l1_broadcast_fee_slow"]
|
|
3764
|
+
),
|
|
3765
|
+
expiresAt: obj["coop_exit_fee_quote_expires_at"],
|
|
3766
|
+
typename: "CoopExitFeeQuote"
|
|
3767
|
+
};
|
|
3768
|
+
};
|
|
3769
|
+
var FRAGMENT10 = `
|
|
3770
|
+
fragment CoopExitFeeQuoteFragment on CoopExitFeeQuote {
|
|
3771
|
+
__typename
|
|
3772
|
+
coop_exit_fee_quote_id: id
|
|
3773
|
+
coop_exit_fee_quote_created_at: created_at
|
|
3774
|
+
coop_exit_fee_quote_updated_at: updated_at
|
|
3775
|
+
coop_exit_fee_quote_network: network
|
|
3776
|
+
coop_exit_fee_quote_total_amount: total_amount {
|
|
3777
|
+
__typename
|
|
3778
|
+
currency_amount_original_value: original_value
|
|
3779
|
+
currency_amount_original_unit: original_unit
|
|
3780
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3781
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3782
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3783
|
+
}
|
|
3784
|
+
coop_exit_fee_quote_user_fee_fast: user_fee_fast {
|
|
3785
|
+
__typename
|
|
3786
|
+
currency_amount_original_value: original_value
|
|
3787
|
+
currency_amount_original_unit: original_unit
|
|
3788
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3789
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3790
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3791
|
+
}
|
|
3792
|
+
coop_exit_fee_quote_user_fee_medium: user_fee_medium {
|
|
3793
|
+
__typename
|
|
3794
|
+
currency_amount_original_value: original_value
|
|
3795
|
+
currency_amount_original_unit: original_unit
|
|
3796
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3797
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3798
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3799
|
+
}
|
|
3800
|
+
coop_exit_fee_quote_user_fee_slow: user_fee_slow {
|
|
3801
|
+
__typename
|
|
3802
|
+
currency_amount_original_value: original_value
|
|
3803
|
+
currency_amount_original_unit: original_unit
|
|
3804
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3805
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3806
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3807
|
+
}
|
|
3808
|
+
coop_exit_fee_quote_l1_broadcast_fee_fast: l1_broadcast_fee_fast {
|
|
3809
|
+
__typename
|
|
3810
|
+
currency_amount_original_value: original_value
|
|
3811
|
+
currency_amount_original_unit: original_unit
|
|
3812
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3813
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3814
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3815
|
+
}
|
|
3816
|
+
coop_exit_fee_quote_l1_broadcast_fee_medium: l1_broadcast_fee_medium {
|
|
3817
|
+
__typename
|
|
3818
|
+
currency_amount_original_value: original_value
|
|
3819
|
+
currency_amount_original_unit: original_unit
|
|
3820
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3821
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3822
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3823
|
+
}
|
|
3824
|
+
coop_exit_fee_quote_l1_broadcast_fee_slow: l1_broadcast_fee_slow {
|
|
3825
|
+
__typename
|
|
3826
|
+
currency_amount_original_value: original_value
|
|
3827
|
+
currency_amount_original_unit: original_unit
|
|
3828
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
3829
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
3830
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
3831
|
+
}
|
|
3832
|
+
coop_exit_fee_quote_expires_at: expires_at
|
|
3833
|
+
}`;
|
|
3834
|
+
|
|
3724
3835
|
// src/graphql/objects/LeavesSwapFeeEstimateOutput.ts
|
|
3725
3836
|
init_buffer();
|
|
3726
3837
|
var LeavesSwapFeeEstimateOutputFromJson = (obj) => {
|
|
@@ -3728,7 +3839,7 @@ var LeavesSwapFeeEstimateOutputFromJson = (obj) => {
|
|
|
3728
3839
|
feeEstimate: CurrencyAmountFromJson(obj["leaves_swap_fee_estimate_output_fee_estimate"])
|
|
3729
3840
|
};
|
|
3730
3841
|
};
|
|
3731
|
-
var
|
|
3842
|
+
var FRAGMENT11 = `
|
|
3732
3843
|
fragment LeavesSwapFeeEstimateOutputFragment on LeavesSwapFeeEstimateOutput {
|
|
3733
3844
|
__typename
|
|
3734
3845
|
leaves_swap_fee_estimate_output_fee_estimate: fee_estimate {
|
|
@@ -3748,7 +3859,7 @@ var LightningSendFeeEstimateOutputFromJson = (obj) => {
|
|
|
3748
3859
|
feeEstimate: CurrencyAmountFromJson(obj["lightning_send_fee_estimate_output_fee_estimate"])
|
|
3749
3860
|
};
|
|
3750
3861
|
};
|
|
3751
|
-
var
|
|
3862
|
+
var FRAGMENT12 = `
|
|
3752
3863
|
fragment LightningSendFeeEstimateOutputFragment on LightningSendFeeEstimateOutput {
|
|
3753
3864
|
__typename
|
|
3754
3865
|
lightning_send_fee_estimate_output_fee_estimate: fee_estimate {
|
|
@@ -3772,7 +3883,7 @@ var StaticDepositQuoteOutputFromJson = (obj) => {
|
|
|
3772
3883
|
signature: obj["static_deposit_quote_output_signature"]
|
|
3773
3884
|
};
|
|
3774
3885
|
};
|
|
3775
|
-
var
|
|
3886
|
+
var FRAGMENT13 = `
|
|
3776
3887
|
fragment StaticDepositQuoteOutputFragment on StaticDepositQuoteOutput {
|
|
3777
3888
|
__typename
|
|
3778
3889
|
static_deposit_quote_output_transaction_id: transaction_id
|
|
@@ -3819,7 +3930,28 @@ var GetClaimDepositQuote = `
|
|
|
3819
3930
|
...StaticDepositQuoteOutputFragment
|
|
3820
3931
|
}
|
|
3821
3932
|
}
|
|
3822
|
-
${
|
|
3933
|
+
${FRAGMENT13}
|
|
3934
|
+
`;
|
|
3935
|
+
|
|
3936
|
+
// src/graphql/queries/GetCoopExitFeeQuote.ts
|
|
3937
|
+
init_buffer();
|
|
3938
|
+
var GetCoopExitFeeQuote = `
|
|
3939
|
+
query CoopExitFeeQuote(
|
|
3940
|
+
$leaf_external_ids: [UUID!]!
|
|
3941
|
+
$withdrawal_address: String!
|
|
3942
|
+
) {
|
|
3943
|
+
coop_exit_fee_quote(
|
|
3944
|
+
input: {
|
|
3945
|
+
leaf_external_ids: $leaf_external_ids,
|
|
3946
|
+
withdrawal_address: $withdrawal_address
|
|
3947
|
+
}
|
|
3948
|
+
) {
|
|
3949
|
+
quote {
|
|
3950
|
+
...CoopExitFeeQuoteFragment
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
}
|
|
3954
|
+
${FRAGMENT10}
|
|
3823
3955
|
`;
|
|
3824
3956
|
|
|
3825
3957
|
// src/graphql/queries/LeavesSwapFeeEstimate.ts
|
|
@@ -3836,7 +3968,7 @@ var LeavesSwapFeeEstimate = `
|
|
|
3836
3968
|
...LeavesSwapFeeEstimateOutputFragment
|
|
3837
3969
|
}
|
|
3838
3970
|
}
|
|
3839
|
-
${
|
|
3971
|
+
${FRAGMENT11}
|
|
3840
3972
|
`;
|
|
3841
3973
|
|
|
3842
3974
|
// src/graphql/queries/LightningSendFeeEstimate.ts
|
|
@@ -3855,7 +3987,7 @@ var LightningSendFeeEstimate = `
|
|
|
3855
3987
|
...LightningSendFeeEstimateOutputFragment
|
|
3856
3988
|
}
|
|
3857
3989
|
}
|
|
3858
|
-
${
|
|
3990
|
+
${FRAGMENT12}
|
|
3859
3991
|
`;
|
|
3860
3992
|
|
|
3861
3993
|
// src/graphql/queries/Transfer.ts
|
|
@@ -3874,13 +4006,13 @@ init_buffer();
|
|
|
3874
4006
|
|
|
3875
4007
|
// src/graphql/objects/UserRequest.ts
|
|
3876
4008
|
init_buffer();
|
|
3877
|
-
var
|
|
4009
|
+
var import_core7 = require("@lightsparkdev/core");
|
|
3878
4010
|
|
|
3879
4011
|
// src/graphql/objects/ClaimStaticDepositStatus.ts
|
|
3880
4012
|
init_buffer();
|
|
3881
4013
|
|
|
3882
4014
|
// src/graphql/objects/UserRequest.ts
|
|
3883
|
-
var
|
|
4015
|
+
var FRAGMENT14 = `
|
|
3884
4016
|
fragment UserRequestFragment on UserRequest {
|
|
3885
4017
|
__typename
|
|
3886
4018
|
... on ClaimStaticDeposit {
|
|
@@ -4112,7 +4244,7 @@ var UserRequest2 = `
|
|
|
4112
4244
|
...UserRequestFragment
|
|
4113
4245
|
}
|
|
4114
4246
|
}
|
|
4115
|
-
${
|
|
4247
|
+
${FRAGMENT14}
|
|
4116
4248
|
`;
|
|
4117
4249
|
|
|
4118
4250
|
// src/graphql/client.ts
|
|
@@ -4125,13 +4257,13 @@ var SspClient = class {
|
|
|
4125
4257
|
this.authProvider = new SparkAuthProvider();
|
|
4126
4258
|
const fetchFunction = typeof window !== "undefined" ? window.fetch.bind(window) : fetch;
|
|
4127
4259
|
const options = config.sspClientOptions;
|
|
4128
|
-
this.requester = new
|
|
4129
|
-
new
|
|
4260
|
+
this.requester = new import_core8.Requester(
|
|
4261
|
+
new import_core8.NodeKeyCache(import_core8.DefaultCrypto),
|
|
4130
4262
|
options.schemaEndpoint || `graphql/spark/2025-03-19`,
|
|
4131
4263
|
`spark-sdk/0.0.0`,
|
|
4132
4264
|
this.authProvider,
|
|
4133
4265
|
options.baseUrl,
|
|
4134
|
-
|
|
4266
|
+
import_core8.DefaultCrypto,
|
|
4135
4267
|
void 0,
|
|
4136
4268
|
fetchFunction
|
|
4137
4269
|
);
|
|
@@ -4234,7 +4366,10 @@ var SspClient = class {
|
|
|
4234
4366
|
leafExternalIds,
|
|
4235
4367
|
withdrawalAddress,
|
|
4236
4368
|
idempotencyKey,
|
|
4237
|
-
exitSpeed
|
|
4369
|
+
exitSpeed,
|
|
4370
|
+
feeLeafExternalIds,
|
|
4371
|
+
feeQuoteId,
|
|
4372
|
+
withdrawAll
|
|
4238
4373
|
}) {
|
|
4239
4374
|
return await this.executeRawQuery({
|
|
4240
4375
|
queryPayload: RequestCoopExit,
|
|
@@ -4242,7 +4377,10 @@ var SspClient = class {
|
|
|
4242
4377
|
leaf_external_ids: leafExternalIds,
|
|
4243
4378
|
withdrawal_address: withdrawalAddress,
|
|
4244
4379
|
idempotency_key: idempotencyKey,
|
|
4245
|
-
exit_speed: exitSpeed
|
|
4380
|
+
exit_speed: exitSpeed,
|
|
4381
|
+
fee_leaf_external_ids: feeLeafExternalIds,
|
|
4382
|
+
fee_quote_id: feeQuoteId,
|
|
4383
|
+
withdraw_all: withdrawAll
|
|
4246
4384
|
},
|
|
4247
4385
|
constructObject: (response) => {
|
|
4248
4386
|
return CoopExitRequestFromJson(response.request_coop_exit.request);
|
|
@@ -4304,7 +4442,8 @@ var SspClient = class {
|
|
|
4304
4442
|
targetAmountSats,
|
|
4305
4443
|
feeSats,
|
|
4306
4444
|
userLeaves,
|
|
4307
|
-
idempotencyKey
|
|
4445
|
+
idempotencyKey,
|
|
4446
|
+
targetAmountSatsList
|
|
4308
4447
|
}) {
|
|
4309
4448
|
const query = {
|
|
4310
4449
|
queryPayload: RequestSwapLeaves,
|
|
@@ -4314,7 +4453,8 @@ var SspClient = class {
|
|
|
4314
4453
|
target_amount_sats: targetAmountSats,
|
|
4315
4454
|
fee_sats: feeSats,
|
|
4316
4455
|
user_leaves: userLeaves,
|
|
4317
|
-
idempotency_key: idempotencyKey
|
|
4456
|
+
idempotency_key: idempotencyKey,
|
|
4457
|
+
target_amount_sats_list: targetAmountSatsList
|
|
4318
4458
|
},
|
|
4319
4459
|
constructObject: (response) => {
|
|
4320
4460
|
if (!response.request_leaves_swap) {
|
|
@@ -4457,7 +4597,7 @@ var SspClient = class {
|
|
|
4457
4597
|
{
|
|
4458
4598
|
queryPayload: GetChallenge,
|
|
4459
4599
|
variables: {
|
|
4460
|
-
public_key: (0,
|
|
4600
|
+
public_key: (0, import_core8.bytesToHex)(await this.signer.getIdentityPublicKey())
|
|
4461
4601
|
},
|
|
4462
4602
|
constructObject: (response) => {
|
|
4463
4603
|
return GetChallengeOutputFromJson(response.get_challenge);
|
|
@@ -4473,7 +4613,7 @@ var SspClient = class {
|
|
|
4473
4613
|
variables: {
|
|
4474
4614
|
protected_challenge: protectedChallenge,
|
|
4475
4615
|
signature,
|
|
4476
|
-
identity_public_key: (0,
|
|
4616
|
+
identity_public_key: (0, import_core8.bytesToHex)(
|
|
4477
4617
|
await this.signer.getIdentityPublicKey()
|
|
4478
4618
|
)
|
|
4479
4619
|
},
|
|
@@ -4506,6 +4646,21 @@ var SspClient = class {
|
|
|
4506
4646
|
new Date(verifyChallenge.validUntil)
|
|
4507
4647
|
);
|
|
4508
4648
|
}
|
|
4649
|
+
async getCoopExitFeeQuote({
|
|
4650
|
+
leafExternalIds,
|
|
4651
|
+
withdrawalAddress
|
|
4652
|
+
}) {
|
|
4653
|
+
return await this.executeRawQuery({
|
|
4654
|
+
queryPayload: GetCoopExitFeeQuote,
|
|
4655
|
+
variables: {
|
|
4656
|
+
leaf_external_ids: leafExternalIds,
|
|
4657
|
+
withdrawal_address: withdrawalAddress
|
|
4658
|
+
},
|
|
4659
|
+
constructObject: (response) => {
|
|
4660
|
+
return CoopExitFeeQuoteFromJson(response.coop_exit_fee_quote.quote);
|
|
4661
|
+
}
|
|
4662
|
+
});
|
|
4663
|
+
}
|
|
4509
4664
|
};
|
|
4510
4665
|
var SparkAuthProvider = class {
|
|
4511
4666
|
sessionToken;
|
|
@@ -4547,10 +4702,6 @@ init_buffer();
|
|
|
4547
4702
|
|
|
4548
4703
|
// src/graphql/objects/ClaimStaticDeposit.ts
|
|
4549
4704
|
init_buffer();
|
|
4550
|
-
var import_core8 = require("@lightsparkdev/core");
|
|
4551
|
-
|
|
4552
|
-
// src/graphql/objects/CoopExitFeeQuote.ts
|
|
4553
|
-
init_buffer();
|
|
4554
4705
|
var import_core9 = require("@lightsparkdev/core");
|
|
4555
4706
|
|
|
4556
4707
|
// src/graphql/objects/SparkUserRequestStatus.ts
|
|
@@ -4939,7 +5090,7 @@ var TransferStatus = /* @__PURE__ */ ((TransferStatus2) => {
|
|
|
4939
5090
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING"] = 1] = "TRANSFER_STATUS_SENDER_KEY_TWEAK_PENDING";
|
|
4940
5091
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_SENDER_KEY_TWEAKED"] = 2] = "TRANSFER_STATUS_SENDER_KEY_TWEAKED";
|
|
4941
5092
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RECEIVER_KEY_TWEAKED"] = 3] = "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED";
|
|
4942
|
-
TransferStatus2[TransferStatus2["
|
|
5093
|
+
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RECEIVER_REFUND_SIGNED"] = 4] = "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED";
|
|
4943
5094
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_COMPLETED"] = 5] = "TRANSFER_STATUS_COMPLETED";
|
|
4944
5095
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_EXPIRED"] = 6] = "TRANSFER_STATUS_EXPIRED";
|
|
4945
5096
|
TransferStatus2[TransferStatus2["TRANSFER_STATUS_RETURNED"] = 7] = "TRANSFER_STATUS_RETURNED";
|
|
@@ -4964,8 +5115,8 @@ function transferStatusFromJSON(object) {
|
|
|
4964
5115
|
case "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED":
|
|
4965
5116
|
return 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */;
|
|
4966
5117
|
case 4:
|
|
4967
|
-
case "
|
|
4968
|
-
return 4 /*
|
|
5118
|
+
case "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED":
|
|
5119
|
+
return 4 /* TRANSFER_STATUS_RECEIVER_REFUND_SIGNED */;
|
|
4969
5120
|
case 5:
|
|
4970
5121
|
case "TRANSFER_STATUS_COMPLETED":
|
|
4971
5122
|
return 5 /* TRANSFER_STATUS_COMPLETED */;
|
|
@@ -5000,8 +5151,8 @@ function transferStatusToJSON(object) {
|
|
|
5000
5151
|
return "TRANSFER_STATUS_SENDER_KEY_TWEAKED";
|
|
5001
5152
|
case 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */:
|
|
5002
5153
|
return "TRANSFER_STATUS_RECEIVER_KEY_TWEAKED";
|
|
5003
|
-
case 4 /*
|
|
5004
|
-
return "
|
|
5154
|
+
case 4 /* TRANSFER_STATUS_RECEIVER_REFUND_SIGNED */:
|
|
5155
|
+
return "TRANSFER_STATUS_RECEIVER_REFUND_SIGNED";
|
|
5005
5156
|
case 5 /* TRANSFER_STATUS_COMPLETED */:
|
|
5006
5157
|
return "TRANSFER_STATUS_COMPLETED";
|
|
5007
5158
|
case 6 /* TRANSFER_STATUS_EXPIRED */:
|
|
@@ -6093,7 +6244,7 @@ var SigningJob = {
|
|
|
6093
6244
|
}
|
|
6094
6245
|
};
|
|
6095
6246
|
function createBaseSigningKeyshare() {
|
|
6096
|
-
return { ownerIdentifiers: [], threshold: 0, publicKey: new Uint8Array(0) };
|
|
6247
|
+
return { ownerIdentifiers: [], threshold: 0, publicKey: new Uint8Array(0), publicShares: {}, updatedTime: void 0 };
|
|
6097
6248
|
}
|
|
6098
6249
|
var SigningKeyshare = {
|
|
6099
6250
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -6106,6 +6257,12 @@ var SigningKeyshare = {
|
|
|
6106
6257
|
if (message.publicKey.length !== 0) {
|
|
6107
6258
|
writer.uint32(26).bytes(message.publicKey);
|
|
6108
6259
|
}
|
|
6260
|
+
Object.entries(message.publicShares).forEach(([key, value]) => {
|
|
6261
|
+
SigningKeyshare_PublicSharesEntry.encode({ key, value }, writer.uint32(34).fork()).join();
|
|
6262
|
+
});
|
|
6263
|
+
if (message.updatedTime !== void 0) {
|
|
6264
|
+
Timestamp.encode(toTimestamp(message.updatedTime), writer.uint32(42).fork()).join();
|
|
6265
|
+
}
|
|
6109
6266
|
return writer;
|
|
6110
6267
|
},
|
|
6111
6268
|
decode(input, length) {
|
|
@@ -6136,6 +6293,23 @@ var SigningKeyshare = {
|
|
|
6136
6293
|
message.publicKey = reader.bytes();
|
|
6137
6294
|
continue;
|
|
6138
6295
|
}
|
|
6296
|
+
case 4: {
|
|
6297
|
+
if (tag !== 34) {
|
|
6298
|
+
break;
|
|
6299
|
+
}
|
|
6300
|
+
const entry4 = SigningKeyshare_PublicSharesEntry.decode(reader, reader.uint32());
|
|
6301
|
+
if (entry4.value !== void 0) {
|
|
6302
|
+
message.publicShares[entry4.key] = entry4.value;
|
|
6303
|
+
}
|
|
6304
|
+
continue;
|
|
6305
|
+
}
|
|
6306
|
+
case 5: {
|
|
6307
|
+
if (tag !== 42) {
|
|
6308
|
+
break;
|
|
6309
|
+
}
|
|
6310
|
+
message.updatedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
6311
|
+
continue;
|
|
6312
|
+
}
|
|
6139
6313
|
}
|
|
6140
6314
|
if ((tag & 7) === 4 || tag === 0) {
|
|
6141
6315
|
break;
|
|
@@ -6148,7 +6322,12 @@ var SigningKeyshare = {
|
|
|
6148
6322
|
return {
|
|
6149
6323
|
ownerIdentifiers: globalThis.Array.isArray(object?.ownerIdentifiers) ? object.ownerIdentifiers.map((e) => globalThis.String(e)) : [],
|
|
6150
6324
|
threshold: isSet3(object.threshold) ? globalThis.Number(object.threshold) : 0,
|
|
6151
|
-
publicKey: isSet3(object.publicKey) ? bytesFromBase642(object.publicKey) : new Uint8Array(0)
|
|
6325
|
+
publicKey: isSet3(object.publicKey) ? bytesFromBase642(object.publicKey) : new Uint8Array(0),
|
|
6326
|
+
publicShares: isObject9(object.publicShares) ? Object.entries(object.publicShares).reduce((acc, [key, value]) => {
|
|
6327
|
+
acc[key] = bytesFromBase642(value);
|
|
6328
|
+
return acc;
|
|
6329
|
+
}, {}) : {},
|
|
6330
|
+
updatedTime: isSet3(object.updatedTime) ? fromJsonTimestamp(object.updatedTime) : void 0
|
|
6152
6331
|
};
|
|
6153
6332
|
},
|
|
6154
6333
|
toJSON(message) {
|
|
@@ -6162,6 +6341,18 @@ var SigningKeyshare = {
|
|
|
6162
6341
|
if (message.publicKey.length !== 0) {
|
|
6163
6342
|
obj.publicKey = base64FromBytes2(message.publicKey);
|
|
6164
6343
|
}
|
|
6344
|
+
if (message.publicShares) {
|
|
6345
|
+
const entries = Object.entries(message.publicShares);
|
|
6346
|
+
if (entries.length > 0) {
|
|
6347
|
+
obj.publicShares = {};
|
|
6348
|
+
entries.forEach(([k, v]) => {
|
|
6349
|
+
obj.publicShares[k] = base64FromBytes2(v);
|
|
6350
|
+
});
|
|
6351
|
+
}
|
|
6352
|
+
}
|
|
6353
|
+
if (message.updatedTime !== void 0) {
|
|
6354
|
+
obj.updatedTime = message.updatedTime.toISOString();
|
|
6355
|
+
}
|
|
6165
6356
|
return obj;
|
|
6166
6357
|
},
|
|
6167
6358
|
create(base) {
|
|
@@ -6172,6 +6363,84 @@ var SigningKeyshare = {
|
|
|
6172
6363
|
message.ownerIdentifiers = object.ownerIdentifiers?.map((e) => e) || [];
|
|
6173
6364
|
message.threshold = object.threshold ?? 0;
|
|
6174
6365
|
message.publicKey = object.publicKey ?? new Uint8Array(0);
|
|
6366
|
+
message.publicShares = Object.entries(object.publicShares ?? {}).reduce(
|
|
6367
|
+
(acc, [key, value]) => {
|
|
6368
|
+
if (value !== void 0) {
|
|
6369
|
+
acc[key] = value;
|
|
6370
|
+
}
|
|
6371
|
+
return acc;
|
|
6372
|
+
},
|
|
6373
|
+
{}
|
|
6374
|
+
);
|
|
6375
|
+
message.updatedTime = object.updatedTime ?? void 0;
|
|
6376
|
+
return message;
|
|
6377
|
+
}
|
|
6378
|
+
};
|
|
6379
|
+
function createBaseSigningKeyshare_PublicSharesEntry() {
|
|
6380
|
+
return { key: "", value: new Uint8Array(0) };
|
|
6381
|
+
}
|
|
6382
|
+
var SigningKeyshare_PublicSharesEntry = {
|
|
6383
|
+
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
6384
|
+
if (message.key !== "") {
|
|
6385
|
+
writer.uint32(10).string(message.key);
|
|
6386
|
+
}
|
|
6387
|
+
if (message.value.length !== 0) {
|
|
6388
|
+
writer.uint32(18).bytes(message.value);
|
|
6389
|
+
}
|
|
6390
|
+
return writer;
|
|
6391
|
+
},
|
|
6392
|
+
decode(input, length) {
|
|
6393
|
+
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
6394
|
+
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
6395
|
+
const message = createBaseSigningKeyshare_PublicSharesEntry();
|
|
6396
|
+
while (reader.pos < end) {
|
|
6397
|
+
const tag = reader.uint32();
|
|
6398
|
+
switch (tag >>> 3) {
|
|
6399
|
+
case 1: {
|
|
6400
|
+
if (tag !== 10) {
|
|
6401
|
+
break;
|
|
6402
|
+
}
|
|
6403
|
+
message.key = reader.string();
|
|
6404
|
+
continue;
|
|
6405
|
+
}
|
|
6406
|
+
case 2: {
|
|
6407
|
+
if (tag !== 18) {
|
|
6408
|
+
break;
|
|
6409
|
+
}
|
|
6410
|
+
message.value = reader.bytes();
|
|
6411
|
+
continue;
|
|
6412
|
+
}
|
|
6413
|
+
}
|
|
6414
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
6415
|
+
break;
|
|
6416
|
+
}
|
|
6417
|
+
reader.skip(tag & 7);
|
|
6418
|
+
}
|
|
6419
|
+
return message;
|
|
6420
|
+
},
|
|
6421
|
+
fromJSON(object) {
|
|
6422
|
+
return {
|
|
6423
|
+
key: isSet3(object.key) ? globalThis.String(object.key) : "",
|
|
6424
|
+
value: isSet3(object.value) ? bytesFromBase642(object.value) : new Uint8Array(0)
|
|
6425
|
+
};
|
|
6426
|
+
},
|
|
6427
|
+
toJSON(message) {
|
|
6428
|
+
const obj = {};
|
|
6429
|
+
if (message.key !== "") {
|
|
6430
|
+
obj.key = message.key;
|
|
6431
|
+
}
|
|
6432
|
+
if (message.value.length !== 0) {
|
|
6433
|
+
obj.value = base64FromBytes2(message.value);
|
|
6434
|
+
}
|
|
6435
|
+
return obj;
|
|
6436
|
+
},
|
|
6437
|
+
create(base) {
|
|
6438
|
+
return SigningKeyshare_PublicSharesEntry.fromPartial(base ?? {});
|
|
6439
|
+
},
|
|
6440
|
+
fromPartial(object) {
|
|
6441
|
+
const message = createBaseSigningKeyshare_PublicSharesEntry();
|
|
6442
|
+
message.key = object.key ?? "";
|
|
6443
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
6175
6444
|
return message;
|
|
6176
6445
|
}
|
|
6177
6446
|
};
|
|
@@ -7868,7 +8137,8 @@ function createBaseStartTokenTransactionRequest() {
|
|
|
7868
8137
|
return {
|
|
7869
8138
|
identityPublicKey: new Uint8Array(0),
|
|
7870
8139
|
partialTokenTransaction: void 0,
|
|
7871
|
-
tokenTransactionSignatures: void 0
|
|
8140
|
+
tokenTransactionSignatures: void 0,
|
|
8141
|
+
sparkPaymentIntent: ""
|
|
7872
8142
|
};
|
|
7873
8143
|
}
|
|
7874
8144
|
var StartTokenTransactionRequest = {
|
|
@@ -7882,6 +8152,9 @@ var StartTokenTransactionRequest = {
|
|
|
7882
8152
|
if (message.tokenTransactionSignatures !== void 0) {
|
|
7883
8153
|
TokenTransactionSignatures.encode(message.tokenTransactionSignatures, writer.uint32(26).fork()).join();
|
|
7884
8154
|
}
|
|
8155
|
+
if (message.sparkPaymentIntent !== "") {
|
|
8156
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
8157
|
+
}
|
|
7885
8158
|
return writer;
|
|
7886
8159
|
},
|
|
7887
8160
|
decode(input, length) {
|
|
@@ -7912,6 +8185,13 @@ var StartTokenTransactionRequest = {
|
|
|
7912
8185
|
message.tokenTransactionSignatures = TokenTransactionSignatures.decode(reader, reader.uint32());
|
|
7913
8186
|
continue;
|
|
7914
8187
|
}
|
|
8188
|
+
case 4: {
|
|
8189
|
+
if (tag !== 34) {
|
|
8190
|
+
break;
|
|
8191
|
+
}
|
|
8192
|
+
message.sparkPaymentIntent = reader.string();
|
|
8193
|
+
continue;
|
|
8194
|
+
}
|
|
7915
8195
|
}
|
|
7916
8196
|
if ((tag & 7) === 4 || tag === 0) {
|
|
7917
8197
|
break;
|
|
@@ -7924,7 +8204,8 @@ var StartTokenTransactionRequest = {
|
|
|
7924
8204
|
return {
|
|
7925
8205
|
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
7926
8206
|
partialTokenTransaction: isSet3(object.partialTokenTransaction) ? TokenTransaction.fromJSON(object.partialTokenTransaction) : void 0,
|
|
7927
|
-
tokenTransactionSignatures: isSet3(object.tokenTransactionSignatures) ? TokenTransactionSignatures.fromJSON(object.tokenTransactionSignatures) : void 0
|
|
8207
|
+
tokenTransactionSignatures: isSet3(object.tokenTransactionSignatures) ? TokenTransactionSignatures.fromJSON(object.tokenTransactionSignatures) : void 0,
|
|
8208
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
7928
8209
|
};
|
|
7929
8210
|
},
|
|
7930
8211
|
toJSON(message) {
|
|
@@ -7938,6 +8219,9 @@ var StartTokenTransactionRequest = {
|
|
|
7938
8219
|
if (message.tokenTransactionSignatures !== void 0) {
|
|
7939
8220
|
obj.tokenTransactionSignatures = TokenTransactionSignatures.toJSON(message.tokenTransactionSignatures);
|
|
7940
8221
|
}
|
|
8222
|
+
if (message.sparkPaymentIntent !== "") {
|
|
8223
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
8224
|
+
}
|
|
7941
8225
|
return obj;
|
|
7942
8226
|
},
|
|
7943
8227
|
create(base) {
|
|
@@ -7948,6 +8232,7 @@ var StartTokenTransactionRequest = {
|
|
|
7948
8232
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
7949
8233
|
message.partialTokenTransaction = object.partialTokenTransaction !== void 0 && object.partialTokenTransaction !== null ? TokenTransaction.fromPartial(object.partialTokenTransaction) : void 0;
|
|
7950
8234
|
message.tokenTransactionSignatures = object.tokenTransactionSignatures !== void 0 && object.tokenTransactionSignatures !== null ? TokenTransactionSignatures.fromPartial(object.tokenTransactionSignatures) : void 0;
|
|
8235
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
7951
8236
|
return message;
|
|
7952
8237
|
}
|
|
7953
8238
|
};
|
|
@@ -8445,7 +8730,12 @@ var RevocationSecretWithIndex = {
|
|
|
8445
8730
|
}
|
|
8446
8731
|
};
|
|
8447
8732
|
function createBaseFinalizeTokenTransactionRequest() {
|
|
8448
|
-
return {
|
|
8733
|
+
return {
|
|
8734
|
+
finalTokenTransaction: void 0,
|
|
8735
|
+
revocationSecrets: [],
|
|
8736
|
+
identityPublicKey: new Uint8Array(0),
|
|
8737
|
+
sparkPaymentIntent: ""
|
|
8738
|
+
};
|
|
8449
8739
|
}
|
|
8450
8740
|
var FinalizeTokenTransactionRequest = {
|
|
8451
8741
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -8458,6 +8748,9 @@ var FinalizeTokenTransactionRequest = {
|
|
|
8458
8748
|
if (message.identityPublicKey.length !== 0) {
|
|
8459
8749
|
writer.uint32(26).bytes(message.identityPublicKey);
|
|
8460
8750
|
}
|
|
8751
|
+
if (message.sparkPaymentIntent !== "") {
|
|
8752
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
8753
|
+
}
|
|
8461
8754
|
return writer;
|
|
8462
8755
|
},
|
|
8463
8756
|
decode(input, length) {
|
|
@@ -8488,6 +8781,13 @@ var FinalizeTokenTransactionRequest = {
|
|
|
8488
8781
|
message.identityPublicKey = reader.bytes();
|
|
8489
8782
|
continue;
|
|
8490
8783
|
}
|
|
8784
|
+
case 4: {
|
|
8785
|
+
if (tag !== 34) {
|
|
8786
|
+
break;
|
|
8787
|
+
}
|
|
8788
|
+
message.sparkPaymentIntent = reader.string();
|
|
8789
|
+
continue;
|
|
8790
|
+
}
|
|
8491
8791
|
}
|
|
8492
8792
|
if ((tag & 7) === 4 || tag === 0) {
|
|
8493
8793
|
break;
|
|
@@ -8500,7 +8800,8 @@ var FinalizeTokenTransactionRequest = {
|
|
|
8500
8800
|
return {
|
|
8501
8801
|
finalTokenTransaction: isSet3(object.finalTokenTransaction) ? TokenTransaction.fromJSON(object.finalTokenTransaction) : void 0,
|
|
8502
8802
|
revocationSecrets: globalThis.Array.isArray(object?.revocationSecrets) ? object.revocationSecrets.map((e) => RevocationSecretWithIndex.fromJSON(e)) : [],
|
|
8503
|
-
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0)
|
|
8803
|
+
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
8804
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
8504
8805
|
};
|
|
8505
8806
|
},
|
|
8506
8807
|
toJSON(message) {
|
|
@@ -8514,6 +8815,9 @@ var FinalizeTokenTransactionRequest = {
|
|
|
8514
8815
|
if (message.identityPublicKey.length !== 0) {
|
|
8515
8816
|
obj.identityPublicKey = base64FromBytes2(message.identityPublicKey);
|
|
8516
8817
|
}
|
|
8818
|
+
if (message.sparkPaymentIntent !== "") {
|
|
8819
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
8820
|
+
}
|
|
8517
8821
|
return obj;
|
|
8518
8822
|
},
|
|
8519
8823
|
create(base) {
|
|
@@ -8524,6 +8828,7 @@ var FinalizeTokenTransactionRequest = {
|
|
|
8524
8828
|
message.finalTokenTransaction = object.finalTokenTransaction !== void 0 && object.finalTokenTransaction !== null ? TokenTransaction.fromPartial(object.finalTokenTransaction) : void 0;
|
|
8525
8829
|
message.revocationSecrets = object.revocationSecrets?.map((e) => RevocationSecretWithIndex.fromPartial(e)) || [];
|
|
8526
8830
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
8831
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
8527
8832
|
return message;
|
|
8528
8833
|
}
|
|
8529
8834
|
};
|
|
@@ -9216,7 +9521,10 @@ function createBaseTreeNode() {
|
|
|
9216
9521
|
ownerIdentityPublicKey: new Uint8Array(0),
|
|
9217
9522
|
signingKeyshare: void 0,
|
|
9218
9523
|
status: "",
|
|
9219
|
-
network: 0
|
|
9524
|
+
network: 0,
|
|
9525
|
+
createdTime: void 0,
|
|
9526
|
+
updatedTime: void 0,
|
|
9527
|
+
ownerSigningPublicKey: new Uint8Array(0)
|
|
9220
9528
|
};
|
|
9221
9529
|
}
|
|
9222
9530
|
var TreeNode = {
|
|
@@ -9257,6 +9565,15 @@ var TreeNode = {
|
|
|
9257
9565
|
if (message.network !== 0) {
|
|
9258
9566
|
writer.uint32(96).int32(message.network);
|
|
9259
9567
|
}
|
|
9568
|
+
if (message.createdTime !== void 0) {
|
|
9569
|
+
Timestamp.encode(toTimestamp(message.createdTime), writer.uint32(106).fork()).join();
|
|
9570
|
+
}
|
|
9571
|
+
if (message.updatedTime !== void 0) {
|
|
9572
|
+
Timestamp.encode(toTimestamp(message.updatedTime), writer.uint32(114).fork()).join();
|
|
9573
|
+
}
|
|
9574
|
+
if (message.ownerSigningPublicKey.length !== 0) {
|
|
9575
|
+
writer.uint32(122).bytes(message.ownerSigningPublicKey);
|
|
9576
|
+
}
|
|
9260
9577
|
return writer;
|
|
9261
9578
|
},
|
|
9262
9579
|
decode(input, length) {
|
|
@@ -9350,6 +9667,27 @@ var TreeNode = {
|
|
|
9350
9667
|
message.network = reader.int32();
|
|
9351
9668
|
continue;
|
|
9352
9669
|
}
|
|
9670
|
+
case 13: {
|
|
9671
|
+
if (tag !== 106) {
|
|
9672
|
+
break;
|
|
9673
|
+
}
|
|
9674
|
+
message.createdTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
9675
|
+
continue;
|
|
9676
|
+
}
|
|
9677
|
+
case 14: {
|
|
9678
|
+
if (tag !== 114) {
|
|
9679
|
+
break;
|
|
9680
|
+
}
|
|
9681
|
+
message.updatedTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
9682
|
+
continue;
|
|
9683
|
+
}
|
|
9684
|
+
case 15: {
|
|
9685
|
+
if (tag !== 122) {
|
|
9686
|
+
break;
|
|
9687
|
+
}
|
|
9688
|
+
message.ownerSigningPublicKey = reader.bytes();
|
|
9689
|
+
continue;
|
|
9690
|
+
}
|
|
9353
9691
|
}
|
|
9354
9692
|
if ((tag & 7) === 4 || tag === 0) {
|
|
9355
9693
|
break;
|
|
@@ -9371,7 +9709,10 @@ var TreeNode = {
|
|
|
9371
9709
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
9372
9710
|
signingKeyshare: isSet3(object.signingKeyshare) ? SigningKeyshare.fromJSON(object.signingKeyshare) : void 0,
|
|
9373
9711
|
status: isSet3(object.status) ? globalThis.String(object.status) : "",
|
|
9374
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
9712
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
9713
|
+
createdTime: isSet3(object.createdTime) ? fromJsonTimestamp(object.createdTime) : void 0,
|
|
9714
|
+
updatedTime: isSet3(object.updatedTime) ? fromJsonTimestamp(object.updatedTime) : void 0,
|
|
9715
|
+
ownerSigningPublicKey: isSet3(object.ownerSigningPublicKey) ? bytesFromBase642(object.ownerSigningPublicKey) : new Uint8Array(0)
|
|
9375
9716
|
};
|
|
9376
9717
|
},
|
|
9377
9718
|
toJSON(message) {
|
|
@@ -9412,6 +9753,15 @@ var TreeNode = {
|
|
|
9412
9753
|
if (message.network !== 0) {
|
|
9413
9754
|
obj.network = networkToJSON(message.network);
|
|
9414
9755
|
}
|
|
9756
|
+
if (message.createdTime !== void 0) {
|
|
9757
|
+
obj.createdTime = message.createdTime.toISOString();
|
|
9758
|
+
}
|
|
9759
|
+
if (message.updatedTime !== void 0) {
|
|
9760
|
+
obj.updatedTime = message.updatedTime.toISOString();
|
|
9761
|
+
}
|
|
9762
|
+
if (message.ownerSigningPublicKey.length !== 0) {
|
|
9763
|
+
obj.ownerSigningPublicKey = base64FromBytes2(message.ownerSigningPublicKey);
|
|
9764
|
+
}
|
|
9415
9765
|
return obj;
|
|
9416
9766
|
},
|
|
9417
9767
|
create(base) {
|
|
@@ -9431,6 +9781,9 @@ var TreeNode = {
|
|
|
9431
9781
|
message.signingKeyshare = object.signingKeyshare !== void 0 && object.signingKeyshare !== null ? SigningKeyshare.fromPartial(object.signingKeyshare) : void 0;
|
|
9432
9782
|
message.status = object.status ?? "";
|
|
9433
9783
|
message.network = object.network ?? 0;
|
|
9784
|
+
message.createdTime = object.createdTime ?? void 0;
|
|
9785
|
+
message.updatedTime = object.updatedTime ?? void 0;
|
|
9786
|
+
message.ownerSigningPublicKey = object.ownerSigningPublicKey ?? new Uint8Array(0);
|
|
9434
9787
|
return message;
|
|
9435
9788
|
}
|
|
9436
9789
|
};
|
|
@@ -10033,7 +10386,8 @@ function createBaseStartTransferRequest() {
|
|
|
10033
10386
|
leavesToSend: [],
|
|
10034
10387
|
receiverIdentityPublicKey: new Uint8Array(0),
|
|
10035
10388
|
expiryTime: void 0,
|
|
10036
|
-
transferPackage: void 0
|
|
10389
|
+
transferPackage: void 0,
|
|
10390
|
+
sparkPaymentIntent: ""
|
|
10037
10391
|
};
|
|
10038
10392
|
}
|
|
10039
10393
|
var StartTransferRequest = {
|
|
@@ -10056,6 +10410,9 @@ var StartTransferRequest = {
|
|
|
10056
10410
|
if (message.transferPackage !== void 0) {
|
|
10057
10411
|
TransferPackage.encode(message.transferPackage, writer.uint32(58).fork()).join();
|
|
10058
10412
|
}
|
|
10413
|
+
if (message.sparkPaymentIntent !== "") {
|
|
10414
|
+
writer.uint32(74).string(message.sparkPaymentIntent);
|
|
10415
|
+
}
|
|
10059
10416
|
return writer;
|
|
10060
10417
|
},
|
|
10061
10418
|
decode(input, length) {
|
|
@@ -10107,6 +10464,13 @@ var StartTransferRequest = {
|
|
|
10107
10464
|
message.transferPackage = TransferPackage.decode(reader, reader.uint32());
|
|
10108
10465
|
continue;
|
|
10109
10466
|
}
|
|
10467
|
+
case 9: {
|
|
10468
|
+
if (tag !== 74) {
|
|
10469
|
+
break;
|
|
10470
|
+
}
|
|
10471
|
+
message.sparkPaymentIntent = reader.string();
|
|
10472
|
+
continue;
|
|
10473
|
+
}
|
|
10110
10474
|
}
|
|
10111
10475
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10112
10476
|
break;
|
|
@@ -10122,7 +10486,8 @@ var StartTransferRequest = {
|
|
|
10122
10486
|
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : [],
|
|
10123
10487
|
receiverIdentityPublicKey: isSet3(object.receiverIdentityPublicKey) ? bytesFromBase642(object.receiverIdentityPublicKey) : new Uint8Array(0),
|
|
10124
10488
|
expiryTime: isSet3(object.expiryTime) ? fromJsonTimestamp(object.expiryTime) : void 0,
|
|
10125
|
-
transferPackage: isSet3(object.transferPackage) ? TransferPackage.fromJSON(object.transferPackage) : void 0
|
|
10489
|
+
transferPackage: isSet3(object.transferPackage) ? TransferPackage.fromJSON(object.transferPackage) : void 0,
|
|
10490
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
10126
10491
|
};
|
|
10127
10492
|
},
|
|
10128
10493
|
toJSON(message) {
|
|
@@ -10145,6 +10510,9 @@ var StartTransferRequest = {
|
|
|
10145
10510
|
if (message.transferPackage !== void 0) {
|
|
10146
10511
|
obj.transferPackage = TransferPackage.toJSON(message.transferPackage);
|
|
10147
10512
|
}
|
|
10513
|
+
if (message.sparkPaymentIntent !== "") {
|
|
10514
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
10515
|
+
}
|
|
10148
10516
|
return obj;
|
|
10149
10517
|
},
|
|
10150
10518
|
create(base) {
|
|
@@ -10158,6 +10526,7 @@ var StartTransferRequest = {
|
|
|
10158
10526
|
message.receiverIdentityPublicKey = object.receiverIdentityPublicKey ?? new Uint8Array(0);
|
|
10159
10527
|
message.expiryTime = object.expiryTime ?? void 0;
|
|
10160
10528
|
message.transferPackage = object.transferPackage !== void 0 && object.transferPackage !== null ? TransferPackage.fromPartial(object.transferPackage) : void 0;
|
|
10529
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
10161
10530
|
return message;
|
|
10162
10531
|
}
|
|
10163
10532
|
};
|
|
@@ -10677,7 +11046,7 @@ var SendLeafKeyTweak_PubkeySharesTweakEntry = {
|
|
|
10677
11046
|
}
|
|
10678
11047
|
};
|
|
10679
11048
|
function createBaseFinalizeTransferRequest() {
|
|
10680
|
-
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), leavesToSend: [] };
|
|
11049
|
+
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), leavesToSend: [], sparkPaymentIntent: "" };
|
|
10681
11050
|
}
|
|
10682
11051
|
var FinalizeTransferRequest = {
|
|
10683
11052
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -10690,6 +11059,9 @@ var FinalizeTransferRequest = {
|
|
|
10690
11059
|
for (const v of message.leavesToSend) {
|
|
10691
11060
|
SendLeafKeyTweak.encode(v, writer.uint32(26).fork()).join();
|
|
10692
11061
|
}
|
|
11062
|
+
if (message.sparkPaymentIntent !== "") {
|
|
11063
|
+
writer.uint32(34).string(message.sparkPaymentIntent);
|
|
11064
|
+
}
|
|
10693
11065
|
return writer;
|
|
10694
11066
|
},
|
|
10695
11067
|
decode(input, length) {
|
|
@@ -10720,6 +11092,13 @@ var FinalizeTransferRequest = {
|
|
|
10720
11092
|
message.leavesToSend.push(SendLeafKeyTweak.decode(reader, reader.uint32()));
|
|
10721
11093
|
continue;
|
|
10722
11094
|
}
|
|
11095
|
+
case 4: {
|
|
11096
|
+
if (tag !== 34) {
|
|
11097
|
+
break;
|
|
11098
|
+
}
|
|
11099
|
+
message.sparkPaymentIntent = reader.string();
|
|
11100
|
+
continue;
|
|
11101
|
+
}
|
|
10723
11102
|
}
|
|
10724
11103
|
if ((tag & 7) === 4 || tag === 0) {
|
|
10725
11104
|
break;
|
|
@@ -10732,7 +11111,8 @@ var FinalizeTransferRequest = {
|
|
|
10732
11111
|
return {
|
|
10733
11112
|
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
10734
11113
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
10735
|
-
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => SendLeafKeyTweak.fromJSON(e)) : []
|
|
11114
|
+
leavesToSend: globalThis.Array.isArray(object?.leavesToSend) ? object.leavesToSend.map((e) => SendLeafKeyTweak.fromJSON(e)) : [],
|
|
11115
|
+
sparkPaymentIntent: isSet3(object.sparkPaymentIntent) ? globalThis.String(object.sparkPaymentIntent) : ""
|
|
10736
11116
|
};
|
|
10737
11117
|
},
|
|
10738
11118
|
toJSON(message) {
|
|
@@ -10746,6 +11126,9 @@ var FinalizeTransferRequest = {
|
|
|
10746
11126
|
if (message.leavesToSend?.length) {
|
|
10747
11127
|
obj.leavesToSend = message.leavesToSend.map((e) => SendLeafKeyTweak.toJSON(e));
|
|
10748
11128
|
}
|
|
11129
|
+
if (message.sparkPaymentIntent !== "") {
|
|
11130
|
+
obj.sparkPaymentIntent = message.sparkPaymentIntent;
|
|
11131
|
+
}
|
|
10749
11132
|
return obj;
|
|
10750
11133
|
},
|
|
10751
11134
|
create(base) {
|
|
@@ -10756,6 +11139,7 @@ var FinalizeTransferRequest = {
|
|
|
10756
11139
|
message.transferId = object.transferId ?? "";
|
|
10757
11140
|
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
10758
11141
|
message.leavesToSend = object.leavesToSend?.map((e) => SendLeafKeyTweak.fromPartial(e)) || [];
|
|
11142
|
+
message.sparkPaymentIntent = object.sparkPaymentIntent ?? "";
|
|
10759
11143
|
return message;
|
|
10760
11144
|
}
|
|
10761
11145
|
};
|
|
@@ -11196,7 +11580,7 @@ var TransferLeaf = {
|
|
|
11196
11580
|
}
|
|
11197
11581
|
};
|
|
11198
11582
|
function createBaseTransferFilter() {
|
|
11199
|
-
return { participant: void 0, transferIds: [], limit: 0, offset: 0, types: [], network: 0 };
|
|
11583
|
+
return { participant: void 0, transferIds: [], limit: 0, offset: 0, types: [], network: 0, statuses: [] };
|
|
11200
11584
|
}
|
|
11201
11585
|
var TransferFilter = {
|
|
11202
11586
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -11228,6 +11612,11 @@ var TransferFilter = {
|
|
|
11228
11612
|
if (message.network !== 0) {
|
|
11229
11613
|
writer.uint32(32).int32(message.network);
|
|
11230
11614
|
}
|
|
11615
|
+
writer.uint32(642).fork();
|
|
11616
|
+
for (const v of message.statuses) {
|
|
11617
|
+
writer.int32(v);
|
|
11618
|
+
}
|
|
11619
|
+
writer.join();
|
|
11231
11620
|
return writer;
|
|
11232
11621
|
},
|
|
11233
11622
|
decode(input, length) {
|
|
@@ -11303,6 +11692,20 @@ var TransferFilter = {
|
|
|
11303
11692
|
message.network = reader.int32();
|
|
11304
11693
|
continue;
|
|
11305
11694
|
}
|
|
11695
|
+
case 80: {
|
|
11696
|
+
if (tag === 640) {
|
|
11697
|
+
message.statuses.push(reader.int32());
|
|
11698
|
+
continue;
|
|
11699
|
+
}
|
|
11700
|
+
if (tag === 642) {
|
|
11701
|
+
const end2 = reader.uint32() + reader.pos;
|
|
11702
|
+
while (reader.pos < end2) {
|
|
11703
|
+
message.statuses.push(reader.int32());
|
|
11704
|
+
}
|
|
11705
|
+
continue;
|
|
11706
|
+
}
|
|
11707
|
+
break;
|
|
11708
|
+
}
|
|
11306
11709
|
}
|
|
11307
11710
|
if ((tag & 7) === 4 || tag === 0) {
|
|
11308
11711
|
break;
|
|
@@ -11324,7 +11727,8 @@ var TransferFilter = {
|
|
|
11324
11727
|
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
11325
11728
|
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0,
|
|
11326
11729
|
types: globalThis.Array.isArray(object?.types) ? object.types.map((e) => transferTypeFromJSON(e)) : [],
|
|
11327
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
11730
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
11731
|
+
statuses: globalThis.Array.isArray(object?.statuses) ? object.statuses.map((e) => transferStatusFromJSON(e)) : []
|
|
11328
11732
|
};
|
|
11329
11733
|
},
|
|
11330
11734
|
toJSON(message) {
|
|
@@ -11351,6 +11755,9 @@ var TransferFilter = {
|
|
|
11351
11755
|
if (message.network !== 0) {
|
|
11352
11756
|
obj.network = networkToJSON(message.network);
|
|
11353
11757
|
}
|
|
11758
|
+
if (message.statuses?.length) {
|
|
11759
|
+
obj.statuses = message.statuses.map((e) => transferStatusToJSON(e));
|
|
11760
|
+
}
|
|
11354
11761
|
return obj;
|
|
11355
11762
|
},
|
|
11356
11763
|
create(base) {
|
|
@@ -11392,6 +11799,7 @@ var TransferFilter = {
|
|
|
11392
11799
|
message.offset = object.offset ?? 0;
|
|
11393
11800
|
message.types = object.types?.map((e) => e) || [];
|
|
11394
11801
|
message.network = object.network ?? 0;
|
|
11802
|
+
message.statuses = object.statuses?.map((e) => e) || [];
|
|
11395
11803
|
return message;
|
|
11396
11804
|
}
|
|
11397
11805
|
};
|
|
@@ -11690,189 +12098,53 @@ var ClaimTransferTweakKeysRequest = {
|
|
|
11690
12098
|
return {
|
|
11691
12099
|
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
11692
12100
|
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
11693
|
-
leavesToReceive: globalThis.Array.isArray(object?.leavesToReceive) ? object.leavesToReceive.map((e) => ClaimLeafKeyTweak.fromJSON(e)) : []
|
|
11694
|
-
};
|
|
11695
|
-
},
|
|
11696
|
-
toJSON(message) {
|
|
11697
|
-
const obj = {};
|
|
11698
|
-
if (message.transferId !== "") {
|
|
11699
|
-
obj.transferId = message.transferId;
|
|
11700
|
-
}
|
|
11701
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
11702
|
-
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
11703
|
-
}
|
|
11704
|
-
if (message.leavesToReceive?.length) {
|
|
11705
|
-
obj.leavesToReceive = message.leavesToReceive.map((e) => ClaimLeafKeyTweak.toJSON(e));
|
|
11706
|
-
}
|
|
11707
|
-
return obj;
|
|
11708
|
-
},
|
|
11709
|
-
create(base) {
|
|
11710
|
-
return ClaimTransferTweakKeysRequest.fromPartial(base ?? {});
|
|
11711
|
-
},
|
|
11712
|
-
fromPartial(object) {
|
|
11713
|
-
const message = createBaseClaimTransferTweakKeysRequest();
|
|
11714
|
-
message.transferId = object.transferId ?? "";
|
|
11715
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
11716
|
-
message.leavesToReceive = object.leavesToReceive?.map((e) => ClaimLeafKeyTweak.fromPartial(e)) || [];
|
|
11717
|
-
return message;
|
|
11718
|
-
}
|
|
11719
|
-
};
|
|
11720
|
-
function createBaseClaimTransferSignRefundsRequest() {
|
|
11721
|
-
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), signingJobs: [] };
|
|
11722
|
-
}
|
|
11723
|
-
var ClaimTransferSignRefundsRequest = {
|
|
11724
|
-
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
11725
|
-
if (message.transferId !== "") {
|
|
11726
|
-
writer.uint32(10).string(message.transferId);
|
|
11727
|
-
}
|
|
11728
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
11729
|
-
writer.uint32(18).bytes(message.ownerIdentityPublicKey);
|
|
11730
|
-
}
|
|
11731
|
-
for (const v of message.signingJobs) {
|
|
11732
|
-
LeafRefundTxSigningJob.encode(v, writer.uint32(26).fork()).join();
|
|
11733
|
-
}
|
|
11734
|
-
return writer;
|
|
11735
|
-
},
|
|
11736
|
-
decode(input, length) {
|
|
11737
|
-
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
11738
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
11739
|
-
const message = createBaseClaimTransferSignRefundsRequest();
|
|
11740
|
-
while (reader.pos < end) {
|
|
11741
|
-
const tag = reader.uint32();
|
|
11742
|
-
switch (tag >>> 3) {
|
|
11743
|
-
case 1: {
|
|
11744
|
-
if (tag !== 10) {
|
|
11745
|
-
break;
|
|
11746
|
-
}
|
|
11747
|
-
message.transferId = reader.string();
|
|
11748
|
-
continue;
|
|
11749
|
-
}
|
|
11750
|
-
case 2: {
|
|
11751
|
-
if (tag !== 18) {
|
|
11752
|
-
break;
|
|
11753
|
-
}
|
|
11754
|
-
message.ownerIdentityPublicKey = reader.bytes();
|
|
11755
|
-
continue;
|
|
11756
|
-
}
|
|
11757
|
-
case 3: {
|
|
11758
|
-
if (tag !== 26) {
|
|
11759
|
-
break;
|
|
11760
|
-
}
|
|
11761
|
-
message.signingJobs.push(LeafRefundTxSigningJob.decode(reader, reader.uint32()));
|
|
11762
|
-
continue;
|
|
11763
|
-
}
|
|
11764
|
-
}
|
|
11765
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
11766
|
-
break;
|
|
11767
|
-
}
|
|
11768
|
-
reader.skip(tag & 7);
|
|
11769
|
-
}
|
|
11770
|
-
return message;
|
|
11771
|
-
},
|
|
11772
|
-
fromJSON(object) {
|
|
11773
|
-
return {
|
|
11774
|
-
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
11775
|
-
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
11776
|
-
signingJobs: globalThis.Array.isArray(object?.signingJobs) ? object.signingJobs.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : []
|
|
11777
|
-
};
|
|
11778
|
-
},
|
|
11779
|
-
toJSON(message) {
|
|
11780
|
-
const obj = {};
|
|
11781
|
-
if (message.transferId !== "") {
|
|
11782
|
-
obj.transferId = message.transferId;
|
|
11783
|
-
}
|
|
11784
|
-
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
11785
|
-
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
11786
|
-
}
|
|
11787
|
-
if (message.signingJobs?.length) {
|
|
11788
|
-
obj.signingJobs = message.signingJobs.map((e) => LeafRefundTxSigningJob.toJSON(e));
|
|
11789
|
-
}
|
|
11790
|
-
return obj;
|
|
11791
|
-
},
|
|
11792
|
-
create(base) {
|
|
11793
|
-
return ClaimTransferSignRefundsRequest.fromPartial(base ?? {});
|
|
11794
|
-
},
|
|
11795
|
-
fromPartial(object) {
|
|
11796
|
-
const message = createBaseClaimTransferSignRefundsRequest();
|
|
11797
|
-
message.transferId = object.transferId ?? "";
|
|
11798
|
-
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
11799
|
-
message.signingJobs = object.signingJobs?.map((e) => LeafRefundTxSigningJob.fromPartial(e)) || [];
|
|
11800
|
-
return message;
|
|
11801
|
-
}
|
|
11802
|
-
};
|
|
11803
|
-
function createBaseClaimTransferSignRefundsResponse() {
|
|
11804
|
-
return { signingResults: [] };
|
|
11805
|
-
}
|
|
11806
|
-
var ClaimTransferSignRefundsResponse = {
|
|
11807
|
-
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
11808
|
-
for (const v of message.signingResults) {
|
|
11809
|
-
LeafRefundTxSigningResult.encode(v, writer.uint32(10).fork()).join();
|
|
11810
|
-
}
|
|
11811
|
-
return writer;
|
|
11812
|
-
},
|
|
11813
|
-
decode(input, length) {
|
|
11814
|
-
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
11815
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
11816
|
-
const message = createBaseClaimTransferSignRefundsResponse();
|
|
11817
|
-
while (reader.pos < end) {
|
|
11818
|
-
const tag = reader.uint32();
|
|
11819
|
-
switch (tag >>> 3) {
|
|
11820
|
-
case 1: {
|
|
11821
|
-
if (tag !== 10) {
|
|
11822
|
-
break;
|
|
11823
|
-
}
|
|
11824
|
-
message.signingResults.push(LeafRefundTxSigningResult.decode(reader, reader.uint32()));
|
|
11825
|
-
continue;
|
|
11826
|
-
}
|
|
11827
|
-
}
|
|
11828
|
-
if ((tag & 7) === 4 || tag === 0) {
|
|
11829
|
-
break;
|
|
11830
|
-
}
|
|
11831
|
-
reader.skip(tag & 7);
|
|
11832
|
-
}
|
|
11833
|
-
return message;
|
|
11834
|
-
},
|
|
11835
|
-
fromJSON(object) {
|
|
11836
|
-
return {
|
|
11837
|
-
signingResults: globalThis.Array.isArray(object?.signingResults) ? object.signingResults.map((e) => LeafRefundTxSigningResult.fromJSON(e)) : []
|
|
12101
|
+
leavesToReceive: globalThis.Array.isArray(object?.leavesToReceive) ? object.leavesToReceive.map((e) => ClaimLeafKeyTweak.fromJSON(e)) : []
|
|
11838
12102
|
};
|
|
11839
12103
|
},
|
|
11840
12104
|
toJSON(message) {
|
|
11841
12105
|
const obj = {};
|
|
11842
|
-
if (message.
|
|
11843
|
-
obj.
|
|
12106
|
+
if (message.transferId !== "") {
|
|
12107
|
+
obj.transferId = message.transferId;
|
|
12108
|
+
}
|
|
12109
|
+
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
12110
|
+
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
12111
|
+
}
|
|
12112
|
+
if (message.leavesToReceive?.length) {
|
|
12113
|
+
obj.leavesToReceive = message.leavesToReceive.map((e) => ClaimLeafKeyTweak.toJSON(e));
|
|
11844
12114
|
}
|
|
11845
12115
|
return obj;
|
|
11846
12116
|
},
|
|
11847
12117
|
create(base) {
|
|
11848
|
-
return
|
|
12118
|
+
return ClaimTransferTweakKeysRequest.fromPartial(base ?? {});
|
|
11849
12119
|
},
|
|
11850
12120
|
fromPartial(object) {
|
|
11851
|
-
const message =
|
|
11852
|
-
message.
|
|
12121
|
+
const message = createBaseClaimTransferTweakKeysRequest();
|
|
12122
|
+
message.transferId = object.transferId ?? "";
|
|
12123
|
+
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
12124
|
+
message.leavesToReceive = object.leavesToReceive?.map((e) => ClaimLeafKeyTweak.fromPartial(e)) || [];
|
|
11853
12125
|
return message;
|
|
11854
12126
|
}
|
|
11855
12127
|
};
|
|
11856
|
-
function
|
|
11857
|
-
return {
|
|
12128
|
+
function createBaseClaimTransferSignRefundsRequest() {
|
|
12129
|
+
return { transferId: "", ownerIdentityPublicKey: new Uint8Array(0), signingJobs: [] };
|
|
11858
12130
|
}
|
|
11859
|
-
var
|
|
12131
|
+
var ClaimTransferSignRefundsRequest = {
|
|
11860
12132
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
11861
|
-
|
|
11862
|
-
writer.uint32(10).string(
|
|
11863
|
-
}
|
|
11864
|
-
if (message.signingJob !== void 0) {
|
|
11865
|
-
SigningJob.encode(message.signingJob, writer.uint32(18).fork()).join();
|
|
12133
|
+
if (message.transferId !== "") {
|
|
12134
|
+
writer.uint32(10).string(message.transferId);
|
|
11866
12135
|
}
|
|
11867
12136
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
11868
|
-
writer.uint32(
|
|
12137
|
+
writer.uint32(18).bytes(message.ownerIdentityPublicKey);
|
|
12138
|
+
}
|
|
12139
|
+
for (const v of message.signingJobs) {
|
|
12140
|
+
LeafRefundTxSigningJob.encode(v, writer.uint32(26).fork()).join();
|
|
11869
12141
|
}
|
|
11870
12142
|
return writer;
|
|
11871
12143
|
},
|
|
11872
12144
|
decode(input, length) {
|
|
11873
12145
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
11874
12146
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
11875
|
-
const message =
|
|
12147
|
+
const message = createBaseClaimTransferSignRefundsRequest();
|
|
11876
12148
|
while (reader.pos < end) {
|
|
11877
12149
|
const tag = reader.uint32();
|
|
11878
12150
|
switch (tag >>> 3) {
|
|
@@ -11880,21 +12152,21 @@ var AggregateNodesRequest = {
|
|
|
11880
12152
|
if (tag !== 10) {
|
|
11881
12153
|
break;
|
|
11882
12154
|
}
|
|
11883
|
-
message.
|
|
12155
|
+
message.transferId = reader.string();
|
|
11884
12156
|
continue;
|
|
11885
12157
|
}
|
|
11886
12158
|
case 2: {
|
|
11887
12159
|
if (tag !== 18) {
|
|
11888
12160
|
break;
|
|
11889
12161
|
}
|
|
11890
|
-
message.
|
|
12162
|
+
message.ownerIdentityPublicKey = reader.bytes();
|
|
11891
12163
|
continue;
|
|
11892
12164
|
}
|
|
11893
12165
|
case 3: {
|
|
11894
12166
|
if (tag !== 26) {
|
|
11895
12167
|
break;
|
|
11896
12168
|
}
|
|
11897
|
-
message.
|
|
12169
|
+
message.signingJobs.push(LeafRefundTxSigningJob.decode(reader, reader.uint32()));
|
|
11898
12170
|
continue;
|
|
11899
12171
|
}
|
|
11900
12172
|
}
|
|
@@ -11907,63 +12179,49 @@ var AggregateNodesRequest = {
|
|
|
11907
12179
|
},
|
|
11908
12180
|
fromJSON(object) {
|
|
11909
12181
|
return {
|
|
11910
|
-
|
|
11911
|
-
|
|
11912
|
-
|
|
12182
|
+
transferId: isSet3(object.transferId) ? globalThis.String(object.transferId) : "",
|
|
12183
|
+
ownerIdentityPublicKey: isSet3(object.ownerIdentityPublicKey) ? bytesFromBase642(object.ownerIdentityPublicKey) : new Uint8Array(0),
|
|
12184
|
+
signingJobs: globalThis.Array.isArray(object?.signingJobs) ? object.signingJobs.map((e) => LeafRefundTxSigningJob.fromJSON(e)) : []
|
|
11913
12185
|
};
|
|
11914
12186
|
},
|
|
11915
12187
|
toJSON(message) {
|
|
11916
12188
|
const obj = {};
|
|
11917
|
-
if (message.
|
|
11918
|
-
obj.
|
|
11919
|
-
}
|
|
11920
|
-
if (message.signingJob !== void 0) {
|
|
11921
|
-
obj.signingJob = SigningJob.toJSON(message.signingJob);
|
|
12189
|
+
if (message.transferId !== "") {
|
|
12190
|
+
obj.transferId = message.transferId;
|
|
11922
12191
|
}
|
|
11923
12192
|
if (message.ownerIdentityPublicKey.length !== 0) {
|
|
11924
12193
|
obj.ownerIdentityPublicKey = base64FromBytes2(message.ownerIdentityPublicKey);
|
|
11925
12194
|
}
|
|
12195
|
+
if (message.signingJobs?.length) {
|
|
12196
|
+
obj.signingJobs = message.signingJobs.map((e) => LeafRefundTxSigningJob.toJSON(e));
|
|
12197
|
+
}
|
|
11926
12198
|
return obj;
|
|
11927
12199
|
},
|
|
11928
12200
|
create(base) {
|
|
11929
|
-
return
|
|
12201
|
+
return ClaimTransferSignRefundsRequest.fromPartial(base ?? {});
|
|
11930
12202
|
},
|
|
11931
12203
|
fromPartial(object) {
|
|
11932
|
-
const message =
|
|
11933
|
-
message.
|
|
11934
|
-
message.signingJob = object.signingJob !== void 0 && object.signingJob !== null ? SigningJob.fromPartial(object.signingJob) : void 0;
|
|
12204
|
+
const message = createBaseClaimTransferSignRefundsRequest();
|
|
12205
|
+
message.transferId = object.transferId ?? "";
|
|
11935
12206
|
message.ownerIdentityPublicKey = object.ownerIdentityPublicKey ?? new Uint8Array(0);
|
|
12207
|
+
message.signingJobs = object.signingJobs?.map((e) => LeafRefundTxSigningJob.fromPartial(e)) || [];
|
|
11936
12208
|
return message;
|
|
11937
12209
|
}
|
|
11938
12210
|
};
|
|
11939
|
-
function
|
|
11940
|
-
return {
|
|
11941
|
-
aggregateSignature: void 0,
|
|
11942
|
-
verifyingKey: new Uint8Array(0),
|
|
11943
|
-
parentNodeTx: new Uint8Array(0),
|
|
11944
|
-
parentNodeVout: 0
|
|
11945
|
-
};
|
|
12211
|
+
function createBaseClaimTransferSignRefundsResponse() {
|
|
12212
|
+
return { signingResults: [] };
|
|
11946
12213
|
}
|
|
11947
|
-
var
|
|
12214
|
+
var ClaimTransferSignRefundsResponse = {
|
|
11948
12215
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
}
|
|
11952
|
-
if (message.verifyingKey.length !== 0) {
|
|
11953
|
-
writer.uint32(18).bytes(message.verifyingKey);
|
|
11954
|
-
}
|
|
11955
|
-
if (message.parentNodeTx.length !== 0) {
|
|
11956
|
-
writer.uint32(26).bytes(message.parentNodeTx);
|
|
11957
|
-
}
|
|
11958
|
-
if (message.parentNodeVout !== 0) {
|
|
11959
|
-
writer.uint32(32).uint32(message.parentNodeVout);
|
|
12216
|
+
for (const v of message.signingResults) {
|
|
12217
|
+
LeafRefundTxSigningResult.encode(v, writer.uint32(10).fork()).join();
|
|
11960
12218
|
}
|
|
11961
12219
|
return writer;
|
|
11962
12220
|
},
|
|
11963
12221
|
decode(input, length) {
|
|
11964
12222
|
const reader = input instanceof import_wire4.BinaryReader ? input : new import_wire4.BinaryReader(input);
|
|
11965
12223
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
11966
|
-
const message =
|
|
12224
|
+
const message = createBaseClaimTransferSignRefundsResponse();
|
|
11967
12225
|
while (reader.pos < end) {
|
|
11968
12226
|
const tag = reader.uint32();
|
|
11969
12227
|
switch (tag >>> 3) {
|
|
@@ -11971,28 +12229,7 @@ var AggregateNodesResponse = {
|
|
|
11971
12229
|
if (tag !== 10) {
|
|
11972
12230
|
break;
|
|
11973
12231
|
}
|
|
11974
|
-
message.
|
|
11975
|
-
continue;
|
|
11976
|
-
}
|
|
11977
|
-
case 2: {
|
|
11978
|
-
if (tag !== 18) {
|
|
11979
|
-
break;
|
|
11980
|
-
}
|
|
11981
|
-
message.verifyingKey = reader.bytes();
|
|
11982
|
-
continue;
|
|
11983
|
-
}
|
|
11984
|
-
case 3: {
|
|
11985
|
-
if (tag !== 26) {
|
|
11986
|
-
break;
|
|
11987
|
-
}
|
|
11988
|
-
message.parentNodeTx = reader.bytes();
|
|
11989
|
-
continue;
|
|
11990
|
-
}
|
|
11991
|
-
case 4: {
|
|
11992
|
-
if (tag !== 32) {
|
|
11993
|
-
break;
|
|
11994
|
-
}
|
|
11995
|
-
message.parentNodeVout = reader.uint32();
|
|
12232
|
+
message.signingResults.push(LeafRefundTxSigningResult.decode(reader, reader.uint32()));
|
|
11996
12233
|
continue;
|
|
11997
12234
|
}
|
|
11998
12235
|
}
|
|
@@ -12005,37 +12242,22 @@ var AggregateNodesResponse = {
|
|
|
12005
12242
|
},
|
|
12006
12243
|
fromJSON(object) {
|
|
12007
12244
|
return {
|
|
12008
|
-
|
|
12009
|
-
verifyingKey: isSet3(object.verifyingKey) ? bytesFromBase642(object.verifyingKey) : new Uint8Array(0),
|
|
12010
|
-
parentNodeTx: isSet3(object.parentNodeTx) ? bytesFromBase642(object.parentNodeTx) : new Uint8Array(0),
|
|
12011
|
-
parentNodeVout: isSet3(object.parentNodeVout) ? globalThis.Number(object.parentNodeVout) : 0
|
|
12245
|
+
signingResults: globalThis.Array.isArray(object?.signingResults) ? object.signingResults.map((e) => LeafRefundTxSigningResult.fromJSON(e)) : []
|
|
12012
12246
|
};
|
|
12013
12247
|
},
|
|
12014
12248
|
toJSON(message) {
|
|
12015
12249
|
const obj = {};
|
|
12016
|
-
if (message.
|
|
12017
|
-
obj.
|
|
12018
|
-
}
|
|
12019
|
-
if (message.verifyingKey.length !== 0) {
|
|
12020
|
-
obj.verifyingKey = base64FromBytes2(message.verifyingKey);
|
|
12021
|
-
}
|
|
12022
|
-
if (message.parentNodeTx.length !== 0) {
|
|
12023
|
-
obj.parentNodeTx = base64FromBytes2(message.parentNodeTx);
|
|
12024
|
-
}
|
|
12025
|
-
if (message.parentNodeVout !== 0) {
|
|
12026
|
-
obj.parentNodeVout = Math.round(message.parentNodeVout);
|
|
12250
|
+
if (message.signingResults?.length) {
|
|
12251
|
+
obj.signingResults = message.signingResults.map((e) => LeafRefundTxSigningResult.toJSON(e));
|
|
12027
12252
|
}
|
|
12028
12253
|
return obj;
|
|
12029
12254
|
},
|
|
12030
12255
|
create(base) {
|
|
12031
|
-
return
|
|
12256
|
+
return ClaimTransferSignRefundsResponse.fromPartial(base ?? {});
|
|
12032
12257
|
},
|
|
12033
12258
|
fromPartial(object) {
|
|
12034
|
-
const message =
|
|
12035
|
-
message.
|
|
12036
|
-
message.verifyingKey = object.verifyingKey ?? new Uint8Array(0);
|
|
12037
|
-
message.parentNodeTx = object.parentNodeTx ?? new Uint8Array(0);
|
|
12038
|
-
message.parentNodeVout = object.parentNodeVout ?? 0;
|
|
12259
|
+
const message = createBaseClaimTransferSignRefundsResponse();
|
|
12260
|
+
message.signingResults = object.signingResults?.map((e) => LeafRefundTxSigningResult.fromPartial(e)) || [];
|
|
12039
12261
|
return message;
|
|
12040
12262
|
}
|
|
12041
12263
|
};
|
|
@@ -15439,7 +15661,7 @@ var CancelTransferResponse = {
|
|
|
15439
15661
|
}
|
|
15440
15662
|
};
|
|
15441
15663
|
function createBaseQueryUnusedDepositAddressesRequest() {
|
|
15442
|
-
return { identityPublicKey: new Uint8Array(0), network: 0 };
|
|
15664
|
+
return { identityPublicKey: new Uint8Array(0), network: 0, limit: 0, offset: 0 };
|
|
15443
15665
|
}
|
|
15444
15666
|
var QueryUnusedDepositAddressesRequest = {
|
|
15445
15667
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
@@ -15449,6 +15671,12 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
15449
15671
|
if (message.network !== 0) {
|
|
15450
15672
|
writer.uint32(16).int32(message.network);
|
|
15451
15673
|
}
|
|
15674
|
+
if (message.limit !== 0) {
|
|
15675
|
+
writer.uint32(24).int64(message.limit);
|
|
15676
|
+
}
|
|
15677
|
+
if (message.offset !== 0) {
|
|
15678
|
+
writer.uint32(32).int64(message.offset);
|
|
15679
|
+
}
|
|
15452
15680
|
return writer;
|
|
15453
15681
|
},
|
|
15454
15682
|
decode(input, length) {
|
|
@@ -15472,6 +15700,20 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
15472
15700
|
message.network = reader.int32();
|
|
15473
15701
|
continue;
|
|
15474
15702
|
}
|
|
15703
|
+
case 3: {
|
|
15704
|
+
if (tag !== 24) {
|
|
15705
|
+
break;
|
|
15706
|
+
}
|
|
15707
|
+
message.limit = longToNumber2(reader.int64());
|
|
15708
|
+
continue;
|
|
15709
|
+
}
|
|
15710
|
+
case 4: {
|
|
15711
|
+
if (tag !== 32) {
|
|
15712
|
+
break;
|
|
15713
|
+
}
|
|
15714
|
+
message.offset = longToNumber2(reader.int64());
|
|
15715
|
+
continue;
|
|
15716
|
+
}
|
|
15475
15717
|
}
|
|
15476
15718
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15477
15719
|
break;
|
|
@@ -15483,7 +15725,9 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
15483
15725
|
fromJSON(object) {
|
|
15484
15726
|
return {
|
|
15485
15727
|
identityPublicKey: isSet3(object.identityPublicKey) ? bytesFromBase642(object.identityPublicKey) : new Uint8Array(0),
|
|
15486
|
-
network: isSet3(object.network) ? networkFromJSON(object.network) : 0
|
|
15728
|
+
network: isSet3(object.network) ? networkFromJSON(object.network) : 0,
|
|
15729
|
+
limit: isSet3(object.limit) ? globalThis.Number(object.limit) : 0,
|
|
15730
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
|
|
15487
15731
|
};
|
|
15488
15732
|
},
|
|
15489
15733
|
toJSON(message) {
|
|
@@ -15494,6 +15738,12 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
15494
15738
|
if (message.network !== 0) {
|
|
15495
15739
|
obj.network = networkToJSON(message.network);
|
|
15496
15740
|
}
|
|
15741
|
+
if (message.limit !== 0) {
|
|
15742
|
+
obj.limit = Math.round(message.limit);
|
|
15743
|
+
}
|
|
15744
|
+
if (message.offset !== 0) {
|
|
15745
|
+
obj.offset = Math.round(message.offset);
|
|
15746
|
+
}
|
|
15497
15747
|
return obj;
|
|
15498
15748
|
},
|
|
15499
15749
|
create(base) {
|
|
@@ -15503,6 +15753,8 @@ var QueryUnusedDepositAddressesRequest = {
|
|
|
15503
15753
|
const message = createBaseQueryUnusedDepositAddressesRequest();
|
|
15504
15754
|
message.identityPublicKey = object.identityPublicKey ?? new Uint8Array(0);
|
|
15505
15755
|
message.network = object.network ?? 0;
|
|
15756
|
+
message.limit = object.limit ?? 0;
|
|
15757
|
+
message.offset = object.offset ?? 0;
|
|
15506
15758
|
return message;
|
|
15507
15759
|
}
|
|
15508
15760
|
};
|
|
@@ -15708,13 +15960,16 @@ var DepositAddressQueryResult = {
|
|
|
15708
15960
|
}
|
|
15709
15961
|
};
|
|
15710
15962
|
function createBaseQueryUnusedDepositAddressesResponse() {
|
|
15711
|
-
return { depositAddresses: [] };
|
|
15963
|
+
return { depositAddresses: [], offset: 0 };
|
|
15712
15964
|
}
|
|
15713
15965
|
var QueryUnusedDepositAddressesResponse = {
|
|
15714
15966
|
encode(message, writer = new import_wire4.BinaryWriter()) {
|
|
15715
15967
|
for (const v of message.depositAddresses) {
|
|
15716
15968
|
DepositAddressQueryResult.encode(v, writer.uint32(10).fork()).join();
|
|
15717
15969
|
}
|
|
15970
|
+
if (message.offset !== 0) {
|
|
15971
|
+
writer.uint32(16).int64(message.offset);
|
|
15972
|
+
}
|
|
15718
15973
|
return writer;
|
|
15719
15974
|
},
|
|
15720
15975
|
decode(input, length) {
|
|
@@ -15731,6 +15986,13 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
15731
15986
|
message.depositAddresses.push(DepositAddressQueryResult.decode(reader, reader.uint32()));
|
|
15732
15987
|
continue;
|
|
15733
15988
|
}
|
|
15989
|
+
case 2: {
|
|
15990
|
+
if (tag !== 16) {
|
|
15991
|
+
break;
|
|
15992
|
+
}
|
|
15993
|
+
message.offset = longToNumber2(reader.int64());
|
|
15994
|
+
continue;
|
|
15995
|
+
}
|
|
15734
15996
|
}
|
|
15735
15997
|
if ((tag & 7) === 4 || tag === 0) {
|
|
15736
15998
|
break;
|
|
@@ -15741,7 +16003,8 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
15741
16003
|
},
|
|
15742
16004
|
fromJSON(object) {
|
|
15743
16005
|
return {
|
|
15744
|
-
depositAddresses: globalThis.Array.isArray(object?.depositAddresses) ? object.depositAddresses.map((e) => DepositAddressQueryResult.fromJSON(e)) : []
|
|
16006
|
+
depositAddresses: globalThis.Array.isArray(object?.depositAddresses) ? object.depositAddresses.map((e) => DepositAddressQueryResult.fromJSON(e)) : [],
|
|
16007
|
+
offset: isSet3(object.offset) ? globalThis.Number(object.offset) : 0
|
|
15745
16008
|
};
|
|
15746
16009
|
},
|
|
15747
16010
|
toJSON(message) {
|
|
@@ -15749,6 +16012,9 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
15749
16012
|
if (message.depositAddresses?.length) {
|
|
15750
16013
|
obj.depositAddresses = message.depositAddresses.map((e) => DepositAddressQueryResult.toJSON(e));
|
|
15751
16014
|
}
|
|
16015
|
+
if (message.offset !== 0) {
|
|
16016
|
+
obj.offset = Math.round(message.offset);
|
|
16017
|
+
}
|
|
15752
16018
|
return obj;
|
|
15753
16019
|
},
|
|
15754
16020
|
create(base) {
|
|
@@ -15757,6 +16023,7 @@ var QueryUnusedDepositAddressesResponse = {
|
|
|
15757
16023
|
fromPartial(object) {
|
|
15758
16024
|
const message = createBaseQueryUnusedDepositAddressesResponse();
|
|
15759
16025
|
message.depositAddresses = object.depositAddresses?.map((e) => DepositAddressQueryResult.fromPartial(e)) || [];
|
|
16026
|
+
message.offset = object.offset ?? 0;
|
|
15760
16027
|
return message;
|
|
15761
16028
|
}
|
|
15762
16029
|
};
|
|
@@ -17343,6 +17610,11 @@ var SparkServiceDefinition = {
|
|
|
17343
17610
|
responseStream: false,
|
|
17344
17611
|
options: {}
|
|
17345
17612
|
},
|
|
17613
|
+
/**
|
|
17614
|
+
* This is deprecated, please use finalize_transfer_with_transfer_package instead.
|
|
17615
|
+
*
|
|
17616
|
+
* @deprecated
|
|
17617
|
+
*/
|
|
17346
17618
|
finalize_transfer: {
|
|
17347
17619
|
name: "finalize_transfer",
|
|
17348
17620
|
requestType: FinalizeTransferRequest,
|
|
@@ -17399,14 +17671,6 @@ var SparkServiceDefinition = {
|
|
|
17399
17671
|
responseStream: false,
|
|
17400
17672
|
options: {}
|
|
17401
17673
|
},
|
|
17402
|
-
aggregate_nodes: {
|
|
17403
|
-
name: "aggregate_nodes",
|
|
17404
|
-
requestType: AggregateNodesRequest,
|
|
17405
|
-
requestStream: false,
|
|
17406
|
-
responseType: AggregateNodesResponse,
|
|
17407
|
-
responseStream: false,
|
|
17408
|
-
options: {}
|
|
17409
|
-
},
|
|
17410
17674
|
store_preimage_share: {
|
|
17411
17675
|
name: "store_preimage_share",
|
|
17412
17676
|
requestType: StorePreimageShareRequest,
|
|
@@ -17950,7 +18214,8 @@ var BASE_CONFIG = {
|
|
|
17950
18214
|
}
|
|
17951
18215
|
};
|
|
17952
18216
|
var LOCAL_WALLET_CONFIG = {
|
|
17953
|
-
...BASE_CONFIG
|
|
18217
|
+
...BASE_CONFIG,
|
|
18218
|
+
threshold: 3
|
|
17954
18219
|
};
|
|
17955
18220
|
var LOCAL_WALLET_CONFIG_SCHNORR = {
|
|
17956
18221
|
...LOCAL_WALLET_CONFIG,
|
|
@@ -20527,8 +20792,8 @@ function getNextTransactionSequence(currSequence, forRefresh) {
|
|
|
20527
20792
|
needRefresh: true
|
|
20528
20793
|
};
|
|
20529
20794
|
}
|
|
20530
|
-
if (nextTimelock <
|
|
20531
|
-
throw new ValidationError("timelock interval is less than
|
|
20795
|
+
if (nextTimelock < 0) {
|
|
20796
|
+
throw new ValidationError("timelock interval is less than 0", {
|
|
20532
20797
|
field: "nextTimelock",
|
|
20533
20798
|
value: nextTimelock
|
|
20534
20799
|
});
|
|
@@ -26466,17 +26731,30 @@ function hashTokenTransactionV1(tokenTransaction, partialHash = false) {
|
|
|
26466
26731
|
);
|
|
26467
26732
|
hashObj.update(networkBytes);
|
|
26468
26733
|
allHashes.push(hashObj.digest());
|
|
26469
|
-
const
|
|
26470
|
-
const
|
|
26471
|
-
const
|
|
26472
|
-
new
|
|
26734
|
+
const clientTimestampHashObj = import_sha211.sha256.create();
|
|
26735
|
+
const clientCreatedTs = tokenTransaction.clientCreatedTimestamp;
|
|
26736
|
+
const clientUnixTime = clientCreatedTs ? Math.floor(clientCreatedTs.getTime() / 1e3) : 0;
|
|
26737
|
+
const clientTimestampBytes = new Uint8Array(8);
|
|
26738
|
+
new DataView(clientTimestampBytes.buffer).setBigUint64(
|
|
26473
26739
|
0,
|
|
26474
|
-
BigInt(
|
|
26740
|
+
BigInt(clientUnixTime),
|
|
26475
26741
|
false
|
|
26476
|
-
// false for big-endian
|
|
26477
26742
|
);
|
|
26478
|
-
|
|
26479
|
-
allHashes.push(
|
|
26743
|
+
clientTimestampHashObj.update(clientTimestampBytes);
|
|
26744
|
+
allHashes.push(clientTimestampHashObj.digest());
|
|
26745
|
+
if (!partialHash) {
|
|
26746
|
+
const expiryHashObj = import_sha211.sha256.create();
|
|
26747
|
+
const expiryTimeBytes = new Uint8Array(8);
|
|
26748
|
+
const expiryUnixTime = tokenTransaction.expiryTime ? Math.floor(tokenTransaction.expiryTime.getTime() / 1e3) : 0;
|
|
26749
|
+
new DataView(expiryTimeBytes.buffer).setBigUint64(
|
|
26750
|
+
0,
|
|
26751
|
+
BigInt(expiryUnixTime),
|
|
26752
|
+
false
|
|
26753
|
+
// false for big-endian
|
|
26754
|
+
);
|
|
26755
|
+
expiryHashObj.update(expiryTimeBytes);
|
|
26756
|
+
allHashes.push(expiryHashObj.digest());
|
|
26757
|
+
}
|
|
26480
26758
|
const finalHashObj = import_sha211.sha256.create();
|
|
26481
26759
|
const concatenatedHashes = new Uint8Array(
|
|
26482
26760
|
allHashes.reduce((sum, hash) => sum + hash.length, 0)
|
|
@@ -27069,6 +27347,9 @@ var TokenTransactionService = class {
|
|
|
27069
27347
|
return txId;
|
|
27070
27348
|
}
|
|
27071
27349
|
async constructTransferTokenTransactionV0(selectedOutputs, tokenOutputData) {
|
|
27350
|
+
selectedOutputs.sort(
|
|
27351
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
27352
|
+
);
|
|
27072
27353
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
27073
27354
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
27074
27355
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -27104,6 +27385,9 @@ var TokenTransactionService = class {
|
|
|
27104
27385
|
};
|
|
27105
27386
|
}
|
|
27106
27387
|
async constructTransferTokenTransaction(selectedOutputs, tokenOutputData) {
|
|
27388
|
+
selectedOutputs.sort(
|
|
27389
|
+
(a, b) => a.previousTransactionVout - b.previousTransactionVout
|
|
27390
|
+
);
|
|
27107
27391
|
const availableTokenAmount = calculateAvailableTokenAmount(selectedOutputs);
|
|
27108
27392
|
const totalRequestedAmount = tokenOutputData.reduce(
|
|
27109
27393
|
(sum, output) => sum + output.tokenAmount,
|
|
@@ -27570,6 +27854,7 @@ var TokenTransactionService = class {
|
|
|
27570
27854
|
await coordinatorClient.commit_transaction(
|
|
27571
27855
|
{
|
|
27572
27856
|
finalTokenTransaction,
|
|
27857
|
+
finalTokenTransactionHash,
|
|
27573
27858
|
inputTtxoSignaturesPerOperator,
|
|
27574
27859
|
ownerIdentityPublicKey: await this.config.signer.getIdentityPublicKey()
|
|
27575
27860
|
},
|
|
@@ -27807,7 +28092,7 @@ var import_utils19 = require("@noble/curves/abstract/utils");
|
|
|
27807
28092
|
var import_sha212 = require("@noble/hashes/sha2");
|
|
27808
28093
|
var import_btc_signer5 = require("@scure/btc-signer");
|
|
27809
28094
|
var INITIAL_TIME_LOCK3 = 2e3;
|
|
27810
|
-
function
|
|
28095
|
+
function maybeApplyFee2(amount) {
|
|
27811
28096
|
if (amount > BigInt(DEFAULT_FEE_SATS)) {
|
|
27812
28097
|
return amount - BigInt(DEFAULT_FEE_SATS);
|
|
27813
28098
|
}
|
|
@@ -28076,7 +28361,7 @@ var TreeCreationService = class {
|
|
|
28076
28361
|
const refundPkScript = import_btc_signer5.OutScript.encode(refundAddress);
|
|
28077
28362
|
refundTx.addOutput({
|
|
28078
28363
|
script: refundPkScript,
|
|
28079
|
-
amount:
|
|
28364
|
+
amount: maybeApplyFee2(parentTxOut.amount)
|
|
28080
28365
|
});
|
|
28081
28366
|
refundTx.addOutput(getEphemeralAnchorOutput());
|
|
28082
28367
|
const refundSigningNonceCommitment = await this.config.signer.getRandomSigningCommitment();
|
|
@@ -28992,13 +29277,34 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
28992
29277
|
([_, node]) => node.status === "AVAILABLE" && !leavesToIgnore.has(node.id)
|
|
28993
29278
|
).map(([_, node]) => node);
|
|
28994
29279
|
}
|
|
28995
|
-
async selectLeaves(
|
|
28996
|
-
if (
|
|
29280
|
+
async selectLeaves(targetAmounts) {
|
|
29281
|
+
if (targetAmounts.length === 0) {
|
|
29282
|
+
throw new ValidationError("Target amounts must be non-empty", {
|
|
29283
|
+
field: "targetAmounts",
|
|
29284
|
+
value: targetAmounts
|
|
29285
|
+
});
|
|
29286
|
+
}
|
|
29287
|
+
if (targetAmounts.some((amount) => amount <= 0)) {
|
|
28997
29288
|
throw new ValidationError("Target amount must be positive", {
|
|
28998
|
-
field: "
|
|
28999
|
-
value:
|
|
29289
|
+
field: "targetAmounts",
|
|
29290
|
+
value: targetAmounts
|
|
29000
29291
|
});
|
|
29001
29292
|
}
|
|
29293
|
+
const totalTargetAmount = targetAmounts.reduce(
|
|
29294
|
+
(acc, amount) => acc + amount,
|
|
29295
|
+
0
|
|
29296
|
+
);
|
|
29297
|
+
const totalBalance = this.getInternalBalance();
|
|
29298
|
+
if (totalTargetAmount > totalBalance) {
|
|
29299
|
+
throw new ValidationError(
|
|
29300
|
+
"Total target amount exceeds available balance",
|
|
29301
|
+
{
|
|
29302
|
+
field: "targetAmounts",
|
|
29303
|
+
value: totalTargetAmount,
|
|
29304
|
+
expected: `less than or equal to ${totalBalance}`
|
|
29305
|
+
}
|
|
29306
|
+
);
|
|
29307
|
+
}
|
|
29002
29308
|
const leaves = await this.getLeaves();
|
|
29003
29309
|
if (leaves.length === 0) {
|
|
29004
29310
|
throw new ValidationError("No owned leaves found", {
|
|
@@ -29006,33 +29312,49 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29006
29312
|
});
|
|
29007
29313
|
}
|
|
29008
29314
|
leaves.sort((a, b) => b.value - a.value);
|
|
29009
|
-
|
|
29010
|
-
|
|
29011
|
-
|
|
29012
|
-
|
|
29013
|
-
|
|
29014
|
-
nodes
|
|
29015
|
-
|
|
29016
|
-
|
|
29017
|
-
|
|
29018
|
-
|
|
29019
|
-
|
|
29020
|
-
|
|
29021
|
-
|
|
29022
|
-
|
|
29023
|
-
|
|
29024
|
-
|
|
29025
|
-
amount += leaf.value;
|
|
29026
|
-
nodes.push(leaf);
|
|
29315
|
+
const selectLeavesForTargets = (targetAmounts2, leaves2) => {
|
|
29316
|
+
const usedLeaves = /* @__PURE__ */ new Set();
|
|
29317
|
+
const results2 = /* @__PURE__ */ new Map();
|
|
29318
|
+
let totalAmount = 0;
|
|
29319
|
+
for (const targetAmount of targetAmounts2) {
|
|
29320
|
+
const nodes = [];
|
|
29321
|
+
let amount = 0;
|
|
29322
|
+
for (const leaf of leaves2) {
|
|
29323
|
+
if (usedLeaves.has(leaf.id)) {
|
|
29324
|
+
continue;
|
|
29325
|
+
}
|
|
29326
|
+
if (targetAmount - amount >= leaf.value) {
|
|
29327
|
+
amount += leaf.value;
|
|
29328
|
+
nodes.push(leaf);
|
|
29329
|
+
usedLeaves.add(leaf.id);
|
|
29330
|
+
}
|
|
29027
29331
|
}
|
|
29332
|
+
totalAmount += amount;
|
|
29333
|
+
results2.set(targetAmount, nodes);
|
|
29028
29334
|
}
|
|
29335
|
+
return {
|
|
29336
|
+
results: results2,
|
|
29337
|
+
foundSelections: totalAmount === totalTargetAmount
|
|
29338
|
+
};
|
|
29339
|
+
};
|
|
29340
|
+
let { results, foundSelections } = selectLeavesForTargets(
|
|
29341
|
+
targetAmounts,
|
|
29342
|
+
leaves
|
|
29343
|
+
);
|
|
29344
|
+
if (!foundSelections) {
|
|
29345
|
+
const newLeaves = await this.requestLeavesSwap({ targetAmounts });
|
|
29346
|
+
newLeaves.sort((a, b) => b.value - a.value);
|
|
29347
|
+
({ results, foundSelections } = selectLeavesForTargets(
|
|
29348
|
+
targetAmounts,
|
|
29349
|
+
newLeaves
|
|
29350
|
+
));
|
|
29029
29351
|
}
|
|
29030
|
-
if (
|
|
29352
|
+
if (!foundSelections) {
|
|
29031
29353
|
throw new Error(
|
|
29032
|
-
`Failed to select leaves for target amount ${
|
|
29354
|
+
`Failed to select leaves for target amount ${totalTargetAmount}`
|
|
29033
29355
|
);
|
|
29034
29356
|
}
|
|
29035
|
-
return
|
|
29357
|
+
return results;
|
|
29036
29358
|
}
|
|
29037
29359
|
async selectLeavesForSwap(targetAmount) {
|
|
29038
29360
|
if (targetAmount == 0) {
|
|
@@ -29265,27 +29587,44 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29265
29587
|
* @private
|
|
29266
29588
|
*/
|
|
29267
29589
|
async requestLeavesSwap({
|
|
29268
|
-
|
|
29590
|
+
targetAmounts,
|
|
29269
29591
|
leaves
|
|
29270
29592
|
}) {
|
|
29271
|
-
if (
|
|
29272
|
-
throw new Error("targetAmount must be positive");
|
|
29593
|
+
if (targetAmounts && targetAmounts.some((amount) => amount <= 0)) {
|
|
29594
|
+
throw new Error("specified targetAmount must be positive");
|
|
29273
29595
|
}
|
|
29274
|
-
if (
|
|
29596
|
+
if (targetAmounts && targetAmounts.some((amount) => !Number.isSafeInteger(amount))) {
|
|
29275
29597
|
throw new ValidationError("targetAmount must be less than 2^53", {
|
|
29276
|
-
field: "
|
|
29277
|
-
value:
|
|
29598
|
+
field: "targetAmounts",
|
|
29599
|
+
value: targetAmounts,
|
|
29278
29600
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
29279
29601
|
});
|
|
29280
29602
|
}
|
|
29281
29603
|
let leavesToSwap;
|
|
29282
|
-
|
|
29283
|
-
|
|
29604
|
+
const totalTargetAmount = targetAmounts?.reduce(
|
|
29605
|
+
(acc, amount) => acc + amount,
|
|
29606
|
+
0
|
|
29607
|
+
);
|
|
29608
|
+
if (totalTargetAmount) {
|
|
29609
|
+
const totalBalance = this.getInternalBalance();
|
|
29610
|
+
if (totalTargetAmount > totalBalance) {
|
|
29611
|
+
throw new ValidationError(
|
|
29612
|
+
"Total target amount exceeds available balance",
|
|
29613
|
+
{
|
|
29614
|
+
field: "targetAmounts",
|
|
29615
|
+
value: totalTargetAmount,
|
|
29616
|
+
expected: `less than or equal to ${totalBalance}`
|
|
29617
|
+
}
|
|
29618
|
+
);
|
|
29619
|
+
}
|
|
29620
|
+
}
|
|
29621
|
+
if (totalTargetAmount && leaves && leaves.length > 0) {
|
|
29622
|
+
if (totalTargetAmount < leaves.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
29284
29623
|
throw new Error("targetAmount is less than the sum of leaves");
|
|
29285
29624
|
}
|
|
29286
29625
|
leavesToSwap = leaves;
|
|
29287
|
-
} else if (
|
|
29288
|
-
leavesToSwap = await this.selectLeavesForSwap(
|
|
29626
|
+
} else if (totalTargetAmount) {
|
|
29627
|
+
leavesToSwap = await this.selectLeavesForSwap(totalTargetAmount);
|
|
29289
29628
|
} else if (leaves && leaves.length > 0) {
|
|
29290
29629
|
leavesToSwap = leaves;
|
|
29291
29630
|
} else {
|
|
@@ -29295,15 +29634,15 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29295
29634
|
const batches = chunkArray(leavesToSwap, 100);
|
|
29296
29635
|
const results = [];
|
|
29297
29636
|
for (const batch of batches) {
|
|
29298
|
-
const result = await this.processSwapBatch(batch,
|
|
29299
|
-
results.push(...result
|
|
29637
|
+
const result = await this.processSwapBatch(batch, targetAmounts);
|
|
29638
|
+
results.push(...result);
|
|
29300
29639
|
}
|
|
29301
29640
|
return results;
|
|
29302
29641
|
}
|
|
29303
29642
|
/**
|
|
29304
29643
|
* Processes a single batch of leaves for swapping.
|
|
29305
29644
|
*/
|
|
29306
|
-
async processSwapBatch(leavesBatch,
|
|
29645
|
+
async processSwapBatch(leavesBatch, targetAmounts) {
|
|
29307
29646
|
const leafKeyTweaks = await Promise.all(
|
|
29308
29647
|
leavesBatch.map(async (leaf) => ({
|
|
29309
29648
|
leaf,
|
|
@@ -29367,8 +29706,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29367
29706
|
request = await sspClient.requestLeaveSwap({
|
|
29368
29707
|
userLeaves,
|
|
29369
29708
|
adaptorPubkey,
|
|
29370
|
-
targetAmountSats:
|
|
29709
|
+
targetAmountSats: targetAmounts?.reduce((acc, amount) => acc + amount, 0) || leavesBatch.reduce((acc, leaf) => acc + leaf.value, 0),
|
|
29371
29710
|
totalAmountSats: leavesBatch.reduce((acc, leaf) => acc + leaf.value, 0),
|
|
29711
|
+
targetAmountSatsList: targetAmounts,
|
|
29372
29712
|
// TODO: Request fee from SSP
|
|
29373
29713
|
feeSats: 0,
|
|
29374
29714
|
idempotencyKey: (0, import_uuidv75.uuidv7)()
|
|
@@ -29424,11 +29764,21 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29424
29764
|
userOutboundTransferExternalId: transfer.id,
|
|
29425
29765
|
leavesSwapRequestId: request.id
|
|
29426
29766
|
});
|
|
29427
|
-
if (!completeResponse) {
|
|
29767
|
+
if (!completeResponse || !completeResponse.inboundTransfer?.sparkId) {
|
|
29428
29768
|
throw new Error("Failed to complete leaves swap");
|
|
29429
29769
|
}
|
|
29430
|
-
await this.
|
|
29431
|
-
|
|
29770
|
+
const incomingTransfer = await this.transferService.queryTransfer(
|
|
29771
|
+
completeResponse.inboundTransfer.sparkId
|
|
29772
|
+
);
|
|
29773
|
+
if (!incomingTransfer) {
|
|
29774
|
+
throw new Error("Failed to get incoming transfer");
|
|
29775
|
+
}
|
|
29776
|
+
return await this.claimTransfer({
|
|
29777
|
+
transfer: incomingTransfer,
|
|
29778
|
+
emit: false,
|
|
29779
|
+
retryCount: 0,
|
|
29780
|
+
optimize: false
|
|
29781
|
+
});
|
|
29432
29782
|
} catch (e) {
|
|
29433
29783
|
await this.cancelAllSenderInitiatedTransfers();
|
|
29434
29784
|
throw new Error(`Failed to request leaves swap: ${e}`);
|
|
@@ -29965,13 +30315,45 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
29965
30315
|
* @returns {Promise<string[]>} The unused deposit addresses
|
|
29966
30316
|
*/
|
|
29967
30317
|
async getUnusedDepositAddresses() {
|
|
30318
|
+
return (await this.queryAllUnusedDepositAddresses({})).map(
|
|
30319
|
+
(addr) => addr.depositAddress
|
|
30320
|
+
);
|
|
30321
|
+
}
|
|
30322
|
+
/**
|
|
30323
|
+
* Gets all unused deposit addresses for the wallet.
|
|
30324
|
+
*
|
|
30325
|
+
* @param {Object} params - Parameters for querying unused deposit addresses
|
|
30326
|
+
* @param {Uint8Array<ArrayBufferLike>} [params.identityPublicKey] - The identity public key
|
|
30327
|
+
* @param {NetworkProto} [params.network] - The network
|
|
30328
|
+
* @returns {Promise<DepositAddressQueryResult[]>} The unused deposit addresses
|
|
30329
|
+
*/
|
|
30330
|
+
async queryAllUnusedDepositAddresses({
|
|
30331
|
+
identityPublicKey,
|
|
30332
|
+
network
|
|
30333
|
+
}) {
|
|
29968
30334
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
29969
30335
|
this.config.getCoordinatorAddress()
|
|
29970
30336
|
);
|
|
29971
|
-
|
|
29972
|
-
|
|
29973
|
-
|
|
29974
|
-
|
|
30337
|
+
let limit = 100;
|
|
30338
|
+
let offset = 0;
|
|
30339
|
+
const pastOffsets = /* @__PURE__ */ new Set();
|
|
30340
|
+
const depositAddresses = [];
|
|
30341
|
+
while (offset >= 0) {
|
|
30342
|
+
if (pastOffsets.has(offset)) {
|
|
30343
|
+
console.warn("Offset has already been seen, stopping");
|
|
30344
|
+
break;
|
|
30345
|
+
}
|
|
30346
|
+
const response = await sparkClient.query_unused_deposit_addresses({
|
|
30347
|
+
identityPublicKey: identityPublicKey ?? await this.config.signer.getIdentityPublicKey(),
|
|
30348
|
+
network: network ?? NetworkToProto[this.config.getNetwork()],
|
|
30349
|
+
limit,
|
|
30350
|
+
offset
|
|
30351
|
+
});
|
|
30352
|
+
depositAddresses.push(...response.depositAddresses);
|
|
30353
|
+
pastOffsets.add(offset);
|
|
30354
|
+
offset = response.offset;
|
|
30355
|
+
}
|
|
30356
|
+
return depositAddresses;
|
|
29975
30357
|
}
|
|
29976
30358
|
/**
|
|
29977
30359
|
* Claims a deposit to the wallet.
|
|
@@ -30020,14 +30402,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30020
30402
|
});
|
|
30021
30403
|
}
|
|
30022
30404
|
const depositTx = getTxFromRawTxHex(txHex);
|
|
30023
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
30024
|
-
this.config.getCoordinatorAddress()
|
|
30025
|
-
);
|
|
30026
30405
|
const unusedDepositAddresses = new Map(
|
|
30027
|
-
(await
|
|
30406
|
+
(await this.queryAllUnusedDepositAddresses({
|
|
30028
30407
|
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
30029
30408
|
network: NetworkToProto[this.config.getNetwork()]
|
|
30030
|
-
})).
|
|
30409
|
+
})).map((addr) => [addr.depositAddress, addr])
|
|
30031
30410
|
);
|
|
30032
30411
|
let depositAddress;
|
|
30033
30412
|
let vout = 0;
|
|
@@ -30081,14 +30460,11 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30081
30460
|
*/
|
|
30082
30461
|
async advancedDeposit(txHex) {
|
|
30083
30462
|
const depositTx = getTxFromRawTxHex(txHex);
|
|
30084
|
-
const sparkClient = await this.connectionManager.createSparkClient(
|
|
30085
|
-
this.config.getCoordinatorAddress()
|
|
30086
|
-
);
|
|
30087
30463
|
const unusedDepositAddresses = new Map(
|
|
30088
|
-
(await
|
|
30464
|
+
(await this.queryAllUnusedDepositAddresses({
|
|
30089
30465
|
identityPublicKey: await this.config.signer.getIdentityPublicKey(),
|
|
30090
30466
|
network: NetworkToProto[this.config.getNetwork()]
|
|
30091
|
-
})).
|
|
30467
|
+
})).map((addr) => [addr.depositAddress, addr])
|
|
30092
30468
|
);
|
|
30093
30469
|
let vout = 0;
|
|
30094
30470
|
const responses = [];
|
|
@@ -30192,7 +30568,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30192
30568
|
(0, import_utils24.hexToBytes)(receiverAddress.identityPublicKey)
|
|
30193
30569
|
);
|
|
30194
30570
|
return await this.withLeaves(async () => {
|
|
30195
|
-
let leavesToSend = await this.selectLeaves(amountSats)
|
|
30571
|
+
let leavesToSend = (await this.selectLeaves([amountSats])).get(
|
|
30572
|
+
amountSats
|
|
30573
|
+
);
|
|
30196
30574
|
leavesToSend = await this.checkRefreshTimelockNodes(leavesToSend);
|
|
30197
30575
|
leavesToSend = await this.checkExtendTimeLockNodes(leavesToSend);
|
|
30198
30576
|
const leafKeyTweaks = await Promise.all(
|
|
@@ -30435,7 +30813,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30435
30813
|
if (type && transfer.type !== type) {
|
|
30436
30814
|
continue;
|
|
30437
30815
|
}
|
|
30438
|
-
if (transfer.status !== 2 /* TRANSFER_STATUS_SENDER_KEY_TWEAKED */ && transfer.status !== 3 /* TRANSFER_STATUS_RECEIVER_KEY_TWEAKED */ && transfer.status !== 4 /*
|
|
30816
|
+
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 */) {
|
|
30439
30817
|
continue;
|
|
30440
30818
|
}
|
|
30441
30819
|
promises.push(
|
|
@@ -30694,7 +31072,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30694
31072
|
expected: `${totalAmount} sats`
|
|
30695
31073
|
});
|
|
30696
31074
|
}
|
|
30697
|
-
let leaves = await this.selectLeaves(totalAmount);
|
|
31075
|
+
let leaves = (await this.selectLeaves([totalAmount])).get(totalAmount);
|
|
30698
31076
|
leaves = await this.checkRefreshTimelockNodes(leaves);
|
|
30699
31077
|
leaves = await this.checkExtendTimeLockNodes(leaves);
|
|
30700
31078
|
const leavesToSend = await Promise.all(
|
|
@@ -30804,13 +31182,18 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30804
31182
|
*
|
|
30805
31183
|
* @param {Object} params - Parameters for the withdrawal
|
|
30806
31184
|
* @param {string} params.onchainAddress - The Bitcoin address where the funds should be sent
|
|
30807
|
-
* @param {
|
|
31185
|
+
* @param {CoopExitFeeQuote} params.feeQuote - The fee quote for the withdrawal
|
|
31186
|
+
* @param {ExitSpeed} params.exitSpeed - The exit speed chosen for the withdrawal
|
|
31187
|
+
* @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.
|
|
31188
|
+
* @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.
|
|
30808
31189
|
* @returns {Promise<CoopExitRequest | null | undefined>} The withdrawal request details, or null/undefined if the request cannot be completed
|
|
30809
31190
|
*/
|
|
30810
31191
|
async withdraw({
|
|
30811
31192
|
onchainAddress,
|
|
30812
31193
|
exitSpeed,
|
|
30813
|
-
|
|
31194
|
+
feeQuote,
|
|
31195
|
+
amountSats,
|
|
31196
|
+
deductFeeFromWithdrawalAmount = true
|
|
30814
31197
|
}) {
|
|
30815
31198
|
if (!Number.isSafeInteger(amountSats)) {
|
|
30816
31199
|
throw new ValidationError("Sats amount must be less than 2^53", {
|
|
@@ -30820,7 +31203,13 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30820
31203
|
});
|
|
30821
31204
|
}
|
|
30822
31205
|
return await this.withLeaves(async () => {
|
|
30823
|
-
return await this.coopExit(
|
|
31206
|
+
return await this.coopExit(
|
|
31207
|
+
onchainAddress,
|
|
31208
|
+
feeQuote,
|
|
31209
|
+
exitSpeed,
|
|
31210
|
+
deductFeeFromWithdrawalAmount,
|
|
31211
|
+
amountSats
|
|
31212
|
+
);
|
|
30824
31213
|
});
|
|
30825
31214
|
}
|
|
30826
31215
|
/**
|
|
@@ -30831,7 +31220,7 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30831
31220
|
* @returns {Promise<Object | null | undefined>} The exit request details
|
|
30832
31221
|
* @private
|
|
30833
31222
|
*/
|
|
30834
|
-
async coopExit(onchainAddress, exitSpeed, targetAmountSats) {
|
|
31223
|
+
async coopExit(onchainAddress, feeEstimate, exitSpeed, deductFeeFromWithdrawalAmount, targetAmountSats) {
|
|
30835
31224
|
if (!Number.isSafeInteger(targetAmountSats)) {
|
|
30836
31225
|
throw new ValidationError("Sats amount must be less than 2^53", {
|
|
30837
31226
|
field: "targetAmountSats",
|
|
@@ -30839,41 +31228,34 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30839
31228
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
30840
31229
|
});
|
|
30841
31230
|
}
|
|
30842
|
-
|
|
30843
|
-
|
|
30844
|
-
leavesToSend = await this.selectLeaves(targetAmountSats);
|
|
30845
|
-
} else {
|
|
30846
|
-
leavesToSend = this.leaves.map((leaf) => ({
|
|
30847
|
-
...leaf
|
|
30848
|
-
}));
|
|
31231
|
+
if (!targetAmountSats) {
|
|
31232
|
+
deductFeeFromWithdrawalAmount = true;
|
|
30849
31233
|
}
|
|
30850
|
-
|
|
30851
|
-
|
|
30852
|
-
|
|
30853
|
-
|
|
30854
|
-
|
|
30855
|
-
|
|
30856
|
-
|
|
30857
|
-
|
|
30858
|
-
|
|
30859
|
-
|
|
30860
|
-
|
|
30861
|
-
|
|
30862
|
-
|
|
30863
|
-
|
|
30864
|
-
|
|
30865
|
-
|
|
30866
|
-
|
|
30867
|
-
|
|
30868
|
-
|
|
30869
|
-
|
|
30870
|
-
|
|
30871
|
-
|
|
30872
|
-
|
|
30873
|
-
}
|
|
30874
|
-
if (fee !== void 0 && fee > leavesToSend.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
31234
|
+
let fee;
|
|
31235
|
+
switch (exitSpeed) {
|
|
31236
|
+
case ExitSpeed_default.FAST:
|
|
31237
|
+
fee = (feeEstimate.l1BroadcastFeeFast?.originalValue || 0) + (feeEstimate.userFeeFast?.originalValue || 0);
|
|
31238
|
+
break;
|
|
31239
|
+
case ExitSpeed_default.MEDIUM:
|
|
31240
|
+
fee = (feeEstimate.l1BroadcastFeeMedium?.originalValue || 0) + (feeEstimate.userFeeMedium?.originalValue || 0);
|
|
31241
|
+
break;
|
|
31242
|
+
case ExitSpeed_default.SLOW:
|
|
31243
|
+
fee = (feeEstimate.l1BroadcastFeeSlow?.originalValue || 0) + (feeEstimate.userFeeSlow?.originalValue || 0);
|
|
31244
|
+
break;
|
|
31245
|
+
default:
|
|
31246
|
+
throw new ValidationError("Invalid exit speed", {
|
|
31247
|
+
field: "exitSpeed",
|
|
31248
|
+
value: exitSpeed,
|
|
31249
|
+
expected: "FAST, MEDIUM, or SLOW"
|
|
31250
|
+
});
|
|
31251
|
+
}
|
|
31252
|
+
let leavesToSendToSsp = [];
|
|
31253
|
+
let leavesToSendToSE = [];
|
|
31254
|
+
if (deductFeeFromWithdrawalAmount) {
|
|
31255
|
+
leavesToSendToSsp = targetAmountSats ? (await this.selectLeaves([targetAmountSats])).get(targetAmountSats) : this.leaves;
|
|
31256
|
+
if (fee > leavesToSendToSsp.reduce((acc, leaf) => acc + leaf.value, 0)) {
|
|
30875
31257
|
throw new ValidationError(
|
|
30876
|
-
"The fee for the withdrawal is greater than the target amount",
|
|
31258
|
+
"The fee for the withdrawal is greater than the target withdrawal amount",
|
|
30877
31259
|
{
|
|
30878
31260
|
field: "fee",
|
|
30879
31261
|
value: fee,
|
|
@@ -30881,11 +31263,32 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30881
31263
|
}
|
|
30882
31264
|
);
|
|
30883
31265
|
}
|
|
31266
|
+
} else {
|
|
31267
|
+
if (!targetAmountSats) {
|
|
31268
|
+
throw new ValidationError(
|
|
31269
|
+
"targetAmountSats is required when deductFeeFromWithdrawalAmount is false",
|
|
31270
|
+
{
|
|
31271
|
+
field: "targetAmountSats",
|
|
31272
|
+
value: targetAmountSats,
|
|
31273
|
+
expected: "defined when deductFeeFromWithdrawalAmount is false"
|
|
31274
|
+
}
|
|
31275
|
+
);
|
|
31276
|
+
}
|
|
31277
|
+
const leaves = await this.selectLeaves([targetAmountSats, fee]);
|
|
31278
|
+
const leavesForTargetAmount = leaves.get(targetAmountSats);
|
|
31279
|
+
const leavesForFee = leaves.get(fee);
|
|
31280
|
+
if (!leavesForTargetAmount || !leavesForFee) {
|
|
31281
|
+
throw new Error("Failed to select leaves for target amount and fee");
|
|
31282
|
+
}
|
|
31283
|
+
leavesToSendToSsp = leavesForTargetAmount;
|
|
31284
|
+
leavesToSendToSE = leavesForFee;
|
|
30884
31285
|
}
|
|
30885
|
-
|
|
30886
|
-
|
|
31286
|
+
leavesToSendToSsp = await this.checkRefreshTimelockNodes(leavesToSendToSsp);
|
|
31287
|
+
leavesToSendToSsp = await this.checkExtendTimeLockNodes(leavesToSendToSsp);
|
|
31288
|
+
leavesToSendToSE = await this.checkRefreshTimelockNodes(leavesToSendToSE);
|
|
31289
|
+
leavesToSendToSE = await this.checkExtendTimeLockNodes(leavesToSendToSE);
|
|
30887
31290
|
const leafKeyTweaks = await Promise.all(
|
|
30888
|
-
|
|
31291
|
+
[...leavesToSendToSE, ...leavesToSendToSsp].map(async (leaf) => ({
|
|
30889
31292
|
leaf,
|
|
30890
31293
|
signingPubKey: await this.config.signer.generatePublicKey(
|
|
30891
31294
|
(0, import_sha213.sha256)(leaf.id)
|
|
@@ -30893,13 +31296,23 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30893
31296
|
newSigningPubKey: await this.config.signer.generatePublicKey()
|
|
30894
31297
|
}))
|
|
30895
31298
|
);
|
|
30896
|
-
const
|
|
30897
|
-
leafExternalIds:
|
|
31299
|
+
const requestCoopExitParams = {
|
|
31300
|
+
leafExternalIds: leavesToSendToSsp.map((leaf) => leaf.id),
|
|
30898
31301
|
withdrawalAddress: onchainAddress,
|
|
30899
31302
|
idempotencyKey: (0, import_uuidv75.uuidv7)(),
|
|
30900
31303
|
exitSpeed,
|
|
30901
|
-
withdrawAll:
|
|
30902
|
-
}
|
|
31304
|
+
withdrawAll: deductFeeFromWithdrawalAmount
|
|
31305
|
+
};
|
|
31306
|
+
if (!deductFeeFromWithdrawalAmount) {
|
|
31307
|
+
requestCoopExitParams.feeQuoteId = feeEstimate.id;
|
|
31308
|
+
requestCoopExitParams.feeLeafExternalIds = leavesToSendToSE.map(
|
|
31309
|
+
(leaf) => leaf.id
|
|
31310
|
+
);
|
|
31311
|
+
}
|
|
31312
|
+
const sspClient = this.getSspClient();
|
|
31313
|
+
const coopExitRequest = await sspClient.requestCoopExit(
|
|
31314
|
+
requestCoopExitParams
|
|
31315
|
+
);
|
|
30903
31316
|
if (!coopExitRequest?.rawConnectorTransaction) {
|
|
30904
31317
|
throw new Error("Failed to request coop exit");
|
|
30905
31318
|
}
|
|
@@ -30937,9 +31350,9 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30937
31350
|
* @param {Object} params - Input parameters for fee estimation
|
|
30938
31351
|
* @param {number} params.amountSats - The amount in satoshis to withdraw
|
|
30939
31352
|
* @param {string} params.withdrawalAddress - The Bitcoin address where the funds should be sent
|
|
30940
|
-
* @returns {Promise<
|
|
31353
|
+
* @returns {Promise<CoopExitFeeQuote | null>} Fee estimate for the withdrawal
|
|
30941
31354
|
*/
|
|
30942
|
-
async
|
|
31355
|
+
async getWithdrawalFeeQuote({
|
|
30943
31356
|
amountSats,
|
|
30944
31357
|
withdrawalAddress
|
|
30945
31358
|
}) {
|
|
@@ -30951,10 +31364,10 @@ var SparkWallet = class _SparkWallet extends import_eventemitter3.EventEmitter {
|
|
|
30951
31364
|
expected: "smaller or equal to " + Number.MAX_SAFE_INTEGER
|
|
30952
31365
|
});
|
|
30953
31366
|
}
|
|
30954
|
-
let leaves = await this.selectLeaves(amountSats);
|
|
31367
|
+
let leaves = (await this.selectLeaves([amountSats])).get(amountSats);
|
|
30955
31368
|
leaves = await this.checkRefreshTimelockNodes(leaves);
|
|
30956
31369
|
leaves = await this.checkExtendTimeLockNodes(leaves);
|
|
30957
|
-
const feeEstimate = await sspClient.
|
|
31370
|
+
const feeEstimate = await sspClient.getCoopExitFeeQuote({
|
|
30958
31371
|
leafExternalIds: leaves.map((leaf) => leaf.id),
|
|
30959
31372
|
withdrawalAddress
|
|
30960
31373
|
});
|