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.
- package/dist/cjs/contract/deployment/utils/create-2-factory.js +53 -46
- package/dist/cjs/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/cjs/event/actions/get-events.js +4 -4
- package/dist/cjs/event/actions/get-events.js.map +1 -1
- package/dist/cjs/exports/extensions/unstoppable-domains.js +10 -0
- package/dist/cjs/exports/extensions/unstoppable-domains.js.map +1 -0
- package/dist/cjs/exports/react.js +4 -2
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/exports/react.native.js +3 -1
- package/dist/cjs/exports/react.native.js.map +1 -1
- package/dist/cjs/exports/wallets.js.map +1 -1
- package/dist/cjs/exports/wallets.native.js.map +1 -1
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js +122 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js +115 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js +115 -0
- package/dist/cjs/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/consts.js +5 -0
- package/dist/cjs/extensions/unstoppable-domains/consts.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js +77 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveName.js +60 -0
- package/dist/cjs/extensions/unstoppable-domains/read/resolveName.js.map +1 -0
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js +92 -0
- package/dist/cjs/react/native/hooks/wallets/useLinkProfile.js.map +1 -0
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js +3 -4
- package/dist/cjs/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js +91 -0
- package/dist/cjs/react/web/hooks/wallets/useLinkProfile.js.map +1 -0
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js +3 -4
- package/dist/cjs/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js +2 -1
- package/dist/cjs/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/wallets/in-app/core/users/getUser.js +11 -8
- package/dist/cjs/wallets/in-app/core/users/getUser.js.map +1 -1
- package/dist/cjs/wallets/in-app/native/native-connector.js +1 -0
- package/dist/cjs/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js +23 -16
- package/dist/cjs/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js +1 -0
- package/dist/cjs/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/esm/contract/deployment/utils/create-2-factory.js +53 -46
- package/dist/esm/contract/deployment/utils/create-2-factory.js.map +1 -1
- package/dist/esm/event/actions/get-events.js +4 -4
- package/dist/esm/event/actions/get-events.js.map +1 -1
- package/dist/esm/exports/extensions/unstoppable-domains.js +4 -0
- package/dist/esm/exports/extensions/unstoppable-domains.js.map +1 -0
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/exports/react.native.js +1 -0
- package/dist/esm/exports/react.native.js.map +1 -1
- package/dist/esm/exports/wallets.js.map +1 -1
- package/dist/esm/exports/wallets.native.js.map +1 -1
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js +114 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js +107 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js +107 -0
- package/dist/esm/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/consts.js +2 -0
- package/dist/esm/extensions/unstoppable-domains/consts.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js +74 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveAddress.js.map +1 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveName.js +57 -0
- package/dist/esm/extensions/unstoppable-domains/read/resolveName.js.map +1 -0
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js +89 -0
- package/dist/esm/react/native/hooks/wallets/useLinkProfile.js.map +1 -0
- package/dist/esm/react/native/hooks/wallets/useProfiles.js +3 -4
- package/dist/esm/react/native/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js +88 -0
- package/dist/esm/react/web/hooks/wallets/useLinkProfile.js.map +1 -0
- package/dist/esm/react/web/hooks/wallets/useProfiles.js +3 -4
- package/dist/esm/react/web/hooks/wallets/useProfiles.js.map +1 -1
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js +2 -1
- package/dist/esm/utils/any-evm/zksync/isZkSyncChain.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/wallets/in-app/core/users/getUser.js +11 -8
- package/dist/esm/wallets/in-app/core/users/getUser.js.map +1 -1
- package/dist/esm/wallets/in-app/native/native-connector.js +1 -0
- package/dist/esm/wallets/in-app/native/native-connector.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/auth/index.js +23 -16
- package/dist/esm/wallets/in-app/web/lib/auth/index.js.map +1 -1
- package/dist/esm/wallets/in-app/web/lib/web-connector.js +1 -0
- package/dist/esm/wallets/in-app/web/lib/web-connector.js.map +1 -1
- package/dist/types/contract/deployment/utils/create-2-factory.d.ts.map +1 -1
- package/dist/types/exports/extensions/unstoppable-domains.d.ts +4 -0
- package/dist/types/exports/extensions/unstoppable-domains.d.ts.map +1 -0
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/react.native.d.ts +1 -0
- package/dist/types/exports/react.native.d.ts.map +1 -1
- package/dist/types/exports/wallets.d.ts +1 -0
- package/dist/types/exports/wallets.d.ts.map +1 -1
- package/dist/types/exports/wallets.native.d.ts +1 -0
- package/dist/types/exports/wallets.native.d.ts.map +1 -1
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.d.ts +90 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.d.ts +83 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.d.ts +83 -0
- package/dist/types/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/consts.d.ts +2 -0
- package/dist/types/extensions/unstoppable-domains/consts.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/read/resolveAddress.d.ts +45 -0
- package/dist/types/extensions/unstoppable-domains/read/resolveAddress.d.ts.map +1 -0
- package/dist/types/extensions/unstoppable-domains/read/resolveName.d.ts +43 -0
- package/dist/types/extensions/unstoppable-domains/read/resolveName.d.ts.map +1 -0
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts +74 -0
- package/dist/types/react/native/hooks/wallets/useLinkProfile.d.ts.map +1 -0
- package/dist/types/react/native/hooks/wallets/useProfiles.d.ts +3 -4
- package/dist/types/react/native/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts +73 -0
- package/dist/types/react/web/hooks/wallets/useLinkProfile.d.ts.map +1 -0
- package/dist/types/react/web/hooks/wallets/useProfiles.d.ts +3 -4
- package/dist/types/react/web/hooks/wallets/useProfiles.d.ts.map +1 -1
- package/dist/types/utils/any-evm/zksync/isZkSyncChain.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/wallets/in-app/core/authentication/types.d.ts.map +1 -1
- package/dist/types/wallets/in-app/core/users/getUser.d.ts +8 -6
- package/dist/types/wallets/in-app/core/users/getUser.d.ts.map +1 -1
- package/dist/types/wallets/in-app/native/native-connector.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts +23 -16
- package/dist/types/wallets/in-app/web/lib/auth/index.d.ts.map +1 -1
- package/dist/types/wallets/in-app/web/lib/web-connector.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/contract/deployment/utils/create-2-factory.ts +70 -57
- package/src/event/actions/get-events.ts +4 -4
- package/src/exports/extensions/unstoppable-domains.ts +9 -0
- package/src/exports/react.native.ts +1 -0
- package/src/exports/react.ts +1 -0
- package/src/exports/wallets.native.ts +1 -0
- package/src/exports/wallets.ts +1 -0
- package/src/extensions/thirdweb/write/publish.test.ts +20 -12
- package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/getMany.ts +130 -0
- package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/namehash.ts +124 -0
- package/src/extensions/unstoppable-domains/__generated__/UnstoppableDomains/read/reverseNameOf.ts +126 -0
- package/src/extensions/unstoppable-domains/consts.ts +1 -0
- package/src/extensions/unstoppable-domains/read/resolveAddress.test.ts +18 -0
- package/src/extensions/unstoppable-domains/read/resolveAddress.ts +96 -0
- package/src/extensions/unstoppable-domains/read/resolveName.test.ts +16 -0
- package/src/extensions/unstoppable-domains/read/resolveName.ts +77 -0
- package/src/react/native/hooks/wallets/useLinkProfile.ts +92 -0
- package/src/react/native/hooks/wallets/useProfiles.ts +3 -4
- package/src/react/web/hooks/wallets/useLinkProfile.ts +91 -0
- package/src/react/web/hooks/wallets/useProfiles.ts +3 -4
- package/src/utils/any-evm/zksync/isZkSyncChain.ts +2 -1
- package/src/version.ts +1 -1
- package/src/wallets/in-app/core/authentication/types.ts +1 -0
- package/src/wallets/in-app/core/users/getUser.ts +14 -7
- package/src/wallets/in-app/native/native-connector.ts +1 -0
- package/src/wallets/in-app/web/lib/auth/index.ts +23 -16
- package/src/wallets/in-app/web/lib/web-connector.ts +1 -0
@@ -0,0 +1,115 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.FN_SELECTOR = void 0;
|
4
|
+
exports.isReverseNameOfSupported = isReverseNameOfSupported;
|
5
|
+
exports.encodeReverseNameOfParams = encodeReverseNameOfParams;
|
6
|
+
exports.encodeReverseNameOf = encodeReverseNameOf;
|
7
|
+
exports.decodeReverseNameOfResult = decodeReverseNameOfResult;
|
8
|
+
exports.reverseNameOf = reverseNameOf;
|
9
|
+
const read_contract_js_1 = require("../../../../../transaction/read-contract.js");
|
10
|
+
const encodeAbiParameters_js_1 = require("../../../../../utils/abi/encodeAbiParameters.js");
|
11
|
+
const viem_1 = require("viem");
|
12
|
+
const detectExtension_js_1 = require("../../../../../utils/bytecode/detectExtension.js");
|
13
|
+
exports.FN_SELECTOR = "0xbebec6b4";
|
14
|
+
const FN_INPUTS = [
|
15
|
+
{
|
16
|
+
type: "address",
|
17
|
+
name: "addr",
|
18
|
+
},
|
19
|
+
];
|
20
|
+
const FN_OUTPUTS = [
|
21
|
+
{
|
22
|
+
type: "string",
|
23
|
+
name: "reverseUri",
|
24
|
+
},
|
25
|
+
];
|
26
|
+
/**
|
27
|
+
* Checks if the `reverseNameOf` method is supported by the given contract.
|
28
|
+
* @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.
|
29
|
+
* @returns A boolean indicating if the `reverseNameOf` method is supported.
|
30
|
+
* @extension UNSTOPPABLE-DOMAINS
|
31
|
+
* @example
|
32
|
+
* ```ts
|
33
|
+
* import { isReverseNameOfSupported } from "thirdweb/extensions/unstoppable-domains";
|
34
|
+
* const supported = isReverseNameOfSupported(["0x..."]);
|
35
|
+
* ```
|
36
|
+
*/
|
37
|
+
function isReverseNameOfSupported(availableSelectors) {
|
38
|
+
return (0, detectExtension_js_1.detectMethod)({
|
39
|
+
availableSelectors,
|
40
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
41
|
+
});
|
42
|
+
}
|
43
|
+
/**
|
44
|
+
* Encodes the parameters for the "reverseNameOf" function.
|
45
|
+
* @param options - The options for the reverseNameOf function.
|
46
|
+
* @returns The encoded ABI parameters.
|
47
|
+
* @extension UNSTOPPABLE-DOMAINS
|
48
|
+
* @example
|
49
|
+
* ```ts
|
50
|
+
* import { encodeReverseNameOfParams } from "thirdweb/extensions/unstoppable-domains";
|
51
|
+
* const result = encodeReverseNameOfParams({
|
52
|
+
* addr: ...,
|
53
|
+
* });
|
54
|
+
* ```
|
55
|
+
*/
|
56
|
+
function encodeReverseNameOfParams(options) {
|
57
|
+
return (0, encodeAbiParameters_js_1.encodeAbiParameters)(FN_INPUTS, [options.addr]);
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Encodes the "reverseNameOf" function into a Hex string with its parameters.
|
61
|
+
* @param options - The options for the reverseNameOf function.
|
62
|
+
* @returns The encoded hexadecimal string.
|
63
|
+
* @extension UNSTOPPABLE-DOMAINS
|
64
|
+
* @example
|
65
|
+
* ```ts
|
66
|
+
* import { encodeReverseNameOf } from "thirdweb/extensions/unstoppable-domains";
|
67
|
+
* const result = encodeReverseNameOf({
|
68
|
+
* addr: ...,
|
69
|
+
* });
|
70
|
+
* ```
|
71
|
+
*/
|
72
|
+
function encodeReverseNameOf(options) {
|
73
|
+
// we do a "manual" concat here to avoid the overhead of the "concatHex" function
|
74
|
+
// we can do this because we know the specific formats of the values
|
75
|
+
return (exports.FN_SELECTOR +
|
76
|
+
encodeReverseNameOfParams(options).slice(2));
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Decodes the result of the reverseNameOf function call.
|
80
|
+
* @param result - The hexadecimal result to decode.
|
81
|
+
* @returns The decoded result as per the FN_OUTPUTS definition.
|
82
|
+
* @extension UNSTOPPABLE-DOMAINS
|
83
|
+
* @example
|
84
|
+
* ```ts
|
85
|
+
* import { decodeReverseNameOfResult } from "thirdweb/extensions/unstoppable-domains";
|
86
|
+
* const result = decodeReverseNameOfResultResult("...");
|
87
|
+
* ```
|
88
|
+
*/
|
89
|
+
function decodeReverseNameOfResult(result) {
|
90
|
+
return (0, viem_1.decodeAbiParameters)(FN_OUTPUTS, result)[0];
|
91
|
+
}
|
92
|
+
/**
|
93
|
+
* Calls the "reverseNameOf" function on the contract.
|
94
|
+
* @param options - The options for the reverseNameOf function.
|
95
|
+
* @returns The parsed result of the function call.
|
96
|
+
* @extension UNSTOPPABLE-DOMAINS
|
97
|
+
* @example
|
98
|
+
* ```ts
|
99
|
+
* import { reverseNameOf } from "thirdweb/extensions/unstoppable-domains";
|
100
|
+
*
|
101
|
+
* const result = await reverseNameOf({
|
102
|
+
* contract,
|
103
|
+
* addr: ...,
|
104
|
+
* });
|
105
|
+
*
|
106
|
+
* ```
|
107
|
+
*/
|
108
|
+
async function reverseNameOf(options) {
|
109
|
+
return (0, read_contract_js_1.readContract)({
|
110
|
+
contract: options.contract,
|
111
|
+
method: [exports.FN_SELECTOR, FN_INPUTS, FN_OUTPUTS],
|
112
|
+
params: [options.addr],
|
113
|
+
});
|
114
|
+
}
|
115
|
+
//# 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":";;;AAwCA,4DAKC;AAeD,8DAEC;AAeD,kDAOC;AAaD,8DAEC;AAkBD,sCAQC;AA5HD,kFAA2E;AAE3E,4FAAsF;AACtF,+BAA2C;AAE3C,yFAAgF;AASnE,QAAA,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,SAAgB,wBAAwB,CAAC,kBAA4B;IACnE,OAAO,IAAA,iCAAY,EAAC;QAClB,kBAAkB;QAClB,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;KACtD,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,yBAAyB,CAAC,OAA4B;IACpE,OAAO,IAAA,4CAAmB,EAAC,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,mBAAmB,CAAC,OAA4B;IAC9D,iFAAiF;IACjF,oEAAoE;IACpE,OAAO,CAAC,mBAAW;QACjB,yBAAyB,CAAC,OAAO,CAAC,CAAC,KAAK,CACtC,CAAC,CACF,CAAqC,CAAC;AAC3C,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,yBAAyB,CAAC,MAAW;IACnD,OAAO,IAAA,0BAAmB,EAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACI,KAAK,UAAU,aAAa,CACjC,OAAoD;IAEpD,OAAO,IAAA,+BAAY,EAAC;QAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,MAAM,EAAE,CAAC,mBAAW,EAAE,SAAS,EAAE,UAAU,CAAU;QACrD,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;KACvB,CAAC,CAAC;AACL,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../../src/extensions/unstoppable-domains/consts.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,4CAA4C,CAAC"}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.resolveAddress = resolveAddress;
|
4
|
+
const polygon_js_1 = require("../../../chains/chain-definitions/polygon.js");
|
5
|
+
const contract_js_1 = require("../../../contract/contract.js");
|
6
|
+
const address_js_1 = require("../../../utils/address.js");
|
7
|
+
const withCache_js_1 = require("../../../utils/promise/withCache.js");
|
8
|
+
const getMany_js_1 = require("../__generated__/UnstoppableDomains/read/getMany.js");
|
9
|
+
const namehash_js_1 = require("../__generated__/UnstoppableDomains/read/namehash.js");
|
10
|
+
const consts_js_1 = require("../consts.js");
|
11
|
+
/**
|
12
|
+
* Resolve an Unstoppable-Domain domain to an Ethereum address
|
13
|
+
* @param options - The options for resolving an UD domain
|
14
|
+
* @returns The Ethereum address associated with the domain name. [Learn more](https://docs.unstoppabledomains.com/reverse-resolution/)
|
15
|
+
* @example
|
16
|
+
*
|
17
|
+
* ### Basic usage
|
18
|
+
* ```ts
|
19
|
+
* import { resolveAddress } from "thirdweb/extension/unstoppable-domains";
|
20
|
+
*
|
21
|
+
* const address = await resolveAddress({
|
22
|
+
* client,
|
23
|
+
* name: "thirdweb.crypto",
|
24
|
+
* });
|
25
|
+
* ```
|
26
|
+
*
|
27
|
+
* ### Custom resolver
|
28
|
+
* By default this extension will try to resolve the name on Polygon mainnet,
|
29
|
+
* you can decide to customize the resolver contract by specifying `resolverAddress` and `resolverChain`
|
30
|
+
* ```ts
|
31
|
+
* import { ethereum } from "thirdweb/chains";
|
32
|
+
*
|
33
|
+
* const address = await resolveAddress({
|
34
|
+
* client,
|
35
|
+
* name: "thirdweb.crypto",
|
36
|
+
* resolverAddress: "0x...",
|
37
|
+
* resolverChain: ethereum,
|
38
|
+
* });
|
39
|
+
* ```
|
40
|
+
*
|
41
|
+
* @extension UNSTOPPABLE-DOMAINS
|
42
|
+
*/
|
43
|
+
async function resolveAddress(options) {
|
44
|
+
const { client, name, resolverAddress, resolverChain } = options;
|
45
|
+
if ((0, address_js_1.isAddress)(name)) {
|
46
|
+
return (0, address_js_1.getAddress)(name);
|
47
|
+
}
|
48
|
+
return (0, withCache_js_1.withCache)(async () => {
|
49
|
+
const contract = (0, contract_js_1.getContract)({
|
50
|
+
client,
|
51
|
+
chain: resolverChain || polygon_js_1.polygon,
|
52
|
+
address: resolverAddress || consts_js_1.UD_POLYGON_MAINNET,
|
53
|
+
});
|
54
|
+
// Get namehash
|
55
|
+
const possibleTokenId = await (0, namehash_js_1.namehash)({
|
56
|
+
contract,
|
57
|
+
labels: name.split("."),
|
58
|
+
});
|
59
|
+
// Resolve ETH address from the tokenId
|
60
|
+
const resolved = await (0, getMany_js_1.getMany)({
|
61
|
+
contract,
|
62
|
+
tokenId: possibleTokenId,
|
63
|
+
// note that you can also retrieve the (BTC, SOL, etc.) address by using "crypto.<symbol>.address" (should that become useful one day)
|
64
|
+
keys: ["crypto.ETH.address"],
|
65
|
+
});
|
66
|
+
const possibleETHAddress = resolved[0];
|
67
|
+
if (!possibleETHAddress) {
|
68
|
+
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>`);
|
69
|
+
}
|
70
|
+
return possibleETHAddress;
|
71
|
+
}, {
|
72
|
+
cacheKey: `unstoppable-domain:addr:${resolverChain?.id || 1}:${name}`,
|
73
|
+
// 1min cache
|
74
|
+
cacheTime: 60 * 1000,
|
75
|
+
});
|
76
|
+
}
|
77
|
+
//# sourceMappingURL=resolveAddress.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resolveAddress.js","sourceRoot":"","sources":["../../../../../src/extensions/unstoppable-domains/read/resolveAddress.ts"],"names":[],"mappings":";;AAoDA,wCA2CC;AA/FD,6EAAuE;AAGvE,+DAA4D;AAC5D,0DAAkE;AAClE,sEAAgE;AAChE,oFAA8E;AAC9E,sFAAgF;AAChF,4CAAkD;AAYlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,KAAK,UAAU,cAAc,CAClC,OAA8B;IAE9B,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACjE,IAAI,IAAA,sBAAS,EAAC,IAAI,CAAC,EAAE,CAAC;QACpB,OAAO,IAAA,uBAAU,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;IACD,OAAO,IAAA,wBAAS,EACd,KAAK,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC;YAC3B,MAAM;YACN,KAAK,EAAE,aAAa,IAAI,oBAAO;YAC/B,OAAO,EAAE,eAAe,IAAI,8BAAkB;SAC/C,CAAC,CAAC;QAEH,eAAe;QACf,MAAM,eAAe,GAAG,MAAM,IAAA,sBAAQ,EAAC;YACrC,QAAQ;YACR,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SACxB,CAAC,CAAC;QAEH,uCAAuC;QACvC,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAO,EAAC;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,60 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.resolveName = resolveName;
|
4
|
+
const polygon_js_1 = require("../../../chains/chain-definitions/polygon.js");
|
5
|
+
const contract_js_1 = require("../../../contract/contract.js");
|
6
|
+
const withCache_js_1 = require("../../../utils/promise/withCache.js");
|
7
|
+
const reverseNameOf_js_1 = require("../__generated__/UnstoppableDomains/read/reverseNameOf.js");
|
8
|
+
const consts_js_1 = require("../consts.js");
|
9
|
+
/**
|
10
|
+
* Resolves the primary Untoppable-Domains name for a specified address.
|
11
|
+
* @param options - The options for resolving an UD domain
|
12
|
+
* @example
|
13
|
+
*
|
14
|
+
* ### Basic usage
|
15
|
+
* ```ts
|
16
|
+
* import { resolveName } from "thirdweb/extension/unstoppable-domains";
|
17
|
+
*
|
18
|
+
* const name = await resolveName({
|
19
|
+
* client,
|
20
|
+
* address: "0x...",
|
21
|
+
* });
|
22
|
+
* ```
|
23
|
+
*
|
24
|
+
* ### Custom resolver
|
25
|
+
* By default this extension will try to resolve the address 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 resolveName({
|
31
|
+
* client,
|
32
|
+
* address: "0x...",
|
33
|
+
* resolverAddress: "0x...",
|
34
|
+
* resolverChain: ethereum,
|
35
|
+
* });
|
36
|
+
* ```
|
37
|
+
* @extension UNSTOPPABLE-DOMAINS
|
38
|
+
*/
|
39
|
+
async function resolveName(options) {
|
40
|
+
const { client, address, resolverAddress, resolverChain } = options;
|
41
|
+
return (0, withCache_js_1.withCache)(async () => {
|
42
|
+
const contract = (0, contract_js_1.getContract)({
|
43
|
+
client,
|
44
|
+
chain: resolverChain || polygon_js_1.polygon,
|
45
|
+
address: resolverAddress || consts_js_1.UD_POLYGON_MAINNET,
|
46
|
+
});
|
47
|
+
// Note: if the given wallet address does not have any UD name, `reverseNameOf` will return an empty string
|
48
|
+
// 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
|
49
|
+
const domain = await (0, reverseNameOf_js_1.reverseNameOf)({ contract, addr: address });
|
50
|
+
if (!domain) {
|
51
|
+
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`);
|
52
|
+
}
|
53
|
+
return domain;
|
54
|
+
}, {
|
55
|
+
cacheKey: `unstoppable-domain:name:${resolverChain?.id || 1}:${address}`,
|
56
|
+
// 1min cache
|
57
|
+
cacheTime: 60 * 1000,
|
58
|
+
});
|
59
|
+
}
|
60
|
+
//# sourceMappingURL=resolveName.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"resolveName.js","sourceRoot":"","sources":["../../../../../src/extensions/unstoppable-domains/read/resolveName.ts"],"names":[],"mappings":";;AAgDA,kCA4BC;AA5ED,6EAAuE;AAGvE,+DAA4D;AAC5D,sEAAgE;AAChE,gGAA0F;AAC1F,4CAAkD;AAYlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACI,KAAK,UAAU,WAAW,CAC/B,OAA6B;IAE7B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;IACpE,OAAO,IAAA,wBAAS,EACd,KAAK,IAAI,EAAE;QACT,MAAM,QAAQ,GAAG,IAAA,yBAAW,EAAC;YAC3B,MAAM;YACN,KAAK,EAAE,aAAa,IAAI,oBAAO;YAC/B,OAAO,EAAE,eAAe,IAAI,8BAAkB;SAC/C,CAAC,CAAC;QAEH,2GAA2G;QAC3G,yIAAyI;QACzI,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAa,EAAC,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,92 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useLinkProfile = useLinkProfile;
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
5
|
+
const is_ecosystem_wallet_js_1 = require("../../../../wallets/ecosystem/is-ecosystem-wallet.js");
|
6
|
+
const index_js_1 = require("../../../../wallets/in-app/web/lib/auth/index.js");
|
7
|
+
const useAdminWallet_js_1 = require("../../../core/hooks/wallets/useAdminWallet.js");
|
8
|
+
/**
|
9
|
+
* Links a web2 or web3 profile to the connected in-app or ecosystem account.
|
10
|
+
*
|
11
|
+
* **When a profile is linked to the account, that profile can then be used to sign into the same account.**
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
*
|
15
|
+
* ### Linking a social profile
|
16
|
+
*
|
17
|
+
* ```jsx
|
18
|
+
* import { useLinkProfile } from "thirdweb/react";
|
19
|
+
*
|
20
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
21
|
+
*
|
22
|
+
* const onClick = () => {
|
23
|
+
* linkProfile({
|
24
|
+
* client,
|
25
|
+
* strategy: "discord", // or "google", "x", "telegram", etc
|
26
|
+
* });
|
27
|
+
* };
|
28
|
+
* ```
|
29
|
+
*
|
30
|
+
* ### Linking an email
|
31
|
+
*
|
32
|
+
* ```jsx
|
33
|
+
* import { useLinkProfile } from "thirdweb/react";
|
34
|
+
* import { preAuthenticate } from "thirdweb/wallets";
|
35
|
+
*
|
36
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
37
|
+
*
|
38
|
+
* // send a verification email first
|
39
|
+
* const sendEmail = async () => {
|
40
|
+
* const email = await preAuthenticate({
|
41
|
+
* client,
|
42
|
+
* strategy: "email",
|
43
|
+
* email: "john.doe@example.com",
|
44
|
+
* });
|
45
|
+
* };
|
46
|
+
*
|
47
|
+
* // then link the profile with the verification code
|
48
|
+
* const onClick = (code: string) => {
|
49
|
+
* linkProfile({
|
50
|
+
* client,
|
51
|
+
* strategy: "email",
|
52
|
+
* email: "john.doe@example.com",
|
53
|
+
* verificationCode: code,
|
54
|
+
* });
|
55
|
+
* };
|
56
|
+
* ```
|
57
|
+
*
|
58
|
+
* The same process can be used for phone and email, simply swap out the `strategy` parameter.
|
59
|
+
*
|
60
|
+
* ### Linking a wallet
|
61
|
+
*
|
62
|
+
* ```jsx
|
63
|
+
* import { useLinkProfile } from "thirdweb/react";
|
64
|
+
*
|
65
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
66
|
+
*
|
67
|
+
* const onClick = () => {
|
68
|
+
* linkProfile({
|
69
|
+
* client,
|
70
|
+
* strategy: "wallet",
|
71
|
+
* wallet: createWallet("io.metamask"), // autocompletion for 400+ wallet ids
|
72
|
+
* chain: sepolia, // any chain works, needed for SIWE signature
|
73
|
+
* });
|
74
|
+
* };
|
75
|
+
* ```
|
76
|
+
*
|
77
|
+
* @wallet
|
78
|
+
*/
|
79
|
+
function useLinkProfile() {
|
80
|
+
const wallet = (0, useAdminWallet_js_1.useAdminWallet)();
|
81
|
+
return (0, react_query_1.useMutation)({
|
82
|
+
mutationKey: ["profiles"],
|
83
|
+
mutationFn: async (options) => {
|
84
|
+
const ecosystem = wallet && (0, is_ecosystem_wallet_js_1.isEcosystemWallet)(wallet)
|
85
|
+
? { id: wallet.id, partnerId: wallet.getConfig()?.partnerId }
|
86
|
+
: undefined;
|
87
|
+
const optionsWithEcosystem = { ...options, ecosystem };
|
88
|
+
return (0, index_js_1.linkProfile)(optionsWithEcosystem);
|
89
|
+
},
|
90
|
+
});
|
91
|
+
}
|
92
|
+
//# sourceMappingURL=useLinkProfile.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLinkProfile.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useLinkProfile.ts"],"names":[],"mappings":";;AA8EA,wCAaC;AA3FD,uDAAoD;AACpD,iGAAyF;AAGzF,+EAA+E;AAC/E,qFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,SAAgB,cAAc;IAC5B,MAAM,MAAM,GAAG,IAAA,kCAAc,GAAE,CAAC;IAChC,OAAO,IAAA,yBAAW,EAAC;QACjB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,UAAU,EAAE,KAAK,EAAE,OAAwC,EAAE,EAAE;YAC7D,MAAM,SAAS,GACb,MAAM,IAAI,IAAA,0CAAiB,EAAC,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,IAAA,sBAAW,EAAC,oBAAoB,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -6,11 +6,10 @@ const is_ecosystem_wallet_js_1 = require("../../../../wallets/ecosystem/is-ecosy
|
|
6
6
|
const index_js_1 = require("../../../../wallets/in-app/web/lib/auth/index.js");
|
7
7
|
const useAdminWallet_js_1 = require("../../../core/hooks/wallets/useAdminWallet.js");
|
8
8
|
/**
|
9
|
-
* Retrieves all linked profiles of the connected in-app or ecosystem
|
9
|
+
* Retrieves all linked profiles of the connected in-app or ecosystem account.
|
10
10
|
*
|
11
|
-
* @returns A React Query result containing the linked profiles for the connected in-app
|
12
|
-
*
|
13
|
-
* @note This hook will only run if the connected wallet supports multi-auth (in-app wallets).
|
11
|
+
* @returns A React Query result containing the linked profiles for the connected in-app account.
|
12
|
+
* @note This hook will only run if the connected wallet supports account linking.
|
14
13
|
*
|
15
14
|
* @example
|
16
15
|
* ```jsx
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useProfiles.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/native/hooks/wallets/useProfiles.ts"],"names":[],"mappings":";;AA4BA,kCAkBC;AA9CD,uDAAsE;AAEtE,iGAAyF;AAGzF,+EAA+E;AAC/E,qFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,IAAA,kCAAc,GAAE,CAAC;IAChC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,IAAA,0CAAiB,EAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,IAAA,0CAAiB,EAAC,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,IAAA,sBAAW,EAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -0,0 +1,91 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.useLinkProfile = useLinkProfile;
|
4
|
+
const react_query_1 = require("@tanstack/react-query");
|
5
|
+
const is_ecosystem_wallet_js_1 = require("../../../../wallets/ecosystem/is-ecosystem-wallet.js");
|
6
|
+
const index_js_1 = require("../../../../wallets/in-app/web/lib/auth/index.js");
|
7
|
+
const useAdminWallet_js_1 = require("../../../core/hooks/wallets/useAdminWallet.js");
|
8
|
+
/**
|
9
|
+
* Links a web2 or web3 profile to the connected in-app or ecosystem account.
|
10
|
+
* **When a profile is linked to the account, that profile can then be used to sign into the same account.**
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
*
|
14
|
+
* ### Linking a social profile
|
15
|
+
*
|
16
|
+
* ```jsx
|
17
|
+
* import { useLinkProfile } from "thirdweb/react";
|
18
|
+
*
|
19
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
20
|
+
*
|
21
|
+
* const onClick = () => {
|
22
|
+
* linkProfile({
|
23
|
+
* client,
|
24
|
+
* strategy: "discord", // or "google", "x", "telegram", etc
|
25
|
+
* });
|
26
|
+
* };
|
27
|
+
* ```
|
28
|
+
*
|
29
|
+
* ### Linking an email
|
30
|
+
*
|
31
|
+
* ```jsx
|
32
|
+
* import { useLinkProfile } from "thirdweb/react";
|
33
|
+
* import { preAuthenticate } from "thirdweb/wallets";
|
34
|
+
*
|
35
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
36
|
+
*
|
37
|
+
* // send a verification email first
|
38
|
+
* const sendEmail = async () => {
|
39
|
+
* const email = await preAuthenticate({
|
40
|
+
* client,
|
41
|
+
* strategy: "email",
|
42
|
+
* email: "john.doe@example.com",
|
43
|
+
* });
|
44
|
+
* };
|
45
|
+
*
|
46
|
+
* // then link the profile with the verification code
|
47
|
+
* const onClick = (code: string) => {
|
48
|
+
* linkProfile({
|
49
|
+
* client,
|
50
|
+
* strategy: "email",
|
51
|
+
* email: "john.doe@example.com",
|
52
|
+
* verificationCode: code,
|
53
|
+
* });
|
54
|
+
* };
|
55
|
+
* ```
|
56
|
+
*
|
57
|
+
* The same process can be used for phone and email, simply swap out the `strategy` parameter.
|
58
|
+
*
|
59
|
+
* ### Linking a wallet
|
60
|
+
*
|
61
|
+
* ```jsx
|
62
|
+
* import { useLinkProfile } from "thirdweb/react";
|
63
|
+
*
|
64
|
+
* const { mutate: linkProfile } = useLinkProfile();
|
65
|
+
*
|
66
|
+
* const onClick = () => {
|
67
|
+
* linkProfile({
|
68
|
+
* client,
|
69
|
+
* strategy: "wallet",
|
70
|
+
* wallet: createWallet("io.metamask"), // autocompletion for 400+ wallet ids
|
71
|
+
* chain: sepolia, // any chain works, needed for SIWE signature
|
72
|
+
* });
|
73
|
+
* };
|
74
|
+
* ```
|
75
|
+
*
|
76
|
+
* @wallet
|
77
|
+
*/
|
78
|
+
function useLinkProfile() {
|
79
|
+
const wallet = (0, useAdminWallet_js_1.useAdminWallet)();
|
80
|
+
return (0, react_query_1.useMutation)({
|
81
|
+
mutationKey: ["profiles"],
|
82
|
+
mutationFn: async (options) => {
|
83
|
+
const ecosystem = wallet && (0, is_ecosystem_wallet_js_1.isEcosystemWallet)(wallet)
|
84
|
+
? { id: wallet.id, partnerId: wallet.getConfig()?.partnerId }
|
85
|
+
: undefined;
|
86
|
+
const optionsWithEcosystem = { ...options, ecosystem };
|
87
|
+
return (0, index_js_1.linkProfile)(optionsWithEcosystem);
|
88
|
+
},
|
89
|
+
});
|
90
|
+
}
|
91
|
+
//# sourceMappingURL=useLinkProfile.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLinkProfile.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useLinkProfile.ts"],"names":[],"mappings":";;AA6EA,wCAaC;AA1FD,uDAAoD;AACpD,iGAAyF;AAGzF,+EAA+E;AAC/E,qFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,SAAgB,cAAc;IAC5B,MAAM,MAAM,GAAG,IAAA,kCAAc,GAAE,CAAC;IAChC,OAAO,IAAA,yBAAW,EAAC;QACjB,WAAW,EAAE,CAAC,UAAU,CAAC;QACzB,UAAU,EAAE,KAAK,EAAE,OAAqB,EAAE,EAAE;YAC1C,MAAM,SAAS,GACb,MAAM,IAAI,IAAA,0CAAiB,EAAC,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,IAAA,sBAAW,EAAC,oBAAoB,CAAC,CAAC;QAC3C,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -6,11 +6,10 @@ const is_ecosystem_wallet_js_1 = require("../../../../wallets/ecosystem/is-ecosy
|
|
6
6
|
const index_js_1 = require("../../../../wallets/in-app/web/lib/auth/index.js");
|
7
7
|
const useAdminWallet_js_1 = require("../../../core/hooks/wallets/useAdminWallet.js");
|
8
8
|
/**
|
9
|
-
* Retrieves all linked profiles of the connected in-app or ecosystem
|
9
|
+
* Retrieves all linked profiles of the connected in-app or ecosystem account.
|
10
10
|
*
|
11
|
-
* @returns A React Query result containing the linked profiles for the connected in-app
|
12
|
-
*
|
13
|
-
* @note This hook will only run if the connected wallet supports multi-auth (in-app wallets).
|
11
|
+
* @returns A React Query result containing the linked profiles for the connected in-app account.
|
12
|
+
* @note This hook will only run if the connected wallet supports account linking.
|
14
13
|
*
|
15
14
|
* @example
|
16
15
|
* ```jsx
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useProfiles.ts"],"names":[],"mappings":";;
|
1
|
+
{"version":3,"file":"useProfiles.js","sourceRoot":"","sources":["../../../../../../src/react/web/hooks/wallets/useProfiles.ts"],"names":[],"mappings":";;AA4BA,kCAkBC;AA9CD,uDAAsE;AAEtE,iGAAyF;AAGzF,+EAA+E;AAC/E,qFAA+E;AAE/E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,WAAW,CAAC,IAE3B;IACC,MAAM,MAAM,GAAG,IAAA,kCAAc,GAAE,CAAC;IAChC,OAAO,IAAA,sBAAQ,EAAC;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;QAClC,OAAO,EAAE,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,OAAO,IAAI,IAAA,0CAAiB,EAAC,MAAM,CAAC,CAAC;QACzE,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,SAAS,GACb,MAAM,IAAI,IAAA,0CAAiB,EAAC,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,IAAA,sBAAW,EAAC;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,SAAS;aACV,CAAC,CAAC;QACL,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"isZkSyncChain.js","sourceRoot":"","sources":["../../../../../src/utils/any-evm/zksync/isZkSyncChain.ts"],"names":[],"mappings":";;AAGA,
|
1
|
+
{"version":3,"file":"isZkSyncChain.js","sourceRoot":"","sources":["../../../../../src/utils/any-evm/zksync/isZkSyncChain.ts"],"names":[],"mappings":";;AAGA,sCA4BC;AA9BD,uDAA4D;AAErD,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,IAAA,2BAAgB,EAAC,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"}
|
package/dist/cjs/version.js
CHANGED
@@ -7,28 +7,27 @@ const fetch_js_1 = require("../../../../utils/fetch.js");
|
|
7
7
|
* Gets user based on the provided query parameters.
|
8
8
|
* @note This function is only available on the server (a secret key is required in the client).
|
9
9
|
*
|
10
|
-
* @param options - The options for the
|
10
|
+
* @param options - The options for the get user function.
|
11
11
|
* @param options.client - The Thirdweb client with a secret key included.
|
12
|
-
* @param [options.walletAddress] - The wallet address to query by.
|
12
|
+
* @param [options.walletAddress] - The wallet address generated by thirdweb to query by.
|
13
13
|
* @param [options.email] - The email to query by.
|
14
14
|
* @param [options.phone] - The phone number to query by.
|
15
15
|
* @param [options.id] - The user ID to query by.
|
16
|
+
* @param [options.externalWalletAddress] - The linked external wallet address to query by.
|
16
17
|
*
|
17
|
-
* @returns
|
18
|
+
* @returns A user object or null if not found.
|
18
19
|
*
|
19
20
|
* @example
|
20
|
-
* ```ts
|
21
21
|
* import { getUser } from "thirdweb/wallets";
|
22
22
|
*
|
23
23
|
* const user = await getUser({
|
24
24
|
* client,
|
25
25
|
* walletAddress: "0x123...",
|
26
26
|
* });
|
27
|
-
* ```
|
28
27
|
*
|
29
28
|
* @wallet
|
30
29
|
*/
|
31
|
-
async function getUser({ client, walletAddress, email, phone, id, }) {
|
30
|
+
async function getUser({ client, walletAddress, email, phone, id, externalWalletAddress, ecosystem, }) {
|
32
31
|
if (!client.secretKey) {
|
33
32
|
throw new Error("A secret key is required to query for users. If you're making this request from the server, please add a secret key to your client.");
|
34
33
|
}
|
@@ -49,10 +48,14 @@ async function getUser({ client, walletAddress, email, phone, id, }) {
|
|
49
48
|
url.searchParams.set("queryBy", "id");
|
50
49
|
url.searchParams.set("id", id);
|
51
50
|
}
|
51
|
+
else if (externalWalletAddress) {
|
52
|
+
url.searchParams.set("queryBy", "externalWalletAddress");
|
53
|
+
url.searchParams.set("externalWalletAddress", externalWalletAddress);
|
54
|
+
}
|
52
55
|
else {
|
53
|
-
throw new Error("Please provide a walletAddress, email, phone, or
|
56
|
+
throw new Error("Please provide a walletAddress, email, phone, id, or externalWalletAddress to query for users.");
|
54
57
|
}
|
55
|
-
const clientFetch = (0, fetch_js_1.getClientFetch)(client);
|
58
|
+
const clientFetch = (0, fetch_js_1.getClientFetch)(client, ecosystem);
|
56
59
|
const res = await clientFetch(url.toString());
|
57
60
|
if (!res.ok) {
|
58
61
|
throw new Error("Failed to get profiles");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"getUser.js","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/users/getUser.ts"],"names":[],"mappings":";;AAwCA,
|
1
|
+
{"version":3,"file":"getUser.js","sourceRoot":"","sources":["../../../../../../src/wallets/in-app/core/users/getUser.ts"],"names":[],"mappings":";;AAwCA,0BA8EC;AArHD,6DAAkE;AAClE,yDAA4D;AAc5D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACI,KAAK,UAAU,OAAO,CAAC,EAC5B,MAAM,EACN,aAAa,EACb,KAAK,EACL,KAAK,EACL,EAAE,EACF,qBAAqB,EACrB,SAAS,GAYV;IACC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;QACtB,MAAM,IAAI,KAAK,CACb,qIAAqI,CACtI,CAAC;IACJ,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,GAAG,IAAA,+BAAkB,EAAC,aAAa,CAAC,8CAA8C,CACnF,CAAC;IAEF,IAAI,aAAa,EAAE,CAAC;QAClB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;QACjD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC;IACvD,CAAC;SAAM,IAAI,KAAK,EAAE,CAAC;QACjB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,KAAK,EAAE,CAAC;QACjB,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACvC,CAAC;SAAM,IAAI,EAAE,EAAE,CAAC;QACd,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QACtC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjC,CAAC;SAAM,IAAI,qBAAqB,EAAE,CAAC;QACjC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;QACzD,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;IACvE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,gGAAgG,CACjG,CAAC;IACJ,CAAC;IAED,MAAM,WAAW,GAAG,IAAA,yBAAc,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEtD,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE9C,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAO3B,CAAC;IAEJ,OAAO,CACL,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAClB,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,IAAI,CAAC,cAAc;KAC9B,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CACf,CAAC;AACJ,CAAC"}
|