Retrieving the address of the deployed proxy

I’m wondering if there’s a way to retrieve the address of my deployed proxy from the network file ( zos.rinkeby.json) other than reading the .json file manually? Something like a getProxyAddress() function?
Thanks

1 Like

Hey @n44o! I’ll go ahead and tag @spalladino to help you :grin:

Hey @n44o! You can install zos locally and use its programmatic interface. We provide a couple of classes that could be useful; in this particular case, you should use the ZosPackageFile/ZosNetworkFile classes as follows:

import { files: { ZosPackageFile } } from 'zos';

const packageFile = new ZosPackageFile();
const networkFile = packageFile.networkFile('rinkeby');
const proxies = networkFile.getProxies({ contract: 'Foo' });
console.log(proxies); // => [{ contract: 'Foo', address: '0x123...', ... }]

You can check all the methods implemented in ZosNetworkFile here

3 Likes

@jcarpanelli Thanks for this! That’s what I was looking for.

1 Like