thirdweb 5.87.3 → 5.87.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/contract/deployment/zksync/implementations.js +3 -0
- package/dist/cjs/contract/deployment/zksync/implementations.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +25 -12
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +15 -38
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -10
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/contract/deployment/zksync/implementations.js +3 -0
- package/dist/esm/contract/deployment/zksync/implementations.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +25 -12
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +15 -38
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +1 -10
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/contract/deployment/zksync/implementations.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts +1 -1
- package/dist/types/pay/utils/commonTypes.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/contract/deployment/zksync/implementations.ts +3 -0
- package/src/pay/buyWithCrypto/getQuote.ts +28 -12
- package/src/pay/utils/commonTypes.ts +1 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +51 -76
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatStatusScreen.tsx +3 -5
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +1 -13
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -5
- package/src/version.ts +1 -1
@@ -1006,34 +1006,6 @@ function SwapScreenContent(props: {
|
|
1006
1006
|
const switchChainRequired =
|
1007
1007
|
props.payer.wallet.getChain()?.id !== fromChain.id;
|
1008
1008
|
|
1009
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
1010
|
-
function getErrorMessage(err: any) {
|
1011
|
-
type AmountTooLowError = {
|
1012
|
-
code: "MINIMUM_PURCHASE_AMOUNT";
|
1013
|
-
data: {
|
1014
|
-
minimumAmountUSDCents: number;
|
1015
|
-
requestedAmountUSDCents: number;
|
1016
|
-
minimumAmountWei: string;
|
1017
|
-
minimumAmountEth: string;
|
1018
|
-
};
|
1019
|
-
};
|
1020
|
-
|
1021
|
-
const defaultMessage = "Unable to get price quote";
|
1022
|
-
try {
|
1023
|
-
if (err.error.code === "MINIMUM_PURCHASE_AMOUNT") {
|
1024
|
-
const obj = err.error as AmountTooLowError;
|
1025
|
-
const minAmountToken = obj.data.minimumAmountEth;
|
1026
|
-
return {
|
1027
|
-
minAmount: formatNumber(Number(minAmountToken), 6),
|
1028
|
-
};
|
1029
|
-
}
|
1030
|
-
} catch {}
|
1031
|
-
|
1032
|
-
return {
|
1033
|
-
msg: [defaultMessage],
|
1034
|
-
};
|
1035
|
-
}
|
1036
|
-
|
1037
1009
|
const errorMsg =
|
1038
1010
|
!quoteQuery.isLoading && quoteQuery.error
|
1039
1011
|
? getErrorMessage(quoteQuery.error)
|
@@ -1133,9 +1105,10 @@ function SwapScreenContent(props: {
|
|
1133
1105
|
{/* Error message */}
|
1134
1106
|
{errorMsg && (
|
1135
1107
|
<div>
|
1136
|
-
{errorMsg.
|
1108
|
+
{errorMsg.data?.minimumAmountEth ? (
|
1137
1109
|
<Text color="danger" size="sm" center multiline>
|
1138
|
-
Minimum amount is
|
1110
|
+
Minimum amount is{" "}
|
1111
|
+
{formatNumber(Number(errorMsg.data.minimumAmountEth), 6)}{" "}
|
1139
1112
|
<TokenSymbol
|
1140
1113
|
token={toToken}
|
1141
1114
|
chain={toChain}
|
@@ -1144,13 +1117,11 @@ function SwapScreenContent(props: {
|
|
1144
1117
|
color="danger"
|
1145
1118
|
/>
|
1146
1119
|
</Text>
|
1147
|
-
)
|
1148
|
-
|
1149
|
-
|
1150
|
-
<Text color="danger" size="sm" center multiline key={msg}>
|
1151
|
-
{msg}
|
1120
|
+
) : (
|
1121
|
+
<Text color="danger" size="sm" center multiline>
|
1122
|
+
{errorMsg.message || defaultMessage}
|
1152
1123
|
</Text>
|
1153
|
-
)
|
1124
|
+
)}
|
1154
1125
|
</div>
|
1155
1126
|
)}
|
1156
1127
|
|
@@ -1166,12 +1137,17 @@ function SwapScreenContent(props: {
|
|
1166
1137
|
)}
|
1167
1138
|
|
1168
1139
|
{/* Button */}
|
1169
|
-
{errorMsg?.
|
1140
|
+
{errorMsg?.data?.minimumAmountEth ? (
|
1170
1141
|
<Button
|
1171
1142
|
variant="accent"
|
1172
1143
|
fullWidth
|
1173
1144
|
onClick={() => {
|
1174
|
-
props.setTokenAmount(
|
1145
|
+
props.setTokenAmount(
|
1146
|
+
formatNumber(
|
1147
|
+
Number(errorMsg.data?.minimumAmountEth),
|
1148
|
+
6,
|
1149
|
+
).toString(),
|
1150
|
+
);
|
1175
1151
|
props.setHasEditedAmount(true);
|
1176
1152
|
}}
|
1177
1153
|
>
|
@@ -1306,34 +1282,6 @@ function FiatScreenContent(props: {
|
|
1306
1282
|
setIsOpen(true);
|
1307
1283
|
}
|
1308
1284
|
|
1309
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
1310
|
-
function getErrorMessage(err: any) {
|
1311
|
-
type AmountTooLowError = {
|
1312
|
-
code: "MINIMUM_PURCHASE_AMOUNT";
|
1313
|
-
data: {
|
1314
|
-
minimumAmountUSDCents: number;
|
1315
|
-
requestedAmountUSDCents: number;
|
1316
|
-
minimumAmountWei: string;
|
1317
|
-
minimumAmountEth: string;
|
1318
|
-
};
|
1319
|
-
};
|
1320
|
-
|
1321
|
-
const defaultMessage = "Unable to get price quote";
|
1322
|
-
try {
|
1323
|
-
if (err.error.code === "MINIMUM_PURCHASE_AMOUNT") {
|
1324
|
-
const obj = err.error as AmountTooLowError;
|
1325
|
-
const minAmountToken = obj.data.minimumAmountEth;
|
1326
|
-
return {
|
1327
|
-
minAmount: formatNumber(Number(minAmountToken), 6),
|
1328
|
-
};
|
1329
|
-
}
|
1330
|
-
} catch {}
|
1331
|
-
|
1332
|
-
return {
|
1333
|
-
msg: [defaultMessage],
|
1334
|
-
};
|
1335
|
-
}
|
1336
|
-
|
1337
1285
|
const disableSubmit = !fiatQuoteQuery.data;
|
1338
1286
|
|
1339
1287
|
const errorMsg =
|
@@ -1381,9 +1329,10 @@ function FiatScreenContent(props: {
|
|
1381
1329
|
{/* Error message */}
|
1382
1330
|
{errorMsg && (
|
1383
1331
|
<div>
|
1384
|
-
{errorMsg.
|
1332
|
+
{errorMsg.data?.minimumAmountEth ? (
|
1385
1333
|
<Text color="danger" size="sm" center multiline>
|
1386
|
-
Minimum amount is
|
1334
|
+
Minimum amount is{" "}
|
1335
|
+
{formatNumber(Number(errorMsg.data.minimumAmountEth), 6)}{" "}
|
1387
1336
|
<TokenSymbol
|
1388
1337
|
token={toToken}
|
1389
1338
|
chain={toChain}
|
@@ -1392,22 +1341,25 @@ function FiatScreenContent(props: {
|
|
1392
1341
|
color="danger"
|
1393
1342
|
/>
|
1394
1343
|
</Text>
|
1395
|
-
)
|
1396
|
-
|
1397
|
-
|
1398
|
-
<Text color="danger" size="sm" center multiline key={msg}>
|
1399
|
-
{msg}
|
1344
|
+
) : (
|
1345
|
+
<Text color="danger" size="sm" center multiline>
|
1346
|
+
{errorMsg.message || defaultMessage}
|
1400
1347
|
</Text>
|
1401
|
-
)
|
1348
|
+
)}
|
1402
1349
|
</div>
|
1403
1350
|
)}
|
1404
1351
|
|
1405
|
-
{errorMsg?.
|
1352
|
+
{errorMsg?.data?.minimumAmountEth ? (
|
1406
1353
|
<Button
|
1407
1354
|
variant="accent"
|
1408
1355
|
fullWidth
|
1409
1356
|
onClick={() => {
|
1410
|
-
props.setTokenAmount(
|
1357
|
+
props.setTokenAmount(
|
1358
|
+
formatNumber(
|
1359
|
+
Number(errorMsg.data?.minimumAmountEth),
|
1360
|
+
6,
|
1361
|
+
).toString(),
|
1362
|
+
);
|
1411
1363
|
props.setHasEditedAmount(true);
|
1412
1364
|
}}
|
1413
1365
|
>
|
@@ -1526,3 +1478,26 @@ function ChainSelectionScreen(props: {
|
|
1526
1478
|
/>
|
1527
1479
|
);
|
1528
1480
|
}
|
1481
|
+
|
1482
|
+
type ApiError = {
|
1483
|
+
code: string;
|
1484
|
+
message?: string;
|
1485
|
+
data?: {
|
1486
|
+
minimumAmountUSDCents?: string;
|
1487
|
+
requestedAmountUSDCents?: string;
|
1488
|
+
minimumAmountWei?: string;
|
1489
|
+
minimumAmountEth?: string;
|
1490
|
+
};
|
1491
|
+
};
|
1492
|
+
|
1493
|
+
const defaultMessage = "Unable to get price quote";
|
1494
|
+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
1495
|
+
function getErrorMessage(err: any): ApiError {
|
1496
|
+
if (typeof err.error === "object") {
|
1497
|
+
return err.error;
|
1498
|
+
}
|
1499
|
+
return {
|
1500
|
+
code: "UNABLE_TO_GET_PRICE_QUOTE",
|
1501
|
+
message: defaultMessage,
|
1502
|
+
};
|
1503
|
+
}
|
@@ -248,11 +248,9 @@ function OnrampStatusScreenUI(props: {
|
|
248
248
|
</>
|
249
249
|
)}
|
250
250
|
|
251
|
-
{
|
252
|
-
|
253
|
-
|
254
|
-
</Button>
|
255
|
-
)}
|
251
|
+
<Button variant="accent" fullWidth onClick={props.onDone}>
|
252
|
+
{props.transactionMode ? "Continue Transaction" : "Done"}
|
253
|
+
</Button>
|
256
254
|
</>
|
257
255
|
)}
|
258
256
|
</Container>
|
@@ -236,19 +236,7 @@ export function SwapConfirmationScreen(props: {
|
|
236
236
|
if (step === "swap") {
|
237
237
|
setStatus("pending");
|
238
238
|
try {
|
239
|
-
|
240
|
-
|
241
|
-
// Fix for inApp wallet
|
242
|
-
// Ideally - the pay server sends a non-legacy transaction to avoid this issue
|
243
|
-
if (
|
244
|
-
props.payer.wallet.id === "inApp" ||
|
245
|
-
props.payer.wallet.id === "embedded"
|
246
|
-
) {
|
247
|
-
tx = {
|
248
|
-
...props.quote.transactionRequest,
|
249
|
-
gasPrice: undefined,
|
250
|
-
};
|
251
|
-
}
|
239
|
+
const tx = props.quote.transactionRequest;
|
252
240
|
|
253
241
|
trackPayEvent({
|
254
242
|
event: "prompt_swap_execution",
|
@@ -113,11 +113,9 @@ export function SwapStatusScreen(props: {
|
|
113
113
|
<Spacer y="xl" />
|
114
114
|
{swapDetails}
|
115
115
|
<Spacer y="sm" />
|
116
|
-
{
|
117
|
-
|
118
|
-
|
119
|
-
</Button>
|
120
|
-
)}
|
116
|
+
<Button variant="accent" fullWidth onClick={props.onDone}>
|
117
|
+
{props.transactionMode ? "Continue Transaction" : "Done"}
|
118
|
+
</Button>
|
121
119
|
</>
|
122
120
|
)}
|
123
121
|
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.87.
|
1
|
+
export const version = "5.87.4";
|