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.
Files changed (179) hide show
  1. package/dist/cjs/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -6
  2. package/dist/cjs/extensions/erc1155/write/mintAdditionalSupplyTo.js.map +1 -1
  3. package/dist/cjs/react/native/ui/components/WalletImage.js +3 -1
  4. package/dist/cjs/react/native/ui/components/WalletImage.js.map +1 -1
  5. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +1 -1
  6. package/dist/cjs/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
  7. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
  8. package/dist/cjs/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  9. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js +20 -10
  10. package/dist/cjs/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  11. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js +7 -2
  12. package/dist/cjs/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  13. package/dist/cjs/react/web/wallets/shared/locale/de.js +1 -0
  14. package/dist/cjs/react/web/wallets/shared/locale/de.js.map +1 -1
  15. package/dist/cjs/react/web/wallets/shared/locale/en.js +1 -0
  16. package/dist/cjs/react/web/wallets/shared/locale/en.js.map +1 -1
  17. package/dist/cjs/react/web/wallets/shared/locale/es.js +1 -0
  18. package/dist/cjs/react/web/wallets/shared/locale/es.js.map +1 -1
  19. package/dist/cjs/react/web/wallets/shared/locale/fr.js +1 -0
  20. package/dist/cjs/react/web/wallets/shared/locale/fr.js.map +1 -1
  21. package/dist/cjs/react/web/wallets/shared/locale/ja.js +1 -0
  22. package/dist/cjs/react/web/wallets/shared/locale/ja.js.map +1 -1
  23. package/dist/cjs/react/web/wallets/shared/locale/kr.js +1 -0
  24. package/dist/cjs/react/web/wallets/shared/locale/kr.js.map +1 -1
  25. package/dist/cjs/react/web/wallets/shared/locale/tl.js +1 -0
  26. package/dist/cjs/react/web/wallets/shared/locale/tl.js.map +1 -1
  27. package/dist/cjs/react/web/wallets/shared/locale/vi.js +1 -0
  28. package/dist/cjs/react/web/wallets/shared/locale/vi.js.map +1 -1
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/cjs/version.js.map +1 -1
  31. package/dist/cjs/wallets/ecosystem/get-ecosystem-wallet-auth-options.js +5 -0
  32. package/dist/cjs/wallets/ecosystem/get-ecosystem-wallet-auth-options.js.map +1 -1
  33. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js +1 -1
  34. package/dist/cjs/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  35. package/dist/cjs/wallets/types.js +1 -0
  36. package/dist/cjs/wallets/types.js.map +1 -1
  37. package/dist/esm/exports/pay.js +0 -1
  38. package/dist/esm/exports/pay.js.map +1 -1
  39. package/dist/esm/exports/react.js +0 -5
  40. package/dist/esm/exports/react.js.map +1 -1
  41. package/dist/esm/exports/react.native.js +0 -2
  42. package/dist/esm/exports/react.native.js.map +1 -1
  43. package/dist/esm/exports/thirdweb.js +0 -1
  44. package/dist/esm/exports/thirdweb.js.map +1 -1
  45. package/dist/esm/exports/wallets/embedded.js +0 -1
  46. package/dist/esm/exports/wallets/embedded.js.map +1 -1
  47. package/dist/esm/exports/wallets/in-app.js +0 -1
  48. package/dist/esm/exports/wallets/in-app.js.map +1 -1
  49. package/dist/esm/exports/wallets/in-app.native.js +0 -1
  50. package/dist/esm/exports/wallets/in-app.native.js.map +1 -1
  51. package/dist/esm/exports/wallets.js +0 -1
  52. package/dist/esm/exports/wallets.js.map +1 -1
  53. package/dist/esm/exports/wallets.native.js +0 -1
  54. package/dist/esm/exports/wallets.native.js.map +1 -1
  55. package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.js +1 -6
  56. package/dist/esm/extensions/erc1155/write/mintAdditionalSupplyTo.js.map +1 -1
  57. package/dist/esm/react/native/ui/components/WalletImage.js +3 -1
  58. package/dist/esm/react/native/ui/components/WalletImage.js.map +1 -1
  59. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js +1 -1
  60. package/dist/esm/react/web/wallets/ecosystem/EcosystemWalletConnectUI.js.map +1 -1
  61. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js +1 -1
  62. package/dist/esm/react/web/wallets/in-app/InAppWalletConnectUI.js.map +1 -1
  63. package/dist/esm/react/web/wallets/in-app/WalletAuth.js +20 -10
  64. package/dist/esm/react/web/wallets/in-app/WalletAuth.js.map +1 -1
  65. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js +7 -2
  66. package/dist/esm/react/web/wallets/shared/ConnectWalletSocialOptions.js.map +1 -1
  67. package/dist/esm/react/web/wallets/shared/locale/de.js +1 -0
  68. package/dist/esm/react/web/wallets/shared/locale/de.js.map +1 -1
  69. package/dist/esm/react/web/wallets/shared/locale/en.js +1 -0
  70. package/dist/esm/react/web/wallets/shared/locale/en.js.map +1 -1
  71. package/dist/esm/react/web/wallets/shared/locale/es.js +1 -0
  72. package/dist/esm/react/web/wallets/shared/locale/es.js.map +1 -1
  73. package/dist/esm/react/web/wallets/shared/locale/fr.js +1 -0
  74. package/dist/esm/react/web/wallets/shared/locale/fr.js.map +1 -1
  75. package/dist/esm/react/web/wallets/shared/locale/ja.js +1 -0
  76. package/dist/esm/react/web/wallets/shared/locale/ja.js.map +1 -1
  77. package/dist/esm/react/web/wallets/shared/locale/kr.js +1 -0
  78. package/dist/esm/react/web/wallets/shared/locale/kr.js.map +1 -1
  79. package/dist/esm/react/web/wallets/shared/locale/tl.js +1 -0
  80. package/dist/esm/react/web/wallets/shared/locale/tl.js.map +1 -1
  81. package/dist/esm/react/web/wallets/shared/locale/vi.js +1 -0
  82. package/dist/esm/react/web/wallets/shared/locale/vi.js.map +1 -1
  83. package/dist/esm/version.js +1 -1
  84. package/dist/esm/version.js.map +1 -1
  85. package/dist/esm/wallets/ecosystem/get-ecosystem-wallet-auth-options.js +5 -0
  86. package/dist/esm/wallets/ecosystem/get-ecosystem-wallet-auth-options.js.map +1 -1
  87. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js +1 -1
  88. package/dist/esm/wallets/in-app/core/authentication/getLoginPath.js.map +1 -1
  89. package/dist/esm/wallets/types.js +1 -0
  90. package/dist/esm/wallets/types.js.map +1 -1
  91. package/dist/types/exports/pay.d.ts +1 -1
  92. package/dist/types/exports/pay.d.ts.map +1 -1
  93. package/dist/types/exports/react.d.ts +3 -3
  94. package/dist/types/exports/react.d.ts.map +1 -1
  95. package/dist/types/exports/react.native.d.ts +1 -1
  96. package/dist/types/exports/react.native.d.ts.map +1 -1
  97. package/dist/types/exports/thirdweb.d.ts +1 -1
  98. package/dist/types/exports/thirdweb.d.ts.map +1 -1
  99. package/dist/types/exports/wallets/embedded.d.ts +1 -1
  100. package/dist/types/exports/wallets/embedded.d.ts.map +1 -1
  101. package/dist/types/exports/wallets/in-app.d.ts +1 -1
  102. package/dist/types/exports/wallets/in-app.d.ts.map +1 -1
  103. package/dist/types/exports/wallets/in-app.native.d.ts +1 -1
  104. package/dist/types/exports/wallets/in-app.native.d.ts.map +1 -1
  105. package/dist/types/exports/wallets.d.ts +1 -1
  106. package/dist/types/exports/wallets.d.ts.map +1 -1
  107. package/dist/types/exports/wallets.native.d.ts +1 -1
  108. package/dist/types/exports/wallets.native.d.ts.map +1 -1
  109. package/dist/types/extensions/erc1155/write/mintAdditionalSupplyTo.d.ts.map +1 -1
  110. package/dist/types/react/native/ui/components/WalletImage.d.ts.map +1 -1
  111. package/dist/types/react/web/wallets/ecosystem/EcosystemWalletConnectUI.d.ts.map +1 -1
  112. package/dist/types/react/web/wallets/in-app/InAppWalletConnectUI.d.ts.map +1 -1
  113. package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts +1 -0
  114. package/dist/types/react/web/wallets/in-app/WalletAuth.d.ts.map +1 -1
  115. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts +3 -1
  116. package/dist/types/react/web/wallets/shared/ConnectWalletSocialOptions.d.ts.map +1 -1
  117. package/dist/types/react/web/wallets/shared/locale/de.d.ts +1 -0
  118. package/dist/types/react/web/wallets/shared/locale/de.d.ts.map +1 -1
  119. package/dist/types/react/web/wallets/shared/locale/en.d.ts +1 -0
  120. package/dist/types/react/web/wallets/shared/locale/en.d.ts.map +1 -1
  121. package/dist/types/react/web/wallets/shared/locale/es.d.ts +1 -0
  122. package/dist/types/react/web/wallets/shared/locale/es.d.ts.map +1 -1
  123. package/dist/types/react/web/wallets/shared/locale/fr.d.ts +1 -0
  124. package/dist/types/react/web/wallets/shared/locale/fr.d.ts.map +1 -1
  125. package/dist/types/react/web/wallets/shared/locale/ja.d.ts +1 -0
  126. package/dist/types/react/web/wallets/shared/locale/ja.d.ts.map +1 -1
  127. package/dist/types/react/web/wallets/shared/locale/kr.d.ts +1 -0
  128. package/dist/types/react/web/wallets/shared/locale/kr.d.ts.map +1 -1
  129. package/dist/types/react/web/wallets/shared/locale/tl.d.ts +1 -0
  130. package/dist/types/react/web/wallets/shared/locale/tl.d.ts.map +1 -1
  131. package/dist/types/react/web/wallets/shared/locale/types.d.ts +1 -0
  132. package/dist/types/react/web/wallets/shared/locale/types.d.ts.map +1 -1
  133. package/dist/types/react/web/wallets/shared/locale/vi.d.ts +1 -0
  134. package/dist/types/react/web/wallets/shared/locale/vi.d.ts.map +1 -1
  135. package/dist/types/version.d.ts +1 -1
  136. package/dist/types/version.d.ts.map +1 -1
  137. package/dist/types/wallets/ecosystem/get-ecosystem-wallet-auth-options.d.ts.map +1 -1
  138. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts +2 -2
  139. package/dist/types/wallets/in-app/core/authentication/getLoginPath.d.ts.map +1 -1
  140. package/dist/types/wallets/in-app/core/authentication/types.d.ts +1 -1
  141. package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
  142. package/dist/types/wallets/types.d.ts +1 -1
  143. package/dist/types/wallets/types.d.ts.map +1 -1
  144. package/package.json +19 -19
  145. package/src/exports/pay.ts +3 -3
  146. package/src/exports/react.native.ts +3 -3
  147. package/src/exports/react.ts +5 -5
  148. package/src/exports/thirdweb.ts +3 -3
  149. package/src/exports/wallets/embedded.ts +1 -1
  150. package/src/exports/wallets/in-app.native.ts +1 -1
  151. package/src/exports/wallets/in-app.ts +1 -1
  152. package/src/exports/wallets.native.ts +1 -1
  153. package/src/exports/wallets.ts +1 -1
  154. package/src/extensions/erc1155/drop1155.test.ts +164 -34
  155. package/src/extensions/erc1155/drops/read/getActiveClaimCondition.test.ts +0 -90
  156. package/src/extensions/erc1155/write/mintAdditionalSupplyTo.ts +1 -7
  157. package/src/extensions/prebuilts/deploy-erc1155.test.ts +5 -5
  158. package/src/extensions/prebuilts/deploy-pack.test.ts +4 -2
  159. package/src/react/native/ui/components/WalletImage.tsx +3 -1
  160. package/src/react/web/wallets/ecosystem/EcosystemWalletConnectUI.tsx +1 -0
  161. package/src/react/web/wallets/in-app/InAppWalletConnectUI.tsx +1 -0
  162. package/src/react/web/wallets/in-app/WalletAuth.tsx +20 -10
  163. package/src/react/web/wallets/shared/ConnectWalletSocialOptions.tsx +19 -2
  164. package/src/react/web/wallets/shared/locale/de.ts +1 -0
  165. package/src/react/web/wallets/shared/locale/en.ts +1 -0
  166. package/src/react/web/wallets/shared/locale/es.ts +1 -0
  167. package/src/react/web/wallets/shared/locale/fr.ts +1 -0
  168. package/src/react/web/wallets/shared/locale/ja.ts +1 -0
  169. package/src/react/web/wallets/shared/locale/kr.ts +1 -0
  170. package/src/react/web/wallets/shared/locale/tl.ts +1 -0
  171. package/src/react/web/wallets/shared/locale/types.ts +1 -0
  172. package/src/react/web/wallets/shared/locale/vi.ts +1 -0
  173. package/src/version.ts +1 -1
  174. package/src/wallets/ecosystem/get-ecosystem-wallet-auth-options.ts +6 -0
  175. package/src/wallets/in-app/core/authentication/getLoginPath.ts +4 -4
  176. package/src/wallets/in-app/core/authentication/types.ts +1 -1
  177. package/src/wallets/types.ts +1 -0
  178. package/src/extensions/erc1155/drops/write/claimTo.test.ts +0 -185
  179. 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: tokenUri,
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 { TEST_ACCOUNT_A } from "../../../test/src/test-wallets.js";
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
- // skip this test suite if there is no secret key available to test with
10
- // TODO: remove reliance on secret key during unit tests entirely
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: TEST_ACCOUNT_A,
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: TEST_ACCOUNT_A,
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 { TEST_ACCOUNT_A } from "~test/test-wallets.js";
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: TEST_ACCOUNT_A,
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 resolveScheme({ client, uri: externalWalletImage });
63
+ return externalWalletImage.startsWith("ipfs://")
64
+ ? resolveScheme({ client, uri: externalWalletImage })
65
+ : externalWalletImage;
64
66
  }
65
67
  } catch {}
66
68
 
@@ -129,6 +129,7 @@ function EcosystemWalletConnectUI(props: {
129
129
  done={done}
130
130
  onBack={goBackToMain || (() => setSelectionData({}))}
131
131
  locale={props.connectLocale}
132
+ isLinking={state.walletLogin.linking}
132
133
  />
133
134
  );
134
135
  }
@@ -116,6 +116,7 @@ function InAppWalletConnectUI(props: {
116
116
  done={done}
117
117
  onBack={goBackToMain || (() => setSelectionData({}))}
118
118
  locale={props.connectLocale}
119
+ isLinking={state.walletLogin.linking}
119
120
  />
120
121
  );
121
122
  }
@@ -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
- await linkProfile({
65
- client: props.client,
66
- strategy: "wallet",
67
- wallet: walletToLink,
68
- chain: wallet.getChain() || defineChain(1),
69
- ecosystem,
70
- }).catch((e) => {
71
- setError(e.message);
72
- throw e;
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?: boolean;
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: true,
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
@@ -58,4 +58,5 @@ export default {
58
58
  passkey: "Passkey",
59
59
  linkWallet: "Verknüpfen Sie eine Brieftasche",
60
60
  loginAsGuest: "Melden Sie sich als Gast an",
61
+ signInWithWallet: "Mit Wallet anmelden",
61
62
  } satisfies InAppWalletLocale;
@@ -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;
@@ -57,4 +57,5 @@ export default {
57
57
  passkey: "Clave de acceso",
58
58
  linkWallet: "Vincular una billetera",
59
59
  loginAsGuest: "Inicia sesión como invitado",
60
+ signInWithWallet: "Iniciar sesión con billetera",
60
61
  } satisfies InAppWalletLocale;
@@ -58,4 +58,5 @@ export default {
58
58
  passkey: "Passkey",
59
59
  linkWallet: "Lier un portefeuille",
60
60
  loginAsGuest: "Connectez-vous en tant qu'invité",
61
+ signInWithWallet: "Se connecter avec portefeuille",
61
62
  } satisfies InAppWalletLocale;
@@ -56,4 +56,5 @@ export default {
56
56
  passkey: "パスキー",
57
57
  linkWallet: "ウォレットをリンクする",
58
58
  loginAsGuest: "ゲストとしてログイン",
59
+ signInWithWallet: "ウォレットでログイン",
59
60
  } satisfies InAppWalletLocale;
@@ -54,4 +54,5 @@ export default {
54
54
  passkey: "비밀번호",
55
55
  linkWallet: "지갑 연결",
56
56
  loginAsGuest: "게스트로 로그인",
57
+ signInWithWallet: "지갑으로 로그인",
57
58
  } satisfies InAppWalletLocale;
@@ -57,4 +57,5 @@ export default {
57
57
  passkey: "Passkey",
58
58
  linkWallet: "Mag-link ng Wallet",
59
59
  loginAsGuest: "Mag-login bilang bisita",
60
+ signInWithWallet: "Mag-login gamit ang Wallet",
60
61
  } satisfies InAppWalletLocale;
@@ -41,6 +41,7 @@ export type InAppWalletLocale = {
41
41
  signInWithApple: string;
42
42
  signInWithFacebook: string;
43
43
  signInWithGoogle: string;
44
+ signInWithWallet: string;
44
45
  socialLoginScreen: {
45
46
  failed: string;
46
47
  instruction: string;
@@ -57,4 +57,5 @@ export default {
57
57
  passkey: "Passkey",
58
58
  linkWallet: "Link a Wallet",
59
59
  loginAsGuest: "Đăng nhập với tư cách khách",
60
+ signInWithWallet: "Đăng nhập bằng Wallet",
60
61
  } satisfies InAppWalletLocale;
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = "5.64.0-nightly-e6e994479fb8386b1740de4170f33446f038f2b1-20241024000332";
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 | "wallet") => {
7
- if (!authOptions.includes(option as AuthOption) && option !== "wallet") {
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 | "wallet";
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 | "wallet";
63
+ authOption: AuthOption;
64
64
  client: ThirdwebClient;
65
65
  ecosystem?: Ecosystem;
66
66
  }): string => {
@@ -112,7 +112,7 @@ export type OAuthRedirectObject = {
112
112
 
113
113
  // TODO: type this better for each auth provider
114
114
  export type Profile = {
115
- type: AuthOption | "wallet";
115
+ type: AuthOption;
116
116
  details: {
117
117
  id?: string;
118
118
  email?: string;
@@ -41,6 +41,7 @@ export const authOptions = [
41
41
  "email",
42
42
  "phone",
43
43
  "passkey",
44
+ "wallet",
44
45
  ] as const;
45
46
  export type AuthOption = (typeof authOptions)[number];
46
47
 
@@ -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
- });