@buildonspark/spark-sdk 0.1.45 → 0.1.47
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 +22 -0
- package/dist/{chunk-I54FARY2.js → chunk-EAP3U3CW.js} +14 -14
- package/dist/chunk-GWFQ7EBA.js +3773 -0
- package/dist/{chunk-J2IE4Z7Y.js → chunk-NNX4OK44.js} +3487 -934
- package/dist/{RequestLightningSendInput-Du0z7Om7.d.cts → client-CvpTRpcw.d.cts} +422 -212
- package/dist/{RequestLightningSendInput-DEPd_fPO.d.ts → client-D7KgLN44.d.ts} +422 -212
- package/dist/graphql/objects/index.d.cts +5 -9
- package/dist/graphql/objects/index.d.ts +5 -9
- package/dist/graphql/objects/index.js +1 -1
- package/dist/index.cjs +20461 -23377
- package/dist/index.d.cts +15 -769
- package/dist/index.d.ts +15 -769
- package/dist/index.js +81 -71
- package/dist/index.node.cjs +21994 -25018
- package/dist/index.node.d.cts +312 -34
- package/dist/index.node.d.ts +312 -34
- package/dist/index.node.js +82 -176
- package/dist/native/index.cjs +22847 -25841
- package/dist/native/index.d.cts +974 -1138
- package/dist/native/index.d.ts +974 -1138
- package/dist/native/index.js +10604 -13592
- package/dist/proto/lrc20.d.cts +2 -2
- package/dist/proto/lrc20.d.ts +2 -2
- package/dist/proto/lrc20.js +3098 -46
- package/dist/proto/spark.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/{sdk-types-Cc4l4kb1.d.ts → sdk-types-BGCeea0G.d.ts} +1 -1
- package/dist/{sdk-types-B0SwjolI.d.cts → sdk-types-XUeQMLFP.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.cts → spark-BbUrbvZz.d.cts} +1 -1
- package/dist/{spark-dM7EYXYQ.d.ts → spark-BbUrbvZz.d.ts} +1 -1
- package/dist/spark-wallet-BAFPpPtY.d.cts +923 -0
- package/dist/spark-wallet-CJkQW8pK.d.ts +923 -0
- package/dist/spark_bindings/native/index.d.cts +1 -1
- package/dist/spark_bindings/native/index.d.ts +1 -1
- package/dist/spark_bindings/wasm/index.d.cts +1 -1
- package/dist/spark_bindings/wasm/index.d.ts +1 -1
- package/dist/{services/index.cjs → tests/test-utils.cjs} +2512 -4380
- package/dist/tests/test-utils.d.cts +79 -0
- package/dist/tests/test-utils.d.ts +79 -0
- package/dist/tests/test-utils.js +85 -0
- package/dist/types/index.d.cts +5 -9
- package/dist/types/index.d.ts +5 -9
- package/dist/types/index.js +5 -5
- package/dist/{types-C-Rp0Oo7.d.cts → types-BADxR3bm.d.cts} +1 -1
- package/dist/{types-C-Rp0Oo7.d.ts → types-BADxR3bm.d.ts} +1 -1
- package/package.json +7 -35
- package/src/graphql/client.ts +59 -20
- package/src/index.node.ts +28 -2
- package/src/index.ts +31 -1
- package/src/native/index.ts +16 -2
- package/src/services/config.ts +4 -6
- package/src/services/connection.ts +131 -64
- package/src/services/lightning.ts +1 -2
- package/src/services/token-transactions.ts +7 -7
- package/src/services/transfer.ts +1 -1
- package/src/services/tree-creation.ts +1 -1
- package/src/services/wallet-config.ts +18 -10
- package/src/signer/signer.react-native.ts +2 -5
- package/src/signer/signer.ts +138 -64
- package/src/signer/types.ts +52 -0
- package/src/spark-wallet/spark-wallet.ts +79 -36
- package/src/spark-wallet/types.ts +4 -4
- package/src/tests/integration/coop-exit.test.ts +2 -1
- package/src/tests/integration/lightning.test.ts +2 -2
- package/src/tests/integration/swap.test.ts +1 -1
- package/src/tests/integration/transfer.test.ts +5 -5
- package/src/tests/integration/tree-creation.test.ts +1 -1
- package/src/tests/integration/wallet.test.ts +1 -0
- package/src/tests/isHermeticTest.ts +3 -24
- package/src/tests/{test-util.ts → test-utils.ts} +3 -7
- package/src/tests/wrapWithOtelSpan.test.ts +1 -1
- package/src/{address → utils}/address.ts +1 -1
- package/src/utils/crypto.ts +19 -9
- package/src/utils/index.ts +2 -0
- package/src/utils/network.ts +17 -0
- package/src/utils/secret-sharing.ts +1 -2
- package/src/utils/signing.ts +1 -1
- package/src/utils/token-transactions.ts +3 -3
- package/src/utils/unilateral-exit.ts +32 -0
- package/src/utils/xchain-address.ts +1 -1
- package/dist/BitcoinNetwork-TnABML0T.d.cts +0 -18
- package/dist/BitcoinNetwork-TnABML0T.d.ts +0 -18
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.cts +0 -10
- package/dist/LightningSendFeeEstimateInput-BgOhEAI-.d.ts +0 -10
- package/dist/address/index.cjs +0 -458
- package/dist/address/index.d.cts +0 -32
- package/dist/address/index.d.ts +0 -32
- package/dist/address/index.js +0 -17
- package/dist/chunk-5FUB65LX.js +0 -838
- package/dist/chunk-6264CGDM.js +0 -113
- package/dist/chunk-7V6N75CC.js +0 -24
- package/dist/chunk-C2S227QR.js +0 -2336
- package/dist/chunk-GSI4OLXZ.js +0 -117
- package/dist/chunk-GZ5IPPJ2.js +0 -170
- package/dist/chunk-HWJWKEIU.js +0 -75
- package/dist/chunk-KMUMFYFX.js +0 -137
- package/dist/chunk-L3EHBOUX.js +0 -0
- package/dist/chunk-NSJF5F5O.js +0 -325
- package/dist/chunk-NTFKFRQ2.js +0 -3146
- package/dist/chunk-PQN3C2MF.js +0 -1122
- package/dist/chunk-QNNSEJ4P.js +0 -232
- package/dist/chunk-R5PXJZQS.js +0 -277
- package/dist/chunk-VTUGIIWI.js +0 -0
- package/dist/chunk-YUPMXTCJ.js +0 -622
- package/dist/chunk-Z5HIAYFT.js +0 -84
- package/dist/index-B2AwKW5J.d.cts +0 -214
- package/dist/index-CJDi1HWc.d.ts +0 -214
- package/dist/network-BTJl-Sul.d.ts +0 -46
- package/dist/network-CqgsdUF2.d.cts +0 -46
- package/dist/services/config.cjs +0 -2354
- package/dist/services/config.d.cts +0 -42
- package/dist/services/config.d.ts +0 -42
- package/dist/services/config.js +0 -17
- package/dist/services/connection.cjs +0 -17691
- package/dist/services/connection.d.cts +0 -95
- package/dist/services/connection.d.ts +0 -95
- package/dist/services/connection.js +0 -11
- package/dist/services/index.d.cts +0 -21
- package/dist/services/index.d.ts +0 -21
- package/dist/services/index.js +0 -58
- package/dist/services/lrc-connection.cjs +0 -4713
- package/dist/services/lrc-connection.d.cts +0 -34
- package/dist/services/lrc-connection.d.ts +0 -34
- package/dist/services/lrc-connection.js +0 -11
- package/dist/services/token-transactions.cjs +0 -2877
- package/dist/services/token-transactions.d.cts +0 -75
- package/dist/services/token-transactions.d.ts +0 -75
- package/dist/services/token-transactions.js +0 -15
- package/dist/services/wallet-config.cjs +0 -340
- package/dist/services/wallet-config.d.cts +0 -56
- package/dist/services/wallet-config.d.ts +0 -56
- package/dist/services/wallet-config.js +0 -33
- package/dist/signer/signer.cjs +0 -2004
- package/dist/signer/signer.d.cts +0 -10
- package/dist/signer/signer.d.ts +0 -10
- package/dist/signer/signer.js +0 -24
- package/dist/signer-BocS_J6B.d.ts +0 -187
- package/dist/signer-DKS0AJkw.d.cts +0 -187
- package/dist/utils/index.cjs +0 -2947
- package/dist/utils/index.d.cts +0 -18
- package/dist/utils/index.d.ts +0 -18
- package/dist/utils/index.js +0 -157
- package/src/address/index.ts +0 -1
- package/src/services/lrc-connection.ts +0 -215
package/dist/index.node.d.cts
CHANGED
|
@@ -1,41 +1,319 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
import {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
import '
|
|
8
|
-
import '@
|
|
9
|
-
import '
|
|
10
|
-
import './
|
|
11
|
-
import './
|
|
12
|
-
import '
|
|
13
|
-
import 'nice-grpc-common';
|
|
14
|
-
import './services/config.cjs';
|
|
15
|
-
import '@buildonspark/lrc20-sdk';
|
|
16
|
-
import './services/wallet-config.cjs';
|
|
17
|
-
import './services/connection.cjs';
|
|
1
|
+
import { N as Network, T as TokenBalanceMap, b as SparkAddressFormat, W as WalletConfigService, c as ConnectionManager } from './spark-wallet-BAFPpPtY.cjs';
|
|
2
|
+
export { C as ConfigOptions, t as CreateLightningInvoiceParams, D as DecodedSparkAddressData, v as DepositParams, H as HumanReadableTokenIdentifier, q as HumanReadableTokenIdentifierData, I as InitWalletResponse, L as LRC_WALLET_NETWORK, m as LRC_WALLET_NETWORK_TYPE, k as NetworkToProto, j as NetworkType, P as PayLightningInvoiceParams, e as SparkAddressData, S as SparkWallet, w as SparkWalletEvents, a as SparkWalletProps, u as TransferParams, U as UserTokenMetadata, d as WalletConfig, s as decodeHumanReadableTokenIdentifier, g as decodeSparkAddress, r as encodeHumanReadableTokenIdentifier, f as encodeSparkAddress, l as getNetwork, n as getNetworkFromAddress, o as getNetworkFromString, h as isValidPublicKey, i as isValidSparkAddress, p as protoToNetwork } from './spark-wallet-BAFPpPtY.cjs';
|
|
3
|
+
import { Y as SigningNonce, Q as SigningCommitment } from './client-CvpTRpcw.cjs';
|
|
4
|
+
export { ac as AggregateFrostParams, Z as DefaultSparkSigner, ae as DerivedHDKey, af as KeyPair, ab as SignFrostParams, K as SparkSigner, ad as SplitSecretWithProofsParams, $ as TaprootOutputKeysGenerator, _ as TaprootSparkSigner, W as VerifiableSecretShare, aa as bigIntToPrivateKey, a4 as computerLagrangeCoefficients, a2 as evaluatePolynomial, a3 as fieldDiv, a5 as generatePolynomialForSecretSharing, a0 as getRandomBigInt, a1 as modInverse, a8 as recoverSecret, a6 as splitSecret, a7 as splitSecretWithProofs, a9 as validateShare } from './client-CvpTRpcw.cjs';
|
|
5
|
+
export { TokenSigner } from '@buildonspark/lrc20-sdk';
|
|
6
|
+
export { MultisigReceiptInput } from '@buildonspark/lrc20-sdk/lrc/types';
|
|
7
|
+
import * as btc from '@scure/btc-signer';
|
|
8
|
+
import { Transaction } from '@scure/btc-signer';
|
|
9
|
+
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
10
|
+
import { j as OutputWithPreviousTransactionData, k as TransferPackage, g as SparkServiceClient, T as TokenTransaction, l as TokenTransactionWithStatus } from './spark-BbUrbvZz.cjs';
|
|
11
|
+
import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.cjs';
|
|
12
|
+
import 'bitcoinjs-lib';
|
|
18
13
|
import 'nice-grpc';
|
|
19
14
|
import 'nice-grpc-web';
|
|
20
|
-
import '
|
|
21
|
-
import '
|
|
22
|
-
import './proto/lrc20.cjs';
|
|
23
|
-
import '@scure/btc-signer';
|
|
15
|
+
import '@bufbuild/protobuf/wire';
|
|
16
|
+
import 'nice-grpc-common';
|
|
24
17
|
import 'eventemitter3';
|
|
25
|
-
import './
|
|
26
|
-
import '
|
|
27
|
-
import '@scure/btc-signer/psbt';
|
|
28
|
-
import 'bitcoinjs-lib';
|
|
18
|
+
import './sdk-types-XUeQMLFP.cjs';
|
|
19
|
+
import '@lightsparkdev/core';
|
|
29
20
|
import '@scure/bip32';
|
|
30
|
-
import './types-
|
|
31
|
-
|
|
21
|
+
import './types-BADxR3bm.cjs';
|
|
22
|
+
|
|
23
|
+
declare class SparkSDKError extends Error {
|
|
24
|
+
readonly context: Record<string, unknown>;
|
|
25
|
+
readonly originalError?: Error;
|
|
26
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
27
|
+
toString(): string;
|
|
28
|
+
toJSON(): Record<string, unknown>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* NetworkError should be used for any errors related to network communication,
|
|
33
|
+
* such as failed HTTP requests, timeouts, or connection issues.
|
|
34
|
+
* This includes:
|
|
35
|
+
* - Failed API calls
|
|
36
|
+
* - Network timeouts
|
|
37
|
+
* - Connection refused
|
|
38
|
+
* - DNS resolution failures
|
|
39
|
+
* - SSL/TLS errors
|
|
40
|
+
*/
|
|
41
|
+
declare class NetworkError extends SparkSDKError {
|
|
42
|
+
constructor(message: string, context?: {
|
|
43
|
+
url?: string;
|
|
44
|
+
method?: string;
|
|
45
|
+
statusCode?: number;
|
|
46
|
+
response?: unknown;
|
|
47
|
+
errorCount?: number;
|
|
48
|
+
errors?: string;
|
|
49
|
+
operation?: string;
|
|
50
|
+
nodeSignaturesCount?: number;
|
|
51
|
+
}, originalError?: Error);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* ValidationError should be used for any errors related to data validation in regards to the user's input,
|
|
55
|
+
* This includes:
|
|
56
|
+
* - Invalid signatures
|
|
57
|
+
* - Malformed addresses
|
|
58
|
+
* - Invalid proof of possession
|
|
59
|
+
* - Invalid cryptographic parameters
|
|
60
|
+
* - Data format validation failures
|
|
61
|
+
*/
|
|
62
|
+
declare class ValidationError extends SparkSDKError {
|
|
63
|
+
constructor(message: string, context?: {
|
|
64
|
+
field?: string;
|
|
65
|
+
value?: unknown;
|
|
66
|
+
expected?: unknown;
|
|
67
|
+
expectedLength?: number;
|
|
68
|
+
actualLength?: number;
|
|
69
|
+
rValue?: bigint;
|
|
70
|
+
fieldPrime?: bigint;
|
|
71
|
+
sValue?: bigint;
|
|
72
|
+
groupOrder?: bigint;
|
|
73
|
+
index?: number;
|
|
74
|
+
treeLength?: number;
|
|
75
|
+
addressNodesLength?: number;
|
|
76
|
+
}, originalError?: Error);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* InternalValidationError should be used for any errors related to internal data validation
|
|
80
|
+
* that is not related to the user's input.
|
|
81
|
+
* This includes:
|
|
82
|
+
* - Invalid SO responses
|
|
83
|
+
*/
|
|
84
|
+
declare class InternalValidationError extends SparkSDKError {
|
|
85
|
+
constructor(message: string, context?: {
|
|
86
|
+
field?: string;
|
|
87
|
+
value?: unknown;
|
|
88
|
+
expected?: unknown;
|
|
89
|
+
outputIndex?: number;
|
|
90
|
+
keyshareInfo?: unknown;
|
|
91
|
+
signingOperators?: unknown;
|
|
92
|
+
}, originalError?: Error);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* AuthenticationError should be used specifically for authentication and authorization failures,
|
|
96
|
+
* such as invalid credentials or insufficient permissions.
|
|
97
|
+
* This includes:
|
|
98
|
+
* - Invalid API keys
|
|
99
|
+
* - Expired tokens
|
|
100
|
+
* - Insufficient permissions
|
|
101
|
+
* - Authentication token validation failures
|
|
102
|
+
* - Authorization failures
|
|
103
|
+
*/
|
|
104
|
+
declare class AuthenticationError extends SparkSDKError {
|
|
105
|
+
constructor(message: string, context?: {
|
|
106
|
+
endpoint?: string;
|
|
107
|
+
reason?: string;
|
|
108
|
+
}, originalError?: Error);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
|
|
112
|
+
* such as invalid RPC parameters or RPC-specific failures.
|
|
113
|
+
* This includes:
|
|
114
|
+
* - Invalid RPC method calls
|
|
115
|
+
* - RPC parameter validation failures
|
|
116
|
+
* - RPC-specific error codes
|
|
117
|
+
* - RPC protocol errors
|
|
118
|
+
*/
|
|
119
|
+
declare class RPCError extends SparkSDKError {
|
|
120
|
+
constructor(message: string, context?: {
|
|
121
|
+
method?: string;
|
|
122
|
+
params?: unknown;
|
|
123
|
+
code?: number;
|
|
124
|
+
}, originalError?: Error);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* ConfigurationError should be used for errors related to SDK configuration,
|
|
128
|
+
* such as missing or invalid configuration values.
|
|
129
|
+
* This includes:
|
|
130
|
+
* - Missing required configuration
|
|
131
|
+
* - Invalid configuration values
|
|
132
|
+
* - Configuration format errors
|
|
133
|
+
* - Environment-specific configuration issues
|
|
134
|
+
*/
|
|
135
|
+
declare class ConfigurationError extends SparkSDKError {
|
|
136
|
+
constructor(message: string, context?: {
|
|
137
|
+
configKey?: string;
|
|
138
|
+
value?: unknown;
|
|
139
|
+
}, originalError?: Error);
|
|
140
|
+
}
|
|
141
|
+
/***
|
|
142
|
+
* NotImplementedError should be used for any errors related to features that are not yet implemented.
|
|
143
|
+
*/
|
|
144
|
+
declare class NotImplementedError extends SparkSDKError {
|
|
145
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
149
|
+
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
150
|
+
adaptorSignature: Uint8Array;
|
|
151
|
+
adaptorPrivateKey: Uint8Array;
|
|
152
|
+
};
|
|
153
|
+
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
154
|
+
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
155
|
+
|
|
156
|
+
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
157
|
+
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
158
|
+
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
159
|
+
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
160
|
+
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
161
|
+
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
162
|
+
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
163
|
+
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
164
|
+
declare function getTxId(tx: btc.Transaction): string;
|
|
165
|
+
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
32
166
|
|
|
33
|
-
declare
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
167
|
+
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
168
|
+
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
169
|
+
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
170
|
+
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
171
|
+
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
172
|
+
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
173
|
+
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
174
|
+
|
|
175
|
+
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
176
|
+
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
177
|
+
|
|
178
|
+
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
179
|
+
|
|
180
|
+
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
181
|
+
|
|
182
|
+
declare function getRandomSigningNonce(): SigningNonce;
|
|
183
|
+
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
184
|
+
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
185
|
+
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
186
|
+
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
187
|
+
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
188
|
+
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
189
|
+
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
190
|
+
|
|
191
|
+
declare function sumAvailableTokens(outputs: OutputWithPreviousTransactionData[]): bigint;
|
|
192
|
+
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
193
|
+
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalanceMap, publicKey: string): {
|
|
194
|
+
balance: bigint;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
198
|
+
|
|
199
|
+
declare const DEFAULT_FEE_SATS: number;
|
|
200
|
+
/**
|
|
201
|
+
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
202
|
+
* Returns the original amount if it's less than or equal to the fee.
|
|
203
|
+
*/
|
|
204
|
+
declare function maybeApplyFee(amount: bigint): bigint;
|
|
205
|
+
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
206
|
+
declare function getCurrentTimelock(currSequence?: number): number;
|
|
207
|
+
declare function getTransactionSequence(currSequence?: number): number;
|
|
208
|
+
declare function checkIfValidSequence(currSequence?: number): void;
|
|
209
|
+
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
210
|
+
nextSequence: number;
|
|
211
|
+
needRefresh: boolean;
|
|
212
|
+
};
|
|
213
|
+
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
214
|
+
|
|
215
|
+
interface LeafInfo {
|
|
216
|
+
leafId: string;
|
|
217
|
+
nodeTx: string;
|
|
218
|
+
refundTx: string;
|
|
219
|
+
}
|
|
220
|
+
interface Utxo {
|
|
221
|
+
txid: string;
|
|
222
|
+
vout: number;
|
|
223
|
+
value: bigint;
|
|
224
|
+
script: string;
|
|
225
|
+
publicKey: string;
|
|
226
|
+
}
|
|
227
|
+
interface FeeRate {
|
|
228
|
+
satPerVbyte: number;
|
|
229
|
+
}
|
|
230
|
+
interface FeeBumpTxPackage {
|
|
231
|
+
tx: string;
|
|
232
|
+
feeBumpPsbt?: string;
|
|
233
|
+
}
|
|
234
|
+
interface FeeBumpTxChain {
|
|
235
|
+
leafId: string;
|
|
236
|
+
txPackages: FeeBumpTxPackage[];
|
|
237
|
+
}
|
|
238
|
+
interface TxChain {
|
|
239
|
+
leafId: string;
|
|
240
|
+
transactions: string[];
|
|
241
|
+
}
|
|
242
|
+
interface BroadcastConfig {
|
|
243
|
+
bitcoinCoreRpcUrl?: string;
|
|
244
|
+
rpcUsername?: string;
|
|
245
|
+
rpcPassword?: string;
|
|
246
|
+
autoBroadcast?: boolean;
|
|
247
|
+
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
248
|
+
}
|
|
249
|
+
interface BroadcastResult {
|
|
250
|
+
success: boolean;
|
|
251
|
+
txids?: string[];
|
|
252
|
+
error?: string;
|
|
253
|
+
broadcastedPackages?: number;
|
|
254
|
+
}
|
|
255
|
+
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
256
|
+
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
257
|
+
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
258
|
+
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
259
|
+
feeBumpPsbt: string;
|
|
260
|
+
usedUtxos: Utxo[];
|
|
261
|
+
correctedParentTx?: string;
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
265
|
+
|
|
266
|
+
interface FetchOwnedTokenOutputsParams {
|
|
267
|
+
ownerPublicKeys: Uint8Array[];
|
|
268
|
+
issuerPublicKeys?: Uint8Array[];
|
|
269
|
+
tokenIdentifiers?: Uint8Array[];
|
|
270
|
+
}
|
|
271
|
+
interface QueryTokenTransactionsParams {
|
|
272
|
+
ownerPublicKeys?: string[];
|
|
273
|
+
issuerPublicKeys?: string[];
|
|
274
|
+
tokenTransactionHashes?: string[];
|
|
275
|
+
tokenIdentifiers?: string[];
|
|
276
|
+
outputIds?: string[];
|
|
277
|
+
}
|
|
278
|
+
declare class TokenTransactionService {
|
|
279
|
+
protected readonly config: WalletConfigService;
|
|
280
|
+
protected readonly connectionManager: ConnectionManager;
|
|
281
|
+
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
282
|
+
tokenTransfer(tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, receiverOutputs: {
|
|
283
|
+
tokenPublicKey: string;
|
|
284
|
+
tokenAmount: bigint;
|
|
285
|
+
receiverSparkAddress: string;
|
|
286
|
+
}[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
287
|
+
constructTransferTokenTransactionV0(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
288
|
+
receiverSparkAddress: Uint8Array;
|
|
289
|
+
tokenPublicKey: Uint8Array;
|
|
290
|
+
tokenAmount: bigint;
|
|
291
|
+
}>): Promise<TokenTransaction>;
|
|
292
|
+
constructTransferTokenTransaction(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
293
|
+
receiverSparkAddress: Uint8Array;
|
|
294
|
+
tokenPublicKey: Uint8Array;
|
|
295
|
+
tokenAmount: bigint;
|
|
296
|
+
}>): Promise<TokenTransaction$1>;
|
|
297
|
+
collectOperatorIdentityPublicKeys(): Uint8Array[];
|
|
298
|
+
broadcastTokenTransaction(tokenTransaction: TokenTransaction | TokenTransaction$1, outputsToSpendSigningPublicKeys?: Uint8Array[], outputsToSpendCommitments?: Uint8Array[]): Promise<string>;
|
|
299
|
+
private broadcastTokenTransactionV0;
|
|
300
|
+
private broadcastTokenTransactionV1;
|
|
301
|
+
private startTokenTransactionV0;
|
|
302
|
+
private startTokenTransaction;
|
|
303
|
+
private signTokenTransactionV0;
|
|
304
|
+
private signTokenTransaction;
|
|
305
|
+
fetchOwnedTokenOutputs(params: FetchOwnedTokenOutputsParams): Promise<OutputWithPreviousTransactionData[]>;
|
|
306
|
+
queryTokenTransactions(params: QueryTokenTransactionsParams): Promise<TokenTransactionWithStatus[] | TokenTransactionWithStatus$1[]>;
|
|
307
|
+
private fetchOwnedTokenOutputsV0;
|
|
308
|
+
private fetchOwnedTokenOutputsV1;
|
|
309
|
+
private queryTokenTransactionsV0;
|
|
310
|
+
private queryTokenTransactionsV1;
|
|
311
|
+
syncTokenOutputs(tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>): Promise<void>;
|
|
312
|
+
selectTokenOutputs(tokenOutputs: OutputWithPreviousTransactionData[], tokenAmount: bigint, strategy: "SMALL_FIRST" | "LARGE_FIRST"): OutputWithPreviousTransactionData[];
|
|
313
|
+
private sortTokenOutputsByStrategy;
|
|
314
|
+
private signMessageWithKey;
|
|
315
|
+
private finalizeTokenTransaction;
|
|
316
|
+
private createSignaturesForOperators;
|
|
39
317
|
}
|
|
40
318
|
|
|
41
|
-
export {
|
|
319
|
+
export { AuthenticationError, type BroadcastConfig, type BroadcastResult, ConfigurationError, ConnectionManager, DEFAULT_FEE_SATS, type FeeBumpTxChain, type FeeBumpTxPackage, type FeeRate, InternalValidationError, type LeafInfo, Network, NetworkError, NotImplementedError, RPCError, SigningCommitment, SigningNonce, SparkAddressFormat, SparkSDKError, TokenBalanceMap, TokenTransactionService, type TxChain, type Utxo, ValidationError, WalletConfigService, addPrivateKeys, addPublicKeys, applyAdaptorToSignature, applyAdditiveTweakToPublicKey, checkIfSelectedOutputsAreAvailable, checkIfValidSequence, collectResponses, computeTaprootKeyNoScript, constructFeeBumpTx, constructUnilateralExitFeeBumpPackages, constructUnilateralExitTxs, createRefundTx, createSigningCommitment, createSigningNonce, decodeBytesToSigningCommitment, decodeBytesToSigningNonce, encodeSigningCommitmentToBytes, encodeSigningNonceToBytes, filterTokenBalanceForTokenPublicKey, generateAdaptorFromSignature, generateSignatureFromExistingAdaptor, getCurrentTimelock, getEphemeralAnchorOutput, getLatestDepositTxId, getNextTransactionSequence, getP2TRAddressFromPkScript, getP2TRAddressFromPublicKey, getP2TRScriptFromPublicKey, getP2WPKHAddressFromPublicKey, getRandomSigningNonce, getSigHashFromTx, getSigningCommitmentFromNonce, getSparkAddressFromTaproot, getTransactionSequence, getTransferPackageSigningPayload, getTxFromRawTxBytes, getTxFromRawTxHex, getTxId, getTxIdNoReverse, isEphemeralAnchorOutput, isTxBroadcast, lastKeyWithTarget, maybeApplyFee, proofOfPossessionMessageHashForDepositAddress, subtractPrivateKeys, subtractPublicKeys, sumAvailableTokens, sumOfPrivateKeys, validateOutboundAdaptorSignature };
|