mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
Merge remote-tracking branch 'origin/master' into update/packages
# Conflicts: # package-lock.json # package.json
This commit is contained in:
commit
a69c128cb6
773
package-lock.json
generated
773
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
|
@ -66,6 +66,7 @@ export abstract class Instantiable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getInstance(...args: any[]): Promise<any>
|
public static async getInstance(...args: any[]): Promise<any>
|
||||||
|
|
||||||
public static async getInstance(config: InstantiableConfig): Promise<any> {
|
public static async getInstance(config: InstantiableConfig): Promise<any> {
|
||||||
LoggerInstance.warn(
|
LoggerInstance.warn(
|
||||||
'getInstance() methods has needs to be added to child class.'
|
'getInstance() methods has needs to be added to child class.'
|
||||||
|
@ -83,8 +84,11 @@ export abstract class Instantiable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private _ocean: Ocean
|
private _ocean: Ocean
|
||||||
|
|
||||||
private _web3: Web3
|
private _web3: Web3
|
||||||
|
|
||||||
private _config: Config
|
private _config: Config
|
||||||
|
|
||||||
private _logger: Logger
|
private _logger: Logger
|
||||||
|
|
||||||
protected setInstanceConfig(config: InstantiableConfig) {
|
protected setInstanceConfig(config: InstantiableConfig) {
|
||||||
|
|
|
@ -39,10 +39,15 @@ export class DDO {
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
public id: string = null
|
public id: string = null
|
||||||
|
|
||||||
public created: string
|
public created: string
|
||||||
|
|
||||||
public publicKey: PublicKey[] = []
|
public publicKey: PublicKey[] = []
|
||||||
|
|
||||||
public authentication: Authentication[] = []
|
public authentication: Authentication[] = []
|
||||||
|
|
||||||
public service: Service[] = []
|
public service: Service[] = []
|
||||||
|
|
||||||
public proof: Proof
|
public proof: Proof
|
||||||
|
|
||||||
public constructor(ddo: Partial<DDO> = {}) {
|
public constructor(ddo: Partial<DDO> = {}) {
|
||||||
|
|
|
@ -9,9 +9,13 @@ export class EventHandler extends Instantiable {
|
||||||
}
|
}
|
||||||
|
|
||||||
private events = new Set<(blockNumber) => void>()
|
private events = new Set<(blockNumber) => void>()
|
||||||
|
|
||||||
private lastBlock: number
|
private lastBlock: number
|
||||||
|
|
||||||
private interval = 200
|
private interval = 200
|
||||||
|
|
||||||
private polling: boolean = false
|
private polling: boolean = false
|
||||||
|
|
||||||
private lastTimeout: NodeJS.Timeout
|
private lastTimeout: NodeJS.Timeout
|
||||||
|
|
||||||
constructor(config: InstantiableConfig) {
|
constructor(config: InstantiableConfig) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { Instantiable, InstantiableConfig } from '../../Instantiable.abstract'
|
||||||
|
|
||||||
export abstract class ContractBase extends Instantiable {
|
export abstract class ContractBase extends Instantiable {
|
||||||
protected static instance = null
|
protected static instance = null
|
||||||
|
|
||||||
public contractName: string
|
public contractName: string
|
||||||
|
|
||||||
private contract: Contract = null
|
private contract: Contract = null
|
||||||
|
|
|
@ -36,6 +36,7 @@ export abstract class Condition extends ContractBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public fulfill(agreementId: string, ...args: any[])
|
public fulfill(agreementId: string, ...args: any[])
|
||||||
|
|
||||||
public fulfill(agreementId: string, args: any[], from?: string) {
|
public fulfill(agreementId: string, args: any[], from?: string) {
|
||||||
return this.sendFrom('fulfill', [zeroX(agreementId), ...args], from)
|
return this.sendFrom('fulfill', [zeroX(agreementId), ...args], from)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export default class Balance {
|
export default class Balance {
|
||||||
public eth: number
|
public eth: number
|
||||||
|
|
||||||
public ocn: number
|
public ocn: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ export class Config {
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
public brizoUri: string
|
public brizoUri: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address of Brizo.
|
* Address of Brizo.
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -24,6 +25,7 @@ export class Config {
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
public nodeUri?: string
|
public nodeUri?: string
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web3 Provider.
|
* Web3 Provider.
|
||||||
* @type {any}
|
* @type {any}
|
||||||
|
@ -56,6 +58,7 @@ export class Config {
|
||||||
|
|
||||||
// Parity config
|
// Parity config
|
||||||
public parityUri?: string
|
public parityUri?: string
|
||||||
|
|
||||||
public threshold?: number
|
public threshold?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export default class InputType {
|
export default class InputType {
|
||||||
public name: string
|
public name: string
|
||||||
|
|
||||||
public type: string
|
public type: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,12 @@ import InputType from './InputType'
|
||||||
|
|
||||||
export default class MethodReflection {
|
export default class MethodReflection {
|
||||||
public contractName: string
|
public contractName: string
|
||||||
|
|
||||||
public methodName: string
|
public methodName: string
|
||||||
|
|
||||||
public address: string
|
public address: string
|
||||||
|
|
||||||
public signature: string
|
public signature: string
|
||||||
|
|
||||||
public inputs: InputType[]
|
public inputs: InputType[]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
export default class ValuePair {
|
export default class ValuePair {
|
||||||
public type: string
|
public type: string
|
||||||
|
|
||||||
public value: any
|
public value: any
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { Instantiable, InstantiableConfig } from '../Instantiable.abstract'
|
||||||
*/
|
*/
|
||||||
export default class Account extends Instantiable {
|
export default class Account extends Instantiable {
|
||||||
private password?: string
|
private password?: string
|
||||||
|
|
||||||
private token?: string
|
private token?: string
|
||||||
|
|
||||||
constructor(private id: string = '0x0', config?: InstantiableConfig) {
|
constructor(private id: string = '0x0', config?: InstantiableConfig) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
export class SubscribableObserver<T, P> {
|
export class SubscribableObserver<T, P> {
|
||||||
public completed: boolean = false
|
public completed: boolean = false
|
||||||
|
|
||||||
private subscriptions = new Set<{
|
private subscriptions = new Set<{
|
||||||
onNext?: (next: T) => void
|
onNext?: (next: T) => void
|
||||||
onComplete?: (complete: P) => void
|
onComplete?: (complete: P) => void
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { SubscribableObserver } from './SubscribableObserver'
|
||||||
|
|
||||||
export class SubscribablePromise<T extends any, P extends any> {
|
export class SubscribablePromise<T extends any, P extends any> {
|
||||||
private observer = new SubscribableObserver<T, P>()
|
private observer = new SubscribableObserver<T, P>()
|
||||||
|
|
||||||
private promise = Object.assign(
|
private promise = Object.assign(
|
||||||
new Promise<P>((resolve, reject) => {
|
new Promise<P>((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user