thirdweb 5.88.2-nightly-91b0367b23d5a9b4c345210d430839f7c2351301-20250210155323 → 5.88.2-nightly-d34f84d15502c4b357283d15b2f5bcaba1f737e8-20250211121334
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/chains/chain-definitions/treasure.js +19 -0
- package/dist/cjs/chains/chain-definitions/treasure.js.map +1 -0
- package/dist/cjs/chains/chain-definitions/treasureTopaz.js +19 -0
- package/dist/cjs/chains/chain-definitions/treasureTopaz.js.map +1 -0
- package/dist/cjs/exports/chains.js +5 -1
- package/dist/cjs/exports/chains.js.map +1 -1
- package/dist/cjs/exports/extensions/erc4337.js +2 -1
- package/dist/cjs/exports/extensions/erc4337.js.map +1 -1
- package/dist/cjs/extensions/erc4337/account/addSessionKey.js +53 -0
- package/dist/cjs/extensions/erc4337/account/addSessionKey.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -19
- package/dist/cjs/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuote.js +1 -19
- package/dist/cjs/react/core/hooks/pay/useBuyWithFiatQuote.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +3 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/cjs/storage/upload/helpers.js +1 -1
- package/dist/cjs/storage/upload/helpers.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +2 -2
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/smart/index.js +5 -12
- package/dist/cjs/wallets/smart/index.js.map +1 -1
- package/dist/esm/chains/chain-definitions/treasure.js +16 -0
- package/dist/esm/chains/chain-definitions/treasure.js.map +1 -0
- package/dist/esm/chains/chain-definitions/treasureTopaz.js +16 -0
- package/dist/esm/chains/chain-definitions/treasureTopaz.js.map +1 -0
- package/dist/esm/exports/chains.js +2 -0
- package/dist/esm/exports/chains.js.map +1 -1
- package/dist/esm/exports/extensions/erc4337.js +1 -1
- package/dist/esm/exports/extensions/erc4337.js.map +1 -1
- package/dist/esm/extensions/erc4337/account/addSessionKey.js +52 -0
- package/dist/esm/extensions/erc4337/account/addSessionKey.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js +1 -19
- package/dist/esm/react/core/hooks/pay/useBuyWithCryptoQuote.js.map +1 -1
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuote.js +1 -19
- package/dist/esm/react/core/hooks/pay/useBuyWithFiatQuote.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js +3 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.js.map +1 -1
- package/dist/esm/storage/upload/helpers.js +1 -1
- package/dist/esm/storage/upload/helpers.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +2 -2
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/smart/index.js +6 -13
- package/dist/esm/wallets/smart/index.js.map +1 -1
- package/dist/types/chains/chain-definitions/treasure.d.ts +7 -0
- package/dist/types/chains/chain-definitions/treasure.d.ts.map +1 -0
- package/dist/types/chains/chain-definitions/treasureTopaz.d.ts +7 -0
- package/dist/types/chains/chain-definitions/treasureTopaz.d.ts.map +1 -0
- package/dist/types/exports/chains.d.ts +2 -0
- package/dist/types/exports/chains.d.ts.map +1 -1
- package/dist/types/exports/extensions/erc4337.d.ts +1 -1
- package/dist/types/exports/extensions/erc4337.d.ts.map +1 -1
- package/dist/types/extensions/erc4337/account/addSessionKey.d.ts +12 -0
- package/dist/types/extensions/erc4337/account/addSessionKey.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithCryptoQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/pay/useBuyWithFiatQuote.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/smart/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chains/chain-definitions/treasure.ts +16 -0
- package/src/chains/chain-definitions/treasureTopaz.ts +16 -0
- package/src/exports/chains.ts +2 -0
- package/src/exports/extensions/erc4337.ts +1 -0
- package/src/extensions/erc4337/account/addSessionKey.ts +80 -0
- package/src/extensions/erc4337/account/permissions.test.ts +60 -1
- package/src/react/core/hooks/pay/useBuyWithCryptoQuote.ts +1 -30
- package/src/react/core/hooks/pay/useBuyWithFiatQuote.ts +1 -30
- package/src/react/web/ui/ConnectWallet/screens/Buy/BuyScreen.tsx +10 -1
- package/src/react/web/ui/ConnectWallet/screens/Buy/fiat/FiatSteps.tsx +1 -1
- package/src/storage/upload/helpers.ts +1 -1
- package/src/utils/any-evm/zksync/isZkSyncChain.ts +2 -2
- package/src/version.ts +1 -1
- package/src/wallets/smart/index.ts +11 -13
@@ -6,8 +6,10 @@ import type { ThirdwebClient } from "../../client/client.js";
|
|
6
6
|
import { type ThirdwebContract, getContract } from "../../contract/contract.js";
|
7
7
|
import { allowance } from "../../extensions/erc20/__generated__/IERC20/read/allowance.js";
|
8
8
|
import { approve } from "../../extensions/erc20/write/approve.js";
|
9
|
-
import {
|
10
|
-
|
9
|
+
import {
|
10
|
+
addSessionKey,
|
11
|
+
shouldUpdateSessionKey,
|
12
|
+
} from "../../extensions/erc4337/account/addSessionKey.js";
|
11
13
|
import { sendTransaction } from "../../transaction/actions/send-transaction.js";
|
12
14
|
import { toSerializableTransaction } from "../../transaction/actions/to-serializable-transaction.js";
|
13
15
|
import type { WaitForReceiptOptions } from "../../transaction/actions/wait-for-tx-receipt.js";
|
@@ -19,7 +21,6 @@ import type { PreparedTransaction } from "../../transaction/prepare-transaction.
|
|
19
21
|
import { readContract } from "../../transaction/read-contract.js";
|
20
22
|
import { getAddress } from "../../utils/address.js";
|
21
23
|
import { isZkSyncChain } from "../../utils/any-evm/zksync/isZkSyncChain.js";
|
22
|
-
import { isContractDeployed } from "../../utils/bytecode/is-contract-deployed.js";
|
23
24
|
import type { Hex } from "../../utils/encoding/hex.js";
|
24
25
|
import { resolvePromisedValue } from "../../utils/promise/resolve-promised-value.js";
|
25
26
|
import { parseTypedData } from "../../utils/signatures/helpers/parse-typed-data.js";
|
@@ -169,16 +170,13 @@ export async function connectSmartAccount(
|
|
169
170
|
smartAccountToAdminAccountMap.set(account, personalAccount);
|
170
171
|
|
171
172
|
if (options.sessionKey) {
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
});
|
180
|
-
}
|
181
|
-
if (!hasSessionKey) {
|
173
|
+
if (
|
174
|
+
await shouldUpdateSessionKey({
|
175
|
+
accountContract,
|
176
|
+
sessionKeyAddress: options.sessionKey.address,
|
177
|
+
newPermissions: options.sessionKey.permissions,
|
178
|
+
})
|
179
|
+
) {
|
182
180
|
const transaction = addSessionKey({
|
183
181
|
account: personalAccount,
|
184
182
|
contract: accountContract,
|