@bestinslot/wallet-kit 0.7.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/README.md +108 -0
- package/dist/balances-BQiaAIaq.js +9627 -0
- package/dist/browser.js +205 -0
- package/dist/core.js +39 -0
- package/dist/mint-BXVHw4CQ.js +70722 -0
- package/dist/node.js +1787 -0
- package/dist/react.js +14 -0
- package/dist/register-browser-providers-CLLT6W6P.js +499 -0
- package/dist/types/adapters/react/use-network.d.ts +8 -0
- package/dist/types/adapters/react/use-wallet.d.ts +15 -0
- package/dist/types/adapters/vue/use-network.d.ts +12 -0
- package/dist/types/api/balances.d.ts +52 -0
- package/dist/types/api/brc20.d.ts +110 -0
- package/dist/types/api/helpers.d.ts +3 -0
- package/dist/types/api/mint.d.ts +57 -0
- package/dist/types/api/modal.d.ts +3 -0
- package/dist/types/api/swap.d.ts +122 -0
- package/dist/types/api/wallet.browser.d.ts +2 -0
- package/dist/types/api/wallet.d.ts +6 -0
- package/dist/types/api/wallet.node.d.ts +4 -0
- package/dist/types/browser.d.ts +10 -0
- package/dist/types/components/Dev.vue.d.ts +11 -0
- package/dist/types/components/connect-modal-view.d.ts +28 -0
- package/dist/types/components/dev/BRC20.vue.d.ts +2 -0
- package/dist/types/components/dev/Button.vue.d.ts +17 -0
- package/dist/types/components/dev/Input.vue.d.ts +12 -0
- package/dist/types/components/dev/Label.vue.d.ts +17 -0
- package/dist/types/components/dev/Select.vue.d.ts +17 -0
- package/dist/types/components/dev/SessionInfo.vue.d.ts +6 -0
- package/dist/types/core/bis.d.ts +21 -0
- package/dist/types/core/bis_swap.d.ts +622 -0
- package/dist/types/core/brc20.d.ts +229 -0
- package/dist/types/core/connect-modal.d.ts +15 -0
- package/dist/types/core/helpers.d.ts +212 -0
- package/dist/types/core/mint.d.ts +364 -0
- package/dist/types/core/modal.d.ts +21 -0
- package/dist/types/core/providers.d.ts +90 -0
- package/dist/types/core/register-browser-providers.d.ts +1 -0
- package/dist/types/core/register-local-provider.d.ts +1 -0
- package/dist/types/core/storage.d.ts +19 -0
- package/dist/types/core/store-network.d.ts +20 -0
- package/dist/types/core/store.d.ts +39 -0
- package/dist/types/core.d.ts +10 -0
- package/dist/types/lib/bitcoin.d.ts +8 -0
- package/dist/types/lib/dev-worker.d.ts +1 -0
- package/dist/types/lib/dev.d.ts +9 -0
- package/dist/types/lib/swap-constants.d.ts +7 -0
- package/dist/types/lib/swap-reporting.d.ts +80 -0
- package/dist/types/lib/uniswap_ops.d.ts +238 -0
- package/dist/types/lib/web3.d.ts +7 -0
- package/dist/types/node.d.ts +9 -0
- package/dist/types/provider/api.d.ts +97 -0
- package/dist/types/provider/leather.d.ts +2 -0
- package/dist/types/provider/local.d.ts +39 -0
- package/dist/types/provider/okx.d.ts +2 -0
- package/dist/types/provider/unisat.d.ts +2 -0
- package/dist/types/provider/xverse.d.ts +2 -0
- package/dist/types/react.d.ts +3 -0
- package/dist/types/types/common.d.ts +33 -0
- package/dist/types/types/global.d.ts +26 -0
- package/dist/types/types/inscription.d.ts +147 -0
- package/dist/types/types/vite-env.d.ts +7 -0
- package/dist/types/types/wallet.d.ts +50 -0
- package/dist/types/vue.d.ts +2 -0
- package/dist/vue.js +13 -0
- package/package.json +133 -0
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
import { SwapFees } from '../lib/swap-reporting';
|
|
2
|
+
import { BISSwapWalletInfo } from './store';
|
|
3
|
+
/**
|
|
4
|
+
* Checks IndexedDB for an existing swap wallet associated with the current ordinals wallet address.
|
|
5
|
+
*
|
|
6
|
+
* @returns {Promise<BISSwapWalletInfo | null>} Resolves with the SwapWalletInfo if found, or null if no wallet is stored for the current ordinals address.
|
|
7
|
+
*/
|
|
8
|
+
export declare function getSwapWalletFromDB(): Promise<BISSwapWalletInfo | null>;
|
|
9
|
+
/**
|
|
10
|
+
* Generates a new swap wallet by creating a BLS key pair derived from a deterministic signature of the user's ordinals wallet.
|
|
11
|
+
*
|
|
12
|
+
* The process involves:
|
|
13
|
+
* 1. Validating that the ordinals wallet address is available.
|
|
14
|
+
* 2. Generating a deterministic signature using the ordinals wallet's signing function, and deriving a BLS private key from it using HKDF.
|
|
15
|
+
* 3. Computing the corresponding BLS public key.
|
|
16
|
+
* 4. Storing the swap wallet information (Bitcoin address, BLS public key, and BLS private key) in IndexedDB for future use.
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<BISSwapWalletInfo>} Resolves with the generated SwapWalletInfo containing the Bitcoin address, BLS public key, and BLS private key.
|
|
19
|
+
*/
|
|
20
|
+
export declare function generateAndStoreSwapWallet(): Promise<BISSwapWalletInfo>;
|
|
21
|
+
export interface ImportSwapWalletOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Replace a stored wallet whose key differs from the imported one. Required for that case, because an import
|
|
24
|
+
* is destructive: it is only ever needed when derivation is no longer reproducing the right key, so replacing
|
|
25
|
+
* the stored wallet is the point — but it should be asked for rather than happen as a side effect.
|
|
26
|
+
*/
|
|
27
|
+
overwrite?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Restores a swap wallet from a saved security code, binding it to the connected ordinals wallet.
|
|
31
|
+
*
|
|
32
|
+
* Swap wallets are normally derived from a BIP-322 signature, and that derivation is guarded at creation by
|
|
33
|
+
* signing twice and comparing. If a wallet later starts signing non-deterministically — a wallet update, or the
|
|
34
|
+
* same address moved to a different implementation whose BIP-322 output differs byte-for-byte — the derivation
|
|
35
|
+
* no longer reproduces the key, and the funds become unreachable even though the address is still controlled.
|
|
36
|
+
* This is the way back: the saved code is exactly what the derivation was supposed to produce.
|
|
37
|
+
*
|
|
38
|
+
* Importing does not weaken the security of the code. It restores only the BLS half of a swap wallet's
|
|
39
|
+
* authority; the backend requires a BIP-322 signature from the ordinals address on every withdraw and unwrap,
|
|
40
|
+
* and resolves that address from the BLS public key. So a code imported under an address that does not own the
|
|
41
|
+
* funds is inert, and a stolen code still cannot move anything on its own.
|
|
42
|
+
*
|
|
43
|
+
* The code is validated before anything is stored, and re-importing the code already in storage is a no-op.
|
|
44
|
+
* Replacing a *different* stored wallet requires `overwrite`.
|
|
45
|
+
*
|
|
46
|
+
* @param securityCode The security code to import, as hex with or without a `0x` prefix.
|
|
47
|
+
* @param options Import options. Set `overwrite` to replace a stored wallet whose key differs from this one.
|
|
48
|
+
* @returns {Promise<BISSwapWalletInfo>} Resolves with the imported swap wallet, now stored against the connected ordinals address.
|
|
49
|
+
*/
|
|
50
|
+
export declare function importSwapWallet(securityCode: string, options?: ImportSwapWalletOptions): Promise<BISSwapWalletInfo>;
|
|
51
|
+
export interface EnsureSwapWalletResult {
|
|
52
|
+
/** The swap wallet now in storage, whether it was just created or already there. */
|
|
53
|
+
wallet: BISSwapWalletInfo;
|
|
54
|
+
/** True only when this call derived and stored the wallet. False when one already existed. */
|
|
55
|
+
created: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Returns the swap wallet for the connected ordinals wallet, deriving and storing one only if none exists yet.
|
|
59
|
+
*
|
|
60
|
+
* This is the idempotent counterpart to `generateAndStoreSwapWallet`, which re-derives (and so re-prompts for two
|
|
61
|
+
* signatures) on every call. Callers that just want the wallet to exist — e.g. on every connect — should use this
|
|
62
|
+
* instead, so a user with a wallet already on disk is never asked to sign again.
|
|
63
|
+
*
|
|
64
|
+
* `created` distinguishes the two paths, so a caller can show a first-run disclosure exactly once.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Promise<EnsureSwapWalletResult>} Resolves with the swap wallet and whether this call created it.
|
|
67
|
+
*/
|
|
68
|
+
export declare function ensureSwapWallet(): Promise<EnsureSwapWalletResult>;
|
|
69
|
+
/**
|
|
70
|
+
* Reads the security code (the BLS private key) of the stored swap wallet for the connected ordinals wallet.
|
|
71
|
+
*
|
|
72
|
+
* The code is a second factor, not a recovery seed: on its own it cannot move funds, because the swap backend
|
|
73
|
+
* requires a BIP-322 signature from the ordinals address alongside every BLS-signed order. It is exposed so that
|
|
74
|
+
* an interface can show it again after creation without re-deriving the wallet.
|
|
75
|
+
*
|
|
76
|
+
* @returns {Promise<string | null>} Resolves with the security code, or null if no swap wallet is stored for the connected address.
|
|
77
|
+
*/
|
|
78
|
+
export declare function getSwapWalletSecurityCode(): Promise<string | null>;
|
|
79
|
+
export interface GetSwapStatusResponse {
|
|
80
|
+
reorg_handler_running: boolean;
|
|
81
|
+
emergency_stop: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks the status of the swap backend, including whether the reorg handler is running and if emergency stop is active.
|
|
85
|
+
*
|
|
86
|
+
* This function is useful for the frontend to determine if the swap functionalities are currently operational or if there are any issues with the backend that users should be aware of.
|
|
87
|
+
*
|
|
88
|
+
* @returns {Promise<GetSwapStatusResponse>} An object containing the status of the reorg handler and emergency stop.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getSwapStatus(): Promise<GetSwapStatusResponse>;
|
|
91
|
+
/**
|
|
92
|
+
* Checks the swap allowance for a given token address by making an API call to the swap backend.
|
|
93
|
+
*
|
|
94
|
+
* @param tokenAddress The address of the token to check the allowance for.
|
|
95
|
+
*
|
|
96
|
+
* @returns {Promise<bigint>} A promise that resolves to a bigint representing the swap allowance for the specified token address. The allowance is returned as a string from the API and converted to bigint in this function.
|
|
97
|
+
*/
|
|
98
|
+
export declare function getSwapAllowance(tokenAddress: string): Promise<bigint>;
|
|
99
|
+
export interface SwapInfo {
|
|
100
|
+
factory_address: string;
|
|
101
|
+
wbtc_address: string;
|
|
102
|
+
wbtc_handler_address: string;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Fetches the swap's deployment info — the factory, WBTC and WBTC handler addresses — for the current network, by making an API call to the swap backend. The result is fetched once per network and cached.
|
|
106
|
+
*
|
|
107
|
+
* This does not require a connected wallet or a smart wallet.
|
|
108
|
+
*
|
|
109
|
+
* @returns {Promise<SwapInfo>} A promise that resolves to a SwapInfo object containing the factory address, the WBTC token address, and the WBTC handler address.
|
|
110
|
+
*/
|
|
111
|
+
export declare function getSwapInfo(): Promise<SwapInfo>;
|
|
112
|
+
/**
|
|
113
|
+
* Checks the BRC-20 token balance for the current ordinals wallet address by making an API call to the swap backend.
|
|
114
|
+
*
|
|
115
|
+
* @param tokenAddress The address of the BRC-20 token to check the balance for.
|
|
116
|
+
* @returns {Promise<bigint>} A promise that resolves to a bigint representing the BRC-20 token balance for the current ordinals wallet address. The balance is returned as a string from the API and converted to bigint in this function.
|
|
117
|
+
*/
|
|
118
|
+
export declare function getBRC20ProgBalance(tokenAddress: string): Promise<bigint>;
|
|
119
|
+
export interface SwapBalance {
|
|
120
|
+
token_address: string;
|
|
121
|
+
balance: string;
|
|
122
|
+
ticker: string;
|
|
123
|
+
decimals: number;
|
|
124
|
+
is_lp: boolean;
|
|
125
|
+
price_sats: number;
|
|
126
|
+
reserve_token_amt?: string;
|
|
127
|
+
token_decimals?: number;
|
|
128
|
+
reserve_btc_amt?: string;
|
|
129
|
+
btc_decimals?: number;
|
|
130
|
+
lp_total_supply?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Checks the swap balances for all tokens associated with the current ordinals wallet address by making an API call to the swap backend.
|
|
134
|
+
*
|
|
135
|
+
* @param ordinalsAddress The ordinals wallet address to check the swap balances for.
|
|
136
|
+
* @returns {Promise<SwapBalance[]>} A promise that resolves to an array of SwapBalance objects, each containing details about the token address, balance, ticker, decimals, whether it's an LP token, price in sats, and optionally reserve amounts and decimals for LP tokens. The balances are returned as strings from the API and can be converted to bigint if needed.
|
|
137
|
+
*/
|
|
138
|
+
export declare function getSwapBalances(ordinalsAddress: string): Promise<SwapBalance[]>;
|
|
139
|
+
/**
|
|
140
|
+
* Checks the swap balance for a specific token address associated with the current ordinals wallet address by making an API call to the swap backend.
|
|
141
|
+
*
|
|
142
|
+
* @param tokenAddress The address of the token to check the swap balance for.
|
|
143
|
+
* @returns {Promise<bigint>} A promise that resolves to a bigint representing the swap balance for the specified token address and current ordinals wallet address. The balance is returned as a string from the API and converted to bigint in this function.
|
|
144
|
+
*/
|
|
145
|
+
export declare function getSwapBalance(tokenAddress: string): Promise<bigint>;
|
|
146
|
+
export interface PairReserves {
|
|
147
|
+
reserveA: bigint;
|
|
148
|
+
reserveB: bigint;
|
|
149
|
+
total_supply: bigint;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Checks the reserves of a specific token pair by making an API call to the swap backend.
|
|
153
|
+
*
|
|
154
|
+
* @param pairAddress The address of the token pair to check the reserves for.
|
|
155
|
+
* @returns {Promise<PairReserves>} A promise that resolves to an object containing the reserves of token A, token B, and the total supply of liquidity tokens for the specified pair address. The reserves and total supply are returned as strings from the API and converted to bigint in this function.
|
|
156
|
+
*/
|
|
157
|
+
export declare function getPairReserves(pairAddress: string): Promise<PairReserves>;
|
|
158
|
+
/**
|
|
159
|
+
* Resolves a referral ID to the referrer's swap pubkey and their return-rate
|
|
160
|
+
* (rebate) in basis points. Returns undefined fields if the referral cannot be
|
|
161
|
+
* resolved, so a bad or expired referral degrades to a normal swap rather than
|
|
162
|
+
* failing the order.
|
|
163
|
+
*
|
|
164
|
+
* @param currentPubkey The swap pubkey of the user performing the swap. Used to reject self-referrals.
|
|
165
|
+
* @param refId The referral identifier to resolve.
|
|
166
|
+
* @returns The referrer's swap pubkey and return-rate bps, or undefined fields when the referral is invalid.
|
|
167
|
+
*/
|
|
168
|
+
export declare function tryGetSwapReferrerInfo(currentPubkey: string, refId: string): Promise<{
|
|
169
|
+
referrerPubkey: string | undefined;
|
|
170
|
+
refReturnBps: bigint | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
/**
|
|
173
|
+
* Requests the estimated miner fee for a specific swap operation type by making an API call to the swap backend.
|
|
174
|
+
*
|
|
175
|
+
* @param type The type of swap operation to estimate the miner fee for. Valid values are 'add_liquidity', 'remove_liquidity', 'swap', 'withdraw', or 'unwrap'.
|
|
176
|
+
* @returns {Promise<bigint>} A promise that resolves to a bigint representing the estimated miner fee for the specified swap operation type. The fee is returned as a string from the API and converted to bigint in this function.
|
|
177
|
+
*/
|
|
178
|
+
export declare function requestMinerFee(type: 'add_liquidity' | 'remove_liquidity' | 'swap' | 'withdraw' | 'unwrap'): Promise<bigint>;
|
|
179
|
+
export interface TokenInfo {
|
|
180
|
+
token_address: string;
|
|
181
|
+
symbol: string;
|
|
182
|
+
decimals: number;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Fetches every token tradable on the swap, ordered by symbol, by making an API call to the swap backend. LP tokens are excluded by the backend.
|
|
186
|
+
*
|
|
187
|
+
* This does not require a connected wallet or a smart wallet, so it can be used to populate a token picker before the user connects.
|
|
188
|
+
*
|
|
189
|
+
* @returns {Promise<TokenInfo[]>} A promise that resolves to an array of TokenInfo objects, each containing the token address, symbol, and decimals.
|
|
190
|
+
*/
|
|
191
|
+
export declare function listTokens(): Promise<TokenInfo[]>;
|
|
192
|
+
export type ListPairsOrderBy = 'price_asc' | 'price_desc' | 'price_change_24h_asc' | 'price_change_24h_desc' | 'price_change_7d_asc' | 'price_change_7d_desc' | 'volume_24h_asc' | 'volume_24h_desc' | 'volume_7d_asc' | 'volume_7d_desc' | 'tvl_asc' | 'tvl_desc' | 'apr_asc' | 'apr_desc';
|
|
193
|
+
export interface ListPairsRequest {
|
|
194
|
+
order_by?: ListPairsOrderBy;
|
|
195
|
+
page?: number;
|
|
196
|
+
count?: number;
|
|
197
|
+
}
|
|
198
|
+
export interface PairInfo {
|
|
199
|
+
pair_address: string;
|
|
200
|
+
pair_name: string;
|
|
201
|
+
token_a_addr: string;
|
|
202
|
+
token_a_symbol: string;
|
|
203
|
+
token_b_addr: string;
|
|
204
|
+
token_b_symbol: string;
|
|
205
|
+
price: number;
|
|
206
|
+
price_change_24h: number;
|
|
207
|
+
price_change_7d: number;
|
|
208
|
+
volume_24h: bigint;
|
|
209
|
+
volume_7d: bigint;
|
|
210
|
+
lp_fee_tier: number;
|
|
211
|
+
tvl: bigint;
|
|
212
|
+
apr: number;
|
|
213
|
+
}
|
|
214
|
+
export interface ListPairsResponse {
|
|
215
|
+
page: number;
|
|
216
|
+
count: number;
|
|
217
|
+
total: number;
|
|
218
|
+
data: PairInfo[];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Fetches a paginated, sortable listing of every swap pair and its market data by making an API call to the swap backend.
|
|
222
|
+
*
|
|
223
|
+
* This does not require a connected wallet or a smart wallet, so it can be used to populate a market table or pair selector before the user connects.
|
|
224
|
+
*
|
|
225
|
+
* @param params (Optional) An object containing the sort order (defaults to 'tvl_desc'), the page to fetch (defaults to 1), and the number of pairs per page (defaults to 20, max 100).
|
|
226
|
+
* @returns {Promise<ListPairsResponse>} A promise that resolves to an object containing the current page, page size, total number of pairs, and an array of PairInfo objects. Each pair includes both token addresses and symbols, price, 24h/7d price change, 24h/7d volume, LP fee tier, TVL, and APR. The volumes and TVL are returned as strings from the API and converted to bigint in this function.
|
|
227
|
+
*/
|
|
228
|
+
export declare function listPairs(params?: ListPairsRequest): Promise<ListPairsResponse>;
|
|
229
|
+
export interface GetPairVolumeRequest {
|
|
230
|
+
pair_address: string;
|
|
231
|
+
days: number;
|
|
232
|
+
}
|
|
233
|
+
export interface GetPairVolumeResponse {
|
|
234
|
+
pair_address: string;
|
|
235
|
+
token_a_address: string;
|
|
236
|
+
token_a_symbol: string;
|
|
237
|
+
token_b_address: string;
|
|
238
|
+
token_b_symbol: string;
|
|
239
|
+
period_days: number;
|
|
240
|
+
total_volume_wbtc: string;
|
|
241
|
+
total_trades: number;
|
|
242
|
+
start_time: string;
|
|
243
|
+
end_time: string;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Fetches the trading volume and number of trades for a specific token pair over a given number of days by making an API call to the swap backend.
|
|
247
|
+
*
|
|
248
|
+
* @param params An object containing the pair address and the number of days to look back for volume data.
|
|
249
|
+
* @returns {Promise<GetPairVolumeResponse>} A promise that resolves to an object containing the pair address, token addresses and symbols, period in days, total volume in WBTC, total number of trades, and the start and end time of the period. The total volume is returned as a string from the API and can be converted to bigint if needed.
|
|
250
|
+
*/
|
|
251
|
+
export declare function getPairVolumeOverDays(params: GetPairVolumeRequest): Promise<GetPairVolumeResponse>;
|
|
252
|
+
export interface GetKlinesRequest {
|
|
253
|
+
pair_address: string;
|
|
254
|
+
interval: '1m' | '5m' | '15m' | '1h' | '4h' | '1d';
|
|
255
|
+
limit: number;
|
|
256
|
+
startTime: number | null;
|
|
257
|
+
endTime: number | null;
|
|
258
|
+
}
|
|
259
|
+
export interface Kline {
|
|
260
|
+
open_time: number;
|
|
261
|
+
close_time: number;
|
|
262
|
+
open: number;
|
|
263
|
+
high: number;
|
|
264
|
+
low: number;
|
|
265
|
+
close: number;
|
|
266
|
+
volume_wbtc: string;
|
|
267
|
+
trades: number;
|
|
268
|
+
}
|
|
269
|
+
export interface GetKlinesResponse {
|
|
270
|
+
pair_address: string;
|
|
271
|
+
token_a_address: string;
|
|
272
|
+
token_a_symbol: string;
|
|
273
|
+
token_b_address: string;
|
|
274
|
+
token_b_symbol: string;
|
|
275
|
+
interval: string;
|
|
276
|
+
klines: Kline[];
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Fetches the historical price and volume data (klines) for a specific token pair and time interval by making an API call to the swap backend.
|
|
280
|
+
*
|
|
281
|
+
* @param params An object containing the pair address, desired time interval for the klines, limit on the number of klines to fetch (max 1000), and optional start and end timestamps to filter the klines.
|
|
282
|
+
* @returns {Promise<GetKlinesResponse>} A promise that resolves to an object containing the pair address, token addresses and symbols, interval, and an array of kline data. Each kline includes open time, close time, open price, high price, low price, close price, volume in WBTC, and number of trades. The volume is returned as a string from the API and can be converted to bigint if needed.
|
|
283
|
+
*/
|
|
284
|
+
export declare function getKlines(params: GetKlinesRequest): Promise<GetKlinesResponse>;
|
|
285
|
+
export interface GetActivityOfPairRequest {
|
|
286
|
+
pair_address: string;
|
|
287
|
+
limit: number;
|
|
288
|
+
offset: number;
|
|
289
|
+
}
|
|
290
|
+
export interface PairActivityEntry {
|
|
291
|
+
id: string;
|
|
292
|
+
type: 'add_liq' | 'remove_liq' | 'swap1' | 'swap2';
|
|
293
|
+
timestamp: number;
|
|
294
|
+
block_height: number;
|
|
295
|
+
success: boolean;
|
|
296
|
+
user_address: string;
|
|
297
|
+
user_pubkey: string;
|
|
298
|
+
amount1: string;
|
|
299
|
+
amount2: string;
|
|
300
|
+
liquidity: string | null;
|
|
301
|
+
token_1: string;
|
|
302
|
+
token_2: string;
|
|
303
|
+
}
|
|
304
|
+
export interface GetActivityOfPairResponse {
|
|
305
|
+
pair_address: string;
|
|
306
|
+
token_a: {
|
|
307
|
+
address: string;
|
|
308
|
+
symbol: string;
|
|
309
|
+
decimals: number;
|
|
310
|
+
};
|
|
311
|
+
token_b: {
|
|
312
|
+
address: string;
|
|
313
|
+
symbol: string;
|
|
314
|
+
decimals: number;
|
|
315
|
+
};
|
|
316
|
+
activities: PairActivityEntry[];
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Fetches the recent swap activities for a specific token pair by making an API call to the swap backend.
|
|
320
|
+
*
|
|
321
|
+
* @param params An object containing the pair address, limit on the number of activities to fetch (max 200), and offset for pagination.
|
|
322
|
+
* @returns {Promise<GetActivityOfPairResponse>} A promise that resolves to an object containing the pair address, token details, and an array of recent activities for that pair. Each activity includes details such as the type of activity (add/remove liquidity or swap), timestamp, block height, success status, user address and pubkey, amounts involved, and token addresses.
|
|
323
|
+
*/
|
|
324
|
+
export declare function getActivityOfPair(params: GetActivityOfPairRequest): Promise<GetActivityOfPairResponse>;
|
|
325
|
+
interface GetWalletActivitiesRequest {
|
|
326
|
+
pubkey: string;
|
|
327
|
+
pairAddress: string;
|
|
328
|
+
}
|
|
329
|
+
export interface WalletActivityEntry {
|
|
330
|
+
id: string;
|
|
331
|
+
type: 'add_liq' | 'remove_liq' | 'swap1' | 'swap2' | 'deposit' | 'unwrap' | 'withdraw' | 'withdraw (lp)';
|
|
332
|
+
timestamp: number | null;
|
|
333
|
+
block_height: number | null;
|
|
334
|
+
success: boolean;
|
|
335
|
+
token_1: {
|
|
336
|
+
address: string;
|
|
337
|
+
symbol: string;
|
|
338
|
+
decimals: number;
|
|
339
|
+
};
|
|
340
|
+
token_2?: {
|
|
341
|
+
address: string;
|
|
342
|
+
symbol: string;
|
|
343
|
+
decimals: number;
|
|
344
|
+
};
|
|
345
|
+
amount1: string;
|
|
346
|
+
amount2?: string;
|
|
347
|
+
txid: string | null;
|
|
348
|
+
liquidity?: string | null;
|
|
349
|
+
target_address?: string | null;
|
|
350
|
+
target_pkscript?: string | null;
|
|
351
|
+
}
|
|
352
|
+
export interface GetWalletActivitiesResponse {
|
|
353
|
+
pubkey: string;
|
|
354
|
+
btc_address: string;
|
|
355
|
+
pair_address: string;
|
|
356
|
+
activities: WalletActivityEntry[];
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Fetches the swap activities associated with a specific wallet public key and pair address by making an API call to the swap backend.
|
|
360
|
+
*
|
|
361
|
+
* @param params An object containing the wallet public key and pair address to query activities for.
|
|
362
|
+
* @returns {Promise<GetWalletActivitiesResponse>} A promise that resolves to an object containing the wallet public key, associated Bitcoin address, pair address, and a list of swap activities (deposits, swaps, liquidity changes, withdrawals) related to that wallet and pair.
|
|
363
|
+
*/
|
|
364
|
+
export declare function getWalletActivities(params: GetWalletActivitiesRequest): Promise<GetWalletActivitiesResponse>;
|
|
365
|
+
/**
|
|
366
|
+
* Fetches the number of decimals for a given token address by making an API call to the swap backend.
|
|
367
|
+
*
|
|
368
|
+
* @param tokenAddress The address of the token to fetch the decimals for.
|
|
369
|
+
* @returns {Promise<number>} A promise that resolves to a number representing the decimals for the specified token address.
|
|
370
|
+
*/
|
|
371
|
+
export declare function getTokenDecimals(tokenAddress: string): Promise<number>;
|
|
372
|
+
export interface ReclaimInscription {
|
|
373
|
+
inscriptionId: string;
|
|
374
|
+
amount: bigint;
|
|
375
|
+
}
|
|
376
|
+
export declare function sumReclaimAmounts(reclaims?: ReclaimInscription[] | null): bigint;
|
|
377
|
+
/**
|
|
378
|
+
* Creates and broadcasts a deposit order for swapping BRC-20 tokens by performing necessary checks, generating signatures, and making API calls to the swap backend. The function handles both BRC-2.0 and base BRC-20 token balances, checks allowances, and prepares the required data for the deposit order.
|
|
379
|
+
*
|
|
380
|
+
* @param tokenAddress The address of the BRC-20 token to deposit.
|
|
381
|
+
* @param tokenAmount The amount of the BRC-20 token to deposit, represented as a bigint in 18 decimals format.
|
|
382
|
+
* @param feeRate The fee rate to use for the transactions, represented in sats/vbyte.
|
|
383
|
+
* @param createAllowanceIfNeeded A boolean flag indicating whether to create an allowance for the BRC-2.0 token transfer if the current allowance is insufficient. Defaults to true.
|
|
384
|
+
* @param reclaimInscriptions Optional transfer inscriptions to reclaim toward the base-layer sufficiency check, each with `inscriptionId` and `amount` (bigint, 18 decimals).
|
|
385
|
+
*
|
|
386
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of transaction IDs (txids) for the transactions involved in the deposit order, including the commit transaction, reveal transaction, and send-to-opreturn transaction.
|
|
387
|
+
*/
|
|
388
|
+
export declare function createAndBroadcastDepositOrder(tokenAddress: string, tokenAmount: bigint, feeRate: number, createAllowanceIfNeeded?: boolean, reclaimInscriptions?: ReclaimInscription[]): Promise<string[]>;
|
|
389
|
+
/**
|
|
390
|
+
* Checks the miner fees required for creating a deposit order for swapping BRC-20 tokens, including the fees for minting inscriptions for allowance and deposit, as well as the fees for sending those inscriptions to OP_RETURN. The function also checks if the user has sufficient balance and allowance for the specified token amount.
|
|
391
|
+
*
|
|
392
|
+
* @param tokenAddress The address of the BRC-20 token to deposit.
|
|
393
|
+
* @param tokenAmount The amount of the BRC-20 token to deposit, represented as a bigint in 18 decimals format.
|
|
394
|
+
* @param feeRate The fee rate to use for the transactions, represented in sats/vbyte.
|
|
395
|
+
* @param createAllowanceIfNeeded A boolean flag indicating whether to include the fees for creating an allowance inscription if the current allowance is insufficient. Defaults to true.
|
|
396
|
+
*
|
|
397
|
+
* @returns A promise that resolves to an object containing the following properties:
|
|
398
|
+
* - needs_approval: A boolean indicating whether an allowance inscription needs to be created.
|
|
399
|
+
* - allowance_fees_total: The total miner fees for creating and sending the allowance inscription to OP_RETURN (0 if no allowance inscription is needed).
|
|
400
|
+
* - base_deposit_fees_total: The total miner fees for creating and sending the base deposit inscription to OP_RETURN (0 if no base deposit inscription is needed).
|
|
401
|
+
* - deposit_fees_total: The total miner fees for creating and sending the deposit inscription to OP_RETURN.
|
|
402
|
+
* - fee_rate: The fee rate used for the calculations, in sats/vbyte.
|
|
403
|
+
*/
|
|
404
|
+
export declare function getMinerFeesOfDepositOrder(tokenAddress: string, tokenAmount: bigint, feeRate: number, createAllowanceIfNeeded?: boolean, reclaimInscriptions?: ReclaimInscription[]): Promise<{
|
|
405
|
+
needs_approval: boolean;
|
|
406
|
+
allowance_fees_total: number;
|
|
407
|
+
base_deposit_fees_total: number;
|
|
408
|
+
deposit_fees_total: number;
|
|
409
|
+
fee_rate: number;
|
|
410
|
+
}>;
|
|
411
|
+
/**
|
|
412
|
+
* Creates and broadcasts a wrap order for swapping BRC-20 tokens. The function first retrieves the necessary swap information and connected wallet details, then generates the required signatures for the deposit. It constructs the call data for the wrap order and mints an inscription with the call data as its content. Finally, it sends the inscription to OP_RETURN and broadcasts the transaction to the network.
|
|
413
|
+
*
|
|
414
|
+
* @param btcAmount The amount of BTC to wrap, represented as a bigint in satoshis.
|
|
415
|
+
* @param feeRate The fee rate to use for the transactions, represented in sats/vbyte.
|
|
416
|
+
*
|
|
417
|
+
* @returns A promise that resolves to an array of transaction IDs related to the wrap order, including the commit transaction, reveal transaction, and the transaction for sending the inscription to OP_RETURN.
|
|
418
|
+
*/
|
|
419
|
+
export declare function createAndBroadcastWrapOrder(btcAmount: bigint, feeRate: number): Promise<string[]>;
|
|
420
|
+
/**
|
|
421
|
+
* Checks the miner fees required for creating a wrap order for swapping BRC-20 tokens. The function retrieves the necessary swap information and connected wallet details, then generates the required signatures for the deposit. It constructs the call data for the wrap order and estimates the gas fees for minting an inscription with the call data as its content and sending it to OP_RETURN.
|
|
422
|
+
*
|
|
423
|
+
* @param btcAmount The amount of BTC to wrap, represented as a bigint in satoshis.
|
|
424
|
+
* @param feeRate The fee rate to use for the transactions, represented in sats/vbyte.
|
|
425
|
+
*
|
|
426
|
+
* @returns A promise that resolves to an object containing the total miner fees for creating and sending the inscriptions related to the wrap order, as well as the fee rate used for the calculations.
|
|
427
|
+
*/
|
|
428
|
+
export declare function getMinerFeesOfWrapOrder(btcAmount: bigint, feeRate: number): Promise<{
|
|
429
|
+
total_fee: number;
|
|
430
|
+
fee_rate: number;
|
|
431
|
+
}>;
|
|
432
|
+
/**
|
|
433
|
+
* Calculates the expected amounts of tokens A and B to be added to the liquidity pool, as well as the amount of liquidity tokens that will be minted, based on the input parameters for adding liquidity. The function retrieves the necessary swap information and uses a proxy to check the current balances and reserves of the tokens in the liquidity pool. It also requests the miner fee for adding liquidity and then calls the addLiquidityRequest function to get the expected results.
|
|
434
|
+
*
|
|
435
|
+
* @param token1Addr The address of the first token to be added to the liquidity pool.
|
|
436
|
+
* @param token2Addr The address of the second token to be added to the liquidity pool.
|
|
437
|
+
* @param amt1 The amount of the first token to be added to the liquidity pool, represented as a bigint.
|
|
438
|
+
* @param amt2 The amount of the second token to be added to the liquidity pool, represented as a bigint.
|
|
439
|
+
*
|
|
440
|
+
* @returns A promise that resolves to an object containing the expected amounts of tokens A and B to be added to the liquidity pool, as well as the amount of liquidity tokens that will be minted, represented as bigints.
|
|
441
|
+
*/
|
|
442
|
+
export declare function getAddLiquidityResult(token1Addr: string, token2Addr: string, amt1: bigint, amt2: bigint): Promise<{
|
|
443
|
+
amountA: bigint;
|
|
444
|
+
amountB: bigint;
|
|
445
|
+
liquidity: bigint;
|
|
446
|
+
}>;
|
|
447
|
+
interface AddLiquidityOrderResponse {
|
|
448
|
+
success: boolean;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Prepares and sends an add liquidity order for a decentralized exchange. The function retrieves the necessary swap information and connected wallet details, calculates the minimum amounts based on the provided slippage, and generates the required signatures for the order. It then constructs the order parameters and sends the add liquidity order to the backend API.
|
|
452
|
+
*
|
|
453
|
+
* @param token1Addr The address of the first token to be added to the liquidity pool.
|
|
454
|
+
* @param token2Addr The address of the second token to be added to the liquidity pool.
|
|
455
|
+
* @param amt1 The amount of the first token to be added to the liquidity pool, represented as a bigint.
|
|
456
|
+
* @param amt2 The amount of the second token to be added to the liquidity pool, represented as a bigint.
|
|
457
|
+
* @param slippageBPS The slippage in basis points to be applied when calculating the minimum amounts for the liquidity order.
|
|
458
|
+
*
|
|
459
|
+
* @returns A promise that resolves to an object indicating the success of the add liquidity order request.
|
|
460
|
+
*/
|
|
461
|
+
export declare function prepareAndSendAddLiquidityOrder(token1Addr: string, token2Addr: string, amt1: bigint, amt2: bigint, slippageBPS: bigint): Promise<AddLiquidityOrderResponse>;
|
|
462
|
+
/**
|
|
463
|
+
* Calculates the expected amounts of tokens A and B to be removed from the liquidity pool, as well as the amount of liquidity tokens that will be burned, based on the input parameters for removing liquidity. The function retrieves the necessary swap information and uses a proxy to check the current balances and reserves of the tokens in the liquidity pool. It also requests the miner fee for removing liquidity and then calls the removeLiquidityRequest function to get the expected results.
|
|
464
|
+
*
|
|
465
|
+
* @param token1Addr The address of the first token to be removed from the liquidity pool.
|
|
466
|
+
* @param token2Addr The address of the second token to be removed from the liquidity pool.
|
|
467
|
+
* @param lpAmt The amount of liquidity tokens to be burned, represented as a bigint.
|
|
468
|
+
*
|
|
469
|
+
* @returns A promise that resolves to an object containing the expected amounts of tokens A and B to be removed from the liquidity pool, as well as the amount of liquidity tokens that will be burned, represented as bigints.
|
|
470
|
+
*/
|
|
471
|
+
export declare function getRemoveLiquidityResult(token1Addr: string, token2Addr: string, lpAmt: bigint): Promise<{
|
|
472
|
+
amountA: bigint;
|
|
473
|
+
amountB: bigint;
|
|
474
|
+
liquidity: bigint;
|
|
475
|
+
}>;
|
|
476
|
+
interface RemoveLiquidityOrderResponse {
|
|
477
|
+
success: boolean;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Prepares and sends a remove liquidity order for a decentralized exchange. The function retrieves the necessary swap information and connected wallet details, calculates the minimum amounts based on the provided slippage, and generates the required signatures for the order. It then constructs the order parameters and sends the remove liquidity order to the backend API.
|
|
481
|
+
*
|
|
482
|
+
* @param token1Addr The address of the first token to be removed from the liquidity pool.
|
|
483
|
+
* @param token2Addr The address of the second token to be removed from the liquidity pool.
|
|
484
|
+
* @param lpAmt The amount of liquidity tokens to be burned, represented as a bigint.
|
|
485
|
+
* @param amt1 The expected amount of the first token to be removed from the liquidity pool, represented as a bigint.
|
|
486
|
+
* @param amt2 The expected amount of the second token to be removed from the liquidity pool, represented as a bigint.
|
|
487
|
+
* @param slippageBPS The slippage in basis points to be applied when calculating the minimum amounts for the liquidity order.
|
|
488
|
+
*
|
|
489
|
+
* @returns A promise that resolves to an object indicating the success of the remove liquidity order request.
|
|
490
|
+
*/
|
|
491
|
+
export declare function prepareAndSendRemoveLiquidityOrder(token1Addr: string, token2Addr: string, lpAmt: bigint, amt1: bigint, amt2: bigint, slippageBPS: bigint): Promise<RemoveLiquidityOrderResponse>;
|
|
492
|
+
/**
|
|
493
|
+
* Calculates the expected output amount, quoted price, and price impact for a token swap operation. The function retrieves the necessary swap information and connected wallet details, then uses a proxy to check the current balances and reserves of the tokens in the liquidity pool. It also requests the miner fee for swapping and gets the fee basis points for the tokens involved in the swap. Finally, it calls the swapRequest function to get the expected results based on the input parameters.
|
|
494
|
+
*
|
|
495
|
+
* @param tokenInAddr The address of the token being swapped from.
|
|
496
|
+
* @param tokenOutAddr The address of the token being swapped to.
|
|
497
|
+
* @param amtIn The amount of the input token to be swapped, represented as a bigint.
|
|
498
|
+
*
|
|
499
|
+
* @returns A promise that resolves to an object containing the expected output amount of the token being swapped to, the quoted price for the swap, the price impact in basis points, and the fee breakdown (see `SwapFees` — `amount_out` is net of the pool fee only, with the rest charged on top).
|
|
500
|
+
*/
|
|
501
|
+
export declare function getSwapResult(tokenInAddr: string, tokenOutAddr: string, amtIn: bigint): Promise<{
|
|
502
|
+
amount_out: bigint;
|
|
503
|
+
quoted_price: number;
|
|
504
|
+
price_impact_bps: bigint;
|
|
505
|
+
fees: SwapFees;
|
|
506
|
+
}>;
|
|
507
|
+
interface SwapOrderResponse {
|
|
508
|
+
success: boolean;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Prepares and sends a swap order for BiS Swap. The function retrieves the necessary swap information and connected wallet details, calculates the minimum output amount based on the provided slippage, and generates the required signatures for the order. It then constructs the order parameters and sends the swap order to the backend API.
|
|
512
|
+
*
|
|
513
|
+
* @param token1Addr The address of the token being swapped from.
|
|
514
|
+
* @param token2Addr The address of the token being swapped to.
|
|
515
|
+
* @param amt1 The amount of the input token to be swapped, represented as a bigint.
|
|
516
|
+
* @param amt2 The amount of the output token expected from the swap, represented as a bigint.
|
|
517
|
+
* @param slippageBPS The slippage in basis points to be applied when calculating the minimum amounts for the liquidity order.
|
|
518
|
+
* @param referrerId An optional referral ID. When provided and valid, a share of the swap fee is credited to the referrer; an invalid referral is ignored and the swap proceeds normally.
|
|
519
|
+
*
|
|
520
|
+
* @returns A promise that resolves to an object indicating the success of the swap order request.
|
|
521
|
+
*/
|
|
522
|
+
export declare function prepareAndSendSwapOrder(token1Addr: string, token2Addr: string, amt1: bigint, amt2: bigint, slippageBPS: bigint, referrerId?: string): Promise<SwapOrderResponse>;
|
|
523
|
+
/**
|
|
524
|
+
* Calculates the expected input amount, quoted price, and price impact for a token swap operation using the swap2 algorithm. The function retrieves the necessary swap information and connected wallet details, then uses a proxy to check the current balances and reserves of the tokens in the liquidity pool. It also requests the miner fee for swapping and gets the fee basis points for the tokens involved in the swap. Finally, it calls the swap2Request function to get the expected results based on the input parameters.
|
|
525
|
+
*
|
|
526
|
+
* @param tokenInAddr The address of the token being swapped from.
|
|
527
|
+
* @param tokenOutAddr The address of the token being swapped to.
|
|
528
|
+
* @param amtOut The amount of the output token expected from the swap, represented as a bigint.
|
|
529
|
+
*
|
|
530
|
+
* @returns A promise that resolves to an object containing the expected input amount of the token being swapped from, the quoted price for the swap, the price impact in basis points, and the fee breakdown (see `SwapFees` — `amount_in` covers the pool fee only, with the rest charged on top).
|
|
531
|
+
*/
|
|
532
|
+
export declare function getSwap2Result(tokenInAddr: string, tokenOutAddr: string, amtOut: bigint): Promise<{
|
|
533
|
+
amount_in: bigint;
|
|
534
|
+
quoted_price: number;
|
|
535
|
+
price_impact_bps: bigint;
|
|
536
|
+
fees: SwapFees;
|
|
537
|
+
}>;
|
|
538
|
+
interface Swap2OrderResponse {
|
|
539
|
+
success: boolean;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Prepares and sends a swap order using the swap2 algorithm for BiS Swap. The function retrieves the necessary swap information and connected wallet details, calculates the maximum input amount based on the provided slippage, and generates the required signatures for the order. It then constructs the order parameters and sends the swap order to the backend API.
|
|
543
|
+
*
|
|
544
|
+
* @param token1Addr The address of the token being swapped from.
|
|
545
|
+
* @param token2Addr The address of the token being swapped to.
|
|
546
|
+
* @param amt1 The amount of the input token to be swapped, represented as a bigint.
|
|
547
|
+
* @param amt2 The amount of the output token expected from the swap, represented as a bigint.
|
|
548
|
+
* @param slippageBPS The slippage in basis points to be applied when calculating the maximum input amount for the swap order.
|
|
549
|
+
* @param referrerId An optional referral ID. When provided and valid, a share of the swap fee is credited to the referrer; an invalid referral is ignored and the swap proceeds normally.
|
|
550
|
+
*
|
|
551
|
+
* @returns A promise that resolves to an object indicating the success of the swap order request.
|
|
552
|
+
*/
|
|
553
|
+
export declare function prepareAndSendSwap2Order(token1Addr: string, token2Addr: string, amt1: bigint, amt2: bigint, slippageBPS: bigint, referrerId?: string): Promise<Swap2OrderResponse>;
|
|
554
|
+
/**
|
|
555
|
+
* Prepares and sends a withdraw request to transfer tokens from the smart wallet to an ordinal wallet. The function retrieves the necessary swap information and connected wallet details, converts the target ordinal Bitcoin address to an Ethereum-compatible address, and generates the required signatures for the withdraw request. It then constructs the withdraw request parameters and sends the request to the backend API.
|
|
556
|
+
*
|
|
557
|
+
* @param tokenAddress The address of the token to be withdrawn.
|
|
558
|
+
* @param ordinalAddress The Bitcoin address of the target ordinal wallet.
|
|
559
|
+
* @param amt The amount of the token to be withdrawn, represented as a bigint.
|
|
560
|
+
*
|
|
561
|
+
* @returns A promise that resolves to an object containing the amount withdrawn, represented as a bigint.
|
|
562
|
+
*/
|
|
563
|
+
export declare function getWithdrawToOrdinalWalletResult(tokenAddress: string, ordinalAddress: string, amt: bigint): Promise<{
|
|
564
|
+
amt: bigint;
|
|
565
|
+
}>;
|
|
566
|
+
/**
|
|
567
|
+
* Prepares and sends a withdraw request to transfer tokens from the smart wallet to the user's own ordinal wallet. The function retrieves the necessary swap information and connected wallet details, obtains the user's ordinal wallet address, converts it to an Ethereum-compatible address, and generates the required signatures for the withdraw request. It then constructs the withdraw request parameters and sends the request to the backend API.
|
|
568
|
+
*
|
|
569
|
+
* @param tokenAddress The address of the token to be withdrawn.
|
|
570
|
+
* @param amt The amount of the token to be withdrawn, represented as a bigint.
|
|
571
|
+
*
|
|
572
|
+
* @returns A promise that resolves to an object containing the amount withdrawn, represented as a bigint.
|
|
573
|
+
*/
|
|
574
|
+
export declare function getWithdrawToSelfOrdinalWalletResult(tokenAddress: string, amt: bigint): Promise<{
|
|
575
|
+
amt: bigint;
|
|
576
|
+
}>;
|
|
577
|
+
export interface WithdrawOrderResponse {
|
|
578
|
+
success: boolean;
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Prepares and sends a withdraw order to transfer tokens from the smart wallet to an ordinal wallet. The function retrieves the necessary swap information and connected wallet details, converts the target ordinal Bitcoin address to an Ethereum-compatible address, and generates the required signatures for the withdraw order. It then constructs the withdraw order parameters and sends the order to the backend API.
|
|
582
|
+
*
|
|
583
|
+
* @param tokenAddr The address of the token to be withdrawn.
|
|
584
|
+
* @param ordinalAddr The Bitcoin address of the target ordinal wallet.
|
|
585
|
+
* @param amt The amount of the token to be withdrawn, represented as a bigint.
|
|
586
|
+
*
|
|
587
|
+
* @returns A promise that resolves to an object indicating the success of the withdraw order request.
|
|
588
|
+
*/
|
|
589
|
+
export declare function prepareAndSendWithdrawOrderToOrdinalWallet(tokenAddr: string, ordinalAddr: string, amt: bigint): Promise<WithdrawOrderResponse>;
|
|
590
|
+
/**
|
|
591
|
+
* Prepares and sends a withdraw order to transfer tokens from the smart wallet to the user's own ordinal wallet. The function retrieves the necessary swap information and connected wallet details, obtains the user's ordinal wallet address, converts it to an Ethereum-compatible address, and generates the required signatures for the withdraw order. It then constructs the withdraw order parameters and sends the order to the backend API.
|
|
592
|
+
*
|
|
593
|
+
* @param tokenAddr The address of the token to be withdrawn.
|
|
594
|
+
* @param amt The amount of the token to be withdrawn, represented as a bigint.
|
|
595
|
+
*
|
|
596
|
+
* @returns A promise that resolves to an object indicating the success of the withdraw order request.
|
|
597
|
+
*/
|
|
598
|
+
export declare function prepareAndSendWithdrawOrderToSelfOrdinalWallet(tokenAddr: string, amt: bigint): Promise<WithdrawOrderResponse>;
|
|
599
|
+
/**
|
|
600
|
+
* Prepares and sends an unwrap order to transfer WBTC from the smart wallet back to Bitcoin. The function retrieves the necessary swap information and connected wallet details, generates the required signatures for the unwrap order, and constructs the unwrap order parameters before sending the order to the backend API.
|
|
601
|
+
*
|
|
602
|
+
* @param pkscript The pkscript of the target Bitcoin address where the unwrapped WBTC will be sent.
|
|
603
|
+
* @param amt The amount of WBTC to be unwrapped, represented as a bigint.
|
|
604
|
+
*
|
|
605
|
+
* @returns A promise that resolves to an object containing the amount unwrapped, represented as a bigint.
|
|
606
|
+
*/
|
|
607
|
+
export declare function getUnwrapResult(pkscript: string, amt: bigint): Promise<{
|
|
608
|
+
amt: bigint;
|
|
609
|
+
}>;
|
|
610
|
+
interface UnwrapOrderResponse {
|
|
611
|
+
success: boolean;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* Prepares and sends an unwrap order to transfer WBTC from the smart wallet back to Bitcoin. The function retrieves the necessary swap information and connected wallet details, generates the required signatures for the unwrap order, and constructs the unwrap order parameters before sending the order to the backend API.
|
|
615
|
+
*
|
|
616
|
+
* @param pkscript The pkscript of the target Bitcoin address where the unwrapped WBTC will be sent.
|
|
617
|
+
* @param amt The amount of WBTC to be unwrapped, represented as a bigint.
|
|
618
|
+
*
|
|
619
|
+
* @returns A promise that resolves to an object indicating the success of the unwrap order request.
|
|
620
|
+
*/
|
|
621
|
+
export declare function prepareAndSendUnwrapOrder(pkscript: string, amt: bigint): Promise<UnwrapOrderResponse>;
|
|
622
|
+
export {};
|