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)
|
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 where = (await this.ocean.keeper.getNetworkName()).toLowerCase()
|
||||||
const networkId = await this.ocean.keeper.getNetworkId()
|
const networkId = await this.ocean.keeper.getNetworkId()
|
||||||
try {
|
try {
|
||||||
|
@ -53,7 +53,10 @@ export abstract class ContractBase extends Instantiable {
|
|||||||
protected async init(config: InstantiableConfig) {
|
protected async init(config: InstantiableConfig) {
|
||||||
this.setInstanceConfig(config)
|
this.setInstanceConfig(config)
|
||||||
const contractHandler = new ContractHandler(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> {
|
protected async getFromAddress(from?: string): Promise<string> {
|
||||||
|
@ -62,9 +62,9 @@ export class OceanVersions extends Instantiable {
|
|||||||
status: OceanPlatformTechStatus.Working,
|
status: OceanPlatformTechStatus.Working,
|
||||||
network: (await this.ocean.keeper.getNetworkName()).toLowerCase(),
|
network: (await this.ocean.keeper.getNetworkName()).toLowerCase(),
|
||||||
keeperVersion: keeperPackageJson.version,
|
keeperVersion: keeperPackageJson.version,
|
||||||
contracts: Object.values(
|
contracts: Object.values(await this.ocean.keeper.getAllInstances())
|
||||||
await this.ocean.keeper.getAllInstances()
|
.filter(_ => !!_)
|
||||||
).reduce(
|
.reduce(
|
||||||
(acc, { contractName, address }) => ({
|
(acc, { contractName, address }) => ({
|
||||||
...acc,
|
...acc,
|
||||||
[contractName]: address
|
[contractName]: address
|
||||||
|
Loading…
Reference in New Issue
Block a user