@deloraprotocol/widget 1.0.2 → 1.0.4
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 +41 -5
- package/dist/index.js +27717 -1626
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,9 @@ export declare function TradeWidget(props: TradeWidgetProps): JSX.Element;
|
|
|
91
91
|
|
|
92
92
|
export declare interface TradeWidgetActionPayload {
|
|
93
93
|
action: "approve" | "swap";
|
|
94
|
+
namespace: WalletNamespace;
|
|
95
|
+
walletAddress: string;
|
|
96
|
+
receiverAddress: string;
|
|
94
97
|
sellNetwork: Network;
|
|
95
98
|
buyNetwork: Network;
|
|
96
99
|
sellToken: Token;
|
|
@@ -102,6 +105,8 @@ export declare interface TradeWidgetActionPayload {
|
|
|
102
105
|
txData: QuoteResponse["calldata"] | null;
|
|
103
106
|
price: number;
|
|
104
107
|
gasCostUSD: string | null;
|
|
108
|
+
txHash?: string;
|
|
109
|
+
receipt?: unknown;
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
export declare interface TradeWidgetConfig {
|
|
@@ -111,14 +116,20 @@ export declare interface TradeWidgetConfig {
|
|
|
111
116
|
apiBase?: string;
|
|
112
117
|
/** Base URL for resolving relative image paths (e.g. /img/...). Defaults to dataBaseUrl, apiBase, or origin. */
|
|
113
118
|
assetBaseUrl?: string;
|
|
114
|
-
/**
|
|
119
|
+
/** @deprecated Wallet state is now owned by the widget. */
|
|
115
120
|
isWalletConnected?: boolean;
|
|
116
|
-
/**
|
|
121
|
+
/** @deprecated Wallet connect flow is now owned by the widget. */
|
|
117
122
|
onConnectWallet?: () => void;
|
|
118
123
|
}
|
|
119
124
|
|
|
125
|
+
export declare interface TradeWidgetConnectPayload {
|
|
126
|
+
namespace: WalletNamespace;
|
|
127
|
+
address: string;
|
|
128
|
+
walletName?: string;
|
|
129
|
+
}
|
|
130
|
+
|
|
120
131
|
export declare interface TradeWidgetErrorPayload {
|
|
121
|
-
source: "metadata" | "quote" | "selection";
|
|
132
|
+
source: "metadata" | "quote" | "selection" | "wallet" | "balances" | "execution" | "unsupported";
|
|
122
133
|
message: string;
|
|
123
134
|
status?: number;
|
|
124
135
|
statusCode?: number;
|
|
@@ -135,13 +146,19 @@ export declare interface TradeWidgetProps extends Omit<MyWidgetProps, "onError">
|
|
|
135
146
|
lockSellToken?: boolean;
|
|
136
147
|
lockBuyNetwork?: boolean;
|
|
137
148
|
lockSellNetwork?: boolean;
|
|
138
|
-
onApprove?: (payload:
|
|
139
|
-
onSwap?: (payload:
|
|
149
|
+
onApprove?: (payload: TradeWidgetTransactionPayload) => void;
|
|
150
|
+
onSwap?: (payload: TradeWidgetTransactionPayload) => void;
|
|
140
151
|
onQuote?: (payload: TradeWidgetQuotePayload) => void;
|
|
141
152
|
onError?: (payload: TradeWidgetErrorPayload) => void;
|
|
153
|
+
onConnect?: (payload: TradeWidgetConnectPayload) => void;
|
|
154
|
+
onTxSubmitted?: (payload: TradeWidgetTransactionPayload) => void;
|
|
155
|
+
onTxConfirmed?: (payload: TradeWidgetTransactionPayload) => void;
|
|
142
156
|
}
|
|
143
157
|
|
|
144
158
|
export declare interface TradeWidgetQuotePayload {
|
|
159
|
+
namespace: WalletNamespace;
|
|
160
|
+
senderAddress: string;
|
|
161
|
+
receiverAddress: string;
|
|
145
162
|
sellNetwork: Network;
|
|
146
163
|
buyNetwork: Network;
|
|
147
164
|
sellToken: Token;
|
|
@@ -152,9 +169,28 @@ export declare interface TradeWidgetQuotePayload {
|
|
|
152
169
|
quote: QuoteResponse;
|
|
153
170
|
}
|
|
154
171
|
|
|
172
|
+
export declare type TradeWidgetStatus = "idle" | "connecting-wallet" | "loading-metadata" | "finding-quote" | "checking-allowance" | "awaiting-approve-signature" | "approve-pending" | "awaiting-swap-signature" | "swap-pending" | "success" | "error";
|
|
173
|
+
|
|
155
174
|
export declare interface TradeWidgetTokenSelection {
|
|
156
175
|
chainId: number;
|
|
157
176
|
address: string;
|
|
158
177
|
}
|
|
159
178
|
|
|
179
|
+
export declare interface TradeWidgetTransactionPayload extends TradeWidgetActionPayload {
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export declare type WalletNamespace = "EVM" | "SVM";
|
|
183
|
+
|
|
160
184
|
export { }
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
declare global {
|
|
188
|
+
interface Window {
|
|
189
|
+
ethereum?: Eip1193Provider;
|
|
190
|
+
solana?: SolanaInjectedProvider;
|
|
191
|
+
phantom?: {
|
|
192
|
+
solana?: SolanaInjectedProvider;
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|