@iota/dapp-kit 0.10.4 → 0.11.1
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/CHANGELOG.md +29 -0
- package/dist/cjs/components/AccountDropdownMenu.css +50 -16
- package/dist/cjs/components/AccountDropdownMenu.css.css +39 -16
- package/dist/cjs/components/AccountDropdownMenu.css.css.map +3 -3
- package/dist/cjs/components/AccountDropdownMenu.css.d.ts +3 -0
- package/dist/cjs/components/AccountDropdownMenu.css.d.ts.map +1 -1
- package/dist/cjs/components/AccountDropdownMenu.css.js +12 -6
- package/dist/cjs/components/AccountDropdownMenu.css.js.map +2 -2
- package/dist/cjs/components/AccountDropdownMenu.css.map +3 -3
- package/dist/cjs/components/AccountDropdownMenu.d.ts.map +1 -1
- package/dist/cjs/components/AccountDropdownMenu.js +184 -86
- package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
- package/dist/cjs/components/ConnectButton.css +50 -16
- package/dist/cjs/components/ConnectButton.css.map +3 -3
- package/dist/cjs/components/ConnectButton.js +259 -161
- package/dist/cjs/components/ConnectButton.js.map +4 -4
- package/dist/cjs/components/IotaNameNftImage.css +11 -0
- package/dist/cjs/components/IotaNameNftImage.css.css +11 -0
- package/dist/cjs/components/IotaNameNftImage.css.css.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.css.d.ts +2 -0
- package/dist/cjs/components/IotaNameNftImage.css.d.ts.map +1 -0
- package/dist/cjs/components/IotaNameNftImage.css.js +27 -0
- package/dist/cjs/components/IotaNameNftImage.css.js.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.css.map +7 -0
- package/dist/cjs/components/IotaNameNftImage.d.ts +8 -0
- package/dist/cjs/components/IotaNameNftImage.d.ts.map +1 -0
- package/dist/cjs/components/IotaNameNftImage.js +165 -0
- package/dist/cjs/components/IotaNameNftImage.js.map +7 -0
- package/dist/cjs/hooks/useGetDefaultIotaName.d.ts +1 -1
- package/dist/cjs/hooks/useGetDefaultIotaName.d.ts.map +1 -1
- package/dist/cjs/hooks/useGetDefaultIotaName.js +26 -16
- package/dist/cjs/hooks/useGetDefaultIotaName.js.map +4 -4
- package/dist/cjs/hooks/useGetIotaNameAvatar.d.ts +2 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.d.ts.map +1 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.js +144 -0
- package/dist/cjs/hooks/useGetIotaNameAvatar.js.map +7 -0
- package/dist/cjs/hooks/useIotaClientInfiniteQuery.d.ts +1 -1
- package/dist/cjs/hooks/useIotaClientInfiniteQuery.d.ts.map +1 -1
- package/dist/cjs/hooks/useIotaClientInfiniteQuery.js +1 -0
- package/dist/cjs/hooks/useIotaClientInfiniteQuery.js.map +2 -2
- package/dist/cjs/hooks/useIotaNamesClient.d.ts +7 -0
- package/dist/cjs/hooks/useIotaNamesClient.d.ts.map +1 -0
- package/dist/cjs/hooks/useIotaNamesClient.js +71 -0
- package/dist/cjs/hooks/useIotaNamesClient.js.map +7 -0
- package/dist/cjs/index.css +50 -16
- package/dist/cjs/index.css.map +3 -3
- package/dist/cjs/index.js +172 -76
- package/dist/cjs/index.js.map +4 -4
- package/dist/esm/components/AccountDropdownMenu.css +50 -16
- package/dist/esm/components/AccountDropdownMenu.css.css +39 -16
- package/dist/esm/components/AccountDropdownMenu.css.css.map +3 -3
- package/dist/esm/components/AccountDropdownMenu.css.d.ts +3 -0
- package/dist/esm/components/AccountDropdownMenu.css.d.ts.map +1 -1
- package/dist/esm/components/AccountDropdownMenu.css.js +12 -6
- package/dist/esm/components/AccountDropdownMenu.css.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.css.map +3 -3
- package/dist/esm/components/AccountDropdownMenu.d.ts.map +1 -1
- package/dist/esm/components/AccountDropdownMenu.js +177 -79
- package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
- package/dist/esm/components/ConnectButton.css +50 -16
- package/dist/esm/components/ConnectButton.css.map +3 -3
- package/dist/esm/components/ConnectButton.js +236 -138
- package/dist/esm/components/ConnectButton.js.map +4 -4
- package/dist/esm/components/IotaNameNftImage.css +11 -0
- package/dist/esm/components/IotaNameNftImage.css.css +11 -0
- package/dist/esm/components/IotaNameNftImage.css.css.map +7 -0
- package/dist/esm/components/IotaNameNftImage.css.d.ts +2 -0
- package/dist/esm/components/IotaNameNftImage.css.d.ts.map +1 -0
- package/dist/esm/components/IotaNameNftImage.css.js +6 -0
- package/dist/esm/components/IotaNameNftImage.css.js.map +7 -0
- package/dist/esm/components/IotaNameNftImage.css.map +7 -0
- package/dist/esm/components/IotaNameNftImage.d.ts +8 -0
- package/dist/esm/components/IotaNameNftImage.d.ts.map +1 -0
- package/dist/esm/components/IotaNameNftImage.js +144 -0
- package/dist/esm/components/IotaNameNftImage.js.map +7 -0
- package/dist/esm/hooks/useGetDefaultIotaName.d.ts +1 -1
- package/dist/esm/hooks/useGetDefaultIotaName.d.ts.map +1 -1
- package/dist/esm/hooks/useGetDefaultIotaName.js +26 -16
- package/dist/esm/hooks/useGetDefaultIotaName.js.map +4 -4
- package/dist/esm/hooks/useGetIotaNameAvatar.d.ts +2 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.d.ts.map +1 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.js +123 -0
- package/dist/esm/hooks/useGetIotaNameAvatar.js.map +7 -0
- package/dist/esm/hooks/useIotaClientInfiniteQuery.d.ts +1 -1
- package/dist/esm/hooks/useIotaClientInfiniteQuery.d.ts.map +1 -1
- package/dist/esm/hooks/useIotaClientInfiniteQuery.js +1 -0
- package/dist/esm/hooks/useIotaClientInfiniteQuery.js.map +2 -2
- package/dist/esm/hooks/useIotaNamesClient.d.ts +7 -0
- package/dist/esm/hooks/useIotaNamesClient.d.ts.map +1 -0
- package/dist/esm/hooks/useIotaNamesClient.js +50 -0
- package/dist/esm/hooks/useIotaNamesClient.js.map +7 -0
- package/dist/esm/index.css +50 -16
- package/dist/esm/index.css.map +3 -3
- package/dist/esm/index.js +143 -47
- package/dist/esm/index.js.map +4 -4
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -10
- package/src/components/AccountDropdownMenu.css.ts +24 -1
- package/src/components/AccountDropdownMenu.tsx +12 -2
- package/src/components/IotaNameNftImage.css.ts +14 -0
- package/src/components/IotaNameNftImage.tsx +30 -0
- package/src/hooks/useGetDefaultIotaName.ts +6 -22
- package/src/hooks/useGetIotaNameAvatar.ts +72 -0
- package/src/hooks/useIotaClientInfiniteQuery.ts +2 -1
- package/src/hooks/useIotaNamesClient.ts +29 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IotaNameNftImage.d.ts","sourceRoot":"","sources":["../../../src/components/IotaNameNftImage.tsx"],"names":[],"mappings":"AAQA,UAAU,qBAAqB;IAC3B,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,gBAAgB,EAAE,OAAO,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,gBAAgB,CAAC,EAC7B,OAAO,EACP,gBAAgB,EAChB,GAAuB,GAC1B,EAAE,qBAAqB,qDAWvB"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/components/IotaNameNftImage.tsx
|
|
21
|
+
var IotaNameNftImage_exports = {};
|
|
22
|
+
__export(IotaNameNftImage_exports, {
|
|
23
|
+
IotaNameNftImage: () => IotaNameNftImage
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(IotaNameNftImage_exports);
|
|
26
|
+
var import_react4 = require("react");
|
|
27
|
+
|
|
28
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
29
|
+
var import_iota_names_sdk3 = require("@iota/iota-names-sdk");
|
|
30
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
31
|
+
|
|
32
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
33
|
+
var import_iota_names_sdk2 = require("@iota/iota-names-sdk");
|
|
34
|
+
var import_react_query = require("@tanstack/react-query");
|
|
35
|
+
|
|
36
|
+
// src/hooks/useIotaNamesClient.ts
|
|
37
|
+
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
38
|
+
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
39
|
+
var import_client2 = require("@iota/iota-sdk/client");
|
|
40
|
+
var import_react3 = require("react");
|
|
41
|
+
|
|
42
|
+
// src/hooks/useIotaClient.ts
|
|
43
|
+
var import_react2 = require("react");
|
|
44
|
+
|
|
45
|
+
// src/components/IotaClientProvider.tsx
|
|
46
|
+
var import_client = require("@iota/iota-sdk/client");
|
|
47
|
+
var import_react = require("react");
|
|
48
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
|
+
var IotaClientContext = (0, import_react.createContext)(null);
|
|
50
|
+
var DEFAULT_NETWORKS = {
|
|
51
|
+
localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet)?.url }
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// src/hooks/useIotaClient.ts
|
|
55
|
+
function useIotaClientContext() {
|
|
56
|
+
const iotaClient = (0, import_react2.useContext)(IotaClientContext);
|
|
57
|
+
if (!iotaClient) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
"Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return iotaClient;
|
|
63
|
+
}
|
|
64
|
+
function useIotaClient() {
|
|
65
|
+
return useIotaClientContext().client;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/hooks/useIotaNamesClient.ts
|
|
69
|
+
function useIotaNamesClient() {
|
|
70
|
+
const { network: networkId } = useIotaClientContext();
|
|
71
|
+
const network = (0, import_client2.getNetwork)(networkId);
|
|
72
|
+
const iotaNamesClient = (0, import_react3.useMemo)(() => {
|
|
73
|
+
if (!network.graphql) return null;
|
|
74
|
+
return new import_iota_names_sdk.IotaNamesClient({
|
|
75
|
+
graphQlClient: new import_graphql.IotaGraphQLClient({ url: network.graphql }),
|
|
76
|
+
network: network.id
|
|
77
|
+
});
|
|
78
|
+
}, [network.id, network.graphql]);
|
|
79
|
+
return {
|
|
80
|
+
iotaNamesClient,
|
|
81
|
+
networkId: network.id,
|
|
82
|
+
isSupported: !!iotaNamesClient?.config
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
87
|
+
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
88
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
89
|
+
return (0, import_react_query.useQuery)({
|
|
90
|
+
queryKey: ["iota-name", "default-name", address, networkId],
|
|
91
|
+
queryFn: async () => {
|
|
92
|
+
if (!address) return null;
|
|
93
|
+
const name = await iotaNamesClient?.getPublicName(address);
|
|
94
|
+
return name ? (0, import_iota_names_sdk2.normalizeIotaName)(name) : name;
|
|
95
|
+
},
|
|
96
|
+
enabled: !!address && iotaNamesEnabled && isSupported,
|
|
97
|
+
staleTime: 1e3 * 60 * 10
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
102
|
+
function useGetIotaNameAvatar(address, iotaNamesEnabled) {
|
|
103
|
+
const client = useIotaClient();
|
|
104
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
105
|
+
const { data: name } = useGetDefaultIotaName(address, iotaNamesEnabled);
|
|
106
|
+
return (0, import_react_query2.useQuery)({
|
|
107
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
108
|
+
queryKey: ["iota-name", "avatar", name, networkId],
|
|
109
|
+
queryFn: async () => {
|
|
110
|
+
if (!name || !address || !iotaNamesClient) return null;
|
|
111
|
+
const nameRecord = await iotaNamesClient.getNameRecord(name);
|
|
112
|
+
if (!nameRecord) return null;
|
|
113
|
+
const avatarObjectId = nameRecord.avatar ?? ((0, import_iota_names_sdk3.isSubname)(name) ? await findSubnameNftId() : nameRecord.nftId);
|
|
114
|
+
if (!avatarObjectId) return null;
|
|
115
|
+
const objectResponse = await client.getObject({
|
|
116
|
+
id: avatarObjectId,
|
|
117
|
+
options: { showDisplay: true }
|
|
118
|
+
});
|
|
119
|
+
return objectResponse?.data?.display?.data?.image_url ?? null;
|
|
120
|
+
async function findSubnameNftId() {
|
|
121
|
+
let subnameType;
|
|
122
|
+
try {
|
|
123
|
+
subnameType = (0, import_iota_names_sdk3.getSubnameRegistrationType)(
|
|
124
|
+
iotaNamesClient.getPackage("packageId", "v1")
|
|
125
|
+
);
|
|
126
|
+
} catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
const { data } = await client.getOwnedObjects({
|
|
130
|
+
owner: address,
|
|
131
|
+
filter: { StructType: subnameType },
|
|
132
|
+
options: { showDisplay: true }
|
|
133
|
+
});
|
|
134
|
+
return data.find((object) => {
|
|
135
|
+
try {
|
|
136
|
+
return (0, import_iota_names_sdk3.normalizeIotaName)(object.data?.display?.data?.name ?? "") === name;
|
|
137
|
+
} catch {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
})?.data?.objectId ?? null;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
enabled: iotaNamesEnabled && isSupported && !!name && !!address,
|
|
144
|
+
staleTime: 1e3 * 60 * 5
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/components/IotaNameNftImage.css.ts
|
|
149
|
+
var image = "IotaNameNftImage_image__qs9r060";
|
|
150
|
+
|
|
151
|
+
// src/components/IotaNameNftImage.tsx
|
|
152
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
153
|
+
function IotaNameNftImage({
|
|
154
|
+
address,
|
|
155
|
+
iotaNamesEnabled,
|
|
156
|
+
alt = "name NFT avatar"
|
|
157
|
+
}) {
|
|
158
|
+
const { data: imageUrl, isLoading } = useGetIotaNameAvatar(address, iotaNamesEnabled);
|
|
159
|
+
const [imgError, setImgError] = (0, import_react4.useState)(false);
|
|
160
|
+
if (!iotaNamesEnabled || isLoading || !imageUrl || imgError) {
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("img", { src: imageUrl, alt, className: image, onError: () => setImgError(true) });
|
|
164
|
+
}
|
|
165
|
+
//# sourceMappingURL=IotaNameNftImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/IotaNameNftImage.tsx", "../../../src/hooks/useGetIotaNameAvatar.ts", "../../../src/hooks/useGetDefaultIotaName.ts", "../../../src/hooks/useIotaNamesClient.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx", "../../../src/components/IotaNameNftImage.css.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useState } from 'react';\n\nimport { useGetIotaNameAvatar } from '../hooks/useGetIotaNameAvatar.js';\nimport * as styles from './IotaNameNftImage.css.js';\n\ninterface IotaNameNftImageProps {\n address: string | null | undefined;\n iotaNamesEnabled: boolean;\n alt?: string;\n}\n\nexport function IotaNameNftImage({\n address,\n iotaNamesEnabled,\n alt = 'name NFT avatar',\n}: IotaNameNftImageProps) {\n const { data: imageUrl, isLoading } = useGetIotaNameAvatar(address, iotaNamesEnabled);\n const [imgError, setImgError] = useState(false);\n\n if (!iotaNamesEnabled || isLoading || !imageUrl || imgError) {\n return null;\n }\n\n return (\n <img src={imageUrl} alt={alt} className={styles.image} onError={() => setImgError(true)} />\n );\n}\n", "// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getSubnameRegistrationType, isSubname, normalizeIotaName } from '@iota/iota-names-sdk';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useGetDefaultIotaName } from './useGetDefaultIotaName.js';\nimport { useIotaClient } from './useIotaClient.js';\nimport { useIotaNamesClient } from './useIotaNamesClient.js';\n\nexport function useGetIotaNameAvatar(\n address: string | null | undefined,\n iotaNamesEnabled: boolean,\n) {\n const client = useIotaClient();\n const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();\n const { data: name } = useGetDefaultIotaName(address, iotaNamesEnabled);\n\n return useQuery({\n // eslint-disable-next-line @tanstack/query/exhaustive-deps\n queryKey: ['iota-name', 'avatar', name, networkId],\n queryFn: async () => {\n if (!name || !address || !iotaNamesClient) return null;\n\n const nameRecord = await iotaNamesClient.getNameRecord(name);\n if (!nameRecord) return null;\n\n const avatarObjectId =\n nameRecord.avatar ??\n (isSubname(name) ? await findSubnameNftId() : nameRecord.nftId);\n if (!avatarObjectId) return null;\n\n const objectResponse = await client.getObject({\n id: avatarObjectId,\n options: { showDisplay: true },\n });\n\n return objectResponse?.data?.display?.data?.image_url ?? null;\n\n async function findSubnameNftId() {\n let subnameType: string;\n try {\n subnameType = getSubnameRegistrationType(\n iotaNamesClient!.getPackage('packageId', 'v1'),\n );\n } catch {\n return null;\n }\n\n const { data } = await client.getOwnedObjects({\n owner: address!,\n filter: { StructType: subnameType },\n options: { showDisplay: true },\n });\n\n return (\n data.find((object) => {\n try {\n return (\n normalizeIotaName(object.data?.display?.data?.name ?? '') === name\n );\n } catch {\n return false;\n }\n })?.data?.objectId ?? null\n );\n }\n },\n enabled: iotaNamesEnabled && isSupported && !!name && !!address,\n staleTime: 1000 * 60 * 5,\n });\n}\n", "// Copyright (c) 2025 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { normalizeIotaName } from '@iota/iota-names-sdk';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useIotaNamesClient } from './useIotaNamesClient.js';\n\nexport function useGetDefaultIotaName(\n address: string | null | undefined,\n iotaNamesEnabled: boolean,\n) {\n const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();\n\n return useQuery({\n queryKey: ['iota-name', 'default-name', address, networkId],\n queryFn: async () => {\n if (!address) return null;\n\n const name = await iotaNamesClient?.getPublicName(address);\n\n return name ? normalizeIotaName(name) : name;\n },\n enabled: !!address && iotaNamesEnabled && isSupported,\n staleTime: 1000 * 60 * 10,\n });\n}\n", "// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { IotaGraphQLClient } from '@iota/iota-sdk/graphql';\nimport { IotaNamesClient } from '@iota/iota-names-sdk';\nimport { getNetwork } from '@iota/iota-sdk/client';\nimport { useMemo } from 'react';\n\nimport { useIotaClientContext } from './useIotaClient.js';\n\nexport function useIotaNamesClient() {\n const { network: networkId } = useIotaClientContext();\n const network = getNetwork(networkId);\n\n const iotaNamesClient = useMemo(() => {\n if (!network.graphql) return null;\n\n return new IotaNamesClient({\n graphQlClient: new IotaGraphQLClient({ url: network.graphql }),\n network: network.id,\n });\n }, [network.id, network.graphql]);\n\n return {\n iotaNamesClient,\n networkId: network.id,\n isSupported: !!iotaNamesClient?.config,\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet)?.url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n", "import 'src/components/IotaNameNftImage.css.ts.vanilla.css?source=LklvdGFOYW1lTmZ0SW1hZ2VfaW1hZ2VfX3FzOXIwNjAgewogIHdpZHRoOiAyNHB4OwogIGhlaWdodDogMjRweDsKICBmbGV4LXNocmluazogMDsKICBib3JkZXItcmFkaXVzOiB2YXIoLS1kYXBwLWtpdC1yYWRpaS1mdWxsKTsKICBvYmplY3QtZml0OiBjb3ZlcjsKfQ==';\nexport var image = 'IotaNameNftImage_image__qs9r060';"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,gBAAyB;;;ACAzB,IAAAC,yBAAyE;AACzE,IAAAC,sBAA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MAAM,QAAQ,EAAE,MAAM;AAAA,UAEtE,QAAQ;AACJ,mBAAO;AAAA,UACX;AAAA,QACJ,CAAC,GAAG,MAAM,YAAY;AAAA,MAE9B;AAAA,IACJ;AAAA,IACA,SAAS,oBAAoB,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAAA,IACxD,WAAW,MAAO,KAAK;AAAA,EAC3B,CAAC;AACL;;;AKtEO,IAAI,QAAQ;;;AN0BX,IAAAC,sBAAA;AAbD,SAAS,iBAAiB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA,MAAM;AACV,GAA0B;AACtB,QAAM,EAAE,MAAM,UAAU,UAAU,IAAI,qBAAqB,SAAS,gBAAgB;AACpF,QAAM,CAAC,UAAU,WAAW,QAAI,wBAAS,KAAK;AAE9C,MAAI,CAAC,oBAAoB,aAAa,CAAC,YAAY,UAAU;AACzD,WAAO;AAAA,EACX;AAEA,SACI,6CAAC,SAAI,KAAK,UAAU,KAAU,WAAkB,OAAO,SAAS,MAAM,YAAY,IAAI,GAAG;AAEjG;",
|
|
6
|
+
"names": ["import_react", "import_iota_names_sdk", "import_react_query", "import_iota_names_sdk", "import_client", "import_react", "import_react", "import_jsx_runtime"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useGetDefaultIotaName(address: string | null | undefined, iotaNamesEnabled: boolean): import("@tanstack/react-query").UseQueryResult<string | null, Error>;
|
|
1
|
+
export declare function useGetDefaultIotaName(address: string | null | undefined, iotaNamesEnabled: boolean): import("@tanstack/react-query").UseQueryResult<string | null | undefined, Error>;
|
|
2
2
|
//# sourceMappingURL=useGetDefaultIotaName.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGetDefaultIotaName.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetDefaultIotaName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useGetDefaultIotaName.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetDefaultIotaName.ts"],"names":[],"mappings":"AAQA,wBAAgB,qBAAqB,CACjC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,gBAAgB,EAAE,OAAO,oFAgB5B"}
|
|
@@ -23,9 +23,14 @@ __export(useGetDefaultIotaName_exports, {
|
|
|
23
23
|
useGetDefaultIotaName: () => useGetDefaultIotaName
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(useGetDefaultIotaName_exports);
|
|
26
|
-
var
|
|
26
|
+
var import_iota_names_sdk2 = require("@iota/iota-names-sdk");
|
|
27
27
|
var import_react_query = require("@tanstack/react-query");
|
|
28
|
+
|
|
29
|
+
// src/hooks/useIotaNamesClient.ts
|
|
30
|
+
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
28
31
|
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
32
|
+
var import_client2 = require("@iota/iota-sdk/client");
|
|
33
|
+
var import_react3 = require("react");
|
|
29
34
|
|
|
30
35
|
// src/hooks/useIotaClient.ts
|
|
31
36
|
var import_react2 = require("react");
|
|
@@ -50,30 +55,35 @@ function useIotaClientContext() {
|
|
|
50
55
|
return iotaClient;
|
|
51
56
|
}
|
|
52
57
|
|
|
53
|
-
// src/hooks/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const iotaContext = useIotaClientContext();
|
|
58
|
-
const network = (0, import_client2.getNetwork)(iotaContext.network);
|
|
58
|
+
// src/hooks/useIotaNamesClient.ts
|
|
59
|
+
function useIotaNamesClient() {
|
|
60
|
+
const { network: networkId } = useIotaClientContext();
|
|
61
|
+
const network = (0, import_client2.getNetwork)(networkId);
|
|
59
62
|
const iotaNamesClient = (0, import_react3.useMemo)(() => {
|
|
60
|
-
|
|
61
|
-
url: network.graphql
|
|
62
|
-
});
|
|
63
|
+
if (!network.graphql) return null;
|
|
63
64
|
return new import_iota_names_sdk.IotaNamesClient({
|
|
64
|
-
graphQlClient:
|
|
65
|
+
graphQlClient: new import_graphql.IotaGraphQLClient({ url: network.graphql }),
|
|
65
66
|
network: network.id
|
|
66
67
|
});
|
|
67
|
-
}, [network.id]);
|
|
68
|
-
|
|
68
|
+
}, [network.id, network.graphql]);
|
|
69
|
+
return {
|
|
70
|
+
iotaNamesClient,
|
|
71
|
+
networkId: network.id,
|
|
72
|
+
isSupported: !!iotaNamesClient?.config
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
77
|
+
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
78
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
69
79
|
return (0, import_react_query.useQuery)({
|
|
70
|
-
queryKey: ["iota-name", "default-name", address],
|
|
80
|
+
queryKey: ["iota-name", "default-name", address, networkId],
|
|
71
81
|
queryFn: async () => {
|
|
72
82
|
if (!address) return null;
|
|
73
83
|
const name = await iotaNamesClient?.getPublicName(address);
|
|
74
|
-
return name ? (0,
|
|
84
|
+
return name ? (0, import_iota_names_sdk2.normalizeIotaName)(name) : name;
|
|
75
85
|
},
|
|
76
|
-
enabled: !!
|
|
86
|
+
enabled: !!address && iotaNamesEnabled && isSupported,
|
|
77
87
|
staleTime: 1e3 * 60 * 10
|
|
78
88
|
});
|
|
79
89
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/hooks/useGetDefaultIotaName.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) 2025 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,
|
|
6
|
-
"names": ["import_client", "import_react", "import_react"]
|
|
3
|
+
"sources": ["../../../src/hooks/useGetDefaultIotaName.ts", "../../../src/hooks/useIotaNamesClient.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) 2025 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { normalizeIotaName } from '@iota/iota-names-sdk';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useIotaNamesClient } from './useIotaNamesClient.js';\n\nexport function useGetDefaultIotaName(\n address: string | null | undefined,\n iotaNamesEnabled: boolean,\n) {\n const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();\n\n return useQuery({\n queryKey: ['iota-name', 'default-name', address, networkId],\n queryFn: async () => {\n if (!address) return null;\n\n const name = await iotaNamesClient?.getPublicName(address);\n\n return name ? normalizeIotaName(name) : name;\n },\n enabled: !!address && iotaNamesEnabled && isSupported,\n staleTime: 1000 * 60 * 10,\n });\n}\n", "// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { IotaGraphQLClient } from '@iota/iota-sdk/graphql';\nimport { IotaNamesClient } from '@iota/iota-names-sdk';\nimport { getNetwork } from '@iota/iota-sdk/client';\nimport { useMemo } from 'react';\n\nimport { useIotaClientContext } from './useIotaClient.js';\n\nexport function useIotaNamesClient() {\n const { network: networkId } = useIotaClientContext();\n const network = getNetwork(networkId);\n\n const iotaNamesClient = useMemo(() => {\n if (!network.graphql) return null;\n\n return new IotaNamesClient({\n graphQlClient: new IotaGraphQLClient({ url: network.graphql }),\n network: network.id,\n });\n }, [network.id, network.graphql]);\n\n return {\n iotaNamesClient,\n networkId: network.id,\n isSupported: !!iotaNamesClient?.config,\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet)?.url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,yBAAkC;AAClC,yBAAyB;;;ACDzB,qBAAkC;AAClC,4BAAgC;AAChC,IAAAC,iBAA2B;AAC3B,IAAAC,gBAAwB;;;ACDxB,IAAAC,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QAAQ,GAAG,IAAI;AACvD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADTO,SAAS,qBAAqB;AACjC,QAAM,EAAE,SAAS,UAAU,IAAI,qBAAqB;AACpD,QAAM,cAAU,2BAAW,SAAS;AAEpC,QAAM,sBAAkB,uBAAQ,MAAM;AAClC,QAAI,CAAC,QAAQ,QAAS,QAAO;AAE7B,WAAO,IAAI,sCAAgB;AAAA,MACvB,eAAe,IAAI,iCAAkB,EAAE,KAAK,QAAQ,QAAQ,CAAC;AAAA,MAC7D,SAAS,QAAQ;AAAA,IACrB,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,IAAI,QAAQ,OAAO,CAAC;AAEhC,SAAO;AAAA,IACH;AAAA,IACA,WAAW,QAAQ;AAAA,IACnB,aAAa,CAAC,CAAC,iBAAiB;AAAA,EACpC;AACJ;;;ADpBO,SAAS,sBACZ,SACA,kBACF;AACE,QAAM,EAAE,iBAAiB,WAAW,YAAY,IAAI,mBAAmB;AAEvE,aAAO,6BAAS;AAAA,IACZ,UAAU,CAAC,aAAa,gBAAgB,SAAS,SAAS;AAAA,IAC1D,SAAS,YAAY;AACjB,UAAI,CAAC,QAAS,QAAO;AAErB,YAAM,OAAO,MAAM,iBAAiB,cAAc,OAAO;AAEzD,aAAO,WAAO,0CAAkB,IAAI,IAAI;AAAA,IAC5C;AAAA,IACA,SAAS,CAAC,CAAC,WAAW,oBAAoB;AAAA,IAC1C,WAAW,MAAO,KAAK;AAAA,EAC3B,CAAC;AACL;",
|
|
6
|
+
"names": ["import_iota_names_sdk", "import_client", "import_react", "import_react"]
|
|
7
7
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useGetIotaNameAvatar.d.ts","sourceRoot":"","sources":["../../../src/hooks/useGetIotaNameAvatar.ts"],"names":[],"mappings":"AAUA,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,gBAAgB,EAAE,OAAO,wEA2D5B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
21
|
+
var useGetIotaNameAvatar_exports = {};
|
|
22
|
+
__export(useGetIotaNameAvatar_exports, {
|
|
23
|
+
useGetIotaNameAvatar: () => useGetIotaNameAvatar
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useGetIotaNameAvatar_exports);
|
|
26
|
+
var import_iota_names_sdk3 = require("@iota/iota-names-sdk");
|
|
27
|
+
var import_react_query2 = require("@tanstack/react-query");
|
|
28
|
+
|
|
29
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
30
|
+
var import_iota_names_sdk2 = require("@iota/iota-names-sdk");
|
|
31
|
+
var import_react_query = require("@tanstack/react-query");
|
|
32
|
+
|
|
33
|
+
// src/hooks/useIotaNamesClient.ts
|
|
34
|
+
var import_graphql = require("@iota/iota-sdk/graphql");
|
|
35
|
+
var import_iota_names_sdk = require("@iota/iota-names-sdk");
|
|
36
|
+
var import_client2 = require("@iota/iota-sdk/client");
|
|
37
|
+
var import_react3 = require("react");
|
|
38
|
+
|
|
39
|
+
// src/hooks/useIotaClient.ts
|
|
40
|
+
var import_react2 = require("react");
|
|
41
|
+
|
|
42
|
+
// src/components/IotaClientProvider.tsx
|
|
43
|
+
var import_client = require("@iota/iota-sdk/client");
|
|
44
|
+
var import_react = require("react");
|
|
45
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
46
|
+
var IotaClientContext = (0, import_react.createContext)(null);
|
|
47
|
+
var DEFAULT_NETWORKS = {
|
|
48
|
+
localnet: { url: (0, import_client.getNetwork)(import_client.Network.Localnet)?.url }
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/hooks/useIotaClient.ts
|
|
52
|
+
function useIotaClientContext() {
|
|
53
|
+
const iotaClient = (0, import_react2.useContext)(IotaClientContext);
|
|
54
|
+
if (!iotaClient) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider"
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
return iotaClient;
|
|
60
|
+
}
|
|
61
|
+
function useIotaClient() {
|
|
62
|
+
return useIotaClientContext().client;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// src/hooks/useIotaNamesClient.ts
|
|
66
|
+
function useIotaNamesClient() {
|
|
67
|
+
const { network: networkId } = useIotaClientContext();
|
|
68
|
+
const network = (0, import_client2.getNetwork)(networkId);
|
|
69
|
+
const iotaNamesClient = (0, import_react3.useMemo)(() => {
|
|
70
|
+
if (!network.graphql) return null;
|
|
71
|
+
return new import_iota_names_sdk.IotaNamesClient({
|
|
72
|
+
graphQlClient: new import_graphql.IotaGraphQLClient({ url: network.graphql }),
|
|
73
|
+
network: network.id
|
|
74
|
+
});
|
|
75
|
+
}, [network.id, network.graphql]);
|
|
76
|
+
return {
|
|
77
|
+
iotaNamesClient,
|
|
78
|
+
networkId: network.id,
|
|
79
|
+
isSupported: !!iotaNamesClient?.config
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// src/hooks/useGetDefaultIotaName.ts
|
|
84
|
+
function useGetDefaultIotaName(address, iotaNamesEnabled) {
|
|
85
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
86
|
+
return (0, import_react_query.useQuery)({
|
|
87
|
+
queryKey: ["iota-name", "default-name", address, networkId],
|
|
88
|
+
queryFn: async () => {
|
|
89
|
+
if (!address) return null;
|
|
90
|
+
const name = await iotaNamesClient?.getPublicName(address);
|
|
91
|
+
return name ? (0, import_iota_names_sdk2.normalizeIotaName)(name) : name;
|
|
92
|
+
},
|
|
93
|
+
enabled: !!address && iotaNamesEnabled && isSupported,
|
|
94
|
+
staleTime: 1e3 * 60 * 10
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// src/hooks/useGetIotaNameAvatar.ts
|
|
99
|
+
function useGetIotaNameAvatar(address, iotaNamesEnabled) {
|
|
100
|
+
const client = useIotaClient();
|
|
101
|
+
const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();
|
|
102
|
+
const { data: name } = useGetDefaultIotaName(address, iotaNamesEnabled);
|
|
103
|
+
return (0, import_react_query2.useQuery)({
|
|
104
|
+
// eslint-disable-next-line @tanstack/query/exhaustive-deps
|
|
105
|
+
queryKey: ["iota-name", "avatar", name, networkId],
|
|
106
|
+
queryFn: async () => {
|
|
107
|
+
if (!name || !address || !iotaNamesClient) return null;
|
|
108
|
+
const nameRecord = await iotaNamesClient.getNameRecord(name);
|
|
109
|
+
if (!nameRecord) return null;
|
|
110
|
+
const avatarObjectId = nameRecord.avatar ?? ((0, import_iota_names_sdk3.isSubname)(name) ? await findSubnameNftId() : nameRecord.nftId);
|
|
111
|
+
if (!avatarObjectId) return null;
|
|
112
|
+
const objectResponse = await client.getObject({
|
|
113
|
+
id: avatarObjectId,
|
|
114
|
+
options: { showDisplay: true }
|
|
115
|
+
});
|
|
116
|
+
return objectResponse?.data?.display?.data?.image_url ?? null;
|
|
117
|
+
async function findSubnameNftId() {
|
|
118
|
+
let subnameType;
|
|
119
|
+
try {
|
|
120
|
+
subnameType = (0, import_iota_names_sdk3.getSubnameRegistrationType)(
|
|
121
|
+
iotaNamesClient.getPackage("packageId", "v1")
|
|
122
|
+
);
|
|
123
|
+
} catch {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
const { data } = await client.getOwnedObjects({
|
|
127
|
+
owner: address,
|
|
128
|
+
filter: { StructType: subnameType },
|
|
129
|
+
options: { showDisplay: true }
|
|
130
|
+
});
|
|
131
|
+
return data.find((object) => {
|
|
132
|
+
try {
|
|
133
|
+
return (0, import_iota_names_sdk3.normalizeIotaName)(object.data?.display?.data?.name ?? "") === name;
|
|
134
|
+
} catch {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
137
|
+
})?.data?.objectId ?? null;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
enabled: iotaNamesEnabled && isSupported && !!name && !!address,
|
|
141
|
+
staleTime: 1e3 * 60 * 5
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=useGetIotaNameAvatar.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useGetIotaNameAvatar.ts", "../../../src/hooks/useGetDefaultIotaName.ts", "../../../src/hooks/useIotaNamesClient.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getSubnameRegistrationType, isSubname, normalizeIotaName } from '@iota/iota-names-sdk';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useGetDefaultIotaName } from './useGetDefaultIotaName.js';\nimport { useIotaClient } from './useIotaClient.js';\nimport { useIotaNamesClient } from './useIotaNamesClient.js';\n\nexport function useGetIotaNameAvatar(\n address: string | null | undefined,\n iotaNamesEnabled: boolean,\n) {\n const client = useIotaClient();\n const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();\n const { data: name } = useGetDefaultIotaName(address, iotaNamesEnabled);\n\n return useQuery({\n // eslint-disable-next-line @tanstack/query/exhaustive-deps\n queryKey: ['iota-name', 'avatar', name, networkId],\n queryFn: async () => {\n if (!name || !address || !iotaNamesClient) return null;\n\n const nameRecord = await iotaNamesClient.getNameRecord(name);\n if (!nameRecord) return null;\n\n const avatarObjectId =\n nameRecord.avatar ??\n (isSubname(name) ? await findSubnameNftId() : nameRecord.nftId);\n if (!avatarObjectId) return null;\n\n const objectResponse = await client.getObject({\n id: avatarObjectId,\n options: { showDisplay: true },\n });\n\n return objectResponse?.data?.display?.data?.image_url ?? null;\n\n async function findSubnameNftId() {\n let subnameType: string;\n try {\n subnameType = getSubnameRegistrationType(\n iotaNamesClient!.getPackage('packageId', 'v1'),\n );\n } catch {\n return null;\n }\n\n const { data } = await client.getOwnedObjects({\n owner: address!,\n filter: { StructType: subnameType },\n options: { showDisplay: true },\n });\n\n return (\n data.find((object) => {\n try {\n return (\n normalizeIotaName(object.data?.display?.data?.name ?? '') === name\n );\n } catch {\n return false;\n }\n })?.data?.objectId ?? null\n );\n }\n },\n enabled: iotaNamesEnabled && isSupported && !!name && !!address,\n staleTime: 1000 * 60 * 5,\n });\n}\n", "// Copyright (c) 2025 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { normalizeIotaName } from '@iota/iota-names-sdk';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useIotaNamesClient } from './useIotaNamesClient.js';\n\nexport function useGetDefaultIotaName(\n address: string | null | undefined,\n iotaNamesEnabled: boolean,\n) {\n const { iotaNamesClient, networkId, isSupported } = useIotaNamesClient();\n\n return useQuery({\n queryKey: ['iota-name', 'default-name', address, networkId],\n queryFn: async () => {\n if (!address) return null;\n\n const name = await iotaNamesClient?.getPublicName(address);\n\n return name ? normalizeIotaName(name) : name;\n },\n enabled: !!address && iotaNamesEnabled && isSupported,\n staleTime: 1000 * 60 * 10,\n });\n}\n", "// Copyright (c) 2026 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { IotaGraphQLClient } from '@iota/iota-sdk/graphql';\nimport { IotaNamesClient } from '@iota/iota-names-sdk';\nimport { getNetwork } from '@iota/iota-sdk/client';\nimport { useMemo } from 'react';\n\nimport { useIotaClientContext } from './useIotaClient.js';\n\nexport function useIotaNamesClient() {\n const { network: networkId } = useIotaClientContext();\n const network = getNetwork(networkId);\n\n const iotaNamesClient = useMemo(() => {\n if (!network.graphql) return null;\n\n return new IotaNamesClient({\n graphQlClient: new IotaGraphQLClient({ url: network.graphql }),\n network: network.id,\n });\n }, [network.id, network.graphql]);\n\n return {\n iotaNamesClient,\n networkId: network.id,\n isSupported: !!iotaNamesClient?.config,\n };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet)?.url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,IAAAA,yBAAyE;AACzE,IAAAC,s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AS,MAAM,QAAQ,EAAE,MAAM;AAAA,UAEtE,QAAQ;AACJ,mBAAO;AAAA,UACX;AAAA,QACJ,CAAC,GAAG,MAAM,YAAY;AAAA,MAE9B;AAAA,IACJ;AAAA,IACA,SAAS,oBAAoB,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC;AAAA,IACxD,WAAW,MAAO,KAAK;AAAA,EAC3B,CAAC;AACL;",
|
|
6
|
+
"names": ["import_iota_names_sdk", "import_react_query", "import_iota_names_sdk", "import_client", "import_react", "import_react"]
|
|
7
|
+
}
|
|
@@ -12,7 +12,7 @@ export type IotaRpcPaginatedMethodName = {
|
|
|
12
12
|
export type IotaRpcPaginatedMethods = {
|
|
13
13
|
[K in IotaRpcPaginatedMethodName]: IotaClient[K] extends (input: infer Params) => Promise<infer Result extends {
|
|
14
14
|
hasNextPage?: boolean | null;
|
|
15
|
-
nextCursor?: infer Cursor | null;
|
|
15
|
+
nextCursor?: (infer Cursor) | null;
|
|
16
16
|
}> ? {
|
|
17
17
|
name: K;
|
|
18
18
|
result: Result;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIotaClientInfiniteQuery.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIotaClientInfiniteQuery.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EACR,YAAY,EACZ,uBAAuB,EACvB,sBAAsB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAG1D,UAAU,eAAe;IACrB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,0BAA0B,GAAG;KACpC,CAAC,IAAI,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,GAA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,EAAE,CAAC,MAAM,MAAM,CAAC,GAAG,IAAI,CAAA;KAAE,CAC5F,GACK;QACI,IAAI,EAAE,CAAC,CAAC;QACR,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAClB,GACD,KAAK;CACd,CAAC;AAEF,MAAM,MAAM,iCAAiC,CACzC,CAAC,SAAS,MAAM,uBAAuB,EACvC,KAAK,IACL,SAAS,CACT,IAAI,CACA,uBAAuB,CACnB,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EACpC,KAAK,EACL,KAAK,EACL,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EACpC,OAAO,EAAE,CACZ,EACD,SAAS,GAAG,kBAAkB,GAAG,kBAAkB,CACtD,EACD,UAAU,CACb,CAAC;AAEF,wBAAgB,0BAA0B,CACtC,CAAC,SAAS,MAAM,uBAAuB,EACvC,KAAK,GAAG,YAAY,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAE1D,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAC5C,EACI,QAAa,EACb,OAAkB,EAClB,GAAG,OAAO,EACb,GAAE,iCAAiC,CAAC,CAAC,EAAE,KAAK,CAAM,GACpD,sBAAsB,CAAC,KAAK,EAAE,KAAK,CAAC,CAiBtC"}
|
|
@@ -61,6 +61,7 @@ function useIotaClientInfiniteQuery(method, params, {
|
|
|
61
61
|
queryKey: [iotaContext.network, method, params, ...queryKey],
|
|
62
62
|
enabled,
|
|
63
63
|
queryFn: ({ pageParam }) => iotaContext.client[method]({
|
|
64
|
+
// oxlint-disable-next-line unicorn/no-useless-fallback-in-spread
|
|
64
65
|
...params ?? {},
|
|
65
66
|
cursor: pageParam
|
|
66
67
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/hooks/useIotaClientInfiniteQuery.ts", "../../../src/hooks/useIotaClient.ts", "../../../src/components/IotaClientProvider.tsx"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport type {\n InfiniteData,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from '@tanstack/react-query';\nimport { useInfiniteQuery } from '@tanstack/react-query';\n\nimport type { PartialBy } from '../types/utilityTypes.js';\nimport { useIotaClientContext } from './useIotaClient.js';\n\ninterface PaginatedResult {\n data?: unknown;\n nextCursor?: unknown;\n hasNextPage: boolean;\n}\n\nexport type IotaRpcPaginatedMethodName = {\n [K in keyof IotaClient]: IotaClient[K] extends (input: any) => Promise<PaginatedResult>\n ? K\n : never;\n}[keyof IotaClient];\n\nexport type IotaRpcPaginatedMethods = {\n [K in IotaRpcPaginatedMethodName]: IotaClient[K] extends (\n input: infer Params,\n ) => Promise<\n infer Result extends { hasNextPage?: boolean | null; nextCursor?: infer Cursor | null }\n >\n ? {\n name: K;\n result: Result;\n params: Params;\n cursor: Cursor;\n }\n : never;\n};\n\nexport type UseIotaClientInfiniteQueryOptions<\n T extends keyof IotaRpcPaginatedMethods,\n TData,\n> = PartialBy<\n Omit<\n UseInfiniteQueryOptions<\n IotaRpcPaginatedMethods[T]['result'],\n Error,\n TData,\n IotaRpcPaginatedMethods[T]['result'],\n unknown[]\n >,\n 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n 'queryKey'\n>;\n\nexport function useIotaClientInfiniteQuery<\n T extends keyof IotaRpcPaginatedMethods,\n TData = InfiniteData<IotaRpcPaginatedMethods[T]['result']>,\n>(\n method: T,\n params: IotaRpcPaginatedMethods[T]['params'],\n {\n queryKey = [],\n enabled = !!params,\n ...options\n }: UseIotaClientInfiniteQueryOptions<T, TData> = {},\n): UseInfiniteQueryResult<TData, Error> {\n const iotaContext = useIotaClientContext();\n\n return useInfiniteQuery({\n ...options,\n initialPageParam: null,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n enabled,\n queryFn: ({ pageParam }) =>\n iotaContext.client[method]({\n ...(params ?? {}),\n cursor: pageParam,\n } as never),\n getNextPageParam: (lastPage) =>\n lastPage.hasNextPage ? (lastPage.nextCursor ?? null) : null,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet)?.url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAAiC;;;ACLjC,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QAAQ,GAAG,IAAI;AACvD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADwCO,SAAS,2BAIZ,QACA,QACA;AAAA,EACI,WAAW,CAAC;AAAA,EACZ,UAAU,CAAC,CAAC;AAAA,EACZ,GAAG;AACP,IAAiD,CAAC,GACd;AACpC,QAAM,cAAc,qBAAqB;AAEzC,aAAO,qCAAiB;AAAA,IACpB,GAAG;AAAA,IACH,kBAAkB;AAAA,IAClB,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,IAC3D;AAAA,IACA,SAAS,CAAC,EAAE,UAAU,MAClB,YAAY,OAAO,MAAM,EAAE;AAAA,
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport type {\n InfiniteData,\n UseInfiniteQueryOptions,\n UseInfiniteQueryResult,\n} from '@tanstack/react-query';\nimport { useInfiniteQuery } from '@tanstack/react-query';\n\nimport type { PartialBy } from '../types/utilityTypes.js';\nimport { useIotaClientContext } from './useIotaClient.js';\n\ninterface PaginatedResult {\n data?: unknown;\n nextCursor?: unknown;\n hasNextPage: boolean;\n}\n\nexport type IotaRpcPaginatedMethodName = {\n [K in keyof IotaClient]: IotaClient[K] extends (input: any) => Promise<PaginatedResult>\n ? K\n : never;\n}[keyof IotaClient];\n\nexport type IotaRpcPaginatedMethods = {\n [K in IotaRpcPaginatedMethodName]: IotaClient[K] extends (\n input: infer Params,\n ) => Promise<\n infer Result extends { hasNextPage?: boolean | null; nextCursor?: (infer Cursor) | null }\n >\n ? {\n name: K;\n result: Result;\n params: Params;\n cursor: Cursor;\n }\n : never;\n};\n\nexport type UseIotaClientInfiniteQueryOptions<\n T extends keyof IotaRpcPaginatedMethods,\n TData,\n> = PartialBy<\n Omit<\n UseInfiniteQueryOptions<\n IotaRpcPaginatedMethods[T]['result'],\n Error,\n TData,\n IotaRpcPaginatedMethods[T]['result'],\n unknown[]\n >,\n 'queryFn' | 'initialPageParam' | 'getNextPageParam'\n >,\n 'queryKey'\n>;\n\nexport function useIotaClientInfiniteQuery<\n T extends keyof IotaRpcPaginatedMethods,\n TData = InfiniteData<IotaRpcPaginatedMethods[T]['result']>,\n>(\n method: T,\n params: IotaRpcPaginatedMethods[T]['params'],\n {\n queryKey = [],\n enabled = !!params,\n ...options\n }: UseIotaClientInfiniteQueryOptions<T, TData> = {},\n): UseInfiniteQueryResult<TData, Error> {\n const iotaContext = useIotaClientContext();\n\n return useInfiniteQuery({\n ...options,\n initialPageParam: null,\n queryKey: [iotaContext.network, method, params, ...queryKey],\n enabled,\n queryFn: ({ pageParam }) =>\n iotaContext.client[method]({\n // oxlint-disable-next-line unicorn/no-useless-fallback-in-spread\n ...(params ?? {}),\n cursor: pageParam,\n } as never),\n getNextPageParam: (lastPage) =>\n lastPage.hasNextPage ? (lastPage.nextCursor ?? null) : null,\n });\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { IotaClient } from '@iota/iota-sdk/client';\nimport { useContext } from 'react';\n\nimport { IotaClientContext } from '../components/IotaClientProvider.js';\n\nexport function useIotaClientContext() {\n const iotaClient = useContext(IotaClientContext);\n\n if (!iotaClient) {\n throw new Error(\n 'Could not find IotaClientContext. Ensure that you have set up the IotaClientProvider',\n );\n }\n\n return iotaClient;\n}\n\nexport function useIotaClient(): IotaClient {\n return useIotaClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// Modifications Copyright (c) 2024 IOTA Stiftung\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getNetwork, isIotaClient, Network, IotaClient } from '@iota/iota-sdk/client';\nimport type { IotaClientOptions } from '@iota/iota-sdk/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | IotaClient = NetworkConfig | IotaClient> = Record<\n string,\n T\n>;\n\nexport interface IotaClientProviderContext {\n client: IotaClient;\n networks: NetworkConfigs;\n network: string;\n config: NetworkConfig | null;\n selectNetwork: (network: string) => void;\n}\n\nexport const IotaClientContext = createContext<IotaClientProviderContext | null>(null);\n\nexport type IotaClientProviderProps<T extends NetworkConfigs> = {\n createClient?: (name: keyof T, config: T[keyof T]) => IotaClient;\n children: React.ReactNode;\n networks?: T;\n onNetworkChange?: (network: keyof T & string) => void;\n} & (\n | {\n defaultNetwork?: keyof T & string;\n network?: never;\n }\n | {\n defaultNetwork?: never;\n network?: keyof T & string;\n }\n);\n\nconst DEFAULT_NETWORKS = {\n localnet: { url: getNetwork(Network.Localnet)?.url },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n _name: string,\n config: NetworkConfig | IotaClient,\n) {\n if (isIotaClient(config)) {\n return config;\n }\n\n return new IotaClient(config);\n};\n\nexport function IotaClientProvider<T extends NetworkConfigs>(props: IotaClientProviderProps<T>) {\n const { onNetworkChange, network, children } = props;\n const networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n const createClient =\n (props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n const [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n props.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n );\n\n const currentNetwork = props.network ?? selectedNetwork;\n\n const client = useMemo(() => {\n return createClient(currentNetwork, networks[currentNetwork]);\n }, [createClient, currentNetwork, networks]);\n\n const ctx = useMemo((): IotaClientProviderContext => {\n return {\n client,\n networks,\n network: currentNetwork,\n config:\n networks[currentNetwork] instanceof IotaClient\n ? null\n : (networks[currentNetwork] as IotaClientOptions),\n selectNetwork: (newNetwork) => {\n if (currentNetwork === newNetwork) {\n return;\n }\n\n if (!network && newNetwork !== selectedNetwork) {\n setSelectedNetwork(newNetwork);\n }\n\n onNetworkChange?.(newNetwork);\n },\n };\n }, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n return <IotaClientContext.Provider value={ctx}>{children}</IotaClientContext.Provider>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,yBAAiC;;;ACLjC,IAAAA,gBAA2B;;;ACD3B,oBAA8D;AAE9D,mBAAiD;AAyFtC;AAxEJ,IAAM,wBAAoB,4BAAgD,IAAI;AAkBrF,IAAM,mBAAmB;AAAA,EACrB,UAAU,EAAE,SAAK,0BAAW,sBAAQ,QAAQ,GAAG,IAAI;AACvD;;;ADlCO,SAAS,uBAAuB;AACnC,QAAM,iBAAa,0BAAW,iBAAiB;AAE/C,MAAI,CAAC,YAAY;AACb,UAAM,IAAI;AAAA,MACN;AAAA,IACJ;AAAA,EACJ;AAEA,SAAO;AACX;;;ADwCO,SAAS,2BAIZ,QACA,QACA;AAAA,EACI,WAAW,CAAC;AAAA,EACZ,UAAU,CAAC,CAAC;AAAA,EACZ,GAAG;AACP,IAAiD,CAAC,GACd;AACpC,QAAM,cAAc,qBAAqB;AAEzC,aAAO,qCAAiB;AAAA,IACpB,GAAG;AAAA,IACH,kBAAkB;AAAA,IAClB,UAAU,CAAC,YAAY,SAAS,QAAQ,QAAQ,GAAG,QAAQ;AAAA,IAC3D;AAAA,IACA,SAAS,CAAC,EAAE,UAAU,MAClB,YAAY,OAAO,MAAM,EAAE;AAAA;AAAA,MAEvB,GAAI,UAAU,CAAC;AAAA,MACf,QAAQ;AAAA,IACZ,CAAU;AAAA,IACd,kBAAkB,CAAC,aACf,SAAS,cAAe,SAAS,cAAc,OAAQ;AAAA,EAC/D,CAAC;AACL;",
|
|
6
6
|
"names": ["import_react"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IotaNamesClient } from '@iota/iota-names-sdk';
|
|
2
|
+
export declare function useIotaNamesClient(): {
|
|
3
|
+
iotaNamesClient: IotaNamesClient | null;
|
|
4
|
+
networkId: import("@iota/iota-sdk/client").Network;
|
|
5
|
+
isSupported: boolean;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=useIotaNamesClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useIotaNamesClient.d.ts","sourceRoot":"","sources":["../../../src/hooks/useIotaNamesClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAMvD,wBAAgB,kBAAkB;;;;EAkBjC"}
|