@babylonlabs-io/ts-sdk 0.0.0-semantic-release.2 → 0.1.0
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/LICENSE +1 -1
- package/README.md +124 -6
- package/dist/MockEthereumWallet-CKQlH2AM.cjs +2 -0
- package/dist/MockEthereumWallet-CKQlH2AM.cjs.map +1 -0
- package/dist/MockEthereumWallet-ibdry7pZ.js +127 -0
- package/dist/MockEthereumWallet-ibdry7pZ.js.map +1 -0
- package/dist/PayoutManager-Dg_i_S7w.cjs +2 -0
- package/dist/PayoutManager-Dg_i_S7w.cjs.map +1 -0
- package/dist/PayoutManager-rMj54HDh.js +1112 -0
- package/dist/PayoutManager-rMj54HDh.js.map +1 -0
- package/dist/challengeAssert-34HqeVFH.cjs +2 -0
- package/dist/challengeAssert-34HqeVFH.cjs.map +1 -0
- package/dist/challengeAssert-DVErOd8l.js +423 -0
- package/dist/challengeAssert-DVErOd8l.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +62 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.d.ts +3 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +5 -1
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/wallets/__tests__/BitcoinWallet.test.d.ts +2 -0
- package/dist/shared/wallets/__tests__/BitcoinWallet.test.d.ts.map +1 -0
- package/dist/shared/wallets/__tests__/EthereumWallet.test.d.ts +2 -0
- package/dist/shared/wallets/__tests__/EthereumWallet.test.d.ts.map +1 -0
- package/dist/shared/wallets/index.d.ts +4 -0
- package/dist/shared/wallets/index.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts +106 -0
- package/dist/shared/wallets/interfaces/BitcoinWallet.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/EthereumWallet.d.ts +6 -0
- package/dist/shared/wallets/interfaces/EthereumWallet.d.ts.map +1 -0
- package/dist/shared/wallets/interfaces/index.d.ts +4 -0
- package/dist/shared/wallets/interfaces/index.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/MockBitcoinWallet.d.ts +29 -0
- package/dist/shared/wallets/mocks/MockBitcoinWallet.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/MockEthereumWallet.d.ts +51 -0
- package/dist/shared/wallets/mocks/MockEthereumWallet.d.ts.map +1 -0
- package/dist/shared/wallets/mocks/index.d.ts +5 -0
- package/dist/shared/wallets/mocks/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/index.d.ts +9 -0
- package/dist/tbv/core/clients/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/index.d.ts +11 -0
- package/dist/tbv/core/clients/mempool/index.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts +94 -0
- package/dist/tbv/core/clients/mempool/mempoolApi.d.ts.map +1 -0
- package/dist/tbv/core/clients/mempool/types.d.ts +98 -0
- package/dist/tbv/core/clients/mempool/types.d.ts.map +1 -0
- package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts +187 -0
- package/dist/tbv/core/contracts/abis/BTCVaultsManager.abi.d.ts.map +1 -0
- package/dist/tbv/core/contracts/errors.d.ts +50 -0
- package/dist/tbv/core/contracts/errors.d.ts.map +1 -0
- package/dist/tbv/core/contracts/index.d.ts +11 -0
- package/dist/tbv/core/contracts/index.d.ts.map +1 -0
- package/dist/tbv/core/index.cjs +1 -1
- package/dist/tbv/core/index.d.ts +17 -1
- package/dist/tbv/core/index.d.ts.map +1 -1
- package/dist/tbv/core/index.js +59 -1
- package/dist/tbv/core/index.js.map +1 -1
- package/dist/tbv/core/managers/PayoutManager.d.ts +158 -0
- package/dist/tbv/core/managers/PayoutManager.d.ts.map +1 -0
- package/dist/tbv/core/managers/PeginManager.d.ts +327 -0
- package/dist/tbv/core/managers/PeginManager.d.ts.map +1 -0
- package/dist/tbv/core/managers/__tests__/PayoutManager.test.d.ts +8 -0
- package/dist/tbv/core/managers/__tests__/PayoutManager.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts +8 -0
- package/dist/tbv/core/managers/__tests__/PeginManager.test.d.ts.map +1 -0
- package/dist/tbv/core/managers/index.d.ts +75 -0
- package/dist/tbv/core/managers/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.cjs +2 -0
- package/dist/tbv/core/primitives/index.d.ts +77 -0
- package/dist/tbv/core/primitives/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/index.js +21 -0
- package/dist/tbv/{integrations/morpho → core/primitives}/index.js.map +1 -1
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts +137 -0
- package/dist/tbv/core/primitives/psbt/__tests__/constants.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts +71 -0
- package/dist/tbv/core/primitives/psbt/__tests__/helpers.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/payout.test.d.ts +8 -0
- package/dist/tbv/core/primitives/psbt/__tests__/payout.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts +5 -0
- package/dist/tbv/core/primitives/psbt/__tests__/pegin.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/challengeAssert.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/depositorPayout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/index.d.ts +27 -0
- package/dist/tbv/core/primitives/psbt/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/noPayout.d.ts +28 -0
- package/dist/tbv/core/primitives/psbt/noPayout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts +99 -0
- package/dist/tbv/core/primitives/psbt/payout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts +88 -0
- package/dist/tbv/core/primitives/psbt/pegin.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/__tests__/payout.test.d.ts +5 -0
- package/dist/tbv/core/primitives/scripts/__tests__/payout.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/index.d.ts +10 -0
- package/dist/tbv/core/primitives/scripts/index.d.ts.map +1 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts +102 -0
- package/dist/tbv/core/primitives/scripts/payout.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/__tests__/bitcoin.test.d.ts +5 -0
- package/dist/tbv/core/primitives/utils/__tests__/bitcoin.test.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts +132 -0
- package/dist/tbv/core/primitives/utils/bitcoin.d.ts.map +1 -0
- package/dist/tbv/core/primitives/utils/index.d.ts +9 -0
- package/dist/tbv/core/primitives/utils/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/index.d.ts +10 -0
- package/dist/tbv/core/utils/btc/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/psbtInputFields.d.ts +41 -0
- package/dist/tbv/core/utils/btc/psbtInputFields.d.ts.map +1 -0
- package/dist/tbv/core/utils/btc/scriptType.d.ts +34 -0
- package/dist/tbv/core/utils/btc/scriptType.d.ts.map +1 -0
- package/dist/tbv/core/utils/fee/constants.d.ts +25 -0
- package/dist/tbv/core/utils/fee/constants.d.ts.map +1 -0
- package/dist/tbv/core/utils/fee/index.d.ts +7 -0
- package/dist/tbv/core/utils/fee/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/index.d.ts +16 -0
- package/dist/tbv/core/utils/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/btcTxHash.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/btcTxHash.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/createSplitTransaction.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/__tests__/fundPeginTransaction.test.d.ts +5 -0
- package/dist/tbv/core/utils/transaction/__tests__/fundPeginTransaction.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/btcTxHash.d.ts +15 -0
- package/dist/tbv/core/utils/transaction/btcTxHash.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts +106 -0
- package/dist/tbv/core/utils/transaction/createSplitTransaction.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts +70 -0
- package/dist/tbv/core/utils/transaction/fundPeginTransaction.d.ts.map +1 -0
- package/dist/tbv/core/utils/transaction/index.d.ts +9 -0
- package/dist/tbv/core/utils/transaction/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/__tests__/selectUtxos.test.d.ts +5 -0
- package/dist/tbv/core/utils/utxo/__tests__/selectUtxos.test.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/index.d.ts +7 -0
- package/dist/tbv/core/utils/utxo/index.d.ts.map +1 -0
- package/dist/tbv/core/utils/utxo/selectUtxos.d.ts +65 -0
- package/dist/tbv/core/utils/utxo/selectUtxos.d.ts.map +1 -0
- package/dist/tbv/index.cjs +1 -1
- package/dist/tbv/index.js +59 -1
- package/dist/tbv/index.js.map +1 -1
- package/dist/tbv/integrations/aave/clients/__tests__/spoke.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/clients/__tests__/spoke.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/__tests__/transaction.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/clients/__tests__/transaction.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/abis/AaveIntegrationController.abi.json.d.ts +1879 -0
- package/dist/tbv/integrations/aave/clients/abis/AaveSpoke.abi.json.d.ts +1262 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts +4 -0
- package/dist/tbv/integrations/aave/clients/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/query.d.ts +27 -0
- package/dist/tbv/integrations/aave/clients/query.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/spoke.d.ts +161 -0
- package/dist/tbv/integrations/aave/clients/spoke.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/clients/transaction.d.ts +110 -0
- package/dist/tbv/integrations/aave/clients/transaction.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/config.d.ts +7 -0
- package/dist/tbv/integrations/aave/config.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/constants.d.ts +113 -0
- package/dist/tbv/integrations/aave/constants.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/index.cjs +2 -0
- package/dist/tbv/integrations/aave/index.cjs.map +1 -0
- package/dist/tbv/integrations/aave/index.d.ts +53 -0
- package/dist/tbv/integrations/aave/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/index.js +307 -0
- package/dist/tbv/integrations/aave/index.js.map +1 -0
- package/dist/tbv/integrations/aave/types.d.ts +66 -0
- package/dist/tbv/integrations/aave/types.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/aaveConversions.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/aaveConversions.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/borrowRatio.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/borrowRatio.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/debtUtils.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/debtUtils.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/healthFactor.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/healthFactor.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSelection.test.d.ts +2 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSelection.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSplit.test.d.ts +5 -0
- package/dist/tbv/integrations/aave/utils/__tests__/vaultSplit.test.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/aaveConversions.d.ts +24 -0
- package/dist/tbv/integrations/aave/utils/aaveConversions.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/borrowRatio.d.ts +15 -0
- package/dist/tbv/integrations/aave/utils/borrowRatio.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/debtUtils.d.ts +14 -0
- package/dist/tbv/integrations/aave/utils/debtUtils.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts +108 -0
- package/dist/tbv/integrations/aave/utils/healthFactor.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/index.d.ts +10 -0
- package/dist/tbv/integrations/aave/utils/index.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/vaultSelection.d.ts +33 -0
- package/dist/tbv/integrations/aave/utils/vaultSelection.d.ts.map +1 -0
- package/dist/tbv/integrations/aave/utils/vaultSplit.d.ts +191 -0
- package/dist/tbv/integrations/aave/utils/vaultSplit.d.ts.map +1 -0
- package/package.json +37 -7
- package/dist/shared/__tests__/example.test.d.ts +0 -6
- package/dist/shared/__tests__/example.test.d.ts.map +0 -1
- package/dist/tbv/core/__tests__/example.test.d.ts +0 -6
- package/dist/tbv/core/__tests__/example.test.d.ts.map +0 -1
- package/dist/tbv/integrations/morpho/index.cjs +0 -2
- package/dist/tbv/integrations/morpho/index.d.ts +0 -2
- package/dist/tbv/integrations/morpho/index.d.ts.map +0 -1
- package/dist/tbv/integrations/morpho/index.js +0 -2
- /package/dist/tbv/{integrations/morpho → core/primitives}/index.cjs.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BitcoinWallet.test.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/__tests__/BitcoinWallet.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumWallet.test.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/__tests__/EthereumWallet.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { BitcoinNetwork, BitcoinWallet, Hash, SignPsbtOptions, } from './interfaces';
|
|
2
|
+
export { MockBitcoinWallet, MockEthereumWallet } from './mocks';
|
|
3
|
+
export type { MockBitcoinWalletConfig, MockEthereumWalletConfig, } from './mocks';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/wallets/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,cAAc,EACd,aAAa,EACb,IAAI,EACJ,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAChE,YAAY,EACV,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bitcoin network types.
|
|
3
|
+
* Using string literal union for maximum compatibility with wallet providers.
|
|
4
|
+
*/
|
|
5
|
+
export type BitcoinNetwork = "mainnet" | "testnet" | "signet";
|
|
6
|
+
/**
|
|
7
|
+
* Bitcoin network constants
|
|
8
|
+
*/
|
|
9
|
+
export declare const BitcoinNetworks: {
|
|
10
|
+
readonly MAINNET: "mainnet";
|
|
11
|
+
readonly TESTNET: "testnet";
|
|
12
|
+
readonly SIGNET: "signet";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Options for signing a specific input in a PSBT.
|
|
16
|
+
*/
|
|
17
|
+
export interface SignInputOptions {
|
|
18
|
+
/** Input index to sign */
|
|
19
|
+
index: number;
|
|
20
|
+
/** Address for signing (optional) */
|
|
21
|
+
address?: string;
|
|
22
|
+
/** Public key for signing (optional, hex string) */
|
|
23
|
+
publicKey?: string;
|
|
24
|
+
/** Sighash types (optional) */
|
|
25
|
+
sighashTypes?: number[];
|
|
26
|
+
/** Disable tweak signer for Taproot script path spend (optional) */
|
|
27
|
+
disableTweakSigner?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* SignPsbt options for advanced signing scenarios.
|
|
31
|
+
*/
|
|
32
|
+
export interface SignPsbtOptions {
|
|
33
|
+
/** Whether to automatically finalize the PSBT after signing */
|
|
34
|
+
autoFinalized?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Specific inputs to sign.
|
|
37
|
+
* If not provided, wallet will attempt to sign all inputs it can.
|
|
38
|
+
* Use this to restrict signing to specific inputs (e.g., only depositor's input).
|
|
39
|
+
*/
|
|
40
|
+
signInputs?: SignInputOptions[];
|
|
41
|
+
/** Contract information for the signing operation. */
|
|
42
|
+
contracts?: Array<{
|
|
43
|
+
/** Contract identifier. */
|
|
44
|
+
id: string;
|
|
45
|
+
/** Contract parameters. */
|
|
46
|
+
params: Record<string, string | number | string[] | number[]>;
|
|
47
|
+
}>;
|
|
48
|
+
/** Action metadata. */
|
|
49
|
+
action?: {
|
|
50
|
+
/** Action name for tracking. */
|
|
51
|
+
name: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This interface is designed to be compatible with @babylonlabs-io/wallet-connector's IBTCProvider
|
|
56
|
+
*
|
|
57
|
+
* Supports Unisat, Ledger, OKX, OneKey, Keystone, and other Bitcoin wallets.
|
|
58
|
+
*/
|
|
59
|
+
export interface BitcoinWallet {
|
|
60
|
+
/**
|
|
61
|
+
* Returns the wallet's public key as a hex string.
|
|
62
|
+
*
|
|
63
|
+
* For Taproot addresses, this should return the x-only public key
|
|
64
|
+
* (32 bytes = 64 hex characters without 0x prefix).
|
|
65
|
+
*
|
|
66
|
+
* For compressed public keys (33 bytes = 66 hex characters),
|
|
67
|
+
* consumers should strip the first byte to get x-only format.
|
|
68
|
+
*/
|
|
69
|
+
getPublicKeyHex(): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Returns the wallet's Bitcoin address.
|
|
72
|
+
*/
|
|
73
|
+
getAddress(): Promise<string>;
|
|
74
|
+
/**
|
|
75
|
+
* Signs a PSBT and returns the signed PSBT as hex.
|
|
76
|
+
*
|
|
77
|
+
* @param psbtHex - The PSBT to sign in hex format
|
|
78
|
+
* @param options - Optional signing parameters (e.g., autoFinalized, contracts)
|
|
79
|
+
* @throws {Error} If the PSBT is invalid or signing fails
|
|
80
|
+
*/
|
|
81
|
+
signPsbt(psbtHex: string, options?: SignPsbtOptions): Promise<string>;
|
|
82
|
+
/**
|
|
83
|
+
* Signs multiple PSBTs and returns the signed PSBTs as hex.
|
|
84
|
+
* This allows batch signing with a single wallet interaction.
|
|
85
|
+
*
|
|
86
|
+
* @param psbtsHexes - Array of PSBTs to sign in hex format
|
|
87
|
+
* @param options - Optional array of signing parameters for each PSBT
|
|
88
|
+
* @throws {Error} If any PSBT is invalid or signing fails
|
|
89
|
+
*/
|
|
90
|
+
signPsbts(psbtsHexes: string[], options?: SignPsbtOptions[]): Promise<string[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Signs a message for authentication or proof of ownership.
|
|
93
|
+
*
|
|
94
|
+
* @param message - The message to sign
|
|
95
|
+
* @param type - The signing method: "ecdsa" for standard signatures, "bip322-simple" for BIP-322
|
|
96
|
+
* @returns Base64-encoded signature
|
|
97
|
+
*/
|
|
98
|
+
signMessage(message: string, type: "bip322-simple" | "ecdsa"): Promise<string>;
|
|
99
|
+
/**
|
|
100
|
+
* Returns the Bitcoin network the wallet is connected to.
|
|
101
|
+
*
|
|
102
|
+
* @returns BitcoinNetwork enum value (MAINNET, TESTNET, SIGNET)
|
|
103
|
+
*/
|
|
104
|
+
getNetwork(): Promise<BitcoinNetwork>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=BitcoinWallet.d.ts.map
|
|
@@ -0,0 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,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtE;;;;;;;OAOG;IACH,SAAS,CACP,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,CAAC,EAAE,eAAe,EAAE,GAC1B,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAErB;;;;;;OAMG;IACH,WAAW,CACT,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,eAAe,GAAG,OAAO,GAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnB;;;;OAIG;IACH,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumWallet.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/interfaces/EthereumWallet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/interfaces/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EACV,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAGzB,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BitcoinNetwork } from '../interfaces';
|
|
2
|
+
import { BitcoinWallet } from '../interfaces/BitcoinWallet';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for MockBitcoinWallet.
|
|
5
|
+
*/
|
|
6
|
+
export interface MockBitcoinWalletConfig {
|
|
7
|
+
publicKeyHex?: string;
|
|
8
|
+
address?: string;
|
|
9
|
+
network?: BitcoinNetwork;
|
|
10
|
+
shouldFailSigning?: boolean;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Mock Bitcoin wallet for testing.
|
|
14
|
+
*/
|
|
15
|
+
export declare class MockBitcoinWallet implements BitcoinWallet {
|
|
16
|
+
private config;
|
|
17
|
+
constructor(config?: MockBitcoinWalletConfig);
|
|
18
|
+
getPublicKeyHex(): Promise<string>;
|
|
19
|
+
getAddress(): Promise<string>;
|
|
20
|
+
signPsbt(psbtHex: string): Promise<string>;
|
|
21
|
+
signPsbts(psbtsHexes: string[]): Promise<string[]>;
|
|
22
|
+
signMessage(message: string, type: "bip322-simple" | "ecdsa"): Promise<string>;
|
|
23
|
+
getNetwork(): Promise<BitcoinNetwork>;
|
|
24
|
+
/** Updates configuration for testing different scenarios. */
|
|
25
|
+
updateConfig(updates: Partial<MockBitcoinWalletConfig>): void;
|
|
26
|
+
/** Resets to default configuration. */
|
|
27
|
+
reset(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=MockBitcoinWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockBitcoinWallet.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/mocks/MockBitcoinWallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACrD,OAAO,CAAC,MAAM,CAAoC;gBAEtC,MAAM,GAAE,uBAA4B;IAa1C,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAIlC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAc1C,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IASlD,WAAW,CACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,eAAe,GAAG,OAAO,GAC9B,OAAO,CAAC,MAAM,CAAC;IAiBZ,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAI3C,6DAA6D;IAC7D,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI;IAO7D,uCAAuC;IACvC,KAAK,IAAI,IAAI;CASd"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Address, Hex } from 'viem';
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for MockEthereumWallet.
|
|
4
|
+
*/
|
|
5
|
+
export interface MockEthereumWalletConfig {
|
|
6
|
+
address?: Address;
|
|
7
|
+
chainId?: number;
|
|
8
|
+
shouldFailOperations?: boolean;
|
|
9
|
+
transactionDelay?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Mock Ethereum wallet for testing.
|
|
13
|
+
*
|
|
14
|
+
* Provides the subset of viem's WalletClient methods used by the SDK.
|
|
15
|
+
* Can be passed to functions expecting a WalletClient for testing purposes.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MockEthereumWallet {
|
|
18
|
+
account: {
|
|
19
|
+
address: Address;
|
|
20
|
+
};
|
|
21
|
+
chain: {
|
|
22
|
+
id: number;
|
|
23
|
+
};
|
|
24
|
+
private shouldFailOperations;
|
|
25
|
+
private transactionDelay;
|
|
26
|
+
private nonce;
|
|
27
|
+
constructor(config?: MockEthereumWalletConfig);
|
|
28
|
+
signMessage(args: {
|
|
29
|
+
message: string;
|
|
30
|
+
account?: Address;
|
|
31
|
+
}): Promise<Hex>;
|
|
32
|
+
sendTransaction(tx: {
|
|
33
|
+
to: Address;
|
|
34
|
+
data?: Hex;
|
|
35
|
+
value?: bigint;
|
|
36
|
+
gas?: bigint;
|
|
37
|
+
account?: {
|
|
38
|
+
address: Address;
|
|
39
|
+
};
|
|
40
|
+
chain?: {
|
|
41
|
+
id: number;
|
|
42
|
+
};
|
|
43
|
+
}): Promise<Hex>;
|
|
44
|
+
/** Updates configuration for testing different scenarios. */
|
|
45
|
+
updateConfig(updates: Partial<MockEthereumWalletConfig>): void;
|
|
46
|
+
/** Resets to default configuration and nonce. */
|
|
47
|
+
reset(): void;
|
|
48
|
+
/** Returns current nonce for testing. */
|
|
49
|
+
getCurrentNonce(): number;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=MockEthereumWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MockEthereumWallet.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/mocks/MockEthereumWallet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAE7B,OAAO,EAAE;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAC9B,KAAK,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IAEtB,OAAO,CAAC,oBAAoB,CAAU;IACtC,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,KAAK,CAAa;gBAEd,MAAM,GAAE,wBAA6B;IAoB3C,WAAW,CAAC,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAqBvE,eAAe,CAAC,EAAE,EAAE;QACxB,EAAE,EAAE,OAAO,CAAC;QACZ,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,OAAO,CAAC,EAAE;YAAE,OAAO,EAAE,OAAO,CAAA;SAAE,CAAC;QAC/B,KAAK,CAAC,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;KACxB,GAAG,OAAO,CAAC,GAAG,CAAC;IAiChB,6DAA6D;IAC7D,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,wBAAwB,CAAC,GAAG,IAAI;IAe9D,iDAAiD;IACjD,KAAK,IAAI,IAAI;IASb,yCAAyC;IACzC,eAAe,IAAI,MAAM;CAG1B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MockBitcoinWallet } from './MockBitcoinWallet';
|
|
2
|
+
export type { MockBitcoinWalletConfig } from './MockBitcoinWallet';
|
|
3
|
+
export { MockEthereumWallet } from './MockEthereumWallet';
|
|
4
|
+
export type { MockEthereumWalletConfig } from './MockEthereumWallet';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/shared/wallets/mocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,YAAY,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tbv/core/clients/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mempool API Client
|
|
3
|
+
*
|
|
4
|
+
* Client for interacting with mempool.space API for Bitcoin network operations.
|
|
5
|
+
*
|
|
6
|
+
* @module clients/mempool
|
|
7
|
+
*/
|
|
8
|
+
export { getAddressTxs, getAddressUtxos, getMempoolApiUrl, getNetworkFees, getTxHex, getTxInfo, getUtxoInfo, MEMPOOL_API_URLS, pushTx, } from './mempoolApi';
|
|
9
|
+
export type { AddressTx } from './mempoolApi';
|
|
10
|
+
export type { MempoolUTXO, NetworkFees, TxInfo, TxInput, TxOutput, TxStatus, UtxoInfo, } from './types';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/tbv/core/clients/mempool/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,MAAM,GACP,MAAM,cAAc,CAAC;AAEtB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,YAAY,EACV,WAAW,EACX,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { MempoolUTXO, NetworkFees, TxInfo, UtxoInfo } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Default mempool API URLs by network.
|
|
4
|
+
*/
|
|
5
|
+
export declare const MEMPOOL_API_URLS: {
|
|
6
|
+
readonly mainnet: "https://mempool.space/api";
|
|
7
|
+
readonly testnet: "https://mempool.space/testnet/api";
|
|
8
|
+
readonly signet: "https://mempool.space/signet/api";
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Push a signed transaction to the Bitcoin network.
|
|
12
|
+
*
|
|
13
|
+
* @param txHex - The signed transaction hex string
|
|
14
|
+
* @param apiUrl - Mempool API base URL
|
|
15
|
+
* @returns The transaction ID
|
|
16
|
+
* @throws Error if broadcasting fails
|
|
17
|
+
*/
|
|
18
|
+
export declare function pushTx(txHex: string, apiUrl: string): Promise<string>;
|
|
19
|
+
/**
|
|
20
|
+
* Get transaction information from mempool.
|
|
21
|
+
*
|
|
22
|
+
* @param txid - The transaction ID
|
|
23
|
+
* @param apiUrl - Mempool API base URL
|
|
24
|
+
* @returns Transaction information
|
|
25
|
+
*/
|
|
26
|
+
export declare function getTxInfo(txid: string, apiUrl: string): Promise<TxInfo>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the hex representation of a transaction.
|
|
29
|
+
*
|
|
30
|
+
* @param txid - The transaction ID
|
|
31
|
+
* @param apiUrl - Mempool API base URL
|
|
32
|
+
* @returns The transaction hex string
|
|
33
|
+
* @throws Error if the request fails or transaction is not found
|
|
34
|
+
*/
|
|
35
|
+
export declare function getTxHex(txid: string, apiUrl: string): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Get UTXO information for a specific transaction output.
|
|
38
|
+
*
|
|
39
|
+
* This is used for constructing PSBTs where we need the witnessUtxo data.
|
|
40
|
+
* Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.
|
|
41
|
+
*
|
|
42
|
+
* @param txid - The transaction ID containing the UTXO
|
|
43
|
+
* @param vout - The output index
|
|
44
|
+
* @param apiUrl - Mempool API base URL
|
|
45
|
+
* @returns UTXO information with value and scriptPubKey
|
|
46
|
+
*/
|
|
47
|
+
export declare function getUtxoInfo(txid: string, vout: number, apiUrl: string): Promise<UtxoInfo>;
|
|
48
|
+
/**
|
|
49
|
+
* Get all UTXOs for a Bitcoin address.
|
|
50
|
+
*
|
|
51
|
+
* @param address - The Bitcoin address
|
|
52
|
+
* @param apiUrl - Mempool API base URL
|
|
53
|
+
* @returns Array of UTXOs sorted by value (largest first)
|
|
54
|
+
*/
|
|
55
|
+
export declare function getAddressUtxos(address: string, apiUrl: string): Promise<MempoolUTXO[]>;
|
|
56
|
+
/**
|
|
57
|
+
* Get the mempool API URL for a given network.
|
|
58
|
+
*
|
|
59
|
+
* @param network - Bitcoin network (mainnet, testnet, signet)
|
|
60
|
+
* @returns The mempool API URL
|
|
61
|
+
*/
|
|
62
|
+
export declare function getMempoolApiUrl(network: "mainnet" | "testnet" | "signet"): string;
|
|
63
|
+
/**
|
|
64
|
+
* Transaction summary from address transactions endpoint.
|
|
65
|
+
*/
|
|
66
|
+
export interface AddressTx {
|
|
67
|
+
txid: string;
|
|
68
|
+
status: {
|
|
69
|
+
confirmed: boolean;
|
|
70
|
+
block_height?: number;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get recent transactions for a Bitcoin address.
|
|
75
|
+
*
|
|
76
|
+
* Returns the last 25 confirmed transactions plus any unconfirmed (mempool) transactions.
|
|
77
|
+
* This is useful for checking if a specific transaction has been broadcast.
|
|
78
|
+
*
|
|
79
|
+
* @param address - The Bitcoin address
|
|
80
|
+
* @param apiUrl - Mempool API base URL
|
|
81
|
+
* @returns Array of recent transactions
|
|
82
|
+
*/
|
|
83
|
+
export declare function getAddressTxs(address: string, apiUrl: string): Promise<AddressTx[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Fetches Bitcoin network fee recommendations from mempool.space API.
|
|
86
|
+
*
|
|
87
|
+
* @param apiUrl - Mempool API base URL
|
|
88
|
+
* @returns Fee rates in sat/vbyte for different confirmation times
|
|
89
|
+
* @throws Error if request fails or returns invalid data
|
|
90
|
+
*
|
|
91
|
+
* @see https://mempool.space/docs/api/rest#get-recommended-fees
|
|
92
|
+
*/
|
|
93
|
+
export declare function getNetworkFees(apiUrl: string): Promise<NetworkFees>;
|
|
94
|
+
//# sourceMappingURL=mempoolApi.d.ts.map
|
|
@@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wBAAsB,aAAa,CACjC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,SAAS,EAAE,CAAC,CAEtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAwBzE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mempool API Types
|
|
3
|
+
*
|
|
4
|
+
* Type definitions for mempool.space API responses.
|
|
5
|
+
*
|
|
6
|
+
* @module clients/mempool/types
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* UTXO information from mempool API.
|
|
10
|
+
*/
|
|
11
|
+
export interface MempoolUTXO {
|
|
12
|
+
txid: string;
|
|
13
|
+
vout: number;
|
|
14
|
+
value: number;
|
|
15
|
+
scriptPubKey: string;
|
|
16
|
+
confirmed: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Transaction input from mempool API.
|
|
20
|
+
*/
|
|
21
|
+
export interface TxInput {
|
|
22
|
+
txid: string;
|
|
23
|
+
vout: number;
|
|
24
|
+
prevout: {
|
|
25
|
+
scriptpubkey: string;
|
|
26
|
+
scriptpubkey_asm: string;
|
|
27
|
+
scriptpubkey_type: string;
|
|
28
|
+
scriptpubkey_address: string;
|
|
29
|
+
value: number;
|
|
30
|
+
};
|
|
31
|
+
scriptsig: string;
|
|
32
|
+
scriptsig_asm: string;
|
|
33
|
+
witness: string[];
|
|
34
|
+
is_coinbase: boolean;
|
|
35
|
+
sequence: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Transaction output from mempool API.
|
|
39
|
+
*/
|
|
40
|
+
export interface TxOutput {
|
|
41
|
+
scriptpubkey: string;
|
|
42
|
+
scriptpubkey_asm: string;
|
|
43
|
+
scriptpubkey_type: string;
|
|
44
|
+
scriptpubkey_address: string;
|
|
45
|
+
value: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Transaction status from mempool API.
|
|
49
|
+
*/
|
|
50
|
+
export interface TxStatus {
|
|
51
|
+
confirmed: boolean;
|
|
52
|
+
block_height?: number;
|
|
53
|
+
block_hash?: string;
|
|
54
|
+
block_time?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Full transaction info from mempool API.
|
|
58
|
+
*/
|
|
59
|
+
export interface TxInfo {
|
|
60
|
+
txid: string;
|
|
61
|
+
version: number;
|
|
62
|
+
locktime: number;
|
|
63
|
+
vin: TxInput[];
|
|
64
|
+
vout: TxOutput[];
|
|
65
|
+
size: number;
|
|
66
|
+
weight: number;
|
|
67
|
+
fee: number;
|
|
68
|
+
status: TxStatus;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* UTXO info for a specific output (used for PSBT construction).
|
|
72
|
+
*
|
|
73
|
+
* Only supports Taproot (P2TR) and native SegWit (P2WPKH, P2WSH) script types.
|
|
74
|
+
*/
|
|
75
|
+
export interface UtxoInfo {
|
|
76
|
+
txid: string;
|
|
77
|
+
vout: number;
|
|
78
|
+
value: number;
|
|
79
|
+
scriptPubKey: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Bitcoin network fee recommendations (sat/vbyte) from mempool.space API.
|
|
83
|
+
*
|
|
84
|
+
* @see https://mempool.space/docs/api/rest#get-recommended-fees
|
|
85
|
+
*/
|
|
86
|
+
export interface NetworkFees {
|
|
87
|
+
/** Next block (~10 min) */
|
|
88
|
+
fastestFee: number;
|
|
89
|
+
/** ~30 minutes */
|
|
90
|
+
halfHourFee: number;
|
|
91
|
+
/** ~1 hour */
|
|
92
|
+
hourFee: number;
|
|
93
|
+
/** Economy (no time guarantee) */
|
|
94
|
+
economyFee: number;
|
|
95
|
+
/** Minimum network fee */
|
|
96
|
+
minimumFee: number;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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