mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Fix error on getting contract address of not loaded contracts.
This commit is contained in:
parent
cb3717460b
commit
4c3f134942
@ -35,7 +35,10 @@ export default class ContractHandler extends Instantiable {
|
||||
this.setInstanceConfig(config)
|
||||
}
|
||||
|
||||
public async get(what: string, optional: boolean = false): Promise<Contract> {
|
||||
public async get(
|
||||
what: string,
|
||||
optional: boolean = false
|
||||
): Promise<Contract> {
|
||||
const where = (await this.ocean.keeper.getNetworkName()).toLowerCase()
|
||||
const networkId = await this.ocean.keeper.getNetworkId()
|
||||
try {
|
||||
|
@ -53,7 +53,10 @@ export abstract class ContractBase extends Instantiable {
|
||||
protected async init(config: InstantiableConfig) {
|
||||
this.setInstanceConfig(config)
|
||||
const contractHandler = new ContractHandler(config)
|
||||
this.contract = await contractHandler.get(this.contractName, this.optional)
|
||||
this.contract = await contractHandler.get(
|
||||
this.contractName,
|
||||
this.optional
|
||||
)
|
||||
}
|
||||
|
||||
protected async getFromAddress(from?: string): Promise<string> {
|
||||
|
@ -62,15 +62,15 @@ export class OceanVersions extends Instantiable {
|
||||
status: OceanPlatformTechStatus.Working,
|
||||
network: (await this.ocean.keeper.getNetworkName()).toLowerCase(),
|
||||
keeperVersion: keeperPackageJson.version,
|
||||
contracts: Object.values(
|
||||
await this.ocean.keeper.getAllInstances()
|
||||
).reduce(
|
||||
(acc, { contractName, address }) => ({
|
||||
...acc,
|
||||
[contractName]: address
|
||||
}),
|
||||
{}
|
||||
)
|
||||
contracts: Object.values(await this.ocean.keeper.getAllInstances())
|
||||
.filter(_ => !!_)
|
||||
.reduce(
|
||||
(acc, { contractName, address }) => ({
|
||||
...acc,
|
||||
[contractName]: address
|
||||
}),
|
||||
{}
|
||||
)
|
||||
}
|
||||
|
||||
// Brizo
|
||||
|
Loading…
Reference in New Issue
Block a user