@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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { a as OutputWithPreviousTransactionData, T as TokenTransaction, b as TokenTransactionWithStatus } from './spark-Cj4brrP5.js';
|
|
2
|
+
import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.js';
|
|
3
|
+
import { W as WalletConfigService, C as ConnectionManager, v as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-B6YthxDI.js';
|
|
4
|
+
|
|
5
|
+
declare class SparkSDKError extends Error {
|
|
6
|
+
readonly context: Record<string, unknown>;
|
|
7
|
+
readonly originalError?: Error;
|
|
8
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
9
|
+
toString(): string;
|
|
10
|
+
toJSON(): Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* NetworkError should be used for any errors related to network communication,
|
|
15
|
+
* such as failed HTTP requests, timeouts, or connection issues.
|
|
16
|
+
* This includes:
|
|
17
|
+
* - Failed API calls
|
|
18
|
+
* - Network timeouts
|
|
19
|
+
* - Connection refused
|
|
20
|
+
* - DNS resolution failures
|
|
21
|
+
* - SSL/TLS errors
|
|
22
|
+
*/
|
|
23
|
+
declare class NetworkError extends SparkSDKError {
|
|
24
|
+
constructor(message: string, context?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
method?: string;
|
|
27
|
+
statusCode?: number;
|
|
28
|
+
response?: unknown;
|
|
29
|
+
errorCount?: number;
|
|
30
|
+
errors?: string;
|
|
31
|
+
operation?: string;
|
|
32
|
+
nodeSignaturesCount?: number;
|
|
33
|
+
}, originalError?: Error);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* ValidationError should be used for any errors related to data validation in regards to the user's input,
|
|
37
|
+
* This includes:
|
|
38
|
+
* - Invalid signatures
|
|
39
|
+
* - Malformed addresses
|
|
40
|
+
* - Invalid proof of possession
|
|
41
|
+
* - Invalid cryptographic parameters
|
|
42
|
+
* - Data format validation failures
|
|
43
|
+
*/
|
|
44
|
+
declare class ValidationError extends SparkSDKError {
|
|
45
|
+
constructor(message: string, context?: {
|
|
46
|
+
field?: string;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
expected?: unknown;
|
|
49
|
+
expectedLength?: number;
|
|
50
|
+
actualLength?: number;
|
|
51
|
+
rValue?: bigint;
|
|
52
|
+
fieldPrime?: bigint;
|
|
53
|
+
sValue?: bigint;
|
|
54
|
+
groupOrder?: bigint;
|
|
55
|
+
index?: number;
|
|
56
|
+
treeLength?: number;
|
|
57
|
+
addressNodesLength?: number;
|
|
58
|
+
}, originalError?: Error);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* InternalValidationError should be used for any errors related to internal data validation
|
|
62
|
+
* that is not related to the user's input.
|
|
63
|
+
* This includes:
|
|
64
|
+
* - Invalid SO responses
|
|
65
|
+
*/
|
|
66
|
+
declare class InternalValidationError extends SparkSDKError {
|
|
67
|
+
constructor(message: string, context?: {
|
|
68
|
+
field?: string;
|
|
69
|
+
value?: unknown;
|
|
70
|
+
expected?: unknown;
|
|
71
|
+
outputIndex?: number;
|
|
72
|
+
keyshareInfo?: unknown;
|
|
73
|
+
signingOperators?: unknown;
|
|
74
|
+
}, originalError?: Error);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* AuthenticationError should be used specifically for authentication and authorization failures,
|
|
78
|
+
* such as invalid credentials or insufficient permissions.
|
|
79
|
+
* This includes:
|
|
80
|
+
* - Invalid API keys
|
|
81
|
+
* - Expired tokens
|
|
82
|
+
* - Insufficient permissions
|
|
83
|
+
* - Authentication token validation failures
|
|
84
|
+
* - Authorization failures
|
|
85
|
+
*/
|
|
86
|
+
declare class AuthenticationError extends SparkSDKError {
|
|
87
|
+
constructor(message: string, context?: {
|
|
88
|
+
endpoint?: string;
|
|
89
|
+
reason?: string;
|
|
90
|
+
}, originalError?: Error);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
|
|
94
|
+
* such as invalid RPC parameters or RPC-specific failures.
|
|
95
|
+
* This includes:
|
|
96
|
+
* - Invalid RPC method calls
|
|
97
|
+
* - RPC parameter validation failures
|
|
98
|
+
* - RPC-specific error codes
|
|
99
|
+
* - RPC protocol errors
|
|
100
|
+
*/
|
|
101
|
+
declare class RPCError extends SparkSDKError {
|
|
102
|
+
constructor(message: string, context?: {
|
|
103
|
+
method?: string;
|
|
104
|
+
params?: unknown;
|
|
105
|
+
code?: number;
|
|
106
|
+
}, originalError?: Error);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* ConfigurationError should be used for errors related to SDK configuration,
|
|
110
|
+
* such as missing or invalid configuration values.
|
|
111
|
+
* This includes:
|
|
112
|
+
* - Missing required configuration
|
|
113
|
+
* - Invalid configuration values
|
|
114
|
+
* - Configuration format errors
|
|
115
|
+
* - Environment-specific configuration issues
|
|
116
|
+
*/
|
|
117
|
+
declare class ConfigurationError extends SparkSDKError {
|
|
118
|
+
constructor(message: string, context?: {
|
|
119
|
+
configKey?: string;
|
|
120
|
+
value?: unknown;
|
|
121
|
+
}, originalError?: Error);
|
|
122
|
+
}
|
|
123
|
+
/***
|
|
124
|
+
* NotImplementedError should be used for any errors related to features that are not yet implemented.
|
|
125
|
+
*/
|
|
126
|
+
declare class NotImplementedError extends SparkSDKError {
|
|
127
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface FetchOwnedTokenOutputsParams {
|
|
131
|
+
ownerPublicKeys: Uint8Array[];
|
|
132
|
+
issuerPublicKeys?: Uint8Array[];
|
|
133
|
+
tokenIdentifiers?: Uint8Array[];
|
|
134
|
+
}
|
|
135
|
+
interface QueryTokenTransactionsParams {
|
|
136
|
+
ownerPublicKeys?: string[];
|
|
137
|
+
issuerPublicKeys?: string[];
|
|
138
|
+
tokenTransactionHashes?: string[];
|
|
139
|
+
tokenIdentifiers?: string[];
|
|
140
|
+
outputIds?: string[];
|
|
141
|
+
pageSize?: number;
|
|
142
|
+
offset?: number;
|
|
143
|
+
}
|
|
144
|
+
declare class TokenTransactionService {
|
|
145
|
+
protected readonly config: WalletConfigService;
|
|
146
|
+
protected readonly connectionManager: ConnectionManager;
|
|
147
|
+
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
148
|
+
tokenTransfer(tokenOutputs: TokenOutputsMap, receiverOutputs: {
|
|
149
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
150
|
+
tokenAmount: bigint;
|
|
151
|
+
receiverSparkAddress: string;
|
|
152
|
+
}[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
153
|
+
constructTransferTokenTransactionV0(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
154
|
+
receiverSparkAddress: Uint8Array;
|
|
155
|
+
tokenPublicKey: Uint8Array;
|
|
156
|
+
tokenAmount: bigint;
|
|
157
|
+
}>): Promise<TokenTransaction>;
|
|
158
|
+
constructTransferTokenTransaction(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
159
|
+
receiverSparkAddress: Uint8Array;
|
|
160
|
+
rawTokenIdentifier: Uint8Array;
|
|
161
|
+
tokenAmount: bigint;
|
|
162
|
+
}>): Promise<TokenTransaction$1>;
|
|
163
|
+
collectOperatorIdentityPublicKeys(): Uint8Array[];
|
|
164
|
+
broadcastTokenTransaction(tokenTransaction: TokenTransaction | TokenTransaction$1, outputsToSpendSigningPublicKeys?: Uint8Array[], outputsToSpendCommitments?: Uint8Array[]): Promise<string>;
|
|
165
|
+
private broadcastTokenTransactionV0;
|
|
166
|
+
private broadcastTokenTransactionV1;
|
|
167
|
+
private startTokenTransactionV0;
|
|
168
|
+
private startTokenTransaction;
|
|
169
|
+
private signTokenTransactionV0;
|
|
170
|
+
private signTokenTransaction;
|
|
171
|
+
fetchOwnedTokenOutputs(params: FetchOwnedTokenOutputsParams): Promise<OutputWithPreviousTransactionData[]>;
|
|
172
|
+
queryTokenTransactions(params: QueryTokenTransactionsParams): Promise<TokenTransactionWithStatus[] | TokenTransactionWithStatus$1[]>;
|
|
173
|
+
private fetchOwnedTokenOutputsV0;
|
|
174
|
+
private fetchOwnedTokenOutputsV1;
|
|
175
|
+
private queryTokenTransactionsV0;
|
|
176
|
+
private queryTokenTransactionsV1;
|
|
177
|
+
selectTokenOutputs(tokenOutputs: OutputWithPreviousTransactionData[], tokenAmount: bigint, strategy: "SMALL_FIRST" | "LARGE_FIRST"): OutputWithPreviousTransactionData[];
|
|
178
|
+
private sortTokenOutputsByStrategy;
|
|
179
|
+
private signMessageWithKey;
|
|
180
|
+
private finalizeTokenTransaction;
|
|
181
|
+
private createSignaturesForOperators;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { AuthenticationError as A, ConfigurationError as C, InternalValidationError as I, NetworkError as N, RPCError as R, SparkSDKError as S, TokenTransactionService as T, ValidationError as V, NotImplementedError as a };
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { a as OutputWithPreviousTransactionData, T as TokenTransaction, b as TokenTransactionWithStatus } from './spark-Cj4brrP5.cjs';
|
|
2
|
+
import { TokenTransaction as TokenTransaction$1, TokenTransactionWithStatus as TokenTransactionWithStatus$1 } from './proto/spark_token.cjs';
|
|
3
|
+
import { W as WalletConfigService, C as ConnectionManager, v as TokenOutputsMap, B as Bech32mTokenIdentifier } from './spark-wallet-BbOf2P2l.cjs';
|
|
4
|
+
|
|
5
|
+
declare class SparkSDKError extends Error {
|
|
6
|
+
readonly context: Record<string, unknown>;
|
|
7
|
+
readonly originalError?: Error;
|
|
8
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
9
|
+
toString(): string;
|
|
10
|
+
toJSON(): Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* NetworkError should be used for any errors related to network communication,
|
|
15
|
+
* such as failed HTTP requests, timeouts, or connection issues.
|
|
16
|
+
* This includes:
|
|
17
|
+
* - Failed API calls
|
|
18
|
+
* - Network timeouts
|
|
19
|
+
* - Connection refused
|
|
20
|
+
* - DNS resolution failures
|
|
21
|
+
* - SSL/TLS errors
|
|
22
|
+
*/
|
|
23
|
+
declare class NetworkError extends SparkSDKError {
|
|
24
|
+
constructor(message: string, context?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
method?: string;
|
|
27
|
+
statusCode?: number;
|
|
28
|
+
response?: unknown;
|
|
29
|
+
errorCount?: number;
|
|
30
|
+
errors?: string;
|
|
31
|
+
operation?: string;
|
|
32
|
+
nodeSignaturesCount?: number;
|
|
33
|
+
}, originalError?: Error);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* ValidationError should be used for any errors related to data validation in regards to the user's input,
|
|
37
|
+
* This includes:
|
|
38
|
+
* - Invalid signatures
|
|
39
|
+
* - Malformed addresses
|
|
40
|
+
* - Invalid proof of possession
|
|
41
|
+
* - Invalid cryptographic parameters
|
|
42
|
+
* - Data format validation failures
|
|
43
|
+
*/
|
|
44
|
+
declare class ValidationError extends SparkSDKError {
|
|
45
|
+
constructor(message: string, context?: {
|
|
46
|
+
field?: string;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
expected?: unknown;
|
|
49
|
+
expectedLength?: number;
|
|
50
|
+
actualLength?: number;
|
|
51
|
+
rValue?: bigint;
|
|
52
|
+
fieldPrime?: bigint;
|
|
53
|
+
sValue?: bigint;
|
|
54
|
+
groupOrder?: bigint;
|
|
55
|
+
index?: number;
|
|
56
|
+
treeLength?: number;
|
|
57
|
+
addressNodesLength?: number;
|
|
58
|
+
}, originalError?: Error);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* InternalValidationError should be used for any errors related to internal data validation
|
|
62
|
+
* that is not related to the user's input.
|
|
63
|
+
* This includes:
|
|
64
|
+
* - Invalid SO responses
|
|
65
|
+
*/
|
|
66
|
+
declare class InternalValidationError extends SparkSDKError {
|
|
67
|
+
constructor(message: string, context?: {
|
|
68
|
+
field?: string;
|
|
69
|
+
value?: unknown;
|
|
70
|
+
expected?: unknown;
|
|
71
|
+
outputIndex?: number;
|
|
72
|
+
keyshareInfo?: unknown;
|
|
73
|
+
signingOperators?: unknown;
|
|
74
|
+
}, originalError?: Error);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* AuthenticationError should be used specifically for authentication and authorization failures,
|
|
78
|
+
* such as invalid credentials or insufficient permissions.
|
|
79
|
+
* This includes:
|
|
80
|
+
* - Invalid API keys
|
|
81
|
+
* - Expired tokens
|
|
82
|
+
* - Insufficient permissions
|
|
83
|
+
* - Authentication token validation failures
|
|
84
|
+
* - Authorization failures
|
|
85
|
+
*/
|
|
86
|
+
declare class AuthenticationError extends SparkSDKError {
|
|
87
|
+
constructor(message: string, context?: {
|
|
88
|
+
endpoint?: string;
|
|
89
|
+
reason?: string;
|
|
90
|
+
}, originalError?: Error);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* RPCError should be used for errors that occur during RPC (Remote Procedure Call) operations,
|
|
94
|
+
* such as invalid RPC parameters or RPC-specific failures.
|
|
95
|
+
* This includes:
|
|
96
|
+
* - Invalid RPC method calls
|
|
97
|
+
* - RPC parameter validation failures
|
|
98
|
+
* - RPC-specific error codes
|
|
99
|
+
* - RPC protocol errors
|
|
100
|
+
*/
|
|
101
|
+
declare class RPCError extends SparkSDKError {
|
|
102
|
+
constructor(message: string, context?: {
|
|
103
|
+
method?: string;
|
|
104
|
+
params?: unknown;
|
|
105
|
+
code?: number;
|
|
106
|
+
}, originalError?: Error);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* ConfigurationError should be used for errors related to SDK configuration,
|
|
110
|
+
* such as missing or invalid configuration values.
|
|
111
|
+
* This includes:
|
|
112
|
+
* - Missing required configuration
|
|
113
|
+
* - Invalid configuration values
|
|
114
|
+
* - Configuration format errors
|
|
115
|
+
* - Environment-specific configuration issues
|
|
116
|
+
*/
|
|
117
|
+
declare class ConfigurationError extends SparkSDKError {
|
|
118
|
+
constructor(message: string, context?: {
|
|
119
|
+
configKey?: string;
|
|
120
|
+
value?: unknown;
|
|
121
|
+
}, originalError?: Error);
|
|
122
|
+
}
|
|
123
|
+
/***
|
|
124
|
+
* NotImplementedError should be used for any errors related to features that are not yet implemented.
|
|
125
|
+
*/
|
|
126
|
+
declare class NotImplementedError extends SparkSDKError {
|
|
127
|
+
constructor(message: string, context?: Record<string, unknown>, originalError?: Error);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface FetchOwnedTokenOutputsParams {
|
|
131
|
+
ownerPublicKeys: Uint8Array[];
|
|
132
|
+
issuerPublicKeys?: Uint8Array[];
|
|
133
|
+
tokenIdentifiers?: Uint8Array[];
|
|
134
|
+
}
|
|
135
|
+
interface QueryTokenTransactionsParams {
|
|
136
|
+
ownerPublicKeys?: string[];
|
|
137
|
+
issuerPublicKeys?: string[];
|
|
138
|
+
tokenTransactionHashes?: string[];
|
|
139
|
+
tokenIdentifiers?: string[];
|
|
140
|
+
outputIds?: string[];
|
|
141
|
+
pageSize?: number;
|
|
142
|
+
offset?: number;
|
|
143
|
+
}
|
|
144
|
+
declare class TokenTransactionService {
|
|
145
|
+
protected readonly config: WalletConfigService;
|
|
146
|
+
protected readonly connectionManager: ConnectionManager;
|
|
147
|
+
constructor(config: WalletConfigService, connectionManager: ConnectionManager);
|
|
148
|
+
tokenTransfer(tokenOutputs: TokenOutputsMap, receiverOutputs: {
|
|
149
|
+
tokenIdentifier: Bech32mTokenIdentifier;
|
|
150
|
+
tokenAmount: bigint;
|
|
151
|
+
receiverSparkAddress: string;
|
|
152
|
+
}[], outputSelectionStrategy?: "SMALL_FIRST" | "LARGE_FIRST", selectedOutputs?: OutputWithPreviousTransactionData[]): Promise<string>;
|
|
153
|
+
constructTransferTokenTransactionV0(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
154
|
+
receiverSparkAddress: Uint8Array;
|
|
155
|
+
tokenPublicKey: Uint8Array;
|
|
156
|
+
tokenAmount: bigint;
|
|
157
|
+
}>): Promise<TokenTransaction>;
|
|
158
|
+
constructTransferTokenTransaction(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputData: Array<{
|
|
159
|
+
receiverSparkAddress: Uint8Array;
|
|
160
|
+
rawTokenIdentifier: Uint8Array;
|
|
161
|
+
tokenAmount: bigint;
|
|
162
|
+
}>): Promise<TokenTransaction$1>;
|
|
163
|
+
collectOperatorIdentityPublicKeys(): Uint8Array[];
|
|
164
|
+
broadcastTokenTransaction(tokenTransaction: TokenTransaction | TokenTransaction$1, outputsToSpendSigningPublicKeys?: Uint8Array[], outputsToSpendCommitments?: Uint8Array[]): Promise<string>;
|
|
165
|
+
private broadcastTokenTransactionV0;
|
|
166
|
+
private broadcastTokenTransactionV1;
|
|
167
|
+
private startTokenTransactionV0;
|
|
168
|
+
private startTokenTransaction;
|
|
169
|
+
private signTokenTransactionV0;
|
|
170
|
+
private signTokenTransaction;
|
|
171
|
+
fetchOwnedTokenOutputs(params: FetchOwnedTokenOutputsParams): Promise<OutputWithPreviousTransactionData[]>;
|
|
172
|
+
queryTokenTransactions(params: QueryTokenTransactionsParams): Promise<TokenTransactionWithStatus[] | TokenTransactionWithStatus$1[]>;
|
|
173
|
+
private fetchOwnedTokenOutputsV0;
|
|
174
|
+
private fetchOwnedTokenOutputsV1;
|
|
175
|
+
private queryTokenTransactionsV0;
|
|
176
|
+
private queryTokenTransactionsV1;
|
|
177
|
+
selectTokenOutputs(tokenOutputs: OutputWithPreviousTransactionData[], tokenAmount: bigint, strategy: "SMALL_FIRST" | "LARGE_FIRST"): OutputWithPreviousTransactionData[];
|
|
178
|
+
private sortTokenOutputsByStrategy;
|
|
179
|
+
private signMessageWithKey;
|
|
180
|
+
private finalizeTokenTransaction;
|
|
181
|
+
private createSignaturesForOperators;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export { AuthenticationError as A, ConfigurationError as C, InternalValidationError as I, NetworkError as N, RPCError as R, SparkSDKError as S, TokenTransactionService as T, ValidationError as V, NotImplementedError as a };
|
package/dist/types/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput,
|
|
1
|
+
export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-CusuvuCe.cjs';
|
|
2
2
|
export { ClaimStaticDepositInput, ClaimStaticDepositRequestType, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getUserRequestQuery } from '../graphql/objects/index.cjs';
|
|
3
|
-
export { l as CommonProto, s as SparkProto } from '../spark-
|
|
3
|
+
export { l as CommonProto, s as SparkProto } from '../spark-Cj4brrP5.cjs';
|
|
4
4
|
import '@lightsparkdev/core';
|
|
5
5
|
import '@buildonspark/lrc20-sdk';
|
|
6
6
|
import '@scure/btc-signer';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput,
|
|
1
|
+
export { B as BitcoinNetwork, O as ClaimStaticDeposit, C as ClaimStaticDepositOutput, Q as ClaimStaticDepositStatus, R as CompleteCoopExitInput, X as CompleteLeavesSwapInput, Y as CoopExitFeeEstimate, Z as CoopExitFeeEstimatesInput, _ as CoopExitFeeEstimatesOutput, F as CoopExitFeeQuote, a0 as CoopExitFeeQuoteInput, G as CoopExitRequest, a2 as CurrencyAmount, a3 as CurrencyUnit, E as ExitSpeed, a4 as GetChallengeOutput, a5 as Invoice, a6 as Leaf, L as LeavesSwapFeeEstimateOutput, a8 as LeavesSwapRequest, x as LightningReceiveRequest, aa as LightningReceiveRequestStatus, z as LightningSendFeeEstimateInput, ab as LightningSendFeeEstimateOutput, y as LightningSendRequest, ad as LightningSendRequestStatus, P as PageInfo, ae as RequestCoopExitInput, af as RequestLeavesSwapInput, ag as RequestLightningReceiveInput, ah as RequestLightningSendInput, ai as SparkCoopExitRequestStatus, aj as SparkLeavesSwapRequestStatus, ak as SparkTransferToLeavesConnection, al as StaticDepositQuoteInput, u as StaticDepositQuoteOutput, am as SwapLeaf, an as Transfer, ar as TransferDirection, ao as UserLeafInput, as as UserRequestType, ap as VerifyChallengeOutput, W as WalletLeaf, w as WalletTransfer, at as WalletTransferLeaf, N as getClaimStaticDepositQuery, $ as getCoopExitFeeQuoteQuery, a1 as getCoopExitRequestQuery, a7 as getLeavesSwapRequestQuery, a9 as getLightningReceiveRequestQuery, ac as getLightningSendRequestQuery, au as mapTransferLeafToWalletTransferLeaf, av as mapTransferToWalletTransfer, aq as mapTreeNodeToWalletLeaf } from '../client-Dn4Ld8pD.js';
|
|
2
2
|
export { ClaimStaticDepositInput, ClaimStaticDepositRequestType, CompleteCoopExitOutput, CompleteLeavesSwapOutput, CompleteSeedReleaseInput, CompleteSeedReleaseOutput, Connection, CoopExitFeeQuoteOutput, Entity, GetChallengeInput, LeavesSwapFeeEstimateInput, NotifyReceiverTransferInput, Provider, RequestCoopExitOutput, RequestLeavesSwapOutput, RequestLightningReceiveOutput, RequestLightningSendOutput, SparkUserRequestStatus, SparkUserRequestType, SparkWalletUser, SparkWalletUserToUserRequestsConnection, StartSeedReleaseInput, UserRequest, VerifyChallengeInput, WalletUserIdentityPublicKeyInput, WalletUserIdentityPublicKeyOutput, getUserRequestQuery } from '../graphql/objects/index.js';
|
|
3
|
-
export { l as CommonProto, s as SparkProto } from '../spark-
|
|
3
|
+
export { l as CommonProto, s as SparkProto } from '../spark-Cj4brrP5.js';
|
|
4
4
|
import '@lightsparkdev/core';
|
|
5
5
|
import '@buildonspark/lrc20-sdk';
|
|
6
6
|
import '@scure/btc-signer';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network,
|
|
5
|
-
import { j as SigningNonce, k as SigningCommitment } from './client-
|
|
6
|
-
import {
|
|
4
|
+
import { N as Network, v as TokenOutputsMap, B as Bech32mTokenIdentifier, u as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-BbOf2P2l.cjs';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-CusuvuCe.cjs';
|
|
6
|
+
import { a as OutputWithPreviousTransactionData, h as TransferPackage, e as SparkServiceClient } from './spark-Cj4brrP5.cjs';
|
|
7
7
|
|
|
8
8
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
9
9
|
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
@@ -51,7 +51,7 @@ declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommi
|
|
|
51
51
|
|
|
52
52
|
declare function sumAvailableTokens(outputs: OutputWithPreviousTransactionData[]): bigint;
|
|
53
53
|
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: TokenOutputsMap, tokenIdentifier: Bech32mTokenIdentifier): boolean;
|
|
54
|
-
declare function
|
|
54
|
+
declare function filterTokenBalanceForTokenIdentifier(tokenBalances: TokenBalanceMap, tokenIdentifier: Bech32mTokenIdentifier): {
|
|
55
55
|
balance: bigint;
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -171,4 +171,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
|
|
|
171
171
|
|
|
172
172
|
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
173
173
|
|
|
174
|
-
export { getCurrentTimelock as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J,
|
|
174
|
+
export { getCurrentTimelock as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J, filterTokenBalanceForTokenIdentifier as K, getTransferPackageSigningPayload as L, DIRECT_TIMELOCK_OFFSET as M, INITIAL_SEQUENCE as N, INITIAL_DIRECT_SEQUENCE as O, TEST_UNILATERAL_DIRECT_SEQUENCE as P, DEFAULT_FEE_SATS as Q, maybeApplyFee as R, createRootTx as S, TEST_UNILATERAL_SEQUENCE as T, createSplitTx as U, createNodeTx as V, createNodeTxs as W, createLeafNodeTx as X, createRefundTx as Y, createRefundTxs as Z, createConnectorRefundTransactions as _, generateAdaptorFromSignature as a, getTransactionSequence as a0, checkIfValidSequence as a1, doesLeafNeedRefresh as a2, getNextTransactionSequence as a3, getEphemeralAnchorOutput as a4, type LeafInfo as a5, type Utxo as a6, type FeeRate as a7, type FeeBumpTxPackage as a8, type FeeBumpTxChain as a9, type TxChain as aa, type BroadcastConfig as ab, type BroadcastResult as ac, isEphemeralAnchorOutput as ad, constructUnilateralExitTxs as ae, constructUnilateralExitFeeBumpPackages as af, constructFeeBumpTx as ag, getSparkAddressFromTaproot as ah, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, getTxEstimatedVbytesSizeByNumberOfInputsOutputs as n, addPublicKeys as o, applyAdditiveTweakToPublicKey as p, addPrivateKeys as q, subtractPrivateKeys as r, subtractPublicKeys as s, sumOfPrivateKeys as t, lastKeyWithTarget as u, validateOutboundAdaptorSignature as v, getLatestDepositTxId as w, isTxBroadcast as x, proofOfPossessionMessageHashForDepositAddress as y, collectResponses as z };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as btc from '@scure/btc-signer';
|
|
2
2
|
import { Transaction } from '@scure/btc-signer';
|
|
3
3
|
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network,
|
|
5
|
-
import { j as SigningNonce, k as SigningCommitment } from './client-
|
|
6
|
-
import {
|
|
4
|
+
import { N as Network, v as TokenOutputsMap, B as Bech32mTokenIdentifier, u as TokenBalanceMap, S as SparkAddressFormat } from './spark-wallet-B6YthxDI.js';
|
|
5
|
+
import { j as SigningNonce, k as SigningCommitment } from './client-Dn4Ld8pD.js';
|
|
6
|
+
import { a as OutputWithPreviousTransactionData, h as TransferPackage, e as SparkServiceClient } from './spark-Cj4brrP5.js';
|
|
7
7
|
|
|
8
8
|
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
9
9
|
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
@@ -51,7 +51,7 @@ declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommi
|
|
|
51
51
|
|
|
52
52
|
declare function sumAvailableTokens(outputs: OutputWithPreviousTransactionData[]): bigint;
|
|
53
53
|
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: TokenOutputsMap, tokenIdentifier: Bech32mTokenIdentifier): boolean;
|
|
54
|
-
declare function
|
|
54
|
+
declare function filterTokenBalanceForTokenIdentifier(tokenBalances: TokenBalanceMap, tokenIdentifier: Bech32mTokenIdentifier): {
|
|
55
55
|
balance: bigint;
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -171,4 +171,4 @@ declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRa
|
|
|
171
171
|
|
|
172
172
|
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
173
173
|
|
|
174
|
-
export { getCurrentTimelock as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J,
|
|
174
|
+
export { getCurrentTimelock as $, getRandomSigningNonce as A, createSigningNonce as B, getSigningCommitmentFromNonce as C, encodeSigningNonceToBytes as D, decodeBytesToSigningNonce as E, createSigningCommitment as F, encodeSigningCommitmentToBytes as G, decodeBytesToSigningCommitment as H, sumAvailableTokens as I, checkIfSelectedOutputsAreAvailable as J, filterTokenBalanceForTokenIdentifier as K, getTransferPackageSigningPayload as L, DIRECT_TIMELOCK_OFFSET as M, INITIAL_SEQUENCE as N, INITIAL_DIRECT_SEQUENCE as O, TEST_UNILATERAL_DIRECT_SEQUENCE as P, DEFAULT_FEE_SATS as Q, maybeApplyFee as R, createRootTx as S, TEST_UNILATERAL_SEQUENCE as T, createSplitTx as U, createNodeTx as V, createNodeTxs as W, createLeafNodeTx as X, createRefundTx as Y, createRefundTxs as Z, createConnectorRefundTransactions as _, generateAdaptorFromSignature as a, getTransactionSequence as a0, checkIfValidSequence as a1, doesLeafNeedRefresh as a2, getNextTransactionSequence as a3, getEphemeralAnchorOutput as a4, type LeafInfo as a5, type Utxo as a6, type FeeRate as a7, type FeeBumpTxPackage as a8, type FeeBumpTxChain as a9, type TxChain as aa, type BroadcastConfig as ab, type BroadcastResult as ac, isEphemeralAnchorOutput as ad, constructUnilateralExitTxs as ae, constructUnilateralExitFeeBumpPackages as af, constructFeeBumpTx as ag, getSparkAddressFromTaproot as ah, applyAdaptorToSignature as b, computeTaprootKeyNoScript as c, getP2TRScriptFromPublicKey as d, getP2TRAddressFromPublicKey as e, getP2TRAddressFromPkScript as f, generateSignatureFromExistingAdaptor as g, getP2WPKHAddressFromPublicKey as h, getTxFromRawTxHex as i, getTxFromRawTxBytes as j, getSigHashFromTx as k, getTxId as l, getTxIdNoReverse as m, getTxEstimatedVbytesSizeByNumberOfInputsOutputs as n, addPublicKeys as o, applyAdditiveTweakToPublicKey as p, addPrivateKeys as q, subtractPrivateKeys as r, subtractPublicKeys as s, sumOfPrivateKeys as t, lastKeyWithTarget as u, validateOutboundAdaptorSignature as v, getLatestDepositTxId as w, isTxBroadcast as x, proofOfPossessionMessageHashForDepositAddress as y, collectResponses as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@buildonspark/spark-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -133,14 +133,19 @@
|
|
|
133
133
|
"dependencies": {
|
|
134
134
|
"@bitcoinerlab/secp256k1": "^1.1.1",
|
|
135
135
|
"@bufbuild/protobuf": "^2.2.5",
|
|
136
|
-
"@buildonspark/lrc20-sdk": "0.0.
|
|
136
|
+
"@buildonspark/lrc20-sdk": "0.0.61",
|
|
137
137
|
"@lightsparkdev/core": "^1.4.2",
|
|
138
138
|
"@noble/curves": "^1.8.0",
|
|
139
139
|
"@noble/hashes": "^1.7.1",
|
|
140
140
|
"@opentelemetry/api": "^1.9.0",
|
|
141
141
|
"@opentelemetry/context-async-hooks": "^2.0.0",
|
|
142
142
|
"@opentelemetry/core": "^2.0.0",
|
|
143
|
+
"@opentelemetry/instrumentation": "^0.203.0",
|
|
144
|
+
"@opentelemetry/instrumentation-fetch": "^0.203.0",
|
|
145
|
+
"@opentelemetry/instrumentation-undici": "^0.14.0",
|
|
143
146
|
"@opentelemetry/sdk-trace-base": "^2.0.0",
|
|
147
|
+
"@opentelemetry/sdk-trace-node": "^2.0.1",
|
|
148
|
+
"@opentelemetry/sdk-trace-web": "^2.0.1",
|
|
144
149
|
"@scure/base": "^1.2.4",
|
|
145
150
|
"@scure/bip32": "^1.6.2",
|
|
146
151
|
"@scure/bip39": "^1.5.4",
|
package/src/index.node.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* Root Node.js entrypoint */
|
|
2
2
|
|
|
3
3
|
import nodeCrypto from "crypto";
|
|
4
|
+
|
|
4
5
|
import { setCrypto } from "./utils/crypto.js";
|
|
5
6
|
|
|
6
7
|
const cryptoImpl =
|
|
@@ -21,7 +22,10 @@ export {
|
|
|
21
22
|
} from "./signer/signer.js";
|
|
22
23
|
export * from "./signer/types.js";
|
|
23
24
|
|
|
24
|
-
export {
|
|
25
|
+
export {
|
|
26
|
+
SparkWalletNodeJS as SparkWallet,
|
|
27
|
+
initializeTracerEnvNodeJS as initializeTracerEnv,
|
|
28
|
+
} from "./spark-wallet/spark-wallet.node.js";
|
|
25
29
|
export * from "./spark-wallet/types.js";
|
|
26
30
|
|
|
27
31
|
export { type WalletConfigService } from "./services/config.js";
|
package/src/index.ts
CHANGED
|
@@ -24,7 +24,10 @@ export {
|
|
|
24
24
|
} from "./signer/signer.js";
|
|
25
25
|
export * from "./signer/types.js";
|
|
26
26
|
|
|
27
|
-
export {
|
|
27
|
+
export {
|
|
28
|
+
SparkWalletBrowser as SparkWallet,
|
|
29
|
+
initializeTracerEnvBrowser as initializeTracerEnv,
|
|
30
|
+
} from "./spark-wallet/spark-wallet.browser.js";
|
|
28
31
|
export * from "./spark-wallet/types.js";
|
|
29
32
|
|
|
30
33
|
export { type WalletConfigService } from "./services/config.js";
|
package/src/services/config.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
ConfigOptions,
|
|
11
11
|
WalletConfig,
|
|
12
12
|
SigningOperator,
|
|
13
|
+
ConsoleOptions,
|
|
13
14
|
} from "./wallet-config.js";
|
|
14
15
|
import { ConfigurationError } from "../errors/types.js";
|
|
15
16
|
|
|
@@ -47,7 +48,7 @@ export class WalletConfigService
|
|
|
47
48
|
|
|
48
49
|
public getCoordinatorAddress(): string {
|
|
49
50
|
const coordinator =
|
|
50
|
-
this.config.signingOperators[this.config.
|
|
51
|
+
this.config.signingOperators[this.config.coordinatorIdentifier];
|
|
51
52
|
if (!coordinator) {
|
|
52
53
|
throw new ConfigurationError(
|
|
53
54
|
"Coordinator not found in signing operators",
|
|
@@ -72,7 +73,7 @@ export class WalletConfigService
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
public getCoordinatorIdentifier(): string {
|
|
75
|
-
return this.config.
|
|
76
|
+
return this.config.coordinatorIdentifier;
|
|
76
77
|
}
|
|
77
78
|
|
|
78
79
|
public getExpectedWithdrawBondSats(): number {
|
|
@@ -124,7 +125,17 @@ export class WalletConfigService
|
|
|
124
125
|
return this.config.electrsUrl;
|
|
125
126
|
}
|
|
126
127
|
|
|
128
|
+
public getSspBaseUrl(): string {
|
|
129
|
+
return this.config.sspClientOptions.baseUrl;
|
|
130
|
+
}
|
|
131
|
+
|
|
127
132
|
public getSspIdentityPublicKey(): string {
|
|
128
133
|
return this.config.sspClientOptions.identityPublicKey;
|
|
129
134
|
}
|
|
135
|
+
|
|
136
|
+
public getConsoleOptions(): ConsoleOptions {
|
|
137
|
+
return {
|
|
138
|
+
...this.config.console,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
130
141
|
}
|
|
@@ -71,8 +71,8 @@ export interface QueryTokenTransactionsParams {
|
|
|
71
71
|
tokenTransactionHashes?: string[];
|
|
72
72
|
tokenIdentifiers?: string[];
|
|
73
73
|
outputIds?: string[];
|
|
74
|
-
pageSize
|
|
75
|
-
offset
|
|
74
|
+
pageSize?: number;
|
|
75
|
+
offset?: number;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
export class TokenTransactionService {
|
|
@@ -1043,6 +1043,8 @@ export class TokenTransactionService {
|
|
|
1043
1043
|
tokenTransactionHashes,
|
|
1044
1044
|
tokenIdentifiers,
|
|
1045
1045
|
outputIds,
|
|
1046
|
+
pageSize,
|
|
1047
|
+
offset,
|
|
1046
1048
|
} = params;
|
|
1047
1049
|
|
|
1048
1050
|
const sparkClient = await this.connectionManager.createSparkClient(
|
|
@@ -1052,11 +1054,17 @@ export class TokenTransactionService {
|
|
|
1052
1054
|
let queryParams: QueryTokenTransactionsRequestV0 = {
|
|
1053
1055
|
tokenPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
|
|
1054
1056
|
ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
|
|
1055
|
-
tokenIdentifiers: tokenIdentifiers?.map(
|
|
1057
|
+
tokenIdentifiers: tokenIdentifiers?.map((identifier) => {
|
|
1058
|
+
const { tokenIdentifier } = decodeBech32mTokenIdentifier(
|
|
1059
|
+
identifier as Bech32mTokenIdentifier,
|
|
1060
|
+
this.config.getNetworkType(),
|
|
1061
|
+
);
|
|
1062
|
+
return tokenIdentifier;
|
|
1063
|
+
})!,
|
|
1056
1064
|
tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
|
|
1057
1065
|
outputIds: outputIds || [],
|
|
1058
|
-
limit:
|
|
1059
|
-
offset:
|
|
1066
|
+
limit: pageSize!,
|
|
1067
|
+
offset: offset!,
|
|
1060
1068
|
};
|
|
1061
1069
|
|
|
1062
1070
|
try {
|
|
@@ -1120,11 +1128,17 @@ export class TokenTransactionService {
|
|
|
1120
1128
|
let queryParams: QueryTokenTransactionsRequestV1 = {
|
|
1121
1129
|
issuerPublicKeys: issuerPublicKeys?.map(hexToBytes)!,
|
|
1122
1130
|
ownerPublicKeys: ownerPublicKeys?.map(hexToBytes)!,
|
|
1123
|
-
tokenIdentifiers: tokenIdentifiers?.map(
|
|
1131
|
+
tokenIdentifiers: tokenIdentifiers?.map((identifier) => {
|
|
1132
|
+
const { tokenIdentifier } = decodeBech32mTokenIdentifier(
|
|
1133
|
+
identifier as Bech32mTokenIdentifier,
|
|
1134
|
+
this.config.getNetworkType(),
|
|
1135
|
+
);
|
|
1136
|
+
return tokenIdentifier;
|
|
1137
|
+
})!,
|
|
1124
1138
|
tokenTransactionHashes: tokenTransactionHashes?.map(hexToBytes)!,
|
|
1125
1139
|
outputIds: outputIds || [],
|
|
1126
|
-
limit: pageSize
|
|
1127
|
-
offset: offset
|
|
1140
|
+
limit: pageSize!,
|
|
1141
|
+
offset: offset!,
|
|
1128
1142
|
};
|
|
1129
1143
|
|
|
1130
1144
|
try {
|