@bestinslot/wallet-kit 0.12.1 → 0.13.1

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.
@@ -1,3 +1,4 @@
1
+ import { APIOrdinalUtxoInfo, APIUtxoInfo } from '../core/helpers';
1
2
  import { SignFunction, SignResponse } from '../provider/api';
2
3
  import { PaymentOpts } from '../types/common';
3
4
  import { InscribeFees, InscribeMultipleResult, InscribeResult, SendInscriptionResult, InscriptionDetails } from '../types/inscription';
@@ -184,6 +185,19 @@ export declare function sendMultiInscriptionWithBuffer(inscriptionIds: string[],
184
185
  * @returns an object containing the transaction ID, signed transaction hex, vout index of the output containing the inscription, and the value of the output containing the inscription
185
186
  */
186
187
  export declare function sendInscriptionAll(inscriptionId: string, targetWallet: WalletInfo, targetPostage: number | null, feeRate: number, dryRun: boolean, signFunc: SignFunction): Promise<SendInscriptionResult>;
188
+ export interface InscriptionUTXODetails {
189
+ satpoint: string;
190
+ value: number;
191
+ script_type: 'pubkeyhash' | 'scripthash' | 'witness_v0_keyhash' | 'witness_v0_scripthash' | 'witness_v1_taproot' | 'pubkey' | 'anchor' | 'witness_unknown' | 'nulldata' | 'multisig' | 'nonstandard';
192
+ block_height: number | null;
193
+ utxo: string;
194
+ }
195
+ /**
196
+ * Locates an inscription's UTXO on `inscriptionAddr`. Searches `ordinalUtxos` when given.
197
+ * Otherwise an inscription created by the saved extra transactions resolves from them
198
+ * directly, and any other inscription is looked up in the backend's `ordinal_utxos` list.
199
+ */
200
+ export declare function getInscriptionDetails(inscriptionId: string, inscriptionAddr: string, ordinalUtxos?: APIOrdinalUtxoInfo[]): Promise<InscriptionUTXODetails | null>;
187
201
  /**
188
202
  * Sends multiple inscriptions in one transaction with a buffer output and returns the fee paid for the transaction. This is used for batch minting or batch sending when the user wants to know the fee before actually sending the transaction.
189
203
  *
@@ -329,10 +343,11 @@ interface SendInscriptionFeeRateResult {
329
343
  * @param targetPostage - postage amount in satoshis to include in the target output
330
344
  * @param extraOutputUtxos - array of extra output UTXOs to include in the transaction, each with its associated wallet information and value
331
345
  * @param feeRate - fee rate in sat/vbyte to use for the transaction
346
+ * @param fetchedCardinalUtxos - the payer's `fetchCardinalUtxos` response to fund from in place of a new fetch
332
347
  *
333
348
  * @returns an object containing the transaction ID, unsigned transaction hex, and calculated transaction fee
334
349
  */
335
- export declare function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(inscriptionId: string, extraInputUtxos: UtxoInfoWithWallet[], targetWallet: WalletInfo, targetPostage: number, extraOutputUtxos: OutputUtxoInfo[], feeRate: number): Promise<SendInscriptionFeeRateResult>;
350
+ export declare function sendInscriptionToOpReturnWithExtraInputsAndExtraOutputFeeRate(inscriptionId: string, extraInputUtxos: UtxoInfoWithWallet[], targetWallet: WalletInfo, targetPostage: number, extraOutputUtxos: OutputUtxoInfo[], feeRate: number, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<SendInscriptionFeeRateResult>;
336
351
  /**
337
352
  * Mints an inscription with extra input UTXOs included in the commit transaction. This function builds and signs the commit and reveal transactions for minting an inscription, while allowing the user to include additional input UTXOs in the commit transaction. This can be useful in cases where the user wants to fund the commit transaction with specific UTXOs or needs to include additional inputs for other reasons. The function retrieves the connected wallets, builds and signs the transactions, validates them, and broadcasts them to the network. If dryRun is true, it returns the signed transaction hex without broadcasting.
338
353
  *
@@ -357,8 +372,9 @@ export declare function mintWithExtraInputInCommitAll(inscriptionDetails: Inscri
357
372
  * @param postage - postage amount in satoshis to use for the transactions
358
373
  * @param paymentAddr - address to send the payment to (if payment is not null)
359
374
  * @param payment - amount to pay (if payment is not null)
375
+ * @param fetchedCardinalUtxos - the payer's `fetchCardinalUtxos` response to fund the commit from in place of a new fetch
360
376
  *
361
377
  * @returns an object containing the estimated commit fee, reveal fee, total fee, unsigned commit transaction hex, signed reveal transaction hex, inscription ID, and postage used
362
378
  */
363
- export declare function mintWithExtraInputInCommitFeeRate(inscriptionDetails: InscriptionDetails, extraInputUtxos: UtxoInfoWithWallet[], feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null): Promise<InscribeCheckFeesResult>;
379
+ export declare function mintWithExtraInputInCommitFeeRate(inscriptionDetails: InscriptionDetails, extraInputUtxos: UtxoInfoWithWallet[], feeRate: number, postage: number | null, paymentAddr: string | null, payment: number | null, fetchedCardinalUtxos?: APIUtxoInfo[]): Promise<InscribeCheckFeesResult>;
364
380
  export {};
@@ -3,8 +3,13 @@
3
3
  * `fee_policy`).
4
4
  */
5
5
  export interface FeePolicy {
6
- /** Total protocol fee on a swap, in basis points. */
6
+ /** Total protocol fee on a swap where either token is WBTC, in basis points. */
7
7
  swap_fee_bps: number;
8
+ /**
9
+ * Total protocol fee on a swap where neither token is WBTC, in basis points.
10
+ * Equals `swap_fee_bps` when the backend does not serve a separate token-pair rate.
11
+ */
12
+ token_pair_swap_fee_bps: number;
8
13
  /** Lowercased token addresses that take the whole fee, highest priority first. WBTC is always first. */
9
14
  priority_tokens: string[];
10
15
  /** Minimum BTC exposure (sats) for a token/token pair's volume/TVL to be reported. A decimal string. */
@@ -13,7 +18,8 @@ export interface FeePolicy {
13
18
  export declare const MISSING_FEE_POLICY_ERROR: string;
14
19
  /**
15
20
  * Validates and normalises the raw `fee_policy` object from `/get_swap_info`.
16
- * Priority addresses are lowercased.
21
+ * Priority addresses are lowercased. An absent `token_pair_swap_fee_bps` takes
22
+ * the value of `swap_fee_bps`.
17
23
  *
18
24
  * @param raw The `fee_policy` value exactly as the backend returned it.
19
25
  * @returns The validated policy.
@@ -25,10 +31,13 @@ export declare function parseFeePolicy(raw: unknown): FeePolicy;
25
31
  * The protocol-fee split for a swap. `token1` is always the input token, for both
26
32
  * exact-input and exact-output swaps.
27
33
  *
28
- * If either side is a priority token, the higher-priority side (lower index in
29
- * `priority_tokens`) pays the full rate and the other side pays 0. Otherwise the
30
- * rate is split, with the odd bp on the input side: input `ceil(rate/2)`, output
31
- * `floor(rate/2)`. Addresses are compared lowercased.
34
+ * The rate is `swap_fee_bps` when either side is WBTC (`priority_tokens[0]`) and
35
+ * `token_pair_swap_fee_bps` otherwise. If either side is a priority token, the
36
+ * higher-priority side (lower index in `priority_tokens`) pays the full rate and
37
+ * the other side pays 0, so a priority token on a token/token pair pays the whole
38
+ * token-pair rate. Otherwise the rate is split, with the odd bp on the input
39
+ * side: input `ceil(rate/2)`, output `floor(rate/2)`. Addresses are compared
40
+ * lowercased.
32
41
  *
33
42
  * @param tokenIn The input token address.
34
43
  * @param tokenOut The output token address.
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ref as s, onScopeDispose as i, watch as u } from "vue";
2
- import { d as r, R as c, i as a } from "./mint-Dm67SjcM.js";
2
+ import { d as r, R as c, i as a } from "./mint-A-bG5QIH.js";
3
3
  function w() {
4
4
  const e = s(r()), t = c((o) => {
5
5
  e.value !== o && (e.value = o);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bestinslot/wallet-kit",
3
3
  "type": "module",
4
- "version": "0.12.1",
4
+ "version": "0.13.1",
5
5
  "private": false,
6
6
  "description": "A lightweight JavaScript library for connecting Bitcoin wallets with a unified API.",
7
7
  "license": "MIT",