thirdweb 5.64.0-nightly-e6e994479fb8386b1740de4170f33446f038f2b1-20241024000332 → 5.64.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/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -6
- package/dist/cjs/extensions/erc1155/write/mintAdditionalSupplyTo.js.map +1 -1
- package/dist/cjs/react/native/ui/components/WalletImage.js +3 -1
- package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +1 -1
- package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
- package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +20 -10
- package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +7 -2
- package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/de.js +1 -0
- 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 +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/es.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/fr.js +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/fr.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/ja.js +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/ja.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/kr.js +1 -0
- package/dist/cjs/react/web/wallets/shared/locale/kr.js.map +1 -1
- package/dist/cjs/react/web/wallets/shared/locale/tl.js +1 -0
- 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/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/ecosystem/get-ecosystem-wallet-auth-options.js +5 -0
- package/dist/cjs/wallets/ecosystem/get-ecosystem-wallet-auth-options.js.map +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +1 -1
- package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/cjs/wallets/types.js +1 -0
- package/dist/cjs/wallets/types.js.map +1 -1
- package/dist/esm/exports/pay.js +0 -1
- package/dist/esm/exports/pay.js.map +1 -1
- package/dist/esm/exports/react.js +0 -5
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/react.native.js +0 -2
- package/dist/esm/exports/react.native.js.map +1 -1
- package/dist/esm/exports/thirdweb.js +0 -1
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/exports/wallets/embedded.js +0 -1
- package/dist/esm/exports/wallets/embedded.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.js +0 -1
- package/dist/esm/exports/wallets/in-app.js.map +1 -1
- package/dist/esm/exports/wallets/in-app.native.js +0 -1
- package/dist/esm/exports/wallets/in-app.native.js.map +1 -1
- package/dist/esm/exports/wallets.js +0 -1
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/exports/wallets.native.js +0 -1
- package/dist/esm/exports/wallets.native.js.map +1 -1
- package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -6
- package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.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/web/wallets/ecosystem/EcosystemWalletConnectUI.js +1 -1
- package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
- package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js +20 -10
- package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +7 -2
- package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/de.js +1 -0
- 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 +1 -0
- package/dist/esm/react/web/wallets/shared/locale/es.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/fr.js +1 -0
- package/dist/esm/react/web/wallets/shared/locale/fr.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/ja.js +1 -0
- package/dist/esm/react/web/wallets/shared/locale/ja.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/kr.js +1 -0
- package/dist/esm/react/web/wallets/shared/locale/kr.js.map +1 -1
- package/dist/esm/react/web/wallets/shared/locale/tl.js +1 -0
- 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/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/ecosystem/get-ecosystem-wallet-auth-options.js +5 -0
- package/dist/esm/wallets/ecosystem/get-ecosystem-wallet-auth-options.js.map +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +1 -1
- package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
- package/dist/esm/wallets/types.js +1 -0
- package/dist/esm/wallets/types.js.map +1 -1
- package/dist/types/exports/pay.d.ts +1 -1
- package/dist/types/exports/pay.d.ts.map +1 -1
- package/dist/types/exports/react.d.ts +3 -3
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/react.native.d.ts +1 -1
- package/dist/types/exports/react.native.d.ts.map +1 -1
- package/dist/types/exports/thirdweb.d.ts +1 -1
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/exports/wallets/embedded.d.ts +1 -1
- package/dist/types/exports/wallets/embedded.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.d.ts +1 -1
- package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
- package/dist/types/exports/wallets/in-app.native.d.ts +1 -1
- package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -1
- package/dist/types/exports/wallets.d.ts +1 -1
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/exports/wallets.native.d.ts +1 -1
- package/dist/types/exports/wallets.native.d.ts.map +1 -1
- package/dist/types/extensions/erc1155/write/mintAdditionalSupplyTo.d.ts.map +1 -1
- package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
- package/dist/types/react/web/wallets/ecosystem/EcosystemWalletConnectUI.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/in-app/WalletAuth.d.ts +1 -0
- package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts +3 -1
- package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.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/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/ecosystem/get-ecosystem-wallet-auth-options.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +2 -2
- package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/types.d.ts +1 -1
- package/dist/types/wallets/types.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/exports/pay.ts +3 -3
- package/src/exports/react.native.ts +3 -3
- package/src/exports/react.ts +5 -5
- package/src/exports/thirdweb.ts +3 -3
- package/src/exports/wallets/embedded.ts +1 -1
- package/src/exports/wallets/in-app.native.ts +1 -1
- package/src/exports/wallets/in-app.ts +1 -1
- package/src/exports/wallets.native.ts +1 -1
- package/src/exports/wallets.ts +1 -1
- package/src/extensions/erc1155/drop1155.test.ts +164 -34
- package/src/extensions/erc1155/drops/read/getActiveClaimCondition.test.ts +0 -90
- package/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts +1 -7
- package/src/extensions/prebuilts/deploy-erc1155.test.ts +5 -5
- package/src/extensions/prebuilts/deploy-pack.test.ts +4 -2
- package/src/react/native/ui/components/WalletImage.tsx +3 -1
- package/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx +1 -0
- package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +1 -0
- package/src/react/web/wallets/in-app/WalletAuth.tsx +20 -10
- package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +19 -2
- package/src/react/web/wallets/shared/locale/de.ts +1 -0
- package/src/react/web/wallets/shared/locale/en.ts +1 -0
- package/src/react/web/wallets/shared/locale/es.ts +1 -0
- package/src/react/web/wallets/shared/locale/fr.ts +1 -0
- package/src/react/web/wallets/shared/locale/ja.ts +1 -0
- package/src/react/web/wallets/shared/locale/kr.ts +1 -0
- package/src/react/web/wallets/shared/locale/tl.ts +1 -0
- package/src/react/web/wallets/shared/locale/types.ts +1 -0
- package/src/react/web/wallets/shared/locale/vi.ts +1 -0
- package/src/version.ts +1 -1
- package/src/wallets/ecosystem/get-ecosystem-wallet-auth-options.ts +6 -0
- package/src/wallets/in-app/core/authentication/getLoginPath.ts +4 -4
- package/src/wallets/in-app/core/authentication/types.ts +1 -1
- package/src/wallets/types.ts +1 -0
- package/src/extensions/erc1155/drops/write/claimTo.test.ts +0 -185
- package/src/extensions/erc1155/drops/write/updateMetadata.test.ts +0 -54
@@ -1,22 +1,8 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
|
-
|
3
|
-
import { ANVIL_CHAIN } from "~test/chains.js";
|
4
|
-
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
5
|
-
import { TEST_CLIENT } from "~test/test-clients.js";
|
6
2
|
import { MAX_UINT256 } from "~test/test-consts.js";
|
7
|
-
import { TEST_ACCOUNT_B } from "~test/test-wallets.js";
|
8
3
|
import { DROP1155_CONTRACT } from "../../../../../test/src/test-contracts.js";
|
9
|
-
import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js";
|
10
|
-
import { getContract } from "../../../../contract/contract.js";
|
11
|
-
import { generateMerkleTreeInfoERC1155 } from "../../../../extensions/airdrop/write/merkleInfoERC1155.js";
|
12
|
-
import { deployERC1155Contract } from "../../../../extensions/prebuilts/deploy-erc1155.js";
|
13
|
-
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
|
14
|
-
import { lazyMint } from "../../write/lazyMint.js";
|
15
|
-
import { setClaimConditions } from "../write/setClaimConditions.js";
|
16
4
|
import { getActiveClaimCondition } from "./getActiveClaimCondition.js";
|
17
5
|
|
18
|
-
const account = TEST_ACCOUNT_B;
|
19
|
-
|
20
6
|
describe.runIf(process.env.TW_SECRET_KEY)("erc1155.getClaimConditions", () => {
|
21
7
|
it("should return the correct claim conditions", async () => {
|
22
8
|
const cc = await getActiveClaimCondition({
|
@@ -36,80 +22,4 @@ describe.runIf(process.env.TW_SECRET_KEY)("erc1155.getClaimConditions", () => {
|
|
36
22
|
});
|
37
23
|
// 1 call for the condition id and 1 call for the condition
|
38
24
|
});
|
39
|
-
|
40
|
-
it("should return the correct claim condition for the public allowlist claim phase", async () => {
|
41
|
-
const address = await deployERC1155Contract({
|
42
|
-
client: TEST_CLIENT,
|
43
|
-
chain: ANVIL_CHAIN,
|
44
|
-
account,
|
45
|
-
type: "DropERC1155",
|
46
|
-
params: {
|
47
|
-
name: "EditionDrop",
|
48
|
-
contractURI: TEST_CONTRACT_URI,
|
49
|
-
},
|
50
|
-
});
|
51
|
-
const contract = getContract({
|
52
|
-
address,
|
53
|
-
chain: ANVIL_CHAIN,
|
54
|
-
client: TEST_CLIENT,
|
55
|
-
});
|
56
|
-
|
57
|
-
// Upload an NFT
|
58
|
-
const lzMint = lazyMint({ contract, nfts: [{ name: "token #0" }] });
|
59
|
-
await sendAndConfirmTransaction({
|
60
|
-
transaction: lzMint,
|
61
|
-
account,
|
62
|
-
});
|
63
|
-
|
64
|
-
// Create a public allowlist claim phase
|
65
|
-
const snapshot = [
|
66
|
-
{
|
67
|
-
recipient: "0x12345674b599ce99958242b3D3741e7b01841DF3",
|
68
|
-
tokenId: 0,
|
69
|
-
amount: 5,
|
70
|
-
},
|
71
|
-
{
|
72
|
-
recipient: "0x89f84D4e4ecaBa42233EEfc46eE49a03Db943bAD",
|
73
|
-
tokenId: 0,
|
74
|
-
amount: 5,
|
75
|
-
},
|
76
|
-
];
|
77
|
-
|
78
|
-
const { merkleRoot } = await generateMerkleTreeInfoERC1155({
|
79
|
-
contract,
|
80
|
-
tokenAddress: NATIVE_TOKEN_ADDRESS,
|
81
|
-
snapshot,
|
82
|
-
});
|
83
|
-
|
84
|
-
const startTime = new Date();
|
85
|
-
const setCC = setClaimConditions({
|
86
|
-
contract,
|
87
|
-
tokenId: 0n,
|
88
|
-
phases: [
|
89
|
-
{
|
90
|
-
maxClaimableSupply: 100n,
|
91
|
-
maxClaimablePerWallet: 5n,
|
92
|
-
currencyAddress: NATIVE_TOKEN_ADDRESS,
|
93
|
-
price: 0.006,
|
94
|
-
startTime,
|
95
|
-
merkleRootHash: merkleRoot,
|
96
|
-
},
|
97
|
-
],
|
98
|
-
});
|
99
|
-
|
100
|
-
await sendAndConfirmTransaction({
|
101
|
-
transaction: setCC,
|
102
|
-
account,
|
103
|
-
});
|
104
|
-
|
105
|
-
const activeCC = await getActiveClaimCondition({ contract, tokenId: 0n });
|
106
|
-
expect(activeCC.currency.toLowerCase()).toBe(
|
107
|
-
NATIVE_TOKEN_ADDRESS.toLowerCase(),
|
108
|
-
);
|
109
|
-
expect(activeCC.merkleRoot).toBe(
|
110
|
-
"0xbfa52e7f255395704d8ea7174ec56f1357e6a1946753fcd64000adb4aeb3ca4a",
|
111
|
-
);
|
112
|
-
expect(activeCC.pricePerToken).toBe(6000000000000000n);
|
113
|
-
expect(activeCC.quantityLimitPerWallet).toBe(5n);
|
114
|
-
});
|
115
25
|
});
|
@@ -38,16 +38,10 @@ export function mintAdditionalSupplyTo(
|
|
38
38
|
return MintTo.mintTo({
|
39
39
|
contract: options.contract,
|
40
40
|
asyncParams: async () => {
|
41
|
-
// we'll be re-using the exising token URI
|
42
|
-
const tokenUri = await URI.uri({
|
43
|
-
contract: options.contract,
|
44
|
-
tokenId: options.tokenId,
|
45
|
-
});
|
46
|
-
|
47
41
|
return {
|
48
42
|
to: options.to,
|
49
43
|
tokenId: options.tokenId,
|
50
|
-
uri:
|
44
|
+
uri: "", // contract will maintain the existing token URI
|
51
45
|
amount: options.supply,
|
52
46
|
};
|
53
47
|
},
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
|
3
3
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_B } from "../../../test/src/test-wallets.js";
|
5
5
|
import { getContract } from "../../contract/contract.js";
|
6
6
|
import { name } from "../common/read/name.js";
|
7
7
|
import { deployERC1155Contract } from "./deploy-erc1155.js";
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
const account = TEST_ACCOUNT_B;
|
10
|
+
|
11
11
|
describe.runIf(process.env.TW_SECRET_KEY)("deployERC1155", () => {
|
12
12
|
it("should deploy ERC1155 drop", async () => {
|
13
13
|
const address = await deployERC1155Contract({
|
14
14
|
client: TEST_CLIENT,
|
15
15
|
chain: ANVIL_CHAIN,
|
16
|
-
account
|
16
|
+
account,
|
17
17
|
type: "DropERC1155",
|
18
18
|
params: {
|
19
19
|
name: "EditionDrop",
|
@@ -35,7 +35,7 @@ describe.runIf(process.env.TW_SECRET_KEY)("deployERC1155", () => {
|
|
35
35
|
const address = await deployERC1155Contract({
|
36
36
|
client: TEST_CLIENT,
|
37
37
|
chain: ANVIL_CHAIN,
|
38
|
-
account
|
38
|
+
account,
|
39
39
|
type: "TokenERC1155",
|
40
40
|
params: {
|
41
41
|
name: "Edition",
|
@@ -1,14 +1,16 @@
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
2
2
|
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
3
|
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import {
|
4
|
+
import { TEST_ACCOUNT_C } from "~test/test-wallets.js";
|
5
5
|
import { isAddress } from "../../utils/address.js";
|
6
6
|
import { deployPackContract } from "./deploy-pack.js";
|
7
7
|
|
8
|
+
const account = TEST_ACCOUNT_C;
|
9
|
+
|
8
10
|
describe.runIf(process.env.TW_SECRET_KEY)("deploy-pack contract", () => {
|
9
11
|
it("should deploy Pack contract", async () => {
|
10
12
|
const address = await deployPackContract({
|
11
|
-
account
|
13
|
+
account,
|
12
14
|
client: TEST_CLIENT,
|
13
15
|
chain: ANVIL_CHAIN,
|
14
16
|
params: {
|
@@ -60,7 +60,9 @@ export const WalletImage = (props: {
|
|
60
60
|
try {
|
61
61
|
const externalWalletImage = await getWalletInfo(activeEOAId, true);
|
62
62
|
if (externalWalletImage) {
|
63
|
-
return
|
63
|
+
return externalWalletImage.startsWith("ipfs://")
|
64
|
+
? resolveScheme({ client, uri: externalWalletImage })
|
65
|
+
: externalWalletImage;
|
64
66
|
}
|
65
67
|
} catch {}
|
66
68
|
|
@@ -28,6 +28,7 @@ export function WalletAuth(props: {
|
|
28
28
|
inAppLocale: InAppWalletLocale;
|
29
29
|
onBack: () => void;
|
30
30
|
walletConnect: { projectId?: string } | undefined;
|
31
|
+
isLinking: boolean;
|
31
32
|
meta?: {
|
32
33
|
title?: string;
|
33
34
|
titleIconUrl?: string;
|
@@ -61,16 +62,25 @@ export function WalletAuth(props: {
|
|
61
62
|
setStatus("loading");
|
62
63
|
walletToConnect.current = walletToLink;
|
63
64
|
try {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
65
|
+
if (props.isLinking) {
|
66
|
+
await linkProfile({
|
67
|
+
client: props.client,
|
68
|
+
strategy: "wallet",
|
69
|
+
wallet: walletToLink,
|
70
|
+
chain: wallet.getChain() || defineChain(1),
|
71
|
+
ecosystem,
|
72
|
+
}).catch((e) => {
|
73
|
+
setError(e.message);
|
74
|
+
throw e;
|
75
|
+
});
|
76
|
+
} else {
|
77
|
+
await wallet.connect({
|
78
|
+
client: props.client,
|
79
|
+
strategy: "wallet",
|
80
|
+
wallet: walletToLink,
|
81
|
+
chain: walletToLink.getChain() || defineChain(1),
|
82
|
+
});
|
83
|
+
}
|
74
84
|
addConnectedWallet(walletToLink);
|
75
85
|
done();
|
76
86
|
} catch {
|
@@ -57,7 +57,9 @@ export type ConnectWalletSelectUIState =
|
|
57
57
|
connectionPromise: Promise<Account | Profile[]>;
|
58
58
|
};
|
59
59
|
passkeyLogin?: boolean;
|
60
|
-
walletLogin?:
|
60
|
+
walletLogin?: {
|
61
|
+
linking: boolean;
|
62
|
+
};
|
61
63
|
};
|
62
64
|
|
63
65
|
const defaultAuthOptions: AuthOption[] = [
|
@@ -186,6 +188,7 @@ export const ConnectWalletSocialOptions = (
|
|
186
188
|
|
187
189
|
const passKeyEnabled = authOptions.includes("passkey");
|
188
190
|
const guestEnabled = authOptions.includes("guest");
|
191
|
+
const siweEnabled = authOptions.includes("wallet");
|
189
192
|
|
190
193
|
const placeholder =
|
191
194
|
inputMode === "email" ? locale.emailPlaceholder : locale.phonePlaceholder;
|
@@ -306,7 +309,9 @@ export const ConnectWalletSocialOptions = (
|
|
306
309
|
|
307
310
|
function handleWalletLogin() {
|
308
311
|
setData({
|
309
|
-
walletLogin:
|
312
|
+
walletLogin: {
|
313
|
+
linking: props.isLinking || false,
|
314
|
+
},
|
310
315
|
});
|
311
316
|
props.select();
|
312
317
|
}
|
@@ -467,6 +472,18 @@ export const ConnectWalletSocialOptions = (
|
|
467
472
|
/>
|
468
473
|
)}
|
469
474
|
|
475
|
+
{/* SIWE login */}
|
476
|
+
{siweEnabled && (
|
477
|
+
<WalletTypeRowButton
|
478
|
+
client={props.client}
|
479
|
+
icon={getSocialIcon("")}
|
480
|
+
onClick={() => {
|
481
|
+
handleWalletLogin();
|
482
|
+
}}
|
483
|
+
title={locale.signInWithWallet}
|
484
|
+
/>
|
485
|
+
)}
|
486
|
+
|
470
487
|
{/* Guest login */}
|
471
488
|
{guestEnabled && (
|
472
489
|
<WalletTypeRowButton
|
@@ -55,6 +55,7 @@ export default {
|
|
55
55
|
signInWithPhone: "Sign in with phone number",
|
56
56
|
phoneRequired: "Phone number is required",
|
57
57
|
passkey: "Passkey",
|
58
|
+
signInWithWallet: "Sign in with Wallet",
|
58
59
|
linkWallet: "Link a Wallet",
|
59
60
|
loginAsGuest: "Continue as guest",
|
60
61
|
} satisfies InAppWalletLocale;
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.64.0
|
1
|
+
export const version = "5.64.0";
|
@@ -40,5 +40,11 @@ export async function getEcosystemOptions(
|
|
40
40
|
);
|
41
41
|
}
|
42
42
|
|
43
|
+
// siwe is the auth option in the backend, but we want to use wallet as the auth option in the frontend
|
44
|
+
if (data.authOptions?.includes("siwe")) {
|
45
|
+
data.authOptions = data.authOptions.filter((o: string) => o !== "siwe");
|
46
|
+
data.authOptions.push("wallet");
|
47
|
+
}
|
48
|
+
|
43
49
|
return data ?? null;
|
44
50
|
}
|
@@ -3,8 +3,8 @@ import { getThirdwebBaseUrl } from "../../../../utils/domains.js";
|
|
3
3
|
import { type AuthOption, authOptions } from "../../../../wallets/types.js";
|
4
4
|
import type { Ecosystem } from "../wallet/types.js";
|
5
5
|
|
6
|
-
const getLoginOptionRoute = (option: AuthOption
|
7
|
-
if (!authOptions.includes(option as AuthOption)
|
6
|
+
const getLoginOptionRoute = (option: AuthOption) => {
|
7
|
+
if (!authOptions.includes(option as AuthOption)) {
|
8
8
|
throw new Error(`Unknown auth option ${option}`);
|
9
9
|
}
|
10
10
|
switch (option) {
|
@@ -22,7 +22,7 @@ export const getLoginUrl = ({
|
|
22
22
|
mode = "popup",
|
23
23
|
redirectUrl,
|
24
24
|
}: {
|
25
|
-
authOption: AuthOption
|
25
|
+
authOption: AuthOption;
|
26
26
|
client: ThirdwebClient;
|
27
27
|
ecosystem?: Ecosystem;
|
28
28
|
mode?: "popup" | "redirect" | "window";
|
@@ -60,7 +60,7 @@ export const getLoginCallbackUrl = ({
|
|
60
60
|
client,
|
61
61
|
ecosystem,
|
62
62
|
}: {
|
63
|
-
authOption: AuthOption
|
63
|
+
authOption: AuthOption;
|
64
64
|
client: ThirdwebClient;
|
65
65
|
ecosystem?: Ecosystem;
|
66
66
|
}): string => {
|
package/src/wallets/types.ts
CHANGED
@@ -1,185 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
2
|
-
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
-
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import { TEST_ACCOUNT_A, TEST_ACCOUNT_B } from "~test/test-wallets.js";
|
5
|
-
|
6
|
-
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
7
|
-
import { NATIVE_TOKEN_ADDRESS } from "../../../../constants/addresses.js";
|
8
|
-
import { getContract } from "../../../../contract/contract.js";
|
9
|
-
import { deployERC20Contract } from "../../../../extensions/prebuilts/deploy-erc20.js";
|
10
|
-
import { deployERC1155Contract } from "../../../../extensions/prebuilts/deploy-erc1155.js";
|
11
|
-
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
|
12
|
-
import { totalSupply } from "../../__generated__/IERC1155/read/totalSupply.js";
|
13
|
-
import { lazyMint } from "../../write/lazyMint.js";
|
14
|
-
import { claimTo } from "./claimTo.js";
|
15
|
-
import { setClaimConditions } from "./setClaimConditions.js";
|
16
|
-
|
17
|
-
const account = TEST_ACCOUNT_A;
|
18
|
-
const client = TEST_CLIENT;
|
19
|
-
const chain = ANVIL_CHAIN;
|
20
|
-
|
21
|
-
describe.runIf(process.env.TW_SECRET_KEY)("erc1155 claimTo extension", () => {
|
22
|
-
it("should claim the nft", async () => {
|
23
|
-
const address = await deployERC1155Contract({
|
24
|
-
client,
|
25
|
-
chain,
|
26
|
-
account,
|
27
|
-
type: "DropERC1155",
|
28
|
-
params: {
|
29
|
-
name: "Edition Drop",
|
30
|
-
contractURI: TEST_CONTRACT_URI,
|
31
|
-
},
|
32
|
-
});
|
33
|
-
const contract = getContract({
|
34
|
-
address,
|
35
|
-
client,
|
36
|
-
chain,
|
37
|
-
});
|
38
|
-
const lazyMintTx = lazyMint({ contract, nfts: [{ name: "token 0" }] });
|
39
|
-
await sendAndConfirmTransaction({ transaction: lazyMintTx, account });
|
40
|
-
const setClaimTx = setClaimConditions({
|
41
|
-
contract,
|
42
|
-
tokenId: 0n,
|
43
|
-
phases: [
|
44
|
-
{
|
45
|
-
maxClaimableSupply: 100n,
|
46
|
-
maxClaimablePerWallet: 100n,
|
47
|
-
currencyAddress: NATIVE_TOKEN_ADDRESS,
|
48
|
-
price: 0.1,
|
49
|
-
startTime: new Date(),
|
50
|
-
},
|
51
|
-
],
|
52
|
-
});
|
53
|
-
await sendAndConfirmTransaction({ transaction: setClaimTx, account });
|
54
|
-
|
55
|
-
const transaction = claimTo({
|
56
|
-
contract,
|
57
|
-
tokenId: 0n,
|
58
|
-
quantity: 1n,
|
59
|
-
to: account.address,
|
60
|
-
});
|
61
|
-
await sendAndConfirmTransaction({ transaction, account });
|
62
|
-
const supplyCount = await totalSupply({ contract, id: 0n });
|
63
|
-
expect(supplyCount).toBe(1n);
|
64
|
-
});
|
65
|
-
|
66
|
-
it("should claim with allowlist", async () => {
|
67
|
-
const address = await deployERC1155Contract({
|
68
|
-
client,
|
69
|
-
chain,
|
70
|
-
account,
|
71
|
-
type: "DropERC1155",
|
72
|
-
params: {
|
73
|
-
name: "Edition Drop",
|
74
|
-
contractURI: TEST_CONTRACT_URI,
|
75
|
-
},
|
76
|
-
});
|
77
|
-
const contract = getContract({
|
78
|
-
address,
|
79
|
-
client,
|
80
|
-
chain,
|
81
|
-
});
|
82
|
-
const lazyMintTx = lazyMint({ contract, nfts: [{ name: "token 0" }] });
|
83
|
-
await sendAndConfirmTransaction({ transaction: lazyMintTx, account });
|
84
|
-
const setClaimTx = setClaimConditions({
|
85
|
-
contract,
|
86
|
-
tokenId: 0n,
|
87
|
-
phases: [
|
88
|
-
{
|
89
|
-
maxClaimableSupply: 100n,
|
90
|
-
maxClaimablePerWallet: 5n,
|
91
|
-
currencyAddress: NATIVE_TOKEN_ADDRESS,
|
92
|
-
price: 0.06,
|
93
|
-
startTime: new Date(),
|
94
|
-
overrideList: [
|
95
|
-
{
|
96
|
-
address: TEST_ACCOUNT_B.address,
|
97
|
-
maxClaimable: "50",
|
98
|
-
price: "0.3",
|
99
|
-
currencyAddress: NATIVE_TOKEN_ADDRESS,
|
100
|
-
},
|
101
|
-
],
|
102
|
-
},
|
103
|
-
],
|
104
|
-
});
|
105
|
-
await sendAndConfirmTransaction({ transaction: setClaimTx, account });
|
106
|
-
|
107
|
-
const transaction = claimTo({
|
108
|
-
contract,
|
109
|
-
tokenId: 0n,
|
110
|
-
quantity: 50n,
|
111
|
-
to: TEST_ACCOUNT_B.address,
|
112
|
-
});
|
113
|
-
await sendAndConfirmTransaction({ transaction, account: TEST_ACCOUNT_B });
|
114
|
-
const supplyCount = await totalSupply({ contract, id: 0n });
|
115
|
-
expect(supplyCount).toBe(50n);
|
116
|
-
});
|
117
|
-
|
118
|
-
/**
|
119
|
-
* This is to document the behavior where one can claim without paying if the claiming address
|
120
|
-
* is the same as the PrimaryRecipientAddress, because of this Solidity code:
|
121
|
-
* ```solidity
|
122
|
-
* // CurrencyTransferLib.sol
|
123
|
-
* function safeTransferERC20(address _currency, address _from, address _to, uint256 _amount) internal {
|
124
|
-
* if (_from == _to) {
|
125
|
-
* return;
|
126
|
-
* }
|
127
|
-
* ...
|
128
|
-
* }
|
129
|
-
* ```
|
130
|
-
*/
|
131
|
-
it("address that is the same with PrimaryFeeRecipient can claim without paying ERC20", async () => {
|
132
|
-
const tokenAddress = await deployERC20Contract({
|
133
|
-
client,
|
134
|
-
chain,
|
135
|
-
account,
|
136
|
-
type: "TokenERC20",
|
137
|
-
params: {
|
138
|
-
name: "token20",
|
139
|
-
contractURI: TEST_CONTRACT_URI,
|
140
|
-
},
|
141
|
-
});
|
142
|
-
const address = await deployERC1155Contract({
|
143
|
-
client,
|
144
|
-
chain,
|
145
|
-
account,
|
146
|
-
type: "DropERC1155",
|
147
|
-
params: {
|
148
|
-
name: "Edition Drop",
|
149
|
-
contractURI: TEST_CONTRACT_URI,
|
150
|
-
saleRecipient: account.address,
|
151
|
-
},
|
152
|
-
});
|
153
|
-
const contract = getContract({
|
154
|
-
address,
|
155
|
-
client,
|
156
|
-
chain,
|
157
|
-
});
|
158
|
-
const lazyMintTx = lazyMint({ contract, nfts: [{ name: "token 0" }] });
|
159
|
-
await sendAndConfirmTransaction({ transaction: lazyMintTx, account });
|
160
|
-
const setClaimTx = setClaimConditions({
|
161
|
-
contract,
|
162
|
-
tokenId: 0n,
|
163
|
-
phases: [
|
164
|
-
{
|
165
|
-
maxClaimableSupply: 100n,
|
166
|
-
maxClaimablePerWallet: 100n,
|
167
|
-
currencyAddress: tokenAddress,
|
168
|
-
price: 1000,
|
169
|
-
startTime: new Date(),
|
170
|
-
},
|
171
|
-
],
|
172
|
-
});
|
173
|
-
await sendAndConfirmTransaction({ transaction: setClaimTx, account });
|
174
|
-
|
175
|
-
const transaction = claimTo({
|
176
|
-
contract,
|
177
|
-
tokenId: 0n,
|
178
|
-
quantity: 1n,
|
179
|
-
to: account.address,
|
180
|
-
});
|
181
|
-
await sendAndConfirmTransaction({ transaction, account });
|
182
|
-
const supplyCount = await totalSupply({ contract, id: 0n });
|
183
|
-
expect(supplyCount).toBe(1n);
|
184
|
-
});
|
185
|
-
});
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
2
|
-
import { ANVIL_CHAIN } from "~test/chains.js";
|
3
|
-
import { TEST_CLIENT } from "~test/test-clients.js";
|
4
|
-
import { TEST_ACCOUNT_A } from "~test/test-wallets.js";
|
5
|
-
|
6
|
-
import { TEST_CONTRACT_URI } from "~test/ipfs-uris.js";
|
7
|
-
import { getContract } from "../../../../contract/contract.js";
|
8
|
-
import { deployERC1155Contract } from "../../../../extensions/prebuilts/deploy-erc1155.js";
|
9
|
-
import { sendAndConfirmTransaction } from "../../../../transaction/actions/send-and-confirm-transaction.js";
|
10
|
-
import { getNFTs } from "../../read/getNFTs.js";
|
11
|
-
import { lazyMint } from "../../write/lazyMint.js";
|
12
|
-
import { updateMetadata } from "./updateMetadata.js";
|
13
|
-
|
14
|
-
const account = TEST_ACCOUNT_A;
|
15
|
-
const client = TEST_CLIENT;
|
16
|
-
const chain = ANVIL_CHAIN;
|
17
|
-
describe.runIf(process.env.TW_SECRET_KEY)("updateMetadata ERC1155", () => {
|
18
|
-
it("should update metadata", async () => {
|
19
|
-
const address = await deployERC1155Contract({
|
20
|
-
client,
|
21
|
-
chain,
|
22
|
-
account,
|
23
|
-
type: "DropERC1155",
|
24
|
-
params: {
|
25
|
-
name: "Edition Drop",
|
26
|
-
contractURI: TEST_CONTRACT_URI,
|
27
|
-
},
|
28
|
-
});
|
29
|
-
const contract = getContract({
|
30
|
-
address,
|
31
|
-
client,
|
32
|
-
chain,
|
33
|
-
});
|
34
|
-
const lazyMintTx = lazyMint({
|
35
|
-
contract,
|
36
|
-
nfts: [{ name: "token 0" }, { name: "token 1" }, { name: "token 2" }],
|
37
|
-
});
|
38
|
-
await sendAndConfirmTransaction({ transaction: lazyMintTx, account });
|
39
|
-
|
40
|
-
const updateTx = updateMetadata({
|
41
|
-
contract,
|
42
|
-
targetTokenId: 1n,
|
43
|
-
newMetadata: { name: "token 1 - updated" },
|
44
|
-
});
|
45
|
-
await sendAndConfirmTransaction({ transaction: updateTx, account });
|
46
|
-
|
47
|
-
const nfts = await getNFTs({ contract });
|
48
|
-
|
49
|
-
expect(nfts.length).toBe(3);
|
50
|
-
expect(nfts[0]?.metadata.name).toBe("token 0");
|
51
|
-
expect(nfts[1]?.metadata.name).toBe("token 1 - updated");
|
52
|
-
expect(nfts[2]?.metadata.name).toBe("token 2");
|
53
|
-
});
|
54
|
-
});
|