thirdweb 5.64.5 → 5.65.0-nightly-7a9713e877eb20b4e0d95964125b295feafc931a-20241102000323
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/auth/core/verify-jwt.js +2 -1
- package/dist/cjs/auth/core/verify-jwt.js.map +1 -1
- package/dist/cjs/extensions/erc721/drops/write/claimToBatch.js +8 -7
- package/dist/cjs/extensions/erc721/drops/write/claimToBatch.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js +2 -1
- package/dist/cjs/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js +2 -1
- package/dist/cjs/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js +2 -1
- package/dist/cjs/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js +14 -0
- package/dist/cjs/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +5 -4
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js +29 -11
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
- package/dist/cjs/rpc/rpc.js +2 -1
- package/dist/cjs/rpc/rpc.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +1 -10
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc1155.js +3 -2
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc1155.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc20.js +3 -2
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc20.js.map +1 -1
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc721.js +3 -2
- package/dist/cjs/utils/extensions/airdrop/process-snapshot-erc721.js.map +1 -1
- package/dist/cjs/utils/extensions/drops/process-override-list.js +3 -2
- package/dist/cjs/utils/extensions/drops/process-override-list.js.map +1 -1
- package/dist/cjs/utils/jwt/encode-jwt.js +5 -2
- package/dist/cjs/utils/jwt/encode-jwt.js.map +1 -1
- package/dist/cjs/utils/storage/walletStorage.js +4 -3
- package/dist/cjs/utils/storage/walletStorage.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 +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/jwt.js +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/jwt.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/passkeys.js +3 -2
- package/dist/cjs/wallets/in-app/core/authentication/passkeys.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/siwe.js +2 -1
- package/dist/cjs/wallets/in-app/core/authentication/siwe.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js +2 -1
- package/dist/cjs/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js +5 -4
- package/dist/cjs/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/errors.js +2 -1
- package/dist/cjs/wallets/in-app/native/helpers/errors.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/storage/local.js +2 -1
- package/dist/cjs/wallets/in-app/native/helpers/storage/local.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js +4 -3
- package/dist/cjs/wallets/in-app/native/helpers/wallet/migration.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/helpers/wallet/recoveryCode.js +5 -4
- package/dist/cjs/wallets/in-app/native/helpers/wallet/recoveryCode.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/otp.js +3 -2
- package/dist/cjs/wallets/in-app/web/lib/auth/otp.js.map +1 -1
- package/dist/cjs/wallets/manager/index.js +4 -3
- package/dist/cjs/wallets/manager/index.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js +1 -1
- package/dist/cjs/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/cjs/wallets/smart/lib/paymaster.js +2 -1
- package/dist/cjs/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/cjs/wallets/smart/smart-wallet.js +14 -10
- package/dist/cjs/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/controller.js +2 -1
- package/dist/cjs/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/cjs/wallets/wallet-connect/receiver/session-store.js +3 -2
- package/dist/cjs/wallets/wallet-connect/receiver/session-store.js.map +1 -1
- package/dist/esm/auth/core/verify-jwt.js +2 -1
- package/dist/esm/auth/core/verify-jwt.js.map +1 -1
- package/dist/esm/extensions/erc721/drops/write/claimToBatch.js +8 -7
- package/dist/esm/extensions/erc721/drops/write/claimToBatch.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js +2 -1
- package/dist/esm/pay/buyWithCrypto/getQuote.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js +2 -1
- package/dist/esm/pay/buyWithCrypto/getTransfer.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js +2 -1
- package/dist/esm/pay/buyWithFiat/getQuote.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js +14 -0
- package/dist/esm/react/web/ui/ConnectWallet/ConnectButton.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +5 -4
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js +30 -12
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
- package/dist/esm/rpc/rpc.js +2 -1
- package/dist/esm/rpc/rpc.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +1 -10
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc1155.js +3 -2
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc1155.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc20.js +3 -2
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc20.js.map +1 -1
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc721.js +3 -2
- package/dist/esm/utils/extensions/airdrop/process-snapshot-erc721.js.map +1 -1
- package/dist/esm/utils/extensions/drops/process-override-list.js +3 -2
- package/dist/esm/utils/extensions/drops/process-override-list.js.map +1 -1
- package/dist/esm/utils/jwt/encode-jwt.js +5 -2
- package/dist/esm/utils/jwt/encode-jwt.js.map +1 -1
- package/dist/esm/utils/storage/walletStorage.js +4 -3
- package/dist/esm/utils/storage/walletStorage.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 +2 -1
- package/dist/esm/wallets/in-app/core/authentication/authEndpoint.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js +2 -1
- package/dist/esm/wallets/in-app/core/authentication/guest.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/jwt.js +2 -1
- package/dist/esm/wallets/in-app/core/authentication/jwt.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/linkAccount.js +2 -1
- package/dist/esm/wallets/in-app/core/authentication/linkAccount.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/passkeys.js +3 -2
- package/dist/esm/wallets/in-app/core/authentication/passkeys.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/siwe.js +2 -1
- package/dist/esm/wallets/in-app/core/authentication/siwe.js.map +1 -1
- package/dist/esm/wallets/in-app/core/wallet/in-app-core.js +2 -1
- package/dist/esm/wallets/in-app/core/wallet/in-app-core.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js +5 -4
- package/dist/esm/wallets/in-app/native/helpers/api/fetchers.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/errors.js +2 -1
- package/dist/esm/wallets/in-app/native/helpers/errors.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/storage/local.js +2 -1
- package/dist/esm/wallets/in-app/native/helpers/storage/local.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js +4 -3
- package/dist/esm/wallets/in-app/native/helpers/wallet/migration.js.map +1 -1
- package/dist/esm/wallets/in-app/native/helpers/wallet/recoveryCode.js +5 -4
- package/dist/esm/wallets/in-app/native/helpers/wallet/recoveryCode.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/otp.js +3 -2
- package/dist/esm/wallets/in-app/web/lib/auth/otp.js.map +1 -1
- package/dist/esm/wallets/manager/index.js +4 -3
- package/dist/esm/wallets/manager/index.js.map +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js +1 -1
- package/dist/esm/wallets/smart/lib/bundler.js.map +1 -1
- package/dist/esm/wallets/smart/lib/paymaster.js +2 -1
- package/dist/esm/wallets/smart/lib/paymaster.js.map +1 -1
- package/dist/esm/wallets/smart/smart-wallet.js +14 -10
- package/dist/esm/wallets/smart/smart-wallet.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/controller.js +2 -1
- package/dist/esm/wallets/wallet-connect/controller.js.map +1 -1
- package/dist/esm/wallets/wallet-connect/receiver/session-store.js +3 -2
- package/dist/esm/wallets/wallet-connect/receiver/session-store.js.map +1 -1
- package/dist/types/auth/core/verify-jwt.d.ts.map +1 -1
- package/dist/types/extensions/erc721/drops/write/claimToBatch.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getQuote.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getTransfer.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getQuote.d.ts.map +1 -1
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts +7 -0
- package/dist/types/react/core/hooks/connection/ConnectButtonProps.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts +14 -0
- package/dist/types/react/web/ui/ConnectWallet/ConnectButton.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts +7 -0
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewAssets.d.ts +5 -0
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewAssets.d.ts.map +1 -1
- package/dist/types/rpc/rpc.d.ts.map +1 -1
- package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/process-snapshot-erc1155.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/process-snapshot-erc20.d.ts.map +1 -1
- package/dist/types/utils/extensions/airdrop/process-snapshot-erc721.d.ts.map +1 -1
- package/dist/types/utils/extensions/drops/process-override-list.d.ts.map +1 -1
- package/dist/types/utils/jwt/encode-jwt.d.ts.map +1 -1
- package/dist/types/utils/storage/walletStorage.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.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.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/linkAccount.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/passkeys.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/siwe.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/wallet/in-app-core.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/errors.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/storage/local.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/wallet/migration.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/helpers/wallet/recoveryCode.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/otp.d.ts.map +1 -1
- package/dist/types/wallets/manager/index.d.ts.map +1 -1
- package/dist/types/wallets/smart/lib/paymaster.d.ts.map +1 -1
- package/dist/types/wallets/smart/smart-wallet.d.ts.map +1 -1
- package/dist/types/wallets/wallet-connect/controller.d.ts.map +1 -1
- package/dist/types/wallets/wallet-connect/receiver/session-store.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auth/core/verify-jwt.ts +2 -1
- package/src/extensions/erc1155/drop1155.test.ts +12 -1
- package/src/extensions/erc1155/token1155.test.ts +12 -1
- package/src/extensions/erc1155/write/mintAdditionalSupplyToBatch.test.ts +0 -1
- package/src/extensions/erc20/drop20.test.ts +11 -2
- package/src/extensions/erc721/drop721.test.ts +10 -7
- package/src/extensions/erc721/drops/write/claimToBatch.ts +10 -11
- package/src/extensions/erc721/read/getNFT.test.ts +0 -67
- package/src/extensions/erc721/read/getNFTs.test.ts +0 -32
- package/src/extensions/erc721/token721.test.ts +115 -0
- package/src/extensions/prebuilts/deploy-erc721.test.ts +0 -42
- package/src/pay/buyWithCrypto/getQuote.ts +2 -1
- package/src/pay/buyWithCrypto/getTransfer.ts +2 -1
- package/src/pay/buyWithFiat/getQuote.ts +2 -1
- package/src/react/core/hooks/connection/ConnectButtonProps.ts +8 -0
- package/src/react/web/ui/ConnectWallet/ConnectButton.tsx +14 -0
- package/src/react/web/ui/ConnectWallet/Details.tsx +30 -16
- package/src/react/web/ui/ConnectWallet/screens/ViewAssets.tsx +46 -24
- package/src/rpc/rpc.ts +2 -1
- package/src/utils/any-evm/zksync/isZkSyncChain.ts +1 -9
- package/src/utils/extensions/airdrop/process-snapshot-erc1155.ts +3 -2
- package/src/utils/extensions/airdrop/process-snapshot-erc20.ts +3 -2
- package/src/utils/extensions/airdrop/process-snapshot-erc721.ts +3 -2
- package/src/utils/extensions/drops/process-override-list.ts +3 -2
- package/src/utils/jwt/encode-jwt.ts +5 -5
- package/src/utils/nft/fetch-token-metadata.test.ts +2 -1
- package/src/utils/storage/walletStorage.ts +4 -3
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/authEndpoint.ts +2 -1
- package/src/wallets/in-app/core/authentication/guest.ts +2 -1
- package/src/wallets/in-app/core/authentication/jwt.ts +2 -1
- package/src/wallets/in-app/core/authentication/linkAccount.ts +2 -1
- package/src/wallets/in-app/core/authentication/passkeys.ts +3 -2
- package/src/wallets/in-app/core/authentication/siwe.ts +2 -1
- package/src/wallets/in-app/core/wallet/in-app-core.ts +2 -1
- package/src/wallets/in-app/native/helpers/api/fetchers.ts +5 -4
- package/src/wallets/in-app/native/helpers/errors.ts +3 -1
- package/src/wallets/in-app/native/helpers/storage/local.ts +2 -1
- package/src/wallets/in-app/native/helpers/wallet/migration.ts +4 -3
- package/src/wallets/in-app/native/helpers/wallet/recoveryCode.ts +5 -4
- package/src/wallets/in-app/web/lib/auth/otp.ts +3 -2
- package/src/wallets/manager/index.ts +4 -3
- package/src/wallets/smart/lib/bundler.ts +1 -1
- package/src/wallets/smart/lib/paymaster.ts +2 -1
- package/src/wallets/smart/smart-wallet.ts +19 -13
- package/src/wallets/wallet-connect/controller.ts +2 -1
- package/src/wallets/wallet-connect/receiver/session-store.ts +3 -6
- package/src/extensions/erc721/write/mintTo.test.ts +0 -69
- package/src/extensions/prebuilts/deploy-erc1155.test.ts +0 -54
- package/src/extensions/prebuilts/deploy-erc20.test.ts +0 -56
@@ -11,48 +11,6 @@ const account = TEST_ACCOUNT_B;
|
|
11
11
|
// skip this test suite if there is no secret key available to test with
|
12
12
|
// TODO: remove reliance on secret key during unit tests entirely
|
13
13
|
describe.runIf(process.env.TW_SECRET_KEY)("deployERC721", () => {
|
14
|
-
it("should deploy ERC721 drop", async () => {
|
15
|
-
const address = await deployERC721Contract({
|
16
|
-
client: TEST_CLIENT,
|
17
|
-
chain: ANVIL_CHAIN,
|
18
|
-
account,
|
19
|
-
type: "DropERC721",
|
20
|
-
params: {
|
21
|
-
name: "NFTDrop",
|
22
|
-
},
|
23
|
-
});
|
24
|
-
expect(address).toBeDefined();
|
25
|
-
const deployedName = await name({
|
26
|
-
contract: getContract({
|
27
|
-
client: TEST_CLIENT,
|
28
|
-
chain: ANVIL_CHAIN,
|
29
|
-
address,
|
30
|
-
}),
|
31
|
-
});
|
32
|
-
expect(deployedName).toBe("NFTDrop");
|
33
|
-
});
|
34
|
-
|
35
|
-
it("should deploy ERC721 token", async () => {
|
36
|
-
const address = await deployERC721Contract({
|
37
|
-
client: TEST_CLIENT,
|
38
|
-
chain: ANVIL_CHAIN,
|
39
|
-
account,
|
40
|
-
type: "TokenERC721",
|
41
|
-
params: {
|
42
|
-
name: "NFTCollection",
|
43
|
-
},
|
44
|
-
});
|
45
|
-
expect(address).toBeDefined();
|
46
|
-
const deployedName = await name({
|
47
|
-
contract: getContract({
|
48
|
-
client: TEST_CLIENT,
|
49
|
-
chain: ANVIL_CHAIN,
|
50
|
-
address,
|
51
|
-
}),
|
52
|
-
});
|
53
|
-
expect(deployedName).toBe("NFTCollection");
|
54
|
-
});
|
55
|
-
|
56
14
|
it("should deploy ERC721 open edition", async () => {
|
57
15
|
const address = await deployERC721Contract({
|
58
16
|
client: TEST_CLIENT,
|
@@ -5,6 +5,7 @@ import { getContract } from "../../contract/contract.js";
|
|
5
5
|
import { approve } from "../../extensions/erc20/write/approve.js";
|
6
6
|
import type { PrepareTransactionOptions } from "../../transaction/prepare-transaction.js";
|
7
7
|
import { getClientFetch } from "../../utils/fetch.js";
|
8
|
+
import { stringify } from "../../utils/json.js";
|
8
9
|
import { getPayBuyWithCryptoQuoteEndpoint } from "../utils/definitions.js";
|
9
10
|
import type {
|
10
11
|
QuoteApprovalInfo,
|
@@ -223,7 +224,7 @@ export async function getBuyWithCryptoQuote(
|
|
223
224
|
Accept: "application/json",
|
224
225
|
"Content-Type": "application/json",
|
225
226
|
},
|
226
|
-
body:
|
227
|
+
body: stringify({
|
227
228
|
fromAddress: params.fromAddress,
|
228
229
|
toAddress: params.toAddress,
|
229
230
|
fromChainId: params.fromChainId.toString(),
|
@@ -6,6 +6,7 @@ import { approve } from "../../extensions/erc20/write/approve.js";
|
|
6
6
|
import type { PrepareTransactionOptions } from "../../transaction/prepare-transaction.js";
|
7
7
|
import type { Address } from "../../utils/address.js";
|
8
8
|
import { getClientFetch } from "../../utils/fetch.js";
|
9
|
+
import { stringify } from "../../utils/json.js";
|
9
10
|
import { getPayBuyWithCryptoTransferEndpoint } from "../utils/definitions.js";
|
10
11
|
import type {
|
11
12
|
QuoteApprovalInfo,
|
@@ -129,7 +130,7 @@ export async function getBuyWithCryptoTransfer(
|
|
129
130
|
Accept: "application/json",
|
130
131
|
"Content-Type": "application/json",
|
131
132
|
},
|
132
|
-
body:
|
133
|
+
body: stringify({
|
133
134
|
fromAddress: params.fromAddress,
|
134
135
|
toAddress: params.toAddress,
|
135
136
|
chainId: params.chainId,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../client/client.js";
|
2
2
|
import { getClientFetch } from "../../utils/fetch.js";
|
3
|
+
import { stringify } from "../../utils/json.js";
|
3
4
|
import type { FiatProvider } from "../utils/commonTypes.js";
|
4
5
|
import { getPayBuyWithFiatQuoteEndpoint } from "../utils/definitions.js";
|
5
6
|
|
@@ -299,7 +300,7 @@ export async function getBuyWithFiatQuote(
|
|
299
300
|
Accept: "application/json",
|
300
301
|
"Content-Type": "application/json",
|
301
302
|
},
|
302
|
-
body:
|
303
|
+
body: stringify({
|
303
304
|
toAddress: params.toAddress,
|
304
305
|
fromCurrencySymbol: params.fromCurrencySymbol,
|
305
306
|
toChainId: params.toChainId.toString(),
|
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../../client/client.js";
|
|
3
3
|
import type { BuyWithCryptoStatus } from "../../../../pay/buyWithCrypto/getStatus.js";
|
4
4
|
import type { BuyWithFiatStatus } from "../../../../pay/buyWithFiat/getStatus.js";
|
5
5
|
import type { FiatProvider } from "../../../../pay/utils/commonTypes.js";
|
6
|
+
import type { AssetTabs } from "../../../../react/web/ui/ConnectWallet/screens/ViewAssets.js";
|
6
7
|
import type { PreparedTransaction } from "../../../../transaction/prepare-transaction.js";
|
7
8
|
import type { Prettify } from "../../../../utils/type-utils.js";
|
8
9
|
import type { Account, Wallet } from "../../../../wallets/interfaces/wallet.js";
|
@@ -311,6 +312,13 @@ export type ConnectButton_detailsModalOptions = {
|
|
311
312
|
* All wallet IDs included in this array will be hidden from wallet selection when connected.
|
312
313
|
*/
|
313
314
|
hiddenWallets?: WalletId[];
|
315
|
+
|
316
|
+
/**
|
317
|
+
* When you click on "View Assets", by default the "Tokens" tab is shown first.
|
318
|
+
* If you want to show the "NFTs" tab first, change the order of the asset tabs to: ["nft", "token"]
|
319
|
+
* Note: If an empty array is passed, the [View Funds] button will be hidden
|
320
|
+
*/
|
321
|
+
assetTabs?: AssetTabs[];
|
314
322
|
};
|
315
323
|
|
316
324
|
/**
|
@@ -247,6 +247,20 @@ const TW_CONNECT_WALLET = "tw-connect-wallet";
|
|
247
247
|
* />
|
248
248
|
* ```
|
249
249
|
*
|
250
|
+
* ### Customizing the orders of the tabs in the [View Funds] screen
|
251
|
+
* When you click on "View Assets", by default the "Tokens" tab is shown first.
|
252
|
+
* If you want to show the "NFTs" tab first, change the order of the asset tabs to: ["nft", "token"]
|
253
|
+
* Note: If an empty array is passed, the [View Funds] button will be hidden
|
254
|
+
*
|
255
|
+
* ```tsx
|
256
|
+
* <ConnectButton
|
257
|
+
* client={client}
|
258
|
+
* detailsModal={{
|
259
|
+
* assetTabs: ["nft", "token"],
|
260
|
+
* }}
|
261
|
+
* />
|
262
|
+
* ```
|
263
|
+
*
|
250
264
|
* @param props
|
251
265
|
* Props for the `ConnectButton` component
|
252
266
|
*
|
@@ -109,7 +109,7 @@ import { ManageWalletScreen } from "./screens/ManageWalletScreen.js";
|
|
109
109
|
import { PrivateKey } from "./screens/PrivateKey.js";
|
110
110
|
import { ReceiveFunds } from "./screens/ReceiveFunds.js";
|
111
111
|
import { SendFunds } from "./screens/SendFunds.js";
|
112
|
-
import { ViewAssets } from "./screens/ViewAssets.js";
|
112
|
+
import { type AssetTabs, ViewAssets } from "./screens/ViewAssets.js";
|
113
113
|
import { ViewNFTs } from "./screens/ViewNFTs.js";
|
114
114
|
import { ViewTokens } from "./screens/ViewTokens.js";
|
115
115
|
import { WalletConnectReceiverScreen } from "./screens/WalletConnectReceiverScreen.js";
|
@@ -170,6 +170,7 @@ export const ConnectedWalletDetails: React.FC<{
|
|
170
170
|
chains={props.chains}
|
171
171
|
displayBalanceToken={props.detailsButton?.displayBalanceToken}
|
172
172
|
connectOptions={props.connectOptions}
|
173
|
+
assetTabs={props.detailsModal?.assetTabs}
|
173
174
|
/>,
|
174
175
|
);
|
175
176
|
}
|
@@ -284,6 +285,7 @@ function DetailsModal(props: {
|
|
284
285
|
chains: Chain[];
|
285
286
|
displayBalanceToken?: Record<number, string>;
|
286
287
|
connectOptions: DetailsModalConnectOptions | undefined;
|
288
|
+
assetTabs?: AssetTabs[];
|
287
289
|
}) {
|
288
290
|
const [screen, setScreen] = useState<WalletDetailsModalScreen>("main");
|
289
291
|
const { disconnect } = useDisconnect();
|
@@ -627,21 +629,24 @@ function DetailsModal(props: {
|
|
627
629
|
</MenuButton>
|
628
630
|
|
629
631
|
{/* View Funds */}
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
{
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
632
|
+
{/* Hide the View Funds button if the assetTabs props is set to an empty array */}
|
633
|
+
{(props.assetTabs === undefined || props.assetTabs.length) && (
|
634
|
+
<MenuButton
|
635
|
+
onClick={() => {
|
636
|
+
setScreen("view-assets");
|
637
|
+
}}
|
638
|
+
style={{
|
639
|
+
fontSize: fontSize.sm,
|
640
|
+
}}
|
641
|
+
>
|
642
|
+
<CoinsIcon size={iconSize.md} />
|
643
|
+
<Text color="primaryText">
|
644
|
+
{props.supportedNFTs
|
645
|
+
? locale.viewFunds.viewAssets
|
646
|
+
: locale.viewFunds.title}
|
647
|
+
</Text>
|
648
|
+
</MenuButton>
|
649
|
+
)}
|
645
650
|
|
646
651
|
{/* Manage Wallet */}
|
647
652
|
<MenuButton
|
@@ -799,6 +804,7 @@ function DetailsModal(props: {
|
|
799
804
|
setScreen={setScreen}
|
800
805
|
client={client}
|
801
806
|
connectLocale={locale}
|
807
|
+
assetTabs={props.detailsModal?.assetTabs}
|
802
808
|
/>
|
803
809
|
);
|
804
810
|
} else {
|
@@ -1458,6 +1464,13 @@ export type UseWalletDetailsModalOptions = {
|
|
1458
1464
|
* By default the "Buy Funds" button is shown.
|
1459
1465
|
*/
|
1460
1466
|
hideBuyFunds?: boolean;
|
1467
|
+
|
1468
|
+
/**
|
1469
|
+
* When you click on "View Assets", by default the "Tokens" tab is shown first.
|
1470
|
+
* If you want to show the "NFTs" tab first, change the order of the asset tabs to: ["nft", "token"]
|
1471
|
+
* Note: If an empty array is passed, the [View Funds] button will be hidden
|
1472
|
+
*/
|
1473
|
+
assetTabs?: AssetTabs[];
|
1461
1474
|
};
|
1462
1475
|
|
1463
1476
|
/**
|
@@ -1515,6 +1528,7 @@ export function useWalletDetailsModal() {
|
|
1515
1528
|
hideBuyFunds: props.hideBuyFunds,
|
1516
1529
|
hideReceiveFunds: props.hideReceiveFunds,
|
1517
1530
|
hideSendFunds: props.hideSendFunds,
|
1531
|
+
assetTabs: props.assetTabs,
|
1518
1532
|
}}
|
1519
1533
|
displayBalanceToken={props.displayBalanceToken}
|
1520
1534
|
theme={props.theme || "dark"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { useState } from "react";
|
1
|
+
import { useMemo, useState } from "react";
|
2
2
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
3
3
|
import { type Theme, iconSize } from "../../../../core/design-system/index.js";
|
4
4
|
import type {
|
@@ -15,6 +15,29 @@ import { ViewNFTsContent } from "./ViewNFTs.js";
|
|
15
15
|
import { ViewTokensContent } from "./ViewTokens.js";
|
16
16
|
import type { WalletDetailsModalScreen } from "./types.js";
|
17
17
|
|
18
|
+
/**
|
19
|
+
* @internal
|
20
|
+
*/
|
21
|
+
export type AssetTabs = "token" | "nft";
|
22
|
+
|
23
|
+
const TokenTab = {
|
24
|
+
label: (
|
25
|
+
<span className="flex gap-2">
|
26
|
+
<CoinsIcon size={iconSize.sm} /> Tokens
|
27
|
+
</span>
|
28
|
+
),
|
29
|
+
value: "Tokens",
|
30
|
+
};
|
31
|
+
|
32
|
+
const NftTab = {
|
33
|
+
label: (
|
34
|
+
<span className="flex gap-2">
|
35
|
+
<ImageIcon size={iconSize.sm} /> NFTs
|
36
|
+
</span>
|
37
|
+
),
|
38
|
+
value: "NFTs",
|
39
|
+
};
|
40
|
+
|
18
41
|
/**
|
19
42
|
* @internal
|
20
43
|
*/
|
@@ -26,9 +49,29 @@ export function ViewAssets(props: {
|
|
26
49
|
setScreen: (screen: WalletDetailsModalScreen) => void;
|
27
50
|
client: ThirdwebClient;
|
28
51
|
connectLocale: ConnectLocale;
|
52
|
+
assetTabs?: AssetTabs[];
|
29
53
|
}) {
|
30
|
-
const [activeTab, setActiveTab] = useState("Tokens");
|
31
54
|
const { connectLocale } = props;
|
55
|
+
const options = useMemo(() => {
|
56
|
+
if (!props.assetTabs) {
|
57
|
+
return [TokenTab, NftTab];
|
58
|
+
}
|
59
|
+
if (!props.assetTabs.length) {
|
60
|
+
return [];
|
61
|
+
}
|
62
|
+
const tabs = [];
|
63
|
+
for (const item of props.assetTabs) {
|
64
|
+
if (item === "token") {
|
65
|
+
tabs.push(TokenTab);
|
66
|
+
} else if (item === "nft") {
|
67
|
+
tabs.push(NftTab);
|
68
|
+
}
|
69
|
+
}
|
70
|
+
return tabs;
|
71
|
+
}, [props.assetTabs]);
|
72
|
+
|
73
|
+
// Since `options` is now a dynamic value, the default active tab is set to the value of the first tab in `options`
|
74
|
+
const [activeTab, setActiveTab] = useState(options[0]?.value || "Tokens");
|
32
75
|
|
33
76
|
return (
|
34
77
|
<Container
|
@@ -52,28 +95,7 @@ export function ViewAssets(props: {
|
|
52
95
|
}}
|
53
96
|
>
|
54
97
|
<Spacer y="md" />
|
55
|
-
<Tabs
|
56
|
-
options={[
|
57
|
-
{
|
58
|
-
label: (
|
59
|
-
<span className="flex gap-2">
|
60
|
-
<CoinsIcon size={iconSize.sm} /> Tokens
|
61
|
-
</span>
|
62
|
-
),
|
63
|
-
value: "Tokens",
|
64
|
-
},
|
65
|
-
{
|
66
|
-
label: (
|
67
|
-
<span className="flex gap-2">
|
68
|
-
<ImageIcon size={iconSize.sm} /> NFTs
|
69
|
-
</span>
|
70
|
-
),
|
71
|
-
value: "NFTs",
|
72
|
-
},
|
73
|
-
]}
|
74
|
-
selected={activeTab}
|
75
|
-
onSelect={setActiveTab}
|
76
|
-
>
|
98
|
+
<Tabs options={options} selected={activeTab} onSelect={setActiveTab}>
|
77
99
|
<Container
|
78
100
|
scrollY
|
79
101
|
style={{
|
package/src/rpc/rpc.ts
CHANGED
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../client/client.js";
|
|
3
3
|
|
4
4
|
import type { Chain } from "../chains/types.js";
|
5
5
|
import { getRpcUrlForChain } from "../chains/utils.js";
|
6
|
+
import { stringify } from "../utils/json.js";
|
6
7
|
import { type RpcRequest, fetchRpc, fetchSingleRpc } from "./fetch-rpc.js";
|
7
8
|
|
8
9
|
const RPC_CLIENT_MAP = new WeakMap();
|
@@ -23,7 +24,7 @@ function getRpcClientMap(client: ThirdwebClient) {
|
|
23
24
|
* @internal
|
24
25
|
*/
|
25
26
|
function rpcRequestKey(request: RpcRequest): string {
|
26
|
-
return `${request.method}:${
|
27
|
+
return `${request.method}:${stringify(request.params)}`;
|
27
28
|
}
|
28
29
|
|
29
30
|
const DEFAULT_MAX_BATCH_SIZE = 100;
|
@@ -1,5 +1,4 @@
|
|
1
1
|
import type { Chain } from "../../../chains/types.js";
|
2
|
-
import { getChainMetadata } from "../../../chains/utils.js";
|
3
2
|
|
4
3
|
export async function isZkSyncChain(chain: Chain) {
|
5
4
|
if (chain.id === 1337 || chain.id === 31337) {
|
@@ -22,12 +21,5 @@ export async function isZkSyncChain(chain: Chain) {
|
|
22
21
|
return true;
|
23
22
|
}
|
24
23
|
|
25
|
-
|
26
|
-
try {
|
27
|
-
const chainMetadata = await getChainMetadata(chain);
|
28
|
-
return chainMetadata.stackType === "zksync_stack";
|
29
|
-
} catch {
|
30
|
-
// If the network check fails, assume it's not a ZkSync chain
|
31
|
-
return false;
|
32
|
-
}
|
24
|
+
return false;
|
33
25
|
}
|
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
2
2
|
import { MerkleTree } from "../../../merkletree/MerkleTree.js";
|
3
3
|
import { upload } from "../../../storage/upload.js";
|
4
4
|
import type { Hex } from "../../encoding/hex.js";
|
5
|
+
import { stringify } from "../../json.js";
|
5
6
|
import { hashEntryERC1155 } from "./hash-entry-erc1155.js";
|
6
7
|
import type {
|
7
8
|
ShardDataERC1155,
|
@@ -54,7 +55,7 @@ export async function processSnapshotERC1155(options: {
|
|
54
55
|
entries,
|
55
56
|
};
|
56
57
|
shardsToUpload.push({
|
57
|
-
data:
|
58
|
+
data: stringify(data),
|
58
59
|
name: `${shardId}.json`,
|
59
60
|
});
|
60
61
|
}
|
@@ -74,7 +75,7 @@ export async function processSnapshotERC1155(options: {
|
|
74
75
|
// 6. Also upload the original entries for retrieving all entries
|
75
76
|
const originalEntriesUri = await upload({
|
76
77
|
client: options.client,
|
77
|
-
files: [
|
78
|
+
files: [stringify(options.snapshot)],
|
78
79
|
});
|
79
80
|
// 7. assmeble the final sharded merkle tree info
|
80
81
|
const shardedMerkleInfo: ShardedMerkleTreeInfo = {
|
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
2
2
|
import { MerkleTree } from "../../../merkletree/MerkleTree.js";
|
3
3
|
import { upload } from "../../../storage/upload.js";
|
4
4
|
import type { Hex } from "../../encoding/hex.js";
|
5
|
+
import { stringify } from "../../json.js";
|
5
6
|
import { hashEntryERC20 } from "./hash-entry-erc20.js";
|
6
7
|
import type {
|
7
8
|
ShardDataERC20,
|
@@ -56,7 +57,7 @@ export async function processSnapshotERC20(options: {
|
|
56
57
|
entries,
|
57
58
|
};
|
58
59
|
shardsToUpload.push({
|
59
|
-
data:
|
60
|
+
data: stringify(data),
|
60
61
|
name: `${shardId}.json`,
|
61
62
|
});
|
62
63
|
}
|
@@ -76,7 +77,7 @@ export async function processSnapshotERC20(options: {
|
|
76
77
|
// 6. Also upload the original entries for retrieving all entries
|
77
78
|
const originalEntriesUri = await upload({
|
78
79
|
client: options.client,
|
79
|
-
files: [
|
80
|
+
files: [stringify(options.snapshot)],
|
80
81
|
});
|
81
82
|
// 7. assmeble the final sharded merkle tree info
|
82
83
|
const shardedMerkleInfo: ShardedMerkleTreeInfo = {
|
@@ -2,6 +2,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
2
2
|
import { MerkleTree } from "../../../merkletree/MerkleTree.js";
|
3
3
|
import { upload } from "../../../storage/upload.js";
|
4
4
|
import type { Hex } from "../../encoding/hex.js";
|
5
|
+
import { stringify } from "../../json.js";
|
5
6
|
import { hashEntryERC721 } from "./hash-entry-erc721.js";
|
6
7
|
import type {
|
7
8
|
ShardDataERC721,
|
@@ -54,7 +55,7 @@ export async function processSnapshotERC721(options: {
|
|
54
55
|
entries,
|
55
56
|
};
|
56
57
|
shardsToUpload.push({
|
57
|
-
data:
|
58
|
+
data: stringify(data),
|
58
59
|
name: `${shardId}.json`,
|
59
60
|
});
|
60
61
|
}
|
@@ -74,7 +75,7 @@ export async function processSnapshotERC721(options: {
|
|
74
75
|
// 6. Also upload the original entries for retrieving all entries
|
75
76
|
const originalEntriesUri = await upload({
|
76
77
|
client: options.client,
|
77
|
-
files: [
|
78
|
+
files: [stringify(options.snapshot)],
|
78
79
|
});
|
79
80
|
// 7. assmeble the final sharded merkle tree info
|
80
81
|
const shardedMerkleInfo: ShardedMerkleTreeInfo = {
|
@@ -3,6 +3,7 @@ import type { ThirdwebClient } from "../../../client/client.js";
|
|
3
3
|
import { MerkleTree } from "../../../merkletree/MerkleTree.js";
|
4
4
|
import { upload } from "../../../storage/upload.js";
|
5
5
|
import type { Hex } from "../../encoding/hex.js";
|
6
|
+
import { stringify } from "../../json.js";
|
6
7
|
import { hashEntry } from "./hash-entry.js";
|
7
8
|
import type {
|
8
9
|
OverrideEntry,
|
@@ -67,7 +68,7 @@ export async function processOverrideList(options: {
|
|
67
68
|
entries,
|
68
69
|
};
|
69
70
|
shardsToUpload.push({
|
70
|
-
data:
|
71
|
+
data: stringify(data),
|
71
72
|
name: `${shardId}.json`,
|
72
73
|
});
|
73
74
|
}
|
@@ -87,7 +88,7 @@ export async function processOverrideList(options: {
|
|
87
88
|
// 6. Also upload the original entries for retrieving all entries
|
88
89
|
const originalEntriesUri = await upload({
|
89
90
|
client: options.client,
|
90
|
-
files: [
|
91
|
+
files: [stringify(options.overrides)],
|
91
92
|
});
|
92
93
|
// 7. assmeble the final sharded merkle tree info
|
93
94
|
const shardedMerkleInfo: ShardedMerkleTreeInfo = {
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { Account } from "../../wallets/interfaces/wallet.js";
|
2
2
|
import { stringToBytes } from "../encoding/to-bytes.js";
|
3
|
+
import { stringify } from "../json.js";
|
3
4
|
import { randomBytesHex } from "../random.js";
|
4
5
|
import { uint8ArrayToBase64 } from "../uint8-array.js";
|
5
6
|
import { PRECOMPILED_B64_ENCODED_JWT_HEADER } from "./jwt-header.js";
|
@@ -47,14 +48,13 @@ type EncodeJWTParams = { payload: JWTPayloadInput; account: Account };
|
|
47
48
|
*/
|
48
49
|
export async function encodeJWT(options: EncodeJWTParams) {
|
49
50
|
const payload = await ensureJWTPayload(options.payload);
|
50
|
-
const message =
|
51
|
+
const message = stringify(payload);
|
51
52
|
|
52
53
|
const signature = await options.account.signMessage({ message });
|
53
54
|
|
54
|
-
const encodedData = uint8ArrayToBase64(
|
55
|
-
|
56
|
-
|
57
|
-
);
|
55
|
+
const encodedData = uint8ArrayToBase64(stringToBytes(message), {
|
56
|
+
urlSafe: true,
|
57
|
+
});
|
58
58
|
|
59
59
|
const encodedSignature = uint8ArrayToBase64(stringToBytes(signature), {
|
60
60
|
urlSafe: true,
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
3
|
+
import { stringify } from "../json.js";
|
3
4
|
import {
|
4
5
|
type FetchTokenMetadataOptions,
|
5
6
|
fetchTokenMetadata,
|
@@ -9,7 +10,7 @@ describe("fetchTokenMetadata", () => {
|
|
9
10
|
it("should return a json object from a valid base64 encoded json", async () => {
|
10
11
|
const validJson = { foo: "bar" };
|
11
12
|
const validBase64Json = `data:application/json;base64,${btoa(
|
12
|
-
|
13
|
+
stringify(validJson),
|
13
14
|
)}`;
|
14
15
|
|
15
16
|
const options: FetchTokenMetadataOptions = {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { stringify } from "../json.js";
|
1
2
|
import type { AsyncStorage } from "./AsyncStorage.js";
|
2
3
|
|
3
4
|
const CONNECT_PARAMS_MAP_KEY = "tw:connected-wallet-params";
|
@@ -39,7 +40,7 @@ export async function saveConnectParamsToStorage<T extends object>(
|
|
39
40
|
};
|
40
41
|
}
|
41
42
|
|
42
|
-
storage.setItem(CONNECT_PARAMS_MAP_KEY,
|
43
|
+
storage.setItem(CONNECT_PARAMS_MAP_KEY, stringify(value));
|
43
44
|
}
|
44
45
|
|
45
46
|
/**
|
@@ -67,7 +68,7 @@ export async function deleteConnectParamsFromStorage(
|
|
67
68
|
}
|
68
69
|
|
69
70
|
delete value[walletId];
|
70
|
-
storage.setItem(CONNECT_PARAMS_MAP_KEY,
|
71
|
+
storage.setItem(CONNECT_PARAMS_MAP_KEY, stringify(value));
|
71
72
|
}
|
72
73
|
}
|
73
74
|
|
@@ -100,7 +101,7 @@ export async function getSavedConnectParamsFromStorage<T extends object>(
|
|
100
101
|
|
101
102
|
function isStringifiable(value: unknown): boolean {
|
102
103
|
try {
|
103
|
-
|
104
|
+
stringify(value);
|
104
105
|
return true;
|
105
106
|
} catch {
|
106
107
|
return false;
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.
|
1
|
+
export const version = "5.65.0-nightly-7a9713e877eb20b4e0d95964125b295feafc931a-20241102000323";
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
2
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
|
+
import { stringify } from "../../../../utils/json.js";
|
3
4
|
import { ROUTE_AUTH_ENDPOINT_CALLBACK } from "../../native/helpers/constants.js";
|
4
5
|
import { createErrorMessage } from "../../native/helpers/errors.js";
|
5
6
|
import type { Ecosystem } from "../wallet/types.js";
|
@@ -17,7 +18,7 @@ export async function authEndpoint(args: {
|
|
17
18
|
headers: {
|
18
19
|
"Content-Type": "application/json",
|
19
20
|
},
|
20
|
-
body:
|
21
|
+
body: stringify({
|
21
22
|
payload: args.payload,
|
22
23
|
developerClientId: args.client.clientId,
|
23
24
|
}),
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
2
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
|
+
import { stringify } from "../../../../utils/json.js";
|
3
4
|
import { randomBytesHex } from "../../../../utils/random.js";
|
4
5
|
import type { AsyncStorage } from "../../../../utils/storage/AsyncStorage.js";
|
5
6
|
import type { Ecosystem } from "../wallet/types.js";
|
@@ -39,7 +40,7 @@ export async function guestAuthenticate(args: {
|
|
39
40
|
headers: {
|
40
41
|
"Content-Type": "application/json",
|
41
42
|
},
|
42
|
-
body:
|
43
|
+
body: stringify({
|
43
44
|
sessionId,
|
44
45
|
}),
|
45
46
|
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
2
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
3
|
+
import { stringify } from "../../../../utils/json.js";
|
3
4
|
import { ROUTE_AUTH_JWT_CALLBACK } from "../../native/helpers/constants.js";
|
4
5
|
import { createErrorMessage } from "../../native/helpers/errors.js";
|
5
6
|
import type { Ecosystem } from "../wallet/types.js";
|
@@ -17,7 +18,7 @@ export async function customJwt(args: {
|
|
17
18
|
headers: {
|
18
19
|
"Content-Type": "application/json",
|
19
20
|
},
|
20
|
-
body:
|
21
|
+
body: stringify({
|
21
22
|
jwt: args.jwt,
|
22
23
|
developerClientId: args.client.clientId,
|
23
24
|
}),
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
2
|
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
3
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
4
|
+
import { stringify } from "../../../../utils/json.js";
|
4
5
|
import type { Ecosystem } from "../wallet/types.js";
|
5
6
|
import type { ClientScopedStorage } from "./client-scoped-storage.js";
|
6
7
|
import type { Profile } from "./types.js";
|
@@ -40,7 +41,7 @@ export async function linkAccount({
|
|
40
41
|
{
|
41
42
|
method: "POST",
|
42
43
|
headers,
|
43
|
-
body:
|
44
|
+
body: stringify({
|
44
45
|
accountAuthTokenToConnect: tokenToLink,
|
45
46
|
}),
|
46
47
|
},
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { ThirdwebClient } from "../../../../client/client.js";
|
2
2
|
import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
3
3
|
import { getClientFetch } from "../../../../utils/fetch.js";
|
4
|
+
import { stringify } from "../../../../utils/json.js";
|
4
5
|
import type { Ecosystem } from "../wallet/types.js";
|
5
6
|
import type { ClientScopedStorage } from "./client-scoped-storage.js";
|
6
7
|
import type { AuthStoredTokenWithCookieReturnType } from "./types.js";
|
@@ -96,7 +97,7 @@ export async function registerPasskey(options: {
|
|
96
97
|
"Content-Type": "application/json",
|
97
98
|
...customHeaders,
|
98
99
|
},
|
99
|
-
body:
|
100
|
+
body: stringify({
|
100
101
|
type: "sign-up",
|
101
102
|
authenticatorData: registration.authenticatorData,
|
102
103
|
credentialId: registration.credentialId,
|
@@ -166,7 +167,7 @@ export async function loginWithPasskey(options: {
|
|
166
167
|
"Content-Type": "application/json",
|
167
168
|
...customHeaders,
|
168
169
|
},
|
169
|
-
body:
|
170
|
+
body: stringify({
|
170
171
|
type: "sign-in",
|
171
172
|
authenticatorData: authentication.authenticatorData,
|
172
173
|
credentialId: authentication.credentialId,
|