@rash2x/bridge-widget 0.7.6 → 0.7.8

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/dist/index.d.ts CHANGED
@@ -198,7 +198,7 @@ declare class ChainStrategyRegistry {
198
198
  * Compute fee breakdown: message fee in native token, bridge fee in transfer token,
199
199
  * gas on destination in dst native token, total in USD
200
200
  */
201
- export declare function computeFeeBreakdownUsd(quote: Quote | undefined, srcToken: Token | undefined, tokens: Token[] | undefined, chains: Chain[] | undefined, srcChain?: Chain, dstChain?: Chain): FeeBreakdown;
201
+ export declare function computeFeeBreakdownUsd(quote: Quote | undefined, srcToken: Token | undefined, dstToken: Token | undefined, tokens: Token[] | undefined, chains: Chain[] | undefined, srcChain?: Chain, dstChain?: Chain): FeeBreakdown;
202
202
 
203
203
  declare interface ConnectedWalletActions {
204
204
  setTonConnected: (connected: boolean) => void;
@@ -276,6 +276,14 @@ export declare interface EvaaBridgeProps {
276
276
  urlParams?: BridgeUrlParams;
277
277
  onUrlParamsChange?: (params: BridgeUrlParams) => void;
278
278
  onInitialized?: () => void;
279
+ /**
280
+ * Called before swap transaction starts. Can be used for authorization checks.
281
+ * - Return `true` or `undefined` to proceed with the transaction
282
+ * - Return `false` to cancel the transaction
283
+ * - Return a Promise to await authorization (e.g., user accepting policy)
284
+ * - Promise resolves to `true`: transaction continues
285
+ * - Promise resolves to `false`: transaction is cancelled
286
+ */
279
287
  onSwapStart?: (data: SwapStartData) => boolean | Promise<boolean> | void;
280
288
  onSwapSuccess?: (data: SwapSuccessData) => void;
281
289
  onSwapError?: (error: SwapErrorData) => void;
@@ -560,6 +568,26 @@ declare interface SettingsState {
560
568
  declare type Store = TransactionState & TransactionActions;
561
569
 
562
570
  export declare interface SwapCallbacks {
571
+ /**
572
+ * Called before swap transaction starts. Can be used for authorization checks.
573
+ * - Return `true` or `undefined` to proceed with the transaction
574
+ * - Return `false` to cancel the transaction
575
+ * - Return a Promise to await authorization (e.g., user accepting policy)
576
+ * - Promise resolves to `true`: transaction continues
577
+ * - Promise resolves to `false`: transaction is cancelled
578
+ *
579
+ * @example
580
+ * ```typescript
581
+ * // Simple synchronous check
582
+ * onSwapStart: () => isUserAuthorized()
583
+ *
584
+ * // Async authorization that waits for user action
585
+ * onSwapStart: async () => {
586
+ * const authorized = await showAuthModalAndWait();
587
+ * return authorized; // true to continue, false to cancel
588
+ * }
589
+ * ```
590
+ */
563
591
  onSwapStart?: (data: SwapStartData) => boolean | Promise<boolean> | void;
564
592
  onSwapSuccess?: (data: SwapSuccessData) => void;
565
593
  onSwapError?: (error: SwapErrorData) => void;