@the_library/web3-contracts
v12.0.0
Published
List of DLibrary contracts deployed
Downloads
376
Maintainers
Readme
@the_library/web3-contracts
This package contains the official deployed smart contract addresses, base configurations, and brand mappings endorsed by dsafe.us for the decentralized D-Library project located at https://datapond.earth.
Legal Notice & D-CODE OPEN SOVEREIGN LICENCE
WARNING: PROPRIETARY PUBLIC SOURCE | D-SAFE COMPLIANT
This software is released strictly under the D-CODE OPEN SOVEREIGN LICENCE (v1.2). By utilizing this package, you agree to its binding conditions.
Critical Infrastructure Clause
As defined in Section 3: Technical Anchors & Hard-Fork Resilience of the license:
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.
Modifying the contract addresses within this package to point to private, uncertified, or centralized ledgers constitutes a material breach of the provided D-CODE OPEN SOVEREIGN LICENCE.
This restriction ensures the permanence, provenance, and anti-enclosure integrity of the public library.
🚀 Getting Started for Junior Developers
Welcome to the D-Library Web3 ecosystem! This package serves as the "Address Book" and "Brand Guide" for the entire platform.
Instead of manually copying and pasting contract addresses from block explorers, you use this package (alongside @the_library/web3-registry-addresses) to securely and programmatically load the correct, certified smart contracts into your frontend application (like Vue.js or React).
1. Getting Supported Techs and Brands
Instead of hardcoding the list of supported blockchains in your UI, you can dynamically generate it using our built-in configuration utilities. This ensures your UI is always up to date when new chains are added to the ecosystem.
import { brandsWithNetwork, BrandWithNetworks } from '@the_library/web3-contracts';
// This returns a structured array of all supported brands (e.g., TRON, CORE)
// along with their specific networks (Mainnet, Testnet, etc.)
const supportedBrands: BrandWithNetworks[] = brandsWithNetwork();
// Example: Iterating through for a Vue dropdown or UI component
// You can use these properties directly in Vue using `v-for="brand in supportedBrands"`
supportedBrands.forEach(brand => {
console.log(`Brand: ${brand.name.en} (${brand.tech})`);
brand.networks.forEach(network => {
console.log(` - Network: ${network.name} (Chain ID: ${network.chainId})`);
});
});2. Browser Caching Architecture
Because blockchain nodes can be slow to query, we utilize a dynamic, cached architecture specifically designed for browsers.
Here is how the API flows:
- Our codebase queries a master "AddressRegistry" on the blockchain.
- The Registry provides the latest URLs for the smart contract ABIs (application binary interfaces) securely hosted on the Arweave Permaweb.
- It downloads these ABIs and strictly caches them inside your Browser's
localStoragefor 24 hours.
This means the very first page load of your application might take a few seconds to sync from the blockchain, but all subsequent visits that day are incredibly fast because the ABIs are loaded directly from local browser storage!
3. Initializing & Loading Smart Contracts (D-CODE Booting)
Here is a full code sample demonstrating how to iterate through the entire supported ecosystem, boot up the registry caching engine, and prepare the contracts for use in your frontend:
(Note: We use the registryAddressLoader from the sibling package to execute the Initialize command)
import { config } from '@the_library/web3-contracts';
import { registryAddressLoader } from '@the_library/web3-registry-addresses';
import { EvmRegistryReadAPI } from '@the_library/web3-evm';
import { TronRegistryReadAPI } from '@the_library/web3-tron';
/**
* Initializes all endorsed D-Code contracts and syncs them to localStorage.
* Call this function during your app's boot phase (e.g., in `main.ts` or Vue's `onMounted`).
*/
const initializeDCodeContracts = async () => {
console.log("Starting D-Code Smart Contract Initialization...");
// Iterate over all endorsed technologies (e.g., 'evm', 'tron')
for (const tech of Object.keys(config)) {
// Iterate over all official network configurations for that tech
for (const chainId of Object.keys(config[tech as keyof typeof config])) {
const networkConfig = config[tech as keyof typeof config][chainId];
console.log(`Booting ${tech.toUpperCase()} Network: ${networkConfig.name}...`);
try {
// 1. Instantiate the Read-Only API for this specific network architecture
const registryApi = tech === 'evm'
? new EvmRegistryReadAPI(networkConfig)
: new TronRegistryReadAPI(networkConfig);
// 2. Initialize the caching loader.
// This checks localStorage first. If expired/empty, it performs a Full Sync from Arweave.
const resolvedAddresses = await registryAddressLoader.Initialize(
tech as any,
chainId,
registryApi
);
console.log(`Successfully cached ${Object.keys(resolvedAddresses).length} contracts for ${networkConfig.name}`);
} catch (error) {
console.error(`Failed to initialize D-Code registry for ${networkConfig.name}:`, error);
}
}
}
console.log("All D-Code contracts initialized and ready for frontend usage!");
}By utilizing these precise APIs, you abstract away the complexity of raw blockchain RPC calls and guarantee that your frontend is always correctly resolving the authentic D-SAFE ecosystem without violating the open sovereign license!
COPYRIGHT: © 2026 DATAPOND PUBLIC LIBRARY TRUST - Australia TECHNICAL GUARDIAN: POND ENTERPRISE PTY LTD - Australia
