@ethereum-entity-registry/sdk 0.2.2 → 0.3.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/dist/index.d.ts +3 -5
- package/dist/index.js +17 -26
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -84,7 +84,6 @@ declare function createIndexer(chainId: SupportedChainId): Indexer;
|
|
|
84
84
|
type IdentifierState = {
|
|
85
85
|
id: `0x${string}`;
|
|
86
86
|
depositAddress: Address;
|
|
87
|
-
owner: Address | null;
|
|
88
87
|
balance: bigint | null;
|
|
89
88
|
};
|
|
90
89
|
type ChainDeployments$1 = {
|
|
@@ -161,18 +160,17 @@ declare function createRegistryMethods(wallet: WalletClient | undefined, publicC
|
|
|
161
160
|
*/
|
|
162
161
|
isAccountDeployed: (id: `0x${string}`) => Promise<boolean>;
|
|
163
162
|
/**
|
|
164
|
-
* Resolve the
|
|
165
|
-
*
|
|
163
|
+
* Resolve the deposit address and optional ERC-20 balance for an identifier.
|
|
164
|
+
* The deposit address is computed locally (no RPC). Balance requires one RPC call.
|
|
166
165
|
*
|
|
167
166
|
* @example
|
|
168
167
|
* const state = await sdk.registry.resolveIdentifier("github", "org/repo", tokenAddress)
|
|
169
168
|
* // state.depositAddress — where funders should send tokens
|
|
170
|
-
* // state.owner — null if unclaimed
|
|
171
169
|
* // state.balance — claimable token balance at the deposit address
|
|
172
170
|
*/
|
|
173
171
|
resolveIdentifier: (namespace: string, rawCanonicalString: string, token?: Address) => Promise<IdentifierState>;
|
|
174
172
|
/**
|
|
175
|
-
* Resolve any free-form identifier string to its
|
|
173
|
+
* Resolve any free-form identifier string to its deposit address and optional balance.
|
|
176
174
|
* Accepts namespace:value, URLs, and domain names.
|
|
177
175
|
*
|
|
178
176
|
* @example
|
package/dist/index.js
CHANGED
|
@@ -6440,18 +6440,18 @@ var deployments_default = {
|
|
|
6440
6440
|
var deployments = deployments_default;
|
|
6441
6441
|
var config = {
|
|
6442
6442
|
[mainnet.id]: {
|
|
6443
|
-
indexer: "
|
|
6443
|
+
indexer: "https://ethereum-entity-registry-production.up.railway.app/graphql"
|
|
6444
6444
|
},
|
|
6445
6445
|
[sepolia.id]: {
|
|
6446
6446
|
registry: (deployments["11155111"]?.EntityRegistry ?? deployments["11155111"]?.CanonicalRegistry)?.address,
|
|
6447
|
-
indexer: "https://
|
|
6447
|
+
indexer: "https://ethereum-entity-registry-production.up.railway.app/graphql"
|
|
6448
6448
|
},
|
|
6449
6449
|
[base.id]: {
|
|
6450
|
-
indexer: "
|
|
6450
|
+
indexer: "https://ethereum-entity-registry-production.up.railway.app/graphql"
|
|
6451
6451
|
},
|
|
6452
6452
|
[baseSepolia.id]: {
|
|
6453
6453
|
registry: deployments["84532"]?.EntityRegistry?.address,
|
|
6454
|
-
indexer: "
|
|
6454
|
+
indexer: "https://ethereum-entity-registry-production.up.railway.app/graphql"
|
|
6455
6455
|
},
|
|
6456
6456
|
[hardhat.id]: {
|
|
6457
6457
|
registry: deployments[31337]?.EntityRegistry?.address,
|
|
@@ -6756,24 +6756,15 @@ function createRegistryMethods(wallet, publicClient, deployments2) {
|
|
|
6756
6756
|
abi: registryAbi,
|
|
6757
6757
|
client: { public: publicClient }
|
|
6758
6758
|
}).read.predictAddress([id]);
|
|
6759
|
-
const
|
|
6760
|
-
address:
|
|
6761
|
-
abi:
|
|
6762
|
-
|
|
6763
|
-
|
|
6764
|
-
|
|
6765
|
-
registryContract.read.ownerOf([id]),
|
|
6766
|
-
token ? publicClient.readContract({
|
|
6767
|
-
address: token,
|
|
6768
|
-
abi: erc20Abi2,
|
|
6769
|
-
functionName: "balanceOf",
|
|
6770
|
-
args: [depositAddress]
|
|
6771
|
-
}) : Promise.resolve(null)
|
|
6772
|
-
]);
|
|
6759
|
+
const balance = token ? await publicClient.readContract({
|
|
6760
|
+
address: token,
|
|
6761
|
+
abi: erc20Abi2,
|
|
6762
|
+
functionName: "balanceOf",
|
|
6763
|
+
args: [depositAddress]
|
|
6764
|
+
}) : null;
|
|
6773
6765
|
return {
|
|
6774
6766
|
id,
|
|
6775
6767
|
depositAddress,
|
|
6776
|
-
owner: ownerRaw === zeroAddress ? null : ownerRaw,
|
|
6777
6768
|
balance
|
|
6778
6769
|
};
|
|
6779
6770
|
}
|
|
@@ -6907,18 +6898,17 @@ function createRegistryMethods(wallet, publicClient, deployments2) {
|
|
|
6907
6898
|
return code !== void 0 && code !== "0x";
|
|
6908
6899
|
},
|
|
6909
6900
|
/**
|
|
6910
|
-
* Resolve the
|
|
6911
|
-
*
|
|
6901
|
+
* Resolve the deposit address and optional ERC-20 balance for an identifier.
|
|
6902
|
+
* The deposit address is computed locally (no RPC). Balance requires one RPC call.
|
|
6912
6903
|
*
|
|
6913
6904
|
* @example
|
|
6914
6905
|
* const state = await sdk.registry.resolveIdentifier("github", "org/repo", tokenAddress)
|
|
6915
6906
|
* // state.depositAddress — where funders should send tokens
|
|
6916
|
-
* // state.owner — null if unclaimed
|
|
6917
6907
|
* // state.balance — claimable token balance at the deposit address
|
|
6918
6908
|
*/
|
|
6919
6909
|
resolveIdentifier: (namespace, rawCanonicalString, token) => resolveById(namespace, rawCanonicalString, token),
|
|
6920
6910
|
/**
|
|
6921
|
-
* Resolve any free-form identifier string to its
|
|
6911
|
+
* Resolve any free-form identifier string to its deposit address and optional balance.
|
|
6922
6912
|
* Accepts namespace:value, URLs, and domain names.
|
|
6923
6913
|
*
|
|
6924
6914
|
* @example
|
|
@@ -7051,9 +7041,7 @@ function EntityRegistryProvider({
|
|
|
7051
7041
|
client,
|
|
7052
7042
|
defaultChain
|
|
7053
7043
|
}) {
|
|
7054
|
-
const [sdk, setSdk] = useState(
|
|
7055
|
-
return new EntityRegistrySDK(client, defaultChain);
|
|
7056
|
-
});
|
|
7044
|
+
const [sdk, setSdk] = useState(null);
|
|
7057
7045
|
useEffect(() => {
|
|
7058
7046
|
setSdk(new EntityRegistrySDK(client, defaultChain));
|
|
7059
7047
|
}, [client, defaultChain]);
|
|
@@ -7391,6 +7379,9 @@ function getTokenAddresses(chainId) {
|
|
|
7391
7379
|
function getDeployments(chainId) {
|
|
7392
7380
|
const d = deployments_default[chainId.toString()];
|
|
7393
7381
|
if (!d) throw new Error(`Chain ${chainId} not supported`);
|
|
7382
|
+
if (!d.EntityRegistry && d.CanonicalRegistry) {
|
|
7383
|
+
d.EntityRegistry = d.CanonicalRegistry;
|
|
7384
|
+
}
|
|
7394
7385
|
return d;
|
|
7395
7386
|
}
|
|
7396
7387
|
function getChain(chainId) {
|