Skip to content

@acala-network/chopsticks

@acala-network/chopsticks

Chopsticks JSON RPC and CLI.

Remarks

This package extends the @acala-network/chopsticks-core package a with JSON RPC server and CLI support.

Table of contents

Namespaces

Interfaces

Type Aliases

Functions

Type Aliases

ChainProperties

Ƭ ChainProperties: Object

Type declaration

NameType
ss58Format?number
tokenDecimals?number[]
tokenSymbol?string[]

Defined in

packages/core/dist/esm/index.d.ts:11


Handler

Ƭ Handler<TParams, TReturn>: (context: Context, params: TParams, subscriptionManager: SubscriptionManager) => Promise<TReturn>

Type parameters

NameType
TParamsany
TReturnany

Type declaration

▸ (context, params, subscriptionManager): Promise<TReturn>

Parameters
NameType
contextContext
paramsTParams
subscriptionManagerSubscriptionManager
Returns

Promise<TReturn>

Defined in

packages/core/dist/esm/rpc/shared.d.ts:24


RuntimeVersion

Ƭ RuntimeVersion: Object

Type declaration

NameType
apis[HexString, number][]
authoringVersionnumber
implNamestring
implVersionnumber
specNamestring
specVersionnumber
stateVersionnumber
transactionVersionnumber

Defined in

packages/core/dist/esm/wasm-executor/index.d.ts:7

Functions

dryRun

dryRun(context, params): Promise<string | [`0x${string}`, null | `0x${string}`][] | { delta: undefined | Delta ; new: {} = newState; old: {} = oldState }>

Dry run an extrinsic or messages. If html is true, return the generated storage diff html string. If raw is true, return the raw storage diff. Otherwise, return { oldState, newState, delta }.

This function is a dev rpc handler. Use dev_dryRun as the method name when calling it.

Parameters

NameTypeDescription
contextContextThe context object of the rpc handler
params[DryRunParams]The parameters of the rpc handler

Returns

Promise<string | [`0x${string}`, null | `0x${string}`][] | { delta: undefined | Delta ; new: {} = newState; old: {} = oldState }>

Example

ts
import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
const params = [
   {
     raw: false,
     dmp: [
       // https://acala.subscan.io/xcm_message/polkadot-2ab22918c567455af3563989d852f307f4cc1250
       {
         sentAt: 14471353,
         msg: '0x02100104000100000b00280b9bba030a13000100000b00280b9bba03010300286bee0d0100040001010070c53d8e216f9c0f2e3b11c53f5f4bf3e078b995d5f0ed590f889f41e20e6531',
       },
     ],
   },
 ]
await ws.send('dev_dryRun', params)

Defined in

packages/chopsticks/src/plugins/dry-run/rpc.ts:110


runBlock

runBlock(«destructured», «destructured»): Promise<RunBlockResponse>

Run a set of extrinsics on top of a block and get the storage diff and optionally the parsed storage diff and block details. NOTE: The extrinsics should include inherents or tranasctions may have unexpected results. NOTE: system.events and system.extrinsicData are excluded from storage diff to reduce size.

This function is a dev rpc handler. Use dev_runBlock as the method name when calling it.

Parameters

NameType
«destructured»Context
«destructured»[RunBlockParams]

Returns

Promise<RunBlockResponse>

Defined in

packages/chopsticks/src/plugins/run-block/rpc.ts:129