@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/index.d.cts
CHANGED
|
@@ -1,200 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.cjs';
|
|
1
|
+
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-CD-Adb5y.cjs';
|
|
2
|
+
import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-BbOf2P2l.cjs';
|
|
3
|
+
export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, s as CreateLightningInvoiceParams, D as DecodedSparkAddressData, t as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, y as SparkWalletEvents, u as TokenBalanceMap, w as TokenMetadataMap, v as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, r as getNetworkFromBech32mTokenIdentifier, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-BbOf2P2l.cjs';
|
|
4
|
+
export { ab as BroadcastConfig, ac as BroadcastResult, Q as DEFAULT_FEE_SATS, M as DIRECT_TIMELOCK_OFFSET, a9 as FeeBumpTxChain, a8 as FeeBumpTxPackage, a7 as FeeRate, O as INITIAL_DIRECT_SEQUENCE, N as INITIAL_SEQUENCE, a5 as LeafInfo, P as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, aa as TxChain, a6 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a1 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, ag as constructFeeBumpTx, af as constructUnilateralExitFeeBumpPackages, ae as constructUnilateralExitTxs, _ as createConnectorRefundTransactions, X as createLeafNodeTx, V as createNodeTx, W as createNodeTxs, Y as createRefundTx, Z as createRefundTxs, S as createRootTx, F as createSigningCommitment, B as createSigningNonce, U as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a2 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, $ as getCurrentTimelock, a4 as getEphemeralAnchorOutput, w as getLatestDepositTxId, a3 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ah as getSparkAddressFromTaproot, a0 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ad as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, R as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-BnKZ0-dY.cjs';
|
|
5
|
+
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-CusuvuCe.cjs';
|
|
7
6
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
8
7
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
8
|
+
import './spark-Cj4brrP5.cjs';
|
|
9
|
+
import '@bufbuild/protobuf/wire';
|
|
10
|
+
import 'nice-grpc-common';
|
|
11
|
+
import './proto/spark_token.cjs';
|
|
9
12
|
import '@scure/btc-signer';
|
|
10
13
|
import 'bitcoinjs-lib';
|
|
11
14
|
import 'nice-grpc';
|
|
12
15
|
import 'nice-grpc-web';
|
|
13
|
-
import '@
|
|
14
|
-
import 'nice-grpc-common';
|
|
16
|
+
import '@opentelemetry/sdk-trace-base';
|
|
15
17
|
import 'eventemitter3';
|
|
16
18
|
import '@scure/btc-signer/psbt';
|
|
17
19
|
import '@lightsparkdev/core';
|
|
18
20
|
import '@scure/bip32';
|
|
19
21
|
import './types-BADxR3bm.cjs';
|
|
20
22
|
|
|
21
|
-
declare class
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* NetworkError should be used for any errors related to network communication,
|
|
31
|
-
* such as failed HTTP requests, timeouts, or connection issues.
|
|
32
|
-
* This includes:
|
|
33
|
-
* - Failed API calls
|
|
34
|
-
* - Network timeouts
|
|
35
|
-
* - Connection refused
|
|
36
|
-
* - DNS resolution failures
|
|
37
|
-
* - SSL/TLS errors
|
|
38
|
-
*/
|
|
39
|
-
declare class NetworkError extends SparkSDKError {
|
|
40
|
-
constructor(message: string, context?: {
|
|
41
|
-
url?: string;
|
|
42
|
-
method?: string;
|
|
43
|
-
statusCode?: number;
|
|
44
|
-
response?: unknown;
|
|
45
|
-
errorCount?: number;
|
|
46
|
-
errors?: string;
|
|
47
|
-
operation?: string;
|
|
48
|
-
nodeSignaturesCount?: number;
|
|
49
|
-
}, originalError?: Error);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* ValidationError should be used for any errors related to data validation in regards to the user's input,
|
|
53
|
-
* This includes:
|
|
54
|
-
* - Invalid signatures
|
|
55
|
-
* - Malformed addresses
|
|
56
|
-
* - Invalid proof of possession
|
|
57
|
-
* - Invalid cryptographic parameters
|
|
58
|
-
* - Data format validation failures
|
|
59
|
-
*/
|
|
60
|
-
declare class ValidationError extends SparkSDKError {
|
|
61
|
-
constructor(message: string, context?: {
|
|
62
|
-
field?: string;
|
|
63
|
-
value?: unknown;
|
|
64
|
-
expected?: unknown;
|
|
65
|
-
expectedLength?: number;
|
|
66
|
-
actualLength?: number;
|
|
67
|
-
rValue?: bigint;
|
|
68
|
-
fieldPrime?: bigint;
|
|
69
|
-
sValue?: bigint;
|
|
70
|
-
groupOrder?: bigint;
|
|
71
|
-
index?: number;
|
|
72
|
-
treeLength?: number;
|
|
73
|
-
addressNodesLength?: number;
|
|
74
|
-
}, originalError?: Error);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* InternalValidationError should be used for any errors related to internal data validation
|
|
78
|
-
* that is not related to the user's input.
|
|
79
|
-
* This includes:
|
|
80
|
-
* - Invalid SO responses
|
|
81
|
-
*/
|
|
82
|
-
declare class InternalValidationError extends SparkSDKError {
|
|
83
|
-
constructor(message: string, context?: {
|
|
84
|
-
field?: string;
|
|
85
|
-
value?: unknown;
|
|
86
|
-
expected?: unknown;
|
|
87
|
-
outputIndex?: number;
|
|
88
|
-
keyshareInfo?: unknown;
|
|
89
|
-
signingOperators?: unknown;
|
|
90
|
-
}, originalError?: Error);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* AuthenticationError should be used specifically for authentication and authorization failures,
|
|
94
|
-
* such as invalid credentials or insufficient permissions.
|
|
95
|
-
* This includes:
|
|
96
|
-
* - Invalid API keys
|
|
97
|
-
* - Expired tokens
|
|
98
|
-
* - Insufficient permissions
|
|
99
|
-
* - Authentication token validation failures
|
|
100
|
-
* - Authorization failures
|
|
101
|
-
*/
|
|
102
|
-
declare class AuthenticationError extends SparkSDKError {
|
|
103
|
-
constructor(message: string, context?: {
|
|
104
|
-
endpoint?: string;
|
|
105
|
-
reason?: string;
|
|
106
|
-
}, originalError?: Error);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
|
|
110
|
-
* such as invalid RPC parameters or RPC-specific failures.
|
|
111
|
-
* This includes:
|
|
112
|
-
* - Invalid RPC method calls
|
|
113
|
-
* - RPC parameter validation failures
|
|
114
|
-
* - RPC-specific error codes
|
|
115
|
-
* - RPC protocol errors
|
|
116
|
-
*/
|
|
117
|
-
declare class RPCError extends SparkSDKError {
|
|
118
|
-
constructor(message: string, context?: {
|
|
119
|
-
method?: string;
|
|
120
|
-
params?: unknown;
|
|
121
|
-
code?: number;
|
|
122
|
-
}, originalError?: Error);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* ConfigurationError should be used for errors related to SDK configuration,
|
|
126
|
-
* such as missing or invalid configuration values.
|
|
127
|
-
* This includes:
|
|
128
|
-
* - Missing required configuration
|
|
129
|
-
* - Invalid configuration values
|
|
130
|
-
* - Configuration format errors
|
|
131
|
-
* - Environment-specific configuration issues
|
|
132
|
-
*/
|
|
133
|
-
declare class ConfigurationError extends SparkSDKError {
|
|
134
|
-
constructor(message: string, context?: {
|
|
135
|
-
configKey?: string;
|
|
136
|
-
value?: unknown;
|
|
137
|
-
}, originalError?: Error);
|
|
138
|
-
}
|
|
139
|
-
/***
|
|
140
|
-
* NotImplementedError should be used for any errors related to features that are not yet implemented.
|
|
141
|
-
*/
|
|
142
|
-
declare class NotImplementedError extends SparkSDKError {
|
|
143
|
-
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface FetchOwnedTokenOutputsParams {
|
|
147
|
-
ownerPublicKeys: Uint8Array[];
|
|
148
|
-
issuerPublicKeys?: Uint8Array[];
|
|
149
|
-
tokenIdentifiers?: Uint8Array[];
|
|
150
|
-
}
|
|
151
|
-
interface QueryTokenTransactionsParams {
|
|
152
|
-
ownerPublicKeys?: string[];
|
|
153
|
-
issuerPublicKeys?: string[];
|
|
154
|
-
tokenTransactionHashes?: string[];
|
|
155
|
-
tokenIdentifiers?: string[];
|
|
156
|
-
outputIds?: string[];
|
|
157
|
-
pageSize: number;
|
|
158
|
-
offset: number;
|
|
159
|
-
}
|
|
160
|
-
declare class TokenTransactionService {
|
|
161
|
-
protected readonly config: WalletConfigService;
|
|
162
|
-
protected readonly connectionManager: ConnectionManager;
|
|
163
|
-
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
164
|
-
tokenTransfer(tokenOutputs: TokenOutputsMap, receiverOutputs: {
|
|
165
|
-
tokenIdentifier: Bech32mTokenIdentifier;
|
|
166
|
-
tokenAmount: bigint;
|
|
167
|
-
receiverSparkAddress: string;
|
|
168
|
-
}[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
169
|
-
constructTransferTokenTransactionV0(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
170
|
-
receiverSparkAddress: Uint8Array;
|
|
171
|
-
tokenPublicKey: Uint8Array;
|
|
172
|
-
tokenAmount: bigint;
|
|
173
|
-
}>): Promise<TokenTransaction>;
|
|
174
|
-
constructTransferTokenTransaction(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
175
|
-
receiverSparkAddress: Uint8Array;
|
|
176
|
-
rawTokenIdentifier: Uint8Array;
|
|
177
|
-
tokenAmount: bigint;
|
|
178
|
-
}>): Promise<TokenTransaction$1>;
|
|
179
|
-
collectOperatorIdentityPublicKeys(): Uint8Array[];
|
|
180
|
-
broadcastTokenTransaction(tokenTransaction: TokenTransaction | TokenTransaction$1, outputsToSpendSigningPublicKeys?: Uint8Array[], outputsToSpendCommitments?: Uint8Array[]): Promise<string>;
|
|
181
|
-
private broadcastTokenTransactionV0;
|
|
182
|
-
private broadcastTokenTransactionV1;
|
|
183
|
-
private startTokenTransactionV0;
|
|
184
|
-
private startTokenTransaction;
|
|
185
|
-
private signTokenTransactionV0;
|
|
186
|
-
private signTokenTransaction;
|
|
187
|
-
fetchOwnedTokenOutputs(params: FetchOwnedTokenOutputsParams): Promise<OutputWithPreviousTransactionData[]>;
|
|
188
|
-
queryTokenTransactions(params: QueryTokenTransactionsParams): Promise<TokenTransactionWithStatus[] | TokenTransactionWithStatus$1[]>;
|
|
189
|
-
private fetchOwnedTokenOutputsV0;
|
|
190
|
-
private fetchOwnedTokenOutputsV1;
|
|
191
|
-
private queryTokenTransactionsV0;
|
|
192
|
-
private queryTokenTransactionsV1;
|
|
193
|
-
selectTokenOutputs(tokenOutputs: OutputWithPreviousTransactionData[], tokenAmount: bigint, strategy: "SMALL_FIRST" | "LARGE_FIRST"): OutputWithPreviousTransactionData[];
|
|
194
|
-
private sortTokenOutputsByStrategy;
|
|
195
|
-
private signMessageWithKey;
|
|
196
|
-
private finalizeTokenTransaction;
|
|
197
|
-
private createSignaturesForOperators;
|
|
198
|
-
}
|
|
23
|
+
declare class SparkWalletBrowser extends SparkWallet {
|
|
24
|
+
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
25
|
+
mnemonic?: string | undefined;
|
|
26
|
+
wallet: SparkWalletBrowser;
|
|
27
|
+
}>;
|
|
28
|
+
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
29
|
+
}
|
|
30
|
+
declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
199
31
|
|
|
200
|
-
export {
|
|
32
|
+
export { SparkWalletBrowser as SparkWallet, SparkWalletProps, initializeTracerEnvBrowser as initializeTracerEnv };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,200 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
|
|
6
|
-
import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.js';
|
|
1
|
+
export { A as AuthenticationError, C as ConfigurationError, I as InternalValidationError, N as NetworkError, a as NotImplementedError, R as RPCError, S as SparkSDKError, T as TokenTransactionService, V as ValidationError } from './token-transactions-0_5XMWjs.js';
|
|
2
|
+
import { z as SparkWallet, x as SparkWalletProps } from './spark-wallet-B6YthxDI.js';
|
|
3
|
+
export { B as Bech32mTokenIdentifier, n as Bech32mTokenIdentifierData, b as ConfigOptions, C as ConnectionManager, s as CreateLightningInvoiceParams, D as DecodedSparkAddressData, t as DepositParams, I as InitWalletResponse, L as LRC_WALLET_NETWORK, k as LRC_WALLET_NETWORK_TYPE, N as Network, h as NetworkToProto, g as NetworkType, P as PayLightningInvoiceParams, R as RawTokenIdentifierHex, c as SparkAddressData, S as SparkAddressFormat, y as SparkWalletEvents, u as TokenBalanceMap, w as TokenMetadataMap, v as TokenOutputsMap, T as TransferParams, U as UserTokenMetadata, a as WalletConfig, W as WalletConfigService, q as decodeBech32mTokenIdentifier, d as decodeSparkAddress, o as encodeBech32mTokenIdentifier, e as encodeSparkAddress, j as getNetwork, l as getNetworkFromAddress, r as getNetworkFromBech32mTokenIdentifier, m as getNetworkFromString, f as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-B6YthxDI.js';
|
|
4
|
+
export { ab as BroadcastConfig, ac as BroadcastResult, Q as DEFAULT_FEE_SATS, M as DIRECT_TIMELOCK_OFFSET, a9 as FeeBumpTxChain, a8 as FeeBumpTxPackage, a7 as FeeRate, O as INITIAL_DIRECT_SEQUENCE, N as INITIAL_SEQUENCE, a5 as LeafInfo, P as TEST_UNILATERAL_DIRECT_SEQUENCE, T as TEST_UNILATERAL_SEQUENCE, aa as TxChain, a6 as Utxo, q as addPrivateKeys, o as addPublicKeys, b as applyAdaptorToSignature, p as applyAdditiveTweakToPublicKey, J as checkIfSelectedOutputsAreAvailable, a1 as checkIfValidSequence, z as collectResponses, c as computeTaprootKeyNoScript, ag as constructFeeBumpTx, af as constructUnilateralExitFeeBumpPackages, ae as constructUnilateralExitTxs, _ as createConnectorRefundTransactions, X as createLeafNodeTx, V as createNodeTx, W as createNodeTxs, Y as createRefundTx, Z as createRefundTxs, S as createRootTx, F as createSigningCommitment, B as createSigningNonce, U as createSplitTx, H as decodeBytesToSigningCommitment, E as decodeBytesToSigningNonce, a2 as doesLeafNeedRefresh, G as encodeSigningCommitmentToBytes, D as encodeSigningNonceToBytes, K as filterTokenBalanceForTokenIdentifier, a as generateAdaptorFromSignature, g as generateSignatureFromExistingAdaptor, $ as getCurrentTimelock, a4 as getEphemeralAnchorOutput, w as getLatestDepositTxId, a3 as getNextTransactionSequence, f as getP2TRAddressFromPkScript, e as getP2TRAddressFromPublicKey, d as getP2TRScriptFromPublicKey, h as getP2WPKHAddressFromPublicKey, A as getRandomSigningNonce, k as getSigHashFromTx, C as getSigningCommitmentFromNonce, ah as getSparkAddressFromTaproot, a0 as getTransactionSequence, L as getTransferPackageSigningPayload, n as getTxEstimatedVbytesSizeByNumberOfInputsOutputs, j as getTxFromRawTxBytes, i as getTxFromRawTxHex, l as getTxId, m as getTxIdNoReverse, ad as isEphemeralAnchorOutput, x as isTxBroadcast, u as lastKeyWithTarget, R as maybeApplyFee, y as proofOfPossessionMessageHashForDepositAddress, r as subtractPrivateKeys, s as subtractPublicKeys, I as sumAvailableTokens, t as sumOfPrivateKeys, v as validateOutboundAdaptorSignature } from './xchain-address-Di3lu4Wy.js';
|
|
5
|
+
export { A as AggregateFrostParams, D as DefaultSparkSigner, p as DerivedHDKey, l as KeyDerivation, K as KeyDerivationType, q as KeyPair, n as SignFrostParams, k as SigningCommitment, i as SigningCommitmentWithOptionalNonce, j as SigningNonce, S as SparkSigner, o as SplitSecretWithProofsParams, T as TaprootOutputKeysGenerator, a as TaprootSparkSigner, U as UnsafeStatelessSparkSigner, V as VerifiableSecretShare, h as bigIntToPrivateKey, c as computerLagrangeCoefficients, e as evaluatePolynomial, f as fieldDiv, b as generatePolynomialForSecretSharing, g as getRandomBigInt, m as modInverse, r as recoverSecret, s as splitSecret, d as splitSecretWithProofs, v as validateShare } from './client-Dn4Ld8pD.js';
|
|
7
6
|
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
8
7
|
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
8
|
+
import './spark-Cj4brrP5.js';
|
|
9
|
+
import '@bufbuild/protobuf/wire';
|
|
10
|
+
import 'nice-grpc-common';
|
|
11
|
+
import './proto/spark_token.js';
|
|
9
12
|
import '@scure/btc-signer';
|
|
10
13
|
import 'bitcoinjs-lib';
|
|
11
14
|
import 'nice-grpc';
|
|
12
15
|
import 'nice-grpc-web';
|
|
13
|
-
import '@
|
|
14
|
-
import 'nice-grpc-common';
|
|
16
|
+
import '@opentelemetry/sdk-trace-base';
|
|
15
17
|
import 'eventemitter3';
|
|
16
18
|
import '@scure/btc-signer/psbt';
|
|
17
19
|
import '@lightsparkdev/core';
|
|
18
20
|
import '@scure/bip32';
|
|
19
21
|
import './types-BADxR3bm.js';
|
|
20
22
|
|
|
21
|
-
declare class
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* NetworkError should be used for any errors related to network communication,
|
|
31
|
-
* such as failed HTTP requests, timeouts, or connection issues.
|
|
32
|
-
* This includes:
|
|
33
|
-
* - Failed API calls
|
|
34
|
-
* - Network timeouts
|
|
35
|
-
* - Connection refused
|
|
36
|
-
* - DNS resolution failures
|
|
37
|
-
* - SSL/TLS errors
|
|
38
|
-
*/
|
|
39
|
-
declare class NetworkError extends SparkSDKError {
|
|
40
|
-
constructor(message: string, context?: {
|
|
41
|
-
url?: string;
|
|
42
|
-
method?: string;
|
|
43
|
-
statusCode?: number;
|
|
44
|
-
response?: unknown;
|
|
45
|
-
errorCount?: number;
|
|
46
|
-
errors?: string;
|
|
47
|
-
operation?: string;
|
|
48
|
-
nodeSignaturesCount?: number;
|
|
49
|
-
}, originalError?: Error);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* ValidationError should be used for any errors related to data validation in regards to the user's input,
|
|
53
|
-
* This includes:
|
|
54
|
-
* - Invalid signatures
|
|
55
|
-
* - Malformed addresses
|
|
56
|
-
* - Invalid proof of possession
|
|
57
|
-
* - Invalid cryptographic parameters
|
|
58
|
-
* - Data format validation failures
|
|
59
|
-
*/
|
|
60
|
-
declare class ValidationError extends SparkSDKError {
|
|
61
|
-
constructor(message: string, context?: {
|
|
62
|
-
field?: string;
|
|
63
|
-
value?: unknown;
|
|
64
|
-
expected?: unknown;
|
|
65
|
-
expectedLength?: number;
|
|
66
|
-
actualLength?: number;
|
|
67
|
-
rValue?: bigint;
|
|
68
|
-
fieldPrime?: bigint;
|
|
69
|
-
sValue?: bigint;
|
|
70
|
-
groupOrder?: bigint;
|
|
71
|
-
index?: number;
|
|
72
|
-
treeLength?: number;
|
|
73
|
-
addressNodesLength?: number;
|
|
74
|
-
}, originalError?: Error);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* InternalValidationError should be used for any errors related to internal data validation
|
|
78
|
-
* that is not related to the user's input.
|
|
79
|
-
* This includes:
|
|
80
|
-
* - Invalid SO responses
|
|
81
|
-
*/
|
|
82
|
-
declare class InternalValidationError extends SparkSDKError {
|
|
83
|
-
constructor(message: string, context?: {
|
|
84
|
-
field?: string;
|
|
85
|
-
value?: unknown;
|
|
86
|
-
expected?: unknown;
|
|
87
|
-
outputIndex?: number;
|
|
88
|
-
keyshareInfo?: unknown;
|
|
89
|
-
signingOperators?: unknown;
|
|
90
|
-
}, originalError?: Error);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* AuthenticationError should be used specifically for authentication and authorization failures,
|
|
94
|
-
* such as invalid credentials or insufficient permissions.
|
|
95
|
-
* This includes:
|
|
96
|
-
* - Invalid API keys
|
|
97
|
-
* - Expired tokens
|
|
98
|
-
* - Insufficient permissions
|
|
99
|
-
* - Authentication token validation failures
|
|
100
|
-
* - Authorization failures
|
|
101
|
-
*/
|
|
102
|
-
declare class AuthenticationError extends SparkSDKError {
|
|
103
|
-
constructor(message: string, context?: {
|
|
104
|
-
endpoint?: string;
|
|
105
|
-
reason?: string;
|
|
106
|
-
}, originalError?: Error);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
|
|
110
|
-
* such as invalid RPC parameters or RPC-specific failures.
|
|
111
|
-
* This includes:
|
|
112
|
-
* - Invalid RPC method calls
|
|
113
|
-
* - RPC parameter validation failures
|
|
114
|
-
* - RPC-specific error codes
|
|
115
|
-
* - RPC protocol errors
|
|
116
|
-
*/
|
|
117
|
-
declare class RPCError extends SparkSDKError {
|
|
118
|
-
constructor(message: string, context?: {
|
|
119
|
-
method?: string;
|
|
120
|
-
params?: unknown;
|
|
121
|
-
code?: number;
|
|
122
|
-
}, originalError?: Error);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* ConfigurationError should be used for errors related to SDK configuration,
|
|
126
|
-
* such as missing or invalid configuration values.
|
|
127
|
-
* This includes:
|
|
128
|
-
* - Missing required configuration
|
|
129
|
-
* - Invalid configuration values
|
|
130
|
-
* - Configuration format errors
|
|
131
|
-
* - Environment-specific configuration issues
|
|
132
|
-
*/
|
|
133
|
-
declare class ConfigurationError extends SparkSDKError {
|
|
134
|
-
constructor(message: string, context?: {
|
|
135
|
-
configKey?: string;
|
|
136
|
-
value?: unknown;
|
|
137
|
-
}, originalError?: Error);
|
|
138
|
-
}
|
|
139
|
-
/***
|
|
140
|
-
* NotImplementedError should be used for any errors related to features that are not yet implemented.
|
|
141
|
-
*/
|
|
142
|
-
declare class NotImplementedError extends SparkSDKError {
|
|
143
|
-
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface FetchOwnedTokenOutputsParams {
|
|
147
|
-
ownerPublicKeys: Uint8Array[];
|
|
148
|
-
issuerPublicKeys?: Uint8Array[];
|
|
149
|
-
tokenIdentifiers?: Uint8Array[];
|
|
150
|
-
}
|
|
151
|
-
interface QueryTokenTransactionsParams {
|
|
152
|
-
ownerPublicKeys?: string[];
|
|
153
|
-
issuerPublicKeys?: string[];
|
|
154
|
-
tokenTransactionHashes?: string[];
|
|
155
|
-
tokenIdentifiers?: string[];
|
|
156
|
-
outputIds?: string[];
|
|
157
|
-
pageSize: number;
|
|
158
|
-
offset: number;
|
|
159
|
-
}
|
|
160
|
-
declare class TokenTransactionService {
|
|
161
|
-
protected readonly config: WalletConfigService;
|
|
162
|
-
protected readonly connectionManager: ConnectionManager;
|
|
163
|
-
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
164
|
-
tokenTransfer(tokenOutputs: TokenOutputsMap, receiverOutputs: {
|
|
165
|
-
tokenIdentifier: Bech32mTokenIdentifier;
|
|
166
|
-
tokenAmount: bigint;
|
|
167
|
-
receiverSparkAddress: string;
|
|
168
|
-
}[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
169
|
-
constructTransferTokenTransactionV0(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
170
|
-
receiverSparkAddress: Uint8Array;
|
|
171
|
-
tokenPublicKey: Uint8Array;
|
|
172
|
-
tokenAmount: bigint;
|
|
173
|
-
}>): Promise<TokenTransaction>;
|
|
174
|
-
constructTransferTokenTransaction(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
175
|
-
receiverSparkAddress: Uint8Array;
|
|
176
|
-
rawTokenIdentifier: Uint8Array;
|
|
177
|
-
tokenAmount: bigint;
|
|
178
|
-
}>): Promise<TokenTransaction$1>;
|
|
179
|
-
collectOperatorIdentityPublicKeys(): Uint8Array[];
|
|
180
|
-
broadcastTokenTransaction(tokenTransaction: TokenTransaction | TokenTransaction$1, outputsToSpendSigningPublicKeys?: Uint8Array[], outputsToSpendCommitments?: Uint8Array[]): Promise<string>;
|
|
181
|
-
private broadcastTokenTransactionV0;
|
|
182
|
-
private broadcastTokenTransactionV1;
|
|
183
|
-
private startTokenTransactionV0;
|
|
184
|
-
private startTokenTransaction;
|
|
185
|
-
private signTokenTransactionV0;
|
|
186
|
-
private signTokenTransaction;
|
|
187
|
-
fetchOwnedTokenOutputs(params: FetchOwnedTokenOutputsParams): Promise<OutputWithPreviousTransactionData[]>;
|
|
188
|
-
queryTokenTransactions(params: QueryTokenTransactionsParams): Promise<TokenTransactionWithStatus[] | TokenTransactionWithStatus$1[]>;
|
|
189
|
-
private fetchOwnedTokenOutputsV0;
|
|
190
|
-
private fetchOwnedTokenOutputsV1;
|
|
191
|
-
private queryTokenTransactionsV0;
|
|
192
|
-
private queryTokenTransactionsV1;
|
|
193
|
-
selectTokenOutputs(tokenOutputs: OutputWithPreviousTransactionData[], tokenAmount: bigint, strategy: "SMALL_FIRST" | "LARGE_FIRST"): OutputWithPreviousTransactionData[];
|
|
194
|
-
private sortTokenOutputsByStrategy;
|
|
195
|
-
private signMessageWithKey;
|
|
196
|
-
private finalizeTokenTransaction;
|
|
197
|
-
private createSignaturesForOperators;
|
|
198
|
-
}
|
|
23
|
+
declare class SparkWalletBrowser extends SparkWallet {
|
|
24
|
+
static initialize({ mnemonicOrSeed, accountNumber, signer, options, }: SparkWalletProps): Promise<{
|
|
25
|
+
mnemonic?: string | undefined;
|
|
26
|
+
wallet: SparkWalletBrowser;
|
|
27
|
+
}>;
|
|
28
|
+
protected initializeTracerEnv({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
29
|
+
}
|
|
30
|
+
declare function initializeTracerEnvBrowser({ spanProcessors, traceUrls, }: Parameters<SparkWallet["initializeTracerEnv"]>[0]): void;
|
|
199
31
|
|
|
200
|
-
export {
|
|
32
|
+
export { SparkWalletBrowser as SparkWallet, SparkWalletProps, initializeTracerEnvBrowser as initializeTracerEnv };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
SparkWalletBrowser,
|
|
3
|
+
initializeTracerEnvBrowser
|
|
4
|
+
} from "./chunk-AVI5E5VT.js";
|
|
2
5
|
import "./chunk-BYXBJQAS.js";
|
|
3
6
|
import {
|
|
4
7
|
AuthenticationError,
|
|
@@ -19,7 +22,6 @@ import {
|
|
|
19
22
|
NotImplementedError,
|
|
20
23
|
RPCError,
|
|
21
24
|
SparkSDKError,
|
|
22
|
-
SparkWallet,
|
|
23
25
|
TEST_UNILATERAL_DIRECT_SEQUENCE,
|
|
24
26
|
TEST_UNILATERAL_SEQUENCE,
|
|
25
27
|
TaprootOutputKeysGenerator,
|
|
@@ -62,7 +64,7 @@ import {
|
|
|
62
64
|
encodeSparkAddress,
|
|
63
65
|
evaluatePolynomial,
|
|
64
66
|
fieldDiv,
|
|
65
|
-
|
|
67
|
+
filterTokenBalanceForTokenIdentifier,
|
|
66
68
|
generateAdaptorFromSignature,
|
|
67
69
|
generatePolynomialForSecretSharing,
|
|
68
70
|
generateSignatureFromExistingAdaptor,
|
|
@@ -71,6 +73,7 @@ import {
|
|
|
71
73
|
getLatestDepositTxId,
|
|
72
74
|
getNetwork,
|
|
73
75
|
getNetworkFromAddress,
|
|
76
|
+
getNetworkFromBech32mTokenIdentifier,
|
|
74
77
|
getNetworkFromString,
|
|
75
78
|
getNextTransactionSequence,
|
|
76
79
|
getP2TRAddressFromPkScript,
|
|
@@ -107,7 +110,7 @@ import {
|
|
|
107
110
|
sumOfPrivateKeys,
|
|
108
111
|
validateOutboundAdaptorSignature,
|
|
109
112
|
validateShare
|
|
110
|
-
} from "./chunk-
|
|
113
|
+
} from "./chunk-GUZ3WCB4.js";
|
|
111
114
|
import "./chunk-G4MSZ6DE.js";
|
|
112
115
|
import "./chunk-3SPMJMUX.js";
|
|
113
116
|
import "./chunk-CQY5ML2A.js";
|
|
@@ -132,7 +135,7 @@ export {
|
|
|
132
135
|
NotImplementedError,
|
|
133
136
|
RPCError,
|
|
134
137
|
SparkSDKError,
|
|
135
|
-
SparkWallet,
|
|
138
|
+
SparkWalletBrowser as SparkWallet,
|
|
136
139
|
TEST_UNILATERAL_DIRECT_SEQUENCE,
|
|
137
140
|
TEST_UNILATERAL_SEQUENCE,
|
|
138
141
|
TaprootOutputKeysGenerator,
|
|
@@ -175,7 +178,7 @@ export {
|
|
|
175
178
|
encodeSparkAddress,
|
|
176
179
|
evaluatePolynomial,
|
|
177
180
|
fieldDiv,
|
|
178
|
-
|
|
181
|
+
filterTokenBalanceForTokenIdentifier,
|
|
179
182
|
generateAdaptorFromSignature,
|
|
180
183
|
generatePolynomialForSecretSharing,
|
|
181
184
|
generateSignatureFromExistingAdaptor,
|
|
@@ -184,6 +187,7 @@ export {
|
|
|
184
187
|
getLatestDepositTxId,
|
|
185
188
|
getNetwork,
|
|
186
189
|
getNetworkFromAddress,
|
|
190
|
+
getNetworkFromBech32mTokenIdentifier,
|
|
187
191
|
getNetworkFromString,
|
|
188
192
|
getNextTransactionSequence,
|
|
189
193
|
getP2TRAddressFromPkScript,
|
|
@@ -202,6 +206,7 @@ export {
|
|
|
202
206
|
getTxFromRawTxHex,
|
|
203
207
|
getTxId,
|
|
204
208
|
getTxIdNoReverse,
|
|
209
|
+
initializeTracerEnvBrowser as initializeTracerEnv,
|
|
205
210
|
isEphemeralAnchorOutput,
|
|
206
211
|
isTxBroadcast,
|
|
207
212
|
isValidPublicKey,
|