thirdweb 5.64.4-nightly-043ee925981bdc39649d30ad65d2fce922515ab0-20241030000335 → 5.64.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/exports/wallets/smart.js +2 -1
- package/dist/cjs/exports/wallets/smart.js.map +1 -1
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.js +31 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.js.map +1 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.js +33 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.js.map +1 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js +149 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js.map +1 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.js +193 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.js.map +1 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.js +173 -0
- package/dist/cjs/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.js.map +1 -0
- package/dist/cjs/extensions/erc1155/drops/write/claimTo.js +5 -2
- package/dist/cjs/extensions/erc1155/drops/write/claimTo.js.map +1 -1
- package/dist/cjs/extensions/erc1155/drops/write/setClaimConditions.js +4 -1
- package/dist/cjs/extensions/erc1155/drops/write/setClaimConditions.js.map +1 -1
- package/dist/cjs/extensions/erc20/drops/write/claimTo.js +1 -0
- package/dist/cjs/extensions/erc20/drops/write/claimTo.js.map +1 -1
- package/dist/cjs/extensions/erc20/drops/write/setClaimConditions.js +1 -0
- package/dist/cjs/extensions/erc20/drops/write/setClaimConditions.js.map +1 -1
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.js +27 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.js +33 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js +105 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/write/claim.js +184 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/write/claim.js.map +1 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.js +164 -0
- package/dist/cjs/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.js.map +1 -0
- package/dist/cjs/extensions/erc721/drops/write/claimTo.js +6 -3
- package/dist/cjs/extensions/erc721/drops/write/claimTo.js.map +1 -1
- package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.js +4 -1
- package/dist/cjs/extensions/erc721/drops/write/setClaimConditions.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/extensions/drops/get-claim-params.js +20 -0
- package/dist/cjs/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.js +39 -12
- package/dist/cjs/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.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/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/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.js +28 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.js.map +1 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.js +30 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.js.map +1 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js +141 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js.map +1 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.js +186 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.js.map +1 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.js +166 -0
- package/dist/esm/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.js.map +1 -0
- package/dist/esm/extensions/erc1155/drops/write/claimTo.js +5 -2
- package/dist/esm/extensions/erc1155/drops/write/claimTo.js.map +1 -1
- package/dist/esm/extensions/erc1155/drops/write/setClaimConditions.js +4 -1
- package/dist/esm/extensions/erc1155/drops/write/setClaimConditions.js.map +1 -1
- package/dist/esm/extensions/erc20/drops/write/claimTo.js +1 -0
- package/dist/esm/extensions/erc20/drops/write/claimTo.js.map +1 -1
- package/dist/esm/extensions/erc20/drops/write/setClaimConditions.js +1 -0
- package/dist/esm/extensions/erc20/drops/write/setClaimConditions.js.map +1 -1
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.js +24 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.js +30 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js +99 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/write/claim.js +177 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/write/claim.js.map +1 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.js +157 -0
- package/dist/esm/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.js.map +1 -0
- package/dist/esm/extensions/erc721/drops/write/claimTo.js +6 -3
- package/dist/esm/extensions/erc721/drops/write/claimTo.js.map +1 -1
- package/dist/esm/extensions/erc721/drops/write/setClaimConditions.js +4 -1
- package/dist/esm/extensions/erc721/drops/write/setClaimConditions.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/extensions/drops/get-claim-params.js +20 -0
- package/dist/esm/utils/extensions/drops/get-claim-params.js.map +1 -1
- package/dist/esm/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.js +39 -12
- package/dist/esm/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.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/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/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.d.ts +72 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.d.ts.map +1 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.d.ts +64 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.d.ts.map +1 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.d.ts +101 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.d.ts.map +1 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.d.ts +139 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.d.ts.map +1 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.d.ts +127 -0
- package/dist/types/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.d.ts.map +1 -0
- package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts +1 -0
- package/dist/types/extensions/erc1155/drops/write/claimTo.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/drops/write/setClaimConditions.d.ts +1 -0
- package/dist/types/extensions/erc1155/drops/write/setClaimConditions.d.ts.map +1 -1
- package/dist/types/extensions/erc20/drops/write/claimTo.d.ts +1 -0
- package/dist/types/extensions/erc20/drops/write/claimTo.d.ts.map +1 -1
- package/dist/types/extensions/erc20/drops/write/setClaimConditions.d.ts +1 -0
- package/dist/types/extensions/erc20/drops/write/setClaimConditions.d.ts.map +1 -1
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.d.ts +54 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.d.ts +64 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.d.ts +62 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/write/claim.d.ts +132 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/write/claim.d.ts.map +1 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.d.ts +120 -0
- package/dist/types/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.d.ts.map +1 -0
- package/dist/types/extensions/erc721/drops/write/claimTo.d.ts +1 -0
- package/dist/types/extensions/erc721/drops/write/claimTo.d.ts.map +1 -1
- package/dist/types/extensions/erc721/drops/write/setClaimConditions.d.ts +1 -0
- package/dist/types/extensions/erc721/drops/write/setClaimConditions.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/extensions/drops/get-claim-params.d.ts +1 -0
- package/dist/types/utils/extensions/drops/get-claim-params.d.ts.map +1 -1
- package/dist/types/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.d.ts +1 -0
- package/dist/types/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.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/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/extensions/erc1155/__generated__/IDropSinglePhase1155/events/ClaimConditionUpdated.ts +43 -0
- package/src/extensions/erc1155/__generated__/IDropSinglePhase1155/events/TokensClaimed.ts +53 -0
- package/src/extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.ts +160 -0
- package/src/extensions/erc1155/__generated__/IDropSinglePhase1155/write/claim.ts +229 -0
- package/src/extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.ts +213 -0
- package/src/extensions/erc1155/customDrop1155.test.ts +181 -0
- package/src/extensions/erc1155/drops/write/claimTo.ts +6 -2
- package/src/extensions/erc1155/drops/write/setClaimConditions.ts +5 -1
- package/src/extensions/erc20/customDrop20.test.ts +80 -0
- package/src/extensions/erc20/drops/write/claimTo.ts +2 -0
- package/src/extensions/erc20/drops/write/setClaimConditions.ts +2 -0
- package/src/extensions/erc721/__generated__/IDropSinglePhase/events/ClaimConditionUpdated.ts +25 -0
- package/src/extensions/erc721/__generated__/IDropSinglePhase/events/TokensClaimed.ts +53 -0
- package/src/extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.ts +105 -0
- package/src/extensions/erc721/__generated__/IDropSinglePhase/write/claim.ts +219 -0
- package/src/extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.ts +203 -0
- package/src/extensions/erc721/customDrop721.test.ts +115 -0
- package/src/extensions/erc721/drops/write/claimTo.ts +7 -3
- package/src/extensions/erc721/drops/write/setClaimConditions.ts +5 -1
- 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/extensions/drops/get-claim-params.ts +29 -2
- package/src/utils/extensions/drops/get-multicall-set-claim-claim-conditon-transactions.ts +46 -16
- 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/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
@@ -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
|
@@ -6,13 +6,14 @@ import {
|
|
6
6
|
import type { ThirdwebContract } from "../../../contract/contract.js";
|
7
7
|
import { getContractMetadata } from "../../../extensions/common/read/getContractMetadata.js";
|
8
8
|
import type { Hex } from "../../encoding/hex.js";
|
9
|
-
import type { OverrideProof } from "./types.js";
|
9
|
+
import type { ClaimCondition, OverrideProof } from "./types.js";
|
10
10
|
|
11
11
|
export type GetClaimParamsOptions = {
|
12
12
|
contract: ThirdwebContract;
|
13
13
|
to: string;
|
14
14
|
quantity: bigint;
|
15
15
|
from?: string;
|
16
|
+
singlePhaseDrop?: boolean;
|
16
17
|
} & (
|
17
18
|
| {
|
18
19
|
type: "erc721";
|
@@ -47,9 +48,18 @@ export type GetClaimParamsOptions = {
|
|
47
48
|
* @extension COMMON
|
48
49
|
*/
|
49
50
|
export async function getClaimParams(options: GetClaimParamsOptions) {
|
50
|
-
const cc = await (async () => {
|
51
|
+
const cc: ClaimCondition = await (async () => {
|
51
52
|
if (options.type === "erc1155") {
|
52
53
|
// lazy-load the getActiveClaimCondition function
|
54
|
+
if (options.singlePhaseDrop) {
|
55
|
+
const { claimCondition } = await import(
|
56
|
+
"../../../extensions/erc1155/__generated__/IDropSinglePhase1155/read/claimCondition.js"
|
57
|
+
);
|
58
|
+
return await claimCondition({
|
59
|
+
contract: options.contract,
|
60
|
+
tokenId: options.tokenId,
|
61
|
+
});
|
62
|
+
}
|
53
63
|
const { getActiveClaimCondition } = await import(
|
54
64
|
"../../../extensions/erc1155/drops/read/getActiveClaimCondition.js"
|
55
65
|
);
|
@@ -60,6 +70,14 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
60
70
|
}
|
61
71
|
if (options.type === "erc721") {
|
62
72
|
// lazy-load the getActiveClaimCondition function
|
73
|
+
if (options.singlePhaseDrop) {
|
74
|
+
const { claimCondition } = await import(
|
75
|
+
"../../../extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js"
|
76
|
+
);
|
77
|
+
return await claimCondition({
|
78
|
+
contract: options.contract,
|
79
|
+
});
|
80
|
+
}
|
63
81
|
const { getActiveClaimCondition } = await import(
|
64
82
|
"../../../extensions/erc721/drops/read/getActiveClaimCondition.js"
|
65
83
|
);
|
@@ -71,6 +89,15 @@ export async function getClaimParams(options: GetClaimParamsOptions) {
|
|
71
89
|
// otherwise erc20 case!
|
72
90
|
|
73
91
|
// lazy-load the getActiveClaimCondition function
|
92
|
+
if (options.singlePhaseDrop) {
|
93
|
+
// same ABI as erc721
|
94
|
+
const { claimCondition } = await import(
|
95
|
+
"../../../extensions/erc721/__generated__/IDropSinglePhase/read/claimCondition.js"
|
96
|
+
);
|
97
|
+
return await claimCondition({
|
98
|
+
contract: options.contract,
|
99
|
+
});
|
100
|
+
}
|
74
101
|
const { getActiveClaimCondition } = await import(
|
75
102
|
"../../../extensions/erc20/drops/read/getActiveClaimCondition.js"
|
76
103
|
);
|
@@ -15,6 +15,7 @@ export async function getMulticallSetClaimConditionTransactions(options: {
|
|
15
15
|
tokenDecimals: number;
|
16
16
|
tokenId?: bigint;
|
17
17
|
resetClaimEligibility?: boolean;
|
18
|
+
singlePhase?: boolean;
|
18
19
|
}): Promise<Hex[]> {
|
19
20
|
const merkleInfos: Record<string, string> = {};
|
20
21
|
const phases = await Promise.all(
|
@@ -94,23 +95,52 @@ export async function getMulticallSetClaimConditionTransactions(options: {
|
|
94
95
|
let encodedSetClaimConditions: Hex;
|
95
96
|
if (options.tokenId !== undefined) {
|
96
97
|
// 1155
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
98
|
+
if (options.singlePhase) {
|
99
|
+
const { encodeSetClaimConditions } = await import(
|
100
|
+
"../../../extensions/erc1155/__generated__/IDropSinglePhase1155/write/setClaimConditions.js"
|
101
|
+
);
|
102
|
+
const phase = sortedPhases[0];
|
103
|
+
if (!phase) {
|
104
|
+
throw new Error("No phase provided");
|
105
|
+
}
|
106
|
+
encodedSetClaimConditions = encodeSetClaimConditions({
|
107
|
+
tokenId: options.tokenId,
|
108
|
+
phase,
|
109
|
+
resetClaimEligibility: options.resetClaimEligibility || false,
|
110
|
+
});
|
111
|
+
} else {
|
112
|
+
const { encodeSetClaimConditions } = await import(
|
113
|
+
"../../../extensions/erc1155/__generated__/IDrop1155/write/setClaimConditions.js"
|
114
|
+
);
|
115
|
+
encodedSetClaimConditions = encodeSetClaimConditions({
|
116
|
+
tokenId: options.tokenId,
|
117
|
+
phases: sortedPhases,
|
118
|
+
resetClaimEligibility: options.resetClaimEligibility || false,
|
119
|
+
});
|
120
|
+
}
|
105
121
|
} else {
|
106
|
-
//
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
122
|
+
// erc721 or erc20
|
123
|
+
if (options.singlePhase) {
|
124
|
+
const { encodeSetClaimConditions } = await import(
|
125
|
+
"../../../extensions/erc721/__generated__/IDropSinglePhase/write/setClaimConditions.js"
|
126
|
+
);
|
127
|
+
const phase = sortedPhases[0];
|
128
|
+
if (!phase) {
|
129
|
+
throw new Error("No phase provided");
|
130
|
+
}
|
131
|
+
encodedSetClaimConditions = encodeSetClaimConditions({
|
132
|
+
phase,
|
133
|
+
resetClaimEligibility: options.resetClaimEligibility || false,
|
134
|
+
});
|
135
|
+
} else {
|
136
|
+
const { encodeSetClaimConditions } = await import(
|
137
|
+
"../../../extensions/erc721/__generated__/IDrop/write/setClaimConditions.js"
|
138
|
+
);
|
139
|
+
encodedSetClaimConditions = encodeSetClaimConditions({
|
140
|
+
phases: sortedPhases,
|
141
|
+
resetClaimEligibility: options.resetClaimEligibility || false,
|
142
|
+
});
|
143
|
+
}
|
114
144
|
}
|
115
145
|
encodedTransactions.push(encodedSetClaimConditions);
|
116
146
|
return encodedTransactions;
|
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.4
|
1
|
+
export const version = "5.64.4";
|
@@ -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(
|
@@ -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 () => {
|