thirdweb 5.93.2 → 5.93.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/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +20 -11
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +21 -12
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/coinbase/coinbase-mobile.js +4 -9
- package/dist/cjs/wallets/coinbase/coinbase-mobile.js.map +1 -1
- package/dist/cjs/wallets/smart/index.js +13 -4
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js +20 -11
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +21 -12
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/coinbase/coinbase-mobile.js +4 -9
- package/dist/esm/wallets/coinbase/coinbase-mobile.js.map +1 -1
- package/dist/esm/wallets/smart/index.js +13 -4
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/coinbase/coinbase-mobile.d.ts.map +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/OnRampScreen.tsx +24 -11
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +25 -12
- package/src/version.ts +1 -1
- package/src/wallets/coinbase/coinbase-mobile.ts +4 -9
- package/src/wallets/smart/index.ts +13 -4
@@ -160,6 +160,19 @@ export function SwapConfirmationScreen(props: {
|
|
160
160
|
fullWidth
|
161
161
|
disabled={status === "pending"}
|
162
162
|
onClick={async () => {
|
163
|
+
const wallet = props.payer.wallet;
|
164
|
+
|
165
|
+
// in case the wallet is not on the same chain as the fromToken, switch to it
|
166
|
+
if (wallet.getChain()?.id !== props.fromChain.id) {
|
167
|
+
await wallet.switchChain(props.fromChain);
|
168
|
+
}
|
169
|
+
|
170
|
+
const account = wallet.getAccount();
|
171
|
+
|
172
|
+
if (!account) {
|
173
|
+
throw new Error("Payer wallet has no account");
|
174
|
+
}
|
175
|
+
|
163
176
|
if (step === "approval" && props.quote.approvalData) {
|
164
177
|
try {
|
165
178
|
setStatus("pending");
|
@@ -167,8 +180,8 @@ export function SwapConfirmationScreen(props: {
|
|
167
180
|
trackPayEvent({
|
168
181
|
event: "prompt_swap_approval",
|
169
182
|
client: props.client,
|
170
|
-
walletAddress:
|
171
|
-
walletType:
|
183
|
+
walletAddress: account.address,
|
184
|
+
walletType: wallet.id,
|
172
185
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
173
186
|
fromAmount: props.quote.swapDetails.fromAmountWei,
|
174
187
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
@@ -188,7 +201,7 @@ export function SwapConfirmationScreen(props: {
|
|
188
201
|
});
|
189
202
|
|
190
203
|
const tx = await sendTransaction({
|
191
|
-
account:
|
204
|
+
account: account,
|
192
205
|
transaction,
|
193
206
|
});
|
194
207
|
|
@@ -197,8 +210,8 @@ export function SwapConfirmationScreen(props: {
|
|
197
210
|
trackPayEvent({
|
198
211
|
event: "swap_approval_success",
|
199
212
|
client: props.client,
|
200
|
-
walletAddress:
|
201
|
-
walletType:
|
213
|
+
walletAddress: account.address,
|
214
|
+
walletType: wallet.id,
|
202
215
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
203
216
|
fromAmount: props.quote.swapDetails.fromAmountWei,
|
204
217
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
@@ -221,8 +234,8 @@ export function SwapConfirmationScreen(props: {
|
|
221
234
|
trackPayEvent({
|
222
235
|
event: "prompt_swap_execution",
|
223
236
|
client: props.client,
|
224
|
-
walletAddress:
|
225
|
-
walletType:
|
237
|
+
walletAddress: account.address,
|
238
|
+
walletType: wallet.id,
|
226
239
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
227
240
|
fromAmount: props.quote.swapDetails.fromAmountWei,
|
228
241
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
@@ -233,7 +246,7 @@ export function SwapConfirmationScreen(props: {
|
|
233
246
|
const tx = props.quote.transactionRequest;
|
234
247
|
let _swapTx: WaitForReceiptOptions;
|
235
248
|
// check if we can batch approval and swap
|
236
|
-
const canBatch =
|
249
|
+
const canBatch = account.sendBatchTransaction;
|
237
250
|
if (
|
238
251
|
canBatch &&
|
239
252
|
props.quote.approvalData &&
|
@@ -250,12 +263,12 @@ export function SwapConfirmationScreen(props: {
|
|
250
263
|
});
|
251
264
|
|
252
265
|
_swapTx = await sendBatchTransaction({
|
253
|
-
account:
|
266
|
+
account: account,
|
254
267
|
transactions: [approveTx, tx],
|
255
268
|
});
|
256
269
|
} else {
|
257
270
|
_swapTx = await sendTransaction({
|
258
|
-
account:
|
271
|
+
account: account,
|
259
272
|
transaction: tx,
|
260
273
|
});
|
261
274
|
}
|
@@ -263,8 +276,8 @@ export function SwapConfirmationScreen(props: {
|
|
263
276
|
trackPayEvent({
|
264
277
|
event: "swap_execution_success",
|
265
278
|
client: props.client,
|
266
|
-
walletAddress:
|
267
|
-
walletType:
|
279
|
+
walletAddress: account.address,
|
280
|
+
walletType: wallet.id,
|
268
281
|
fromToken: props.quote.swapDetails.fromToken.tokenAddress,
|
269
282
|
fromAmount: props.quote.swapDetails.fromAmountWei,
|
270
283
|
toToken: props.quote.swapDetails.toToken.tokenAddress,
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.93.
|
1
|
+
export const version = "5.93.4";
|
@@ -17,11 +17,6 @@ export async function getCoinbaseMobileProvider(
|
|
17
17
|
mobileProvider = (await initSmartWalletProvider(
|
18
18
|
options,
|
19
19
|
)) as unknown as ProviderInterface;
|
20
|
-
const ExpoLinking = await import("expo-linking");
|
21
|
-
const { handleResponse } = await import("@mobile-wallet-protocol/client");
|
22
|
-
ExpoLinking.addEventListener("url", ({ url }) => {
|
23
|
-
handleResponse(url);
|
24
|
-
});
|
25
20
|
} else {
|
26
21
|
// otherwise, use the coinbase app provider
|
27
22
|
// TODO: remove this path once the new @mobile-wallet-protocol/client supports it
|
@@ -55,10 +50,10 @@ async function initSmartWalletProvider(
|
|
55
50
|
}
|
56
51
|
const sdk = new EIP1193Provider({
|
57
52
|
metadata: {
|
58
|
-
|
59
|
-
|
60
|
-
appDeeplinkUrl,
|
61
|
-
|
53
|
+
name: options?.appMetadata?.name || "thirdweb powered app",
|
54
|
+
chainIds: options?.chains?.map((c) => c.id),
|
55
|
+
customScheme: appDeeplinkUrl,
|
56
|
+
logoUrl: options?.appMetadata?.logoUrl,
|
62
57
|
},
|
63
58
|
wallet: Wallets.CoinbaseSmartWallet, // TODO support both smart and EOA once the SDK supports it
|
64
59
|
});
|
@@ -264,11 +264,12 @@ async function createSmartAccount(
|
|
264
264
|
executeOverride: options.overrides?.execute,
|
265
265
|
});
|
266
266
|
|
267
|
+
const chain = getCachedChain(transaction.chainId);
|
267
268
|
const result = await _sendUserOp({
|
268
269
|
executeTx,
|
269
270
|
options: {
|
270
271
|
...options,
|
271
|
-
chain
|
272
|
+
chain,
|
272
273
|
accountContract,
|
273
274
|
overrides: {
|
274
275
|
...options.overrides,
|
@@ -278,7 +279,7 @@ async function createSmartAccount(
|
|
278
279
|
});
|
279
280
|
trackTransaction({
|
280
281
|
client: options.client,
|
281
|
-
chainId:
|
282
|
+
chainId: chain.id,
|
282
283
|
transactionHash: result.transactionHash,
|
283
284
|
walletAddress: options.accountContract.address,
|
284
285
|
walletType: "smart",
|
@@ -292,17 +293,25 @@ async function createSmartAccount(
|
|
292
293
|
transactions,
|
293
294
|
executeBatchOverride: options.overrides?.executeBatch,
|
294
295
|
});
|
296
|
+
if (transactions.length === 0) {
|
297
|
+
throw new Error("No transactions to send");
|
298
|
+
}
|
299
|
+
const firstTx = transactions[0];
|
300
|
+
if (!firstTx) {
|
301
|
+
throw new Error("No transactions to send");
|
302
|
+
}
|
303
|
+
const chain = getCachedChain(firstTx.chainId);
|
295
304
|
const result = await _sendUserOp({
|
296
305
|
executeTx,
|
297
306
|
options: {
|
298
307
|
...options,
|
299
|
-
chain
|
308
|
+
chain,
|
300
309
|
accountContract,
|
301
310
|
},
|
302
311
|
});
|
303
312
|
trackTransaction({
|
304
313
|
client: options.client,
|
305
|
-
chainId:
|
314
|
+
chainId: chain.id,
|
306
315
|
transactionHash: result.transactionHash,
|
307
316
|
walletAddress: options.accountContract.address,
|
308
317
|
walletType: "smart",
|