@buildonspark/spark-sdk 0.2.7 → 0.2.8
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 +11 -0
- package/dist/bare/index.cjs +1657 -1879
- package/dist/bare/index.d.cts +65 -115
- package/dist/bare/index.d.ts +65 -115
- package/dist/bare/index.js +1578 -1807
- package/dist/{chunk-GIDAHHDB.js → chunk-6CMNEDBK.js} +217 -9
- package/dist/{chunk-J24LM4RO.js → chunk-76SYPHOC.js} +1 -1
- package/dist/{chunk-2HD3USKS.js → chunk-A5M55UR3.js} +0 -24
- package/dist/{chunk-7LY7PJQL.js → chunk-G2RIVSSI.js} +14 -5
- package/dist/{chunk-R5VUHUJR.js → chunk-HMJO7LPI.js} +4160 -3739
- package/dist/{client-DmjOifnt.d.ts → client-B5vlztPA.d.ts} +1 -1
- package/dist/{client-BmnZ1xDg.d.cts → client-TLqKGhj8.d.cts} +1 -1
- package/dist/debug.cjs +1664 -1945
- package/dist/debug.d.cts +12 -7
- package/dist/debug.d.ts +12 -7
- package/dist/debug.js +6 -8
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +1703 -1926
- package/dist/index.d.cts +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +17 -8
- package/dist/index.node.cjs +1703 -1926
- package/dist/index.node.d.cts +7 -6
- package/dist/index.node.d.ts +7 -6
- package/dist/index.node.js +22 -6
- package/dist/native/index.cjs +1697 -1927
- package/dist/native/index.d.cts +78 -123
- package/dist/native/index.d.ts +78 -123
- package/dist/native/index.js +1626 -1862
- package/dist/proto/spark.cjs +0 -24
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark.js +1 -1
- package/dist/proto/spark_token.cjs +221 -8
- package/dist/proto/spark_token.d.cts +25 -2
- package/dist/proto/spark_token.d.ts +25 -2
- package/dist/proto/spark_token.js +12 -2
- package/dist/{spark-B305mDNB.d.cts → spark-CBBjw5AY.d.cts} +2 -30
- package/dist/{spark-B305mDNB.d.ts → spark-CBBjw5AY.d.ts} +2 -30
- package/dist/{spark-wallet-BdwARy70.d.cts → spark-wallet-CIuHgbSR.d.cts} +38 -29
- package/dist/{spark-wallet-enp968Uc.d.ts → spark-wallet-CrNWPa9p.d.ts} +38 -29
- package/dist/{spark-wallet.node-CtpJlYBs.d.cts → spark-wallet.node-BvfiSwh_.d.cts} +1 -1
- package/dist/{spark-wallet.node-DqWcsNb6.d.ts → spark-wallet.node-pnKSb-aa.d.ts} +1 -1
- package/dist/tests/test-utils.cjs +483 -1120
- package/dist/tests/test-utils.d.cts +8 -4
- package/dist/tests/test-utils.d.ts +8 -4
- package/dist/tests/test-utils.js +5 -6
- package/dist/{token-transactions-3-pVToE0.d.cts → token-transactions-ChvD_wLe.d.cts} +15 -10
- package/dist/{token-transactions-84Hp0hGz.d.ts → token-transactions-e8UUOjFk.d.ts} +15 -10
- package/dist/types/index.cjs +0 -24
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +2 -2
- package/dist/{xchain-address-BtuJEbzG.d.cts → xchain-address-CDnNobbB.d.ts} +9 -3
- package/dist/{xchain-address-Q1BrcwID.d.ts → xchain-address-CtqVOuWz.d.cts} +9 -3
- package/package.json +1 -1
- package/src/constants.ts +7 -1
- package/src/debug.ts +1 -1
- package/src/proto/spark.ts +2 -48
- package/src/proto/spark_token.ts +255 -7
- package/src/services/token-transactions.ts +57 -14
- package/src/services/transfer.ts +20 -17
- package/src/services/wallet-config.ts +2 -0
- package/src/signer/signer.react-native.ts +0 -2
- package/src/spark-wallet/spark-wallet.browser.ts +9 -8
- package/src/spark-wallet/spark-wallet.node.ts +8 -4
- package/src/spark-wallet/spark-wallet.ts +424 -227
- package/src/tests/address.test.ts +87 -1
- package/src/tests/integration/retry.test.ts +78 -0
- package/src/tests/integration/transfer.test.ts +285 -1
- package/src/tests/integration/wallet.test.ts +160 -0
- package/src/tests/{tokens.test.ts → token-hashing.test.ts} +150 -162
- package/src/tests/token-outputs.test.ts +194 -0
- package/src/tests/utils/spark-testing-wallet.ts +16 -8
- package/src/utils/address.ts +152 -11
- package/src/utils/invoice-hashing.test.ts +235 -0
- package/src/utils/invoice-hashing.ts +227 -0
- package/src/utils/mempool.ts +6 -0
- package/src/utils/retry.ts +116 -0
- package/src/utils/token-hashing.ts +566 -0
- package/src/utils/token-transactions.ts +9 -5
- package/dist/chunk-7N6R7G3E.js +0 -7
- package/dist/spark-wallet.browser-BYlprQpX.d.ts +0 -12
- package/dist/spark-wallet.browser-CVI2Ss3u.d.cts +0 -12
- package/src/services/tree-creation.ts +0 -893
- package/src/tests/integration/tree-creation.test.ts +0 -46
package/dist/bare/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { Channel } from 'nice-grpc';
|
|
|
9
9
|
import { Channel as Channel$1 } from 'nice-grpc-web';
|
|
10
10
|
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
11
11
|
import { EventEmitter } from 'eventemitter3';
|
|
12
|
+
import * as _scure_base from '@scure/base';
|
|
12
13
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
13
14
|
|
|
14
15
|
declare class SparkSDKError extends Error {
|
|
@@ -968,18 +969,6 @@ interface UTXO {
|
|
|
968
969
|
txid: Uint8Array;
|
|
969
970
|
}
|
|
970
971
|
declare const UTXO: MessageFns$2<UTXO>;
|
|
971
|
-
/**
|
|
972
|
-
* NodeOutput represents a node on the tree.
|
|
973
|
-
* This is similar to a UTXO, which is used to create a subtree on Spark. But instead of using
|
|
974
|
-
* a utxo, a existing node on the tree is used as the utxo.
|
|
975
|
-
*/
|
|
976
|
-
interface NodeOutput {
|
|
977
|
-
/** The id of the node. */
|
|
978
|
-
nodeId: string;
|
|
979
|
-
/** The vout of the raw transaction for the node, which will be used to create the tree. */
|
|
980
|
-
vout: number;
|
|
981
|
-
}
|
|
982
|
-
declare const NodeOutput: MessageFns$2<NodeOutput>;
|
|
983
972
|
/**
|
|
984
973
|
* SigningJob is the job for signing a transaction.
|
|
985
974
|
* The signing job is used to sign a bitcoin transaction using Spark FROST.
|
|
@@ -1153,7 +1142,9 @@ interface TokenMintInput$1 {
|
|
|
1153
1142
|
declare const TokenMintInput$1: MessageFns$2<TokenMintInput$1>;
|
|
1154
1143
|
interface TokenCreateInput$1 {
|
|
1155
1144
|
issuerPublicKey: Uint8Array;
|
|
1145
|
+
/** No minimum length because a single utf-8 character can be 3 bytes. */
|
|
1156
1146
|
tokenName: string;
|
|
1147
|
+
/** No minimum length because a single utf-8 character can be 3 bytes. */
|
|
1157
1148
|
tokenTicker: string;
|
|
1158
1149
|
decimals: number;
|
|
1159
1150
|
/** Decoded uint128 */
|
|
@@ -1732,79 +1723,6 @@ interface ExtendLeafResponse {
|
|
|
1732
1723
|
directFromCpfpRefundTxSigningResult: ExtendLeafSigningResult | undefined;
|
|
1733
1724
|
}
|
|
1734
1725
|
declare const ExtendLeafResponse: MessageFns$2<ExtendLeafResponse>;
|
|
1735
|
-
interface AddressRequestNode {
|
|
1736
|
-
userPublicKey: Uint8Array;
|
|
1737
|
-
children: AddressRequestNode[];
|
|
1738
|
-
}
|
|
1739
|
-
declare const AddressRequestNode: MessageFns$2<AddressRequestNode>;
|
|
1740
|
-
interface PrepareTreeAddressRequest {
|
|
1741
|
-
source?: {
|
|
1742
|
-
$case: "parentNodeOutput";
|
|
1743
|
-
parentNodeOutput: NodeOutput;
|
|
1744
|
-
} | {
|
|
1745
|
-
$case: "onChainUtxo";
|
|
1746
|
-
onChainUtxo: UTXO;
|
|
1747
|
-
} | undefined;
|
|
1748
|
-
/**
|
|
1749
|
-
* The tx on this node is to spend the source's utxo.
|
|
1750
|
-
* The user's public key should already be registered with the SE for the root node.
|
|
1751
|
-
*/
|
|
1752
|
-
node: AddressRequestNode | undefined;
|
|
1753
|
-
userIdentityPublicKey: Uint8Array;
|
|
1754
|
-
}
|
|
1755
|
-
declare const PrepareTreeAddressRequest: MessageFns$2<PrepareTreeAddressRequest>;
|
|
1756
|
-
interface AddressNode {
|
|
1757
|
-
address: Address | undefined;
|
|
1758
|
-
children: AddressNode[];
|
|
1759
|
-
}
|
|
1760
|
-
declare const AddressNode: MessageFns$2<AddressNode>;
|
|
1761
|
-
interface PrepareTreeAddressResponse {
|
|
1762
|
-
node: AddressNode | undefined;
|
|
1763
|
-
}
|
|
1764
|
-
declare const PrepareTreeAddressResponse: MessageFns$2<PrepareTreeAddressResponse>;
|
|
1765
|
-
interface CreationNode {
|
|
1766
|
-
/** This is the cpfp tx that spends the parent node's output. */
|
|
1767
|
-
nodeTxSigningJob: SigningJob | undefined;
|
|
1768
|
-
/** The refund tx can only exist if there's no children. */
|
|
1769
|
-
refundTxSigningJob: SigningJob | undefined;
|
|
1770
|
-
/** The children will spend the output of the node's tx. Vout is the index of the child. */
|
|
1771
|
-
children: CreationNode[];
|
|
1772
|
-
/** This is the direct tx that spends the parent node's output. */
|
|
1773
|
-
directNodeTxSigningJob: SigningJob | undefined;
|
|
1774
|
-
/** The direct refund tx can only exist if there's no children. */
|
|
1775
|
-
directRefundTxSigningJob: SigningJob | undefined;
|
|
1776
|
-
/** The direct from cpfp refund tx can only exist if there's no children. */
|
|
1777
|
-
directFromCpfpRefundTxSigningJob: SigningJob | undefined;
|
|
1778
|
-
}
|
|
1779
|
-
declare const CreationNode: MessageFns$2<CreationNode>;
|
|
1780
|
-
interface CreateTreeRequest {
|
|
1781
|
-
source?: {
|
|
1782
|
-
$case: "parentNodeOutput";
|
|
1783
|
-
parentNodeOutput: NodeOutput;
|
|
1784
|
-
} | {
|
|
1785
|
-
$case: "onChainUtxo";
|
|
1786
|
-
onChainUtxo: UTXO;
|
|
1787
|
-
} | undefined;
|
|
1788
|
-
/** The node should contain the tx that spends the source's utxo. */
|
|
1789
|
-
node: CreationNode | undefined;
|
|
1790
|
-
/** The owner of the tree. */
|
|
1791
|
-
userIdentityPublicKey: Uint8Array;
|
|
1792
|
-
}
|
|
1793
|
-
declare const CreateTreeRequest: MessageFns$2<CreateTreeRequest>;
|
|
1794
|
-
interface CreationResponseNode {
|
|
1795
|
-
nodeId: string;
|
|
1796
|
-
nodeTxSigningResult: SigningResult | undefined;
|
|
1797
|
-
refundTxSigningResult: SigningResult | undefined;
|
|
1798
|
-
children: CreationResponseNode[];
|
|
1799
|
-
directNodeTxSigningResult: SigningResult | undefined;
|
|
1800
|
-
directRefundTxSigningResult: SigningResult | undefined;
|
|
1801
|
-
directFromCpfpRefundTxSigningResult: SigningResult | undefined;
|
|
1802
|
-
}
|
|
1803
|
-
declare const CreationResponseNode: MessageFns$2<CreationResponseNode>;
|
|
1804
|
-
interface CreateTreeResponse {
|
|
1805
|
-
node: CreationResponseNode | undefined;
|
|
1806
|
-
}
|
|
1807
|
-
declare const CreateTreeResponse: MessageFns$2<CreateTreeResponse>;
|
|
1808
1726
|
interface SigningOperatorInfo {
|
|
1809
1727
|
index: number;
|
|
1810
1728
|
identifier: string;
|
|
@@ -2121,8 +2039,6 @@ interface SparkServiceClient<CallOptionsExt = {}> {
|
|
|
2121
2039
|
counter_leaf_swap(request: DeepPartial$2<CounterLeafSwapRequest>, options?: CallOptions & CallOptionsExt): Promise<CounterLeafSwapResponse>;
|
|
2122
2040
|
refresh_timelock(request: DeepPartial$2<RefreshTimelockRequest>, options?: CallOptions & CallOptionsExt): Promise<RefreshTimelockResponse>;
|
|
2123
2041
|
extend_leaf(request: DeepPartial$2<ExtendLeafRequest>, options?: CallOptions & CallOptionsExt): Promise<ExtendLeafResponse>;
|
|
2124
|
-
prepare_tree_address(request: DeepPartial$2<PrepareTreeAddressRequest>, options?: CallOptions & CallOptionsExt): Promise<PrepareTreeAddressResponse>;
|
|
2125
|
-
create_tree(request: DeepPartial$2<CreateTreeRequest>, options?: CallOptions & CallOptionsExt): Promise<CreateTreeResponse>;
|
|
2126
2042
|
get_signing_operator_list(request: DeepPartial$2<Empty>, options?: CallOptions & CallOptionsExt): Promise<GetSigningOperatorListResponse>;
|
|
2127
2043
|
query_nodes(request: DeepPartial$2<QueryNodesRequest>, options?: CallOptions & CallOptionsExt): Promise<QueryNodesResponse>;
|
|
2128
2044
|
query_nodes_distribution(request: DeepPartial$2<QueryNodesDistributionRequest>, options?: CallOptions & CallOptionsExt): Promise<QueryNodesDistributionResponse>;
|
|
@@ -2161,7 +2077,6 @@ interface SparkServiceClient<CallOptionsExt = {}> {
|
|
|
2161
2077
|
* The following endpoints enforce inclusion of Direct Transactions used
|
|
2162
2078
|
* for unilateral exits
|
|
2163
2079
|
*/
|
|
2164
|
-
create_tree_v2(request: DeepPartial$2<CreateTreeRequest>, options?: CallOptions & CallOptionsExt): Promise<CreateTreeResponse>;
|
|
2165
2080
|
cooperative_exit_v2(request: DeepPartial$2<CooperativeExitRequest>, options?: CallOptions & CallOptionsExt): Promise<CooperativeExitResponse>;
|
|
2166
2081
|
extend_leaf_v2(request: DeepPartial$2<ExtendLeafRequest>, options?: CallOptions & CallOptionsExt): Promise<ExtendLeafResponse>;
|
|
2167
2082
|
claim_transfer_sign_refunds_v2(request: DeepPartial$2<ClaimTransferSignRefundsRequest>, options?: CallOptions & CallOptionsExt): Promise<ClaimTransferSignRefundsResponse>;
|
|
@@ -2534,6 +2449,7 @@ type ConfigOptions = MayHaveSspClientOptions & {
|
|
|
2534
2449
|
readonly sspClientOptions?: SspClientOptions;
|
|
2535
2450
|
readonly expectedWithdrawBondSats?: number;
|
|
2536
2451
|
readonly expectedWithdrawRelativeBlockLocktime?: number;
|
|
2452
|
+
readonly signerWithPreExistingKeys?: boolean;
|
|
2537
2453
|
readonly console?: ConsoleOptions;
|
|
2538
2454
|
};
|
|
2539
2455
|
|
|
@@ -2625,6 +2541,12 @@ interface MessageFns$1<T> {
|
|
|
2625
2541
|
fromPartial(object: DeepPartial$1<T>): T;
|
|
2626
2542
|
}
|
|
2627
2543
|
|
|
2544
|
+
declare enum CommitStatus {
|
|
2545
|
+
COMMIT_UNSPECIFIED = 0,
|
|
2546
|
+
COMMIT_PROCESSING = 1,
|
|
2547
|
+
COMMIT_FINALIZED = 2,
|
|
2548
|
+
UNRECOGNIZED = -1
|
|
2549
|
+
}
|
|
2628
2550
|
declare enum TokenTransactionStatus {
|
|
2629
2551
|
TOKEN_TRANSACTION_STARTED = 0,
|
|
2630
2552
|
TOKEN_TRANSACTION_SIGNED = 1,
|
|
@@ -2655,7 +2577,9 @@ interface TokenMintInput {
|
|
|
2655
2577
|
declare const TokenMintInput: MessageFns<TokenMintInput>;
|
|
2656
2578
|
interface TokenCreateInput {
|
|
2657
2579
|
issuerPublicKey: Uint8Array;
|
|
2580
|
+
/** No minimum length because a single utf-8 character can be 3 bytes. */
|
|
2658
2581
|
tokenName: string;
|
|
2582
|
+
/** No minimum length because a single utf-8 character can be 3 bytes. */
|
|
2659
2583
|
tokenTicker: string;
|
|
2660
2584
|
decimals: number;
|
|
2661
2585
|
/** Decoded uint128 */
|
|
@@ -2720,8 +2644,14 @@ interface TokenTransaction {
|
|
|
2720
2644
|
* timestamps win over later ones.
|
|
2721
2645
|
*/
|
|
2722
2646
|
clientCreatedTimestamp: Date | undefined;
|
|
2647
|
+
/** The spark invoices this transaction fulfills. */
|
|
2648
|
+
invoiceAttachments: InvoiceAttachment[];
|
|
2723
2649
|
}
|
|
2724
2650
|
declare const TokenTransaction: MessageFns<TokenTransaction>;
|
|
2651
|
+
interface InvoiceAttachment {
|
|
2652
|
+
sparkInvoice: string;
|
|
2653
|
+
}
|
|
2654
|
+
declare const InvoiceAttachment: MessageFns<InvoiceAttachment>;
|
|
2725
2655
|
interface SignatureWithIndex {
|
|
2726
2656
|
/**
|
|
2727
2657
|
* This is a Schnorr or ECDSA DER signature which can be between 64 and 73
|
|
@@ -2772,7 +2702,14 @@ interface CommitTransactionRequest {
|
|
|
2772
2702
|
ownerIdentityPublicKey: Uint8Array;
|
|
2773
2703
|
}
|
|
2774
2704
|
declare const CommitTransactionRequest: MessageFns<CommitTransactionRequest>;
|
|
2705
|
+
interface CommitProgress {
|
|
2706
|
+
committedOperatorPublicKeys: Uint8Array[];
|
|
2707
|
+
uncommittedOperatorPublicKeys: Uint8Array[];
|
|
2708
|
+
}
|
|
2709
|
+
declare const CommitProgress: MessageFns<CommitProgress>;
|
|
2775
2710
|
interface CommitTransactionResponse {
|
|
2711
|
+
commitStatus: CommitStatus;
|
|
2712
|
+
commitProgress: CommitProgress | undefined;
|
|
2776
2713
|
}
|
|
2777
2714
|
declare const CommitTransactionResponse: MessageFns<CommitTransactionResponse>;
|
|
2778
2715
|
interface QueryTokenMetadataRequest {
|
|
@@ -3002,7 +2939,7 @@ declare class TransferService extends BaseTransferService {
|
|
|
3002
2939
|
*/
|
|
3003
2940
|
sendTransfer(leaves: LeafKeyTweak[], receiverIdentityPubkey: Uint8Array): Promise<Transfer>;
|
|
3004
2941
|
claimTransfer(transfer: Transfer, leaves: LeafKeyTweak[]): Promise<FinalizeNodeSignaturesResponse>;
|
|
3005
|
-
queryPendingTransfers(): Promise<QueryTransfersResponse>;
|
|
2942
|
+
queryPendingTransfers(transferIds?: string[]): Promise<QueryTransfersResponse>;
|
|
3006
2943
|
queryAllTransfers(limit: number, offset: number): Promise<QueryTransfersResponse>;
|
|
3007
2944
|
verifyPendingTransfer(transfer: Transfer): Promise<Map<string, Uint8Array>>;
|
|
3008
2945
|
queryTransfer(transferId: string): Promise<Transfer | undefined>;
|
|
@@ -3079,10 +3016,18 @@ interface DecodedSparkAddressData {
|
|
|
3079
3016
|
signature?: string;
|
|
3080
3017
|
}
|
|
3081
3018
|
declare function encodeSparkAddress(payload: SparkAddressData): SparkAddressFormat;
|
|
3019
|
+
declare function encodeSparkAddressWithSignature(payload: SparkAddressData, signature?: Uint8Array): SparkAddressFormat;
|
|
3082
3020
|
declare function decodeSparkAddress(address: string, network: NetworkType): DecodedSparkAddressData;
|
|
3083
3021
|
declare function isValidSparkAddress(address: string): boolean;
|
|
3084
3022
|
declare function isValidPublicKey(publicKey: string): void;
|
|
3085
3023
|
declare function validateSparkInvoiceFields(sparkInvoiceFields: SparkInvoiceFields): void;
|
|
3024
|
+
declare function validateSparkInvoiceSignature(invoice: SparkAddressFormat): void;
|
|
3025
|
+
declare function getNetworkFromSparkAddress(address: SparkAddressFormat): "MAINNET" | "REGTEST" | "SIGNET" | "TESTNET" | "LOCAL";
|
|
3026
|
+
declare function toProtoTimestamp(date: Date): {
|
|
3027
|
+
seconds: number;
|
|
3028
|
+
nanos: number;
|
|
3029
|
+
};
|
|
3030
|
+
declare function bech32mDecode(address: SparkAddressFormat): _scure_base.Bech32Decoded<string>;
|
|
3086
3031
|
|
|
3087
3032
|
type Bech32mTokenIdentifier = `btkn1${string}` | `btknrt1${string}` | `btknt1${string}` | `btkns1${string}` | `btknl1${string}`;
|
|
3088
3033
|
interface Bech32mTokenIdentifierData {
|
|
@@ -3172,7 +3117,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3172
3117
|
protected transferService: TransferService;
|
|
3173
3118
|
protected tracerId: string;
|
|
3174
3119
|
private depositService;
|
|
3175
|
-
private treeCreationService;
|
|
3176
3120
|
private lightningService;
|
|
3177
3121
|
private coopExitService;
|
|
3178
3122
|
private signingService;
|
|
@@ -3273,11 +3217,16 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3273
3217
|
* @private
|
|
3274
3218
|
*/
|
|
3275
3219
|
protected initWallet(mnemonicOrSeed?: Uint8Array | string, accountNumber?: number): Promise<InitWalletResponse | undefined>;
|
|
3220
|
+
/**
|
|
3221
|
+
* Initializes the wallet without a seed. Meant for use with a signer with pre-existing keys.
|
|
3222
|
+
* @private
|
|
3223
|
+
*/
|
|
3224
|
+
protected initWalletWithoutSeed(): Promise<`${string}1${string}`>;
|
|
3276
3225
|
/**
|
|
3277
3226
|
* Initializes a wallet from a seed.
|
|
3278
3227
|
*
|
|
3279
3228
|
* @param {Uint8Array | string} seed - The seed to initialize the wallet from
|
|
3280
|
-
* @returns {Promise<string>} The
|
|
3229
|
+
* @returns {Promise<string>} The Spark address
|
|
3281
3230
|
* @private
|
|
3282
3231
|
*/
|
|
3283
3232
|
private initWalletFromSeed;
|
|
@@ -3344,6 +3293,18 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3344
3293
|
*/
|
|
3345
3294
|
private generateDepositAddress;
|
|
3346
3295
|
queryStaticDepositAddresses(): Promise<string[]>;
|
|
3296
|
+
/**
|
|
3297
|
+
* Returns confirmed UTXOs for a given Spark deposit address.
|
|
3298
|
+
*
|
|
3299
|
+
* @param depositAddress - The deposit address to query.
|
|
3300
|
+
* @param limit - Maximum number of UTXOs to return (default 100).
|
|
3301
|
+
* @param offset - Pagination offset (default 0).
|
|
3302
|
+
* @returns {Promise<{ txid: string, vout: number }[]>} List of confirmed UTXOs.
|
|
3303
|
+
*/
|
|
3304
|
+
getUtxosForDepositAddress(depositAddress: string, limit?: number, offset?: number): Promise<{
|
|
3305
|
+
txid: string;
|
|
3306
|
+
vout: number;
|
|
3307
|
+
}[]>;
|
|
3347
3308
|
/**
|
|
3348
3309
|
* Get a quote on how much credit you can claim for a deposit from the SSP.
|
|
3349
3310
|
*
|
|
@@ -3468,6 +3429,8 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3468
3429
|
* @private
|
|
3469
3430
|
*/
|
|
3470
3431
|
private checkRefreshTimelockNodes;
|
|
3432
|
+
private claimTransferCore;
|
|
3433
|
+
private processClaimedTransferResults;
|
|
3471
3434
|
/**
|
|
3472
3435
|
* Claims a specific transfer.
|
|
3473
3436
|
*
|
|
@@ -3512,6 +3475,10 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3512
3475
|
* @returns {Promise<LightningSendRequest>} The Lightning payment request details
|
|
3513
3476
|
*/
|
|
3514
3477
|
payLightningInvoice({ invoice, maxFeeSats, preferSpark, amountSatsToSend, }: PayLightningInvoiceParams): Promise<LightningSendRequest | WalletTransfer>;
|
|
3478
|
+
fulfillSparkInvoice(sparkInvoices: {
|
|
3479
|
+
invoice: SparkAddressFormat;
|
|
3480
|
+
amount?: bigint;
|
|
3481
|
+
}[]): Promise<string>;
|
|
3515
3482
|
/**
|
|
3516
3483
|
* Gets fee estimate for sending Lightning payments.
|
|
3517
3484
|
*
|
|
@@ -3519,29 +3486,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3519
3486
|
* @returns {Promise<number>} Fee estimate for sending Lightning payments
|
|
3520
3487
|
*/
|
|
3521
3488
|
getLightningSendFeeEstimate({ encodedInvoice, amountSats, }: LightningSendFeeEstimateInput): Promise<number>;
|
|
3522
|
-
/**
|
|
3523
|
-
* Generates a deposit address for a tree.
|
|
3524
|
-
*
|
|
3525
|
-
* @param {number} vout - The vout index
|
|
3526
|
-
* @param {Uint8Array} parentSigningPubKey - The parent signing public key
|
|
3527
|
-
* @param {Transaction} [parentTx] - Optional parent transaction
|
|
3528
|
-
* @param {TreeNode} [parentNode] - Optional parent node
|
|
3529
|
-
* @returns {Promise<Object>} Deposit address information
|
|
3530
|
-
* @private
|
|
3531
|
-
*/
|
|
3532
|
-
private generateDepositAddressForTree;
|
|
3533
|
-
/**
|
|
3534
|
-
* Creates a tree structure.
|
|
3535
|
-
*
|
|
3536
|
-
* @param {number} vout - The vout index
|
|
3537
|
-
* @param {DepositAddressTree} root - The root of the tree
|
|
3538
|
-
* @param {boolean} createLeaves - Whether to create leaves
|
|
3539
|
-
* @param {Transaction} [parentTx] - Optional parent transaction
|
|
3540
|
-
* @param {TreeNode} [parentNode] - Optional parent node
|
|
3541
|
-
* @returns {Promise<Object>} The created tree
|
|
3542
|
-
* @private
|
|
3543
|
-
*/
|
|
3544
|
-
private createTree;
|
|
3545
3489
|
/**
|
|
3546
3490
|
* Initiates a withdrawal to move funds from the Spark network to an on-chain Bitcoin address.
|
|
3547
3491
|
*
|
|
@@ -3760,6 +3704,12 @@ declare class SparkWalletBrowser extends SparkWallet {
|
|
|
3760
3704
|
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
3761
3705
|
}
|
|
3762
3706
|
|
|
3707
|
+
/**
|
|
3708
|
+
* @deprecated Use `SparkWallet.getUtxosForDepositAddress()` instead.
|
|
3709
|
+
* Retrieves the most recent transaction that pays to the given deposit address
|
|
3710
|
+
* by querying the electrs HTTP API. Retained only for backwards compatibility
|
|
3711
|
+
* and will be removed in a future release.
|
|
3712
|
+
*/
|
|
3763
3713
|
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
3764
3714
|
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
3765
3715
|
|
|
@@ -3926,4 +3876,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
|
|
|
3926
3876
|
|
|
3927
3877
|
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
3928
3878
|
|
|
3929
|
-
export { type AggregateFrostParams, AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type IKeyPackage, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, InternalValidationError, LRC_WALLET_NETWORK, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, type SignFrostParams, type SparkAddressData, type SparkAddressFormat, SparkSDKError, type SparkSigner, SparkWalletBrowser as SparkWallet, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, TaprootOutputKeysGenerator, TaprootSparkSigner, type TxChain, UnsafeStatelessSparkSigner, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bigIntToPrivateKey, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createConnectorRefundTransactions, createLeafNodeTx, createNodeTx, createNodeTxs, createRefundTx, createRefundTxs, createRootTx, createSigningCommitment, createSigningNonce, createSplitTx, decodeBech32mTokenIdentifier, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, decodeSparkAddress, doesLeafNeedRefresh, encodeBech32mTokenIdentifier, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, encodeSparkAddress, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenIdentifier, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromBech32mTokenIdentifier, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxEstimatedVbytesSizeByNumberOfInputsOutputs, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, isValidPublicKey, isValidSparkAddress, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, protoToNetwork, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumAvailableTokens, sumOfPrivateKeys, validateOutboundAdaptorSignature, validateShare, validateSparkInvoiceFields };
|
|
3879
|
+
export { type AggregateFrostParams, AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, ConfigurationError, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, DefaultSparkSigner, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, type IKeyPackage, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, InternalValidationError, LRC_WALLET_NETWORK, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, RPCError, type SignFrostParams, type SparkAddressData, type SparkAddressFormat, SparkSDKError, type SparkSigner, SparkWalletBrowser as SparkWallet, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, TaprootOutputKeysGenerator, TaprootSparkSigner, type TxChain, UnsafeStatelessSparkSigner, type Utxo, ValidationError, type VerifiableSecretShare, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, bech32mDecode, bigIntToPrivateKey, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, computerLagrangeCoefficients, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createConnectorRefundTransactions, createLeafNodeTx, createNodeTx, createNodeTxs, createRefundTx, createRefundTxs, createRootTx, createSigningCommitment, createSigningNonce, createSplitTx, decodeBech32mTokenIdentifier, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, decodeSparkAddress, doesLeafNeedRefresh, encodeBech32mTokenIdentifier, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, encodeSparkAddress, encodeSparkAddressWithSignature, evaluatePolynomial, fieldDiv, filterTokenBalanceForTokenIdentifier, generateAdaptorFromSignature, generatePolynomialForSecretSharing, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNetwork, getNetworkFromAddress, getNetworkFromBech32mTokenIdentifier, getNetworkFromSparkAddress, getNetworkFromString, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomBigInt, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxEstimatedVbytesSizeByNumberOfInputsOutputs, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, isValidPublicKey, isValidSparkAddress, lastKeyWithTarget, maybeApplyFee, modInverse, proofOfPossessionMessageHashForDepositAddress, protoToNetwork, recoverSecret, splitSecret, splitSecretWithProofs, subtractPrivateKeys, subtractPublicKeys, sumAvailableTokens, sumOfPrivateKeys, toProtoTimestamp, validateOutboundAdaptorSignature, validateShare, validateSparkInvoiceFields, validateSparkInvoiceSignature };
|