@buildonspark/spark-sdk 0.0.15 → 0.0.16
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/dist/services/wallet-config.d.ts +1 -0
- package/dist/services/wallet-config.js +1 -0
- package/dist/services/wallet-config.js.map +1 -1
- package/dist/spark-sdk.d.ts +1 -1
- package/dist/spark-sdk.js +3 -3
- package/dist/spark-sdk.js.map +1 -1
- package/package.json +4 -3
- package/src/examples/example.js +247 -0
- package/src/examples/example.ts +207 -0
- package/src/graphql/client.ts +282 -0
- package/src/graphql/mutations/CompleteCoopExit.ts +19 -0
- package/src/graphql/mutations/CompleteLeavesSwap.ts +17 -0
- package/src/graphql/mutations/RequestCoopExit.ts +20 -0
- package/src/graphql/mutations/RequestLightningReceive.ts +26 -0
- package/src/graphql/mutations/RequestLightningSend.ts +17 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +24 -0
- package/src/graphql/objects/BitcoinNetwork.ts +22 -0
- package/src/graphql/objects/CompleteCoopExitInput.ts +41 -0
- package/src/graphql/objects/CompleteCoopExitOutput.ts +45 -0
- package/src/graphql/objects/CompleteLeavesSwapInput.ts +45 -0
- package/src/graphql/objects/CompleteLeavesSwapOutput.ts +45 -0
- package/src/graphql/objects/CompleteSeedReleaseInput.ts +41 -0
- package/src/graphql/objects/CompleteSeedReleaseOutput.ts +43 -0
- package/src/graphql/objects/Connection.ts +90 -0
- package/src/graphql/objects/CoopExitFeeEstimateInput.ts +41 -0
- package/src/graphql/objects/CoopExitFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/CoopExitRequest.ts +118 -0
- package/src/graphql/objects/CurrencyAmount.ts +74 -0
- package/src/graphql/objects/CurrencyUnit.ts +32 -0
- package/src/graphql/objects/Entity.ts +202 -0
- package/src/graphql/objects/GetChallengeInput.ts +37 -0
- package/src/graphql/objects/GetChallengeOutput.ts +43 -0
- package/src/graphql/objects/Invoice.ts +83 -0
- package/src/graphql/objects/Leaf.ts +59 -0
- package/src/graphql/objects/LeavesSwapFeeEstimateInput.ts +37 -0
- package/src/graphql/objects/LeavesSwapFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LeavesSwapRequest.ts +192 -0
- package/src/graphql/objects/LightningReceiveFeeEstimateInput.ts +41 -0
- package/src/graphql/objects/LightningReceiveFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LightningReceiveRequest.ts +147 -0
- package/src/graphql/objects/LightningReceiveRequestStatus.ts +34 -0
- package/src/graphql/objects/LightningSendFeeEstimateInput.ts +37 -0
- package/src/graphql/objects/LightningSendFeeEstimateOutput.ts +52 -0
- package/src/graphql/objects/LightningSendRequest.ts +134 -0
- package/src/graphql/objects/LightningSendRequestStatus.ts +28 -0
- package/src/graphql/objects/NotifyReceiverTransferInput.ts +41 -0
- package/src/graphql/objects/PageInfo.ts +58 -0
- package/src/graphql/objects/Provider.ts +41 -0
- package/src/graphql/objects/RequestCoopExitInput.ts +41 -0
- package/src/graphql/objects/RequestCoopExitOutput.ts +45 -0
- package/src/graphql/objects/RequestLeavesSwapInput.ts +55 -0
- package/src/graphql/objects/RequestLeavesSwapOutput.ts +45 -0
- package/src/graphql/objects/RequestLightningReceiveInput.ts +58 -0
- package/src/graphql/objects/RequestLightningReceiveOutput.ts +45 -0
- package/src/graphql/objects/RequestLightningSendInput.ts +41 -0
- package/src/graphql/objects/RequestLightningSendOutput.ts +45 -0
- package/src/graphql/objects/SparkCoopExitRequestStatus.ts +20 -0
- package/src/graphql/objects/SparkLeavesSwapRequestStatus.ts +20 -0
- package/src/graphql/objects/SparkTransferToLeavesConnection.ts +79 -0
- package/src/graphql/objects/SparkWalletUser.ts +86 -0
- package/src/graphql/objects/StartSeedReleaseInput.ts +37 -0
- package/src/graphql/objects/SwapLeaf.ts +53 -0
- package/src/graphql/objects/Transfer.ts +98 -0
- package/src/graphql/objects/UserLeafInput.ts +28 -0
- package/src/graphql/objects/VerifyChallengeInput.ts +51 -0
- package/src/graphql/objects/VerifyChallengeOutput.ts +43 -0
- package/src/graphql/objects/WalletUserIdentityPublicKeyInput.ts +37 -0
- package/src/graphql/objects/WalletUserIdentityPublicKeyOutput.ts +43 -0
- package/src/graphql/objects/index.ts +67 -0
- package/src/graphql/queries/CoopExitFeeEstimate.ts +18 -0
- package/src/graphql/queries/CurrentUser.ts +10 -0
- package/src/graphql/queries/LightningReceiveFeeEstimate.ts +18 -0
- package/src/graphql/queries/LightningSendFeeEstimate.ts +16 -0
- package/src/proto/common.ts +431 -0
- package/src/proto/google/protobuf/descriptor.ts +6625 -0
- package/src/proto/google/protobuf/duration.ts +197 -0
- package/src/proto/google/protobuf/empty.ts +83 -0
- package/src/proto/google/protobuf/timestamp.ts +226 -0
- package/src/proto/mock.ts +151 -0
- package/src/proto/spark.ts +12727 -0
- package/src/proto/spark_authn.ts +673 -0
- package/src/proto/validate/validate.ts +6047 -0
- package/src/services/config.ts +71 -0
- package/src/services/connection.ts +264 -0
- package/src/services/coop-exit.ts +190 -0
- package/src/services/deposit.ts +327 -0
- package/src/services/lightning.ts +341 -0
- package/src/services/lrc20.ts +42 -0
- package/src/services/token-transactions.ts +499 -0
- package/src/services/transfer.ts +1188 -0
- package/src/services/tree-creation.ts +618 -0
- package/src/services/wallet-config.ts +141 -0
- package/src/signer/signer.ts +531 -0
- package/src/spark-sdk.ts +1644 -0
- package/src/tests/adaptor-signature.test.ts +64 -0
- package/src/tests/bitcoin.test.ts +122 -0
- package/src/tests/coop-exit.test.ts +233 -0
- package/src/tests/deposit.test.ts +98 -0
- package/src/tests/keys.test.ts +82 -0
- package/src/tests/lightning.test.ts +307 -0
- package/src/tests/secret-sharing.test.ts +63 -0
- package/src/tests/swap.test.ts +252 -0
- package/src/tests/test-util.ts +92 -0
- package/src/tests/tokens.test.ts +47 -0
- package/src/tests/transfer.test.ts +371 -0
- package/src/tests/tree-creation.test.ts +56 -0
- package/src/tests/utils/spark-testing-wallet.ts +37 -0
- package/src/tests/utils/test-faucet.ts +257 -0
- package/src/types/grpc.ts +8 -0
- package/src/types/index.ts +3 -0
- package/src/utils/adaptor-signature.ts +189 -0
- package/src/utils/bitcoin.ts +138 -0
- package/src/utils/crypto.ts +14 -0
- package/src/utils/index.ts +12 -0
- package/src/utils/keys.ts +92 -0
- package/src/utils/mempool.ts +42 -0
- package/src/utils/network.ts +70 -0
- package/src/utils/proof.ts +17 -0
- package/src/utils/response-validation.ts +26 -0
- package/src/utils/secret-sharing.ts +263 -0
- package/src/utils/signing.ts +96 -0
- package/src/utils/token-hashing.ts +163 -0
- package/src/utils/token-keyshares.ts +31 -0
- package/src/utils/token-transactions.ts +71 -0
- package/src/utils/transaction.ts +45 -0
- package/src/utils/wasm-wrapper.ts +57 -0
- package/src/utils/wasm.ts +154 -0
- package/src/wasm/spark_bindings.d.ts +208 -0
- package/src/wasm/spark_bindings.js +1161 -0
- package/src/wasm/spark_bindings_bg.wasm +0 -0
- package/src/wasm/spark_bindings_bg.wasm.d.ts +136 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import { Query, isObject } from '@lightsparkdev/core';
|
|
6
|
+
|
|
7
|
+
/** This interface is used by all the entities in the Lightspark system. It defines a few core fields that are available everywhere. Any object that implements this interface can be queried using the `entity` query and its ID. **/
|
|
8
|
+
interface Entity {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
13
|
+
* string.
|
|
14
|
+
**/
|
|
15
|
+
id: string;
|
|
16
|
+
|
|
17
|
+
/** The date and time when the entity was first created. **/
|
|
18
|
+
createdAt: string;
|
|
19
|
+
|
|
20
|
+
/** The date and time when the entity was last updated. **/
|
|
21
|
+
updatedAt: string;
|
|
22
|
+
|
|
23
|
+
/** The typename of the object **/
|
|
24
|
+
typename: string;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export const FRAGMENT = `
|
|
36
|
+
fragment EntityFragment on Entity {
|
|
37
|
+
__typename
|
|
38
|
+
... on CoopExitRequest {
|
|
39
|
+
__typename
|
|
40
|
+
coop_exit_request_id: id
|
|
41
|
+
coop_exit_request_created_at: created_at
|
|
42
|
+
coop_exit_request_updated_at: updated_at
|
|
43
|
+
coop_exit_request_fee: fee {
|
|
44
|
+
__typename
|
|
45
|
+
currency_amount_original_value: original_value
|
|
46
|
+
currency_amount_original_unit: original_unit
|
|
47
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
48
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
49
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
50
|
+
}
|
|
51
|
+
coop_exit_request_status: status
|
|
52
|
+
coop_exit_request_expires_at: expires_at
|
|
53
|
+
coop_exit_request_raw_connector_transaction: raw_connector_transaction
|
|
54
|
+
}
|
|
55
|
+
... on LeavesSwapRequest {
|
|
56
|
+
__typename
|
|
57
|
+
leaves_swap_request_id: id
|
|
58
|
+
leaves_swap_request_created_at: created_at
|
|
59
|
+
leaves_swap_request_updated_at: updated_at
|
|
60
|
+
leaves_swap_request_status: status
|
|
61
|
+
leaves_swap_request_total_amount: total_amount {
|
|
62
|
+
__typename
|
|
63
|
+
currency_amount_original_value: original_value
|
|
64
|
+
currency_amount_original_unit: original_unit
|
|
65
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
66
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
67
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
68
|
+
}
|
|
69
|
+
leaves_swap_request_target_amount: target_amount {
|
|
70
|
+
__typename
|
|
71
|
+
currency_amount_original_value: original_value
|
|
72
|
+
currency_amount_original_unit: original_unit
|
|
73
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
74
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
75
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
76
|
+
}
|
|
77
|
+
leaves_swap_request_fee: fee {
|
|
78
|
+
__typename
|
|
79
|
+
currency_amount_original_value: original_value
|
|
80
|
+
currency_amount_original_unit: original_unit
|
|
81
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
82
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
83
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
84
|
+
}
|
|
85
|
+
leaves_swap_request_inbound_transfer: inbound_transfer {
|
|
86
|
+
__typename
|
|
87
|
+
transfer_total_amount: total_amount {
|
|
88
|
+
__typename
|
|
89
|
+
currency_amount_original_value: original_value
|
|
90
|
+
currency_amount_original_unit: original_unit
|
|
91
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
92
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
93
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
94
|
+
}
|
|
95
|
+
transfer_spark_id: spark_id
|
|
96
|
+
}
|
|
97
|
+
leaves_swap_request_outbound_transfer: outbound_transfer {
|
|
98
|
+
__typename
|
|
99
|
+
transfer_total_amount: total_amount {
|
|
100
|
+
__typename
|
|
101
|
+
currency_amount_original_value: original_value
|
|
102
|
+
currency_amount_original_unit: original_unit
|
|
103
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
104
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
105
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
106
|
+
}
|
|
107
|
+
transfer_spark_id: spark_id
|
|
108
|
+
}
|
|
109
|
+
leaves_swap_request_expires_at: expires_at
|
|
110
|
+
leaves_swap_request_swap_leaves: swap_leaves {
|
|
111
|
+
__typename
|
|
112
|
+
swap_leaf_leaf_id: leaf_id
|
|
113
|
+
swap_leaf_raw_unsigned_refund_transaction: raw_unsigned_refund_transaction
|
|
114
|
+
swap_leaf_adaptor_signed_signature: adaptor_signed_signature
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
... on LightningReceiveRequest {
|
|
118
|
+
__typename
|
|
119
|
+
lightning_receive_request_id: id
|
|
120
|
+
lightning_receive_request_created_at: created_at
|
|
121
|
+
lightning_receive_request_updated_at: updated_at
|
|
122
|
+
lightning_receive_request_invoice: invoice {
|
|
123
|
+
__typename
|
|
124
|
+
invoice_encoded_envoice: encoded_envoice
|
|
125
|
+
invoice_bitcoin_network: bitcoin_network
|
|
126
|
+
invoice_payment_hash: payment_hash
|
|
127
|
+
invoice_amount: amount {
|
|
128
|
+
__typename
|
|
129
|
+
currency_amount_original_value: original_value
|
|
130
|
+
currency_amount_original_unit: original_unit
|
|
131
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
132
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
133
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
134
|
+
}
|
|
135
|
+
invoice_created_at: created_at
|
|
136
|
+
invoice_expires_at: expires_at
|
|
137
|
+
invoice_memo: memo
|
|
138
|
+
}
|
|
139
|
+
lightning_receive_request_fee: fee {
|
|
140
|
+
__typename
|
|
141
|
+
currency_amount_original_value: original_value
|
|
142
|
+
currency_amount_original_unit: original_unit
|
|
143
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
144
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
145
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
146
|
+
}
|
|
147
|
+
lightning_receive_request_status: status
|
|
148
|
+
lightning_receive_request_transfer: transfer {
|
|
149
|
+
__typename
|
|
150
|
+
transfer_total_amount: total_amount {
|
|
151
|
+
__typename
|
|
152
|
+
currency_amount_original_value: original_value
|
|
153
|
+
currency_amount_original_unit: original_unit
|
|
154
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
155
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
156
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
157
|
+
}
|
|
158
|
+
transfer_spark_id: spark_id
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
... on LightningSendRequest {
|
|
162
|
+
__typename
|
|
163
|
+
lightning_send_request_id: id
|
|
164
|
+
lightning_send_request_created_at: created_at
|
|
165
|
+
lightning_send_request_updated_at: updated_at
|
|
166
|
+
lightning_send_request_encoded_invoice: encoded_invoice
|
|
167
|
+
lightning_send_request_fee: fee {
|
|
168
|
+
__typename
|
|
169
|
+
currency_amount_original_value: original_value
|
|
170
|
+
currency_amount_original_unit: original_unit
|
|
171
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
172
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
173
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
174
|
+
}
|
|
175
|
+
lightning_send_request_idempotency_key: idempotency_key
|
|
176
|
+
lightning_send_request_status: status
|
|
177
|
+
lightning_send_request_transfer: transfer {
|
|
178
|
+
__typename
|
|
179
|
+
transfer_total_amount: total_amount {
|
|
180
|
+
__typename
|
|
181
|
+
currency_amount_original_value: original_value
|
|
182
|
+
currency_amount_original_unit: original_unit
|
|
183
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
184
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
185
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
186
|
+
}
|
|
187
|
+
transfer_spark_id: spark_id
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
... on SparkWalletUser {
|
|
191
|
+
__typename
|
|
192
|
+
spark_wallet_user_id: id
|
|
193
|
+
spark_wallet_user_created_at: created_at
|
|
194
|
+
spark_wallet_user_updated_at: updated_at
|
|
195
|
+
spark_wallet_user_identity_public_key: identity_public_key
|
|
196
|
+
}
|
|
197
|
+
}`;
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
export default Entity;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface GetChallengeInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
publicKey: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const GetChallengeInputFromJson = (obj: any): GetChallengeInput => {
|
|
19
|
+
return {
|
|
20
|
+
publicKey: obj["get_challenge_input_public_key"],
|
|
21
|
+
|
|
22
|
+
} as GetChallengeInput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const GetChallengeInputToJson = (obj: GetChallengeInput): any => {
|
|
26
|
+
return {
|
|
27
|
+
get_challenge_input_public_key: obj.publicKey,
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default GetChallengeInput;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface GetChallengeOutput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
protectedChallenge: string;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const GetChallengeOutputFromJson = (obj: any): GetChallengeOutput => {
|
|
19
|
+
return {
|
|
20
|
+
protectedChallenge: obj["get_challenge_output_protected_challenge"],
|
|
21
|
+
|
|
22
|
+
} as GetChallengeOutput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const GetChallengeOutputToJson = (obj: GetChallengeOutput): any => {
|
|
26
|
+
return {
|
|
27
|
+
get_challenge_output_protected_challenge: obj.protectedChallenge,
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
export const FRAGMENT = `
|
|
35
|
+
fragment GetChallengeOutputFragment on GetChallengeOutput {
|
|
36
|
+
__typename
|
|
37
|
+
get_challenge_output_protected_challenge: protected_challenge
|
|
38
|
+
}`;
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
export default GetChallengeOutput;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import CurrencyAmount from './CurrencyAmount.js';
|
|
6
|
+
import {CurrencyAmountFromJson} from './CurrencyAmount.js';
|
|
7
|
+
import {CurrencyAmountToJson} from './CurrencyAmount.js';
|
|
8
|
+
import BitcoinNetwork from './BitcoinNetwork.js';
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
interface Invoice {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
encodedEnvoice: string;
|
|
15
|
+
|
|
16
|
+
bitcoinNetwork: BitcoinNetwork;
|
|
17
|
+
|
|
18
|
+
paymentHash: string;
|
|
19
|
+
|
|
20
|
+
amount: CurrencyAmount;
|
|
21
|
+
|
|
22
|
+
createdAt: string;
|
|
23
|
+
|
|
24
|
+
expiresAt: string;
|
|
25
|
+
|
|
26
|
+
memo?: string | undefined;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const InvoiceFromJson = (obj: any): Invoice => {
|
|
34
|
+
return {
|
|
35
|
+
encodedEnvoice: obj["invoice_encoded_envoice"],
|
|
36
|
+
bitcoinNetwork: BitcoinNetwork[obj["invoice_bitcoin_network"]] ?? BitcoinNetwork.FUTURE_VALUE,
|
|
37
|
+
paymentHash: obj["invoice_payment_hash"],
|
|
38
|
+
amount: CurrencyAmountFromJson(obj["invoice_amount"]),
|
|
39
|
+
createdAt: obj["invoice_created_at"],
|
|
40
|
+
expiresAt: obj["invoice_expires_at"],
|
|
41
|
+
memo: obj["invoice_memo"],
|
|
42
|
+
|
|
43
|
+
} as Invoice;
|
|
44
|
+
|
|
45
|
+
}
|
|
46
|
+
export const InvoiceToJson = (obj: Invoice): any => {
|
|
47
|
+
return {
|
|
48
|
+
invoice_encoded_envoice: obj.encodedEnvoice,
|
|
49
|
+
invoice_bitcoin_network: obj.bitcoinNetwork,
|
|
50
|
+
invoice_payment_hash: obj.paymentHash,
|
|
51
|
+
invoice_amount: CurrencyAmountToJson(obj.amount),
|
|
52
|
+
invoice_created_at: obj.createdAt,
|
|
53
|
+
invoice_expires_at: obj.expiresAt,
|
|
54
|
+
invoice_memo: obj.memo,
|
|
55
|
+
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export const FRAGMENT = `
|
|
62
|
+
fragment InvoiceFragment on Invoice {
|
|
63
|
+
__typename
|
|
64
|
+
invoice_encoded_envoice: encoded_envoice
|
|
65
|
+
invoice_bitcoin_network: bitcoin_network
|
|
66
|
+
invoice_payment_hash: payment_hash
|
|
67
|
+
invoice_amount: amount {
|
|
68
|
+
__typename
|
|
69
|
+
currency_amount_original_value: original_value
|
|
70
|
+
currency_amount_original_unit: original_unit
|
|
71
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
72
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
73
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
74
|
+
}
|
|
75
|
+
invoice_created_at: created_at
|
|
76
|
+
invoice_expires_at: expires_at
|
|
77
|
+
invoice_memo: memo
|
|
78
|
+
}`;
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
export default Invoice;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {CurrencyAmountToJson} from './CurrencyAmount.js';
|
|
6
|
+
import {CurrencyAmountFromJson} from './CurrencyAmount.js';
|
|
7
|
+
import CurrencyAmount from './CurrencyAmount.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
interface Leaf {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/** The amount of the leaf. **/
|
|
14
|
+
amount: CurrencyAmount;
|
|
15
|
+
|
|
16
|
+
/** The id of the leaf known at signing operators. **/
|
|
17
|
+
sparkNodeId: string;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const LeafFromJson = (obj: any): Leaf => {
|
|
25
|
+
return {
|
|
26
|
+
amount: CurrencyAmountFromJson(obj["leaf_amount"]),
|
|
27
|
+
sparkNodeId: obj["leaf_spark_node_id"],
|
|
28
|
+
|
|
29
|
+
} as Leaf;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
export const LeafToJson = (obj: Leaf): any => {
|
|
33
|
+
return {
|
|
34
|
+
leaf_amount: CurrencyAmountToJson(obj.amount),
|
|
35
|
+
leaf_spark_node_id: obj.sparkNodeId,
|
|
36
|
+
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
export const FRAGMENT = `
|
|
43
|
+
fragment LeafFragment on Leaf {
|
|
44
|
+
__typename
|
|
45
|
+
leaf_amount: amount {
|
|
46
|
+
__typename
|
|
47
|
+
currency_amount_original_value: original_value
|
|
48
|
+
currency_amount_original_unit: original_unit
|
|
49
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
50
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
51
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
52
|
+
}
|
|
53
|
+
leaf_spark_node_id: spark_node_id
|
|
54
|
+
}`;
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
export default Leaf;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
interface LeavesSwapFeeEstimateInput {
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
totalAmountSats: number;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const LeavesSwapFeeEstimateInputFromJson = (obj: any): LeavesSwapFeeEstimateInput => {
|
|
19
|
+
return {
|
|
20
|
+
totalAmountSats: obj["leaves_swap_fee_estimate_input_total_amount_sats"],
|
|
21
|
+
|
|
22
|
+
} as LeavesSwapFeeEstimateInput;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
export const LeavesSwapFeeEstimateInputToJson = (obj: LeavesSwapFeeEstimateInput): any => {
|
|
26
|
+
return {
|
|
27
|
+
leaves_swap_fee_estimate_input_total_amount_sats: obj.totalAmountSats,
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
export default LeavesSwapFeeEstimateInput;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
// Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
import {CurrencyAmountToJson} from './CurrencyAmount.js';
|
|
6
|
+
import {CurrencyAmountFromJson} from './CurrencyAmount.js';
|
|
7
|
+
import CurrencyAmount from './CurrencyAmount.js';
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
interface LeavesSwapFeeEstimateOutput {
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
feeEstimate: CurrencyAmount;
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const LeavesSwapFeeEstimateOutputFromJson = (obj: any): LeavesSwapFeeEstimateOutput => {
|
|
21
|
+
return {
|
|
22
|
+
feeEstimate: CurrencyAmountFromJson(obj["leaves_swap_fee_estimate_output_fee_estimate"]),
|
|
23
|
+
|
|
24
|
+
} as LeavesSwapFeeEstimateOutput;
|
|
25
|
+
|
|
26
|
+
}
|
|
27
|
+
export const LeavesSwapFeeEstimateOutputToJson = (obj: LeavesSwapFeeEstimateOutput): any => {
|
|
28
|
+
return {
|
|
29
|
+
leaves_swap_fee_estimate_output_fee_estimate: CurrencyAmountToJson(obj.feeEstimate),
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
export const FRAGMENT = `
|
|
37
|
+
fragment LeavesSwapFeeEstimateOutputFragment on LeavesSwapFeeEstimateOutput {
|
|
38
|
+
__typename
|
|
39
|
+
leaves_swap_fee_estimate_output_fee_estimate: fee_estimate {
|
|
40
|
+
__typename
|
|
41
|
+
currency_amount_original_value: original_value
|
|
42
|
+
currency_amount_original_unit: original_unit
|
|
43
|
+
currency_amount_preferred_currency_unit: preferred_currency_unit
|
|
44
|
+
currency_amount_preferred_currency_value_rounded: preferred_currency_value_rounded
|
|
45
|
+
currency_amount_preferred_currency_value_approx: preferred_currency_value_approx
|
|
46
|
+
}
|
|
47
|
+
}`;
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
export default LeavesSwapFeeEstimateOutput;
|