Skip to content

@acala-network/chopsticks-coreDocs


@acala-network/chopsticks-core / ChopsticksProvider

Class: ChopsticksProvider

Provider for local chopsticks chain

Implements

  • ProviderInterface

Constructors

new ChopsticksProvider()

new ChopsticksProvider(chain): ChopsticksProvider

Parameters

chain: Blockchain

Returns

ChopsticksProvider

Defined in

packages/core/src/chopsticks-provider.ts:42

Properties

chain

readonly chain: Blockchain

Defined in

packages/core/src/chopsticks-provider.ts:42


subscriptionManager

subscriptionManager: object

subscribe()

subscribe: (method, subid, onCancel) => (data) => void

Parameters

method: string

subid: string

onCancel = ...

Returns

Function

Parameters

data: any

Returns

void

unsubscribe()

unsubscribe: (subid) => void

Parameters

subid: string

Returns

void

Defined in

packages/core/src/chopsticks-provider.ts:99

Accessors

hasSubscriptions

get hasSubscriptions(): boolean

true if the provider supports subscriptions (not available for HTTP)

Returns

boolean

Implementation of

ProviderInterface.hasSubscriptions

Defined in

packages/core/src/chopsticks-provider.ts:61


isClonable

get isClonable(): boolean

true if the clone() functionality is available on the provider

Returns

boolean

Implementation of

ProviderInterface.isClonable

Defined in

packages/core/src/chopsticks-provider.ts:65


isConnected

get isConnected(): boolean

true if the provider is currently connected (ws/sc has connection logic)

Returns

boolean

Implementation of

ProviderInterface.isConnected

Defined in

packages/core/src/chopsticks-provider.ts:69


isReady

get isReady(): Promise<void>

Returns

Promise<void>

Defined in

packages/core/src/chopsticks-provider.ts:73

Methods

clone()

clone(): ChopsticksProvider

Returns

ChopsticksProvider

Implementation of

ProviderInterface.clone

Defined in

packages/core/src/chopsticks-provider.ts:77


connect()

connect(): Promise<void>

Returns

Promise<void>

Implementation of

ProviderInterface.connect

Defined in

packages/core/src/chopsticks-provider.ts:81


disconnect()

disconnect(): Promise<void>

Returns

Promise<void>

Implementation of

ProviderInterface.disconnect

Defined in

packages/core/src/chopsticks-provider.ts:86


on()

on(type, sub): () => void

Parameters

type: ProviderInterfaceEmitted

sub: ProviderInterfaceEmitCb

Returns

Function

Returns

void

Implementation of

ProviderInterface.on

Defined in

packages/core/src/chopsticks-provider.ts:91


send()

send<T>(method, params, _isCacheable?, subscription?): Promise<T>

Type Parameters

T

Parameters

method: string

params: unknown[]

_isCacheable?: boolean

subscription?: SubscriptionHandler

Returns

Promise<T>

Implementation of

ProviderInterface.send

Defined in

packages/core/src/chopsticks-provider.ts:128


subscribe()

subscribe(type, method, params, callback): Promise<string | number>

Parameters

type: string

method: string

params: unknown[]

callback: ProviderInterfaceCallback

Returns

Promise<string | number>

Implementation of

ProviderInterface.subscribe

Defined in

packages/core/src/chopsticks-provider.ts:168


unsubscribe()

unsubscribe(_type, method, id): Promise<boolean>

Parameters

_type: string

method: string

id: string | number

Returns

Promise<boolean>

Implementation of

ProviderInterface.unsubscribe

Defined in

packages/core/src/chopsticks-provider.ts:177


fromEndpoint()

static fromEndpoint(endpoint, block?, db?): Promise<ChopsticksProvider>

Parameters

endpoint: string

block?: null | string | number

db?: Database

Returns

Promise<ChopsticksProvider>

Defined in

packages/core/src/chopsticks-provider.ts:50