1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00

refactoring

This commit is contained in:
Sebastian Gerske 2018-10-18 13:12:23 +02:00
parent 7f5f7606dc
commit 43a9306132
6 changed files with 13 additions and 11 deletions

View File

@ -2,9 +2,9 @@ import {Receipt} from "web3-utils"
import AccessStatus from "../models/AccessStatus"
import Asset from "../ocean/Asset"
import Order from "../ocean/Order"
import ContractBaseWrapper from "./ContractWrapperBase"
import ContractBase from "./ContractBase"
export default class OceanAuth extends ContractBaseWrapper {
export default class OceanAuth extends ContractBase {
public static async getInstance(): Promise<OceanAuth> {
const auth: OceanAuth = new OceanAuth("OceanAuth")

View File

@ -3,7 +3,7 @@ import Contract from "web3-eth-contract"
import Logger from "../utils/Logger"
import ContractHandler from "./ContractHandler"
export default abstract class ContractWrapperBase {
export default abstract class ContractBase {
protected static instance = null
@ -14,6 +14,7 @@ export default abstract class ContractWrapperBase {
this.contractName = contractName
}
/*
public async listenToEventOnce(eventName: string, options: any): Promise<any> {
return new Promise<any>((resolve, reject) => {
if (!this.contract.events[eventName]) {
@ -27,6 +28,7 @@ export default abstract class ContractWrapperBase {
})
})
}
*/
public async getEventData(eventName: any, options: any): Promise<Event[]> {
if (!this.contract.events[eventName]) {

View File

@ -1,9 +1,9 @@
import BigNumber from "bignumber.js"
import {Receipt} from "web3-utils"
import Order from "../ocean/Order"
import ContractWrapperBase from "./ContractWrapperBase"
import ContractBase from "./ContractBase"
export default class OceanMarket extends ContractWrapperBase {
export default class OceanMarket extends ContractBase {
public static async getInstance(): Promise<OceanMarket> {
const market: OceanMarket = new OceanMarket("OceanMarket")

View File

@ -1,8 +1,8 @@
import BigNumber from "bignumber.js"
import {Receipt} from "web3-utils"
import ContractBaseWrapper from "./ContractWrapperBase"
import ContractBase from "./ContractBase"
export default class OceanToken extends ContractBaseWrapper {
export default class OceanToken extends ContractBase {
public static async getInstance(): Promise<OceanToken> {
const token: OceanToken = new OceanToken("OceanToken")

View File

@ -1,9 +1,9 @@
import ConfigProvider from "../../src/ConfigProvider"
import ContractHandler from "../../src/keeper/ContractHandler"
import config from "../config"
import ContractWrapperBaseMock from "../mocks/ContractWrapperBase.Mock"
import ContractBaseMock from "../mocks/ContractBase.Mock"
const wrappedContract = new ContractWrapperBaseMock("OceanToken")
const wrappedContract = new ContractBaseMock("OceanToken")
before(async () => {
ConfigProvider.configure(config)

View File

@ -1,6 +1,6 @@
import ContractWrapperBase from "../../src/keeper/ContractWrapperBase"
import ContractBase from "../../src/keeper/ContractBase"
export default class ContractWrapperBaseMock extends ContractWrapperBase {
export default class ContractBaseMock extends ContractBase {
public async initMock() {
this.init()
}