@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
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import * as btc from '@scure/btc-signer';
|
|
2
|
-
import { Transaction } from '@scure/btc-signer';
|
|
3
|
-
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network } from './network-CqgsdUF2.cjs';
|
|
5
|
-
import { S as SparkSigner, i as SigningNonce, h as SigningCommitment } from './signer-DKS0AJkw.cjs';
|
|
6
|
-
import { j as OutputWithPreviousTransactionData, l as TransferPackage, g as SparkServiceClient } from './spark-dM7EYXYQ.cjs';
|
|
7
|
-
import { ConfigOptions } from './services/wallet-config.cjs';
|
|
8
|
-
import { SparkAddressFormat } from './address/index.cjs';
|
|
9
|
-
|
|
10
|
-
type HumanReadableTokenIdentifier = `btk1${string}` | `btkrt1${string}` | `btkt1${string}` | `btks1${string}` | `btkl1${string}`;
|
|
11
|
-
|
|
12
|
-
type CreateLightningInvoiceParams = {
|
|
13
|
-
amountSats: number;
|
|
14
|
-
memo?: string;
|
|
15
|
-
expirySeconds?: number;
|
|
16
|
-
includeSparkAddress?: boolean;
|
|
17
|
-
receiverIdentityPubkey?: string;
|
|
18
|
-
descriptionHash?: string;
|
|
19
|
-
};
|
|
20
|
-
type PayLightningInvoiceParams = {
|
|
21
|
-
invoice: string;
|
|
22
|
-
maxFeeSats: number;
|
|
23
|
-
preferSpark?: boolean;
|
|
24
|
-
amountSatsToSend?: number;
|
|
25
|
-
};
|
|
26
|
-
type TransferParams = {
|
|
27
|
-
amountSats: number;
|
|
28
|
-
receiverSparkAddress: string;
|
|
29
|
-
};
|
|
30
|
-
type DepositParams = {
|
|
31
|
-
signingPubKey: Uint8Array;
|
|
32
|
-
verifyingKey: Uint8Array;
|
|
33
|
-
depositTx: Transaction;
|
|
34
|
-
vout: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Token metadata containing essential information about a token.
|
|
38
|
-
* This is the wallet's internal representation with JavaScript-friendly types.
|
|
39
|
-
*
|
|
40
|
-
* rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
|
|
41
|
-
*
|
|
42
|
-
* tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const tokenMetadata: TokenMetadata = {
|
|
47
|
-
* rawTokenIdentifier: new Uint8Array([1, 2, 3]),
|
|
48
|
-
* tokenPublicKey: "0348fbb...",
|
|
49
|
-
* tokenName: "SparkToken",
|
|
50
|
-
* tokenTicker: "SPK",
|
|
51
|
-
* decimals: 8,
|
|
52
|
-
* maxSupply: 1000000n
|
|
53
|
-
* };
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
type TokenMetadata = {
|
|
57
|
-
/** Raw binary token identifier - This is used to encode the human readable token identifier */
|
|
58
|
-
rawTokenIdentifier: Uint8Array;
|
|
59
|
-
/** Hex-encoded public key of the token issuer - Same as issuerPublicKey */
|
|
60
|
-
tokenPublicKey: string;
|
|
61
|
-
/** Human-readable name of the token (e.g., SparkToken)*/
|
|
62
|
-
tokenName: string;
|
|
63
|
-
/** Short ticker symbol for the token (e.g., "SPK") */
|
|
64
|
-
tokenTicker: string;
|
|
65
|
-
/** Number of decimal places for token amounts */
|
|
66
|
-
decimals: number;
|
|
67
|
-
/** Maximum supply of tokens that can ever be minted */
|
|
68
|
-
maxSupply: bigint;
|
|
69
|
-
};
|
|
70
|
-
type TokenBalanceMap = Map<HumanReadableTokenIdentifier, {
|
|
71
|
-
balance: bigint;
|
|
72
|
-
tokenMetadata: TokenMetadata;
|
|
73
|
-
}>;
|
|
74
|
-
type InitWalletResponse = {
|
|
75
|
-
mnemonic?: string | undefined;
|
|
76
|
-
};
|
|
77
|
-
interface SparkWalletProps {
|
|
78
|
-
mnemonicOrSeed?: Uint8Array | string;
|
|
79
|
-
accountNumber?: number;
|
|
80
|
-
signer?: SparkSigner;
|
|
81
|
-
options?: ConfigOptions;
|
|
82
|
-
}
|
|
83
|
-
interface SparkWalletEvents {
|
|
84
|
-
/** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
|
|
85
|
-
"transfer:claimed": (transferId: string, updatedBalance: number) => void;
|
|
86
|
-
/** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
|
|
87
|
-
"deposit:confirmed": (depositId: string, updatedBalance: number) => void;
|
|
88
|
-
/** Emitted when the stream is connected */
|
|
89
|
-
"stream:connected": () => void;
|
|
90
|
-
/** Emitted when the stream disconnects and fails to reconnect after max attempts */
|
|
91
|
-
"stream:disconnected": (reason: string) => void;
|
|
92
|
-
/** Emitted when attempting to reconnect the stream */
|
|
93
|
-
"stream:reconnecting": (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
97
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
98
|
-
adaptorSignature: Uint8Array;
|
|
99
|
-
adaptorPrivateKey: Uint8Array;
|
|
100
|
-
};
|
|
101
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
102
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
103
|
-
|
|
104
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
105
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
106
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
107
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
108
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
109
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
110
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
111
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
112
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
113
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
114
|
-
|
|
115
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
116
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
117
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
118
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
119
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
120
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
121
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
122
|
-
|
|
123
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
124
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
125
|
-
|
|
126
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
127
|
-
|
|
128
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
129
|
-
|
|
130
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
131
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
132
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
133
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
134
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
135
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
136
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
137
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
138
|
-
|
|
139
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
140
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
141
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalanceMap, publicKey: string): {
|
|
142
|
-
balance: bigint;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
146
|
-
|
|
147
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
148
|
-
/**
|
|
149
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
150
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
151
|
-
*/
|
|
152
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
153
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
154
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
155
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
156
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
157
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
158
|
-
nextSequence: number;
|
|
159
|
-
needRefresh: boolean;
|
|
160
|
-
};
|
|
161
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
162
|
-
|
|
163
|
-
interface LeafInfo {
|
|
164
|
-
leafId: string;
|
|
165
|
-
nodeTx: string;
|
|
166
|
-
refundTx: string;
|
|
167
|
-
}
|
|
168
|
-
interface Utxo {
|
|
169
|
-
txid: string;
|
|
170
|
-
vout: number;
|
|
171
|
-
value: bigint;
|
|
172
|
-
script: string;
|
|
173
|
-
publicKey: string;
|
|
174
|
-
}
|
|
175
|
-
interface FeeRate {
|
|
176
|
-
satPerVbyte: number;
|
|
177
|
-
}
|
|
178
|
-
interface FeeBumpTxPackage {
|
|
179
|
-
tx: string;
|
|
180
|
-
feeBumpPsbt?: string;
|
|
181
|
-
}
|
|
182
|
-
interface FeeBumpTxChain {
|
|
183
|
-
leafId: string;
|
|
184
|
-
txPackages: FeeBumpTxPackage[];
|
|
185
|
-
}
|
|
186
|
-
interface TxChain {
|
|
187
|
-
leafId: string;
|
|
188
|
-
transactions: string[];
|
|
189
|
-
}
|
|
190
|
-
interface BroadcastConfig {
|
|
191
|
-
bitcoinCoreRpcUrl?: string;
|
|
192
|
-
rpcUsername?: string;
|
|
193
|
-
rpcPassword?: string;
|
|
194
|
-
autoBroadcast?: boolean;
|
|
195
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
196
|
-
}
|
|
197
|
-
interface BroadcastResult {
|
|
198
|
-
success: boolean;
|
|
199
|
-
txids?: string[];
|
|
200
|
-
error?: string;
|
|
201
|
-
broadcastedPackages?: number;
|
|
202
|
-
}
|
|
203
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
204
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
205
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
206
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
207
|
-
feeBumpPsbt: string;
|
|
208
|
-
usedUtxos: Utxo[];
|
|
209
|
-
correctedParentTx?: string;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
213
|
-
|
|
214
|
-
export { getEphemeralAnchorOutput as $, proofOfPossessionMessageHashForDepositAddress as A, collectResponses as B, type CreateLightningInvoiceParams as C, type DepositParams as D, getRandomSigningNonce as E, createSigningNonce as F, getSigningCommitmentFromNonce as G, encodeSigningNonceToBytes as H, type InitWalletResponse as I, decodeBytesToSigningNonce as J, createSigningCommitment as K, encodeSigningCommitmentToBytes as L, decodeBytesToSigningCommitment as M, calculateAvailableTokenAmount as N, checkIfSelectedOutputsAreAvailable as O, type PayLightningInvoiceParams as P, filterTokenBalanceForTokenPublicKey as Q, getTransferPackageSigningPayload as R, type SparkWalletProps as S, type TransferParams as T, DEFAULT_FEE_SATS as U, maybeApplyFee as V, createRefundTx as W, getCurrentTimelock as X, getTransactionSequence as Y, checkIfValidSequence as Z, getNextTransactionSequence as _, type TokenMetadata as a, type LeafInfo as a0, type Utxo as a1, type FeeRate as a2, type FeeBumpTxPackage as a3, type FeeBumpTxChain as a4, type TxChain as a5, type BroadcastConfig as a6, type BroadcastResult as a7, isEphemeralAnchorOutput as a8, constructUnilateralExitTxs as a9, constructUnilateralExitFeeBumpPackages as aa, constructFeeBumpTx as ab, getSparkAddressFromTaproot as ac, type TokenBalanceMap as b, type SparkWalletEvents as c, generateAdaptorFromSignature as d, applyAdaptorToSignature as e, computeTaprootKeyNoScript as f, generateSignatureFromExistingAdaptor as g, getP2TRScriptFromPublicKey as h, getP2TRAddressFromPublicKey as i, getP2TRAddressFromPkScript as j, getP2WPKHAddressFromPublicKey as k, getTxFromRawTxHex as l, getTxFromRawTxBytes as m, getSigHashFromTx as n, getTxId as o, getTxIdNoReverse as p, addPublicKeys as q, applyAdditiveTweakToPublicKey as r, subtractPublicKeys as s, addPrivateKeys as t, subtractPrivateKeys as u, validateOutboundAdaptorSignature as v, sumOfPrivateKeys as w, lastKeyWithTarget as x, getLatestDepositTxId as y, isTxBroadcast as z };
|
package/dist/index-CJDi1HWc.d.ts
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import * as btc from '@scure/btc-signer';
|
|
2
|
-
import { Transaction } from '@scure/btc-signer';
|
|
3
|
-
import { TransactionOutput, TransactionInput } from '@scure/btc-signer/psbt';
|
|
4
|
-
import { N as Network } from './network-BTJl-Sul.js';
|
|
5
|
-
import { S as SparkSigner, i as SigningNonce, h as SigningCommitment } from './signer-BocS_J6B.js';
|
|
6
|
-
import { j as OutputWithPreviousTransactionData, l as TransferPackage, g as SparkServiceClient } from './spark-dM7EYXYQ.js';
|
|
7
|
-
import { ConfigOptions } from './services/wallet-config.js';
|
|
8
|
-
import { SparkAddressFormat } from './address/index.js';
|
|
9
|
-
|
|
10
|
-
type HumanReadableTokenIdentifier = `btk1${string}` | `btkrt1${string}` | `btkt1${string}` | `btks1${string}` | `btkl1${string}`;
|
|
11
|
-
|
|
12
|
-
type CreateLightningInvoiceParams = {
|
|
13
|
-
amountSats: number;
|
|
14
|
-
memo?: string;
|
|
15
|
-
expirySeconds?: number;
|
|
16
|
-
includeSparkAddress?: boolean;
|
|
17
|
-
receiverIdentityPubkey?: string;
|
|
18
|
-
descriptionHash?: string;
|
|
19
|
-
};
|
|
20
|
-
type PayLightningInvoiceParams = {
|
|
21
|
-
invoice: string;
|
|
22
|
-
maxFeeSats: number;
|
|
23
|
-
preferSpark?: boolean;
|
|
24
|
-
amountSatsToSend?: number;
|
|
25
|
-
};
|
|
26
|
-
type TransferParams = {
|
|
27
|
-
amountSats: number;
|
|
28
|
-
receiverSparkAddress: string;
|
|
29
|
-
};
|
|
30
|
-
type DepositParams = {
|
|
31
|
-
signingPubKey: Uint8Array;
|
|
32
|
-
verifyingKey: Uint8Array;
|
|
33
|
-
depositTx: Transaction;
|
|
34
|
-
vout: number;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Token metadata containing essential information about a token.
|
|
38
|
-
* This is the wallet's internal representation with JavaScript-friendly types.
|
|
39
|
-
*
|
|
40
|
-
* rawTokenIdentifier: This is the raw binary token identifier - This is used to encode the human readable token identifier.
|
|
41
|
-
*
|
|
42
|
-
* tokenPublicKey: This is the hex-encoded public key of the token issuer - Same as issuerPublicKey.
|
|
43
|
-
*
|
|
44
|
-
* @example
|
|
45
|
-
* ```typescript
|
|
46
|
-
* const tokenMetadata: TokenMetadata = {
|
|
47
|
-
* rawTokenIdentifier: new Uint8Array([1, 2, 3]),
|
|
48
|
-
* tokenPublicKey: "0348fbb...",
|
|
49
|
-
* tokenName: "SparkToken",
|
|
50
|
-
* tokenTicker: "SPK",
|
|
51
|
-
* decimals: 8,
|
|
52
|
-
* maxSupply: 1000000n
|
|
53
|
-
* };
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
type TokenMetadata = {
|
|
57
|
-
/** Raw binary token identifier - This is used to encode the human readable token identifier */
|
|
58
|
-
rawTokenIdentifier: Uint8Array;
|
|
59
|
-
/** Hex-encoded public key of the token issuer - Same as issuerPublicKey */
|
|
60
|
-
tokenPublicKey: string;
|
|
61
|
-
/** Human-readable name of the token (e.g., SparkToken)*/
|
|
62
|
-
tokenName: string;
|
|
63
|
-
/** Short ticker symbol for the token (e.g., "SPK") */
|
|
64
|
-
tokenTicker: string;
|
|
65
|
-
/** Number of decimal places for token amounts */
|
|
66
|
-
decimals: number;
|
|
67
|
-
/** Maximum supply of tokens that can ever be minted */
|
|
68
|
-
maxSupply: bigint;
|
|
69
|
-
};
|
|
70
|
-
type TokenBalanceMap = Map<HumanReadableTokenIdentifier, {
|
|
71
|
-
balance: bigint;
|
|
72
|
-
tokenMetadata: TokenMetadata;
|
|
73
|
-
}>;
|
|
74
|
-
type InitWalletResponse = {
|
|
75
|
-
mnemonic?: string | undefined;
|
|
76
|
-
};
|
|
77
|
-
interface SparkWalletProps {
|
|
78
|
-
mnemonicOrSeed?: Uint8Array | string;
|
|
79
|
-
accountNumber?: number;
|
|
80
|
-
signer?: SparkSigner;
|
|
81
|
-
options?: ConfigOptions;
|
|
82
|
-
}
|
|
83
|
-
interface SparkWalletEvents {
|
|
84
|
-
/** Emitted when an incoming transfer is successfully claimed. Includes the transfer ID and new total balance. */
|
|
85
|
-
"transfer:claimed": (transferId: string, updatedBalance: number) => void;
|
|
86
|
-
/** Emitted when a deposit is marked as available. Includes the deposit ID and new total balance. */
|
|
87
|
-
"deposit:confirmed": (depositId: string, updatedBalance: number) => void;
|
|
88
|
-
/** Emitted when the stream is connected */
|
|
89
|
-
"stream:connected": () => void;
|
|
90
|
-
/** Emitted when the stream disconnects and fails to reconnect after max attempts */
|
|
91
|
-
"stream:disconnected": (reason: string) => void;
|
|
92
|
-
/** Emitted when attempting to reconnect the stream */
|
|
93
|
-
"stream:reconnecting": (attempt: number, maxAttempts: number, delayMs: number, error: string) => void;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
declare function generateSignatureFromExistingAdaptor(signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
97
|
-
declare function generateAdaptorFromSignature(signature: Uint8Array): {
|
|
98
|
-
adaptorSignature: Uint8Array;
|
|
99
|
-
adaptorPrivateKey: Uint8Array;
|
|
100
|
-
};
|
|
101
|
-
declare function validateOutboundAdaptorSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPubkey: Uint8Array): boolean;
|
|
102
|
-
declare function applyAdaptorToSignature(pubkey: Uint8Array, hash: Uint8Array, signature: Uint8Array, adaptorPrivateKeyBytes: Uint8Array): Uint8Array;
|
|
103
|
-
|
|
104
|
-
declare function computeTaprootKeyNoScript(pubkey: Uint8Array): Uint8Array;
|
|
105
|
-
declare function getP2TRScriptFromPublicKey(pubKey: Uint8Array, network: Network): Uint8Array;
|
|
106
|
-
declare function getP2TRAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
107
|
-
declare function getP2TRAddressFromPkScript(pkScript: Uint8Array, network: Network): string;
|
|
108
|
-
declare function getP2WPKHAddressFromPublicKey(pubKey: Uint8Array, network: Network): string;
|
|
109
|
-
declare function getTxFromRawTxHex(rawTxHex: string): btc.Transaction;
|
|
110
|
-
declare function getTxFromRawTxBytes(rawTxBytes: Uint8Array): btc.Transaction;
|
|
111
|
-
declare function getSigHashFromTx(tx: btc.Transaction, inputIndex: number, prevOutput: TransactionOutput): Uint8Array;
|
|
112
|
-
declare function getTxId(tx: btc.Transaction): string;
|
|
113
|
-
declare function getTxIdNoReverse(tx: btc.Transaction): string;
|
|
114
|
-
|
|
115
|
-
declare function addPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array;
|
|
116
|
-
declare function applyAdditiveTweakToPublicKey(pubkey: Uint8Array, tweak: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
117
|
-
declare function subtractPublicKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
118
|
-
declare function addPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
119
|
-
declare function subtractPrivateKeys(a: Uint8Array, b: Uint8Array): Uint8Array<ArrayBufferLike>;
|
|
120
|
-
declare function sumOfPrivateKeys(keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
121
|
-
declare function lastKeyWithTarget(target: Uint8Array, keys: Uint8Array[]): Uint8Array<ArrayBufferLike>;
|
|
122
|
-
|
|
123
|
-
declare function getLatestDepositTxId(address: string): Promise<string | null>;
|
|
124
|
-
declare function isTxBroadcast(txid: string, baseUrl: string, network?: any): Promise<boolean>;
|
|
125
|
-
|
|
126
|
-
declare function proofOfPossessionMessageHashForDepositAddress(userPubkey: Uint8Array, operatorPubkey: Uint8Array, depositAddress: string): Uint8Array;
|
|
127
|
-
|
|
128
|
-
declare function collectResponses<T>(responses: PromiseSettledResult<T>[]): T[];
|
|
129
|
-
|
|
130
|
-
declare function getRandomSigningNonce(): SigningNonce;
|
|
131
|
-
declare function createSigningNonce(binding: Uint8Array, hiding: Uint8Array): SigningNonce;
|
|
132
|
-
declare function getSigningCommitmentFromNonce(nonce: SigningNonce): SigningCommitment;
|
|
133
|
-
declare function encodeSigningNonceToBytes(nonce: SigningNonce): Uint8Array;
|
|
134
|
-
declare function decodeBytesToSigningNonce(bytes: Uint8Array): SigningNonce;
|
|
135
|
-
declare function createSigningCommitment(binding: Uint8Array, hiding: Uint8Array): SigningCommitment;
|
|
136
|
-
declare function encodeSigningCommitmentToBytes(commitment: SigningCommitment): Uint8Array;
|
|
137
|
-
declare function decodeBytesToSigningCommitment(bytes: Uint8Array): SigningCommitment;
|
|
138
|
-
|
|
139
|
-
declare function calculateAvailableTokenAmount(outputLeaves: OutputWithPreviousTransactionData[]): bigint;
|
|
140
|
-
declare function checkIfSelectedOutputsAreAvailable(selectedOutputs: OutputWithPreviousTransactionData[], tokenOutputs: Map<string, OutputWithPreviousTransactionData[]>, tokenPublicKey: Uint8Array): boolean;
|
|
141
|
-
declare function filterTokenBalanceForTokenPublicKey(tokenBalances: TokenBalanceMap, publicKey: string): {
|
|
142
|
-
balance: bigint;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
declare function getTransferPackageSigningPayload(transferID: string, transferPackage: TransferPackage): Uint8Array;
|
|
146
|
-
|
|
147
|
-
declare const DEFAULT_FEE_SATS: number;
|
|
148
|
-
/**
|
|
149
|
-
* Subtracts the default fee from the amount if it's greater than the fee.
|
|
150
|
-
* Returns the original amount if it's less than or equal to the fee.
|
|
151
|
-
*/
|
|
152
|
-
declare function maybeApplyFee(amount: bigint): bigint;
|
|
153
|
-
declare function createRefundTx(sequence: number, nodeOutPoint: TransactionInput, amountSats: bigint, receivingPubkey: Uint8Array, network: Network): Transaction;
|
|
154
|
-
declare function getCurrentTimelock(currSequence?: number): number;
|
|
155
|
-
declare function getTransactionSequence(currSequence?: number): number;
|
|
156
|
-
declare function checkIfValidSequence(currSequence?: number): void;
|
|
157
|
-
declare function getNextTransactionSequence(currSequence?: number, forRefresh?: boolean): {
|
|
158
|
-
nextSequence: number;
|
|
159
|
-
needRefresh: boolean;
|
|
160
|
-
};
|
|
161
|
-
declare function getEphemeralAnchorOutput(): TransactionOutput;
|
|
162
|
-
|
|
163
|
-
interface LeafInfo {
|
|
164
|
-
leafId: string;
|
|
165
|
-
nodeTx: string;
|
|
166
|
-
refundTx: string;
|
|
167
|
-
}
|
|
168
|
-
interface Utxo {
|
|
169
|
-
txid: string;
|
|
170
|
-
vout: number;
|
|
171
|
-
value: bigint;
|
|
172
|
-
script: string;
|
|
173
|
-
publicKey: string;
|
|
174
|
-
}
|
|
175
|
-
interface FeeRate {
|
|
176
|
-
satPerVbyte: number;
|
|
177
|
-
}
|
|
178
|
-
interface FeeBumpTxPackage {
|
|
179
|
-
tx: string;
|
|
180
|
-
feeBumpPsbt?: string;
|
|
181
|
-
}
|
|
182
|
-
interface FeeBumpTxChain {
|
|
183
|
-
leafId: string;
|
|
184
|
-
txPackages: FeeBumpTxPackage[];
|
|
185
|
-
}
|
|
186
|
-
interface TxChain {
|
|
187
|
-
leafId: string;
|
|
188
|
-
transactions: string[];
|
|
189
|
-
}
|
|
190
|
-
interface BroadcastConfig {
|
|
191
|
-
bitcoinCoreRpcUrl?: string;
|
|
192
|
-
rpcUsername?: string;
|
|
193
|
-
rpcPassword?: string;
|
|
194
|
-
autoBroadcast?: boolean;
|
|
195
|
-
network?: "MAINNET" | "REGTEST" | "TESTNET" | "SIGNET" | "LOCAL";
|
|
196
|
-
}
|
|
197
|
-
interface BroadcastResult {
|
|
198
|
-
success: boolean;
|
|
199
|
-
txids?: string[];
|
|
200
|
-
error?: string;
|
|
201
|
-
broadcastedPackages?: number;
|
|
202
|
-
}
|
|
203
|
-
declare function isEphemeralAnchorOutput(script?: Uint8Array, amount?: bigint): boolean;
|
|
204
|
-
declare function constructUnilateralExitTxs(nodeHexStrings: string[], sparkClient?: SparkServiceClient, network?: any): Promise<TxChain[]>;
|
|
205
|
-
declare function constructUnilateralExitFeeBumpPackages(nodeHexStrings: string[], utxos: Utxo[], feeRate: FeeRate, electrsUrl: string, sparkClient?: SparkServiceClient, network?: any): Promise<FeeBumpTxChain[]>;
|
|
206
|
-
declare function constructFeeBumpTx(txHex: string, utxos: Utxo[], feeRate: FeeRate, previousFeeBumpTx?: string): {
|
|
207
|
-
feeBumpPsbt: string;
|
|
208
|
-
usedUtxos: Utxo[];
|
|
209
|
-
correctedParentTx?: string;
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
declare function getSparkAddressFromTaproot(taprootAddress: string): SparkAddressFormat;
|
|
213
|
-
|
|
214
|
-
export { getEphemeralAnchorOutput as $, proofOfPossessionMessageHashForDepositAddress as A, collectResponses as B, type CreateLightningInvoiceParams as C, type DepositParams as D, getRandomSigningNonce as E, createSigningNonce as F, getSigningCommitmentFromNonce as G, encodeSigningNonceToBytes as H, type InitWalletResponse as I, decodeBytesToSigningNonce as J, createSigningCommitment as K, encodeSigningCommitmentToBytes as L, decodeBytesToSigningCommitment as M, calculateAvailableTokenAmount as N, checkIfSelectedOutputsAreAvailable as O, type PayLightningInvoiceParams as P, filterTokenBalanceForTokenPublicKey as Q, getTransferPackageSigningPayload as R, type SparkWalletProps as S, type TransferParams as T, DEFAULT_FEE_SATS as U, maybeApplyFee as V, createRefundTx as W, getCurrentTimelock as X, getTransactionSequence as Y, checkIfValidSequence as Z, getNextTransactionSequence as _, type TokenMetadata as a, type LeafInfo as a0, type Utxo as a1, type FeeRate as a2, type FeeBumpTxPackage as a3, type FeeBumpTxChain as a4, type TxChain as a5, type BroadcastConfig as a6, type BroadcastResult as a7, isEphemeralAnchorOutput as a8, constructUnilateralExitTxs as a9, constructUnilateralExitFeeBumpPackages as aa, constructFeeBumpTx as ab, getSparkAddressFromTaproot as ac, type TokenBalanceMap as b, type SparkWalletEvents as c, generateAdaptorFromSignature as d, applyAdaptorToSignature as e, computeTaprootKeyNoScript as f, generateSignatureFromExistingAdaptor as g, getP2TRScriptFromPublicKey as h, getP2TRAddressFromPublicKey as i, getP2TRAddressFromPkScript as j, getP2WPKHAddressFromPublicKey as k, getTxFromRawTxHex as l, getTxFromRawTxBytes as m, getSigHashFromTx as n, getTxId as o, getTxIdNoReverse as p, addPublicKeys as q, applyAdditiveTweakToPublicKey as r, subtractPublicKeys as s, addPrivateKeys as t, subtractPrivateKeys as u, validateOutboundAdaptorSignature as v, sumOfPrivateKeys as w, lastKeyWithTarget as x, getLatestDepositTxId as y, isTxBroadcast as z };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { NetworkType as NetworkType$1 } from '@buildonspark/lrc20-sdk';
|
|
2
|
-
import * as btc from '@scure/btc-signer';
|
|
3
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
4
|
-
import { N as Network$1 } from './spark-dM7EYXYQ.js';
|
|
5
|
-
import { B as BitcoinNetwork } from './BitcoinNetwork-TnABML0T.js';
|
|
6
|
-
|
|
7
|
-
declare enum Network {
|
|
8
|
-
MAINNET = 0,
|
|
9
|
-
TESTNET = 1,
|
|
10
|
-
SIGNET = 2,
|
|
11
|
-
REGTEST = 3,
|
|
12
|
-
LOCAL = 4
|
|
13
|
-
}
|
|
14
|
-
type NetworkType = keyof typeof Network;
|
|
15
|
-
declare const NetworkToProto: Record<Network, Network$1>;
|
|
16
|
-
declare const getNetwork: (network: Network) => typeof btc.NETWORK;
|
|
17
|
-
declare const LRC_WALLET_NETWORK: Readonly<{
|
|
18
|
-
0: bitcoin.networks.Network;
|
|
19
|
-
1: bitcoin.networks.Network;
|
|
20
|
-
2: bitcoin.networks.Network;
|
|
21
|
-
3: bitcoin.networks.Network;
|
|
22
|
-
4: bitcoin.networks.Network;
|
|
23
|
-
}>;
|
|
24
|
-
declare const LRC_WALLET_NETWORK_TYPE: Readonly<{
|
|
25
|
-
0: NetworkType$1.MAINNET;
|
|
26
|
-
1: NetworkType$1.TESTNET;
|
|
27
|
-
2: NetworkType$1.TESTNET;
|
|
28
|
-
3: NetworkType$1.REGTEST;
|
|
29
|
-
4: NetworkType$1.LOCAL;
|
|
30
|
-
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Utility function to determine the network from a Bitcoin address.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} address - The Bitcoin address
|
|
35
|
-
* @returns {BitcoinNetwork | null} The detected network or null if not detected
|
|
36
|
-
*/
|
|
37
|
-
declare function getNetworkFromAddress(address: string): BitcoinNetwork.MAINNET | BitcoinNetwork.REGTEST | null;
|
|
38
|
-
/**
|
|
39
|
-
* Utility function to get the network enum value from a string.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} network - The Bitcoin network to turn into an enum value
|
|
42
|
-
* @returns {Network} The enum value matching the string
|
|
43
|
-
*/
|
|
44
|
-
declare function getNetworkFromString(network?: string): Network;
|
|
45
|
-
|
|
46
|
-
export { LRC_WALLET_NETWORK as L, Network as N, type NetworkType as a, NetworkToProto as b, LRC_WALLET_NETWORK_TYPE as c, getNetworkFromAddress as d, getNetworkFromString as e, getNetwork as g };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { NetworkType as NetworkType$1 } from '@buildonspark/lrc20-sdk';
|
|
2
|
-
import * as btc from '@scure/btc-signer';
|
|
3
|
-
import * as bitcoin from 'bitcoinjs-lib';
|
|
4
|
-
import { N as Network$1 } from './spark-dM7EYXYQ.cjs';
|
|
5
|
-
import { B as BitcoinNetwork } from './BitcoinNetwork-TnABML0T.cjs';
|
|
6
|
-
|
|
7
|
-
declare enum Network {
|
|
8
|
-
MAINNET = 0,
|
|
9
|
-
TESTNET = 1,
|
|
10
|
-
SIGNET = 2,
|
|
11
|
-
REGTEST = 3,
|
|
12
|
-
LOCAL = 4
|
|
13
|
-
}
|
|
14
|
-
type NetworkType = keyof typeof Network;
|
|
15
|
-
declare const NetworkToProto: Record<Network, Network$1>;
|
|
16
|
-
declare const getNetwork: (network: Network) => typeof btc.NETWORK;
|
|
17
|
-
declare const LRC_WALLET_NETWORK: Readonly<{
|
|
18
|
-
0: bitcoin.networks.Network;
|
|
19
|
-
1: bitcoin.networks.Network;
|
|
20
|
-
2: bitcoin.networks.Network;
|
|
21
|
-
3: bitcoin.networks.Network;
|
|
22
|
-
4: bitcoin.networks.Network;
|
|
23
|
-
}>;
|
|
24
|
-
declare const LRC_WALLET_NETWORK_TYPE: Readonly<{
|
|
25
|
-
0: NetworkType$1.MAINNET;
|
|
26
|
-
1: NetworkType$1.TESTNET;
|
|
27
|
-
2: NetworkType$1.TESTNET;
|
|
28
|
-
3: NetworkType$1.REGTEST;
|
|
29
|
-
4: NetworkType$1.LOCAL;
|
|
30
|
-
}>;
|
|
31
|
-
/**
|
|
32
|
-
* Utility function to determine the network from a Bitcoin address.
|
|
33
|
-
*
|
|
34
|
-
* @param {string} address - The Bitcoin address
|
|
35
|
-
* @returns {BitcoinNetwork | null} The detected network or null if not detected
|
|
36
|
-
*/
|
|
37
|
-
declare function getNetworkFromAddress(address: string): BitcoinNetwork.MAINNET | BitcoinNetwork.REGTEST | null;
|
|
38
|
-
/**
|
|
39
|
-
* Utility function to get the network enum value from a string.
|
|
40
|
-
*
|
|
41
|
-
* @param {string} network - The Bitcoin network to turn into an enum value
|
|
42
|
-
* @returns {Network} The enum value matching the string
|
|
43
|
-
*/
|
|
44
|
-
declare function getNetworkFromString(network?: string): Network;
|
|
45
|
-
|
|
46
|
-
export { LRC_WALLET_NETWORK as L, Network as N, type NetworkType as a, NetworkToProto as b, LRC_WALLET_NETWORK_TYPE as c, getNetworkFromAddress as d, getNetworkFromString as e, getNetwork as g };
|