thirdweb 5.64.3 → 5.64.4-nightly-c2a90542d7f870c799c297c59cd2b468816f7939-20241031000332
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/exports/wallets/smart.js +2 -1
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/exports/wallets.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +3 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +4 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js +2 -1
- package/dist/cjs/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/cjs/transaction/prepare-contract-call.js +23 -0
- package/dist/cjs/transaction/prepare-contract-call.js.map +1 -1
- package/dist/cjs/utils/url.js +8 -0
- package/dist/cjs/utils/url.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/authEndpoint.js +7 -6
- package/dist/cjs/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +17 -20
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/jwt.js +7 -6
- package/dist/cjs/wallets/in-app/core/authentication/jwt.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/passkeys.js +5 -5
- package/dist/cjs/wallets/in-app/core/authentication/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +0 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +2 -2
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +17 -20
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/calls.js +31 -0
- package/dist/cjs/wallets/smart/lib/calls.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/userop.js +1 -0
- package/dist/cjs/wallets/smart/lib/userop.js.map +1 -1
- package/dist/esm/exports/wallets/smart.js +1 -1
- package/dist/esm/exports/wallets/smart.js.map +1 -1
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/TransactionsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +3 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +4 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.js.map +1 -1
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js +2 -1
- package/dist/esm/react/web/ui/TransactionButton/ExecutingScreen.js.map +1 -1
- package/dist/esm/transaction/prepare-contract-call.js +23 -0
- package/dist/esm/transaction/prepare-contract-call.js.map +1 -1
- package/dist/esm/utils/url.js +6 -0
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/authEndpoint.js +7 -6
- package/dist/esm/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +17 -20
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/jwt.js +7 -6
- package/dist/esm/wallets/in-app/core/authentication/jwt.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/passkeys.js +5 -5
- package/dist/esm/wallets/in-app/core/authentication/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +2 -2
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +17 -20
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/smart/lib/calls.js +30 -0
- package/dist/esm/wallets/smart/lib/calls.js.map +1 -1
- package/dist/esm/wallets/smart/lib/userop.js +1 -0
- package/dist/esm/wallets/smart/lib/userop.js.map +1 -1
- package/dist/types/exports/wallets/smart.d.ts +1 -1
- package/dist/types/exports/wallets/smart.d.ts.map +1 -1
- package/dist/types/exports/wallets.d.ts +1 -1
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/TransactionsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.d.ts.map +1 -1
- package/dist/types/react/web/ui/TransactionButton/ExecutingScreen.d.ts.map +1 -1
- package/dist/types/transaction/prepare-contract-call.d.ts +23 -0
- package/dist/types/transaction/prepare-contract-call.d.ts.map +1 -1
- package/dist/types/utils/url.d.ts +2 -0
- package/dist/types/utils/url.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/authEndpoint.d.ts +2 -2
- package/dist/types/wallets/in-app/core/authentication/authEndpoint.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/jwt.d.ts +2 -2
- package/dist/types/wallets/in-app/core/authentication/jwt.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/passkeys.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +2 -0
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts +0 -4
- package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/calls.d.ts +27 -1
- package/dist/types/wallets/smart/lib/calls.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/userop.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/exports/wallets/smart.ts +4 -1
- package/src/exports/wallets.ts +1 -0
- package/src/react/web/ui/ConnectWallet/TransactionsScreen.tsx +5 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +9 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatTxDetailsTable.tsx +5 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +13 -3
- package/src/react/web/ui/ConnectWallet/screens/WalletTransactionHistory.tsx +2 -1
- package/src/react/web/ui/TransactionButton/ExecutingScreen.tsx +5 -1
- package/src/transaction/prepare-contract-call.ts +23 -0
- package/src/utils/url.ts +8 -0
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/authEndpoint.ts +11 -8
- package/src/wallets/in-app/core/authentication/guest.ts +16 -19
- package/src/wallets/in-app/core/authentication/jwt.ts +11 -8
- package/src/wallets/in-app/core/authentication/passkeys.ts +5 -7
- package/src/wallets/in-app/core/wallet/types.ts +3 -0
- package/src/wallets/in-app/native/helpers/api/fetchers.ts +1 -1
- package/src/wallets/in-app/native/native-connector.ts +2 -2
- package/src/wallets/in-app/web/lib/web-connector.ts +20 -20
- package/src/wallets/smart/lib/calls.ts +42 -1
- package/src/wallets/smart/lib/userop.ts +1 -0
- package/src/wallets/smart/smart-wallet-integration-v07.test.ts +8 -0
- package/src/wallets/smart/smart-wallet-integration.test.ts +7 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"userop.d.ts","sourceRoot":"","sources":["../../../../../src/wallets/smart/lib/userop.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EAEtB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,m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AC;IAC3B,YAAY,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,CA0C/C;AAiDD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IACjD,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,gDAmEA"}
|
package/package.json
CHANGED
@@ -15,7 +15,10 @@ export {
|
|
15
15
|
estimateUserOpGas,
|
16
16
|
} from "../../wallets/smart/lib/bundler.js";
|
17
17
|
|
18
|
-
export {
|
18
|
+
export {
|
19
|
+
predictAddress,
|
20
|
+
predictSmartAccountAddress,
|
21
|
+
} from "../../wallets/smart/lib/calls.js";
|
19
22
|
|
20
23
|
export { getPaymasterAndData } from "../../wallets/smart/lib/paymaster.js";
|
21
24
|
|
package/src/exports/wallets.ts
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
import { ExternalLinkIcon } from "@radix-ui/react-icons";
|
4
4
|
import { useState } from "react";
|
5
5
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
6
|
+
import { formatExplorerAddressUrl } from "../../../../utils/url.js";
|
6
7
|
import { iconSize } from "../../../core/design-system/index.js";
|
7
8
|
import { useChainExplorers } from "../../../core/hooks/others/useChainQuery.js";
|
8
9
|
import { useActiveAccount } from "../../../core/hooks/wallets/useActiveAccount.js";
|
@@ -125,7 +126,10 @@ export function TransactionsScreen(props: {
|
|
125
126
|
<ButtonLink
|
126
127
|
fullWidth
|
127
128
|
variant="outline"
|
128
|
-
href={
|
129
|
+
href={formatExplorerAddressUrl(
|
130
|
+
chainExplorers.explorers[0]?.url ?? "",
|
131
|
+
activeAccount?.address ?? "",
|
132
|
+
)}
|
129
133
|
target="_blank"
|
130
134
|
as="a"
|
131
135
|
gap="xs"
|
@@ -10,6 +10,7 @@ import { NATIVE_TOKEN_ADDRESS } from "../../../../../../../constants/addresses.j
|
|
10
10
|
import type { BuyWithFiatQuote } from "../../../../../../../pay/buyWithFiat/getQuote.js";
|
11
11
|
import type { BuyWithFiatStatus } from "../../../../../../../pay/buyWithFiat/getStatus.js";
|
12
12
|
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
13
|
+
import { formatExplorerTxUrl } from "../../../../../../../utils/url.js";
|
13
14
|
import {
|
14
15
|
type Theme,
|
15
16
|
fontSize,
|
@@ -345,7 +346,10 @@ export function FiatSteps(props: {
|
|
345
346
|
onRampExplorers.explorers[0]?.url && onRampTxHash
|
346
347
|
? {
|
347
348
|
label: "View on Explorer",
|
348
|
-
url:
|
349
|
+
url: formatExplorerTxUrl(
|
350
|
+
onRampExplorers.explorers[0]?.url,
|
351
|
+
onRampTxHash,
|
352
|
+
),
|
349
353
|
}
|
350
354
|
: undefined
|
351
355
|
}
|
@@ -382,7 +386,10 @@ export function FiatSteps(props: {
|
|
382
386
|
toChainExplorers.explorers[0]?.url && toTokenTxHash
|
383
387
|
? {
|
384
388
|
label: "View on Explorer",
|
385
|
-
url:
|
389
|
+
url: formatExplorerTxUrl(
|
390
|
+
toChainExplorers.explorers[0]?.url,
|
391
|
+
toTokenTxHash,
|
392
|
+
),
|
386
393
|
}
|
387
394
|
: undefined
|
388
395
|
}
|
@@ -2,6 +2,7 @@ import { ExternalLinkIcon } from "@radix-ui/react-icons";
|
|
2
2
|
import { getCachedChain } from "../../../../../../../chains/utils.js";
|
3
3
|
import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
4
4
|
import { formatNumber } from "../../../../../../../utils/formatNumber.js";
|
5
|
+
import { formatExplorerTxUrl } from "../../../../../../../utils/url.js";
|
5
6
|
import {
|
6
7
|
fontSize,
|
7
8
|
iconSize,
|
@@ -121,9 +122,10 @@ export function OnRampTxDetailsTable(props: {
|
|
121
122
|
<ButtonLink
|
122
123
|
fullWidth
|
123
124
|
variant="outline"
|
124
|
-
href={
|
125
|
-
onRampExplorers.explorers[0]
|
126
|
-
|
125
|
+
href={formatExplorerTxUrl(
|
126
|
+
onRampExplorers.explorers[0]?.url,
|
127
|
+
onrampTxHash,
|
128
|
+
)}
|
127
129
|
target="_blank"
|
128
130
|
gap="xs"
|
129
131
|
style={{
|
@@ -4,6 +4,7 @@ import type { ThirdwebClient } from "../../../../../../../client/client.js";
|
|
4
4
|
import type { BuyWithCryptoQuote } from "../../../../../../../pay/buyWithCrypto/getQuote.js";
|
5
5
|
import type { ValidBuyWithCryptoStatus } from "../../../../../../../pay/buyWithCrypto/getStatus.js";
|
6
6
|
import { shortenAddress } from "../../../../../../../utils/address.js";
|
7
|
+
import { formatExplorerTxUrl } from "../../../../../../../utils/url.js";
|
7
8
|
import {
|
8
9
|
fontSize,
|
9
10
|
iconSize,
|
@@ -199,7 +200,10 @@ export function SwapTxDetailsTable(
|
|
199
200
|
<ButtonLink
|
200
201
|
fullWidth
|
201
202
|
variant="outline"
|
202
|
-
href={
|
203
|
+
href={formatExplorerTxUrl(
|
204
|
+
fromChainExplorers.explorers[0]?.url,
|
205
|
+
sourceTxHash,
|
206
|
+
)}
|
203
207
|
target="_blank"
|
204
208
|
gap="xs"
|
205
209
|
style={{
|
@@ -330,7 +334,10 @@ export function SwapTxDetailsTable(
|
|
330
334
|
<ButtonLink
|
331
335
|
fullWidth
|
332
336
|
variant="outline"
|
333
|
-
href={
|
337
|
+
href={formatExplorerTxUrl(
|
338
|
+
fromChainExplorers.explorers[0]?.url,
|
339
|
+
sourceTxHash,
|
340
|
+
)}
|
334
341
|
target="_blank"
|
335
342
|
gap="xs"
|
336
343
|
style={{
|
@@ -352,7 +359,10 @@ export function SwapTxDetailsTable(
|
|
352
359
|
<ButtonLink
|
353
360
|
fullWidth
|
354
361
|
variant="outline"
|
355
|
-
href={
|
362
|
+
href={formatExplorerTxUrl(
|
363
|
+
toChainExplorers.explorers[0]?.url,
|
364
|
+
destinationTxHash,
|
365
|
+
)}
|
356
366
|
target="_blank"
|
357
367
|
gap="xs"
|
358
368
|
style={{
|
@@ -7,6 +7,7 @@ import type { ThirdwebClient } from "../../../../../client/client.js";
|
|
7
7
|
import { getTransactionStore } from "../../../../../transaction/transaction-store.js";
|
8
8
|
import { shortenHex } from "../../../../../utils/address.js";
|
9
9
|
import type { Hex } from "../../../../../utils/encoding/hex.js";
|
10
|
+
import { formatExplorerTxUrl } from "../../../../../utils/url.js";
|
10
11
|
import { useCustomTheme } from "../../../../core/design-system/CustomThemeProvider.js";
|
11
12
|
import { iconSize, spacing } from "../../../../core/design-system/index.js";
|
12
13
|
import { useWaitForReceipt } from "../../../../core/hooks/contract/useWaitForReceipt.js";
|
@@ -192,7 +193,7 @@ function TransactionButton(props: {
|
|
192
193
|
if (props.explorerUrl) {
|
193
194
|
return (
|
194
195
|
<a
|
195
|
-
href={
|
196
|
+
href={formatExplorerTxUrl(props.explorerUrl, props.hash)}
|
196
197
|
target="_blank"
|
197
198
|
rel="noreferrer"
|
198
199
|
>
|
@@ -3,6 +3,7 @@ import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
3
|
import type { Hex } from "viem";
|
4
4
|
import type { WaitForReceiptOptions } from "../../../../transaction/actions/wait-for-tx-receipt.js";
|
5
5
|
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
|
6
|
+
import { formatExplorerTxUrl } from "../../../../utils/url.js";
|
6
7
|
import { iconSize } from "../../../core/design-system/index.js";
|
7
8
|
import { useChainExplorers } from "../../../core/hooks/others/useChainQuery.js";
|
8
9
|
import { useSendTransaction } from "../../hooks/transaction/useSendTransaction.js";
|
@@ -106,7 +107,10 @@ export function ExecutingTxScreen(props: {
|
|
106
107
|
<ButtonLink
|
107
108
|
fullWidth
|
108
109
|
variant="outline"
|
109
|
-
href={
|
110
|
+
href={formatExplorerTxUrl(
|
111
|
+
chainExplorers.explorers[0]?.url ?? "",
|
112
|
+
txHash,
|
113
|
+
)}
|
110
114
|
target="_blank"
|
111
115
|
as="a"
|
112
116
|
gap="xs"
|
@@ -92,6 +92,29 @@ export type PrepareContractCallOptions<
|
|
92
92
|
* });
|
93
93
|
* ```
|
94
94
|
*
|
95
|
+
* ### Usage with ERC20 value:
|
96
|
+
*
|
97
|
+
* For transactions that transfer ERC20 tokens, you can specify the value as the amount of tokens to transfer.
|
98
|
+
*
|
99
|
+
* You can use this in conjuction with the [`getApprovalForTransaction`](https://portal.thirdweb.com/references/typescript/v5/getApprovalForTransaction) function to easily create approval transactions for ERC20 tokens.
|
100
|
+
*
|
101
|
+
* This value will also be read by the react hooks and UI components to present to total cost to the user.
|
102
|
+
*
|
103
|
+
* ```ts
|
104
|
+
* import { prepareContractCall } from "thirdweb";
|
105
|
+
* import { toWei } from "thirdweb/utils";
|
106
|
+
*
|
107
|
+
* const transaction = prepareContractCall({
|
108
|
+
* contract,
|
109
|
+
* method: "function payWithCoin()",
|
110
|
+
* params: [],
|
111
|
+
* erc20Value: {
|
112
|
+
* tokenAddress: "0x...", // the address of the ERC20 token
|
113
|
+
* amountWei: toWei("0.1"), // the amount of tokens to transfer in wei
|
114
|
+
* },
|
115
|
+
* });
|
116
|
+
* ```
|
117
|
+
*
|
95
118
|
* ### Usage with a JSON ABI function object:
|
96
119
|
*
|
97
120
|
* ```ts
|
package/src/utils/url.ts
CHANGED
@@ -63,3 +63,11 @@ export function formatWalletConnectUrl(
|
|
63
63
|
? formatUniversalUrl(appUrl, wcUri)
|
64
64
|
: formatNativeUrl(appUrl, wcUri);
|
65
65
|
}
|
66
|
+
|
67
|
+
export function formatExplorerTxUrl(explorerUrl: string, txHash: string) {
|
68
|
+
return `${explorerUrl.endsWith("/") ? explorerUrl : `${explorerUrl}/`}tx/${txHash}`;
|
69
|
+
}
|
70
|
+
|
71
|
+
export function formatExplorerAddressUrl(explorerUrl: string, address: string) {
|
72
|
+
return `${explorerUrl.endsWith("/") ? explorerUrl : `${explorerUrl}/`}address/${address}`;
|
73
|
+
}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.64.
|
1
|
+
export const version = "5.64.4-nightly-c2a90542d7f870c799c297c59cd2b468816f7939-20241031000332";
|
@@ -1,34 +1,37 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
-
import {
|
2
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
3
|
import { ROUTE_AUTH_ENDPOINT_CALLBACK } from "../../native/helpers/constants.js";
|
4
4
|
import { createErrorMessage } from "../../native/helpers/errors.js";
|
5
|
-
import type {
|
5
|
+
import type { Ecosystem } from "../wallet/types.js";
|
6
6
|
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
7
7
|
|
8
8
|
export async function authEndpoint(args: {
|
9
9
|
payload: string;
|
10
10
|
client: ThirdwebClient;
|
11
|
-
|
11
|
+
ecosystem?: Ecosystem;
|
12
12
|
}): Promise<AuthStoredTokenWithCookieReturnType> {
|
13
|
-
const
|
13
|
+
const clientFetch = getClientFetch(args.client, args.ecosystem);
|
14
|
+
|
15
|
+
const res = await clientFetch(ROUTE_AUTH_ENDPOINT_CALLBACK, {
|
14
16
|
method: "POST",
|
15
17
|
headers: {
|
16
|
-
|
18
|
+
"Content-Type": "application/json",
|
17
19
|
},
|
18
20
|
body: JSON.stringify({
|
19
21
|
payload: args.payload,
|
20
22
|
developerClientId: args.client.clientId,
|
21
23
|
}),
|
22
24
|
});
|
23
|
-
|
24
|
-
|
25
|
+
|
26
|
+
if (!res.ok) {
|
27
|
+
const error = await res.json();
|
25
28
|
throw new Error(
|
26
29
|
`Custom auth endpoint authentication error: ${error.message}`,
|
27
30
|
);
|
28
31
|
}
|
29
32
|
|
30
33
|
try {
|
31
|
-
const { verifiedToken } = await
|
34
|
+
const { verifiedToken } = await res.json();
|
32
35
|
|
33
36
|
return { storedToken: verifiedToken };
|
34
37
|
} catch (e) {
|
@@ -29,25 +29,22 @@ export async function guestAuthenticate(args: {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
const clientFetch = getClientFetch(args.client, args.ecosystem);
|
32
|
-
const
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
});
|
32
|
+
const path = getLoginCallbackUrl({
|
33
|
+
authOption: "guest",
|
34
|
+
client: args.client,
|
35
|
+
ecosystem: args.ecosystem,
|
36
|
+
});
|
37
|
+
const res = await clientFetch(`${path}`, {
|
38
|
+
method: "POST",
|
39
|
+
headers: {
|
40
|
+
"Content-Type": "application/json",
|
41
|
+
},
|
42
|
+
body: JSON.stringify({
|
43
|
+
sessionId,
|
44
|
+
}),
|
45
|
+
});
|
47
46
|
|
48
|
-
|
47
|
+
if (!res.ok) throw new Error("Failed to generate guest account");
|
49
48
|
|
50
|
-
|
51
|
-
})();
|
52
|
-
return authResult;
|
49
|
+
return (await res.json()) satisfies AuthStoredTokenWithCookieReturnType;
|
53
50
|
}
|
@@ -1,19 +1,21 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
-
import {
|
2
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
3
|
import { ROUTE_AUTH_JWT_CALLBACK } from "../../native/helpers/constants.js";
|
4
4
|
import { createErrorMessage } from "../../native/helpers/errors.js";
|
5
|
-
import type {
|
5
|
+
import type { Ecosystem } from "../wallet/types.js";
|
6
6
|
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
7
7
|
|
8
8
|
export async function customJwt(args: {
|
9
9
|
jwt: string;
|
10
10
|
client: ThirdwebClient;
|
11
|
-
|
11
|
+
ecosystem?: Ecosystem;
|
12
12
|
}): Promise<AuthStoredTokenWithCookieReturnType> {
|
13
|
-
const
|
13
|
+
const clientFetch = getClientFetch(args.client, args.ecosystem);
|
14
|
+
|
15
|
+
const res = await clientFetch(ROUTE_AUTH_JWT_CALLBACK, {
|
14
16
|
method: "POST",
|
15
17
|
headers: {
|
16
|
-
|
18
|
+
"Content-Type": "application/json",
|
17
19
|
},
|
18
20
|
body: JSON.stringify({
|
19
21
|
jwt: args.jwt,
|
@@ -21,13 +23,14 @@ export async function customJwt(args: {
|
|
21
23
|
}),
|
22
24
|
});
|
23
25
|
|
24
|
-
if (!
|
25
|
-
const error = await
|
26
|
+
if (!res.ok) {
|
27
|
+
const error = await res.json();
|
26
28
|
throw new Error(`JWT authentication error: ${error.message}`);
|
27
29
|
}
|
28
30
|
|
29
31
|
try {
|
30
|
-
const { verifiedToken } = await
|
32
|
+
const { verifiedToken } = await res.json();
|
33
|
+
|
31
34
|
return { storedToken: verifiedToken };
|
32
35
|
} catch (e) {
|
33
36
|
throw new Error(
|
@@ -137,19 +137,17 @@ export async function loginWithPasskey(options: {
|
|
137
137
|
}
|
138
138
|
const fetchWithId = getClientFetch(options.client, options.ecosystem);
|
139
139
|
// 1. request challenge from server/iframe
|
140
|
-
const
|
141
|
-
|
140
|
+
const [challengeData, credentialId] = await Promise.all([
|
141
|
+
fetchWithId(getChallengePath("sign-in")).then((r) => r.json()),
|
142
|
+
options.storage?.getPasskeyCredentialId(),
|
143
|
+
]);
|
142
144
|
if (!challengeData.challenge) {
|
143
145
|
throw new Error("No challenge received");
|
144
146
|
}
|
145
147
|
const challenge = challengeData.challenge;
|
146
|
-
// 1.2. find the user's credentialId in local storage
|
147
|
-
const credentialId =
|
148
|
-
(await options.storage?.getPasskeyCredentialId()) ?? undefined;
|
149
|
-
|
150
148
|
// 2. initiate login
|
151
149
|
const authentication = await options.passkeyClient.authenticate({
|
152
|
-
credentialId,
|
150
|
+
credentialId: credentialId ?? undefined,
|
153
151
|
challenge,
|
154
152
|
rp: options.rp,
|
155
153
|
});
|
@@ -12,6 +12,7 @@ import type {
|
|
12
12
|
MultiStepAuthArgsType,
|
13
13
|
SingleStepAuthArgsType,
|
14
14
|
} from "../authentication/types.js";
|
15
|
+
import type { UserStatus } from "./enclave-wallet.js";
|
15
16
|
|
16
17
|
export type Ecosystem = {
|
17
18
|
id: EcosystemWalletId;
|
@@ -33,6 +34,8 @@ export type InAppWalletAutoConnectOptions = {
|
|
33
34
|
chain?: Chain;
|
34
35
|
};
|
35
36
|
|
37
|
+
export type WalletUser = UserStatus;
|
38
|
+
|
36
39
|
export type InAppWalletSocialAuth = SocialAuthOption;
|
37
40
|
export type InAppWalletOAuth = OAuthOption;
|
38
41
|
export type InAppWalletAuth = AuthOption;
|
@@ -199,13 +199,13 @@ export class InAppNativeConnector implements InAppConnector {
|
|
199
199
|
return customJwt({
|
200
200
|
jwt: params.jwt,
|
201
201
|
client: this.client,
|
202
|
-
|
202
|
+
ecosystem: this.ecosystem,
|
203
203
|
});
|
204
204
|
case "auth_endpoint":
|
205
205
|
return authEndpoint({
|
206
206
|
payload: params.payload,
|
207
207
|
client: this.client,
|
208
|
-
|
208
|
+
ecosystem: this.ecosystem,
|
209
209
|
});
|
210
210
|
default:
|
211
211
|
throw new Error(`Unsupported authentication type: ${strategy}`);
|
@@ -4,8 +4,10 @@ import { webLocalStorage } from "../../../../utils/storage/webStorage.js";
|
|
4
4
|
import type { SocialAuthOption } from "../../../../wallets/types.js";
|
5
5
|
import type { Account } from "../../../interfaces/wallet.js";
|
6
6
|
import { getUserStatus } from "../../core/actions/get-enclave-user-status.js";
|
7
|
+
import { authEndpoint } from "../../core/authentication/authEndpoint.js";
|
7
8
|
import { ClientScopedStorage } from "../../core/authentication/client-scoped-storage.js";
|
8
9
|
import { guestAuthenticate } from "../../core/authentication/guest.js";
|
10
|
+
import { customJwt } from "../../core/authentication/jwt.js";
|
9
11
|
import {
|
10
12
|
getLinkedProfilesInternal,
|
11
13
|
linkAccount,
|
@@ -268,8 +270,11 @@ export class InAppWebConnector implements InAppConnector {
|
|
268
270
|
});
|
269
271
|
}
|
270
272
|
|
271
|
-
async loginWithAuthToken(
|
272
|
-
|
273
|
+
async loginWithAuthToken(
|
274
|
+
authResult: AuthStoredTokenWithCookieReturnType,
|
275
|
+
recoveryCode?: string,
|
276
|
+
) {
|
277
|
+
return this.auth.loginWithAuthToken(authResult, recoveryCode);
|
273
278
|
}
|
274
279
|
|
275
280
|
/**
|
@@ -292,20 +297,22 @@ export class InAppWebConnector implements InAppConnector {
|
|
292
297
|
client: this.client,
|
293
298
|
ecosystem: this.ecosystem,
|
294
299
|
});
|
300
|
+
case "auth_endpoint": {
|
301
|
+
return authEndpoint({
|
302
|
+
payload: args.payload,
|
303
|
+
client: this.client,
|
304
|
+
ecosystem: this.ecosystem,
|
305
|
+
});
|
306
|
+
}
|
295
307
|
case "jwt":
|
296
|
-
return
|
308
|
+
return customJwt({
|
297
309
|
jwt: args.jwt,
|
298
|
-
|
310
|
+
client: this.client,
|
311
|
+
ecosystem: this.ecosystem,
|
299
312
|
});
|
300
313
|
case "passkey": {
|
301
314
|
return this.passkeyAuth(args);
|
302
315
|
}
|
303
|
-
case "auth_endpoint": {
|
304
|
-
return this.auth.authenticateWithCustomAuthEndpoint({
|
305
|
-
payload: args.payload,
|
306
|
-
encryptionKey: args.encryptionKey,
|
307
|
-
});
|
308
|
-
}
|
309
316
|
case "iframe_email_verification": {
|
310
317
|
return this.auth.authenticateWithIframe({
|
311
318
|
email: args.email,
|
@@ -359,17 +366,10 @@ export class InAppWebConnector implements InAppConnector {
|
|
359
366
|
): Promise<AuthLoginReturnType> {
|
360
367
|
const strategy = args.strategy;
|
361
368
|
switch (strategy) {
|
369
|
+
case "auth_endpoint":
|
362
370
|
case "jwt": {
|
363
|
-
|
364
|
-
|
365
|
-
encryptionKey: args.encryptionKey,
|
366
|
-
});
|
367
|
-
}
|
368
|
-
case "auth_endpoint": {
|
369
|
-
return this.auth.loginWithCustomAuthEndpoint({
|
370
|
-
payload: args.payload,
|
371
|
-
encryptionKey: args.encryptionKey,
|
372
|
-
});
|
371
|
+
const authToken = await this.authenticate(args);
|
372
|
+
return await this.loginWithAuthToken(authToken, args.encryptionKey);
|
373
373
|
}
|
374
374
|
case "iframe_email_verification": {
|
375
375
|
return this.auth.loginWithIframe({
|
@@ -1,9 +1,49 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Chain } from "../../../chains/types.js";
|
2
|
+
import type { ThirdwebClient } from "../../../client/client.js";
|
3
|
+
import {
|
4
|
+
type ThirdwebContract,
|
5
|
+
getContract,
|
6
|
+
} from "../../../contract/contract.js";
|
2
7
|
import { prepareContractCall } from "../../../transaction/prepare-contract-call.js";
|
3
8
|
import type { PreparedTransaction } from "../../../transaction/prepare-transaction.js";
|
4
9
|
import { readContract } from "../../../transaction/read-contract.js";
|
5
10
|
import { isHex, stringToHex } from "../../../utils/encoding/hex.js";
|
6
11
|
import type { SendTransactionOption } from "../../interfaces/wallet.js";
|
12
|
+
import { DEFAULT_ACCOUNT_FACTORY_V0_6 } from "./constants.js";
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Predict the address of a smart account.
|
16
|
+
* @param args - The options for predicting the address of a smart account.
|
17
|
+
* @returns The predicted address of the smart account.
|
18
|
+
* @example
|
19
|
+
* ```ts
|
20
|
+
* import { predictSmartAccountAddress } from "thirdweb/wallets/smart";
|
21
|
+
*
|
22
|
+
* const predictedAddress = await predictSmartAccountAddress({
|
23
|
+
* client,
|
24
|
+
* chain,
|
25
|
+
* adminAddress,
|
26
|
+
* });
|
27
|
+
* ```
|
28
|
+
* @walletUtils
|
29
|
+
*/
|
30
|
+
export async function predictSmartAccountAddress(args: {
|
31
|
+
client: ThirdwebClient;
|
32
|
+
chain: Chain;
|
33
|
+
adminAddress: string;
|
34
|
+
factoryAddress?: string;
|
35
|
+
accountSalt?: string;
|
36
|
+
}): Promise<string> {
|
37
|
+
return predictAddress({
|
38
|
+
adminAddress: args.adminAddress,
|
39
|
+
accountSalt: args.accountSalt,
|
40
|
+
factoryContract: getContract({
|
41
|
+
address: args.factoryAddress ?? DEFAULT_ACCOUNT_FACTORY_V0_6,
|
42
|
+
chain: args.chain,
|
43
|
+
client: args.client,
|
44
|
+
}),
|
45
|
+
});
|
46
|
+
}
|
7
47
|
|
8
48
|
/**
|
9
49
|
* Predict the address of a smart account.
|
@@ -20,6 +60,7 @@ import type { SendTransactionOption } from "../../interfaces/wallet.js";
|
|
20
60
|
* });
|
21
61
|
* ```
|
22
62
|
* @walletUtils
|
63
|
+
* @deprecated Use `predictSmartAccountAddress` instead.
|
23
64
|
*/
|
24
65
|
export async function predictAddress(args: {
|
25
66
|
factoryContract: ThirdwebContract;
|
@@ -23,6 +23,7 @@ import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js
|
|
23
23
|
import { sleep } from "../../utils/sleep.js";
|
24
24
|
import type { Account, Wallet } from "../interfaces/wallet.js";
|
25
25
|
import { generateAccount } from "../utils/generateAccount.js";
|
26
|
+
import { predictSmartAccountAddress } from "./lib/calls.js";
|
26
27
|
import { DEFAULT_ACCOUNT_FACTORY_V0_7 } from "./lib/constants.js";
|
27
28
|
import { smartWallet } from "./smart-wallet.js";
|
28
29
|
|
@@ -70,6 +71,13 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
70
71
|
|
71
72
|
it("can connect", async () => {
|
72
73
|
expect(smartWalletAddress).toHaveLength(42);
|
74
|
+
const predictedAddress = await predictSmartAccountAddress({
|
75
|
+
client,
|
76
|
+
chain,
|
77
|
+
adminAddress: personalAccount.address,
|
78
|
+
factoryAddress: DEFAULT_ACCOUNT_FACTORY_V0_7,
|
79
|
+
});
|
80
|
+
expect(predictedAddress).toEqual(smartWalletAddress);
|
73
81
|
});
|
74
82
|
|
75
83
|
it("should revert on unsuccessful transactions", async () => {
|
@@ -23,6 +23,7 @@ import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js
|
|
23
23
|
import { sleep } from "../../utils/sleep.js";
|
24
24
|
import type { Account, Wallet } from "../interfaces/wallet.js";
|
25
25
|
import { generateAccount } from "../utils/generateAccount.js";
|
26
|
+
import { predictSmartAccountAddress } from "./lib/calls.js";
|
26
27
|
import { smartWallet } from "./smart-wallet.js";
|
27
28
|
|
28
29
|
let wallet: Wallet;
|
@@ -69,6 +70,12 @@ describe.runIf(process.env.TW_SECRET_KEY).sequential(
|
|
69
70
|
|
70
71
|
it("can connect", async () => {
|
71
72
|
expect(smartWalletAddress).toHaveLength(42);
|
73
|
+
const predictedAddress = await predictSmartAccountAddress({
|
74
|
+
client,
|
75
|
+
chain,
|
76
|
+
adminAddress: personalAccount.address,
|
77
|
+
});
|
78
|
+
expect(predictedAddress).toEqual(smartWalletAddress);
|
72
79
|
});
|
73
80
|
|
74
81
|
it("should revert on unsuccessful transactions", async () => {
|