@bestinslot/wallet-kit 0.14.0 → 0.14.2

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.
@@ -64,6 +64,8 @@ export declare function callInscription(contractAddress: string, calldata: strin
64
64
  * @param label - The argument name used in error messages.
65
65
  */
66
66
  export declare function parseBrc20Amount(value: string, label: string): bigint;
67
+ /** Formats an 18-decimal bigint as the shortest BRC-20 decimal string, such as `"7.5"`. */
68
+ export declare function formatBrc20Amount(value: bigint): string;
67
69
  export declare function assertRecipient(recipient: string): void;
68
70
  export declare function assertFeeRate(feeRate: number): void;
69
71
  export declare function runChain(steps: ChainStep[], feeRate: number, dryRun: boolean, options: SignProgressOptions): Promise<Brc20SendQuote | ChainResult>;
@@ -79,18 +81,27 @@ export interface SendAsBrc20Args extends SignProgressOptions {
79
81
  dryRun: boolean;
80
82
  }
81
83
  export interface SendAsBrc20Result {
82
- /** The BRC-20 transfer inscription sent to the recipient, or null when `fromBrc20Amount` is 0. */
84
+ /**
85
+ * The BRC-20 transfer inscription sent to the recipient. It carries both parts when the recipient
86
+ * is another address, and only `fromBrc20Amount` when the recipient is the sender's own ordinals
87
+ * address. Null when it would carry nothing.
88
+ */
83
89
  brc20Transfer: Brc20SendPart | null;
84
- /** The BRC2.0 withdraw inscription sent to the recipient, or null when `fromProgAmount` is 0. */
90
+ /**
91
+ * The BRC2.0 withdraw inscription, sent to the sender's own ordinals address (the recipient's, when
92
+ * that is the sender), or null when `fromProgAmount` is 0.
93
+ */
85
94
  progWithdraw: Brc20SendPart | null;
86
95
  /** Every broadcast transaction id, in chain order. */
87
96
  txIds: string[];
88
97
  }
89
98
  /**
90
99
  * Sends a ticker so the recipient receives plain BRC-20, drawing on the sender's base BRC-20 balance
91
- * first and its BRC2.0 balance second. The base part is a BRC-20 transfer inscription sent to the
92
- * recipient; the BRC2.0 part is a `brc20-module` withdraw inscription sent to the recipient. Both
93
- * parts are signed as one chain and broadcast together.
100
+ * and its BRC2.0 balance. To another address, a `brc20-module` withdraw first moves the BRC2.0 part
101
+ * into the sender's own base balance, then one BRC-20 transfer inscription of both parts goes to the
102
+ * recipient: exchanges and other wallets credit only transfer inscriptions. To the sender's own
103
+ * ordinals address, the withdraw alone credits it. All steps are signed as one chain and broadcast
104
+ * together, and the chain order makes the withdraw index before the transfer is inscribed.
94
105
  */
95
106
  export declare function sendAsBrc20(args: SendAsBrc20Args): Promise<Brc20SendQuote | SendAsBrc20Result>;
96
107
  export interface SendAsBrc20ProgArgs extends SignProgressOptions {
@@ -220,15 +220,13 @@ export declare function verifySignature(message: string, signatureHex: string, a
220
220
  */
221
221
  export declare function verifySignatureLocal(message: string, signatureHex: string, address: string): boolean;
222
222
  /**
223
- * A generic helper function to handle fetch requests with consistent error handling.
224
- * It automatically checks for non-ok HTTP responses and for an 'error' field
225
- * in the JSON response body, throwing a descriptive error in either case.
223
+ * Fetches a backend JSON route.
226
224
  *
227
225
  * @param url The URL to fetch.
228
226
  * @param options The standard RequestInit options for the fetch call.
229
227
  * @returns A promise that resolves with the parsed JSON data of type T.
230
- * @throws {Error} Throws an error if the network request fails, the HTTP
231
- * status is not ok, or the response body contains an error field.
228
+ * @throws {BackendError} When the request does not complete, the HTTP status is not ok, the body
229
+ * is not JSON, or the body carries an `error` field. It holds the status and the backend's `code`.
232
230
  */
233
231
  export declare function fetchWithErrors<T>(url: string, options: RequestInit): Promise<T>;
234
232
  /**
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ref as s, onScopeDispose as u, watch as i } from "vue";
2
- import { e as r, T as c, k as a } from "./mint-Cyl31b8y.js";
2
+ import { e as r, U as c, k as a } from "./mint-CSk_3TfL.js";
3
3
  function n() {
4
4
  const o = s(r()), t = c((e) => {
5
5
  o.value !== e && (o.value = e);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bestinslot/wallet-kit",
3
3
  "type": "module",
4
- "version": "0.14.0",
4
+ "version": "0.14.2",
5
5
  "private": false,
6
6
  "description": "A lightweight JavaScript library for connecting Bitcoin wallets with a unified API.",
7
7
  "license": "MIT",