@buildonspark/spark-sdk 0.2.5 → 0.2.6
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 +13 -0
- package/dist/chunk-AVI5E5VT.js +66 -0
- package/dist/{chunk-U7LRIWTF.js → chunk-GUZ3WCB4.js} +313 -143
- package/dist/{client-C88GCTPB.d.cts → client-CusuvuCe.d.cts} +2 -2
- package/dist/{client-Dg6vS_2I.d.ts → client-Dn4Ld8pD.d.ts} +2 -2
- package/dist/debug.cjs +452 -286
- package/dist/debug.d.cts +8 -6
- package/dist/debug.d.ts +8 -6
- package/dist/debug.js +1 -1
- package/dist/graphql/objects/index.d.cts +3 -3
- package/dist/graphql/objects/index.d.ts +3 -3
- package/dist/index.cjs +526 -303
- package/dist/index.d.cts +19 -187
- package/dist/index.d.ts +19 -187
- package/dist/index.js +11 -6
- package/dist/index.node.cjs +451 -328
- package/dist/index.node.d.cts +7 -6
- package/dist/index.node.d.ts +7 -6
- package/dist/index.node.js +55 -98
- package/dist/native/index.cjs +468 -301
- package/dist/native/index.d.cts +37 -18
- package/dist/native/index.d.ts +37 -18
- package/dist/native/index.js +317 -148
- package/dist/proto/lrc20.d.cts +1 -1
- package/dist/proto/lrc20.d.ts +1 -1
- package/dist/proto/spark.d.cts +1 -1
- package/dist/proto/spark.d.ts +1 -1
- package/dist/proto/spark_token.d.cts +1 -1
- package/dist/proto/spark_token.d.ts +1 -1
- package/dist/{spark-ESAfZARg.d.cts → spark-Cj4brrP5.d.cts} +1 -1
- package/dist/{spark-ESAfZARg.d.ts → spark-Cj4brrP5.d.ts} +1 -1
- package/dist/{spark-wallet-B2WwKN8W.d.ts → spark-wallet-B6YthxDI.d.ts} +36 -17
- package/dist/{spark-wallet-Di65w0Us.d.cts → spark-wallet-BbOf2P2l.d.cts} +36 -17
- package/dist/spark-wallet.node-BBk1sGS2.d.cts +12 -0
- package/dist/spark-wallet.node-Bffethig.d.ts +12 -0
- package/dist/tests/test-utils.cjs +78 -50
- package/dist/tests/test-utils.d.cts +24 -23
- package/dist/tests/test-utils.d.ts +24 -23
- package/dist/tests/test-utils.js +2 -2
- package/dist/token-transactions-0_5XMWjs.d.ts +184 -0
- package/dist/token-transactions-CD-Adb5y.d.cts +184 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/{xchain-address-CqRu3F21.d.cts → xchain-address-BnKZ0-dY.d.cts} +5 -5
- package/dist/{xchain-address-BsveIy5l.d.ts → xchain-address-Di3lu4Wy.d.ts} +5 -5
- package/package.json +7 -2
- package/src/index.node.ts +5 -1
- package/src/index.ts +4 -1
- package/src/services/config.ts +13 -2
- package/src/services/token-transactions.ts +22 -8
- package/src/services/wallet-config.ts +22 -13
- package/src/spark-wallet/spark-wallet.browser.ts +72 -0
- package/src/spark-wallet/spark-wallet.node.ts +60 -118
- package/src/spark-wallet/spark-wallet.ts +273 -146
- package/src/tests/integration/ssp/coop-exit-validation.test.ts +233 -0
- package/src/tests/integration/ssp/coop-exit.test.ts +112 -93
- package/src/tests/integration/ssp/static-deposit-validation.test.ts +145 -0
- package/src/tests/integration/ssp/static_deposit.test.ts +439 -132
- package/src/tests/integration/ssp/transfers.test.ts +7 -2
- package/src/tests/integration/static_deposit.test.ts +92 -0
- package/src/tests/integration/transfer.test.ts +1 -1
- package/src/tests/utils/regtest-test-faucet.ts +8 -0
- package/src/tests/utils/spark-testing-wallet.ts +42 -0
- package/src/tests/utils/test-faucet.ts +6 -2
- package/src/utils/token-identifier.ts +47 -4
- package/src/utils/token-transactions.ts +13 -9
- package/dist/chunk-LQZL2D3Y.js +0 -7
- package/dist/spark-wallet.node-7R0Rxyj9.d.cts +0 -13
- package/dist/spark-wallet.node-CSPWOWRu.d.ts +0 -13
package/dist/native/index.d.cts
CHANGED
|
@@ -10,6 +10,7 @@ import { HDKey } from '@scure/bip32';
|
|
|
10
10
|
import { Query } from '@lightsparkdev/core';
|
|
11
11
|
import { Channel } from 'nice-grpc';
|
|
12
12
|
import { Channel as Channel$1 } from 'nice-grpc-web';
|
|
13
|
+
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
13
14
|
import { EventEmitter } from 'eventemitter3';
|
|
14
15
|
|
|
15
16
|
declare class SparkSDKError extends Error {
|
|
@@ -1783,7 +1784,8 @@ interface Bech32mTokenIdentifierData {
|
|
|
1783
1784
|
network: NetworkType;
|
|
1784
1785
|
}
|
|
1785
1786
|
declare function encodeBech32mTokenIdentifier(payload: Bech32mTokenIdentifierData): Bech32mTokenIdentifier;
|
|
1786
|
-
declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network
|
|
1787
|
+
declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network?: NetworkType): Bech32mTokenIdentifierData;
|
|
1788
|
+
declare function getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier): NetworkType;
|
|
1787
1789
|
|
|
1788
1790
|
declare enum TokenTransactionStatus {
|
|
1789
1791
|
TOKEN_TRANSACTION_STARTED = 0,
|
|
@@ -2826,10 +2828,13 @@ type SigningOperator = {
|
|
|
2826
2828
|
readonly address: string;
|
|
2827
2829
|
readonly identityPublicKey: string;
|
|
2828
2830
|
};
|
|
2831
|
+
type ConsoleOptions = {
|
|
2832
|
+
otel?: boolean;
|
|
2833
|
+
};
|
|
2829
2834
|
type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
|
|
2830
2835
|
readonly network?: NetworkType;
|
|
2831
2836
|
readonly signingOperators?: Readonly<Record<string, SigningOperator>>;
|
|
2832
|
-
readonly
|
|
2837
|
+
readonly coordinatorIdentifier?: string;
|
|
2833
2838
|
readonly frostSignerAddress?: string;
|
|
2834
2839
|
readonly lrc20Address?: string;
|
|
2835
2840
|
readonly threshold?: number;
|
|
@@ -2841,6 +2846,7 @@ type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
|
|
|
2841
2846
|
readonly sspClientOptions?: SspClientOptions;
|
|
2842
2847
|
readonly expectedWithdrawBondSats?: number;
|
|
2843
2848
|
readonly expectedWithdrawRelativeBlockLocktime?: number;
|
|
2849
|
+
readonly console?: ConsoleOptions;
|
|
2844
2850
|
};
|
|
2845
2851
|
declare const WalletConfig: {
|
|
2846
2852
|
LOCAL: Required<ConfigOptions>;
|
|
@@ -2941,7 +2947,7 @@ interface SparkWalletEvents {
|
|
|
2941
2947
|
|
|
2942
2948
|
declare function sumAvailableTokens(outputs: OutputWithPreviousTransactionData$1[]): bigint;
|
|
2943
2949
|
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData$1[], tokenOutputs: TokenOutputsMap, tokenIdentifier: Bech32mTokenIdentifier): boolean;
|
|
2944
|
-
declare function
|
|
2950
|
+
declare function filterTokenBalanceForTokenIdentifier(tokenBalances: TokenBalanceMap, tokenIdentifier: Bech32mTokenIdentifier): {
|
|
2945
2951
|
balance: bigint;
|
|
2946
2952
|
};
|
|
2947
2953
|
|
|
@@ -3088,7 +3094,9 @@ declare class WalletConfigService implements HasLrc20WalletApiConfig, HasSspClie
|
|
|
3088
3094
|
getTokenTransactionVersion(): "V0" | "V1";
|
|
3089
3095
|
getTokenValidityDurationSeconds(): number;
|
|
3090
3096
|
getElectrsUrl(): string;
|
|
3097
|
+
getSspBaseUrl(): string;
|
|
3091
3098
|
getSspIdentityPublicKey(): string;
|
|
3099
|
+
getConsoleOptions(): ConsoleOptions;
|
|
3092
3100
|
}
|
|
3093
3101
|
|
|
3094
3102
|
declare enum InterruptTransferRequest_InterruptTransferAction {
|
|
@@ -3305,7 +3313,7 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3305
3313
|
protected tokenMetadata: TokenMetadataMap;
|
|
3306
3314
|
protected tokenOutputs: TokenOutputsMap;
|
|
3307
3315
|
private claimTransfersInterval;
|
|
3308
|
-
|
|
3316
|
+
private tracer;
|
|
3309
3317
|
protected constructor(options?: ConfigOptions, signer?: SparkSigner);
|
|
3310
3318
|
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
3311
3319
|
mnemonic?: string | undefined;
|
|
@@ -3385,17 +3393,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3385
3393
|
* Processes a single batch of leaves for swapping.
|
|
3386
3394
|
*/
|
|
3387
3395
|
private processSwapBatch;
|
|
3388
|
-
/**
|
|
3389
|
-
* Gets all transfers for the wallet.
|
|
3390
|
-
*
|
|
3391
|
-
* @param {number} [limit=20] - Maximum number of transfers to return
|
|
3392
|
-
* @param {number} [offset=0] - Offset for pagination
|
|
3393
|
-
* @returns {Promise<QueryTransfersResponse>} Response containing the list of transfers
|
|
3394
|
-
*/
|
|
3395
|
-
getTransfers(limit?: number, offset?: number): Promise<{
|
|
3396
|
-
transfers: WalletTransfer[];
|
|
3397
|
-
offset: number;
|
|
3398
|
-
}>;
|
|
3399
3396
|
/**
|
|
3400
3397
|
* Gets the current balance of the wallet.
|
|
3401
3398
|
* You can use the forceRefetch option to synchronize your wallet and claim any
|
|
@@ -3682,6 +3679,7 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3682
3679
|
* @returns {Promise<TransferWithUserRequest | undefined>} The transfer
|
|
3683
3680
|
*/
|
|
3684
3681
|
getTransferFromSsp(id: string): Promise<TransferWithUserRequest | undefined>;
|
|
3682
|
+
private constructTransfersWithUserRequest;
|
|
3685
3683
|
/**
|
|
3686
3684
|
* Gets a transfer, that the wallet is a participant of, in the Spark network.
|
|
3687
3685
|
* Only contains data about the spark->spark transfer, use getTransferFromSsp if you're
|
|
@@ -3691,6 +3689,17 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3691
3689
|
* @returns {Promise<Transfer | undefined>} The transfer
|
|
3692
3690
|
*/
|
|
3693
3691
|
getTransfer(id: string): Promise<WalletTransfer | undefined>;
|
|
3692
|
+
/**
|
|
3693
|
+
* Gets all transfers for the wallet.
|
|
3694
|
+
*
|
|
3695
|
+
* @param {number} [limit=20] - Maximum number of transfers to return
|
|
3696
|
+
* @param {number} [offset=0] - Offset for pagination
|
|
3697
|
+
* @returns {Promise<QueryTransfersResponse>} Response containing the list of transfers
|
|
3698
|
+
*/
|
|
3699
|
+
getTransfers(limit?: number, offset?: number): Promise<{
|
|
3700
|
+
transfers: WalletTransfer[];
|
|
3701
|
+
offset: number;
|
|
3702
|
+
}>;
|
|
3694
3703
|
/**
|
|
3695
3704
|
* Synchronizes token outputs for the wallet.
|
|
3696
3705
|
*
|
|
@@ -3822,6 +3831,16 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3822
3831
|
private startPeriodicClaimTransfers;
|
|
3823
3832
|
private updateLeaves;
|
|
3824
3833
|
private queryNodes;
|
|
3834
|
+
protected getOtelTraceUrls(): string[];
|
|
3835
|
+
protected initializeTracer(wallet: SparkWallet): void;
|
|
3836
|
+
protected initializeTracerEnv({ spanProcessors, traceUrls, }: {
|
|
3837
|
+
spanProcessors: SpanProcessor[];
|
|
3838
|
+
traceUrls: string[];
|
|
3839
|
+
}): void;
|
|
3840
|
+
protected wrapWithOtelSpan<A extends unknown[], R>(name: string, fn: (...args: A) => Promise<R>): (...args: A) => Promise<R>;
|
|
3841
|
+
protected getTraceName(methodName: string): string;
|
|
3842
|
+
private wrapPublicSparkWalletMethodWithOtelSpan;
|
|
3843
|
+
private wrapSparkWalletMethodsWithTracing;
|
|
3825
3844
|
}
|
|
3826
3845
|
|
|
3827
3846
|
interface FetchOwnedTokenOutputsParams {
|
|
@@ -3835,8 +3854,8 @@ interface QueryTokenTransactionsParams {
|
|
|
3835
3854
|
tokenTransactionHashes?: string[];
|
|
3836
3855
|
tokenIdentifiers?: string[];
|
|
3837
3856
|
outputIds?: string[];
|
|
3838
|
-
pageSize
|
|
3839
|
-
offset
|
|
3857
|
+
pageSize?: number;
|
|
3858
|
+
offset?: number;
|
|
3840
3859
|
}
|
|
3841
3860
|
declare class TokenTransactionService {
|
|
3842
3861
|
protected readonly config: WalletConfigService;
|
|
@@ -3878,4 +3897,4 @@ declare class TokenTransactionService {
|
|
|
3878
3897
|
private createSignaturesForOperators;
|
|
3879
3898
|
}
|
|
3880
3899
|
|
|
3881
|
-
export { AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, type ConfigOptions, ConfigurationError, ConnectionManager, type CreateLightningInvoiceParams, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, ReactNativeSparkSigner as DefaultSparkSigner, type DepositParams, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, type InitWalletResponse, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, type PayLightningInvoiceParams, RPCError, type RawTokenIdentifierHex, ReactNativeSparkSigner, type SparkAddressData, type SparkAddressFormat, SparkSDKError, SparkWallet, type SparkWalletEvents, type SparkWalletProps, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, type TokenBalanceMap, type TokenMetadataMap, type TokenOutputsMap, TokenTransactionService, type TransferParams, type TxChain, type UserTokenMetadata, type Utxo, ValidationError, type VerifiableSecretShare, WalletConfig, WalletConfigService, 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,
|
|
3900
|
+
export { AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, type ConfigOptions, ConfigurationError, ConnectionManager, type CreateLightningInvoiceParams, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, ReactNativeSparkSigner as DefaultSparkSigner, type DepositParams, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, type InitWalletResponse, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, type PayLightningInvoiceParams, RPCError, type RawTokenIdentifierHex, ReactNativeSparkSigner, type SparkAddressData, type SparkAddressFormat, SparkSDKError, SparkWallet, type SparkWalletEvents, type SparkWalletProps, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, type TokenBalanceMap, type TokenMetadataMap, type TokenOutputsMap, TokenTransactionService, type TransferParams, type TxChain, type UserTokenMetadata, type Utxo, ValidationError, type VerifiableSecretShare, WalletConfig, WalletConfigService, 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 };
|
package/dist/native/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { HDKey } from '@scure/bip32';
|
|
|
10
10
|
import { Query } from '@lightsparkdev/core';
|
|
11
11
|
import { Channel } from 'nice-grpc';
|
|
12
12
|
import { Channel as Channel$1 } from 'nice-grpc-web';
|
|
13
|
+
import { SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
13
14
|
import { EventEmitter } from 'eventemitter3';
|
|
14
15
|
|
|
15
16
|
declare class SparkSDKError extends Error {
|
|
@@ -1783,7 +1784,8 @@ interface Bech32mTokenIdentifierData {
|
|
|
1783
1784
|
network: NetworkType;
|
|
1784
1785
|
}
|
|
1785
1786
|
declare function encodeBech32mTokenIdentifier(payload: Bech32mTokenIdentifierData): Bech32mTokenIdentifier;
|
|
1786
|
-
declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network
|
|
1787
|
+
declare function decodeBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier, network?: NetworkType): Bech32mTokenIdentifierData;
|
|
1788
|
+
declare function getNetworkFromBech32mTokenIdentifier(bech32mTokenIdentifier: Bech32mTokenIdentifier): NetworkType;
|
|
1787
1789
|
|
|
1788
1790
|
declare enum TokenTransactionStatus {
|
|
1789
1791
|
TOKEN_TRANSACTION_STARTED = 0,
|
|
@@ -2826,10 +2828,13 @@ type SigningOperator = {
|
|
|
2826
2828
|
readonly address: string;
|
|
2827
2829
|
readonly identityPublicKey: string;
|
|
2828
2830
|
};
|
|
2831
|
+
type ConsoleOptions = {
|
|
2832
|
+
otel?: boolean;
|
|
2833
|
+
};
|
|
2829
2834
|
type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
|
|
2830
2835
|
readonly network?: NetworkType;
|
|
2831
2836
|
readonly signingOperators?: Readonly<Record<string, SigningOperator>>;
|
|
2832
|
-
readonly
|
|
2837
|
+
readonly coordinatorIdentifier?: string;
|
|
2833
2838
|
readonly frostSignerAddress?: string;
|
|
2834
2839
|
readonly lrc20Address?: string;
|
|
2835
2840
|
readonly threshold?: number;
|
|
@@ -2841,6 +2846,7 @@ type ConfigOptions = MayHaveLrc20WalletApiConfig & MayHaveSspClientOptions & {
|
|
|
2841
2846
|
readonly sspClientOptions?: SspClientOptions;
|
|
2842
2847
|
readonly expectedWithdrawBondSats?: number;
|
|
2843
2848
|
readonly expectedWithdrawRelativeBlockLocktime?: number;
|
|
2849
|
+
readonly console?: ConsoleOptions;
|
|
2844
2850
|
};
|
|
2845
2851
|
declare const WalletConfig: {
|
|
2846
2852
|
LOCAL: Required<ConfigOptions>;
|
|
@@ -2941,7 +2947,7 @@ interface SparkWalletEvents {
|
|
|
2941
2947
|
|
|
2942
2948
|
declare function sumAvailableTokens(outputs: OutputWithPreviousTransactionData$1[]): bigint;
|
|
2943
2949
|
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData$1[], tokenOutputs: TokenOutputsMap, tokenIdentifier: Bech32mTokenIdentifier): boolean;
|
|
2944
|
-
declare function
|
|
2950
|
+
declare function filterTokenBalanceForTokenIdentifier(tokenBalances: TokenBalanceMap, tokenIdentifier: Bech32mTokenIdentifier): {
|
|
2945
2951
|
balance: bigint;
|
|
2946
2952
|
};
|
|
2947
2953
|
|
|
@@ -3088,7 +3094,9 @@ declare class WalletConfigService implements HasLrc20WalletApiConfig, HasSspClie
|
|
|
3088
3094
|
getTokenTransactionVersion(): "V0" | "V1";
|
|
3089
3095
|
getTokenValidityDurationSeconds(): number;
|
|
3090
3096
|
getElectrsUrl(): string;
|
|
3097
|
+
getSspBaseUrl(): string;
|
|
3091
3098
|
getSspIdentityPublicKey(): string;
|
|
3099
|
+
getConsoleOptions(): ConsoleOptions;
|
|
3092
3100
|
}
|
|
3093
3101
|
|
|
3094
3102
|
declare enum InterruptTransferRequest_InterruptTransferAction {
|
|
@@ -3305,7 +3313,7 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3305
3313
|
protected tokenMetadata: TokenMetadataMap;
|
|
3306
3314
|
protected tokenOutputs: TokenOutputsMap;
|
|
3307
3315
|
private claimTransfersInterval;
|
|
3308
|
-
|
|
3316
|
+
private tracer;
|
|
3309
3317
|
protected constructor(options?: ConfigOptions, signer?: SparkSigner);
|
|
3310
3318
|
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
3311
3319
|
mnemonic?: string | undefined;
|
|
@@ -3385,17 +3393,6 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3385
3393
|
* Processes a single batch of leaves for swapping.
|
|
3386
3394
|
*/
|
|
3387
3395
|
private processSwapBatch;
|
|
3388
|
-
/**
|
|
3389
|
-
* Gets all transfers for the wallet.
|
|
3390
|
-
*
|
|
3391
|
-
* @param {number} [limit=20] - Maximum number of transfers to return
|
|
3392
|
-
* @param {number} [offset=0] - Offset for pagination
|
|
3393
|
-
* @returns {Promise<QueryTransfersResponse>} Response containing the list of transfers
|
|
3394
|
-
*/
|
|
3395
|
-
getTransfers(limit?: number, offset?: number): Promise<{
|
|
3396
|
-
transfers: WalletTransfer[];
|
|
3397
|
-
offset: number;
|
|
3398
|
-
}>;
|
|
3399
3396
|
/**
|
|
3400
3397
|
* Gets the current balance of the wallet.
|
|
3401
3398
|
* You can use the forceRefetch option to synchronize your wallet and claim any
|
|
@@ -3682,6 +3679,7 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3682
3679
|
* @returns {Promise<TransferWithUserRequest | undefined>} The transfer
|
|
3683
3680
|
*/
|
|
3684
3681
|
getTransferFromSsp(id: string): Promise<TransferWithUserRequest | undefined>;
|
|
3682
|
+
private constructTransfersWithUserRequest;
|
|
3685
3683
|
/**
|
|
3686
3684
|
* Gets a transfer, that the wallet is a participant of, in the Spark network.
|
|
3687
3685
|
* Only contains data about the spark->spark transfer, use getTransferFromSsp if you're
|
|
@@ -3691,6 +3689,17 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3691
3689
|
* @returns {Promise<Transfer | undefined>} The transfer
|
|
3692
3690
|
*/
|
|
3693
3691
|
getTransfer(id: string): Promise<WalletTransfer | undefined>;
|
|
3692
|
+
/**
|
|
3693
|
+
* Gets all transfers for the wallet.
|
|
3694
|
+
*
|
|
3695
|
+
* @param {number} [limit=20] - Maximum number of transfers to return
|
|
3696
|
+
* @param {number} [offset=0] - Offset for pagination
|
|
3697
|
+
* @returns {Promise<QueryTransfersResponse>} Response containing the list of transfers
|
|
3698
|
+
*/
|
|
3699
|
+
getTransfers(limit?: number, offset?: number): Promise<{
|
|
3700
|
+
transfers: WalletTransfer[];
|
|
3701
|
+
offset: number;
|
|
3702
|
+
}>;
|
|
3694
3703
|
/**
|
|
3695
3704
|
* Synchronizes token outputs for the wallet.
|
|
3696
3705
|
*
|
|
@@ -3822,6 +3831,16 @@ declare class SparkWallet extends EventEmitter {
|
|
|
3822
3831
|
private startPeriodicClaimTransfers;
|
|
3823
3832
|
private updateLeaves;
|
|
3824
3833
|
private queryNodes;
|
|
3834
|
+
protected getOtelTraceUrls(): string[];
|
|
3835
|
+
protected initializeTracer(wallet: SparkWallet): void;
|
|
3836
|
+
protected initializeTracerEnv({ spanProcessors, traceUrls, }: {
|
|
3837
|
+
spanProcessors: SpanProcessor[];
|
|
3838
|
+
traceUrls: string[];
|
|
3839
|
+
}): void;
|
|
3840
|
+
protected wrapWithOtelSpan<A extends unknown[], R>(name: string, fn: (...args: A) => Promise<R>): (...args: A) => Promise<R>;
|
|
3841
|
+
protected getTraceName(methodName: string): string;
|
|
3842
|
+
private wrapPublicSparkWalletMethodWithOtelSpan;
|
|
3843
|
+
private wrapSparkWalletMethodsWithTracing;
|
|
3825
3844
|
}
|
|
3826
3845
|
|
|
3827
3846
|
interface FetchOwnedTokenOutputsParams {
|
|
@@ -3835,8 +3854,8 @@ interface QueryTokenTransactionsParams {
|
|
|
3835
3854
|
tokenTransactionHashes?: string[];
|
|
3836
3855
|
tokenIdentifiers?: string[];
|
|
3837
3856
|
outputIds?: string[];
|
|
3838
|
-
pageSize
|
|
3839
|
-
offset
|
|
3857
|
+
pageSize?: number;
|
|
3858
|
+
offset?: number;
|
|
3840
3859
|
}
|
|
3841
3860
|
declare class TokenTransactionService {
|
|
3842
3861
|
protected readonly config: WalletConfigService;
|
|
@@ -3878,4 +3897,4 @@ declare class TokenTransactionService {
|
|
|
3878
3897
|
private createSignaturesForOperators;
|
|
3879
3898
|
}
|
|
3880
3899
|
|
|
3881
|
-
export { AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, type ConfigOptions, ConfigurationError, ConnectionManager, type CreateLightningInvoiceParams, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, ReactNativeSparkSigner as DefaultSparkSigner, type DepositParams, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, type InitWalletResponse, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, type PayLightningInvoiceParams, RPCError, type RawTokenIdentifierHex, ReactNativeSparkSigner, type SparkAddressData, type SparkAddressFormat, SparkSDKError, SparkWallet, type SparkWalletEvents, type SparkWalletProps, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, type TokenBalanceMap, type TokenMetadataMap, type TokenOutputsMap, TokenTransactionService, type TransferParams, type TxChain, type UserTokenMetadata, type Utxo, ValidationError, type VerifiableSecretShare, WalletConfig, WalletConfigService, 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,
|
|
3900
|
+
export { AuthenticationError, type Bech32mTokenIdentifier, type Bech32mTokenIdentifierData, type BroadcastConfig, type BroadcastResult, type ConfigOptions, ConfigurationError, ConnectionManager, type CreateLightningInvoiceParams, DEFAULT_FEE_SATS, DIRECT_TIMELOCK_OFFSET, type DecodedSparkAddressData, ReactNativeSparkSigner as DefaultSparkSigner, type DepositParams, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, INITIAL_DIRECT_SEQUENCE, INITIAL_SEQUENCE, type InitWalletResponse, InternalValidationError, LRC_WALLET_NETWORK, LRC_WALLET_NETWORK_TYPE, type LeafInfo, Network, NetworkError, NetworkToProto, type NetworkType, NotImplementedError, type PayLightningInvoiceParams, RPCError, type RawTokenIdentifierHex, ReactNativeSparkSigner, type SparkAddressData, type SparkAddressFormat, SparkSDKError, SparkWallet, type SparkWalletEvents, type SparkWalletProps, TEST_UNILATERAL_DIRECT_SEQUENCE, TEST_UNILATERAL_SEQUENCE, type TokenBalanceMap, type TokenMetadataMap, type TokenOutputsMap, TokenTransactionService, type TransferParams, type TxChain, type UserTokenMetadata, type Utxo, ValidationError, type VerifiableSecretShare, WalletConfig, WalletConfigService, 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 };
|