@skip-go/widget 3.0.24 → 3.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/build/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { ChainAffiliates } from '@skip-go/client';
2
+ import { ChainType } from '@skip-go/client';
2
3
  import { JSX as JSX_2 } from 'react';
3
4
  import { ReactElement } from 'react';
4
5
  import { RouteConfig } from '@skip-go/client';
@@ -6,6 +7,14 @@ import { SignClientTypes } from '@walletconnect/types';
6
7
  import { SkipClientOptions } from '@skip-go/client';
7
8
  import { WalletConnectModalConfig } from '@walletconnect/modal';
8
9
 
10
+ declare type Callbacks = {
11
+ onWalletConnected?: (props: OnWalletConnectedProps) => void;
12
+ onWalletDisconnected?: (props: OnWalletDisconnectedProps) => void;
13
+ onTransactionBroadcasted?: (props: OnTransactionBroadcastedProps) => void;
14
+ onTransactionComplete?: (props: OnTransactionCompleteProps) => void;
15
+ onTransactionFailed?: (props: OnTransactionFailedProps) => void;
16
+ };
17
+
9
18
  declare type ChainFilter = {
10
19
  source?: Record<string, string[] | undefined>;
11
20
  destination?: Record<string, string[] | undefined>;
@@ -98,6 +107,34 @@ declare type NewSwapVenueRequest = {
98
107
  chainId: string;
99
108
  };
100
109
 
110
+ declare type OnTransactionBroadcastedProps = {
111
+ txHash: string;
112
+ chainId: string;
113
+ explorerLink: string;
114
+ };
115
+
116
+ declare type OnTransactionCompleteProps = {
117
+ txHash: string;
118
+ chainId: string;
119
+ explorerLink: string;
120
+ };
121
+
122
+ declare type OnTransactionFailedProps = {
123
+ error: string;
124
+ };
125
+
126
+ declare type OnWalletConnectedProps = {
127
+ walletName: string;
128
+ chainIdToAddressMap?: Record<string, string>;
129
+ chainId?: string;
130
+ address?: string;
131
+ };
132
+
133
+ declare type OnWalletDisconnectedProps = {
134
+ walletName: string;
135
+ chainType?: ChainType;
136
+ };
137
+
101
138
  declare type PartialTheme = Partial<Theme> | undefined;
102
139
 
103
140
  declare type ShowSwapWidget = {
@@ -162,7 +199,19 @@ export declare type WidgetProps = {
162
199
  routeConfig?: WidgetRouteConfig;
163
200
  filter?: ChainFilter;
164
201
  walletConnect?: WalletConnect;
165
- } & Pick<NewSkipClientOptions, "apiUrl" | "chainIdsToAffiliates" | "endpointOptions">;
202
+ /**
203
+ * Map of connected wallet addresses, allowing your app to pass pre-connected addresses to the widget.
204
+ * This feature enables the widget to display a specific address as connected for a given chain.
205
+ *
206
+ * If a chain ID is mapped to an address, the widget will automatically use it as the connected address for that chain.
207
+ *
208
+ * @example
209
+ * ```tsx
210
+ * <Widget connectedAddresses={{ "cosmoshub-4": "cosmos1...", "1": "0x..." }} />
211
+ * ```
212
+ */
213
+ connectedAddresses?: Record<string, string | undefined>;
214
+ } & Pick<NewSkipClientOptions, "apiUrl" | "chainIdsToAffiliates" | "endpointOptions" | "getCosmosSigner" | "getEVMSigner" | "getSVMSigner"> & Callbacks;
166
215
 
167
216
  declare type WidgetRouteConfig = Omit<RouteConfig, "swapVenues" | "swapVenue"> & {
168
217
  swapVenues?: NewSwapVenueRequest[];