@buildonspark/spark-sdk 0.1.46 → 0.2.0
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 +26 -0
- package/dist/{chunk-BGGEVUJK.js → chunk-2ENZX6LT.js} +241 -7
- package/dist/{chunk-LHRD2WT6.js → chunk-4JD4HIAN.js} +23 -3
- package/dist/{chunk-I54FARY2.js → chunk-CDLETEDT.js} +11 -3
- package/dist/{chunk-OBFKIEMP.js → chunk-TM6CHQXC.js} +1 -1
- package/dist/chunk-UDK3EBE5.js +13514 -0
- package/dist/chunk-XYTKKLCV.js +7 -0
- package/dist/{RequestLightningSendInput-2cSh_In4.d.cts → client-DKbwpcnl.d.ts} +434 -212
- package/dist/{RequestLightningSendInput-CN6BNg_g.d.ts → client-Drs5Lapg.d.cts} +434 -212
- package/dist/{services/config.cjs → debug.cjs} +31007 -1003
- package/dist/debug.d.cts +126 -0
- package/dist/debug.d.ts +126 -0
- package/dist/debug.js +21 -0
- package/dist/graphql/objects/index.d.cts +4 -11
- package/dist/graphql/objects/index.d.ts +4 -11
- package/dist/graphql/objects/index.js +2 -4
- package/dist/index.cjs +18219 -20818
- package/dist/index.d.cts +15 -768
- package/dist/index.d.ts +15 -768
- package/dist/index.js +82 -76
- package/dist/index.node.cjs +23831 -26538
- package/dist/index.node.d.cts +191 -33
- package/dist/index.node.d.ts +191 -33
- package/dist/index.node.js +87 -181
- package/dist/native/index.cjs +17835 -20519
- package/dist/native/index.d.cts +1466 -1546
- package/dist/native/index.d.ts +1466 -1546
- package/dist/native/index.js +22605 -25286
- package/dist/proto/lrc20.d.cts +2 -2
- package/dist/proto/lrc20.d.ts +2 -2
- package/dist/proto/lrc20.js +3098 -46
- package/dist/proto/spark.cjs +241 -7
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +5 -1
- package/dist/proto/spark_token.cjs +22 -2
- package/dist/proto/spark_token.d.cts +8 -1
- package/dist/proto/spark_token.d.ts +8 -1
- package/dist/proto/spark_token.js +2 -2
- package/dist/{sdk-types-CKBsylfW.d.ts → sdk-types-DCIVdKUT.d.ts} +1 -1
- package/dist/{sdk-types-Ct8xmN7l.d.cts → sdk-types-DJ2ve9YY.d.cts} +1 -1
- package/dist/{spark-DbzGfse6.d.ts → spark-BUOx3U7Q.d.cts} +103 -5
- package/dist/{spark-DbzGfse6.d.cts → spark-BUOx3U7Q.d.ts} +103 -5
- package/dist/spark-wallet-CF8Oxjqs.d.ts +935 -0
- package/dist/spark-wallet-DOLSa3oF.d.cts +935 -0
- package/dist/spark_bindings/native/index.d.cts +1 -1
- package/dist/spark_bindings/native/index.d.ts +1 -1
- package/dist/spark_bindings/wasm/index.d.cts +1 -1
- package/dist/spark_bindings/wasm/index.d.ts +1 -1
- package/dist/{services/index.cjs → tests/test-utils.cjs} +9788 -10263
- package/dist/tests/test-utils.d.cts +79 -0
- package/dist/tests/test-utils.d.ts +79 -0
- package/dist/tests/test-utils.js +93 -0
- package/dist/types/index.cjs +239 -7
- package/dist/types/index.d.cts +5 -9
- package/dist/types/index.d.ts +5 -9
- package/dist/types/index.js +4 -6
- package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.cts} +1 -1
- package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.ts} +1 -1
- package/dist/{index-COm59SPw.d.ts → xchain-address-C2xMs9nz.d.cts} +6 -94
- package/dist/{index-CKL5DodV.d.cts → xchain-address-Ckto9oEz.d.ts} +6 -94
- package/package.json +9 -33
- package/src/debug.ts +13 -0
- package/src/graphql/client.ts +59 -20
- package/src/index.node.ts +28 -2
- package/src/index.ts +31 -1
- package/src/native/index.ts +16 -2
- package/src/proto/mock.ts +76 -0
- package/src/proto/spark.ts +354 -6
- package/src/proto/spark_token.ts +34 -2
- package/src/services/config.ts +4 -6
- package/src/services/connection.ts +131 -64
- package/src/services/coop-exit.ts +6 -3
- package/src/services/deposit.ts +9 -8
- package/src/services/lightning.ts +4 -3
- package/src/services/signing.ts +10 -6
- package/src/services/token-transactions.ts +100 -85
- package/src/services/transfer.ts +88 -60
- package/src/services/tree-creation.ts +17 -9
- package/src/services/wallet-config.ts +17 -9
- package/src/signer/signer.react-native.ts +5 -10
- package/src/signer/signer.ts +269 -339
- package/src/signer/types.ts +63 -0
- package/src/spark-wallet/spark-wallet.ts +226 -149
- package/src/spark-wallet/types.ts +22 -8
- package/src/tests/integration/adaptor-signature.test.ts +8 -9
- package/src/tests/integration/coop-exit.test.ts +214 -202
- package/src/tests/integration/lightning.test.ts +128 -103
- package/src/tests/integration/swap.test.ts +116 -84
- package/src/tests/integration/transfer.test.ts +291 -214
- package/src/tests/integration/tree-creation.test.ts +0 -5
- package/src/tests/integration/wallet.test.ts +1 -0
- package/src/tests/isHermeticTest.ts +3 -24
- package/src/tests/{test-util.ts → test-utils.ts} +13 -11
- package/src/tests/token-identifier.test.ts +6 -6
- package/src/tests/wrapWithOtelSpan.test.ts +1 -1
- package/src/{address → utils}/address.ts +1 -1
- package/src/utils/crypto.ts +19 -9
- package/src/utils/index.ts +2 -0
- package/src/utils/network.ts +17 -0
- package/src/utils/secret-sharing.ts +1 -2
- package/src/utils/signing.ts +1 -1
- package/src/utils/token-identifier.ts +27 -21
- package/src/utils/token-transaction-validation.ts +34 -0
- package/src/utils/token-transactions.ts +12 -8
- package/src/utils/unilateral-exit.ts +32 -0
- package/src/utils/xchain-address.ts +1 -1
- package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
- package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
- package/dist/address/index.cjs +0 -458
- package/dist/address/index.d.cts +0 -32
- package/dist/address/index.d.ts +0 -32
- package/dist/address/index.js +0 -17
- package/dist/chunk-4EMV7HHW.js +0 -277
- package/dist/chunk-C2S227QR.js +0 -2336
- package/dist/chunk-DXR2PXJU.js +0 -1122
- package/dist/chunk-GSI4OLXZ.js +0 -117
- package/dist/chunk-HHNQ3ZHC.js +0 -170
- package/dist/chunk-HMLOC6TE.js +0 -14
- package/dist/chunk-HSCLBJEL.js +0 -113
- package/dist/chunk-HWJWKEIU.js +0 -75
- package/dist/chunk-JB64OQES.js +0 -7095
- package/dist/chunk-KMUMFYFX.js +0 -137
- package/dist/chunk-N5VZVCGJ.js +0 -622
- package/dist/chunk-NSJF5F5O.js +0 -325
- package/dist/chunk-NTFKFRQ2.js +0 -3146
- package/dist/chunk-OFCJFZ4I.js +0 -24
- package/dist/chunk-QNNSEJ4P.js +0 -232
- package/dist/chunk-UXDODSDT.js +0 -838
- package/dist/chunk-VTUGIIWI.js +0 -0
- package/dist/chunk-Z5HIAYFT.js +0 -84
- package/dist/network-Css46DAz.d.cts +0 -46
- package/dist/network-hynb7iTZ.d.ts +0 -46
- package/dist/services/config.d.cts +0 -42
- package/dist/services/config.d.ts +0 -42
- package/dist/services/config.js +0 -17
- package/dist/services/connection.cjs +0 -17691
- package/dist/services/connection.d.cts +0 -95
- package/dist/services/connection.d.ts +0 -95
- package/dist/services/connection.js +0 -11
- package/dist/services/index.d.cts +0 -21
- package/dist/services/index.d.ts +0 -21
- package/dist/services/index.js +0 -58
- package/dist/services/lrc-connection.cjs +0 -4713
- package/dist/services/lrc-connection.d.cts +0 -34
- package/dist/services/lrc-connection.d.ts +0 -34
- package/dist/services/lrc-connection.js +0 -11
- package/dist/services/token-transactions.cjs +0 -2877
- package/dist/services/token-transactions.d.cts +0 -75
- package/dist/services/token-transactions.d.ts +0 -75
- package/dist/services/token-transactions.js +0 -15
- package/dist/services/wallet-config.cjs +0 -340
- package/dist/services/wallet-config.d.cts +0 -56
- package/dist/services/wallet-config.d.ts +0 -56
- package/dist/services/wallet-config.js +0 -33
- package/dist/signer/signer.cjs +0 -2004
- package/dist/signer/signer.d.cts +0 -10
- package/dist/signer/signer.d.ts +0 -10
- package/dist/signer/signer.js +0 -24
- package/dist/signer-BP6F__oR.d.cts +0 -187
- package/dist/signer-BVZJXcq7.d.ts +0 -187
- package/dist/utils/index.cjs +0 -2947
- package/dist/utils/index.d.cts +0 -18
- package/dist/utils/index.d.ts +0 -18
- package/dist/utils/index.js +0 -157
- package/ios/spark_frost.kt +0 -1900
- package/src/address/index.ts +0 -1
- package/src/services/lrc-connection.ts +0 -215
- /package/dist/{chunk-L3EHBOUX.js → chunk-BYXBJQAS.js} +0 -0
|
@@ -1,6 +1,222 @@
|
|
|
1
1
|
import { Query } from '@lightsparkdev/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { TokenSigner, Receipt } from '@buildonspark/lrc20-sdk';
|
|
3
|
+
import { Transaction } from '@scure/btc-signer';
|
|
4
|
+
import { Psbt } from 'bitcoinjs-lib';
|
|
5
|
+
import { HDKey } from '@scure/bip32';
|
|
6
|
+
import { b as ISigningCommitment } from './types-BADxR3bm.cjs';
|
|
7
|
+
|
|
8
|
+
type Polynomial = {
|
|
9
|
+
fieldModulus: bigint;
|
|
10
|
+
coefficients: bigint[];
|
|
11
|
+
proofs: Uint8Array[];
|
|
12
|
+
};
|
|
13
|
+
type SecretShare = {
|
|
14
|
+
fieldModulus: bigint;
|
|
15
|
+
threshold: number;
|
|
16
|
+
index: bigint;
|
|
17
|
+
share: bigint;
|
|
18
|
+
};
|
|
19
|
+
type VerifiableSecretShare = SecretShare & {
|
|
20
|
+
proofs: Uint8Array[];
|
|
21
|
+
};
|
|
22
|
+
declare function getRandomBigInt(max: bigint): bigint;
|
|
23
|
+
declare function modInverse(a: bigint, m: bigint): bigint;
|
|
24
|
+
declare function evaluatePolynomial(polynomial: Polynomial, x: bigint): bigint;
|
|
25
|
+
declare function fieldDiv(numerator: bigint, denominator: bigint, fieldModulus: bigint): bigint;
|
|
26
|
+
declare function computerLagrangeCoefficients(index: bigint, points: SecretShare[]): bigint;
|
|
27
|
+
declare function generatePolynomialForSecretSharing(fieldModulus: bigint, secret: bigint, degree: number): Polynomial;
|
|
28
|
+
declare function splitSecret(fieldModulus: bigint, secret: bigint, threshold: number, numberOfShares: number): SecretShare[];
|
|
29
|
+
declare function splitSecretWithProofs(secret: bigint, fieldModulus: bigint, threshold: number, numberOfShares: number): VerifiableSecretShare[];
|
|
30
|
+
declare function recoverSecret(shares: VerifiableSecretShare[]): bigint;
|
|
31
|
+
declare function validateShare(share: VerifiableSecretShare): void;
|
|
32
|
+
declare function bigIntToPrivateKey(value: bigint): Uint8Array;
|
|
33
|
+
|
|
34
|
+
type SigningNonce = {
|
|
35
|
+
binding: Uint8Array;
|
|
36
|
+
hiding: Uint8Array;
|
|
37
|
+
};
|
|
38
|
+
type SigningCommitment = {
|
|
39
|
+
binding: Uint8Array;
|
|
40
|
+
hiding: Uint8Array;
|
|
41
|
+
};
|
|
42
|
+
declare enum KeyDerivationType {
|
|
43
|
+
LEAF = "leaf",
|
|
44
|
+
DEPOSIT = "deposit",
|
|
45
|
+
STATIC_DEPOSIT = "static_deposit",
|
|
46
|
+
ECIES = "ecies",
|
|
47
|
+
RANDOM = "random"
|
|
48
|
+
}
|
|
49
|
+
type KeyDerivation = {
|
|
50
|
+
type: KeyDerivationType.LEAF;
|
|
51
|
+
path: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: KeyDerivationType.DEPOSIT;
|
|
54
|
+
} | {
|
|
55
|
+
type: KeyDerivationType.RANDOM;
|
|
56
|
+
} | {
|
|
57
|
+
type: KeyDerivationType.STATIC_DEPOSIT;
|
|
58
|
+
path: number;
|
|
59
|
+
} | {
|
|
60
|
+
type: KeyDerivationType.ECIES;
|
|
61
|
+
path: Uint8Array;
|
|
62
|
+
};
|
|
63
|
+
type SignFrostParams = {
|
|
64
|
+
message: Uint8Array;
|
|
65
|
+
keyDerivation: KeyDerivation;
|
|
66
|
+
publicKey: Uint8Array;
|
|
67
|
+
verifyingKey: Uint8Array;
|
|
68
|
+
selfCommitment: ISigningCommitment;
|
|
69
|
+
statechainCommitments?: {
|
|
70
|
+
[key: string]: ISigningCommitment;
|
|
71
|
+
} | undefined;
|
|
72
|
+
adaptorPubKey?: Uint8Array | undefined;
|
|
73
|
+
};
|
|
74
|
+
type AggregateFrostParams = Omit<SignFrostParams, "keyDerivation"> & {
|
|
75
|
+
selfSignature: Uint8Array;
|
|
76
|
+
statechainSignatures?: {
|
|
77
|
+
[key: string]: Uint8Array;
|
|
78
|
+
} | undefined;
|
|
79
|
+
statechainPublicKeys?: {
|
|
80
|
+
[key: string]: Uint8Array;
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
type SplitSecretWithProofsParams = {
|
|
84
|
+
secret: Uint8Array;
|
|
85
|
+
curveOrder: bigint;
|
|
86
|
+
threshold: number;
|
|
87
|
+
numShares: number;
|
|
88
|
+
};
|
|
89
|
+
type DerivedHDKey = {
|
|
90
|
+
hdKey: HDKey;
|
|
91
|
+
privateKey: Uint8Array;
|
|
92
|
+
publicKey: Uint8Array;
|
|
93
|
+
};
|
|
94
|
+
type KeyPair = {
|
|
95
|
+
privateKey: Uint8Array;
|
|
96
|
+
publicKey: Uint8Array;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
interface SparkKeysGenerator {
|
|
100
|
+
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
101
|
+
identityKey: KeyPair;
|
|
102
|
+
signingHDKey: DerivedHDKey;
|
|
103
|
+
depositKey: KeyPair;
|
|
104
|
+
staticDepositHDKey: DerivedHDKey;
|
|
105
|
+
}>;
|
|
106
|
+
}
|
|
107
|
+
declare class TaprootOutputKeysGenerator implements SparkKeysGenerator {
|
|
108
|
+
private readonly useAddressIndex;
|
|
109
|
+
constructor(useAddressIndex?: boolean);
|
|
110
|
+
deriveKeysFromSeed(seed: Uint8Array, accountNumber: number): Promise<{
|
|
111
|
+
identityKey: KeyPair;
|
|
112
|
+
signingHDKey: DerivedHDKey;
|
|
113
|
+
depositKey: KeyPair;
|
|
114
|
+
staticDepositHDKey: DerivedHDKey;
|
|
115
|
+
}>;
|
|
116
|
+
}
|
|
117
|
+
interface SparkSigner extends TokenSigner {
|
|
118
|
+
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
119
|
+
getDepositSigningKey(): Promise<Uint8Array>;
|
|
120
|
+
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
121
|
+
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
122
|
+
generateMnemonic(): Promise<string>;
|
|
123
|
+
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
124
|
+
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
125
|
+
getPublicKeyFromDerivation(keyDerivation?: KeyDerivation): Promise<Uint8Array>;
|
|
126
|
+
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
127
|
+
subtractPrivateKeysGivenDerivationPaths(first: string, second: string): Promise<Uint8Array>;
|
|
128
|
+
subtractAndSplitSecretWithProofsGivenDerivations(params: Omit<SplitSecretWithProofsParams, "secret"> & {
|
|
129
|
+
first: KeyDerivation;
|
|
130
|
+
second?: KeyDerivation | undefined;
|
|
131
|
+
}): Promise<VerifiableSecretShare[]>;
|
|
132
|
+
subtractSplitAndEncrypt(params: Omit<SplitSecretWithProofsParams, "secret"> & {
|
|
133
|
+
first: KeyDerivation;
|
|
134
|
+
second: KeyDerivation;
|
|
135
|
+
receiverPublicKey: Uint8Array;
|
|
136
|
+
}): Promise<{
|
|
137
|
+
shares: VerifiableSecretShare[];
|
|
138
|
+
secretCipher: Uint8Array;
|
|
139
|
+
}>;
|
|
140
|
+
splitSecretWithProofs(params: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
141
|
+
signFrost(params: SignFrostParams): Promise<Uint8Array>;
|
|
142
|
+
aggregateFrost(params: AggregateFrostParams): Promise<Uint8Array>;
|
|
143
|
+
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
144
|
+
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
145
|
+
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
146
|
+
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
147
|
+
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
148
|
+
getDepositSigningKey(): Promise<Uint8Array>;
|
|
149
|
+
}
|
|
150
|
+
declare class DefaultSparkSigner implements SparkSigner {
|
|
151
|
+
private identityKey;
|
|
152
|
+
private signingKey;
|
|
153
|
+
private depositKey;
|
|
154
|
+
private staticDepositKey;
|
|
155
|
+
protected commitmentToNonceMap: Map<SigningCommitment, SigningNonce>;
|
|
156
|
+
private readonly keysGenerator;
|
|
157
|
+
constructor({ sparkKeysGenerator, }?: {
|
|
158
|
+
sparkKeysGenerator?: SparkKeysGenerator;
|
|
159
|
+
});
|
|
160
|
+
private deriveSigningKey;
|
|
161
|
+
private decryptEciesToPrivateKey;
|
|
162
|
+
protected getSigningPrivateKeyFromDerivation(keyDerivation: KeyDerivation): Promise<Uint8Array>;
|
|
163
|
+
signSchnorrWithIdentityKey(message: Uint8Array): Promise<Uint8Array>;
|
|
164
|
+
getIdentityPublicKey(): Promise<Uint8Array>;
|
|
165
|
+
getDepositSigningKey(): Promise<Uint8Array>;
|
|
166
|
+
getStaticDepositSigningKey(idx: number): Promise<Uint8Array>;
|
|
167
|
+
getStaticDepositSecretKey(idx: number): Promise<Uint8Array>;
|
|
168
|
+
generateMnemonic(): Promise<string>;
|
|
169
|
+
mnemonicToSeed(mnemonic: string): Promise<Uint8Array>;
|
|
170
|
+
getPublicKeyFromDerivation(keyDerivation: KeyDerivation): Promise<Uint8Array>;
|
|
171
|
+
subtractPrivateKeysGivenDerivationPaths(first: string, second: string): Promise<Uint8Array>;
|
|
172
|
+
subtractAndSplitSecretWithProofsGivenDerivations({ first, second, curveOrder, threshold, numShares, }: Omit<SplitSecretWithProofsParams, "secret"> & {
|
|
173
|
+
first: KeyDerivation;
|
|
174
|
+
second: KeyDerivation;
|
|
175
|
+
}): Promise<VerifiableSecretShare[]>;
|
|
176
|
+
subtractSplitAndEncrypt({ first, second, curveOrder, threshold, numShares, receiverPublicKey, }: Omit<SplitSecretWithProofsParams, "secret"> & {
|
|
177
|
+
first: KeyDerivation;
|
|
178
|
+
second: KeyDerivation;
|
|
179
|
+
receiverPublicKey: Uint8Array;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
shares: VerifiableSecretShare[];
|
|
182
|
+
secretCipher: Uint8Array;
|
|
183
|
+
}>;
|
|
184
|
+
splitSecretWithProofs({ secret, curveOrder, threshold, numShares, }: SplitSecretWithProofsParams): Promise<VerifiableSecretShare[]>;
|
|
185
|
+
signFrost({ message, keyDerivation, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, }: SignFrostParams): Promise<Uint8Array>;
|
|
186
|
+
aggregateFrost({ message, publicKey, verifyingKey, selfCommitment, statechainCommitments, adaptorPubKey, selfSignature, statechainSignatures, statechainPublicKeys, }: AggregateFrostParams): Promise<Uint8Array>;
|
|
187
|
+
createSparkWalletFromSeed(seed: Uint8Array | string, accountNumber?: number): Promise<string>;
|
|
188
|
+
signMessageWithIdentityKey(message: Uint8Array, compact?: boolean): Promise<Uint8Array>;
|
|
189
|
+
decryptEcies(ciphertext: Uint8Array): Promise<Uint8Array>;
|
|
190
|
+
getRandomSigningCommitment(): Promise<SigningCommitment>;
|
|
191
|
+
validateMessageWithIdentityKey(message: Uint8Array, signature: Uint8Array): Promise<boolean>;
|
|
192
|
+
signPsbt(psbt: Psbt, input: number, sighashTypes?: number[], receipt?: Receipt): Promise<Psbt>;
|
|
193
|
+
private getReceiptPrivateKey;
|
|
194
|
+
signTransactionIndex(tx: Transaction, index: number, publicKey: Uint8Array): void;
|
|
195
|
+
}
|
|
196
|
+
declare class TaprootSparkSigner extends DefaultSparkSigner {
|
|
197
|
+
constructor(useAddressIndex?: boolean);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
interface ClaimStaticDepositOutput {
|
|
201
|
+
transferId: string;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/** This is an enum identifying a particular Bitcoin Network. **/
|
|
205
|
+
declare enum BitcoinNetwork {
|
|
206
|
+
/**
|
|
207
|
+
* This is an enum value that represents values that could be added in the future.
|
|
208
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
209
|
+
*/
|
|
210
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
211
|
+
/** The production version of the Bitcoin Blockchain. **/
|
|
212
|
+
MAINNET = "MAINNET",
|
|
213
|
+
/** A test version of the Bitcoin Blockchain, maintained by Lightspark. **/
|
|
214
|
+
REGTEST = "REGTEST",
|
|
215
|
+
/** A test version of the Bitcoin Blockchain, maintained by a centralized organization. Not in use at Lightspark. **/
|
|
216
|
+
SIGNET = "SIGNET",
|
|
217
|
+
/** A test version of the Bitcoin Blockchain, publicly available. **/
|
|
218
|
+
TESTNET = "TESTNET"
|
|
219
|
+
}
|
|
4
220
|
|
|
5
221
|
/** This enum identifies the unit of currency associated with a CurrencyAmount. **/
|
|
6
222
|
declare enum CurrencyUnit {
|
|
@@ -51,19 +267,38 @@ interface CurrencyAmount {
|
|
|
51
267
|
preferredCurrencyValueApprox: number;
|
|
52
268
|
}
|
|
53
269
|
|
|
54
|
-
|
|
55
|
-
|
|
270
|
+
declare enum ExitSpeed {
|
|
271
|
+
/**
|
|
272
|
+
* This is an enum value that represents values that could be added in the future.
|
|
273
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
274
|
+
*/
|
|
275
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
276
|
+
FAST = "FAST",
|
|
277
|
+
MEDIUM = "MEDIUM",
|
|
278
|
+
SLOW = "SLOW"
|
|
56
279
|
}
|
|
57
280
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
281
|
+
declare enum SparkCoopExitRequestStatus {
|
|
282
|
+
/**
|
|
283
|
+
* This is an enum value that represents values that could be added in the future.
|
|
284
|
+
* Clients should support unknown values as more of them could be added without notice.
|
|
285
|
+
*/
|
|
286
|
+
FUTURE_VALUE = "FUTURE_VALUE",
|
|
287
|
+
INITIATED = "INITIATED",
|
|
288
|
+
INBOUND_TRANSFER_CHECKED = "INBOUND_TRANSFER_CHECKED",
|
|
289
|
+
TX_SIGNED = "TX_SIGNED",
|
|
290
|
+
TX_BROADCASTED = "TX_BROADCASTED",
|
|
291
|
+
WAITING_ON_TX_CONFIRMATIONS = "WAITING_ON_TX_CONFIRMATIONS",
|
|
292
|
+
SUCCEEDED = "SUCCEEDED",
|
|
293
|
+
EXPIRED = "EXPIRED",
|
|
294
|
+
FAILED = "FAILED"
|
|
61
295
|
}
|
|
62
296
|
|
|
63
|
-
interface
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
297
|
+
interface Leaf {
|
|
298
|
+
/** The amount of the leaf. **/
|
|
299
|
+
amount: CurrencyAmount;
|
|
300
|
+
/** The id of the leaf known at signing operators. **/
|
|
301
|
+
sparkNodeId: string;
|
|
67
302
|
}
|
|
68
303
|
|
|
69
304
|
/** This is an object representing information about a page returned by the Lightspark API. For more information, please see the “Pagination” section of our API docs for more information about its usage. **/
|
|
@@ -74,6 +309,94 @@ interface PageInfo {
|
|
|
74
309
|
endCursor?: string | undefined;
|
|
75
310
|
}
|
|
76
311
|
|
|
312
|
+
interface SparkTransferToLeavesConnection {
|
|
313
|
+
/**
|
|
314
|
+
* The total count of objects in this connection, using the current filters. It is different from the
|
|
315
|
+
* number of objects returned in the current page (in the `entities` field).
|
|
316
|
+
**/
|
|
317
|
+
count: number;
|
|
318
|
+
/** An object that holds pagination information about the objects in this connection. **/
|
|
319
|
+
pageInfo: PageInfo;
|
|
320
|
+
/** The leaves for the current page of this connection. **/
|
|
321
|
+
entities: Leaf[];
|
|
322
|
+
/** The typename of the object **/
|
|
323
|
+
typename: string;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
declare class Transfer {
|
|
327
|
+
/** The total amount of the transfer. **/
|
|
328
|
+
readonly totalAmount: CurrencyAmount;
|
|
329
|
+
/** The id of the transfer known at signing operators. If not set, the transfer hasn't been
|
|
330
|
+
* initialized. **/
|
|
331
|
+
readonly sparkId?: string | undefined;
|
|
332
|
+
/** The user request this transfer belongs to, if there is any **/
|
|
333
|
+
readonly userRequestId?: string | undefined;
|
|
334
|
+
constructor(
|
|
335
|
+
/** The total amount of the transfer. **/
|
|
336
|
+
totalAmount: CurrencyAmount,
|
|
337
|
+
/** The id of the transfer known at signing operators. If not set, the transfer hasn't been
|
|
338
|
+
* initialized. **/
|
|
339
|
+
sparkId?: string | undefined,
|
|
340
|
+
/** The user request this transfer belongs to, if there is any **/
|
|
341
|
+
userRequestId?: string | undefined);
|
|
342
|
+
getLeaves(client: SspClient, first?: number | undefined, after?: string | undefined): Promise<SparkTransferToLeavesConnection>;
|
|
343
|
+
toJson(): {
|
|
344
|
+
transfer_total_amount: any;
|
|
345
|
+
transfer_spark_id: string | undefined;
|
|
346
|
+
transfer_user_request: {
|
|
347
|
+
id: string | undefined;
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
interface CoopExitRequest {
|
|
353
|
+
/**
|
|
354
|
+
* The unique identifier of this entity across all Lightspark systems. Should be treated as an opaque
|
|
355
|
+
* string.
|
|
356
|
+
**/
|
|
357
|
+
id: string;
|
|
358
|
+
/** The date and time when the entity was first created. **/
|
|
359
|
+
createdAt: string;
|
|
360
|
+
/** The date and time when the entity was last updated. **/
|
|
361
|
+
updatedAt: string;
|
|
362
|
+
/** The network the lightning send request is on. **/
|
|
363
|
+
network: BitcoinNetwork;
|
|
364
|
+
/** The fee user pays for the coop exit not including the L1 broadcast fee. **/
|
|
365
|
+
fee: CurrencyAmount;
|
|
366
|
+
/** The L1 broadcast fee user pays for the coop exit. **/
|
|
367
|
+
l1BroadcastFee: CurrencyAmount;
|
|
368
|
+
/** The status of this coop exit request. **/
|
|
369
|
+
status: SparkCoopExitRequestStatus;
|
|
370
|
+
/** The time when the coop exit request expires and the UTXOs are released. **/
|
|
371
|
+
expiresAt: string;
|
|
372
|
+
/** The raw connector transaction. **/
|
|
373
|
+
rawConnectorTransaction: string;
|
|
374
|
+
/** The raw coop exit L1 transaction. **/
|
|
375
|
+
rawCoopExitTransaction: string;
|
|
376
|
+
/** The transaction id of the coop exit transaction. **/
|
|
377
|
+
coopExitTxid: string;
|
|
378
|
+
/** The typename of the object **/
|
|
379
|
+
typename: string;
|
|
380
|
+
/** The fee quote user requested for this coop exit. **/
|
|
381
|
+
feeQuoteId?: string | undefined;
|
|
382
|
+
/** The exit speed user requested for this coop exit. **/
|
|
383
|
+
exitSpeed?: ExitSpeed | undefined;
|
|
384
|
+
/** The swap transfer. **/
|
|
385
|
+
transfer?: Transfer | undefined;
|
|
386
|
+
}
|
|
387
|
+
declare const getCoopExitRequestQuery: (id: string) => Query<CoopExitRequest>;
|
|
388
|
+
|
|
389
|
+
interface CompleteCoopExitInput {
|
|
390
|
+
userOutboundTransferExternalId: string;
|
|
391
|
+
coopExitRequestId: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
interface CompleteLeavesSwapInput {
|
|
395
|
+
adaptorSecretKey: string;
|
|
396
|
+
userOutboundTransferExternalId: string;
|
|
397
|
+
leavesSwapRequestId: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
77
400
|
interface CoopExitFeeEstimate {
|
|
78
401
|
userFee: CurrencyAmount;
|
|
79
402
|
l1BroadcastFee: CurrencyAmount;
|
|
@@ -128,31 +451,22 @@ interface CoopExitFeeQuoteInput {
|
|
|
128
451
|
withdrawalAddress: string;
|
|
129
452
|
}
|
|
130
453
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
* This is an enum value that represents values that could be added in the future.
|
|
134
|
-
* Clients should support unknown values as more of them could be added without notice.
|
|
135
|
-
*/
|
|
136
|
-
FUTURE_VALUE = "FUTURE_VALUE",
|
|
137
|
-
FAST = "FAST",
|
|
138
|
-
MEDIUM = "MEDIUM",
|
|
139
|
-
SLOW = "SLOW"
|
|
454
|
+
interface GetChallengeOutput {
|
|
455
|
+
protectedChallenge: string;
|
|
140
456
|
}
|
|
141
457
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
EXPIRED = "EXPIRED",
|
|
155
|
-
FAILED = "FAILED"
|
|
458
|
+
interface Invoice {
|
|
459
|
+
encodedInvoice: string;
|
|
460
|
+
bitcoinNetwork: BitcoinNetwork;
|
|
461
|
+
paymentHash: string;
|
|
462
|
+
amount: CurrencyAmount;
|
|
463
|
+
createdAt: string;
|
|
464
|
+
expiresAt: string;
|
|
465
|
+
memo?: string | undefined;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
interface LeavesSwapFeeEstimateOutput {
|
|
469
|
+
feeEstimate: CurrencyAmount;
|
|
156
470
|
}
|
|
157
471
|
|
|
158
472
|
declare enum SparkLeavesSwapRequestStatus {
|
|
@@ -210,16 +524,6 @@ interface LeavesSwapRequest {
|
|
|
210
524
|
}
|
|
211
525
|
declare const getLeavesSwapRequestQuery: (id: string) => Query<LeavesSwapRequest>;
|
|
212
526
|
|
|
213
|
-
interface Invoice {
|
|
214
|
-
encodedInvoice: string;
|
|
215
|
-
bitcoinNetwork: BitcoinNetwork;
|
|
216
|
-
paymentHash: string;
|
|
217
|
-
amount: CurrencyAmount;
|
|
218
|
-
createdAt: string;
|
|
219
|
-
expiresAt: string;
|
|
220
|
-
memo?: string | undefined;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
527
|
declare enum LightningReceiveRequestStatus {
|
|
224
528
|
/**
|
|
225
529
|
* This is an enum value that represents values that could be added in the future.
|
|
@@ -265,176 +569,16 @@ interface LightningReceiveRequest {
|
|
|
265
569
|
}
|
|
266
570
|
declare const getLightningReceiveRequestQuery: (id: string) => Query<LightningReceiveRequest>;
|
|
267
571
|
|
|
268
|
-
interface
|
|
269
|
-
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
interface StaticDepositQuoteInput {
|
|
273
|
-
/** The transaction id of the deposit. **/
|
|
274
|
-
transactionId: string;
|
|
275
|
-
/** The output index of the deposit. **/
|
|
276
|
-
outputIndex: number;
|
|
277
|
-
/** The bitcoin network of the deposit. **/
|
|
278
|
-
network: BitcoinNetwork;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
interface StaticDepositQuoteOutput {
|
|
282
|
-
/** The transaction id of the deposit. **/
|
|
283
|
-
transactionId: string;
|
|
284
|
-
/** The output index of the deposit. **/
|
|
285
|
-
outputIndex: number;
|
|
286
|
-
/** The bitcoin network of the deposit. **/
|
|
287
|
-
network: BitcoinNetwork;
|
|
288
|
-
/** The amount of sats that will be credited to the user's balance. **/
|
|
289
|
-
creditAmountSats: number;
|
|
290
|
-
/** The signature of the quote. **/
|
|
291
|
-
signature: string;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
interface VerifyChallengeOutput {
|
|
295
|
-
validUntil: string;
|
|
296
|
-
sessionToken: string;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
interface SspClientOptions {
|
|
300
|
-
baseUrl: string;
|
|
301
|
-
identityPublicKey: string;
|
|
302
|
-
schemaEndpoint?: string;
|
|
303
|
-
}
|
|
304
|
-
interface MayHaveSspClientOptions {
|
|
305
|
-
readonly sspClientOptions?: SspClientOptions;
|
|
306
|
-
}
|
|
307
|
-
interface HasSspClientOptions {
|
|
308
|
-
readonly sspClientOptions: SspClientOptions;
|
|
309
|
-
}
|
|
310
|
-
declare class SspClient {
|
|
311
|
-
private readonly requester;
|
|
312
|
-
private readonly signer;
|
|
313
|
-
private readonly authProvider;
|
|
314
|
-
constructor(config: HasSspClientOptions & {
|
|
315
|
-
signer: SparkSigner;
|
|
316
|
-
});
|
|
317
|
-
executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
|
|
318
|
-
getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
|
|
319
|
-
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
320
|
-
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
321
|
-
getCurrentUser(): Promise<void>;
|
|
322
|
-
completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
323
|
-
requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
324
|
-
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
325
|
-
requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
326
|
-
requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
327
|
-
completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
328
|
-
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
329
|
-
getLightningSendRequest(id: string): Promise<LightningSendRequest | null>;
|
|
330
|
-
getLeaveSwapRequest(id: string): Promise<LeavesSwapRequest | null>;
|
|
331
|
-
getCoopExitRequest(id: string): Promise<CoopExitRequest | null>;
|
|
332
|
-
getClaimDepositQuote({ transactionId, outputIndex, network, }: StaticDepositQuoteInput): Promise<StaticDepositQuoteOutput | null>;
|
|
333
|
-
claimStaticDeposit({ transactionId, outputIndex, network, creditAmountSats, depositSecretKey, signature, sspSignature, }: {
|
|
334
|
-
transactionId: string;
|
|
335
|
-
outputIndex: number;
|
|
336
|
-
network: BitcoinNetwork;
|
|
337
|
-
creditAmountSats: number;
|
|
338
|
-
depositSecretKey: string;
|
|
339
|
-
signature: string;
|
|
340
|
-
sspSignature: string;
|
|
341
|
-
}): Promise<ClaimStaticDepositOutput | null>;
|
|
342
|
-
getTransfer(id: string): Promise<Transfer | null>;
|
|
343
|
-
getChallenge(): Promise<GetChallengeOutput | null>;
|
|
344
|
-
verifyChallenge(signature: string, protectedChallenge: string): Promise<VerifyChallengeOutput | null>;
|
|
345
|
-
authenticate(): Promise<void>;
|
|
346
|
-
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
interface Leaf {
|
|
350
|
-
/** The amount of the leaf. **/
|
|
351
|
-
amount: CurrencyAmount;
|
|
352
|
-
/** The id of the leaf known at signing operators. **/
|
|
353
|
-
sparkNodeId: string;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
interface SparkTransferToLeavesConnection {
|
|
357
|
-
/**
|
|
358
|
-
* The total count of objects in this connection, using the current filters. It is different from the
|
|
359
|
-
* number of objects returned in the current page (in the `entities` field).
|
|
360
|
-
**/
|
|
361
|
-
count: number;
|
|
362
|
-
/** An object that holds pagination information about the objects in this connection. **/
|
|
363
|
-
pageInfo: PageInfo;
|
|
364
|
-
/** The leaves for the current page of this connection. **/
|
|
365
|
-
entities: Leaf[];
|
|
366
|
-
/** The typename of the object **/
|
|
367
|
-
typename: string;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
declare class Transfer {
|
|
371
|
-
/** The total amount of the transfer. **/
|
|
372
|
-
readonly totalAmount: CurrencyAmount;
|
|
373
|
-
/** The id of the transfer known at signing operators. If not set, the transfer hasn't been
|
|
374
|
-
* initialized. **/
|
|
375
|
-
readonly sparkId?: string | undefined;
|
|
376
|
-
/** The user request this transfer belongs to, if there is any **/
|
|
377
|
-
readonly userRequestId?: string | undefined;
|
|
378
|
-
constructor(
|
|
379
|
-
/** The total amount of the transfer. **/
|
|
380
|
-
totalAmount: CurrencyAmount,
|
|
381
|
-
/** The id of the transfer known at signing operators. If not set, the transfer hasn't been
|
|
382
|
-
* initialized. **/
|
|
383
|
-
sparkId?: string | undefined,
|
|
384
|
-
/** The user request this transfer belongs to, if there is any **/
|
|
385
|
-
userRequestId?: string | undefined);
|
|
386
|
-
getLeaves(client: SspClient, first?: number | undefined, after?: string | undefined): Promise<SparkTransferToLeavesConnection>;
|
|
387
|
-
toJson(): {
|
|
388
|
-
transfer_total_amount: any;
|
|
389
|
-
transfer_spark_id: string | undefined;
|
|
390
|
-
transfer_user_request: {
|
|
391
|
-
id: string | undefined;
|
|
392
|
-
};
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
interface CoopExitRequest {
|
|
572
|
+
interface LightningSendFeeEstimateInput {
|
|
573
|
+
encodedInvoice: string;
|
|
397
574
|
/**
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
/** The date and time when the entity was first created. **/
|
|
403
|
-
createdAt: string;
|
|
404
|
-
/** The date and time when the entity was last updated. **/
|
|
405
|
-
updatedAt: string;
|
|
406
|
-
/** The network the lightning send request is on. **/
|
|
407
|
-
network: BitcoinNetwork;
|
|
408
|
-
/** The fee user pays for the coop exit not including the L1 broadcast fee. **/
|
|
409
|
-
fee: CurrencyAmount;
|
|
410
|
-
/** The L1 broadcast fee user pays for the coop exit. **/
|
|
411
|
-
l1BroadcastFee: CurrencyAmount;
|
|
412
|
-
/** The status of this coop exit request. **/
|
|
413
|
-
status: SparkCoopExitRequestStatus;
|
|
414
|
-
/** The time when the coop exit request expires and the UTXOs are released. **/
|
|
415
|
-
expiresAt: string;
|
|
416
|
-
/** The raw connector transaction. **/
|
|
417
|
-
rawConnectorTransaction: string;
|
|
418
|
-
/** The raw coop exit L1 transaction. **/
|
|
419
|
-
rawCoopExitTransaction: string;
|
|
420
|
-
/** The transaction id of the coop exit transaction. **/
|
|
421
|
-
coopExitTxid: string;
|
|
422
|
-
/** The typename of the object **/
|
|
423
|
-
typename: string;
|
|
424
|
-
/** The fee quote user requested for this coop exit. **/
|
|
425
|
-
feeQuoteId?: string | undefined;
|
|
426
|
-
/** The exit speed user requested for this coop exit. **/
|
|
427
|
-
exitSpeed?: ExitSpeed | undefined;
|
|
428
|
-
/** The swap transfer. **/
|
|
429
|
-
transfer?: Transfer | undefined;
|
|
430
|
-
}
|
|
431
|
-
declare const getCoopExitRequestQuery: (id: string) => Query<CoopExitRequest>;
|
|
432
|
-
|
|
433
|
-
interface GetChallengeOutput {
|
|
434
|
-
protectedChallenge: string;
|
|
575
|
+
* The amount you will pay for this invoice in sats. It should ONLY be set when the invoice amount is
|
|
576
|
+
* zero.
|
|
577
|
+
**/
|
|
578
|
+
amountSats?: number | undefined;
|
|
435
579
|
}
|
|
436
580
|
|
|
437
|
-
interface
|
|
581
|
+
interface LightningSendFeeEstimateOutput {
|
|
438
582
|
feeEstimate: CurrencyAmount;
|
|
439
583
|
}
|
|
440
584
|
|
|
@@ -551,4 +695,82 @@ interface RequestLightningSendInput {
|
|
|
551
695
|
amountSats?: number | undefined;
|
|
552
696
|
}
|
|
553
697
|
|
|
554
|
-
|
|
698
|
+
interface StaticDepositQuoteInput {
|
|
699
|
+
/** The transaction id of the deposit. **/
|
|
700
|
+
transactionId: string;
|
|
701
|
+
/** The output index of the deposit. **/
|
|
702
|
+
outputIndex: number;
|
|
703
|
+
/** The bitcoin network of the deposit. **/
|
|
704
|
+
network: BitcoinNetwork;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
interface StaticDepositQuoteOutput {
|
|
708
|
+
/** The transaction id of the deposit. **/
|
|
709
|
+
transactionId: string;
|
|
710
|
+
/** The output index of the deposit. **/
|
|
711
|
+
outputIndex: number;
|
|
712
|
+
/** The bitcoin network of the deposit. **/
|
|
713
|
+
network: BitcoinNetwork;
|
|
714
|
+
/** The amount of sats that will be credited to the user's balance. **/
|
|
715
|
+
creditAmountSats: number;
|
|
716
|
+
/** The signature of the quote. **/
|
|
717
|
+
signature: string;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
interface VerifyChallengeOutput {
|
|
721
|
+
validUntil: string;
|
|
722
|
+
sessionToken: string;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
interface SspClientOptions {
|
|
726
|
+
baseUrl: string;
|
|
727
|
+
identityPublicKey: string;
|
|
728
|
+
schemaEndpoint?: string;
|
|
729
|
+
}
|
|
730
|
+
interface MayHaveSspClientOptions {
|
|
731
|
+
readonly sspClientOptions?: SspClientOptions;
|
|
732
|
+
}
|
|
733
|
+
interface HasSspClientOptions {
|
|
734
|
+
readonly sspClientOptions: SspClientOptions;
|
|
735
|
+
}
|
|
736
|
+
declare class SspClient {
|
|
737
|
+
private readonly requester;
|
|
738
|
+
private readonly signer;
|
|
739
|
+
private readonly authProvider;
|
|
740
|
+
private authPromise?;
|
|
741
|
+
constructor(config: HasSspClientOptions & {
|
|
742
|
+
signer: SparkSigner;
|
|
743
|
+
});
|
|
744
|
+
executeRawQuery<T>(query: Query<T>, needsAuth?: boolean): Promise<T | null>;
|
|
745
|
+
getSwapFeeEstimate(amountSats: number): Promise<LeavesSwapFeeEstimateOutput | null>;
|
|
746
|
+
getLightningSendFeeEstimate(encodedInvoice: string, amountSats?: number): Promise<LightningSendFeeEstimateOutput | null>;
|
|
747
|
+
getCoopExitFeeEstimate({ leafExternalIds, withdrawalAddress, }: CoopExitFeeEstimatesInput): Promise<CoopExitFeeEstimatesOutput | null>;
|
|
748
|
+
getCurrentUser(): Promise<void>;
|
|
749
|
+
completeCoopExit({ userOutboundTransferExternalId, coopExitRequestId, }: CompleteCoopExitInput): Promise<CoopExitRequest | null>;
|
|
750
|
+
requestCoopExit({ leafExternalIds, withdrawalAddress, idempotencyKey, exitSpeed, feeLeafExternalIds, feeQuoteId, withdrawAll, }: RequestCoopExitInput): Promise<CoopExitRequest | null>;
|
|
751
|
+
requestLightningReceive({ amountSats, network, paymentHash, expirySecs, memo, includeSparkAddress, receiverIdentityPubkey, descriptionHash, }: RequestLightningReceiveInput): Promise<LightningReceiveRequest | null>;
|
|
752
|
+
requestLightningSend({ encodedInvoice, idempotencyKey, amountSats, }: RequestLightningSendInput): Promise<LightningSendRequest | null>;
|
|
753
|
+
requestLeaveSwap({ adaptorPubkey, totalAmountSats, targetAmountSats, feeSats, userLeaves, idempotencyKey, targetAmountSatsList, }: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
754
|
+
completeLeaveSwap({ adaptorSecretKey, userOutboundTransferExternalId, leavesSwapRequestId, }: CompleteLeavesSwapInput): Promise<LeavesSwapRequest | null>;
|
|
755
|
+
getLightningReceiveRequest(id: string): Promise<LightningReceiveRequest | null>;
|
|
756
|
+
getLightningSendRequest(id: string): Promise<LightningSendRequest | null>;
|
|
757
|
+
getLeaveSwapRequest(id: string): Promise<LeavesSwapRequest | null>;
|
|
758
|
+
getCoopExitRequest(id: string): Promise<CoopExitRequest | null>;
|
|
759
|
+
getClaimDepositQuote({ transactionId, outputIndex, network, }: StaticDepositQuoteInput): Promise<StaticDepositQuoteOutput | null>;
|
|
760
|
+
claimStaticDeposit({ transactionId, outputIndex, network, creditAmountSats, depositSecretKey, signature, sspSignature, }: {
|
|
761
|
+
transactionId: string;
|
|
762
|
+
outputIndex: number;
|
|
763
|
+
network: BitcoinNetwork;
|
|
764
|
+
creditAmountSats: number;
|
|
765
|
+
depositSecretKey: string;
|
|
766
|
+
signature: string;
|
|
767
|
+
sspSignature: string;
|
|
768
|
+
}): Promise<ClaimStaticDepositOutput | null>;
|
|
769
|
+
getTransfer(id: string): Promise<Transfer | null>;
|
|
770
|
+
getChallenge(): Promise<GetChallengeOutput | null>;
|
|
771
|
+
verifyChallenge(signature: string, protectedChallenge: string): Promise<VerifyChallengeOutput | null>;
|
|
772
|
+
authenticate(): Promise<void>;
|
|
773
|
+
getCoopExitFeeQuote({ leafExternalIds, withdrawalAddress, }: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null>;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export { splitSecretWithProofs as $, SparkLeavesSwapRequestStatus as A, BitcoinNetwork as B, type ClaimStaticDepositOutput as C, type SparkTransferToLeavesConnection as D, ExitSpeed as E, type StaticDepositQuoteInput as F, type GetChallengeOutput as G, type StaticDepositQuoteOutput as H, type Invoice as I, type SwapLeaf as J, type VerifiableSecretShare as K, type Leaf as L, bigIntToPrivateKey as M, computerLagrangeCoefficients as N, evaluatePolynomial as O, type PageInfo as P, fieldDiv as Q, type RequestCoopExitInput as R, SparkCoopExitRequestStatus as S, Transfer as T, type UserLeafInput as U, type VerifyChallengeOutput as V, generatePolynomialForSecretSharing as W, getRandomBigInt as X, modInverse as Y, recoverSecret as Z, splitSecret as _, type CompleteCoopExitInput as a, validateShare as a0, type SparkSigner as a1, type MayHaveSspClientOptions as a2, type SspClientOptions as a3, type HasSspClientOptions as a4, type KeyDerivation as a5, type SigningCommitment as a6, type SigningNonce as a7, SspClient as a8, DefaultSparkSigner as a9, TaprootSparkSigner as aa, TaprootOutputKeysGenerator as ab, KeyDerivationType as ac, type SignFrostParams as ad, type AggregateFrostParams as ae, type SplitSecretWithProofsParams as af, type DerivedHDKey as ag, type KeyPair as ah, type CompleteLeavesSwapInput as b, type CoopExitFeeEstimate as c, type CoopExitFeeEstimatesInput as d, type CoopExitFeeEstimatesOutput as e, type CoopExitFeeQuote as f, getCoopExitFeeQuoteQuery as g, type CoopExitFeeQuoteInput as h, type CoopExitRequest as i, getCoopExitRequestQuery as j, type CurrencyAmount as k, CurrencyUnit as l, type LeavesSwapFeeEstimateOutput as m, getLeavesSwapRequestQuery as n, type LeavesSwapRequest as o, getLightningReceiveRequestQuery as p, type LightningReceiveRequest as q, LightningReceiveRequestStatus as r, type LightningSendFeeEstimateInput as s, type LightningSendFeeEstimateOutput as t, getLightningSendRequestQuery as u, type LightningSendRequest as v, LightningSendRequestStatus as w, type RequestLeavesSwapInput as x, type RequestLightningReceiveInput as y, type RequestLightningSendInput as z };
|