thirdweb 5.56.0 → 5.57.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/contract/verification/index.js +29 -33
- package/dist/cjs/contract/verification/index.js.map +1 -1
- package/dist/cjs/extensions/erc1155/read/getNFTs.js +4 -1
- package/dist/cjs/extensions/erc1155/read/getNFTs.js.map +1 -1
- package/dist/cjs/react/core/utils/walletIcon.js +4 -1
- package/dist/cjs/react/core/utils/walletIcon.js.map +1 -1
- package/dist/cjs/react/native/ui/components/WalletImage.js +2 -0
- package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/InAppWalletUI.js +21 -1
- package/dist/cjs/react/native/ui/connect/InAppWalletUI.js.map +1 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js +2 -1
- package/dist/cjs/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/cjs/react/native/ui/icons/svgs.js +2 -1
- package/dist/cjs/react/native/ui/icons/svgs.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +15 -2
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js +12 -12
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js +5 -5
- package/dist/cjs/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/cjs/react/web/ui/MediaRenderer/MediaRenderer.js +1 -1
- package/dist/cjs/react/web/ui/MediaRenderer/MediaRenderer.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletHeader.js +3 -3
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletHeader.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +4 -0
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +38 -19
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/GuestLogin.js +81 -0
- package/dist/cjs/react/web/wallets/shared/GuestLogin.js.map +1 -0
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js +1 -1
- package/dist/cjs/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js +1 -1
- package/dist/cjs/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/de.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/de.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/en.js +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/en.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/es.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/es.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/fr.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/fr.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/ja.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/ja.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/kr.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/kr.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/tl.js +2 -1
- package/dist/cjs/react/web/wallets/shared/locale/tl.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/vi.js +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/vi.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/oauthSignIn.js +1 -0
- package/dist/cjs/react/web/wallets/shared/oauthSignIn.js.map +1 -1
- package/dist/cjs/utils/any-evm/deploy-metadata.js +1 -0
- package/dist/cjs/utils/any-evm/deploy-metadata.js.map +1 -1
- package/dist/cjs/utils/encoding/hex.js +1 -3
- package/dist/cjs/utils/encoding/hex.js.map +1 -1
- package/dist/cjs/utils/fetch.js +7 -12
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/utils/promise/p-limit.js.map +1 -1
- package/dist/cjs/utils/signatures/sign-message.js +2 -4
- 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/guest.js +33 -0
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -0
- package/dist/cjs/wallets/in-app/core/authentication/types.js +1 -0
- package/dist/cjs/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js +25 -0
- package/dist/cjs/wallets/in-app/native/auth/native-auth.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +1 -3
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/sss.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +32 -0
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/in-app.js +13 -1
- package/dist/cjs/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +8 -0
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/cjs/wallets/manager/index.js +5 -0
- package/dist/cjs/wallets/manager/index.js.map +1 -1
- package/dist/cjs/wallets/types.js +1 -0
- package/dist/cjs/wallets/types.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/request-handlers/switch-chain.js +2 -4
- package/dist/cjs/wallets/wallet-connect/receiver/request-handlers/switch-chain.js.map +1 -1
- package/dist/esm/contract/verification/index.js +29 -33
- package/dist/esm/contract/verification/index.js.map +1 -1
- package/dist/esm/extensions/erc1155/read/getNFTs.js +4 -1
- package/dist/esm/extensions/erc1155/read/getNFTs.js.map +1 -1
- package/dist/esm/react/core/utils/walletIcon.js +3 -0
- package/dist/esm/react/core/utils/walletIcon.js.map +1 -1
- package/dist/esm/react/native/ui/components/WalletImage.js +3 -1
- package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/esm/react/native/ui/connect/InAppWalletUI.js +21 -1
- package/dist/esm/react/native/ui/connect/InAppWalletUI.js.map +1 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js +2 -1
- package/dist/esm/react/native/ui/connect/TokenListScreen.js.map +1 -1
- package/dist/esm/react/native/ui/icons/svgs.js +1 -0
- package/dist/esm/react/native/ui/icons/svgs.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +15 -2
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js +12 -12
- package/dist/esm/react/web/ui/ConnectWallet/screens/SignatureScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js +6 -6
- package/dist/esm/react/web/ui/ConnectWallet/screens/TokenSelector.js.map +1 -1
- package/dist/esm/react/web/ui/MediaRenderer/MediaRenderer.js +1 -1
- package/dist/esm/react/web/ui/MediaRenderer/MediaRenderer.js.map +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletHeader.js +3 -3
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletHeader.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +4 -0
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +38 -19
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/GuestLogin.js +78 -0
- package/dist/esm/react/web/wallets/shared/GuestLogin.js.map +1 -0
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js +1 -1
- package/dist/esm/react/web/wallets/shared/OTPLoginUI.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js +1 -1
- package/dist/esm/react/web/wallets/shared/SocialLogin.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/de.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/de.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/en.js +1 -0
- package/dist/esm/react/web/wallets/shared/locale/en.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/es.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/es.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/fr.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/fr.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/ja.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/ja.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/kr.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/kr.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/tl.js +2 -1
- package/dist/esm/react/web/wallets/shared/locale/tl.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/vi.js +1 -0
- package/dist/esm/react/web/wallets/shared/locale/vi.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/oauthSignIn.js +1 -0
- package/dist/esm/react/web/wallets/shared/oauthSignIn.js.map +1 -1
- package/dist/esm/utils/any-evm/deploy-metadata.js +1 -0
- package/dist/esm/utils/any-evm/deploy-metadata.js.map +1 -1
- package/dist/esm/utils/encoding/hex.js +1 -3
- package/dist/esm/utils/encoding/hex.js.map +1 -1
- package/dist/esm/utils/fetch.js +1 -7
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/utils/promise/p-limit.js.map +1 -1
- package/dist/esm/utils/signatures/sign-message.js +2 -4
- 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/guest.js +30 -0
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -0
- package/dist/esm/wallets/in-app/core/authentication/types.js +1 -0
- package/dist/esm/wallets/in-app/core/authentication/types.js.map +1 -1
- package/dist/esm/wallets/in-app/native/auth/native-auth.js +24 -0
- package/dist/esm/wallets/in-app/native/auth/native-auth.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +1 -3
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/sss.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +33 -1
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/in-app.js +13 -1
- package/dist/esm/wallets/in-app/web/in-app.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +8 -0
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/wallets/manager/index.js +5 -0
- package/dist/esm/wallets/manager/index.js.map +1 -1
- package/dist/esm/wallets/types.js +1 -0
- package/dist/esm/wallets/types.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/request-handlers/switch-chain.js +2 -4
- package/dist/esm/wallets/wallet-connect/receiver/request-handlers/switch-chain.js.map +1 -1
- package/dist/types/contract/verification/index.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/read/getNFTs.d.ts.map +1 -1
- package/dist/types/react/core/utils/storage.d.ts +1 -1
- package/dist/types/react/core/utils/storage.d.ts.map +1 -1
- package/dist/types/react/core/utils/walletIcon.d.ts +2 -1
- package/dist/types/react/core/utils/walletIcon.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/InAppWalletUI.d.ts.map +1 -1
- package/dist/types/react/native/ui/connect/TokenListScreen.d.ts.map +1 -1
- package/dist/types/react/native/ui/icons/svgs.d.ts +1 -0
- package/dist/types/react/native/ui/icons/svgs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/TokenSelector.d.ts.map +1 -1
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletHeader.d.ts.map +1 -1
- package/dist/types/react/web/wallets/in-app/InAppWalletConnectUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts +3 -0
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/GuestLogin.d.ts +19 -0
- package/dist/types/react/web/wallets/shared/GuestLogin.d.ts.map +1 -0
- package/dist/types/react/web/wallets/shared/OTPLoginUI.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/de.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/de.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/en.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/en.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/es.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/es.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/fr.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/fr.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/ja.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/ja.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/kr.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/kr.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/tl.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/tl.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/types.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/types.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/locale/vi.d.ts +1 -0
- package/dist/types/react/web/wallets/shared/locale/vi.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/oauthSignIn.d.ts.map +1 -1
- package/dist/types/utils/any-evm/deploy-metadata.d.ts.map +1 -1
- package/dist/types/utils/encoding/hex.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts +4 -2
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/utils/promise/p-limit.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts +12 -0
- package/dist/types/wallets/in-app/core/authentication/guest.d.ts.map +1 -0
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +8 -4
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts +2 -1
- package/dist/types/wallets/in-app/core/wallet/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/auth/native-auth.d.ts +4 -3
- package/dist/types/wallets/in-app/native/auth/native-auth.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/api/fetchers.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/wallet/sss.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/native-connector.d.ts +1 -0
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts +13 -1
- package/dist/types/wallets/in-app/web/in-app.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/oauth.d.ts +3 -3
- 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.map +1 -1
- package/dist/types/wallets/manager/index.d.ts.map +1 -1
- package/dist/types/wallets/types.d.ts +2 -1
- package/dist/types/wallets/types.d.ts.map +1 -1
- package/dist/types/wallets/wallet-connect/receiver/request-handlers/switch-chain.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/contract/verification/index.ts +32 -34
- package/src/extensions/erc1155/read/getNFTs.ts +4 -1
- package/src/react/core/utils/walletIcon.ts +5 -0
- package/src/react/native/ui/components/WalletImage.tsx +3 -0
- package/src/react/native/ui/connect/InAppWalletUI.tsx +30 -0
- package/src/react/native/ui/connect/TokenListScreen.tsx +9 -12
- package/src/react/native/ui/icons/svgs.ts +2 -0
- package/src/react/web/ui/ConnectWallet/Details.tsx +15 -2
- package/src/react/web/ui/ConnectWallet/screens/SignatureScreen.tsx +36 -38
- package/src/react/web/ui/ConnectWallet/screens/TokenSelector.tsx +34 -36
- package/src/react/web/ui/MediaRenderer/MediaRenderer.tsx +1 -1
- package/src/react/web/wallets/ecosystem/EcosystemWalletHeader.tsx +18 -20
- package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +16 -0
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +128 -101
- package/src/react/web/wallets/shared/GuestLogin.tsx +159 -0
- package/src/react/web/wallets/shared/OTPLoginUI.tsx +3 -5
- package/src/react/web/wallets/shared/SocialLogin.tsx +1 -1
- package/src/react/web/wallets/shared/locale/de.ts +2 -1
- package/src/react/web/wallets/shared/locale/en.ts +1 -0
- package/src/react/web/wallets/shared/locale/es.ts +2 -1
- package/src/react/web/wallets/shared/locale/fr.ts +2 -1
- package/src/react/web/wallets/shared/locale/ja.ts +2 -1
- package/src/react/web/wallets/shared/locale/kr.ts +2 -1
- package/src/react/web/wallets/shared/locale/tl.ts +2 -1
- package/src/react/web/wallets/shared/locale/types.ts +1 -0
- package/src/react/web/wallets/shared/locale/vi.ts +1 -0
- package/src/react/web/wallets/shared/oauthSignIn.ts +6 -2
- package/src/utils/any-evm/deploy-metadata.ts +1 -0
- package/src/utils/encoding/hex.ts +2 -3
- package/src/utils/fetch.test.ts +94 -0
- package/src/utils/fetch.ts +1 -12
- package/src/utils/promise/p-limit.ts +165 -165
- package/src/utils/signatures/sign-message.ts +3 -3
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/guest.ts +37 -0
- package/src/wallets/in-app/core/authentication/types.ts +9 -4
- package/src/wallets/in-app/core/wallet/types.ts +6 -1
- package/src/wallets/in-app/native/auth/native-auth.ts +34 -3
- package/src/wallets/in-app/native/helpers/api/fetchers.ts +1 -2
- package/src/wallets/in-app/native/helpers/wallet/sss.ts +1 -6
- package/src/wallets/in-app/native/native-connector.ts +42 -2
- package/src/wallets/in-app/web/in-app.ts +13 -1
- package/src/wallets/in-app/web/lib/auth/oauth.ts +3 -3
- package/src/wallets/in-app/web/lib/web-connector.ts +8 -0
- package/src/wallets/manager/index.ts +5 -0
- package/src/wallets/types.ts +2 -0
- package/src/wallets/wallet-connect/receiver/request-handlers/switch-chain.ts +2 -3
@@ -1,105 +1,105 @@
|
|
1
1
|
// source code of yocto-queue + modified to add types
|
2
2
|
// https://github.com/sindresorhus/yocto-queue
|
3
3
|
class Node<T> {
|
4
|
-
|
5
|
-
|
4
|
+
value: T;
|
5
|
+
next: Node<T> | undefined;
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
constructor(value: T) {
|
8
|
+
this.value = value;
|
9
|
+
}
|
10
10
|
}
|
11
11
|
|
12
12
|
class Queue<T> {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
13
|
+
private head: Node<T> | undefined;
|
14
|
+
private tail: Node<T> | undefined;
|
15
|
+
size: number;
|
16
|
+
|
17
|
+
constructor() {
|
18
|
+
this.clear();
|
19
|
+
this.size = 0;
|
20
|
+
}
|
21
|
+
|
22
|
+
enqueue(value: T) {
|
23
|
+
const node = new Node(value);
|
24
|
+
|
25
|
+
if (this.head) {
|
26
|
+
if (this.tail) {
|
27
|
+
this.tail.next = node;
|
28
|
+
}
|
29
|
+
this.tail = node;
|
30
|
+
} else {
|
31
|
+
this.head = node;
|
32
|
+
this.tail = node;
|
33
|
+
}
|
34
|
+
|
35
|
+
this.size++;
|
36
|
+
}
|
37
|
+
|
38
|
+
dequeue() {
|
39
|
+
const current = this.head;
|
40
|
+
if (!current) {
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
|
44
|
+
this.head = this.head?.next;
|
45
|
+
this.size--;
|
46
|
+
return current.value;
|
47
|
+
}
|
48
|
+
|
49
|
+
clear() {
|
50
|
+
this.head = undefined;
|
51
|
+
this.tail = undefined;
|
52
|
+
this.size = 0;
|
53
|
+
}
|
54
|
+
|
55
|
+
*[Symbol.iterator]() {
|
56
|
+
let current = this.head;
|
57
|
+
|
58
|
+
while (current) {
|
59
|
+
yield current.value;
|
60
|
+
current = current.next;
|
61
|
+
}
|
62
|
+
}
|
63
63
|
}
|
64
64
|
|
65
65
|
// source code of p-limit - https://github.com/sindresorhus/p-limit/ + modified to add types
|
66
66
|
const AsyncResource = {
|
67
|
-
|
68
|
-
|
69
|
-
|
67
|
+
bind(fn: () => void, _type?: any, thisArg?: any) {
|
68
|
+
return fn.bind(thisArg);
|
69
|
+
},
|
70
70
|
};
|
71
71
|
|
72
72
|
type LimitFunctionCallSignature = {
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
73
|
+
/**
|
74
|
+
* @param fn - Promise-returning/async function.
|
75
|
+
* @param arguments - Any arguments to pass through to `fn`. Support for passing arguments on to the `fn` is provided in order to be able to avoid creating unnecessary closures. You probably don't need this optimization unless you're pushing a lot of functions.
|
76
|
+
* @returns The promise returned by calling `fn(...arguments)`.
|
77
|
+
*/
|
78
|
+
<Arguments extends unknown[], ReturnType>(
|
79
|
+
fn: (...arguments_: Arguments) => PromiseLike<ReturnType> | ReturnType,
|
80
|
+
...arguments_: Arguments
|
81
|
+
): Promise<ReturnType>;
|
82
82
|
};
|
83
83
|
|
84
84
|
export type LimitFunction = {
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
85
|
+
/**
|
86
|
+
* The number of promises that are currently running.
|
87
|
+
*/
|
88
|
+
readonly activeCount: number;
|
89
|
+
|
90
|
+
/**
|
91
|
+
* The number of promises that are waiting to run (i.e. their internal `fn` was not called yet).
|
92
|
+
*/
|
93
|
+
readonly pendingCount: number;
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Discard pending promises that are waiting to run.
|
97
|
+
*
|
98
|
+
* This might be useful if you want to teardown the queue at the end of your program's lifecycle or discard any function calls referencing an intermediary state of your app.
|
99
|
+
*
|
100
|
+
* Note: This does not cancel promises that are already running.
|
101
|
+
*/
|
102
|
+
clearQueue: () => void;
|
103
103
|
} & LimitFunctionCallSignature;
|
104
104
|
|
105
105
|
type Fn = () => void;
|
@@ -110,84 +110,84 @@ type Fn = () => void;
|
|
110
110
|
* @internal
|
111
111
|
*/
|
112
112
|
export function pLimit(concurrency: number): LimitFunction {
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
113
|
+
if (
|
114
|
+
!(
|
115
|
+
(Number.isInteger(concurrency) ||
|
116
|
+
concurrency === Number.POSITIVE_INFINITY) &&
|
117
|
+
concurrency > 0
|
118
|
+
)
|
119
|
+
) {
|
120
|
+
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
121
|
+
}
|
122
|
+
|
123
|
+
const queue = new Queue<Fn>();
|
124
|
+
let activeCount = 0;
|
125
|
+
|
126
|
+
const next = () => {
|
127
|
+
activeCount--;
|
128
|
+
|
129
|
+
if (queue.size > 0) {
|
130
|
+
const fn = queue.dequeue();
|
131
|
+
if (fn) {
|
132
|
+
fn();
|
133
|
+
}
|
134
|
+
}
|
135
|
+
};
|
136
|
+
|
137
|
+
const run = async (function_: Fn, resolve: any, arguments_: any[]) => {
|
138
|
+
activeCount++;
|
139
|
+
|
140
|
+
// @ts-ignore
|
141
|
+
const result = (async () => function_(...arguments_))();
|
142
|
+
|
143
|
+
resolve(result);
|
144
|
+
|
145
|
+
try {
|
146
|
+
await result;
|
147
|
+
} catch {}
|
148
|
+
|
149
|
+
next();
|
150
|
+
};
|
151
|
+
|
152
|
+
const enqueue = (function_: Fn, resolve: any, arguments_: any[]) => {
|
153
|
+
queue.enqueue(
|
154
|
+
AsyncResource.bind(run.bind(undefined, function_, resolve, arguments_)),
|
155
|
+
);
|
156
|
+
|
157
|
+
(async () => {
|
158
|
+
// This function needs to wait until the next microtask before comparing
|
159
|
+
// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously
|
160
|
+
// when the run function is dequeued and called. The comparison in the if-statement
|
161
|
+
// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.
|
162
|
+
await Promise.resolve();
|
163
|
+
|
164
|
+
if (activeCount < concurrency && queue.size > 0) {
|
165
|
+
const fn = queue.dequeue();
|
166
|
+
if (fn) {
|
167
|
+
fn();
|
168
|
+
}
|
169
|
+
}
|
170
|
+
})();
|
171
|
+
};
|
172
|
+
|
173
|
+
const generator: LimitFunctionCallSignature = (function_, ...arguments_) =>
|
174
|
+
new Promise((resolve) => {
|
175
|
+
enqueue(function_, resolve, arguments_);
|
176
|
+
});
|
177
|
+
|
178
|
+
Object.defineProperties(generator, {
|
179
|
+
activeCount: {
|
180
|
+
get: () => activeCount,
|
181
|
+
},
|
182
|
+
pendingCount: {
|
183
|
+
get: () => queue.size,
|
184
|
+
},
|
185
|
+
clearQueue: {
|
186
|
+
value() {
|
187
|
+
queue.clear();
|
188
|
+
},
|
189
|
+
},
|
190
|
+
});
|
191
|
+
|
192
|
+
return generator as LimitFunction;
|
193
193
|
}
|
@@ -62,10 +62,10 @@ export function signMessage(
|
|
62
62
|
const { message, privateKey } = options;
|
63
63
|
const signature = sign({ hash: hashMessage(message), privateKey });
|
64
64
|
return signatureToHex(signature);
|
65
|
-
}
|
65
|
+
}
|
66
|
+
if ("account" in options) {
|
66
67
|
const { message, account } = options;
|
67
68
|
return account.signMessage({ message });
|
68
|
-
} else {
|
69
|
-
throw new Error("Either privateKey or account is required");
|
70
69
|
}
|
70
|
+
throw new Error("Either privateKey or account is required");
|
71
71
|
}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.57.0";
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
|
+
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
|
+
import type { Ecosystem } from "../../web/types.js";
|
4
|
+
import { getLoginCallbackUrl } from "./getLoginPath.js";
|
5
|
+
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Does no real authentication, just issues a temporary token for the user.
|
9
|
+
* @internal
|
10
|
+
*/
|
11
|
+
export async function guestAuthenticate(args: {
|
12
|
+
client: ThirdwebClient;
|
13
|
+
ecosystem?: Ecosystem;
|
14
|
+
}): Promise<AuthStoredTokenWithCookieReturnType> {
|
15
|
+
const clientFetch = getClientFetch(args.client, args.ecosystem);
|
16
|
+
const authResult = await (async () => {
|
17
|
+
const path = getLoginCallbackUrl({
|
18
|
+
authOption: "guest",
|
19
|
+
client: args.client,
|
20
|
+
ecosystem: args.ecosystem,
|
21
|
+
});
|
22
|
+
const res = await clientFetch(`${path}`, {
|
23
|
+
method: "POST",
|
24
|
+
headers: {
|
25
|
+
"Content-Type": "application/json",
|
26
|
+
},
|
27
|
+
body: JSON.stringify({
|
28
|
+
sessionId: "guest",
|
29
|
+
}),
|
30
|
+
});
|
31
|
+
|
32
|
+
if (!res.ok) throw new Error("Failed to generate guest account");
|
33
|
+
|
34
|
+
return (await res.json()) satisfies AuthStoredTokenWithCookieReturnType;
|
35
|
+
})();
|
36
|
+
return authResult;
|
37
|
+
}
|
@@ -3,7 +3,7 @@ import type { ThirdwebClient } from "../../../../client/client.js";
|
|
3
3
|
import type { Address } from "../../../../utils/address.js";
|
4
4
|
import type { Account } from "../../../interfaces/wallet.js";
|
5
5
|
import type { Wallet } from "../../../interfaces/wallet.js";
|
6
|
-
import type { AuthOption,
|
6
|
+
import type { AuthOption, OAuthOption } from "../../../types.js";
|
7
7
|
import type { Ecosystem } from "../../web/types.js";
|
8
8
|
|
9
9
|
export type MultiStepAuthProviderType =
|
@@ -26,7 +26,7 @@ export type MultiStepAuthArgsType = MultiStepAuthProviderType & {
|
|
26
26
|
|
27
27
|
export type SingleStepAuthArgsType =
|
28
28
|
| {
|
29
|
-
strategy:
|
29
|
+
strategy: OAuthOption;
|
30
30
|
openedWindow?: Window;
|
31
31
|
closeOpenedWindow?: (window: Window) => void;
|
32
32
|
redirectUrl?: string;
|
@@ -52,6 +52,10 @@ export type SingleStepAuthArgsType =
|
|
52
52
|
strategy: "wallet";
|
53
53
|
wallet: Wallet;
|
54
54
|
chain: Chain;
|
55
|
+
}
|
56
|
+
| {
|
57
|
+
strategy: "guest";
|
58
|
+
client: ThirdwebClient;
|
55
59
|
};
|
56
60
|
|
57
61
|
export type AuthArgsType = (MultiStepAuthArgsType | SingleStepAuthArgsType) & {
|
@@ -68,6 +72,7 @@ export enum RecoveryShareManagement {
|
|
68
72
|
// TODO: remove usage of enums, instead use object with as const
|
69
73
|
export enum AuthProvider {
|
70
74
|
COGNITO = "Cognito",
|
75
|
+
GUEST = "Guest",
|
71
76
|
GOOGLE = "Google",
|
72
77
|
EMAIL_OTP = "EmailOtp",
|
73
78
|
CUSTOM_JWT = "CustomJWT",
|
@@ -82,8 +87,8 @@ export enum AuthProvider {
|
|
82
87
|
TELEGRAM = "Telegram",
|
83
88
|
}
|
84
89
|
|
85
|
-
export type
|
86
|
-
strategy:
|
90
|
+
export type OAuthRedirectObject = {
|
91
|
+
strategy: OAuthOption;
|
87
92
|
redirectUrl: string;
|
88
93
|
};
|
89
94
|
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import type { Chain } from "../../../../chains/types.js";
|
2
2
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
3
3
|
import type { SmartWalletOptions } from "../../../smart/types.js";
|
4
|
-
import type {
|
4
|
+
import type {
|
5
|
+
AuthOption,
|
6
|
+
OAuthOption,
|
7
|
+
SocialAuthOption,
|
8
|
+
} from "../../../types.js";
|
5
9
|
import type {
|
6
10
|
AuthStoredTokenWithCookieReturnType,
|
7
11
|
MultiStepAuthArgsType,
|
@@ -24,6 +28,7 @@ export type InAppWalletAutoConnectOptions = {
|
|
24
28
|
};
|
25
29
|
|
26
30
|
export type InAppWalletSocialAuth = SocialAuthOption;
|
31
|
+
export type InAppWalletOAuth = OAuthOption;
|
27
32
|
export type InAppWalletAuth = AuthOption;
|
28
33
|
|
29
34
|
export type InAppWalletCreationOptions =
|
@@ -3,11 +3,12 @@ import type { Chain } from "../../../../chains/types.js";
|
|
3
3
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
4
4
|
import type { Wallet } from "../../../interfaces/wallet.js";
|
5
5
|
import { getLoginUrl } from "../../core/authentication/getLoginPath.js";
|
6
|
+
import { guestAuthenticate } from "../../core/authentication/guest.js";
|
6
7
|
import { siweAuthenticate } from "../../core/authentication/siwe.js";
|
7
8
|
import type {
|
8
9
|
AuthStoredTokenWithCookieReturnType,
|
9
10
|
MultiStepAuthArgsType,
|
10
|
-
|
11
|
+
OAuthRedirectObject,
|
11
12
|
} from "../../core/authentication/types.js";
|
12
13
|
import { verifyOtp } from "../../web/lib/auth/otp.js";
|
13
14
|
import type { Ecosystem } from "../../web/types.js";
|
@@ -53,7 +54,7 @@ export async function otpLogin(
|
|
53
54
|
}
|
54
55
|
|
55
56
|
export async function authenticate(
|
56
|
-
auth:
|
57
|
+
auth: OAuthRedirectObject,
|
57
58
|
client: ThirdwebClient,
|
58
59
|
): Promise<AuthStoredTokenWithCookieReturnType> {
|
59
60
|
const loginUrl = getLoginUrl({
|
@@ -98,7 +99,7 @@ export async function authenticate(
|
|
98
99
|
}
|
99
100
|
|
100
101
|
export async function socialLogin(
|
101
|
-
auth:
|
102
|
+
auth: OAuthRedirectObject,
|
102
103
|
client: ThirdwebClient,
|
103
104
|
): Promise<AuthStoredTokenWithCookieReturnType> {
|
104
105
|
const { storedToken } = await authenticate(auth, client);
|
@@ -158,6 +159,36 @@ export async function siweLogin(
|
|
158
159
|
}
|
159
160
|
}
|
160
161
|
|
162
|
+
export async function guestLogin(
|
163
|
+
client: ThirdwebClient,
|
164
|
+
ecosystem?: Ecosystem,
|
165
|
+
): Promise<AuthStoredTokenWithCookieReturnType> {
|
166
|
+
const { storedToken } = await guestAuthenticate({
|
167
|
+
client,
|
168
|
+
ecosystem,
|
169
|
+
});
|
170
|
+
try {
|
171
|
+
const toStoreToken: AuthStoredTokenWithCookieReturnType["storedToken"] = {
|
172
|
+
jwtToken: storedToken.jwtToken,
|
173
|
+
authDetails: storedToken.authDetails,
|
174
|
+
authProvider: storedToken.authProvider,
|
175
|
+
developerClientId: storedToken.developerClientId,
|
176
|
+
cookieString: storedToken.cookieString,
|
177
|
+
// we should always store the jwt cookie since there's no concept of cookie in react native
|
178
|
+
shouldStoreCookieString: true,
|
179
|
+
isNewUser: storedToken.isNewUser,
|
180
|
+
};
|
181
|
+
|
182
|
+
await postAuth({ storedToken: toStoreToken, client });
|
183
|
+
|
184
|
+
return { storedToken };
|
185
|
+
} catch (e) {
|
186
|
+
throw new Error(
|
187
|
+
createErrorMessage("Malformed response from post authentication", e),
|
188
|
+
);
|
189
|
+
}
|
190
|
+
}
|
191
|
+
|
161
192
|
export async function customJwt(
|
162
193
|
authOptions: { jwt: string; password: string },
|
163
194
|
client: ThirdwebClient,
|
@@ -206,12 +206,7 @@ function getRNG(type) {
|
|
206
206
|
size = 32;
|
207
207
|
elems = Math.ceil(bits / 32);
|
208
208
|
while (str === null) {
|
209
|
-
str = construct(
|
210
|
-
bits,
|
211
|
-
randomBytesBuffer(elems),
|
212
|
-
radix,
|
213
|
-
size,
|
214
|
-
);
|
209
|
+
str = construct(bits, randomBytesBuffer(elems), radix, size);
|
215
210
|
}
|
216
211
|
|
217
212
|
return str;
|
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
3
3
|
import { stringify } from "../../../utils/json.js";
|
4
4
|
import { nativeLocalStorage } from "../../../utils/storage/nativeStorage.js";
|
5
5
|
import type { Account, Wallet } from "../../interfaces/wallet.js";
|
6
|
+
import { guestAuthenticate } from "../core/authentication/guest.js";
|
6
7
|
import {
|
7
8
|
loginWithPasskey,
|
8
9
|
registerPasskey,
|
@@ -16,7 +17,7 @@ import {
|
|
16
17
|
type LogoutReturnType,
|
17
18
|
type MultiStepAuthArgsType,
|
18
19
|
type MultiStepAuthProviderType,
|
19
|
-
type
|
20
|
+
type OAuthRedirectObject,
|
20
21
|
UserWalletStatus,
|
21
22
|
} from "../core/authentication/types.js";
|
22
23
|
import type { InAppConnector } from "../core/interfaces/connector.js";
|
@@ -27,6 +28,7 @@ import {
|
|
27
28
|
authenticate,
|
28
29
|
customJwt,
|
29
30
|
deleteActiveAccount,
|
31
|
+
guestLogin,
|
30
32
|
otpLogin,
|
31
33
|
siweLogin,
|
32
34
|
socialLogin,
|
@@ -99,6 +101,12 @@ export class InAppNativeConnector implements InAppConnector {
|
|
99
101
|
case "phone": {
|
100
102
|
return verifyOtp(params);
|
101
103
|
}
|
104
|
+
case "guest": {
|
105
|
+
return guestAuthenticate({
|
106
|
+
client: this.options.client,
|
107
|
+
ecosystem: params.ecosystem,
|
108
|
+
});
|
109
|
+
}
|
102
110
|
case "wallet": {
|
103
111
|
return siweAuthenticate({
|
104
112
|
client: this.options.client,
|
@@ -159,6 +167,11 @@ export class InAppNativeConnector implements InAppConnector {
|
|
159
167
|
redirectUrl,
|
160
168
|
});
|
161
169
|
}
|
170
|
+
case "guest": {
|
171
|
+
return this.guestLogin({
|
172
|
+
ecosystem: params.ecosystem,
|
173
|
+
});
|
174
|
+
}
|
162
175
|
case "wallet": {
|
163
176
|
return this.siweLogin({
|
164
177
|
wallet: params.wallet,
|
@@ -300,7 +313,9 @@ export class InAppNativeConnector implements InAppConnector {
|
|
300
313
|
return deleteActiveAccount({ client: this.options.client });
|
301
314
|
}
|
302
315
|
|
303
|
-
private async socialLogin(
|
316
|
+
private async socialLogin(
|
317
|
+
auth: OAuthRedirectObject,
|
318
|
+
): Promise<AuthLoginReturnType> {
|
304
319
|
try {
|
305
320
|
const { storedToken } = await socialLogin(auth, this.options.client);
|
306
321
|
const account = await this.getAccount();
|
@@ -355,6 +370,31 @@ export class InAppNativeConnector implements InAppConnector {
|
|
355
370
|
}
|
356
371
|
}
|
357
372
|
|
373
|
+
private async guestLogin(options: {
|
374
|
+
ecosystem?: Ecosystem;
|
375
|
+
}): Promise<AuthLoginReturnType> {
|
376
|
+
try {
|
377
|
+
const { storedToken } = await guestLogin(
|
378
|
+
this.options.client,
|
379
|
+
options.ecosystem,
|
380
|
+
);
|
381
|
+
const account = await this.getAccount();
|
382
|
+
return {
|
383
|
+
user: {
|
384
|
+
status: UserWalletStatus.LOGGED_IN_WALLET_INITIALIZED,
|
385
|
+
account,
|
386
|
+
authDetails: storedToken.authDetails,
|
387
|
+
walletAddress: account.address,
|
388
|
+
},
|
389
|
+
};
|
390
|
+
} catch (error) {
|
391
|
+
if (error instanceof Error) {
|
392
|
+
throw new Error(`Error generating guest account: ${error.message}`);
|
393
|
+
}
|
394
|
+
throw new Error("An unknown error occurred generating guest account");
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
358
398
|
private async customJwt(authOptions: {
|
359
399
|
jwt: string;
|
360
400
|
password: string;
|