@the_library/web3-registry-addresses 1.0.0 → 1.2.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/README.md +99 -0
- package/dist/index.d.ts +28 -2
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +5 -7
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @the_library/web3-registry-addresses
|
|
2
|
+
|
|
3
|
+
Welcome to the D-Library Web3 ecosystem! This package is the crucial "bridge" that connects your frontend application to the exact, certified Smart Contracts endorsed by [dsafe.us](https://dsafe.us) for the decentralized **D-Library** project.
|
|
4
|
+
|
|
5
|
+
## Legal Notice & D-CODE OPEN SOVEREIGN LICENCE
|
|
6
|
+
|
|
7
|
+
**WARNING: PROPRIETARY PUBLIC SOURCE | D-SAFE COMPLIANT**
|
|
8
|
+
|
|
9
|
+
This software is released strictly under the **D-CODE OPEN SOVEREIGN LICENCE (v1.2)**. By utilizing this package, you agree to its binding conditions.
|
|
10
|
+
|
|
11
|
+
### Critical Infrastructure Clause
|
|
12
|
+
As defined in **Section 3: Technical Anchors & Hard-Fork Resilience** of the license:
|
|
13
|
+
|
|
14
|
+
> **Immutable Addresses:** You are prohibited from manually modifying the hard-coded Smart Contract addresses or D-SAFE Source URLs embedded in this package to point to non-certified ledgers.
|
|
15
|
+
|
|
16
|
+
**Modifying the registry endpoints or overriding the canonical lookup configuration within this package to point to private, uncertified, or centralized ledgers constitutes a material breach of the provided D-CODE OPEN SOVEREIGN LICENCE.**
|
|
17
|
+
|
|
18
|
+
This restriction prevents forking intended to restrict public access or bypass the D-SAFE Specification requirements.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 🚀 Getting Started for Junior Developers
|
|
23
|
+
|
|
24
|
+
In the world of Web3, contract addresses can change if the developers upgrade the system.
|
|
25
|
+
Instead of hardcoding those addresses into your Vue.js or React application, you use this package to dynamically fetch the most up-to-date, official addresses directly from the blockchain!
|
|
26
|
+
|
|
27
|
+
Because querying the blockchain is slow, this package automatically intercepts those addresses and caches them instantly inside the user's **Browser `localStorage`** for 24 hours.
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @the_library/web3-registry-addresses
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
*(Note: Depending on which blockchains you want to support, you will also need the corresponding reader packages, like `@the_library/web3-evm` or `@the_library/web3-tron`).*
|
|
36
|
+
|
|
37
|
+
### 1. Bootstrapping the Cache (Initialization)
|
|
38
|
+
|
|
39
|
+
When your application first loads, you need to "Boot" the D-CODE registry. This reads the official configuration loop and instructs this package to go out, fetch the addresses, and save them to the browser.
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { config, registryAddressLoader } from '@the_library/web3-registry-addresses';
|
|
43
|
+
import { EvmRegistryReadAPI } from '@the_library/web3-evm';
|
|
44
|
+
import { TronRegistryReadAPI } from '@the_library/web3-tron';
|
|
45
|
+
|
|
46
|
+
const loadDCODEContracts = async () => {
|
|
47
|
+
// Iterate over all endorsed technologies (EVM, Tron, etc.)
|
|
48
|
+
for (const tech of Object.keys(config)) {
|
|
49
|
+
|
|
50
|
+
// Iterate over all official network configurations for that tech
|
|
51
|
+
for (const network of Object.keys(config[tech as keyof typeof config])) {
|
|
52
|
+
const networkConfig = config[tech as keyof typeof config][network];
|
|
53
|
+
console.log(`Loading ${tech} network ${network}...`);
|
|
54
|
+
|
|
55
|
+
try {
|
|
56
|
+
// 1. Instantiate the active Read API based on the technology
|
|
57
|
+
const registryApi = tech === 'evm'
|
|
58
|
+
? new EvmRegistryReadAPI(networkConfig)
|
|
59
|
+
: new TronRegistryReadAPI(networkConfig);
|
|
60
|
+
|
|
61
|
+
// 2. Fetch and resolve the canonical smart contracts!
|
|
62
|
+
// This checks localStorage. If there is no cache, it asks the blockchain.
|
|
63
|
+
const addresses = await registryAddressLoader.Initialize(
|
|
64
|
+
tech as any,
|
|
65
|
+
network,
|
|
66
|
+
registryApi
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
console.log(`Resolved Contracts for ${tech}:${network}:`, addresses);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.error(`Failed to load registry for ${network}`, e);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 2. Using the Cached Addresses Instantly
|
|
79
|
+
|
|
80
|
+
Once `Initialize` has finished anywhere in your app, you never have to `await` or fetch from the blockchain again for that session! You can instantly grab the certified address in any Vue component:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
import { registryAddressLoader } from '@the_library/web3-registry-addresses';
|
|
84
|
+
|
|
85
|
+
// Example: Get the CORE Testnet address for the "Factory" contract
|
|
86
|
+
const getFactoryAddress = () => {
|
|
87
|
+
// This is synchronous and zero-latency! It reads directly from RAM/localStorage.
|
|
88
|
+
const address = registryAddressLoader.getAddress('evm', 1114, 'Factory');
|
|
89
|
+
|
|
90
|
+
if (!address) throw new Error("Registry Cache is not initialized!");
|
|
91
|
+
return address;
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
By using this flow, your frontend is blazing fast, perfectly synced with the blockchain, and fully compliant with the D-SAFE architectural requirements!
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
**COPYRIGHT:** © 2026 DATAPOND PUBLIC LIBRARY TRUST - Australia
|
|
99
|
+
**TECHNICAL GUARDIAN:** POND ENTERPRISE PTY LTD - Australia
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
import { Tech, AddressRegistryReadAPI } from '@the_library/web3-core';
|
|
2
|
+
export * from '@the_library/web3-contracts';
|
|
2
3
|
|
|
4
|
+
interface ContractLoadingStatus {
|
|
5
|
+
name: string;
|
|
6
|
+
status: 'pending' | 'loading' | 'loaded' | 'error';
|
|
7
|
+
address?: string;
|
|
8
|
+
}
|
|
9
|
+
interface LoadingStatus {
|
|
10
|
+
total: number;
|
|
11
|
+
loaded: number;
|
|
12
|
+
contracts: ContractLoadingStatus[];
|
|
13
|
+
}
|
|
3
14
|
interface CacheEntry {
|
|
4
15
|
address: string;
|
|
5
16
|
abi: any;
|
|
@@ -11,17 +22,32 @@ interface RegistryCache {
|
|
|
11
22
|
entries: {
|
|
12
23
|
[contractName: string]: CacheEntry;
|
|
13
24
|
};
|
|
25
|
+
dataEntries?: {
|
|
26
|
+
[dataKey: string]: string;
|
|
27
|
+
};
|
|
14
28
|
}
|
|
15
29
|
declare class RegistryAddressLoader {
|
|
30
|
+
private defered;
|
|
16
31
|
private memoryCache;
|
|
32
|
+
private listeners;
|
|
33
|
+
private loadingStatuses;
|
|
17
34
|
private getCacheKey;
|
|
18
35
|
private getFromLocalStorage;
|
|
19
36
|
private saveToLocalStorage;
|
|
37
|
+
subscribe(listener: (tech: Tech, chainId: string | number, status: LoadingStatus) => void): () => void;
|
|
38
|
+
private notify;
|
|
39
|
+
getLoadingStatus(tech: Tech, chainId: string | number): LoadingStatus | undefined;
|
|
20
40
|
private fetchAbiFromArweave;
|
|
21
|
-
|
|
41
|
+
loadAllKeys(tech: Tech, chainId: number | string): Promise<Record<string, string>>;
|
|
42
|
+
Initialize(tech: Tech, chainId: number | string, registry: AddressRegistryReadAPI, registryAddress?: string): Promise<Record<string, string>>;
|
|
22
43
|
getAddress(tech: string, chainId: string | number, name: string): string | undefined;
|
|
23
44
|
getAbi(tech: string, chainId: string | number, name: string): any;
|
|
45
|
+
getData(tech: string, chainId: string | number, key: string): string | undefined;
|
|
24
46
|
}
|
|
25
47
|
declare const registryAddressLoader: RegistryAddressLoader;
|
|
48
|
+
/**
|
|
49
|
+
* Proxy to registryAddressLoader for backward compatibility
|
|
50
|
+
*/
|
|
51
|
+
declare function getContractAbi(ecosystem: string, networkId: string | number, contractName: string): any;
|
|
26
52
|
|
|
27
|
-
export { type CacheEntry, RegistryAddressLoader, type RegistryCache, registryAddressLoader };
|
|
53
|
+
export { type CacheEntry, type ContractLoadingStatus, type LoadingStatus, RegistryAddressLoader, type RegistryCache, getContractAbi, registryAddressLoader };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
export{d as RegistryAddressLoader,$ as registryAddressLoader};//# sourceMappingURL=index.js.map
|
|
1
|
+
var E="dcode_registry_cache_v2_",x=1440*60*1e3,p=class{constructor(){this.defered={};this.memoryCache=new Map;this.listeners=new Set;this.loadingStatuses=new Map}getCacheKey(e,t){return`${E}${e}_${t}`}getFromLocalStorage(e){let t=localStorage.getItem(e);if(!t)return null;try{return JSON.parse(t)}catch(s){return console.error(`[RegistryLoader] Failed to parse cache for ${e}`,s),null}}saveToLocalStorage(e,t){localStorage.setItem(e,JSON.stringify(t))}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}notify(e,t,s){let a=`${e}:${t}`;this.loadingStatuses.set(a,s),this.listeners.forEach(o=>o(e,t,s))}getLoadingStatus(e,t){return this.loadingStatuses.get(`${e}:${t}`)}async fetchAbiFromArweave(e){if(!e)return null;try{let t=await fetch(`https://arweave.net/${e}`);if(t.ok){let s=await t.json();return console.log(`[RegistryLoader] Successfully fetched ABI for ${e}`),s}console.error(`[RegistryLoader] Arweave fetch failed for ${e}: ${t.status} ${t.statusText}`)}catch(t){console.warn(`[RegistryLoader] Failed to fetch ABI from Arweave (${e}):`,t)}return null}async loadAllKeys(e,t){let s={},a=this.getCacheKey(e,t),o=`${e}-${t}`;typeof this.defered[o]<"u"&&await this.defered[o];let d=this.memoryCache.get(a)||this.getFromLocalStorage(a);if(d)return this.memoryCache.set(a,d),Object.values(d.entries).forEach(u=>{let y=u.originalName.charAt(0).toLowerCase()+u.originalName.slice(1);s[y]=u.address}),s;throw new Error(`No cache found for ${e}:${t}`)}async Initialize(e,t,s,a){console.log(`[RegistryLoader] Starting Initialization for ${e}:${t} using AddressRegistry at ${a||"unknown"}`);let o=this.getCacheKey(e,t),d=Date.now(),u=`${e}-${t}`;if(typeof this.defered[u]<"u")return this.loadAllKeys(e,t);let y,v;this.defered[u]=new Promise((r,n)=>{y=r,v=n});let g=this.memoryCache.get(o)||this.getFromLocalStorage(o);if(g&&d-g.timestamp<x){console.log(`[RegistryLoader] Cache valid for ${e}:${t}`);let r=this.loadAllKeys(e,t);return y(!0),r}console.log(`[RegistryLoader] Cache expired or missing for ${e}:${t}. Performing Full Sync...`);let m=await s.getAllContractNames(),h=[];try{h=await s.getAllDataKeys()}catch{console.warn(`[RegistryLoader] Failed to fetch data keys (method may not exist yet on this network for ${e}:${t})`)}console.log(`[RegistryLoader] Retrieved ${m.length} contract names and ${h.length} data keys for ${e}:${t} (Registry at ${a}):`,m,h);let i={total:m.length+h.length,loaded:0,contracts:m.map(r=>({name:r,status:"pending"}))};this.notify(e,t,i);let w={},L={},R={},A=m.map(async r=>{let n=i.contracts.find(c=>c.name===r);n.status="loading",this.notify(e,t,{...i});try{let[c,l]=await s.getLatestContract(r);console.log(`[RegistryLoader] Found ${r} at ${c} (ABI: ${l}) for ${e}:${t}`);let f=r.toLowerCase(),K=r.charAt(0).toLowerCase()+r.slice(1),$=null;g&&g.entries[f]&&g.entries[f].txId===l?$=g.entries[f].abi:l?(console.log(`[RegistryLoader] Fetching new ABI for ${r} (${l})...`),$=await this.fetchAbiFromArweave(l)):console.warn(`[RegistryLoader] No ABI URL found for ${r} on ${e}:${t}`),w[f]={address:c,abi:$,txId:l,originalName:r},R[K]=c,n.status=$||!l?"loaded":"error",n.address=c}catch(c){console.warn(`[RegistryLoader] Failed to load contract ${r} for ${e}:${t}:`,c),n.status="error"}finally{i.loaded++,this.notify(e,t,{...i})}}),S=h.map(async r=>{try{let n=await s.getLatestData(r);L[r]=n,console.log(`[RegistryLoader] Found data ${r} = ${n} for ${e}:${t}`)}catch(n){console.warn(`[RegistryLoader] Failed to load data ${r} for ${e}:${t}:`,n)}finally{i.loaded++,this.notify(e,t,{...i})}});await Promise.all([...A,...S]);let b={timestamp:i.contracts.some(r=>r.status==="error")?g?.timestamp||0:d,entries:w,dataEntries:L};return this.memoryCache.set(o,b),this.saveToLocalStorage(o,b),y(!0),R}getAddress(e,t,s){let a=this.getCacheKey(e,t);return this.memoryCache.get(a)?.entries[s.toLowerCase()]?.address}getAbi(e,t,s){let a=this.getCacheKey(e,t);return this.memoryCache.get(a)?.entries[s.toLowerCase()]?.abi}getData(e,t,s){let a=this.getCacheKey(e,t);return this.memoryCache.get(a)?.dataEntries?.[s]}},F=new p;function P(C,e,t){return F.getAbi(C,e,t)}export*from"@the_library/web3-contracts";export{p as RegistryAddressLoader,P as getContractAbi,F as registryAddressLoader};
|
|
3
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/loader.ts"],"names":["CACHE_KEY_PREFIX","CACHE_DURATION_MS","RegistryAddressLoader","tech","chainId","key","data","e","cache","abiUrl","res","abi","registry","cacheKey","now","addresses","entry","camelCaseName","contractNames","newEntries","name","address","normalizedName","newCache","registryAddressLoader"],"mappings":"AAEA,IAAMA,CAAAA,CAAmB,2BACnBC,CAAAA,CAAoB,IAAA,CAAU,GAAK,GAAA,CAgB5BC,CAAAA,CAAN,KAA4B,CAA5B,WAAA,EAAA,CACH,IAAA,CAAQ,YAA0C,IAAI,IAAA,CAE9C,YAAYC,CAAAA,CAAcC,CAAAA,CAAkC,CAChE,OAAO,CAAA,EAAGJ,CAAgB,CAAA,EAAGG,CAAI,CAAA,CAAA,EAAIC,CAAO,CAAA,CAChD,CAEQ,oBAAoBC,CAAAA,CAAmC,CAC3D,IAAMC,CAAAA,CAAO,YAAA,CAAa,OAAA,CAAQD,CAAG,CAAA,CACrC,GAAI,CAACC,CAAAA,CAAM,OAAO,KAClB,GAAI,CACA,OAAO,IAAA,CAAK,KAAA,CAAMA,CAAI,CAC1B,CAAA,MAASC,CAAAA,CAAG,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v2_';\nconst CACHE_DURATION_MS = 24 * 60 * 60 * 1000; // 24 hours\n\nexport interface CacheEntry {\n address: string;\n abi: any;\n txId: string;\n originalName: string;\n}\n\nexport interface RegistryCache {\n timestamp: number;\n entries: {\n [contractName: string]: CacheEntry;\n };\n}\n\nexport class RegistryAddressLoader {\n private memoryCache: Map<string, RegistryCache> = new Map();\n\n private getCacheKey(tech: string, chainId: string | number): string {\n return `${CACHE_KEY_PREFIX}${tech}_${chainId}`;\n }\n\n private getFromLocalStorage(key: string): RegistryCache | null {\n const data = localStorage.getItem(key);\n if (!data) return null;\n try {\n return JSON.parse(data);\n } catch (e) {\n console.error(`[RegistryLoader] Failed to parse cache for ${key}`, e);\n return null;\n }\n }\n\n private saveToLocalStorage(key: string, cache: RegistryCache): void {\n localStorage.setItem(key, JSON.stringify(cache));\n }\n\n private async fetchAbiFromArweave(abiUrl: string): Promise<any> {\n if (!abiUrl) return null;\n try {\n const res = await fetch(`https://arweave.net/${abiUrl}`);\n if (res.ok) {\n const abi = await res.json();\n console.log(`[RegistryLoader] Successfully fetched ABI for ${abiUrl}`);\n return abi;\n }\n console.error(`[RegistryLoader] Arweave fetch failed for ${abiUrl}: ${res.status} ${res.statusText}`);\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to fetch ABI from Arweave (${abiUrl}):`, e);\n }\n return null;\n }\n\n public async Initialize(tech: Tech, chainId: number | string, registry: AddressRegistryReadAPI): Promise<Record<string, string>> {\n const cacheKey = this.getCacheKey(tech, chainId);\n const now = Date.now();\n\n let cache = this.memoryCache.get(cacheKey) || this.getFromLocalStorage(cacheKey);\n\n // Time Check: Has it been less than 24 hours?\n if (cache && (now - cache.timestamp < CACHE_DURATION_MS)) {\n console.log(`[RegistryLoader] Cache valid for ${tech}:${chainId}`);\n this.memoryCache.set(cacheKey, cache);\n const addresses: Record<string, string> = {};\n Object.values(cache.entries).forEach(entry => {\n const camelCaseName = entry.originalName.charAt(0).toLowerCase() + entry.originalName.slice(1);\n addresses[camelCaseName] = entry.address;\n });\n return addresses;\n }\n\n console.log(`[RegistryLoader] Cache expired or missing for ${tech}:${chainId}. Performing Full Sync...`);\n\n const contractNames = await registry.getAllContractNames();\n console.log(`[RegistryLoader] Retrieved ${contractNames.length} contract names for ${tech}:${chainId}:`, contractNames);\n const newEntries: { [name: string]: CacheEntry } = {};\n const addresses: Record<string, string> = {};\n\n for (const name of contractNames) {\n try {\n const [address, abiUrl] = await registry.getLatestContract(name);\n const normalizedName = name.toLowerCase();\n const camelCaseName = name.charAt(0).toLowerCase() + name.slice(1);\n\n let abi = null;\n // Try to reuse ABI from old cache if txId matches\n if (cache && cache.entries[normalizedName] && cache.entries[normalizedName].txId === abiUrl) {\n abi = cache.entries[normalizedName].abi;\n } else if (abiUrl) {\n console.log(`[RegistryLoader] Fetching new ABI for ${name} (${abiUrl})...`);\n abi = await this.fetchAbiFromArweave(abiUrl);\n } else {\n console.warn(`[RegistryLoader] No ABI URL found for ${name} on ${tech}:${chainId}`);\n }\n\n newEntries[normalizedName] = {\n address,\n abi,\n txId: abiUrl,\n originalName: name\n };\n addresses[camelCaseName] = address;\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to load contract ${name} for ${tech}:${chainId}:`, e);\n }\n }\n\n const newCache: RegistryCache = {\n timestamp: now,\n entries: newEntries\n };\n\n this.memoryCache.set(cacheKey, newCache);\n this.saveToLocalStorage(cacheKey, newCache);\n return addresses;\n }\n\n public getAddress(tech: string, chainId: string | number, name: string): string | undefined {\n const cacheKey = this.getCacheKey(tech, chainId);\n const cache = this.memoryCache.get(cacheKey);\n return cache?.entries[name.toLowerCase()]?.address;\n }\n\n public getAbi(tech: string, chainId: string | number, name: string): any {\n const cacheKey = this.getCacheKey(tech, chainId);\n const cache = this.memoryCache.get(cacheKey);\n return cache?.entries[name.toLowerCase()]?.abi;\n }\n}\n\nexport const registryAddressLoader = new RegistryAddressLoader();\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/loader.ts","../src/index.ts"],"sourcesContent":["import { ReadOnlyDomainAPI, Tech, AddressRegistryReadAPI } from '@the_library/web3-core';\n\nexport interface ContractLoadingStatus {\n name: string;\n status: 'pending' | 'loading' | 'loaded' | 'error';\n address?: string;\n}\n\nexport interface LoadingStatus {\n total: number;\n loaded: number;\n contracts: ContractLoadingStatus[];\n}\n\n\nconst CACHE_KEY_PREFIX = 'dcode_registry_cache_v2_';\nconst CACHE_DURATION_MS = 24 * 60 * 60 * 1000; // 24 hours\n\nexport interface CacheEntry {\n address: string;\n abi: any;\n txId: string;\n originalName: string;\n}\n\nexport interface RegistryCache {\n timestamp: number;\n entries: {\n [contractName: string]: CacheEntry;\n };\n dataEntries?: {\n [dataKey: string]: string;\n };\n}\n\nexport class RegistryAddressLoader {\n\n private defered: { [key: string]: Promise<true> } = {};\n private memoryCache: Map<string, RegistryCache> = new Map();\n private listeners: Set<(tech: Tech, chainId: string | number, status: LoadingStatus) => void> = new Set();\n private loadingStatuses: Map<string, LoadingStatus> = new Map();\n\n\n private getCacheKey(tech: string, chainId: string | number): string {\n return `${CACHE_KEY_PREFIX}${tech}_${chainId}`;\n }\n\n private getFromLocalStorage(key: string): RegistryCache | null {\n const data = localStorage.getItem(key);\n if (!data) return null;\n try {\n return JSON.parse(data);\n } catch (e) {\n console.error(`[RegistryLoader] Failed to parse cache for ${key}`, e);\n return null;\n }\n }\n\n private saveToLocalStorage(key: string, cache: RegistryCache): void {\n localStorage.setItem(key, JSON.stringify(cache));\n }\n\n public subscribe(listener: (tech: Tech, chainId: string | number, status: LoadingStatus) => void): () => void {\n this.listeners.add(listener);\n return () => this.listeners.delete(listener);\n }\n\n private notify(tech: Tech, chainId: string | number, status: LoadingStatus): void {\n const key = `${tech}:${chainId}`;\n this.loadingStatuses.set(key, status);\n this.listeners.forEach(l => l(tech, chainId, status));\n }\n\n public getLoadingStatus(tech: Tech, chainId: string | number): LoadingStatus | undefined {\n return this.loadingStatuses.get(`${tech}:${chainId}`);\n }\n\n\n private async fetchAbiFromArweave(abiUrl: string): Promise<any> {\n if (!abiUrl) return null;\n try {\n const res = await fetch(`https://arweave.net/${abiUrl}`);\n if (res.ok) {\n const abi = await res.json();\n console.log(`[RegistryLoader] Successfully fetched ABI for ${abiUrl}`);\n return abi;\n }\n console.error(`[RegistryLoader] Arweave fetch failed for ${abiUrl}: ${res.status} ${res.statusText}`);\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to fetch ABI from Arweave (${abiUrl}):`, e);\n }\n return null;\n }\n\n public async loadAllKeys(tech: Tech, chainId: number | string): Promise<Record<string, string>> {\n const addresses: Record<string, string> = {};\n const cacheKey = this.getCacheKey(tech, chainId);\n\n const promiseKey = `${tech}-${chainId}`;\n if (typeof this.defered[promiseKey] !== 'undefined') {\n await this.defered[promiseKey];\n }\n let cache = this.memoryCache.get(cacheKey) || this.getFromLocalStorage(cacheKey);\n\n if (cache) {\n this.memoryCache.set(cacheKey, cache);\n\n Object.values(cache.entries).forEach(entry => {\n const camelCaseName = entry.originalName.charAt(0).toLowerCase() + entry.originalName.slice(1);\n addresses[camelCaseName] = entry.address;\n });\n return addresses;\n }\n throw new Error(`No cache found for ${tech}:${chainId}`);\n }\n public async Initialize(tech: Tech, chainId: number | string, registry: AddressRegistryReadAPI, registryAddress?: string): Promise<Record<string, string>> {\n console.log(`[RegistryLoader] Starting Initialization for ${tech}:${chainId} using AddressRegistry at ${registryAddress || 'unknown'}`);\n\n const cacheKey = this.getCacheKey(tech, chainId);\n const now = Date.now();\n\n\n const promiseKey = `${tech}-${chainId}`;\n if (typeof this.defered[promiseKey] !== 'undefined') {\n return this.loadAllKeys(tech, chainId)\n }\n let resolve!: (value: true) => void;\n let reject!: (reason?: any) => void;\n this.defered[promiseKey] = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n\n let cache = this.memoryCache.get(cacheKey) || this.getFromLocalStorage(cacheKey);\n\n // Time Check: Has it been less than 24 hours?\n if (cache && (now - cache.timestamp < CACHE_DURATION_MS)) {\n console.log(`[RegistryLoader] Cache valid for ${tech}:${chainId}`);\n const keys = this.loadAllKeys(tech, chainId)\n resolve(true);\n return keys;\n }\n\n console.log(`[RegistryLoader] Cache expired or missing for ${tech}:${chainId}. Performing Full Sync...`);\n\n const contractNames = await registry.getAllContractNames();\n let dataKeys: string[] = [];\n try {\n dataKeys = await registry.getAllDataKeys();\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to fetch data keys (method may not exist yet on this network for ${tech}:${chainId})`);\n }\n \n console.log(`[RegistryLoader] Retrieved ${contractNames.length} contract names and ${dataKeys.length} data keys for ${tech}:${chainId} (Registry at ${registryAddress}):`, contractNames, dataKeys);\n\n\n const status: LoadingStatus = {\n total: contractNames.length + dataKeys.length,\n loaded: 0,\n contracts: contractNames.map(name => ({ name, status: 'pending' }))\n };\n this.notify(tech, chainId, status);\n\n const newEntries: { [name: string]: CacheEntry } = {};\n const newDataEntries: { [name: string]: string } = {};\n const addresses: Record<string, string> = {};\n\n const loadPromises = contractNames.map(async (name) => {\n const contractStatus = status.contracts.find(c => c.name === name)!;\n contractStatus.status = 'loading';\n this.notify(tech, chainId, { ...status });\n\n try {\n const [address, abiUrl] = await registry.getLatestContract(name);\n console.log(`[RegistryLoader] Found ${name} at ${address} (ABI: ${abiUrl}) for ${tech}:${chainId}`);\n\n const normalizedName = name.toLowerCase();\n const camelCaseName = name.charAt(0).toLowerCase() + name.slice(1);\n\n let abi = null;\n // Try to reuse ABI from old cache if txId matches\n if (cache && cache.entries[normalizedName] && cache.entries[normalizedName].txId === abiUrl) {\n abi = cache.entries[normalizedName].abi;\n } else if (abiUrl) {\n console.log(`[RegistryLoader] Fetching new ABI for ${name} (${abiUrl})...`);\n abi = await this.fetchAbiFromArweave(abiUrl);\n } else {\n console.warn(`[RegistryLoader] No ABI URL found for ${name} on ${tech}:${chainId}`);\n }\n\n newEntries[normalizedName] = {\n address,\n abi,\n txId: abiUrl,\n originalName: name\n };\n addresses[camelCaseName] = address;\n contractStatus.status = abi || !abiUrl ? 'loaded' : 'error';\n contractStatus.address = address;\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to load contract ${name} for ${tech}:${chainId}:`, e);\n contractStatus.status = 'error';\n } finally {\n status.loaded++;\n this.notify(tech, chainId, { ...status });\n }\n });\n\n const dataPromises = dataKeys.map(async (key) => {\n try {\n const value = await registry.getLatestData(key);\n newDataEntries[key] = value;\n console.log(`[RegistryLoader] Found data ${key} = ${value} for ${tech}:${chainId}`);\n } catch (e) {\n console.warn(`[RegistryLoader] Failed to load data ${key} for ${tech}:${chainId}:`, e);\n } finally {\n status.loaded++;\n this.notify(tech, chainId, { ...status });\n }\n });\n\n await Promise.all([...loadPromises, ...dataPromises]);\n\n const hasErrors = status.contracts.some(c => c.status === 'error');\n\n const newCache: RegistryCache = {\n timestamp: hasErrors ? (cache?.timestamp || 0) : now,\n entries: newEntries,\n dataEntries: newDataEntries\n };\n\n this.memoryCache.set(cacheKey, newCache);\n this.saveToLocalStorage(cacheKey, newCache);\n resolve(true);\n return addresses;\n }\n\n\n public getAddress(tech: string, chainId: string | number, name: string): string | undefined {\n const cacheKey = this.getCacheKey(tech, chainId);\n const cache = this.memoryCache.get(cacheKey);\n return cache?.entries[name.toLowerCase()]?.address;\n }\n\n public getAbi(tech: string, chainId: string | number, name: string): any {\n const cacheKey = this.getCacheKey(tech, chainId);\n const cache = this.memoryCache.get(cacheKey);\n return cache?.entries[name.toLowerCase()]?.abi;\n }\n\n public getData(tech: string, chainId: string | number, key: string): string | undefined {\n const cacheKey = this.getCacheKey(tech, chainId);\n const cache = this.memoryCache.get(cacheKey);\n return cache?.dataEntries?.[key];\n }\n}\n\nexport const registryAddressLoader = new RegistryAddressLoader();\n\n/**\n * Proxy to registryAddressLoader for backward compatibility\n */\nexport function getContractAbi(ecosystem: string, networkId: string | number, contractName: string): any {\n return registryAddressLoader.getAbi(ecosystem, networkId, contractName);\n}\n","export * from './loader';\nexport * from '@the_library/web3-contracts';\n"],"mappings":"AAeA,IAAMA,EAAmB,2BACnBC,E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,GAAGuB,EAAc,GAAGI,CAAY,CAAC,EAIpD,IAAME,EAA0B,CAC5B,UAHc7B,EAAO,UAAU,KAAK8B,GAAKA,EAAE,SAAW,OAAO,EAGrChC,GAAO,WAAa,EAAKc,EACjD,QAASS,EACT,YAAaC,CACjB,EAEA,YAAK,YAAY,IAAIhB,EAAUuB,CAAQ,EACvC,KAAK,mBAAmBvB,EAAUuB,CAAQ,EAC1ChB,EAAQ,EAAI,EACLR,CACX,CAGO,WAAWZ,EAAcC,EAA0B0B,EAAkC,CACxF,IAAMd,EAAW,KAAK,YAAYb,EAAMC,CAAO,EAE/C,OADc,KAAK,YAAY,IAAIY,CAAQ,GAC7B,QAAQc,EAAK,YAAY,CAAC,GAAG,OAC/C,CAEO,OAAO3B,EAAcC,EAA0B0B,EAAmB,CACrE,IAAMd,EAAW,KAAK,YAAYb,EAAMC,CAAO,EAE/C,OADc,KAAK,YAAY,IAAIY,CAAQ,GAC7B,QAAQc,EAAK,YAAY,CAAC,GAAG,GAC/C,CAEO,QAAQ3B,EAAcC,EAA0BC,EAAiC,CACpF,IAAMW,EAAW,KAAK,YAAYb,EAAMC,CAAO,EAE/C,OADc,KAAK,YAAY,IAAIY,CAAQ,GAC7B,cAAcX,CAAG,CACnC,CACJ,EAEaoC,EAAwB,IAAIvC,EAKlC,SAASwC,EAAeC,EAAmBC,EAA4BC,EAA2B,CACrG,OAAOJ,EAAsB,OAAOE,EAAWC,EAAWC,CAAY,CAC1E,CCvQA,WAAc","names":["CACHE_KEY_PREFIX","CACHE_DURATION_MS","RegistryAddressLoader","tech","chainId","key","data","e","cache","listener","status","l","abiUrl","res","abi","addresses","cacheKey","promiseKey","entry","camelCaseName","registry","registryAddress","now","resolve","reject","_resolve","_reject","keys","contractNames","dataKeys","name","newEntries","newDataEntries","loadPromises","contractStatus","address","normalizedName","dataPromises","value","newCache","c","registryAddressLoader","getContractAbi","ecosystem","networkId","contractName"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@the_library/web3-registry-addresses",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Common package for handling Web3 AddressRegistry sessions and caching",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -28,15 +28,13 @@
|
|
|
28
28
|
"cache"
|
|
29
29
|
],
|
|
30
30
|
"sideEffects": false,
|
|
31
|
-
"author": "Med Pond",
|
|
31
|
+
"author": "Med Pond <med@datapond.earth>",
|
|
32
32
|
"license": "SEE LICENSE IN LICENCE",
|
|
33
33
|
"devDependencies": {
|
|
34
|
+
"@the_library/web3-contracts": "workspace:*",
|
|
35
|
+
"@the_library/web3-core": "workspace:*",
|
|
34
36
|
"@types/node": "^22.10.0",
|
|
35
37
|
"tsup": "^8.0.1",
|
|
36
38
|
"typescript": "^5.3.3"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@the_library/web3-contracts": "workspace:*",
|
|
40
|
-
"@the_library/web3-core": "workspace:*"
|
|
41
39
|
}
|
|
42
|
-
}
|
|
40
|
+
}
|