Live addresses
Constant
Dynamic
const getCompAddr = async (strID: string): Promise<string> => {
const world = new ethers.Contract(worldAddr, WorldABI, provider);
const systemRegistry = await world.components();
const id = ethers.utils.solidityKeccak256(['string'], [strID]);
return await getAddrByID(systemRegistry, id);
};
const getSystemAddr = async (strID: string): Promise<string> => {
const world = new ethers.Contract(worldAddr, WorldABI, provider);
const systemRegistry = await world.systems();
const id = ethers.utils.solidityKeccak256(['string'], [strID]);
return await getAddrByID(systemRegistry, id);
};
const getAddrByID = async (
compsAddr: string,
id: BigNumberish
): Promise<string> => {
const comp = new ethers.Contract(compsAddr, UintCompABI, provider);
const values = await comp.getEntitiesWithValue(id);
return values.length > 0 ? values[0].toHexString() : '0x0000000000000000000000000000000000000000';
};Last updated