@buildonspark/spark-sdk 0.1.43 → 0.1.45
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 +16 -0
- package/dist/{RequestLightningSendInput-D7fZdT4A.d.ts → RequestLightningSendInput-DEPd_fPO.d.ts} +43 -4
- package/dist/{RequestLightningSendInput-Na1mHdWg.d.cts → RequestLightningSendInput-Du0z7Om7.d.cts} +43 -4
- package/dist/address/index.cjs +2 -2
- package/dist/address/index.d.cts +2 -2
- package/dist/address/index.d.ts +2 -2
- package/dist/address/index.js +2 -2
- package/dist/{chunk-IRW5TWMH.js → chunk-5FUB65LX.js} +7 -9
- package/dist/{chunk-BUTZWYBW.js → chunk-6264CGDM.js} +4 -4
- package/dist/{chunk-VFJQNBFX.js → chunk-7V6N75CC.js} +5 -2
- package/dist/{chunk-M6A4KFIG.js → chunk-BGGEVUJK.js} +1505 -445
- package/dist/{chunk-DQYKQJRZ.js → chunk-C2S227QR.js} +675 -52
- package/dist/{chunk-GYQR4B4P.js → chunk-GZ5IPPJ2.js} +2 -2
- package/dist/{chunk-6AFUC5M2.js → chunk-HWJWKEIU.js} +8 -2
- package/dist/{chunk-TOSP3INR.js → chunk-I54FARY2.js} +4 -2
- package/dist/{chunk-WWOTVNPP.js → chunk-J2IE4Z7Y.js} +544 -431
- package/dist/{chunk-O4RYNJNB.js → chunk-KMUMFYFX.js} +3 -3
- package/dist/chunk-LHRD2WT6.js +2374 -0
- package/dist/{chunk-ABZA6R5S.js → chunk-NTFKFRQ2.js} +1 -1
- package/dist/{chunk-MIVX3GHD.js → chunk-OBFKIEMP.js} +1 -1
- package/dist/{chunk-HRQRRDSS.js → chunk-PQN3C2MF.js} +15 -15
- package/dist/{chunk-DOA6QXYQ.js → chunk-R5PXJZQS.js} +3 -1
- package/dist/{chunk-TIUBYNN5.js → chunk-YUPMXTCJ.js} +4 -4
- package/dist/graphql/objects/index.d.cts +6 -43
- package/dist/graphql/objects/index.d.ts +6 -43
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index-B2AwKW5J.d.cts +214 -0
- package/dist/index-CJDi1HWc.d.ts +214 -0
- package/dist/index.cjs +4150 -1026
- package/dist/index.d.cts +764 -19
- package/dist/index.d.ts +764 -19
- package/dist/index.js +17 -21
- package/dist/index.node.cjs +4153 -1033
- package/dist/index.node.d.cts +10 -8
- package/dist/index.node.d.ts +10 -8
- package/dist/index.node.js +20 -28
- package/dist/native/index.cjs +4166 -1042
- package/dist/native/index.d.cts +369 -108
- package/dist/native/index.d.ts +369 -108
- package/dist/native/index.js +4138 -1015
- package/dist/{network-xkBSpaTn.d.ts → network-BTJl-Sul.d.ts} +1 -1
- package/dist/{network-D5lKssVl.d.cts → network-CqgsdUF2.d.cts} +1 -1
- package/dist/proto/lrc20.cjs +222 -19
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/lrc20.js +2 -2
- package/dist/proto/spark.cjs +1502 -442
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +5 -5
- package/dist/proto/spark_token.cjs +1515 -56
- package/dist/proto/spark_token.d.cts +153 -15
- package/dist/proto/spark_token.d.ts +153 -15
- package/dist/proto/spark_token.js +40 -4
- package/dist/{sdk-types-B-q9py_P.d.cts → sdk-types-B0SwjolI.d.cts} +1 -1
- package/dist/{sdk-types-BPoPgzda.d.ts → sdk-types-Cc4l4kb1.d.ts} +1 -1
- package/dist/services/config.cjs +7 -3
- package/dist/services/config.d.cts +5 -4
- package/dist/services/config.d.ts +5 -4
- package/dist/services/config.js +6 -6
- package/dist/services/connection.cjs +2938 -646
- package/dist/services/connection.d.cts +5 -4
- package/dist/services/connection.d.ts +5 -4
- package/dist/services/connection.js +4 -4
- package/dist/services/index.cjs +6381 -3461
- package/dist/services/index.d.cts +7 -6
- package/dist/services/index.d.ts +7 -6
- package/dist/services/index.js +15 -13
- package/dist/services/lrc-connection.cjs +227 -21
- package/dist/services/lrc-connection.d.cts +5 -4
- package/dist/services/lrc-connection.d.ts +5 -4
- package/dist/services/lrc-connection.js +4 -4
- package/dist/services/token-transactions.cjs +868 -244
- package/dist/services/token-transactions.d.cts +25 -7
- package/dist/services/token-transactions.d.ts +25 -7
- package/dist/services/token-transactions.js +5 -4
- package/dist/services/wallet-config.cjs +4 -1
- package/dist/services/wallet-config.d.cts +7 -5
- package/dist/services/wallet-config.d.ts +7 -5
- package/dist/services/wallet-config.js +3 -1
- package/dist/signer/signer.cjs +5 -2
- package/dist/signer/signer.d.cts +3 -2
- package/dist/signer/signer.d.ts +3 -2
- package/dist/signer/signer.js +2 -2
- package/dist/{signer-wqesWifN.d.ts → signer-BocS_J6B.d.ts} +2 -6
- package/dist/{signer-IO3oMRNj.d.cts → signer-DKS0AJkw.d.cts} +2 -6
- package/dist/{spark-CDm4gqS6.d.cts → spark-dM7EYXYQ.d.cts} +138 -42
- package/dist/{spark-CDm4gqS6.d.ts → spark-dM7EYXYQ.d.ts} +138 -42
- package/dist/spark_bindings/native/index.cjs +183 -0
- package/dist/spark_bindings/native/index.d.cts +14 -0
- package/dist/spark_bindings/native/index.d.ts +14 -0
- package/dist/spark_bindings/native/index.js +141 -0
- package/dist/spark_bindings/wasm/index.cjs +1093 -0
- package/dist/spark_bindings/wasm/index.d.cts +47 -0
- package/dist/spark_bindings/wasm/index.d.ts +47 -0
- package/dist/{chunk-K4C4W5FC.js → spark_bindings/wasm/index.js} +7 -6
- package/dist/types/index.cjs +1503 -443
- package/dist/types/index.d.cts +6 -5
- package/dist/types/index.d.ts +6 -5
- package/dist/types/index.js +3 -3
- package/dist/types-C-Rp0Oo7.d.cts +46 -0
- package/dist/types-C-Rp0Oo7.d.ts +46 -0
- package/dist/utils/index.cjs +358 -36
- package/dist/utils/index.d.cts +14 -134
- package/dist/utils/index.d.ts +14 -134
- package/dist/utils/index.js +8 -8
- package/package.json +21 -1
- package/src/constants.ts +5 -1
- package/src/graphql/client.ts +28 -0
- package/src/graphql/mutations/RequestCoopExit.ts +6 -0
- package/src/graphql/mutations/RequestSwapLeaves.ts +2 -0
- package/src/graphql/queries/GetCoopExitFeeQuote.ts +20 -0
- package/src/index.node.ts +0 -1
- package/src/index.ts +0 -1
- package/src/native/index.ts +1 -2
- package/src/proto/common.ts +5 -5
- package/src/proto/google/protobuf/descriptor.ts +34 -34
- package/src/proto/google/protobuf/duration.ts +2 -2
- package/src/proto/google/protobuf/empty.ts +2 -2
- package/src/proto/google/protobuf/timestamp.ts +2 -2
- package/src/proto/mock.ts +4 -4
- package/src/proto/spark.ts +1924 -525
- package/src/proto/spark_authn.ts +7 -7
- package/src/proto/spark_token.ts +1668 -105
- package/src/proto/validate/validate.ts +24 -24
- package/src/services/bolt11-spark.ts +62 -187
- package/src/services/coop-exit.ts +3 -0
- package/src/services/lrc20.ts +1 -1
- package/src/services/token-transactions.ts +209 -9
- package/src/services/transfer.ts +22 -3
- package/src/services/tree-creation.ts +13 -0
- package/src/services/wallet-config.ts +2 -1
- package/src/spark-wallet/spark-wallet.node.ts +3 -7
- package/src/spark-wallet/spark-wallet.ts +376 -232
- package/src/spark-wallet/types.ts +39 -3
- package/src/tests/bolt11-spark.test.ts +7 -15
- package/src/tests/integration/deposit.test.ts +16 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +85 -21
- package/src/tests/integration/ssp/swap.test.ts +47 -0
- package/src/tests/integration/swap.test.ts +453 -433
- package/src/tests/integration/transfer.test.ts +261 -248
- package/src/tests/token-identifier.test.ts +54 -0
- package/src/tests/tokens.test.ts +218 -22
- package/src/utils/token-hashing.ts +346 -52
- package/src/utils/token-identifier.ts +88 -0
- package/src/utils/token-transaction-validation.ts +350 -5
- package/src/utils/token-transactions.ts +12 -8
- package/src/utils/transaction.ts +2 -8
- package/dist/chunk-VA7MV4MZ.js +0 -1073
- package/dist/index-7RYRH5wc.d.ts +0 -815
- package/dist/index-BJOc8Ur-.d.cts +0 -815
- package/dist/wasm-7OWFHDMS.js +0 -21
- package/src/logger.ts +0 -3
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,138 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
export { a6 as BroadcastConfig, a7 as BroadcastResult, U as DEFAULT_FEE_SATS, a4 as FeeBumpTxChain, a3 as FeeBumpTxPackage, a2 as FeeRate, a0 as LeafInfo, a5 as TxChain, a1 as Utxo, t as addPrivateKeys, q as addPublicKeys, e as applyAdaptorToSignature, r as applyAdditiveTweakToPublicKey, N as calculateAvailableTokenAmount, O as checkIfSelectedOutputsAreAvailable, Z as checkIfValidSequence, B as collectResponses, f as computeTaprootKeyNoScript, ab as constructFeeBumpTx, aa as constructUnilateralExitFeeBumpPackages, a9 as constructUnilateralExitTxs, W as createRefundTx, K as createSigningCommitment, F as createSigningNonce, M as decodeBytesToSigningCommitment, J as decodeBytesToSigningNonce, L as encodeSigningCommitmentToBytes, H as encodeSigningNonceToBytes, Q as filterTokenBalanceForTokenPublicKey, d as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, X as getCurrentTimelock, $ as getEphemeralAnchorOutput, y as getLatestDepositTxId, _ as getNextTransactionSequence, j as getP2TRAddressFromPkScript, i as getP2TRAddressFromPublicKey, h as getP2TRScriptFromPublicKey, k as getP2WPKHAddressFromPublicKey, E as getRandomSigningNonce, n as getSigHashFromTx, G as getSigningCommitmentFromNonce, ac as getSparkAddressFromTaproot, Y as getTransactionSequence, R as getTransferPackageSigningPayload, m as getTxFromRawTxBytes, l as getTxFromRawTxHex, o as getTxId, p as getTxIdNoReverse, a8 as isEphemeralAnchorOutput, z as isTxBroadcast, x as lastKeyWithTarget, V as maybeApplyFee, A as proofOfPossessionMessageHashForDepositAddress, u as subtractPrivateKeys, s as subtractPublicKeys, w as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from '../index-B2AwKW5J.cjs';
|
|
2
|
+
export { L as LRC_WALLET_NETWORK, c as LRC_WALLET_NETWORK_TYPE, N as Network, b as NetworkToProto, a as NetworkType, g as getNetwork, d as getNetworkFromAddress, e as getNetworkFromString } from '../network-CqgsdUF2.cjs';
|
|
3
|
+
export { V as VerifiableSecretShare, d as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, a as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, b as splitSecretWithProofs, v as validateShare } from '../signer-DKS0AJkw.cjs';
|
|
4
|
+
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt';
|
|
6
|
+
import '../spark-dM7EYXYQ.cjs';
|
|
7
|
+
import '@bufbuild/protobuf/wire';
|
|
8
|
+
import 'nice-grpc-common';
|
|
9
|
+
import '../services/wallet-config.cjs';
|
|
10
10
|
import '@buildonspark/lrc20-sdk';
|
|
11
|
-
import '
|
|
11
|
+
import '../RequestLightningSendInput-Du0z7Om7.cjs';
|
|
12
|
+
import '@lightsparkdev/core';
|
|
12
13
|
import '../BitcoinNetwork-TnABML0T.cjs';
|
|
13
14
|
import '@scure/bip32';
|
|
15
|
+
import '../types-C-Rp0Oo7.cjs';
|
|
16
|
+
import 'bitcoinjs-lib';
|
|
14
17
|
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
15
|
-
import '
|
|
16
|
-
import 'nice-grpc-common';
|
|
17
|
-
|
|
18
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
19
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
20
|
-
adaptorSignature: Uint8Array;
|
|
21
|
-
adaptorPrivateKey: Uint8Array;
|
|
22
|
-
};
|
|
23
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
24
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
25
|
-
|
|
26
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
27
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
28
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
29
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
30
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
31
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
32
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
33
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
34
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
35
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
36
|
-
|
|
37
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
38
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
39
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
40
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
41
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
42
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
43
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
44
|
-
|
|
45
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
46
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
47
|
-
|
|
48
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
49
|
-
|
|
50
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
51
|
-
|
|
52
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
53
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
54
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
55
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
56
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
57
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
58
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
59
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
60
|
-
|
|
61
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
62
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
63
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: Map<string, {
|
|
64
|
-
balance: bigint;
|
|
65
|
-
}>, publicKey: string): {
|
|
66
|
-
balance: bigint;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
70
|
-
|
|
71
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
72
|
-
/**
|
|
73
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
74
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
75
|
-
*/
|
|
76
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
77
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
78
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
79
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
80
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
81
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
82
|
-
nextSequence: number;
|
|
83
|
-
needRefresh: boolean;
|
|
84
|
-
};
|
|
85
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
86
|
-
|
|
87
|
-
interface LeafInfo {
|
|
88
|
-
leafId: string;
|
|
89
|
-
nodeTx: string;
|
|
90
|
-
refundTx: string;
|
|
91
|
-
}
|
|
92
|
-
interface Utxo {
|
|
93
|
-
txid: string;
|
|
94
|
-
vout: number;
|
|
95
|
-
value: bigint;
|
|
96
|
-
script: string;
|
|
97
|
-
publicKey: string;
|
|
98
|
-
}
|
|
99
|
-
interface FeeRate {
|
|
100
|
-
satPerVbyte: number;
|
|
101
|
-
}
|
|
102
|
-
interface FeeBumpTxPackage {
|
|
103
|
-
tx: string;
|
|
104
|
-
feeBumpPsbt?: string;
|
|
105
|
-
}
|
|
106
|
-
interface FeeBumpTxChain {
|
|
107
|
-
leafId: string;
|
|
108
|
-
txPackages: FeeBumpTxPackage[];
|
|
109
|
-
}
|
|
110
|
-
interface TxChain {
|
|
111
|
-
leafId: string;
|
|
112
|
-
transactions: string[];
|
|
113
|
-
}
|
|
114
|
-
interface BroadcastConfig {
|
|
115
|
-
bitcoinCoreRpcUrl?: string;
|
|
116
|
-
rpcUsername?: string;
|
|
117
|
-
rpcPassword?: string;
|
|
118
|
-
autoBroadcast?: boolean;
|
|
119
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
120
|
-
}
|
|
121
|
-
interface BroadcastResult {
|
|
122
|
-
success: boolean;
|
|
123
|
-
txids?: string[];
|
|
124
|
-
error?: string;
|
|
125
|
-
broadcastedPackages?: number;
|
|
126
|
-
}
|
|
127
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
128
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
129
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
130
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
131
|
-
feeBumpPsbt: string;
|
|
132
|
-
usedUtxos: Utxo[];
|
|
133
|
-
correctedParentTx?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
137
|
-
|
|
138
|
-
export { type BroadcastConfig, type BroadcastResult, DEFAULT_FEE_SATS, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type LeafInfo, Network, type TxChain, type Utxo, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, proofOfPossessionMessageHashForDepositAddress, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature };
|
|
18
|
+
import '../address/index.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,138 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
export { a6 as BroadcastConfig, a7 as BroadcastResult, U as DEFAULT_FEE_SATS, a4 as FeeBumpTxChain, a3 as FeeBumpTxPackage, a2 as FeeRate, a0 as LeafInfo, a5 as TxChain, a1 as Utxo, t as addPrivateKeys, q as addPublicKeys, e as applyAdaptorToSignature, r as applyAdditiveTweakToPublicKey, N as calculateAvailableTokenAmount, O as checkIfSelectedOutputsAreAvailable, Z as checkIfValidSequence, B as collectResponses, f as computeTaprootKeyNoScript, ab as constructFeeBumpTx, aa as constructUnilateralExitFeeBumpPackages, a9 as constructUnilateralExitTxs, W as createRefundTx, K as createSigningCommitment, F as createSigningNonce, M as decodeBytesToSigningCommitment, J as decodeBytesToSigningNonce, L as encodeSigningCommitmentToBytes, H as encodeSigningNonceToBytes, Q as filterTokenBalanceForTokenPublicKey, d as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, X as getCurrentTimelock, $ as getEphemeralAnchorOutput, y as getLatestDepositTxId, _ as getNextTransactionSequence, j as getP2TRAddressFromPkScript, i as getP2TRAddressFromPublicKey, h as getP2TRScriptFromPublicKey, k as getP2WPKHAddressFromPublicKey, E as getRandomSigningNonce, n as getSigHashFromTx, G as getSigningCommitmentFromNonce, ac as getSparkAddressFromTaproot, Y as getTransactionSequence, R as getTransferPackageSigningPayload, m as getTxFromRawTxBytes, l as getTxFromRawTxHex, o as getTxId, p as getTxIdNoReverse, a8 as isEphemeralAnchorOutput, z as isTxBroadcast, x as lastKeyWithTarget, V as maybeApplyFee, A as proofOfPossessionMessageHashForDepositAddress, u as subtractPrivateKeys, s as subtractPublicKeys, w as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from '../index-CJDi1HWc.js';
|
|
2
|
+
export { L as LRC_WALLET_NETWORK, c as LRC_WALLET_NETWORK_TYPE, N as Network, b as NetworkToProto, a as NetworkType, g as getNetwork, d as getNetworkFromAddress, e as getNetworkFromString } from '../network-BTJl-Sul.js';
|
|
3
|
+
export { V as VerifiableSecretShare, d as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, a as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, b as splitSecretWithProofs, v as validateShare } from '../signer-BocS_J6B.js';
|
|
4
|
+
import '@scure/btc-signer';
|
|
5
|
+
import '@scure/btc-signer/psbt';
|
|
6
|
+
import '../spark-dM7EYXYQ.js';
|
|
7
|
+
import '@bufbuild/protobuf/wire';
|
|
8
|
+
import 'nice-grpc-common';
|
|
9
|
+
import '../services/wallet-config.js';
|
|
10
10
|
import '@buildonspark/lrc20-sdk';
|
|
11
|
-
import '
|
|
11
|
+
import '../RequestLightningSendInput-DEPd_fPO.js';
|
|
12
|
+
import '@lightsparkdev/core';
|
|
12
13
|
import '../BitcoinNetwork-TnABML0T.js';
|
|
13
14
|
import '@scure/bip32';
|
|
15
|
+
import '../types-C-Rp0Oo7.js';
|
|
16
|
+
import 'bitcoinjs-lib';
|
|
14
17
|
import '@buildonspark/lrc20-sdk/lrc/types';
|
|
15
|
-
import '
|
|
16
|
-
import 'nice-grpc-common';
|
|
17
|
-
|
|
18
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
19
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
20
|
-
adaptorSignature: Uint8Array;
|
|
21
|
-
adaptorPrivateKey: Uint8Array;
|
|
22
|
-
};
|
|
23
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
24
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
25
|
-
|
|
26
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
27
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
28
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
29
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
30
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
31
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
32
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
33
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
34
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
35
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
36
|
-
|
|
37
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
38
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
39
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
40
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
41
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
42
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
43
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
44
|
-
|
|
45
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
46
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
47
|
-
|
|
48
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
49
|
-
|
|
50
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
51
|
-
|
|
52
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
53
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
54
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
55
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
56
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
57
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
58
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
59
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
60
|
-
|
|
61
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
62
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
63
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: Map<string, {
|
|
64
|
-
balance: bigint;
|
|
65
|
-
}>, publicKey: string): {
|
|
66
|
-
balance: bigint;
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
70
|
-
|
|
71
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
72
|
-
/**
|
|
73
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
74
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
75
|
-
*/
|
|
76
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
77
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
78
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
79
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
80
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
81
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
82
|
-
nextSequence: number;
|
|
83
|
-
needRefresh: boolean;
|
|
84
|
-
};
|
|
85
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
86
|
-
|
|
87
|
-
interface LeafInfo {
|
|
88
|
-
leafId: string;
|
|
89
|
-
nodeTx: string;
|
|
90
|
-
refundTx: string;
|
|
91
|
-
}
|
|
92
|
-
interface Utxo {
|
|
93
|
-
txid: string;
|
|
94
|
-
vout: number;
|
|
95
|
-
value: bigint;
|
|
96
|
-
script: string;
|
|
97
|
-
publicKey: string;
|
|
98
|
-
}
|
|
99
|
-
interface FeeRate {
|
|
100
|
-
satPerVbyte: number;
|
|
101
|
-
}
|
|
102
|
-
interface FeeBumpTxPackage {
|
|
103
|
-
tx: string;
|
|
104
|
-
feeBumpPsbt?: string;
|
|
105
|
-
}
|
|
106
|
-
interface FeeBumpTxChain {
|
|
107
|
-
leafId: string;
|
|
108
|
-
txPackages: FeeBumpTxPackage[];
|
|
109
|
-
}
|
|
110
|
-
interface TxChain {
|
|
111
|
-
leafId: string;
|
|
112
|
-
transactions: string[];
|
|
113
|
-
}
|
|
114
|
-
interface BroadcastConfig {
|
|
115
|
-
bitcoinCoreRpcUrl?: string;
|
|
116
|
-
rpcUsername?: string;
|
|
117
|
-
rpcPassword?: string;
|
|
118
|
-
autoBroadcast?: boolean;
|
|
119
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
120
|
-
}
|
|
121
|
-
interface BroadcastResult {
|
|
122
|
-
success: boolean;
|
|
123
|
-
txids?: string[];
|
|
124
|
-
error?: string;
|
|
125
|
-
broadcastedPackages?: number;
|
|
126
|
-
}
|
|
127
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
128
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
129
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
130
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
131
|
-
feeBumpPsbt: string;
|
|
132
|
-
usedUtxos: Utxo[];
|
|
133
|
-
correctedParentTx?: string;
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
137
|
-
|
|
138
|
-
export { type BroadcastConfig, type BroadcastResult, DEFAULT_FEE_SATS, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type LeafInfo, Network, type TxChain, type Utxo, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, calculateAvailableTokenAmount, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, proofOfPossessionMessageHashForDepositAddress, subtractPrivateKeys, subtractPublicKeys, sumOfPrivateKeys, validateOutboundAdaptorSignature };
|
|
18
|
+
import '../address/index.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -26,16 +26,16 @@ import {
|
|
|
26
26
|
isTxBroadcast,
|
|
27
27
|
maybeApplyFee,
|
|
28
28
|
proofOfPossessionMessageHashForDepositAddress
|
|
29
|
-
} from "../chunk-
|
|
29
|
+
} from "../chunk-5FUB65LX.js";
|
|
30
30
|
import {
|
|
31
31
|
calculateAvailableTokenAmount,
|
|
32
32
|
checkIfSelectedOutputsAreAvailable,
|
|
33
33
|
collectResponses,
|
|
34
34
|
filterTokenBalanceForTokenPublicKey
|
|
35
|
-
} from "../chunk-
|
|
36
|
-
import "../chunk-
|
|
37
|
-
import "../chunk-
|
|
38
|
-
import "../chunk-
|
|
35
|
+
} from "../chunk-HWJWKEIU.js";
|
|
36
|
+
import "../chunk-OBFKIEMP.js";
|
|
37
|
+
import "../chunk-I54FARY2.js";
|
|
38
|
+
import "../chunk-KMUMFYFX.js";
|
|
39
39
|
import {
|
|
40
40
|
LRC_WALLET_NETWORK,
|
|
41
41
|
LRC_WALLET_NETWORK_TYPE,
|
|
@@ -45,9 +45,7 @@ import {
|
|
|
45
45
|
getNetworkFromAddress,
|
|
46
46
|
getNetworkFromString
|
|
47
47
|
} from "../chunk-Z5HIAYFT.js";
|
|
48
|
-
import "../chunk-
|
|
49
|
-
import "../chunk-HMLOC6TE.js";
|
|
50
|
-
import "../chunk-M6A4KFIG.js";
|
|
48
|
+
import "../chunk-R5PXJZQS.js";
|
|
51
49
|
import {
|
|
52
50
|
addPrivateKeys,
|
|
53
51
|
addPublicKeys,
|
|
@@ -82,8 +80,10 @@ import {
|
|
|
82
80
|
splitSecretWithProofs,
|
|
83
81
|
validateShare
|
|
84
82
|
} from "../chunk-QNNSEJ4P.js";
|
|
83
|
+
import "../chunk-HMLOC6TE.js";
|
|
85
84
|
import "../chunk-VTUGIIWI.js";
|
|
86
85
|
import "../chunk-GSI4OLXZ.js";
|
|
86
|
+
import "../chunk-BGGEVUJK.js";
|
|
87
87
|
import "../chunk-MVRQ5US7.js";
|
|
88
88
|
export {
|
|
89
89
|
DEFAULT_FEE_SATS,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildonspark/spark-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.45",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -92,6 +92,14 @@
|
|
|
92
92
|
"./native": {
|
|
93
93
|
"import": "./dist/native/index.js",
|
|
94
94
|
"require": "./dist/native/index.cjs"
|
|
95
|
+
},
|
|
96
|
+
"./native/spark-frost": {
|
|
97
|
+
"import": "./dist/spark_bindings/native/index.js",
|
|
98
|
+
"require": "./dist/spark_bindings/native/index.cjs"
|
|
99
|
+
},
|
|
100
|
+
"./spark-frost": {
|
|
101
|
+
"import": "./dist/spark_bindings/wasm/index.js",
|
|
102
|
+
"require": "./dist/spark_bindings/wasm/index.cjs"
|
|
95
103
|
}
|
|
96
104
|
},
|
|
97
105
|
"browser": {
|
|
@@ -168,6 +176,7 @@
|
|
|
168
176
|
"eciesjs": "^0.4.13",
|
|
169
177
|
"eventemitter3": "^5.0.1",
|
|
170
178
|
"js-base64": "^3.7.7",
|
|
179
|
+
"light-bolt11-decoder": "^3.2.0",
|
|
171
180
|
"nice-grpc": "^2.1.10",
|
|
172
181
|
"nice-grpc-client-middleware-retry": "^3.1.10",
|
|
173
182
|
"nice-grpc-common": "^2.0.2",
|
|
@@ -181,6 +190,17 @@
|
|
|
181
190
|
"react-native": ">=0.71.0",
|
|
182
191
|
"react-native-get-random-values": ">=1.11.0"
|
|
183
192
|
},
|
|
193
|
+
"peerDependenciesMeta": {
|
|
194
|
+
"react": {
|
|
195
|
+
"optional": true
|
|
196
|
+
},
|
|
197
|
+
"react-native": {
|
|
198
|
+
"optional": true
|
|
199
|
+
},
|
|
200
|
+
"react-native-get-random-values": {
|
|
201
|
+
"optional": true
|
|
202
|
+
}
|
|
203
|
+
},
|
|
184
204
|
"engines": {
|
|
185
205
|
"node": ">=18.0.0"
|
|
186
206
|
},
|
package/src/constants.ts
CHANGED
|
@@ -11,7 +11,11 @@ export const packageVersion =
|
|
|
11
11
|
typeof __PACKAGE_VERSION__ !== "undefined" ? __PACKAGE_VERSION__ : "unknown";
|
|
12
12
|
|
|
13
13
|
let baseEnvStr = "unknown";
|
|
14
|
-
if (
|
|
14
|
+
if (isBun) {
|
|
15
|
+
const bunVersion =
|
|
16
|
+
"version" in globalThis.Bun ? globalThis.Bun.version : "unknown-version";
|
|
17
|
+
baseEnvStr = `bun/${bunVersion}`;
|
|
18
|
+
} else if (isNode) {
|
|
15
19
|
baseEnvStr = `node/${process.version}`;
|
|
16
20
|
} else if (isReactNative) {
|
|
17
21
|
baseEnvStr = "react-native";
|
package/src/graphql/client.ts
CHANGED
|
@@ -23,6 +23,7 @@ import ClaimStaticDepositOutput, {
|
|
|
23
23
|
} from "./objects/ClaimStaticDepositOutput.js";
|
|
24
24
|
import ClaimStaticDepositRequestType from "./objects/ClaimStaticDepositRequestType.js";
|
|
25
25
|
import { CoopExitFeeEstimatesOutputFromJson } from "./objects/CoopExitFeeEstimatesOutput.js";
|
|
26
|
+
import { CoopExitFeeQuoteFromJson } from "./objects/CoopExitFeeQuote.js";
|
|
26
27
|
import CoopExitRequest, {
|
|
27
28
|
CoopExitRequestFromJson,
|
|
28
29
|
} from "./objects/CoopExitRequest.js";
|
|
@@ -33,6 +34,8 @@ import type {
|
|
|
33
34
|
CompleteLeavesSwapInput,
|
|
34
35
|
CoopExitFeeEstimatesInput,
|
|
35
36
|
CoopExitFeeEstimatesOutput,
|
|
37
|
+
CoopExitFeeQuote,
|
|
38
|
+
CoopExitFeeQuoteInput,
|
|
36
39
|
GetChallengeOutput,
|
|
37
40
|
LeavesSwapFeeEstimateOutput,
|
|
38
41
|
LightningSendRequest,
|
|
@@ -63,6 +66,7 @@ import VerifyChallengeOutput, {
|
|
|
63
66
|
} from "./objects/VerifyChallengeOutput.js";
|
|
64
67
|
import { CoopExitFeeEstimate } from "./queries/CoopExitFeeEstimate.js";
|
|
65
68
|
import { GetClaimDepositQuote } from "./queries/GetClaimDepositQuote.js";
|
|
69
|
+
import { GetCoopExitFeeQuote } from "./queries/GetCoopExitFeeQuote.js";
|
|
66
70
|
import { LeavesSwapFeeEstimate } from "./queries/LeavesSwapFeeEstimate.js";
|
|
67
71
|
import { LightningSendFeeEstimate } from "./queries/LightningSendFeeEstimate.js";
|
|
68
72
|
import { GetTransfer } from "./queries/Transfer.js";
|
|
@@ -229,6 +233,9 @@ export default class SspClient {
|
|
|
229
233
|
withdrawalAddress,
|
|
230
234
|
idempotencyKey,
|
|
231
235
|
exitSpeed,
|
|
236
|
+
feeLeafExternalIds,
|
|
237
|
+
feeQuoteId,
|
|
238
|
+
withdrawAll,
|
|
232
239
|
}: RequestCoopExitInput): Promise<CoopExitRequest | null> {
|
|
233
240
|
return await this.executeRawQuery({
|
|
234
241
|
queryPayload: RequestCoopExit,
|
|
@@ -237,6 +244,9 @@ export default class SspClient {
|
|
|
237
244
|
withdrawal_address: withdrawalAddress,
|
|
238
245
|
idempotency_key: idempotencyKey,
|
|
239
246
|
exit_speed: exitSpeed,
|
|
247
|
+
fee_leaf_external_ids: feeLeafExternalIds,
|
|
248
|
+
fee_quote_id: feeQuoteId,
|
|
249
|
+
withdraw_all: withdrawAll,
|
|
240
250
|
},
|
|
241
251
|
constructObject: (response: { request_coop_exit: any }) => {
|
|
242
252
|
return CoopExitRequestFromJson(response.request_coop_exit.request);
|
|
@@ -302,6 +312,7 @@ export default class SspClient {
|
|
|
302
312
|
feeSats,
|
|
303
313
|
userLeaves,
|
|
304
314
|
idempotencyKey,
|
|
315
|
+
targetAmountSatsList,
|
|
305
316
|
}: RequestLeavesSwapInput): Promise<LeavesSwapRequest | null> {
|
|
306
317
|
const query = {
|
|
307
318
|
queryPayload: RequestSwapLeaves,
|
|
@@ -312,6 +323,7 @@ export default class SspClient {
|
|
|
312
323
|
fee_sats: feeSats,
|
|
313
324
|
user_leaves: userLeaves,
|
|
314
325
|
idempotency_key: idempotencyKey,
|
|
326
|
+
target_amount_sats_list: targetAmountSatsList,
|
|
315
327
|
},
|
|
316
328
|
constructObject: (response: { request_leaves_swap: any }) => {
|
|
317
329
|
if (!response.request_leaves_swap) {
|
|
@@ -538,6 +550,22 @@ export default class SspClient {
|
|
|
538
550
|
new Date(verifyChallenge.validUntil),
|
|
539
551
|
);
|
|
540
552
|
}
|
|
553
|
+
|
|
554
|
+
async getCoopExitFeeQuote({
|
|
555
|
+
leafExternalIds,
|
|
556
|
+
withdrawalAddress,
|
|
557
|
+
}: CoopExitFeeQuoteInput): Promise<CoopExitFeeQuote | null> {
|
|
558
|
+
return await this.executeRawQuery({
|
|
559
|
+
queryPayload: GetCoopExitFeeQuote,
|
|
560
|
+
variables: {
|
|
561
|
+
leaf_external_ids: leafExternalIds,
|
|
562
|
+
withdrawal_address: withdrawalAddress,
|
|
563
|
+
},
|
|
564
|
+
constructObject: (response: { coop_exit_fee_quote: any }) => {
|
|
565
|
+
return CoopExitFeeQuoteFromJson(response.coop_exit_fee_quote.quote);
|
|
566
|
+
},
|
|
567
|
+
});
|
|
568
|
+
}
|
|
541
569
|
}
|
|
542
570
|
|
|
543
571
|
class SparkAuthProvider implements AuthProvider {
|
|
@@ -6,6 +6,9 @@ export const RequestCoopExit = `
|
|
|
6
6
|
$withdrawal_address: String!
|
|
7
7
|
$idempotency_key: String!
|
|
8
8
|
$exit_speed: ExitSpeed!
|
|
9
|
+
$withdraw_all: Boolean
|
|
10
|
+
$fee_leaf_external_ids: [UUID!]
|
|
11
|
+
$fee_quote_id: ID
|
|
9
12
|
) {
|
|
10
13
|
request_coop_exit(
|
|
11
14
|
input: {
|
|
@@ -13,6 +16,9 @@ export const RequestCoopExit = `
|
|
|
13
16
|
withdrawal_address: $withdrawal_address
|
|
14
17
|
idempotency_key: $idempotency_key
|
|
15
18
|
exit_speed: $exit_speed
|
|
19
|
+
withdraw_all: $withdraw_all
|
|
20
|
+
fee_leaf_external_ids: $fee_leaf_external_ids
|
|
21
|
+
fee_quote_id: $fee_quote_id
|
|
16
22
|
}
|
|
17
23
|
) {
|
|
18
24
|
request {
|
|
@@ -8,6 +8,7 @@ export const RequestSwapLeaves = `
|
|
|
8
8
|
$fee_sats: Long!
|
|
9
9
|
$user_leaves: [UserLeafInput!]!
|
|
10
10
|
$idempotency_key: String!
|
|
11
|
+
$target_amount_sats_list: [Long!]
|
|
11
12
|
) {
|
|
12
13
|
request_leaves_swap(input: {
|
|
13
14
|
adaptor_pubkey: $adaptor_pubkey
|
|
@@ -16,6 +17,7 @@ export const RequestSwapLeaves = `
|
|
|
16
17
|
fee_sats: $fee_sats
|
|
17
18
|
user_leaves: $user_leaves
|
|
18
19
|
idempotency_key: $idempotency_key
|
|
20
|
+
target_amount_sats_list: $target_amount_sats_list
|
|
19
21
|
}) {
|
|
20
22
|
request {
|
|
21
23
|
...LeavesSwapRequestFragment
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FRAGMENT as CoopExitFeeQuoteFragment } from "../objects/CoopExitFeeQuote.js";
|
|
2
|
+
|
|
3
|
+
export const GetCoopExitFeeQuote = `
|
|
4
|
+
query CoopExitFeeQuote(
|
|
5
|
+
$leaf_external_ids: [UUID!]!
|
|
6
|
+
$withdrawal_address: String!
|
|
7
|
+
) {
|
|
8
|
+
coop_exit_fee_quote(
|
|
9
|
+
input: {
|
|
10
|
+
leaf_external_ids: $leaf_external_ids,
|
|
11
|
+
withdrawal_address: $withdrawal_address
|
|
12
|
+
}
|
|
13
|
+
) {
|
|
14
|
+
quote {
|
|
15
|
+
...CoopExitFeeQuoteFragment
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
${CoopExitFeeQuoteFragment}
|
|
20
|
+
`;
|
package/src/index.node.ts
CHANGED
package/src/index.ts
CHANGED
package/src/native/index.ts
CHANGED
|
@@ -3,6 +3,5 @@ export { ReactNativeSparkSigner } from "../signer/signer.react-native.js";
|
|
|
3
3
|
/* Enable some consumers to use named import DefaultSparkSigner regardless of module, see LIG-7662 */
|
|
4
4
|
export { ReactNativeSparkSigner as DefaultSparkSigner } from "../signer/signer.react-native.js";
|
|
5
5
|
export { SparkWallet } from "../spark-wallet/spark-wallet.js";
|
|
6
|
-
export { getLatestDepositTxId } from "../utils/mempool.js";
|
|
7
|
-
export { createDummyTx } from "../spark_bindings/native/index.js";
|
|
8
6
|
export * from "../utils/index.js";
|
|
7
|
+
export { getLatestDepositTxId } from "../utils/mempool.js";
|
package/src/proto/common.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
|
|
2
2
|
// versions:
|
|
3
|
-
// protoc-gen-ts_proto v2.7.
|
|
3
|
+
// protoc-gen-ts_proto v2.7.5
|
|
4
4
|
// protoc v5.29.3
|
|
5
5
|
// source: common.proto
|
|
6
6
|
|
|
@@ -99,7 +99,7 @@ export const PackageMap: MessageFns<PackageMap> = {
|
|
|
99
99
|
|
|
100
100
|
decode(input: BinaryReader | Uint8Array, length?: number): PackageMap {
|
|
101
101
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
102
|
-
|
|
102
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
103
103
|
const message = createBasePackageMap();
|
|
104
104
|
while (reader.pos < end) {
|
|
105
105
|
const tag = reader.uint32();
|
|
@@ -184,7 +184,7 @@ export const PackageMap_PackagesEntry: MessageFns<PackageMap_PackagesEntry> = {
|
|
|
184
184
|
|
|
185
185
|
decode(input: BinaryReader | Uint8Array, length?: number): PackageMap_PackagesEntry {
|
|
186
186
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
187
|
-
|
|
187
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
188
188
|
const message = createBasePackageMap_PackagesEntry();
|
|
189
189
|
while (reader.pos < end) {
|
|
190
190
|
const tag = reader.uint32();
|
|
@@ -260,7 +260,7 @@ export const SigningCommitment: MessageFns<SigningCommitment> = {
|
|
|
260
260
|
|
|
261
261
|
decode(input: BinaryReader | Uint8Array, length?: number): SigningCommitment {
|
|
262
262
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
263
|
-
|
|
263
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
264
264
|
const message = createBaseSigningCommitment();
|
|
265
265
|
while (reader.pos < end) {
|
|
266
266
|
const tag = reader.uint32();
|
|
@@ -333,7 +333,7 @@ export const SigningResult: MessageFns<SigningResult> = {
|
|
|
333
333
|
|
|
334
334
|
decode(input: BinaryReader | Uint8Array, length?: number): SigningResult {
|
|
335
335
|
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
336
|
-
|
|
336
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
337
337
|
const message = createBaseSigningResult();
|
|
338
338
|
while (reader.pos < end) {
|
|
339
339
|
const tag = reader.uint32();
|