@acala-network/chopsticks-core
@acala-network/chopsticks-core / dev
Variable: dev
constdev:object
Defined in: packages/core/src/rpc/dev/index.ts:8
Type declaration
dev_newBlock()
dev_newBlock: (
context,params) =>Promise<`0x${string}`>
Build new blocks.
This function is a dev rpc handler. Use dev_newBlock as the method name when calling it.
Parameters
context
The context object of the rpc handler
params
[NewBlockParams]
The parameters of the rpc handler
Returns
Promise<`0x${string}`>
Examples
import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_newBlock', [{ count: 2 }])import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_newBlock', [
{
ump: {
// https://acala.subscan.io/xcm_message/polkadot-ff66f28818d0b74573e62db8317e354b253fbc80
2000: [
'0x021000040000000007903fc4db080a130000000007903fc4db08000d010004000101009c4b11a0974cba4a395c94832fba812868a6cb0ba09e8519b3521093ea359905',
],
}
}
])import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
// this will create two blocks with block height 100000001 and 100000002
await ws.send('dev_newBlock', [{ count: 2, unsafeBlockHeight: 100000001 }])dev_setBlockBuildMode()
dev_setBlockBuildMode: (
context,params) =>Promise<void>
Set block build mode.
1 - Batch, 2 - Instant, 3 - Manual
This function is a dev rpc handler. Use dev_setBlockBuildMode as the method name when calling it.
Parameters
context
The context object of the rpc handler
params
The parameters of the rpc handler
Returns
Promise<void>
Example
import { WsProvider } from '@polkadot/rpc-provider'
import { BuildBlockMode } from '@acala-network/chopsticks-core'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_setBlockBuildMode', [BuildBlockMode.Instant])dev_setHead()
dev_setHead: (
context,hashOrNumber) =>Promise<`0x${string}`>
Set head.
This function is a dev rpc handler. Use dev_setHead as the method name when calling it.
Parameters
context
The context object of the rpc handler
hashOrNumber
[number | `0x${string}`]
The block hash or number to set as head
Returns
Promise<`0x${string}`>
Example
import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_setHead', [1000000])dev_setRuntimeLogLevel()
dev_setRuntimeLogLevel: (
context,runtimeLogLevel) =>Promise<void>
Set runtime log level.
This function is a dev rpc handler. Use dev_setRuntimeLogLevel as the method name when calling it.
Parameters
context
The context object of the rpc handler
runtimeLogLevel
[number]
The runtime log level to set
Returns
Promise<void>
Example
import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_setRuntimeLogLevel', [1])dev_setStorage()
dev_setStorage: (
context,params) =>Promise<`0x${string}`>
Set storage values.
This function is a dev rpc handler. Use dev_setStorage as the method name when calling it.
Parameters
context
The context object of the rpc handler
params
[StorageValues, `0x${string}`?]
The parameters of the rpc handler
Returns
Promise<`0x${string}`>
Example
import { WsProvider } from '@polkadot/rpc-provider'
import { Keyring } from '@polkadot/keyring'
const ws = new WsProvider(`ws://localhost:8000`)
const keyring = new Keyring({ type: 'ed25519' })
const bob = keyring.addFromUri('//Bob')
const storage = {
System: {
Account: [[[bob.address], { data: { free: 100000 }, nonce: 1 }]],
},
}
await ws.send('dev_setStorage', [storage])dev_timeTravel()
dev_timeTravel: (
context,date) =>Promise<number>
Travel to a specific time.
This function is a dev rpc handler. Use dev_timeTravel as the method name when calling it.
Parameters
context
The context object of the rpc handler
date
[string | number]
Timestamp or date string to set
Returns
Promise<number>
Example
import { WsProvider } from '@polkadot/rpc-provider'
const ws = new WsProvider(`ws://localhost:8000`)
await ws.send('dev_timeTravel', ['Jan 1, 2023'])