@buildonspark/spark-sdk 0.1.41 → 0.1.43

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.
Files changed (156) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/android/src/main/jniLibs/arm64-v8a/libuniffi_spark_frost.so +0 -0
  3. package/android/src/main/jniLibs/armeabi-v7a/libuniffi_spark_frost.so +0 -0
  4. package/android/src/main/jniLibs/x86/libuniffi_spark_frost.so +0 -0
  5. package/android/src/main/jniLibs/x86_64/libuniffi_spark_frost.so +0 -0
  6. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +10 -0
  7. package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +10 -0
  8. package/dist/{RequestLightningSendInput-mXUWn_cp.d.ts → RequestLightningSendInput-D7fZdT4A.d.ts} +35 -16
  9. package/dist/{RequestLightningSendInput-DXcLoiCe.d.cts → RequestLightningSendInput-Na1mHdWg.d.cts} +35 -16
  10. package/dist/address/index.cjs +38 -7
  11. package/dist/address/index.d.cts +2 -2
  12. package/dist/address/index.d.ts +2 -2
  13. package/dist/address/index.js +3 -3
  14. package/dist/{chunk-ATEHMLKP.js → chunk-6AFUC5M2.js} +1 -1
  15. package/dist/{chunk-ZXDE2XMU.js → chunk-BUTZWYBW.js} +9 -6
  16. package/dist/{chunk-7EFSUADA.js → chunk-DOA6QXYQ.js} +1 -0
  17. package/dist/{chunk-J5W5Q2ZP.js → chunk-DQYKQJRZ.js} +291 -7
  18. package/dist/{chunk-TWF35O6M.js → chunk-GSI4OLXZ.js} +32 -1
  19. package/dist/{chunk-2ZXXLPG2.js → chunk-GYQR4B4P.js} +5 -4
  20. package/dist/{chunk-ROKY5KS4.js → chunk-HRQRRDSS.js} +53 -15
  21. package/dist/{chunk-YEZDPUFY.js → chunk-IRW5TWMH.js} +8 -8
  22. package/dist/{chunk-7VMYMQLF.js → chunk-NSJF5F5O.js} +1 -1
  23. package/dist/{chunk-TM4TOEOX.js → chunk-O4RYNJNB.js} +3 -3
  24. package/dist/{chunk-MGPRLH6Q.js → chunk-QNNSEJ4P.js} +1 -1
  25. package/dist/{chunk-UKT6OFLO.js → chunk-TIUBYNN5.js} +13 -7
  26. package/dist/{chunk-6YVPOQ2A.js → chunk-TOSP3INR.js} +235 -143
  27. package/dist/chunk-VFJQNBFX.js +21 -0
  28. package/dist/{chunk-KKSU7OZO.js → chunk-WWOTVNPP.js} +195 -67
  29. package/dist/{chunk-HK6LPV6Z.js → chunk-Z5HIAYFT.js} +1 -1
  30. package/dist/graphql/objects/index.cjs +229 -135
  31. package/dist/graphql/objects/index.d.cts +54 -9
  32. package/dist/graphql/objects/index.d.ts +54 -9
  33. package/dist/graphql/objects/index.js +3 -3
  34. package/dist/{index-OSDtPMmC.d.ts → index-7RYRH5wc.d.ts} +10 -8
  35. package/dist/{index-CFh4uWzi.d.cts → index-BJOc8Ur-.d.cts} +10 -8
  36. package/dist/index.cjs +790 -315
  37. package/dist/index.d.cts +8 -7
  38. package/dist/index.d.ts +8 -7
  39. package/dist/index.js +26 -26
  40. package/dist/index.node.cjs +790 -315
  41. package/dist/index.node.d.cts +9 -8
  42. package/dist/index.node.d.ts +9 -8
  43. package/dist/index.node.js +26 -26
  44. package/dist/native/index.cjs +812 -332
  45. package/dist/native/index.d.cts +53 -18
  46. package/dist/native/index.d.ts +53 -18
  47. package/dist/native/index.js +659 -181
  48. package/dist/{network-BiwBmoOg.d.cts → network-D5lKssVl.d.cts} +1 -1
  49. package/dist/{network-BF2GYPye.d.ts → network-xkBSpaTn.d.ts} +1 -1
  50. package/dist/proto/lrc20.d.cts +1 -1
  51. package/dist/proto/lrc20.d.ts +1 -1
  52. package/dist/proto/spark.d.cts +1 -1
  53. package/dist/proto/spark.d.ts +1 -1
  54. package/dist/proto/spark_token.d.cts +1 -1
  55. package/dist/proto/spark_token.d.ts +1 -1
  56. package/dist/{sdk-types-CfhdFnsA.d.cts → sdk-types-B-q9py_P.d.cts} +1 -1
  57. package/dist/{sdk-types-MnQrHolg.d.ts → sdk-types-BPoPgzda.d.ts} +1 -1
  58. package/dist/services/config.cjs +118 -69
  59. package/dist/services/config.d.cts +6 -4
  60. package/dist/services/config.d.ts +6 -4
  61. package/dist/services/config.js +9 -9
  62. package/dist/services/connection.cjs +95 -15
  63. package/dist/services/connection.d.cts +6 -4
  64. package/dist/services/connection.d.ts +6 -4
  65. package/dist/services/connection.js +3 -3
  66. package/dist/services/index.cjs +487 -117
  67. package/dist/services/index.d.cts +5 -4
  68. package/dist/services/index.d.ts +5 -4
  69. package/dist/services/index.js +19 -19
  70. package/dist/services/lrc-connection.cjs +50 -7
  71. package/dist/services/lrc-connection.d.cts +5 -4
  72. package/dist/services/lrc-connection.d.ts +5 -4
  73. package/dist/services/lrc-connection.js +3 -3
  74. package/dist/services/token-transactions.cjs +351 -36
  75. package/dist/services/token-transactions.d.cts +5 -4
  76. package/dist/services/token-transactions.d.ts +5 -4
  77. package/dist/services/token-transactions.js +6 -6
  78. package/dist/services/wallet-config.cjs +1 -0
  79. package/dist/services/wallet-config.d.cts +6 -4
  80. package/dist/services/wallet-config.d.ts +6 -4
  81. package/dist/services/wallet-config.js +1 -1
  82. package/dist/signer/signer.cjs +117 -64
  83. package/dist/signer/signer.d.cts +4 -3
  84. package/dist/signer/signer.d.ts +4 -3
  85. package/dist/signer/signer.js +15 -7
  86. package/dist/{signer-CylxIujU.d.ts → signer-IO3oMRNj.d.cts} +2 -1
  87. package/dist/{signer-BhLS7SYR.d.cts → signer-wqesWifN.d.ts} +2 -1
  88. package/dist/{spark-DjR1b3TC.d.cts → spark-CDm4gqS6.d.cts} +1 -1
  89. package/dist/{spark-DjR1b3TC.d.ts → spark-CDm4gqS6.d.ts} +1 -1
  90. package/dist/types/index.cjs +282 -188
  91. package/dist/types/index.d.cts +7 -6
  92. package/dist/types/index.d.ts +7 -6
  93. package/dist/types/index.js +3 -3
  94. package/dist/utils/index.cjs +90 -58
  95. package/dist/utils/index.d.cts +6 -5
  96. package/dist/utils/index.d.ts +6 -5
  97. package/dist/utils/index.js +16 -16
  98. package/ios/spark_frostFFI.xcframework/ios-arm64/SparkFrost +0 -0
  99. package/ios/spark_frostFFI.xcframework/ios-arm64/spark_frostFFI.framework/spark_frostFFI +0 -0
  100. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/SparkFrost +0 -0
  101. package/ios/spark_frostFFI.xcframework/ios-arm64_x86_64-simulator/spark_frostFFI.framework/spark_frostFFI +0 -0
  102. package/ios/spark_frostFFI.xcframework/macos-arm64_x86_64/spark_frostFFI.framework/spark_frostFFI +0 -0
  103. package/package.json +4 -4
  104. package/src/constants.ts +21 -0
  105. package/src/errors/base.ts +43 -1
  106. package/src/graphql/client.ts +4 -0
  107. package/src/graphql/mutations/RequestLightningSend.ts +2 -0
  108. package/src/graphql/objects/ClaimStaticDepositInput.ts +1 -1
  109. package/src/graphql/objects/ClaimStaticDepositStatus.ts +4 -2
  110. package/src/graphql/objects/Connection.ts +7 -7
  111. package/src/graphql/objects/CoopExitFeeEstimate.ts +1 -1
  112. package/src/graphql/objects/CoopExitFeeQuote.ts +202 -0
  113. package/src/graphql/objects/CoopExitFeeQuoteInput.ts +41 -0
  114. package/src/graphql/objects/CoopExitFeeQuoteOutput.ts +45 -0
  115. package/src/graphql/objects/CoopExitRequest.ts +21 -0
  116. package/src/graphql/objects/CurrencyUnit.ts +26 -28
  117. package/src/graphql/objects/Entity.ts +84 -0
  118. package/src/graphql/objects/Invoice.ts +2 -2
  119. package/src/graphql/objects/Leaf.ts +1 -1
  120. package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +1 -1
  121. package/src/graphql/objects/LeavesSwapRequest.ts +6 -0
  122. package/src/graphql/objects/LightningReceiveRequest.ts +11 -0
  123. package/src/graphql/objects/LightningSendFeeEstimateInput.ts +8 -0
  124. package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +1 -1
  125. package/src/graphql/objects/LightningSendRequest.ts +3 -0
  126. package/src/graphql/objects/RequestCoopExitInput.ts +8 -0
  127. package/src/graphql/objects/RequestLeavesSwapInput.ts +5 -1
  128. package/src/graphql/objects/RequestLightningReceiveInput.ts +9 -2
  129. package/src/graphql/objects/RequestLightningSendInput.ts +8 -0
  130. package/src/graphql/objects/SparkCoopExitRequestStatus.ts +2 -0
  131. package/src/graphql/objects/SparkUserRequestType.ts +2 -0
  132. package/src/graphql/objects/SparkWalletUser.ts +20 -0
  133. package/src/graphql/objects/UserRequest.ts +32 -0
  134. package/src/graphql/objects/VerifyChallengeInput.ts +1 -1
  135. package/src/graphql/objects/index.ts +12 -3
  136. package/src/graphql/queries/LightningSendFeeEstimate.ts +2 -0
  137. package/src/logger.ts +3 -0
  138. package/src/native/index.ts +1 -0
  139. package/src/services/config.ts +4 -0
  140. package/src/services/connection.ts +68 -29
  141. package/src/services/coop-exit.ts +1 -1
  142. package/src/services/lightning.ts +25 -1
  143. package/src/services/lrc-connection.ts +3 -3
  144. package/src/services/token-transactions.ts +6 -2
  145. package/src/services/wallet-config.ts +2 -0
  146. package/src/signer/signer.ts +4 -1
  147. package/src/spark-wallet/spark-wallet.ts +51 -15
  148. package/src/spark-wallet/types.ts +1 -0
  149. package/src/tests/errors.test.ts +58 -0
  150. package/src/tests/integration/lightning.test.ts +184 -0
  151. package/src/tests/integration/ssp/static_deposit.test.ts +1 -2
  152. package/src/tests/tokens.test.ts +52 -3
  153. package/src/utils/token-hashing.ts +335 -1
  154. package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.cts +0 -5
  155. package/dist/LightningSendFeeEstimateInput-CJvPnCSB.d.ts +0 -5
  156. package/dist/chunk-HKAKEKCE.js +0 -8
@@ -63,6 +63,70 @@ fragment EntityFragment on Entity {
63
63
  claim_static_deposit_bitcoin_network: bitcoin_network
64
64
  claim_static_deposit_transfer_spark_id: transfer_spark_id
65
65
  }
66
+ ... on CoopExitFeeQuote {
67
+ __typename
68
+ coop_exit_fee_quote_id: id
69
+ coop_exit_fee_quote_created_at: created_at
70
+ coop_exit_fee_quote_updated_at: updated_at
71
+ coop_exit_fee_quote_network: network
72
+ coop_exit_fee_quote_total_amount: total_amount {
73
+ __typename
74
+ currency_amount_original_value: original_value
75
+ currency_amount_original_unit: original_unit
76
+ currency_amount_preferred_currency_unit: preferred_currency_unit
77
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
78
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
79
+ }
80
+ coop_exit_fee_quote_user_fee_fast: user_fee_fast {
81
+ __typename
82
+ currency_amount_original_value: original_value
83
+ currency_amount_original_unit: original_unit
84
+ currency_amount_preferred_currency_unit: preferred_currency_unit
85
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
86
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
87
+ }
88
+ coop_exit_fee_quote_user_fee_medium: user_fee_medium {
89
+ __typename
90
+ currency_amount_original_value: original_value
91
+ currency_amount_original_unit: original_unit
92
+ currency_amount_preferred_currency_unit: preferred_currency_unit
93
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
94
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
95
+ }
96
+ coop_exit_fee_quote_user_fee_slow: user_fee_slow {
97
+ __typename
98
+ currency_amount_original_value: original_value
99
+ currency_amount_original_unit: original_unit
100
+ currency_amount_preferred_currency_unit: preferred_currency_unit
101
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
102
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
103
+ }
104
+ coop_exit_fee_quote_l1_broadcast_fee_fast: l1_broadcast_fee_fast {
105
+ __typename
106
+ currency_amount_original_value: original_value
107
+ currency_amount_original_unit: original_unit
108
+ currency_amount_preferred_currency_unit: preferred_currency_unit
109
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
110
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
111
+ }
112
+ coop_exit_fee_quote_l1_broadcast_fee_medium: l1_broadcast_fee_medium {
113
+ __typename
114
+ currency_amount_original_value: original_value
115
+ currency_amount_original_unit: original_unit
116
+ currency_amount_preferred_currency_unit: preferred_currency_unit
117
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
118
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
119
+ }
120
+ coop_exit_fee_quote_l1_broadcast_fee_slow: l1_broadcast_fee_slow {
121
+ __typename
122
+ currency_amount_original_value: original_value
123
+ currency_amount_original_unit: original_unit
124
+ currency_amount_preferred_currency_unit: preferred_currency_unit
125
+ currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
126
+ currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
127
+ }
128
+ coop_exit_fee_quote_expires_at: expires_at
129
+ }
66
130
  ... on CoopExitRequest {
67
131
  __typename
68
132
  coop_exit_request_id: id
@@ -85,6 +149,10 @@ fragment EntityFragment on Entity {
85
149
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
86
150
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
87
151
  }
152
+ coop_exit_request_fee_quote: fee_quote {
153
+ id
154
+ }
155
+ coop_exit_request_exit_speed: exit_speed
88
156
  coop_exit_request_status: status
89
157
  coop_exit_request_expires_at: expires_at
90
158
  coop_exit_request_raw_connector_transaction: raw_connector_transaction
@@ -101,6 +169,9 @@ fragment EntityFragment on Entity {
101
169
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
102
170
  }
103
171
  transfer_spark_id: spark_id
172
+ transfer_user_request: user_request {
173
+ id
174
+ }
104
175
  }
105
176
  }
106
177
  ... on LeavesSwapRequest {
@@ -145,6 +216,9 @@ fragment EntityFragment on Entity {
145
216
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
146
217
  }
147
218
  transfer_spark_id: spark_id
219
+ transfer_user_request: user_request {
220
+ id
221
+ }
148
222
  }
149
223
  leaves_swap_request_outbound_transfer: outbound_transfer {
150
224
  __typename
@@ -157,6 +231,9 @@ fragment EntityFragment on Entity {
157
231
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
158
232
  }
159
233
  transfer_spark_id: spark_id
234
+ transfer_user_request: user_request {
235
+ id
236
+ }
160
237
  }
161
238
  leaves_swap_request_expires_at: expires_at
162
239
  leaves_swap_request_swap_leaves: swap_leaves {
@@ -201,8 +278,12 @@ fragment EntityFragment on Entity {
201
278
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
202
279
  }
203
280
  transfer_spark_id: spark_id
281
+ transfer_user_request: user_request {
282
+ id
283
+ }
204
284
  }
205
285
  lightning_receive_request_payment_preimage: payment_preimage
286
+ lightning_receive_request_receiver_identity_public_key: receiver_identity_public_key
206
287
  }
207
288
  ... on LightningSendRequest {
208
289
  __typename
@@ -232,6 +313,9 @@ fragment EntityFragment on Entity {
232
313
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
233
314
  }
234
315
  transfer_spark_id: spark_id
316
+ transfer_user_request: user_request {
317
+ id
318
+ }
235
319
  }
236
320
  lightning_send_request_payment_preimage: payment_preimage
237
321
  }
@@ -2,10 +2,10 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
- import {CurrencyAmountFromJson} from './CurrencyAmount.js';
6
5
  import BitcoinNetwork from './BitcoinNetwork.js';
7
- import {CurrencyAmountToJson} from './CurrencyAmount.js';
8
6
  import CurrencyAmount from './CurrencyAmount.js';
7
+ import {CurrencyAmountFromJson} from './CurrencyAmount.js';
8
+ import {CurrencyAmountToJson} from './CurrencyAmount.js';
9
9
 
10
10
 
11
11
  interface Invoice {
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import CurrencyAmount from './CurrencyAmount.js';
5
6
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
6
7
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
7
- import CurrencyAmount from './CurrencyAmount.js';
8
8
 
9
9
 
10
10
  interface Leaf {
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import CurrencyAmount from './CurrencyAmount.js';
5
6
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
6
7
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
7
- import CurrencyAmount from './CurrencyAmount.js';
8
8
 
9
9
 
10
10
  interface LeavesSwapFeeEstimateOutput {
@@ -150,6 +150,9 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
150
150
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
151
151
  }
152
152
  transfer_spark_id: spark_id
153
+ transfer_user_request: user_request {
154
+ id
155
+ }
153
156
  }
154
157
  leaves_swap_request_outbound_transfer: outbound_transfer {
155
158
  __typename
@@ -162,6 +165,9 @@ fragment LeavesSwapRequestFragment on LeavesSwapRequest {
162
165
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
163
166
  }
164
167
  transfer_spark_id: spark_id
168
+ transfer_user_request: user_request {
169
+ id
170
+ }
165
171
  }
166
172
  leaves_swap_request_expires_at: expires_at
167
173
  leaves_swap_request_swap_leaves: swap_leaves {
@@ -36,6 +36,9 @@ interface LightningReceiveRequest {
36
36
 
37
37
  /** The payment preimage of the invoice if retrieved from SE. **/
38
38
  paymentPreimage?: string | undefined;
39
+
40
+ /** The receiver's identity public key if different from owner of the request. **/
41
+ receiverIdentityPublicKey?: string | undefined;
39
42
  }
40
43
 
41
44
  export const LightningReceiveRequestFromJson = (
@@ -57,6 +60,8 @@ export const LightningReceiveRequestFromJson = (
57
60
  ? TransferFromJson(obj["lightning_receive_request_transfer"])
58
61
  : undefined,
59
62
  paymentPreimage: obj["lightning_receive_request_payment_preimage"],
63
+ receiverIdentityPublicKey:
64
+ obj["lightning_receive_request_receiver_identity_public_key"],
60
65
  } as LightningReceiveRequest;
61
66
  };
62
67
  export const LightningReceiveRequestToJson = (
@@ -74,6 +79,8 @@ export const LightningReceiveRequestToJson = (
74
79
  ? obj.transfer.toJson()
75
80
  : undefined,
76
81
  lightning_receive_request_payment_preimage: obj.paymentPreimage,
82
+ lightning_receive_request_receiver_identity_public_key:
83
+ obj.receiverIdentityPublicKey,
77
84
  };
78
85
  };
79
86
 
@@ -113,8 +120,12 @@ fragment LightningReceiveRequestFragment on LightningReceiveRequest {
113
120
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
114
121
  }
115
122
  transfer_spark_id: spark_id
123
+ transfer_user_request: user_request {
124
+ id
125
+ }
116
126
  }
117
127
  lightning_receive_request_payment_preimage: payment_preimage
128
+ lightning_receive_request_receiver_identity_public_key: receiver_identity_public_key
118
129
  }`;
119
130
 
120
131
  export const getLightningReceiveRequestQuery = (
@@ -10,6 +10,12 @@ interface LightningSendFeeEstimateInput {
10
10
 
11
11
  encodedInvoice: string;
12
12
 
13
+ /**
14
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
15
+ * zero.
16
+ **/
17
+ amountSats?: number | undefined;
18
+
13
19
 
14
20
 
15
21
 
@@ -18,6 +24,7 @@ interface LightningSendFeeEstimateInput {
18
24
  export const LightningSendFeeEstimateInputFromJson = (obj: any): LightningSendFeeEstimateInput => {
19
25
  return {
20
26
  encodedInvoice: obj["lightning_send_fee_estimate_input_encoded_invoice"],
27
+ amountSats: obj["lightning_send_fee_estimate_input_amount_sats"],
21
28
 
22
29
  } as LightningSendFeeEstimateInput;
23
30
 
@@ -25,6 +32,7 @@ export const LightningSendFeeEstimateInputFromJson = (obj: any): LightningSendFe
25
32
  export const LightningSendFeeEstimateInputToJson = (obj: LightningSendFeeEstimateInput): any => {
26
33
  return {
27
34
  lightning_send_fee_estimate_input_encoded_invoice: obj.encodedInvoice,
35
+ lightning_send_fee_estimate_input_amount_sats: obj.amountSats,
28
36
 
29
37
  }
30
38
 
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import CurrencyAmount from './CurrencyAmount.js';
5
6
  import {CurrencyAmountFromJson} from './CurrencyAmount.js';
6
7
  import {CurrencyAmountToJson} from './CurrencyAmount.js';
7
- import CurrencyAmount from './CurrencyAmount.js';
8
8
 
9
9
 
10
10
  interface LightningSendFeeEstimateOutput {
@@ -117,6 +117,9 @@ fragment LightningSendRequestFragment on LightningSendRequest {
117
117
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
118
118
  }
119
119
  transfer_spark_id: spark_id
120
+ transfer_user_request: user_request {
121
+ id
122
+ }
120
123
  }
121
124
  lightning_send_request_payment_preimage: payment_preimage
122
125
  }`;
@@ -18,6 +18,10 @@ interface RequestCoopExitInput {
18
18
 
19
19
  withdrawAll: boolean;
20
20
 
21
+ feeLeafExternalIds?: string[] | undefined;
22
+
23
+ feeQuoteId?: string | undefined;
24
+
21
25
 
22
26
 
23
27
 
@@ -30,6 +34,8 @@ export const RequestCoopExitInputFromJson = (obj: any): RequestCoopExitInput =>
30
34
  idempotencyKey: obj["request_coop_exit_input_idempotency_key"],
31
35
  exitSpeed: ExitSpeed[obj["request_coop_exit_input_exit_speed"]] ?? ExitSpeed.FUTURE_VALUE,
32
36
  withdrawAll: obj["request_coop_exit_input_withdraw_all"],
37
+ feeLeafExternalIds: obj["request_coop_exit_input_fee_leaf_external_ids"],
38
+ feeQuoteId: obj["request_coop_exit_input_fee_quote_id"],
33
39
 
34
40
  } as RequestCoopExitInput;
35
41
 
@@ -41,6 +47,8 @@ request_coop_exit_input_withdrawal_address: obj.withdrawalAddress,
41
47
  request_coop_exit_input_idempotency_key: obj.idempotencyKey,
42
48
  request_coop_exit_input_exit_speed: obj.exitSpeed,
43
49
  request_coop_exit_input_withdraw_all: obj.withdrawAll,
50
+ request_coop_exit_input_fee_leaf_external_ids: obj.feeLeafExternalIds,
51
+ request_coop_exit_input_fee_quote_id: obj.feeQuoteId,
44
52
 
45
53
  }
46
54
 
@@ -3,8 +3,8 @@
3
3
 
4
4
 
5
5
  import {UserLeafInputFromJson} from './UserLeafInput.js';
6
- import UserLeafInput from './UserLeafInput.js';
7
6
  import {UserLeafInputToJson} from './UserLeafInput.js';
7
+ import UserLeafInput from './UserLeafInput.js';
8
8
 
9
9
 
10
10
  interface RequestLeavesSwapInput {
@@ -22,6 +22,8 @@ interface RequestLeavesSwapInput {
22
22
 
23
23
  idempotencyKey: string;
24
24
 
25
+ targetAmountSatsList?: number[] | undefined;
26
+
25
27
 
26
28
 
27
29
 
@@ -35,6 +37,7 @@ export const RequestLeavesSwapInputFromJson = (obj: any): RequestLeavesSwapInput
35
37
  feeSats: obj["request_leaves_swap_input_fee_sats"],
36
38
  userLeaves: obj["request_leaves_swap_input_user_leaves"].map((e) => UserLeafInputFromJson(e)),
37
39
  idempotencyKey: obj["request_leaves_swap_input_idempotency_key"],
40
+ targetAmountSatsList: obj["request_leaves_swap_input_target_amount_sats_list"],
38
41
 
39
42
  } as RequestLeavesSwapInput;
40
43
 
@@ -47,6 +50,7 @@ request_leaves_swap_input_target_amount_sats: obj.targetAmountSats,
47
50
  request_leaves_swap_input_fee_sats: obj.feeSats,
48
51
  request_leaves_swap_input_user_leaves: obj.userLeaves.map((e) => UserLeafInputToJson(e)),
49
52
  request_leaves_swap_input_idempotency_key: obj.idempotencyKey,
53
+ request_leaves_swap_input_target_amount_sats_list: obj.targetAmountSatsList,
50
54
 
51
55
  }
52
56
 
@@ -27,7 +27,10 @@ includeSparkAddress: boolean;
27
27
  /** The expiry of the lightning invoice in seconds. Default value is 86400 (1 day). **/
28
28
  expirySecs?: number | undefined;
29
29
 
30
- /** The memo to include in the lightning invoice. **/
30
+ /**
31
+ * The memo to include in the lightning invoice. Should not be provided if the description_hash is
32
+ * provided.
33
+ **/
31
34
  memo?: string | undefined;
32
35
 
33
36
  /**
@@ -38,11 +41,14 @@ receiverIdentityPubkey?: string | undefined;
38
41
 
39
42
  /**
40
43
  * The h tag of the invoice. This is the hash of a longer description to include in the lightning
41
- * invoice. It is used in LNURL and UMA as the hash of the metadata.
44
+ * invoice. It is used in LNURL and UMA as the hash of the metadata. This field is mutually exclusive
45
+ * with the memo field. Only one or the other should be provided.
42
46
  **/
43
47
  descriptionHash?: string | undefined;
44
48
 
45
49
 
50
+
51
+
46
52
  }
47
53
 
48
54
  export const RequestLightningReceiveInputFromJson = (obj: any): RequestLightningReceiveInput => {
@@ -69,6 +75,7 @@ request_lightning_receive_input_memo: obj.memo,
69
75
  request_lightning_receive_input_receiver_identity_pubkey: obj.receiverIdentityPubkey,
70
76
  request_lightning_receive_input_include_spark_address: obj.includeSparkAddress,
71
77
  request_lightning_receive_input_description_hash: obj.descriptionHash,
78
+
72
79
  }
73
80
 
74
81
  }
@@ -12,6 +12,12 @@ interface RequestLightningSendInput {
12
12
 
13
13
  idempotencyKey: string;
14
14
 
15
+ /**
16
+ * The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
17
+ * zero.
18
+ **/
19
+ amountSats?: number | undefined;
20
+
15
21
 
16
22
 
17
23
 
@@ -21,6 +27,7 @@ export const RequestLightningSendInputFromJson = (obj: any): RequestLightningSen
21
27
  return {
22
28
  encodedInvoice: obj["request_lightning_send_input_encoded_invoice"],
23
29
  idempotencyKey: obj["request_lightning_send_input_idempotency_key"],
30
+ amountSats: obj["request_lightning_send_input_amount_sats"],
24
31
 
25
32
  } as RequestLightningSendInput;
26
33
 
@@ -29,6 +36,7 @@ export const RequestLightningSendInputToJson = (obj: RequestLightningSendInput):
29
36
  return {
30
37
  request_lightning_send_input_encoded_invoice: obj.encodedInvoice,
31
38
  request_lightning_send_input_idempotency_key: obj.idempotencyKey,
39
+ request_lightning_send_input_amount_sats: obj.amountSats,
32
40
 
33
41
  }
34
42
 
@@ -11,6 +11,8 @@ export enum SparkCoopExitRequestStatus {
11
11
 
12
12
  INITIATED = "INITIATED",
13
13
 
14
+ INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
15
+
14
16
  TX_SIGNED = "TX_SIGNED",
15
17
 
16
18
  TX_BROADCASTED = "TX_BROADCASTED",
@@ -17,6 +17,8 @@ COOP_EXIT = "COOP_EXIT",
17
17
 
18
18
  LEAVES_SWAP = "LEAVES_SWAP",
19
19
 
20
+ CLAIM_STATIC_DEPOSIT = "CLAIM_STATIC_DEPOSIT",
21
+
20
22
  }
21
23
 
22
24
  export default SparkUserRequestType;
@@ -105,6 +105,10 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
105
105
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
106
106
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
107
107
  }
108
+ coop_exit_request_fee_quote: fee_quote {
109
+ id
110
+ }
111
+ coop_exit_request_exit_speed: exit_speed
108
112
  coop_exit_request_status: status
109
113
  coop_exit_request_expires_at: expires_at
110
114
  coop_exit_request_raw_connector_transaction: raw_connector_transaction
@@ -121,6 +125,9 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
121
125
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
122
126
  }
123
127
  transfer_spark_id: spark_id
128
+ transfer_user_request: user_request {
129
+ id
130
+ }
124
131
  }
125
132
  }
126
133
  ... on LeavesSwapRequest {
@@ -165,6 +172,9 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
165
172
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
166
173
  }
167
174
  transfer_spark_id: spark_id
175
+ transfer_user_request: user_request {
176
+ id
177
+ }
168
178
  }
169
179
  leaves_swap_request_outbound_transfer: outbound_transfer {
170
180
  __typename
@@ -177,6 +187,9 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
177
187
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
178
188
  }
179
189
  transfer_spark_id: spark_id
190
+ transfer_user_request: user_request {
191
+ id
192
+ }
180
193
  }
181
194
  leaves_swap_request_expires_at: expires_at
182
195
  leaves_swap_request_swap_leaves: swap_leaves {
@@ -221,8 +234,12 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
221
234
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
222
235
  }
223
236
  transfer_spark_id: spark_id
237
+ transfer_user_request: user_request {
238
+ id
239
+ }
224
240
  }
225
241
  lightning_receive_request_payment_preimage: payment_preimage
242
+ lightning_receive_request_receiver_identity_public_key: receiver_identity_public_key
226
243
  }
227
244
  ... on LightningSendRequest {
228
245
  __typename
@@ -252,6 +269,9 @@ query FetchSparkWalletUserToUserRequestsConnection($entity_id: ID!, $first: Int,
252
269
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
253
270
  }
254
271
  transfer_spark_id: spark_id
272
+ transfer_user_request: user_request {
273
+ id
274
+ }
255
275
  }
256
276
  lightning_send_request_payment_preimage: payment_preimage
257
277
  }
@@ -9,6 +9,7 @@ import {
9
9
  CurrencyAmountFromJson,
10
10
  CurrencyAmountToJson,
11
11
  } from "./CurrencyAmount.js";
12
+ import ExitSpeed from "./ExitSpeed.js";
12
13
  import { InvoiceFromJson, InvoiceToJson } from "./Invoice.js";
13
14
  import LeavesSwapRequest from "./LeavesSwapRequest.js";
14
15
  import LightningReceiveRequest from "./LightningReceiveRequest.js";
@@ -87,6 +88,11 @@ export const UserRequestFromJson = (obj: any): UserRequest => {
87
88
  obj["coop_exit_request_raw_coop_exit_transaction"],
88
89
  coopExitTxid: obj["coop_exit_request_coop_exit_txid"],
89
90
  typename: "CoopExitRequest",
91
+ feeQuoteId: obj["coop_exit_request_fee_quote"]?.id ?? undefined,
92
+ exitSpeed: !!obj["coop_exit_request_exit_speed"]
93
+ ? (ExitSpeed[obj["coop_exit_request_exit_speed"]] ??
94
+ ExitSpeed.FUTURE_VALUE)
95
+ : null,
90
96
  transfer: !!obj["coop_exit_request_transfer"]
91
97
  ? TransferFromJson(obj["coop_exit_request_transfer"])
92
98
  : undefined,
@@ -141,6 +147,8 @@ export const UserRequestFromJson = (obj: any): UserRequest => {
141
147
  ? TransferFromJson(obj["lightning_receive_request_transfer"])
142
148
  : undefined,
143
149
  paymentPreimage: obj["lightning_receive_request_payment_preimage"],
150
+ receiverIdentityPublicKey:
151
+ obj["lightning_receive_request_receiver_identity_public_key"],
144
152
  } as LightningReceiveRequest;
145
153
  }
146
154
  if (obj["__typename"] == "LightningSendRequest") {
@@ -204,6 +212,8 @@ export const UserRequestToJson = (obj: UserRequest): any => {
204
212
  coop_exit_request_l1_broadcast_fee: CurrencyAmountToJson(
205
213
  coopExitRequest.l1BroadcastFee,
206
214
  ),
215
+ coop_exit_request_fee_quote: { id: coopExitRequest.feeQuoteId },
216
+ coop_exit_request_exit_speed: coopExitRequest.exitSpeed,
207
217
  coop_exit_request_status: coopExitRequest.status,
208
218
  coop_exit_request_expires_at: coopExitRequest.expiresAt,
209
219
  coop_exit_request_raw_connector_transaction:
@@ -260,6 +270,8 @@ export const UserRequestToJson = (obj: UserRequest): any => {
260
270
  : undefined,
261
271
  lightning_receive_request_payment_preimage:
262
272
  lightningReceiveRequest.paymentPreimage,
273
+ lightning_receive_request_receiver_identity_public_key:
274
+ lightningReceiveRequest.receiverIdentityPublicKey,
263
275
  };
264
276
  }
265
277
  if (obj.typename == "LightningSendRequest") {
@@ -344,6 +356,10 @@ fragment UserRequestFragment on UserRequest {
344
356
  currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
345
357
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
346
358
  }
359
+ coop_exit_request_fee_quote: fee_quote {
360
+ id
361
+ }
362
+ coop_exit_request_exit_speed: exit_speed
347
363
  coop_exit_request_status: status
348
364
  coop_exit_request_expires_at: expires_at
349
365
  coop_exit_request_raw_connector_transaction: raw_connector_transaction
@@ -360,6 +376,9 @@ fragment UserRequestFragment on UserRequest {
360
376
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
361
377
  }
362
378
  transfer_spark_id: spark_id
379
+ transfer_user_request: user_request {
380
+ id
381
+ }
363
382
  }
364
383
  }
365
384
  ... on LeavesSwapRequest {
@@ -404,6 +423,9 @@ fragment UserRequestFragment on UserRequest {
404
423
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
405
424
  }
406
425
  transfer_spark_id: spark_id
426
+ transfer_user_request: user_request {
427
+ id
428
+ }
407
429
  }
408
430
  leaves_swap_request_outbound_transfer: outbound_transfer {
409
431
  __typename
@@ -416,6 +438,9 @@ fragment UserRequestFragment on UserRequest {
416
438
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
417
439
  }
418
440
  transfer_spark_id: spark_id
441
+ transfer_user_request: user_request {
442
+ id
443
+ }
419
444
  }
420
445
  leaves_swap_request_expires_at: expires_at
421
446
  leaves_swap_request_swap_leaves: swap_leaves {
@@ -460,8 +485,12 @@ fragment UserRequestFragment on UserRequest {
460
485
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
461
486
  }
462
487
  transfer_spark_id: spark_id
488
+ transfer_user_request: user_request {
489
+ id
490
+ }
463
491
  }
464
492
  lightning_receive_request_payment_preimage: payment_preimage
493
+ lightning_receive_request_receiver_identity_public_key: receiver_identity_public_key
465
494
  }
466
495
  ... on LightningSendRequest {
467
496
  __typename
@@ -491,6 +520,9 @@ fragment UserRequestFragment on UserRequest {
491
520
  currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
492
521
  }
493
522
  transfer_spark_id: spark_id
523
+ transfer_user_request: user_request {
524
+ id
525
+ }
494
526
  }
495
527
  lightning_send_request_payment_preimage: payment_preimage
496
528
  }
@@ -2,9 +2,9 @@
2
2
  // Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
3
3
 
4
4
 
5
+ import Provider from './Provider.js';
5
6
  import {ProviderFromJson} from './Provider.js';
6
7
  import {ProviderToJson} from './Provider.js';
7
- import Provider from './Provider.js';
8
8
 
9
9
 
10
10
  interface VerifyChallengeInput {
@@ -1,7 +1,7 @@
1
1
  export { default as BitcoinNetwork } from "./BitcoinNetwork.js";
2
2
  export {
3
- type default as ClaimStaticDeposit,
4
3
  getClaimStaticDepositQuery,
4
+ type default as ClaimStaticDeposit,
5
5
  } from "./ClaimStaticDeposit.js";
6
6
  export type { default as ClaimStaticDepositInput } from "./ClaimStaticDepositInput.js";
7
7
  export type { default as ClaimStaticDepositOutput } from "./ClaimStaticDepositOutput.js";
@@ -18,7 +18,13 @@ export type { default as CoopExitFeeEstimate } from "./CoopExitFeeEstimate.js";
18
18
  export type { default as CoopExitFeeEstimatesInput } from "./CoopExitFeeEstimatesInput.js";
19
19
  export type { default as CoopExitFeeEstimatesOutput } from "./CoopExitFeeEstimatesOutput.js";
20
20
  export {
21
- type default as CoopExitRequest,
21
+ getCoopExitFeeQuoteQuery,
22
+ type default as CoopExitFeeQuote,
23
+ } from "./CoopExitFeeQuote.js";
24
+ export type { default as CoopExitFeeQuoteInput } from "./CoopExitFeeQuoteInput.js";
25
+ export type { default as CoopExitFeeQuoteOutput } from "./CoopExitFeeQuoteOutput.js";
26
+ export type {
27
+ default as CoopExitRequest,
22
28
  getCoopExitRequestQuery,
23
29
  } from "./CoopExitRequest.js";
24
30
  export type { default as CurrencyAmount } from "./CurrencyAmount.js";
@@ -71,7 +77,10 @@ export type { default as StaticDepositQuoteOutput } from "./StaticDepositQuoteOu
71
77
  export type { default as SwapLeaf } from "./SwapLeaf.js";
72
78
  export { default as Transfer } from "./Transfer.js";
73
79
  export type { default as UserLeafInput } from "./UserLeafInput.js";
74
- export { getUserRequestQuery, type default as UserRequest } from "./UserRequest.js";
80
+ export {
81
+ getUserRequestQuery,
82
+ type default as UserRequest,
83
+ } from "./UserRequest.js";
75
84
  export type { default as VerifyChallengeInput } from "./VerifyChallengeInput.js";
76
85
  export type { default as VerifyChallengeOutput } from "./VerifyChallengeOutput.js";
77
86
  export type { default as WalletUserIdentityPublicKeyInput } from "./WalletUserIdentityPublicKeyInput.js";
@@ -3,10 +3,12 @@ import { FRAGMENT as LightningSendFeeEstimateOutputFragment } from "../objects/L
3
3
  export const LightningSendFeeEstimate = `
4
4
  query LightningSendFeeEstimate(
5
5
  $encoded_invoice: String!
6
+ $amount_sats: Long
6
7
  ) {
7
8
  lightning_send_fee_estimate(
8
9
  input: {
9
10
  encoded_invoice: $encoded_invoice
11
+ amount_sats: $amount_sats
10
12
  }
11
13
  ) {
12
14
  ...LightningSendFeeEstimateOutputFragment
package/src/logger.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { Logger } from "@lightsparkdev/core";
2
+
3
+ export const logger = new Logger("@buildonspark/spark-sdk");