thirdweb 5.60.1 → 5.61.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 (154) hide show
  1. package/dist/cjs/contract/deployment/utils/create-2-factory.js +53 -46
  2. package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
  3. package/dist/cjs/event/actions/get-events.js +4 -4
  4. package/dist/cjs/event/actions/get-events.js.map +1 -1
  5. package/dist/cjs/exports/extensions/unstoppable-domains.js +10 -0
  6. package/dist/cjs/exports/extensions/unstoppable-domains.js.map +1 -0
  7. package/dist/cjs/exports/react.js +4 -2
  8. package/dist/cjs/exports/react.js.map +1 -1
  9. package/dist/cjs/exports/react.native.js +3 -1
  10. package/dist/cjs/exports/react.native.js.map +1 -1
  11. package/dist/cjs/exports/wallets.js.map +1 -1
  12. package/dist/cjs/exports/wallets.native.js.map +1 -1
  13. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js +122 -0
  14. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js.map +1 -0
  15. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js +115 -0
  16. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js.map +1 -0
  17. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js +115 -0
  18. package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js.map +1 -0
  19. package/dist/cjs/extensions/unstoppable-domains/consts.js +5 -0
  20. package/dist/cjs/extensions/unstoppable-domains/consts.js.map +1 -0
  21. package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js +77 -0
  22. package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -0
  23. package/dist/cjs/extensions/unstoppable-domains/read/resolveName.js +60 -0
  24. package/dist/cjs/extensions/unstoppable-domains/read/resolveName.js.map +1 -0
  25. package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js +92 -0
  26. package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js.map +1 -0
  27. package/dist/cjs/react/native/hooks/wallets/useProfiles.js +3 -4
  28. package/dist/cjs/react/native/hooks/wallets/useProfiles.js.map +1 -1
  29. package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js +91 -0
  30. package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js.map +1 -0
  31. package/dist/cjs/react/web/hooks/wallets/useProfiles.js +3 -4
  32. package/dist/cjs/react/web/hooks/wallets/useProfiles.js.map +1 -1
  33. package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +2 -1
  34. package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/cjs/wallets/in-app/core/users/getUser.js +11 -8
  37. package/dist/cjs/wallets/in-app/core/users/getUser.js.map +1 -1
  38. package/dist/cjs/wallets/in-app/native/native-connector.js +1 -0
  39. package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
  40. package/dist/cjs/wallets/in-app/web/lib/auth/index.js +23 -16
  41. package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
  42. package/dist/cjs/wallets/in-app/web/lib/web-connector.js +1 -0
  43. package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
  44. package/dist/esm/contract/deployment/utils/create-2-factory.js +53 -46
  45. package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
  46. package/dist/esm/event/actions/get-events.js +4 -4
  47. package/dist/esm/event/actions/get-events.js.map +1 -1
  48. package/dist/esm/exports/extensions/unstoppable-domains.js +4 -0
  49. package/dist/esm/exports/extensions/unstoppable-domains.js.map +1 -0
  50. package/dist/esm/exports/react.js +1 -0
  51. package/dist/esm/exports/react.js.map +1 -1
  52. package/dist/esm/exports/react.native.js +1 -0
  53. package/dist/esm/exports/react.native.js.map +1 -1
  54. package/dist/esm/exports/wallets.js.map +1 -1
  55. package/dist/esm/exports/wallets.native.js.map +1 -1
  56. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js +114 -0
  57. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js.map +1 -0
  58. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js +107 -0
  59. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js.map +1 -0
  60. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js +107 -0
  61. package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js.map +1 -0
  62. package/dist/esm/extensions/unstoppable-domains/consts.js +2 -0
  63. package/dist/esm/extensions/unstoppable-domains/consts.js.map +1 -0
  64. package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js +74 -0
  65. package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -0
  66. package/dist/esm/extensions/unstoppable-domains/read/resolveName.js +57 -0
  67. package/dist/esm/extensions/unstoppable-domains/read/resolveName.js.map +1 -0
  68. package/dist/esm/react/native/hooks/wallets/useLinkProfile.js +89 -0
  69. package/dist/esm/react/native/hooks/wallets/useLinkProfile.js.map +1 -0
  70. package/dist/esm/react/native/hooks/wallets/useProfiles.js +3 -4
  71. package/dist/esm/react/native/hooks/wallets/useProfiles.js.map +1 -1
  72. package/dist/esm/react/web/hooks/wallets/useLinkProfile.js +88 -0
  73. package/dist/esm/react/web/hooks/wallets/useLinkProfile.js.map +1 -0
  74. package/dist/esm/react/web/hooks/wallets/useProfiles.js +3 -4
  75. package/dist/esm/react/web/hooks/wallets/useProfiles.js.map +1 -1
  76. package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +2 -1
  77. package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
  78. package/dist/esm/version.js +1 -1
  79. package/dist/esm/wallets/in-app/core/users/getUser.js +11 -8
  80. package/dist/esm/wallets/in-app/core/users/getUser.js.map +1 -1
  81. package/dist/esm/wallets/in-app/native/native-connector.js +1 -0
  82. package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
  83. package/dist/esm/wallets/in-app/web/lib/auth/index.js +23 -16
  84. package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
  85. package/dist/esm/wallets/in-app/web/lib/web-connector.js +1 -0
  86. package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
  87. package/dist/types/contract/deployment/utils/create-2-factory.d.ts.map +1 -1
  88. package/dist/types/exports/extensions/unstoppable-domains.d.ts +4 -0
  89. package/dist/types/exports/extensions/unstoppable-domains.d.ts.map +1 -0
  90. package/dist/types/exports/react.d.ts +1 -0
  91. package/dist/types/exports/react.d.ts.map +1 -1
  92. package/dist/types/exports/react.native.d.ts +1 -0
  93. package/dist/types/exports/react.native.d.ts.map +1 -1
  94. package/dist/types/exports/wallets.d.ts +1 -0
  95. package/dist/types/exports/wallets.d.ts.map +1 -1
  96. package/dist/types/exports/wallets.native.d.ts +1 -0
  97. package/dist/types/exports/wallets.native.d.ts.map +1 -1
  98. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.d.ts +90 -0
  99. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.d.ts.map +1 -0
  100. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.d.ts +83 -0
  101. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.d.ts.map +1 -0
  102. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.d.ts +83 -0
  103. package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.d.ts.map +1 -0
  104. package/dist/types/extensions/unstoppable-domains/consts.d.ts +2 -0
  105. package/dist/types/extensions/unstoppable-domains/consts.d.ts.map +1 -0
  106. package/dist/types/extensions/unstoppable-domains/read/resolveAddress.d.ts +45 -0
  107. package/dist/types/extensions/unstoppable-domains/read/resolveAddress.d.ts.map +1 -0
  108. package/dist/types/extensions/unstoppable-domains/read/resolveName.d.ts +43 -0
  109. package/dist/types/extensions/unstoppable-domains/read/resolveName.d.ts.map +1 -0
  110. package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts +74 -0
  111. package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts.map +1 -0
  112. package/dist/types/react/native/hooks/wallets/useProfiles.d.ts +3 -4
  113. package/dist/types/react/native/hooks/wallets/useProfiles.d.ts.map +1 -1
  114. package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts +73 -0
  115. package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts.map +1 -0
  116. package/dist/types/react/web/hooks/wallets/useProfiles.d.ts +3 -4
  117. package/dist/types/react/web/hooks/wallets/useProfiles.d.ts.map +1 -1
  118. package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts.map +1 -1
  119. package/dist/types/version.d.ts +1 -1
  120. package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
  121. package/dist/types/wallets/in-app/core/users/getUser.d.ts +8 -6
  122. package/dist/types/wallets/in-app/core/users/getUser.d.ts.map +1 -1
  123. package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
  124. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +23 -16
  125. package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
  126. package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
  127. package/package.json +1 -1
  128. package/src/contract/deployment/utils/create-2-factory.ts +70 -57
  129. package/src/event/actions/get-events.ts +4 -4
  130. package/src/exports/extensions/unstoppable-domains.ts +9 -0
  131. package/src/exports/react.native.ts +1 -0
  132. package/src/exports/react.ts +1 -0
  133. package/src/exports/wallets.native.ts +1 -0
  134. package/src/exports/wallets.ts +1 -0
  135. package/src/extensions/thirdweb/write/publish.test.ts +20 -12
  136. package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.ts +130 -0
  137. package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.ts +124 -0
  138. package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.ts +126 -0
  139. package/src/extensions/unstoppable-domains/consts.ts +1 -0
  140. package/src/extensions/unstoppable-domains/read/resolveAddress.test.ts +18 -0
  141. package/src/extensions/unstoppable-domains/read/resolveAddress.ts +96 -0
  142. package/src/extensions/unstoppable-domains/read/resolveName.test.ts +16 -0
  143. package/src/extensions/unstoppable-domains/read/resolveName.ts +77 -0
  144. package/src/react/native/hooks/wallets/useLinkProfile.ts +92 -0
  145. package/src/react/native/hooks/wallets/useProfiles.ts +3 -4
  146. package/src/react/web/hooks/wallets/useLinkProfile.ts +91 -0
  147. package/src/react/web/hooks/wallets/useProfiles.ts +3 -4
  148. package/src/utils/any-evm/zksync/isZkSyncChain.ts +2 -1
  149. package/src/version.ts +1 -1
  150. package/src/wallets/in-app/core/authentication/types.ts +1 -0
  151. package/src/wallets/in-app/core/users/getUser.ts +14 -7
  152. package/src/wallets/in-app/native/native-connector.ts +1 -0
  153. package/src/wallets/in-app/web/lib/auth/index.ts +23 -16
  154. package/src/wallets/in-app/web/lib/web-connector.ts +1 -0
@@ -0,0 +1,107 @@
1
+ import { readContract } from "../../../../../transaction/read-contract.js";
2
+ import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
3
+ import { decodeAbiParameters } from "viem";
4
+ import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
5
+ export const FN_SELECTOR = "0x276fabb1";
6
+ const FN_INPUTS = [
7
+ {
8
+ type: "string[]",
9
+ name: "labels",
10
+ },
11
+ ];
12
+ const FN_OUTPUTS = [
13
+ {
14
+ type: "uint256",
15
+ name: "hash",
16
+ },
17
+ ];
18
+ /**
19
+ * Checks if the `namehash` method is supported by the given contract.
20
+ * @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
21
+ * @returns A boolean indicating if the `namehash` method is supported.
22
+ * @extension UNSTOPPABLE-DOMAINS
23
+ * @example
24
+ * ```ts
25
+ * import { isNamehashSupported } from "thirdweb/extensions/unstoppable-domains";
26
+ * const supported = isNamehashSupported(["0x..."]);
27
+ * ```
28
+ */
29
+ export function isNamehashSupported(availableSelectors) {
30
+ return detectMethod({
31
+ availableSelectors,
32
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
33
+ });
34
+ }
35
+ /**
36
+ * Encodes the parameters for the "namehash" function.
37
+ * @param options - The options for the namehash function.
38
+ * @returns The encoded ABI parameters.
39
+ * @extension UNSTOPPABLE-DOMAINS
40
+ * @example
41
+ * ```ts
42
+ * import { encodeNamehashParams } from "thirdweb/extensions/unstoppable-domains";
43
+ * const result = encodeNamehashParams({
44
+ * labels: ...,
45
+ * });
46
+ * ```
47
+ */
48
+ export function encodeNamehashParams(options) {
49
+ return encodeAbiParameters(FN_INPUTS, [options.labels]);
50
+ }
51
+ /**
52
+ * Encodes the "namehash" function into a Hex string with its parameters.
53
+ * @param options - The options for the namehash function.
54
+ * @returns The encoded hexadecimal string.
55
+ * @extension UNSTOPPABLE-DOMAINS
56
+ * @example
57
+ * ```ts
58
+ * import { encodeNamehash } from "thirdweb/extensions/unstoppable-domains";
59
+ * const result = encodeNamehash({
60
+ * labels: ...,
61
+ * });
62
+ * ```
63
+ */
64
+ export function encodeNamehash(options) {
65
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
66
+ // we can do this because we know the specific formats of the values
67
+ return (FN_SELECTOR +
68
+ encodeNamehashParams(options).slice(2));
69
+ }
70
+ /**
71
+ * Decodes the result of the namehash function call.
72
+ * @param result - The hexadecimal result to decode.
73
+ * @returns The decoded result as per the FN_OUTPUTS definition.
74
+ * @extension UNSTOPPABLE-DOMAINS
75
+ * @example
76
+ * ```ts
77
+ * import { decodeNamehashResult } from "thirdweb/extensions/unstoppable-domains";
78
+ * const result = decodeNamehashResultResult("...");
79
+ * ```
80
+ */
81
+ export function decodeNamehashResult(result) {
82
+ return decodeAbiParameters(FN_OUTPUTS, result)[0];
83
+ }
84
+ /**
85
+ * Calls the "namehash" function on the contract.
86
+ * @param options - The options for the namehash function.
87
+ * @returns The parsed result of the function call.
88
+ * @extension UNSTOPPABLE-DOMAINS
89
+ * @example
90
+ * ```ts
91
+ * import { namehash } from "thirdweb/extensions/unstoppable-domains";
92
+ *
93
+ * const result = await namehash({
94
+ * contract,
95
+ * labels: ...,
96
+ * });
97
+ *
98
+ * ```
99
+ */
100
+ export async function namehash(options) {
101
+ return readContract({
102
+ contract: options.contract,
103
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
104
+ params: [options.labels],
105
+ });
106
+ }
107
+ //# sourceMappingURL=namehash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"namehash.js","sourceRoot":"","sources":["../../../../../../../src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAShF,MAAM,CAAC,MAAM,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;KACf;CACO,CAAC;AACX,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM;KACb;CACO,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,kBAA4B;IAC9D,OAAO,YAAY,CAAC;QAClB,kBAAkB;QAClB,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAuB;IAC1D,OAAO,mBAAmB,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,cAAc,CAAC,OAAuB;IACpD,iFAAiF;IACjF,oEAAoE;IACpE,OAAO,CAAC,WAAW;QACjB,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAqC,CAAC;AAChF,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAW;IAC9C,OAAO,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAA+C;IAE/C,OAAO,YAAY,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC;KACzB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,107 @@
1
+ import { readContract } from "../../../../../transaction/read-contract.js";
2
+ import { encodeAbiParameters } from "../../../../../utils/abi/encodeAbiParameters.js";
3
+ import { decodeAbiParameters } from "viem";
4
+ import { detectMethod } from "../../../../../utils/bytecode/detectExtension.js";
5
+ export const FN_SELECTOR = "0xbebec6b4";
6
+ const FN_INPUTS = [
7
+ {
8
+ type: "address",
9
+ name: "addr",
10
+ },
11
+ ];
12
+ const FN_OUTPUTS = [
13
+ {
14
+ type: "string",
15
+ name: "reverseUri",
16
+ },
17
+ ];
18
+ /**
19
+ * Checks if the `reverseNameOf` method is supported by the given contract.
20
+ * @param availableSelectors An array of 4byte function selectors of the contract. You can get this in various ways, such as using "whatsabi" or if you have the ABI of the contract available you can use it to generate the selectors.
21
+ * @returns A boolean indicating if the `reverseNameOf` method is supported.
22
+ * @extension UNSTOPPABLE-DOMAINS
23
+ * @example
24
+ * ```ts
25
+ * import { isReverseNameOfSupported } from "thirdweb/extensions/unstoppable-domains";
26
+ * const supported = isReverseNameOfSupported(["0x..."]);
27
+ * ```
28
+ */
29
+ export function isReverseNameOfSupported(availableSelectors) {
30
+ return detectMethod({
31
+ availableSelectors,
32
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
33
+ });
34
+ }
35
+ /**
36
+ * Encodes the parameters for the "reverseNameOf" function.
37
+ * @param options - The options for the reverseNameOf function.
38
+ * @returns The encoded ABI parameters.
39
+ * @extension UNSTOPPABLE-DOMAINS
40
+ * @example
41
+ * ```ts
42
+ * import { encodeReverseNameOfParams } from "thirdweb/extensions/unstoppable-domains";
43
+ * const result = encodeReverseNameOfParams({
44
+ * addr: ...,
45
+ * });
46
+ * ```
47
+ */
48
+ export function encodeReverseNameOfParams(options) {
49
+ return encodeAbiParameters(FN_INPUTS, [options.addr]);
50
+ }
51
+ /**
52
+ * Encodes the "reverseNameOf" function into a Hex string with its parameters.
53
+ * @param options - The options for the reverseNameOf function.
54
+ * @returns The encoded hexadecimal string.
55
+ * @extension UNSTOPPABLE-DOMAINS
56
+ * @example
57
+ * ```ts
58
+ * import { encodeReverseNameOf } from "thirdweb/extensions/unstoppable-domains";
59
+ * const result = encodeReverseNameOf({
60
+ * addr: ...,
61
+ * });
62
+ * ```
63
+ */
64
+ export function encodeReverseNameOf(options) {
65
+ // we do a "manual" concat here to avoid the overhead of the "concatHex" function
66
+ // we can do this because we know the specific formats of the values
67
+ return (FN_SELECTOR +
68
+ encodeReverseNameOfParams(options).slice(2));
69
+ }
70
+ /**
71
+ * Decodes the result of the reverseNameOf function call.
72
+ * @param result - The hexadecimal result to decode.
73
+ * @returns The decoded result as per the FN_OUTPUTS definition.
74
+ * @extension UNSTOPPABLE-DOMAINS
75
+ * @example
76
+ * ```ts
77
+ * import { decodeReverseNameOfResult } from "thirdweb/extensions/unstoppable-domains";
78
+ * const result = decodeReverseNameOfResultResult("...");
79
+ * ```
80
+ */
81
+ export function decodeReverseNameOfResult(result) {
82
+ return decodeAbiParameters(FN_OUTPUTS, result)[0];
83
+ }
84
+ /**
85
+ * Calls the "reverseNameOf" function on the contract.
86
+ * @param options - The options for the reverseNameOf function.
87
+ * @returns The parsed result of the function call.
88
+ * @extension UNSTOPPABLE-DOMAINS
89
+ * @example
90
+ * ```ts
91
+ * import { reverseNameOf } from "thirdweb/extensions/unstoppable-domains";
92
+ *
93
+ * const result = await reverseNameOf({
94
+ * contract,
95
+ * addr: ...,
96
+ * });
97
+ *
98
+ * ```
99
+ */
100
+ export async function reverseNameOf(options) {
101
+ return readContract({
102
+ contract: options.contract,
103
+ method: [FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
104
+ params: [options.addr],
105
+ });
106
+ }
107
+ //# sourceMappingURL=reverseNameOf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reverseNameOf.js","sourceRoot":"","sources":["../../../../../../../src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAShF,MAAM,CAAC,MAAM,WAAW,GAAG,YAAqB,CAAC;AACjD,MAAM,SAAS,GAAG;IAChB;QACE,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,MAAM;KACb;CACO,CAAC;AACX,MAAM,UAAU,GAAG;IACjB;QACE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,YAAY;KACnB;CACO,CAAC;AAEX;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CAAC,kBAA4B;IACnE,OAAO,YAAY,CAAC;QAClB,kBAAkB;QAClB,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CAAC,OAA4B;IACpE,OAAO,mBAAmB,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAA4B;IAC9D,iFAAiF;IACjF,oEAAoE;IACpE,OAAO,CAAC,WAAW;QACjB,yBAAyB,CAAC,OAAO,CAAC,CAAC,KAAK,CACtC,CAAC,CACF,CAAqC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAW;IACnD,OAAO,mBAAmB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,OAAoD;IAEpD,OAAO,YAAY,CAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;KACvB,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const UD_POLYGON_MAINNET = "0xa9a6A3626993D487d2Dbda3173cf58cA1a9D9e9f";
2
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../../src/extensions/unstoppable-domains/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,4CAA4C,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { polygon } from "../../../chains/chain-definitions/polygon.js";
2
+ import { getContract } from "../../../contract/contract.js";
3
+ import { getAddress, isAddress } from "../../../utils/address.js";
4
+ import { withCache } from "../../../utils/promise/withCache.js";
5
+ import { getMany } from "../__generated__/UnstoppableDomains/read/getMany.js";
6
+ import { namehash } from "../__generated__/UnstoppableDomains/read/namehash.js";
7
+ import { UD_POLYGON_MAINNET } from "../consts.js";
8
+ /**
9
+ * Resolve an Unstoppable-Domain domain to an Ethereum address
10
+ * @param options - The options for resolving an UD domain
11
+ * @returns The Ethereum address associated with the domain name. [Learn more](https://docs.unstoppabledomains.com/reverse-resolution/)
12
+ * @example
13
+ *
14
+ * ### Basic usage
15
+ * ```ts
16
+ * import { resolveAddress } from "thirdweb/extension/unstoppable-domains";
17
+ *
18
+ * const address = await resolveAddress({
19
+ * client,
20
+ * name: "thirdweb.crypto",
21
+ * });
22
+ * ```
23
+ *
24
+ * ### Custom resolver
25
+ * By default this extension will try to resolve the name on Polygon mainnet,
26
+ * you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain`
27
+ * ```ts
28
+ * import { ethereum } from "thirdweb/chains";
29
+ *
30
+ * const address = await resolveAddress({
31
+ * client,
32
+ * name: "thirdweb.crypto",
33
+ * resolverAddress: "0x...",
34
+ * resolverChain: ethereum,
35
+ * });
36
+ * ```
37
+ *
38
+ * @extension UNSTOPPABLE-DOMAINS
39
+ */
40
+ export async function resolveAddress(options) {
41
+ const { client, name, resolverAddress, resolverChain } = options;
42
+ if (isAddress(name)) {
43
+ return getAddress(name);
44
+ }
45
+ return withCache(async () => {
46
+ const contract = getContract({
47
+ client,
48
+ chain: resolverChain || polygon,
49
+ address: resolverAddress || UD_POLYGON_MAINNET,
50
+ });
51
+ // Get namehash
52
+ const possibleTokenId = await namehash({
53
+ contract,
54
+ labels: name.split("."),
55
+ });
56
+ // Resolve ETH address from the tokenId
57
+ const resolved = await getMany({
58
+ contract,
59
+ tokenId: possibleTokenId,
60
+ // note that you can also retrieve the (BTC, SOL, etc.) address by using "crypto.<symbol>.address" (should that become useful one day)
61
+ keys: ["crypto.ETH.address"],
62
+ });
63
+ const possibleETHAddress = resolved[0];
64
+ if (!possibleETHAddress) {
65
+ throw new Error(`Could not retrieve any ETH address associated with domain name: ${name}. Make sure you have set the base EVM address for your domain here: https://unstoppabledomains.com/manage?page=crypto&domain=<your-domain>`);
66
+ }
67
+ return possibleETHAddress;
68
+ }, {
69
+ cacheKey: `unstoppable-domain:addr:${resolverChain?.id || 1}:${name}`,
70
+ // 1min cache
71
+ cacheTime: 60 * 1000,
72
+ });
73
+ }
74
+ //# sourceMappingURL=resolveAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveAddress.js","sourceRoot":"","sources":["../../../../../src/extensions/unstoppable-domains/read/resolveAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,qDAAqD,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,sDAAsD,CAAC;AAChF,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAYlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,OAA8B;IAE9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACjE,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,SAAS,CACd,KAAK,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM;YACN,KAAK,EAAE,aAAa,IAAI,OAAO;YAC/B,OAAO,EAAE,eAAe,IAAI,kBAAkB;SAC/C,CAAC,CAAC;QAEH,eAAe;QACf,MAAM,eAAe,GAAG,MAAM,QAAQ,CAAC;YACrC,QAAQ;YACR,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SACxB,CAAC,CAAC;QAEH,uCAAuC;QACvC,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC;YAC7B,QAAQ;YACR,OAAO,EAAE,eAAe;YACxB,sIAAsI;YACtI,IAAI,EAAE,CAAC,oBAAoB,CAAC;SAC7B,CAAC,CAAC;QAEH,MAAM,kBAAkB,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;QACvC,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,mEAAmE,IAAI,4IAA4I,CACpN,CAAC;QACJ,CAAC;QACD,OAAO,kBAAkB,CAAC;IAC5B,CAAC,EACD;QACE,QAAQ,EAAE,2BAA2B,aAAa,EAAE,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;QACrE,aAAa;QACb,SAAS,EAAE,EAAE,GAAG,IAAI;KACrB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { polygon } from "../../../chains/chain-definitions/polygon.js";
2
+ import { getContract } from "../../../contract/contract.js";
3
+ import { withCache } from "../../../utils/promise/withCache.js";
4
+ import { reverseNameOf } from "../__generated__/UnstoppableDomains/read/reverseNameOf.js";
5
+ import { UD_POLYGON_MAINNET } from "../consts.js";
6
+ /**
7
+ * Resolves the primary Untoppable-Domains name for a specified address.
8
+ * @param options - The options for resolving an UD domain
9
+ * @example
10
+ *
11
+ * ### Basic usage
12
+ * ```ts
13
+ * import { resolveName } from "thirdweb/extension/unstoppable-domains";
14
+ *
15
+ * const name = await resolveName({
16
+ * client,
17
+ * address: "0x...",
18
+ * });
19
+ * ```
20
+ *
21
+ * ### Custom resolver
22
+ * By default this extension will try to resolve the address on Polygon mainnet,
23
+ * you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain`
24
+ * ```ts
25
+ * import { ethereum } from "thirdweb/chains";
26
+ *
27
+ * const address = await resolveName({
28
+ * client,
29
+ * address: "0x...",
30
+ * resolverAddress: "0x...",
31
+ * resolverChain: ethereum,
32
+ * });
33
+ * ```
34
+ * @extension UNSTOPPABLE-DOMAINS
35
+ */
36
+ export async function resolveName(options) {
37
+ const { client, address, resolverAddress, resolverChain } = options;
38
+ return withCache(async () => {
39
+ const contract = getContract({
40
+ client,
41
+ chain: resolverChain || polygon,
42
+ address: resolverAddress || UD_POLYGON_MAINNET,
43
+ });
44
+ // Note: if the given wallet address does not have any UD name, `reverseNameOf` will return an empty string
45
+ // This can still happen if you have transfered a domain to a new address, and forgot to set up the Reverse Resolution on the new address
46
+ const domain = await reverseNameOf({ contract, addr: address });
47
+ if (!domain) {
48
+ throw new Error(`Failed to retrieve domain for address: ${address}. Make sure you have set the Reverse Resolution address for your domain at https://unstoppabledomains.com/manage?page=reverseResolution&domain=your-domain`);
49
+ }
50
+ return domain;
51
+ }, {
52
+ cacheKey: `unstoppable-domain:name:${resolverChain?.id || 1}:${address}`,
53
+ // 1min cache
54
+ cacheTime: 60 * 1000,
55
+ });
56
+ }
57
+ //# sourceMappingURL=resolveName.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolveName.js","sourceRoot":"","sources":["../../../../../src/extensions/unstoppable-domains/read/resolveName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,8CAA8C,CAAC;AAGvE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,2DAA2D,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAYlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACpE,OAAO,SAAS,CACd,KAAK,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,WAAW,CAAC;YAC3B,MAAM;YACN,KAAK,EAAE,aAAa,IAAI,OAAO;YAC/B,OAAO,EAAE,eAAe,IAAI,kBAAkB;SAC/C,CAAC,CAAC;QAEH,2GAA2G;QAC3G,yIAAyI;QACzI,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,0CAA0C,OAAO,4JAA4J,CAC9M,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC,EACD;QACE,QAAQ,EAAE,2BAA2B,aAAa,EAAE,EAAE,IAAI,CAAC,IAAI,OAAO,EAAE;QACxE,aAAa;QACb,SAAS,EAAE,EAAE,GAAG,IAAI;KACrB,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,89 @@
1
+ import { useMutation } from "@tanstack/react-query";
2
+ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
3
+ import { linkProfile } from "../../../../wallets/in-app/web/lib/auth/index.js";
4
+ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
5
+ /**
6
+ * Links a web2 or web3 profile to the connected in-app or ecosystem account.
7
+ *
8
+ * **When a profile is linked to the account, that profile can then be used to sign into the same account.**
9
+ *
10
+ * @example
11
+ *
12
+ * ### Linking a social profile
13
+ *
14
+ * ```jsx
15
+ * import { useLinkProfile } from "thirdweb/react";
16
+ *
17
+ * const { mutate: linkProfile } = useLinkProfile();
18
+ *
19
+ * const onClick = () => {
20
+ * linkProfile({
21
+ * client,
22
+ * strategy: "discord", // or "google", "x", "telegram", etc
23
+ * });
24
+ * };
25
+ * ```
26
+ *
27
+ * ### Linking an email
28
+ *
29
+ * ```jsx
30
+ * import { useLinkProfile } from "thirdweb/react";
31
+ * import { preAuthenticate } from "thirdweb/wallets";
32
+ *
33
+ * const { mutate: linkProfile } = useLinkProfile();
34
+ *
35
+ * // send a verification email first
36
+ * const sendEmail = async () => {
37
+ * const email = await preAuthenticate({
38
+ * client,
39
+ * strategy: "email",
40
+ * email: "john.doe@example.com",
41
+ * });
42
+ * };
43
+ *
44
+ * // then link the profile with the verification code
45
+ * const onClick = (code: string) => {
46
+ * linkProfile({
47
+ * client,
48
+ * strategy: "email",
49
+ * email: "john.doe@example.com",
50
+ * verificationCode: code,
51
+ * });
52
+ * };
53
+ * ```
54
+ *
55
+ * The same process can be used for phone and email, simply swap out the `strategy` parameter.
56
+ *
57
+ * ### Linking a wallet
58
+ *
59
+ * ```jsx
60
+ * import { useLinkProfile } from "thirdweb/react";
61
+ *
62
+ * const { mutate: linkProfile } = useLinkProfile();
63
+ *
64
+ * const onClick = () => {
65
+ * linkProfile({
66
+ * client,
67
+ * strategy: "wallet",
68
+ * wallet: createWallet("io.metamask"), // autocompletion for 400+ wallet ids
69
+ * chain: sepolia, // any chain works, needed for SIWE signature
70
+ * });
71
+ * };
72
+ * ```
73
+ *
74
+ * @wallet
75
+ */
76
+ export function useLinkProfile() {
77
+ const wallet = useAdminWallet();
78
+ return useMutation({
79
+ mutationKey: ["profiles"],
80
+ mutationFn: async (options) => {
81
+ const ecosystem = wallet && isEcosystemWallet(wallet)
82
+ ? { id: wallet.id, partnerId: wallet.getConfig()?.partnerId }
83
+ : undefined;
84
+ const optionsWithEcosystem = { ...options, ecosystem };
85
+ return linkProfile(optionsWithEcosystem);
86
+ },
87
+ });
88
+ }
89
+ //# sourceMappingURL=useLinkProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLinkProfile.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useLinkProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,WAAW,CAAC;QACjB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,UAAU,EAAE,KAAK,EAAE,OAAwC,EAAE,EAAE;YAC7D,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,MAAM,oBAAoB,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAkB,CAAC;YACvE,OAAO,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -3,11 +3,10 @@ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wa
3
3
  import { getProfiles } from "../../../../wallets/in-app/web/lib/auth/index.js";
4
4
  import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
5
5
  /**
6
- * Retrieves all linked profiles of the connected in-app or ecosystem wallet.
6
+ * Retrieves all linked profiles of the connected in-app or ecosystem account.
7
7
  *
8
- * @returns A React Query result containing the linked profiles for the connected in-app wallet.
9
- *
10
- * @note This hook will only run if the connected wallet supports multi-auth (in-app wallets).
8
+ * @returns A React Query result containing the linked profiles for the connected in-app account.
9
+ * @note This hook will only run if the connected wallet supports account linking.
11
10
  *
12
11
  * @example
13
12
  * ```jsx
@@ -1 +1 @@
1
- {"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useProfiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,WAAW,CAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useProfiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,WAAW,CAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,88 @@
1
+ import { useMutation } from "@tanstack/react-query";
2
+ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wallet.js";
3
+ import { linkProfile } from "../../../../wallets/in-app/web/lib/auth/index.js";
4
+ import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
5
+ /**
6
+ * Links a web2 or web3 profile to the connected in-app or ecosystem account.
7
+ * **When a profile is linked to the account, that profile can then be used to sign into the same account.**
8
+ *
9
+ * @example
10
+ *
11
+ * ### Linking a social profile
12
+ *
13
+ * ```jsx
14
+ * import { useLinkProfile } from "thirdweb/react";
15
+ *
16
+ * const { mutate: linkProfile } = useLinkProfile();
17
+ *
18
+ * const onClick = () => {
19
+ * linkProfile({
20
+ * client,
21
+ * strategy: "discord", // or "google", "x", "telegram", etc
22
+ * });
23
+ * };
24
+ * ```
25
+ *
26
+ * ### Linking an email
27
+ *
28
+ * ```jsx
29
+ * import { useLinkProfile } from "thirdweb/react";
30
+ * import { preAuthenticate } from "thirdweb/wallets";
31
+ *
32
+ * const { mutate: linkProfile } = useLinkProfile();
33
+ *
34
+ * // send a verification email first
35
+ * const sendEmail = async () => {
36
+ * const email = await preAuthenticate({
37
+ * client,
38
+ * strategy: "email",
39
+ * email: "john.doe@example.com",
40
+ * });
41
+ * };
42
+ *
43
+ * // then link the profile with the verification code
44
+ * const onClick = (code: string) => {
45
+ * linkProfile({
46
+ * client,
47
+ * strategy: "email",
48
+ * email: "john.doe@example.com",
49
+ * verificationCode: code,
50
+ * });
51
+ * };
52
+ * ```
53
+ *
54
+ * The same process can be used for phone and email, simply swap out the `strategy` parameter.
55
+ *
56
+ * ### Linking a wallet
57
+ *
58
+ * ```jsx
59
+ * import { useLinkProfile } from "thirdweb/react";
60
+ *
61
+ * const { mutate: linkProfile } = useLinkProfile();
62
+ *
63
+ * const onClick = () => {
64
+ * linkProfile({
65
+ * client,
66
+ * strategy: "wallet",
67
+ * wallet: createWallet("io.metamask"), // autocompletion for 400+ wallet ids
68
+ * chain: sepolia, // any chain works, needed for SIWE signature
69
+ * });
70
+ * };
71
+ * ```
72
+ *
73
+ * @wallet
74
+ */
75
+ export function useLinkProfile() {
76
+ const wallet = useAdminWallet();
77
+ return useMutation({
78
+ mutationKey: ["profiles"],
79
+ mutationFn: async (options) => {
80
+ const ecosystem = wallet && isEcosystemWallet(wallet)
81
+ ? { id: wallet.id, partnerId: wallet.getConfig()?.partnerId }
82
+ : undefined;
83
+ const optionsWithEcosystem = { ...options, ecosystem };
84
+ return linkProfile(optionsWithEcosystem);
85
+ },
86
+ });
87
+ }
88
+ //# sourceMappingURL=useLinkProfile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLinkProfile.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useLinkProfile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,WAAW,CAAC;QACjB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,UAAU,EAAE,KAAK,EAAE,OAAqB,EAAE,EAAE;YAC1C,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,MAAM,oBAAoB,GAAG,EAAE,GAAG,OAAO,EAAE,SAAS,EAAkB,CAAC;YACvE,OAAO,WAAW,CAAC,oBAAoB,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -3,11 +3,10 @@ import { isEcosystemWallet } from "../../../../wallets/ecosystem/is-ecosystem-wa
3
3
  import { getProfiles } from "../../../../wallets/in-app/web/lib/auth/index.js";
4
4
  import { useAdminWallet } from "../../../core/hooks/wallets/useAdminWallet.js";
5
5
  /**
6
- * Retrieves all linked profiles of the connected in-app or ecosystem wallet.
6
+ * Retrieves all linked profiles of the connected in-app or ecosystem account.
7
7
  *
8
- * @returns A React Query result containing the linked profiles for the connected in-app wallet.
9
- *
10
- * @note This hook will only run if the connected wallet supports multi-auth (in-app wallets).
8
+ * @returns A React Query result containing the linked profiles for the connected in-app account.
9
+ * @note This hook will only run if the connected wallet supports account linking.
11
10
  *
12
11
  * @example
13
12
  * ```jsx
@@ -1 +1 @@
1
- {"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useProfiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,WAAW,CAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useProfiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sDAAsD,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,OAAO,QAAQ,CAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,iBAAiB,CAAC,MAAM,CAAC;gBACjC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE;gBAC7D,CAAC,CAAC,SAAS,CAAC;YAChB,OAAO,WAAW,CAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -11,7 +11,8 @@ export async function isZkSyncChain(chain) {
11
11
  chain.id === 282 ||
12
12
  chain.id === 388 ||
13
13
  chain.id === 4654 ||
14
- chain.id === 333271) {
14
+ chain.id === 333271 ||
15
+ chain.id === 37111) {
15
16
  return true;
16
17
  }
17
18
  // fallback to checking the stack on rpc
@@ -1 +1 @@
1
- {"version":3,"file":"isZkSyncChain.js","sourceRoot":"","sources":["../../../../../src/utils/any-evm/zksync/isZkSyncChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAqC;IACrC,IACE,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,KAAK;QAClB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,IAAI;QACjB,KAAK,CAAC,EAAE,KAAK,MAAM,EACnB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,aAAa,CAAC,SAAS,KAAK,cAAc,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"isZkSyncChain.js","sourceRoot":"","sources":["../../../../../src/utils/any-evm/zksync/isZkSyncChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAY;IAC9C,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAqC;IACrC,IACE,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,KAAK;QAClB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,GAAG;QAChB,KAAK,CAAC,EAAE,KAAK,IAAI;QACjB,KAAK,CAAC,EAAE,KAAK,MAAM;QACnB,KAAK,CAAC,EAAE,KAAK,KAAK,EAClB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wCAAwC;IACxC,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,aAAa,CAAC,SAAS,KAAK,cAAc,CAAC;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,6DAA6D;QAC7D,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1,2 +1,2 @@
1
- export const version = "5.60.1";
1
+ export const version = "5.61.0";
2
2
  //# sourceMappingURL=version.js.map