thirdweb 5.48.1-nightly-7ef1c721ef693584d153554d46f2e70e8015b261-20240822000343 → 5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351
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/pay.js +3 -1
- package/dist/cjs/exports/pay.js.map +1 -1
- package/dist/cjs/exports/thirdweb.js +3 -1
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js +3 -0
- package/dist/cjs/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +95 -0
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/cjs/pay/utils/definitions.js +7 -1
- package/dist/cjs/pay/utils/definitions.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/cjs/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/cjs/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +9 -0
- package/dist/cjs/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +9 -3
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +34 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.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/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +118 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +7 -76
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/stories/ConnectButton.stories.js +28 -0
- package/dist/cjs/stories/ConnectButton.stories.js.map +1 -0
- package/dist/cjs/stories/PayEmbed.stories.js +38 -0
- package/dist/cjs/stories/PayEmbed.stories.js.map +1 -0
- package/dist/cjs/stories/utils.js +27 -0
- package/dist/cjs/stories/utils.js.map +1 -0
- package/dist/cjs/transaction/actions/send-transaction.js.map +1 -1
- package/dist/cjs/utils/fetch.js +2 -1
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/utils/signatures/sign-message.js +13 -19
- package/dist/cjs/utils/signatures/sign-message.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/cjs/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/cjs/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/constants.js +6 -0
- package/dist/cjs/wallets/smart/lib/constants.js.map +1 -1
- package/dist/esm/exports/pay.js +2 -0
- package/dist/esm/exports/pay.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +2 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/commonTypes.js +2 -0
- package/dist/esm/pay/buyWithCrypto/commonTypes.js.map +1 -0
- package/dist/esm/pay/buyWithCrypto/getQuote.js +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +92 -0
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -0
- package/dist/esm/pay/utils/definitions.js +5 -0
- package/dist/esm/pay/utils/definitions.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js +5 -1
- package/dist/esm/react/native/ui/connect/ConnectedButton.js.map +1 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js +2 -1
- package/dist/esm/react/native/ui/connect/ConnectedModal.js.map +1 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js +5 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +28 -22
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js +5 -0
- package/dist/esm/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +5 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js +8 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js +35 -3
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.js +8 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.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/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +115 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -0
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js +8 -77
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js +2 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/formatTokenBalance.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +3 -2
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +5 -2
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/stories/ConnectButton.stories.js +25 -0
- package/dist/esm/stories/ConnectButton.stories.js.map +1 -0
- package/dist/esm/stories/PayEmbed.stories.js +35 -0
- package/dist/esm/stories/PayEmbed.stories.js.map +1 -0
- package/dist/esm/stories/utils.js +24 -0
- package/dist/esm/stories/utils.js.map +1 -0
- package/dist/esm/transaction/actions/send-transaction.js.map +1 -1
- package/dist/esm/utils/fetch.js +2 -1
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/utils/signatures/sign-message.js +13 -19
- package/dist/esm/utils/signatures/sign-message.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +8 -7
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/index.js +2 -2
- package/dist/esm/wallets/in-app/core/wallet/index.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +3 -2
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js +4 -4
- package/dist/esm/wallets/in-app/web/lib/auth/oauth.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +5 -3
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/smart/lib/constants.js +6 -0
- package/dist/esm/wallets/smart/lib/constants.js.map +1 -1
- package/dist/types/exports/pay.d.ts +3 -1
- package/dist/types/exports/pay.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +3 -1
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts +36 -0
- package/dist/types/pay/buyWithCrypto/commonTypes.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts +1 -24
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts +85 -0
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -0
- package/dist/types/pay/buyWithFiat/getQuote.d.ts +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/pay/utils/definitions.d.ts +5 -0
- package/dist/types/pay/utils/definitions.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +15 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts +3 -0
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedButton.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/ConnectedModal.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/TokenListScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +6 -0
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts +3 -0
- package/dist/types/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts +2 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.d.ts +3 -2
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.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/Buy/swap/SwapStatusScreen.d.ts +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts +20 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts +5 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/formatTokenBalance.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/SocialLogin.d.ts.map +1 -1
- package/dist/types/stories/ConnectButton.stories.d.ts +18 -0
- package/dist/types/stories/ConnectButton.stories.d.ts.map +1 -0
- package/dist/types/stories/PayEmbed.stories.d.ts +19 -0
- package/dist/types/stories/PayEmbed.stories.d.ts.map +1 -0
- package/dist/types/stories/utils.d.ts +5 -0
- package/dist/types/stories/utils.d.ts.map +1 -0
- package/dist/types/transaction/actions/send-transaction.d.ts +12 -2
- package/dist/types/transaction/actions/send-transaction.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/utils/signatures/sign-message.d.ts +26 -3
- package/dist/types/utils/signatures/sign-message.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/ecosystem/types.d.ts +1 -2
- package/dist/types/wallets/ecosystem/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -8
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts +1 -1
- package/dist/types/wallets/in-app/core/interfaces/connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +1 -5
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.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/constants.d.ts.map +1 -1
- package/package.json +15 -2
- package/src/exports/pay.ts +11 -2
- package/src/exports/thirdweb.ts +11 -2
- package/src/pay/buyWithCrypto/commonTypes.ts +40 -0
- package/src/pay/buyWithCrypto/getQuote.ts +8 -42
- package/src/pay/buyWithCrypto/getStatus.ts +1 -1
- package/src/pay/buyWithCrypto/getTransfer.ts +185 -0
- package/src/pay/buyWithFiat/getQuote.ts +1 -1
- package/src/pay/utils/definitions.ts +7 -0
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +16 -0
- package/src/react/core/hooks/transaction/useSendTransaction.ts +3 -0
- package/src/react/native/ui/connect/ConnectedButton.tsx +6 -1
- package/src/react/native/ui/connect/ConnectedModal.tsx +2 -1
- package/src/react/native/ui/connect/TokenListScreen.tsx +6 -1
- package/src/react/web/ui/ConnectWallet/Details.tsx +93 -77
- package/src/react/web/ui/ConnectWallet/icons/currencies/JPYIcon.tsx +21 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +8 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/currencies.tsx +9 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/main/useUISelectionStates.ts +47 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/pay-transactions/SwapDetailsScreen.tsx +26 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/SwapStatusScreen.tsx +3 -3
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +284 -0
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferFlow.tsx +29 -220
- package/src/react/web/ui/ConnectWallet/screens/formatTokenBalance.ts +3 -1
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +3 -2
- package/src/react/web/wallets/shared/SocialLogin.tsx +7 -2
- package/src/stories/ConnectButton.stories.ts +31 -0
- package/src/stories/PayEmbed.stories.ts +42 -0
- package/src/stories/utils.tsx +29 -0
- package/src/transaction/actions/send-transaction.ts +12 -3
- package/src/utils/fetch.ts +4 -1
- package/src/utils/signatures/sign-message.test.ts +78 -50
- package/src/utils/signatures/sign-message.ts +44 -9
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/types.ts +1 -2
- package/src/wallets/in-app/core/authentication/getLoginPath.ts +11 -9
- package/src/wallets/in-app/core/authentication/types.ts +1 -8
- package/src/wallets/in-app/core/interfaces/connector.ts +5 -1
- package/src/wallets/in-app/core/wallet/index.ts +6 -2
- package/src/wallets/in-app/core/wallet/types.ts +1 -5
- package/src/wallets/in-app/native/auth/native-auth.ts +1 -1
- package/src/wallets/in-app/web/lib/auth/index.ts +7 -2
- package/src/wallets/in-app/web/lib/auth/oauth.ts +5 -5
- package/src/wallets/in-app/web/lib/web-connector.ts +9 -3
- package/src/wallets/smart/lib/constants.ts +6 -0
- package/src/wallets/smart/smart-wallet-dev.test.ts +86 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
import { generatePrivateKey } from "viem/accounts";
|
2
|
+
import { createWalletAdapter } from "../adapters/wallet-adapter.js";
|
3
|
+
import { ethereum } from "../chains/chain-definitions/ethereum.js";
|
4
|
+
import { createThirdwebClient } from "../client/client.js";
|
5
|
+
import type { Account } from "../wallets/interfaces/wallet.js";
|
6
|
+
import { privateKeyToAccount } from "../wallets/private-key.js";
|
7
|
+
|
8
|
+
const clientId = process.env.STORYBOOK_CLIENT_ID;
|
9
|
+
|
10
|
+
if (!clientId) {
|
11
|
+
throw new Error("STORYBOOK_CLIENT_ID env is not configured");
|
12
|
+
}
|
13
|
+
|
14
|
+
export const storyClient = createThirdwebClient({
|
15
|
+
clientId: clientId,
|
16
|
+
});
|
17
|
+
|
18
|
+
export const storyAccount: Account = privateKeyToAccount({
|
19
|
+
client: storyClient,
|
20
|
+
privateKey: process.env.STORYBOOK_ACCOUNT_PRIVATE_KEY || generatePrivateKey(),
|
21
|
+
});
|
22
|
+
|
23
|
+
export const storyWallet = createWalletAdapter({
|
24
|
+
adaptedAccount: storyAccount,
|
25
|
+
client: storyClient,
|
26
|
+
chain: ethereum,
|
27
|
+
onDisconnect: () => {},
|
28
|
+
switchChain: () => {},
|
29
|
+
});
|
@@ -5,13 +5,22 @@ import type { GaslessOptions } from "./gasless/types.js";
|
|
5
5
|
import { toSerializableTransaction } from "./to-serializable-transaction.js";
|
6
6
|
import type { WaitForReceiptOptions } from "./wait-for-tx-receipt.js";
|
7
7
|
|
8
|
-
|
8
|
+
/** Send transaction options */
|
9
|
+
export interface SendTransactionOptions {
|
10
|
+
/**
|
11
|
+
* The account to send the transaction with
|
12
|
+
*/
|
9
13
|
account: Account;
|
10
|
-
|
14
|
+
/**
|
15
|
+
* The prepared transaction to send
|
16
|
+
*/
|
11
17
|
// biome-ignore lint/suspicious/noExplicitAny: library function that accepts any prepared transaction type
|
12
18
|
transaction: PreparedTransaction<any>;
|
19
|
+
/**
|
20
|
+
* Gasless options for the transaction, if applicable
|
21
|
+
*/
|
13
22
|
gasless?: GaslessOptions;
|
14
|
-
}
|
23
|
+
}
|
15
24
|
|
16
25
|
/**
|
17
26
|
* Sends a transaction using the provided account.
|
package/src/utils/fetch.ts
CHANGED
@@ -111,7 +111,10 @@ export function isThirdwebUrl(url: string): boolean {
|
|
111
111
|
|
112
112
|
try {
|
113
113
|
// special case for localhost in development only
|
114
|
-
if (
|
114
|
+
if (
|
115
|
+
process.env.NODE_ENV === "development" ||
|
116
|
+
process.env.NODE_ENV === "test"
|
117
|
+
) {
|
115
118
|
if (hostname === "localhost") {
|
116
119
|
IS_THIRDWEB_URL_CACHE.set(url, true);
|
117
120
|
return true;
|
@@ -1,57 +1,85 @@
|
|
1
|
-
import { expect, test } from "vitest";
|
1
|
+
import { describe, expect, test } from "vitest";
|
2
2
|
|
3
|
-
import { ANVIL_PKEY_A } from "~test/test-wallets.js";
|
3
|
+
import { ANVIL_PKEY_A, TEST_ACCOUNT_A } from "~test/test-wallets.js";
|
4
4
|
import { signMessage } from "./sign-message.js";
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
describe("signMessage", async () => {
|
7
|
+
test("privateKey", async () => {
|
8
|
+
expect(
|
9
|
+
signMessage({
|
10
|
+
message: "hello world",
|
11
|
+
privateKey: ANVIL_PKEY_A,
|
12
|
+
}),
|
13
|
+
).toMatchInlineSnapshot(
|
14
|
+
'"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
15
|
+
);
|
16
|
+
|
17
|
+
expect(
|
18
|
+
signMessage({
|
19
|
+
message: "🤯",
|
20
|
+
privateKey: ANVIL_PKEY_A,
|
21
|
+
}),
|
22
|
+
).toMatchInlineSnapshot(
|
23
|
+
'"0xc0cd7599731c37aa4c0815a89dc8dcb4ce479f83df7ee8ffc606a9ef29323e814b54bb8935b56e7c690f1ee4c6290da5c2f6df6fc3443fbe96bb1846a2c4fefc1c"',
|
24
|
+
);
|
25
|
+
|
26
|
+
expect(
|
27
|
+
signMessage({
|
28
|
+
message: "0x787037Ba5b7eA8a8737627FfB67d35FdCaAd9A18",
|
29
|
+
privateKey: ANVIL_PKEY_A,
|
30
|
+
}),
|
31
|
+
).toMatchInlineSnapshot(
|
32
|
+
'"0x151436da0ef734f06ae71f4b907a062fa5683b40af4221e86dfe5f2fc9f09ffa40c90fee4a0e48311506b84dc6f20e513dc4dc434f0f70a03af6ff3e22c7b7591c"',
|
33
|
+
);
|
34
|
+
});
|
35
|
+
|
36
|
+
test("raw", async () => {
|
37
|
+
expect(
|
38
|
+
signMessage({
|
39
|
+
message: { raw: "0x68656c6c6f20776f726c64" },
|
40
|
+
privateKey: ANVIL_PKEY_A,
|
41
|
+
}),
|
42
|
+
).toMatchInlineSnapshot(
|
43
|
+
'"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
44
|
+
);
|
45
|
+
|
46
|
+
expect(
|
47
|
+
signMessage({
|
48
|
+
message: {
|
49
|
+
raw: Uint8Array.from([
|
50
|
+
104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100,
|
51
|
+
]),
|
52
|
+
},
|
53
|
+
privateKey: ANVIL_PKEY_A,
|
54
|
+
}),
|
55
|
+
).toMatchInlineSnapshot(
|
56
|
+
'"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
57
|
+
);
|
58
|
+
});
|
59
|
+
|
60
|
+
test("account", async () => {
|
61
|
+
const basicSignature = await signMessage({
|
9
62
|
message: "hello world",
|
10
|
-
|
11
|
-
})
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
signMessage({
|
63
|
+
account: TEST_ACCOUNT_A,
|
64
|
+
});
|
65
|
+
expect(basicSignature).toMatchInlineSnapshot(
|
66
|
+
'"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
67
|
+
);
|
68
|
+
|
69
|
+
const emojiSignature = await signMessage({
|
18
70
|
message: "🤯",
|
19
|
-
|
20
|
-
})
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
expect(
|
26
|
-
signMessage({
|
27
|
-
message: "0x787037Ba5b7eA8a8737627FfB67d35FdCaAd9A18",
|
28
|
-
privateKey: ANVIL_PKEY_A,
|
29
|
-
}),
|
30
|
-
).toMatchInlineSnapshot(
|
31
|
-
'"0x151436da0ef734f06ae71f4b907a062fa5683b40af4221e86dfe5f2fc9f09ffa40c90fee4a0e48311506b84dc6f20e513dc4dc434f0f70a03af6ff3e22c7b7591c"',
|
32
|
-
);
|
33
|
-
});
|
71
|
+
account: TEST_ACCOUNT_A,
|
72
|
+
});
|
73
|
+
expect(emojiSignature).toMatchInlineSnapshot(
|
74
|
+
'"0xc0cd7599731c37aa4c0815a89dc8dcb4ce479f83df7ee8ffc606a9ef29323e814b54bb8935b56e7c690f1ee4c6290da5c2f6df6fc3443fbe96bb1846a2c4fefc1c"',
|
75
|
+
);
|
34
76
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
);
|
44
|
-
|
45
|
-
expect(
|
46
|
-
signMessage({
|
47
|
-
message: {
|
48
|
-
raw: Uint8Array.from([
|
49
|
-
104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100,
|
50
|
-
]),
|
51
|
-
},
|
52
|
-
privateKey: ANVIL_PKEY_A,
|
53
|
-
}),
|
54
|
-
).toMatchInlineSnapshot(
|
55
|
-
'"0xa461f509887bd19e312c0c58467ce8ff8e300d3c1a90b608a760c5b80318eaf15fe57c96f9175d6cd4daad4663763baa7e78836e067d0163e9a2ccf2ff753f5b1b"',
|
56
|
-
);
|
77
|
+
const addressSignature = await signMessage({
|
78
|
+
message: "0x787037Ba5b7eA8a8737627FfB67d35FdCaAd9A18",
|
79
|
+
account: TEST_ACCOUNT_A,
|
80
|
+
});
|
81
|
+
expect(addressSignature).toMatchInlineSnapshot(
|
82
|
+
'"0x151436da0ef734f06ae71f4b907a062fa5683b40af4221e86dfe5f2fc9f09ffa40c90fee4a0e48311506b84dc6f20e513dc4dc434f0f70a03af6ff3e22c7b7591c"',
|
83
|
+
);
|
84
|
+
});
|
57
85
|
});
|
@@ -1,16 +1,18 @@
|
|
1
|
+
import type { Account } from "../../wallets/interfaces/wallet.js";
|
1
2
|
import type { Hex } from "../encoding/hex.js";
|
2
3
|
import { hashMessage } from "../hashing/hashMessage.js";
|
3
4
|
import type { Prettify } from "../type-utils.js";
|
4
5
|
import { sign } from "./sign.js";
|
5
6
|
import { signatureToHex } from "./signature-to-hex.js";
|
6
7
|
|
8
|
+
type Message = Prettify<
|
9
|
+
| string
|
10
|
+
| {
|
11
|
+
raw: Hex | Uint8Array;
|
12
|
+
}
|
13
|
+
>;
|
7
14
|
export type SignMessageOptions = {
|
8
|
-
message:
|
9
|
-
| string
|
10
|
-
| {
|
11
|
-
raw: Hex | Uint8Array;
|
12
|
-
}
|
13
|
-
>;
|
15
|
+
message: Message;
|
14
16
|
privateKey: Hex;
|
15
17
|
};
|
16
18
|
|
@@ -30,7 +32,40 @@ export type SignMessageOptions = {
|
|
30
32
|
* ```
|
31
33
|
* @utils
|
32
34
|
*/
|
33
|
-
export function signMessage({ message, privateKey }: SignMessageOptions): Hex
|
34
|
-
|
35
|
-
|
35
|
+
export function signMessage({ message, privateKey }: SignMessageOptions): Hex;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Signs a string message with a given account.
|
39
|
+
* @param options The options for signing.
|
40
|
+
* @param options.message The message to be signed as a string or object containing raw hex or bytes
|
41
|
+
* @param options.account The account to be used
|
42
|
+
* @returns The signature as a hex string
|
43
|
+
* @example
|
44
|
+
* ```ts
|
45
|
+
* import { signMessage } from "thirdweb/utils";
|
46
|
+
* await signMessage({
|
47
|
+
* message: "Hello, world!",
|
48
|
+
* account
|
49
|
+
* });
|
50
|
+
* ```
|
51
|
+
* @walletUtils
|
52
|
+
*/
|
53
|
+
export function signMessage({
|
54
|
+
message,
|
55
|
+
account,
|
56
|
+
}: { message: Message; account: Account }): Promise<Hex>;
|
57
|
+
|
58
|
+
export function signMessage(
|
59
|
+
options: SignMessageOptions | { message: Message; account: Account },
|
60
|
+
): Hex | Promise<Hex> {
|
61
|
+
if ("privateKey" in options) {
|
62
|
+
const { message, privateKey } = options;
|
63
|
+
const signature = sign({ hash: hashMessage(message), privateKey });
|
64
|
+
return signatureToHex(signature);
|
65
|
+
} else if ("account" in options) {
|
66
|
+
const { message, account } = options;
|
67
|
+
return account.signMessage({ message });
|
68
|
+
} else {
|
69
|
+
throw new Error("Either privateKey or account is required");
|
70
|
+
}
|
36
71
|
}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.48.
|
1
|
+
export const version = "5.48.2-nightly-1405598e7e51e4d415fd57f8169012823db0cedf-20240824000351";
|
@@ -25,9 +25,17 @@ export const getLoginUrl = ({
|
|
25
25
|
authOption: AuthOption | "wallet";
|
26
26
|
client: ThirdwebClient;
|
27
27
|
ecosystem?: Ecosystem;
|
28
|
-
mode?: "popup" | "redirect" | "
|
28
|
+
mode?: "popup" | "redirect" | "window";
|
29
29
|
redirectUrl?: string;
|
30
30
|
}) => {
|
31
|
+
if (mode === "popup" && redirectUrl) {
|
32
|
+
throw new Error("Redirect URL is not supported for popup mode");
|
33
|
+
}
|
34
|
+
|
35
|
+
if (mode === "window" && !redirectUrl) {
|
36
|
+
throw new Error("Redirect URL is required for window mode");
|
37
|
+
}
|
38
|
+
|
31
39
|
const route = getLoginOptionRoute(authOption);
|
32
40
|
let baseUrl = `${getThirdwebBaseUrl("inAppWallet")}/api/2024-05-05/login/${route}?clientId=${client.clientId}`;
|
33
41
|
if (ecosystem?.partnerId) {
|
@@ -36,20 +44,14 @@ export const getLoginUrl = ({
|
|
36
44
|
baseUrl = `${baseUrl}&ecosystemId=${ecosystem.id}`;
|
37
45
|
}
|
38
46
|
|
39
|
-
if
|
47
|
+
// Always append redirectUrl to the baseUrl if mode is not popup
|
48
|
+
if (mode !== "popup") {
|
40
49
|
const formattedRedirectUrl = new URL(redirectUrl || window.location.href);
|
41
50
|
formattedRedirectUrl.searchParams.set("walletId", ecosystem?.id || "inApp");
|
42
51
|
formattedRedirectUrl.searchParams.set("authProvider", authOption);
|
43
52
|
baseUrl = `${baseUrl}&redirectUrl=${encodeURIComponent(formattedRedirectUrl.toString())}`;
|
44
53
|
}
|
45
54
|
|
46
|
-
if (mode === "mobile") {
|
47
|
-
if (!redirectUrl) {
|
48
|
-
throw new Error("Redirect URL is required for mobile authentication");
|
49
|
-
}
|
50
|
-
baseUrl = `${baseUrl}&redirectUrl=${encodeURIComponent(redirectUrl)}`;
|
51
|
-
}
|
52
|
-
|
53
55
|
return baseUrl;
|
54
56
|
};
|
55
57
|
|
@@ -30,6 +30,7 @@ export type SingleStepAuthArgsType =
|
|
30
30
|
openedWindow?: Window;
|
31
31
|
closeOpenedWindow?: (window: Window) => void;
|
32
32
|
redirectUrl?: string;
|
33
|
+
mode?: "redirect" | "popup" | "window";
|
33
34
|
}
|
34
35
|
| { strategy: "jwt"; jwt: string; encryptionKey: string }
|
35
36
|
| { strategy: "auth_endpoint"; payload: string; encryptionKey: string }
|
@@ -46,14 +47,6 @@ export type SingleStepAuthArgsType =
|
|
46
47
|
* Optional name of the passkey to create, defaults to a generated name
|
47
48
|
*/
|
48
49
|
passkeyName?: string;
|
49
|
-
/**
|
50
|
-
* Optional domain, defaults to current window location.
|
51
|
-
* NOTE: this is required on native platforms.
|
52
|
-
*/
|
53
|
-
domain?: {
|
54
|
-
displayName: string;
|
55
|
-
hostname: string;
|
56
|
-
};
|
57
50
|
}
|
58
51
|
| {
|
59
52
|
strategy: "wallet";
|
@@ -15,7 +15,11 @@ export interface InAppConnector {
|
|
15
15
|
getAccount(): Promise<Account>;
|
16
16
|
preAuthenticate(args: PreAuthArgsType): Promise<void>;
|
17
17
|
// Authenticate generates an auth token, when redirecting it returns void as the user is redirected to a new page and the token is stored in the callback url
|
18
|
-
authenticateWithRedirect?(
|
18
|
+
authenticateWithRedirect?(
|
19
|
+
strategy: SocialAuthOption,
|
20
|
+
mode?: "redirect" | "popup" | "window",
|
21
|
+
redirectUrl?: string,
|
22
|
+
): void;
|
19
23
|
// Login takes an auth token and connects a user with it
|
20
24
|
loginWithAuthToken?(
|
21
25
|
authResult: AuthStoredTokenWithCookieReturnType,
|
@@ -40,12 +40,16 @@ export async function connectInAppWallet(
|
|
40
40
|
connector: InAppConnector,
|
41
41
|
): Promise<[Account, Chain]> {
|
42
42
|
if (
|
43
|
-
createOptions?.auth?.mode
|
43
|
+
createOptions?.auth?.mode !== "popup" &&
|
44
44
|
connector.authenticateWithRedirect
|
45
45
|
) {
|
46
46
|
const strategy = options.strategy;
|
47
47
|
if (socialAuthOptions.includes(strategy as SocialAuthOption)) {
|
48
|
-
connector.authenticateWithRedirect(
|
48
|
+
connector.authenticateWithRedirect(
|
49
|
+
strategy as SocialAuthOption,
|
50
|
+
createOptions?.auth?.mode,
|
51
|
+
createOptions?.auth?.redirectUrl,
|
52
|
+
);
|
49
53
|
}
|
50
54
|
}
|
51
55
|
// If we don't have authenticateWithRedirect then it's likely react native, so the default is to redirect and we can carry on
|
@@ -36,15 +36,11 @@ export type InAppWalletCreationOptions =
|
|
36
36
|
/**
|
37
37
|
* Whether to display the social auth prompt in a popup or redirect
|
38
38
|
*/
|
39
|
-
mode?: "popup" | "redirect";
|
39
|
+
mode?: "popup" | "redirect" | "window";
|
40
40
|
/**
|
41
41
|
* Optional url to redirect to after authentication
|
42
42
|
*/
|
43
43
|
redirectUrl?: string;
|
44
|
-
/**
|
45
|
-
* Whether to handle the redirect in a new window
|
46
|
-
*/
|
47
|
-
redirectExternally?: boolean;
|
48
44
|
/**
|
49
45
|
* The domain of the passkey to use for authentication
|
50
46
|
*/
|
@@ -156,7 +156,12 @@ export async function authenticate(
|
|
156
156
|
>,
|
157
157
|
) {
|
158
158
|
const connector = await getInAppWalletConnector(args.client, args.ecosystem);
|
159
|
-
|
160
|
-
|
159
|
+
const isRedirect = args.redirect || args.mode !== "popup";
|
160
|
+
if (isRedirect && connector.authenticateWithRedirect && args.strategy)
|
161
|
+
return connector.authenticateWithRedirect(
|
162
|
+
args.strategy as SocialAuthOption,
|
163
|
+
args.mode,
|
164
|
+
args.redirectUrl,
|
165
|
+
);
|
161
166
|
return connector.connect(args);
|
162
167
|
}
|
@@ -31,16 +31,16 @@ export const loginWithOauthRedirect = (options: {
|
|
31
31
|
client: ThirdwebClient;
|
32
32
|
ecosystem?: Ecosystem;
|
33
33
|
redirectUrl?: string;
|
34
|
-
|
34
|
+
mode?: "redirect" | "popup" | "window";
|
35
35
|
}): void => {
|
36
36
|
const loginUrl = getLoginUrl({
|
37
37
|
...options,
|
38
|
-
mode: "redirect",
|
38
|
+
mode: options.mode || "redirect",
|
39
39
|
});
|
40
|
-
if (options.
|
41
|
-
window.open(loginUrl);
|
42
|
-
} else {
|
40
|
+
if (options.mode === "redirect") {
|
43
41
|
window.location.href = loginUrl;
|
42
|
+
} else {
|
43
|
+
window.open(loginUrl);
|
44
44
|
}
|
45
45
|
};
|
46
46
|
|
@@ -150,11 +150,17 @@ export class InAppWebConnector implements InAppConnector {
|
|
150
150
|
});
|
151
151
|
}
|
152
152
|
|
153
|
-
authenticateWithRedirect(
|
153
|
+
authenticateWithRedirect(
|
154
|
+
strategy: SocialAuthOption,
|
155
|
+
mode?: "redirect" | "popup" | "window",
|
156
|
+
redirectUrl?: string,
|
157
|
+
): void {
|
154
158
|
loginWithOauthRedirect({
|
155
159
|
authOption: strategy,
|
156
160
|
client: this.wallet.client,
|
157
161
|
ecosystem: this.wallet.ecosystem,
|
162
|
+
redirectUrl,
|
163
|
+
mode,
|
158
164
|
});
|
159
165
|
}
|
160
166
|
|
@@ -308,8 +314,8 @@ export class InAppWebConnector implements InAppConnector {
|
|
308
314
|
passkeyClient,
|
309
315
|
storage,
|
310
316
|
rp: {
|
311
|
-
id:
|
312
|
-
name:
|
317
|
+
id: this.passkeyDomain ?? window.location.hostname,
|
318
|
+
name: this.passkeyDomain ?? window.document.title,
|
313
319
|
},
|
314
320
|
});
|
315
321
|
}
|
@@ -19,6 +19,9 @@ export const MANAGED_ACCOUNT_GAS_BUFFER = 50000n;
|
|
19
19
|
*/
|
20
20
|
export const getDefaultBundlerUrl = (chain: Chain) => {
|
21
21
|
const domain = getThirdwebDomains().bundler;
|
22
|
+
if (domain.startsWith("localhost:")) {
|
23
|
+
return `http://${domain}?chain=${chain.id}`;
|
24
|
+
}
|
22
25
|
return `https://${chain.id}.${domain}/`;
|
23
26
|
};
|
24
27
|
|
@@ -27,5 +30,8 @@ export const getDefaultBundlerUrl = (chain: Chain) => {
|
|
27
30
|
*/
|
28
31
|
export const getDefaultPaymasterUrl = (chain: Chain) => {
|
29
32
|
const domain = getThirdwebDomains().bundler;
|
33
|
+
if (domain.startsWith("localhost:")) {
|
34
|
+
return `http://${domain}?chain=${chain.id}`;
|
35
|
+
}
|
30
36
|
return `https://${chain.id}.${domain}/`;
|
31
37
|
};
|
@@ -0,0 +1,86 @@
|
|
1
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
2
|
+
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
3
|
+
import { arbitrumSepolia } from "../../chains/chain-definitions/arbitrum-sepolia.js";
|
4
|
+
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
5
|
+
|
6
|
+
import { balanceOf } from "../../extensions/erc1155/__generated__/IERC1155/read/balanceOf.js";
|
7
|
+
import { claimTo } from "../../extensions/erc1155/drops/write/claimTo.js";
|
8
|
+
import { sendAndConfirmTransaction } from "../../transaction/actions/send-and-confirm-transaction.js";
|
9
|
+
import type { Address } from "../../utils/address.js";
|
10
|
+
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
|
11
|
+
import { setThirdwebDomains } from "../../utils/domains.js";
|
12
|
+
import type { Account, Wallet } from "../interfaces/wallet.js";
|
13
|
+
import { generateAccount } from "../utils/generateAccount.js";
|
14
|
+
import { smartWallet } from "./smart-wallet.js";
|
15
|
+
|
16
|
+
let wallet: Wallet;
|
17
|
+
let smartAccount: Account;
|
18
|
+
let smartWalletAddress: Address;
|
19
|
+
let personalAccount: Account;
|
20
|
+
let accountContract: ThirdwebContract;
|
21
|
+
|
22
|
+
const chain = arbitrumSepolia;
|
23
|
+
const client = TEST_CLIENT;
|
24
|
+
const contract = getContract({
|
25
|
+
client,
|
26
|
+
chain,
|
27
|
+
address: "0x6A7a26c9a595E6893C255C9dF0b593e77518e0c3",
|
28
|
+
});
|
29
|
+
describe.runIf(process.env.TW_SECRET_KEY).skip.sequential(
|
30
|
+
"SmartWallet policy tests",
|
31
|
+
{
|
32
|
+
retry: 0,
|
33
|
+
timeout: 240_000,
|
34
|
+
},
|
35
|
+
() => {
|
36
|
+
beforeAll(async () => {
|
37
|
+
setThirdwebDomains({
|
38
|
+
rpc: "rpc.thirdweb-dev.com",
|
39
|
+
storage: "storage.thirdweb-dev.com",
|
40
|
+
bundler: "bundler.thirdweb-dev.com",
|
41
|
+
});
|
42
|
+
personalAccount = await generateAccount({
|
43
|
+
client,
|
44
|
+
});
|
45
|
+
wallet = smartWallet({
|
46
|
+
chain,
|
47
|
+
gasless: true,
|
48
|
+
});
|
49
|
+
smartAccount = await wallet.connect({
|
50
|
+
client: TEST_CLIENT,
|
51
|
+
personalAccount,
|
52
|
+
});
|
53
|
+
smartWalletAddress = smartAccount.address as Address;
|
54
|
+
accountContract = getContract({
|
55
|
+
address: smartWalletAddress,
|
56
|
+
chain,
|
57
|
+
client,
|
58
|
+
});
|
59
|
+
});
|
60
|
+
|
61
|
+
it("can connect", async () => {
|
62
|
+
expect(smartWalletAddress).toHaveLength(42);
|
63
|
+
});
|
64
|
+
|
65
|
+
it("can execute a tx", async () => {
|
66
|
+
const tx = await sendAndConfirmTransaction({
|
67
|
+
transaction: claimTo({
|
68
|
+
contract,
|
69
|
+
quantity: 1n,
|
70
|
+
to: smartWalletAddress,
|
71
|
+
tokenId: 0n,
|
72
|
+
}),
|
73
|
+
account: smartAccount,
|
74
|
+
});
|
75
|
+
expect(tx.transactionHash).toHaveLength(66);
|
76
|
+
const isDeployed = await isContractDeployed(accountContract);
|
77
|
+
expect(isDeployed).toEqual(true);
|
78
|
+
const balance = await balanceOf({
|
79
|
+
contract,
|
80
|
+
owner: smartWalletAddress,
|
81
|
+
tokenId: 0n,
|
82
|
+
});
|
83
|
+
expect(balance).toEqual(1n);
|
84
|
+
});
|
85
|
+
},
|
86
|
+
);
|