Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node next #522

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion executor/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion executor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chopsticks-executor"
version = "0.9.1-3"
version = "0.9.1-4"
description = "Chopsticks executor"
repository = "https://github.com/AcalaNetwork/chopsticks"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion executor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@acala-network/chopsticks-executor",
"description": "Chopsticks executor",
"version": "0.9.1-3",
"version": "0.9.1-4",
"license": "Apache-2.0",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ fn setup_console(level: Option<String>) {

#[wasm_bindgen(typescript_custom_section)]
const _: &'static str = r#"
import { HexString } from '@polkadot/util/types';
type HexString = `0x${string}`;
export interface JsCallback {
getStorage: (key: HexString) => Promise<string | undefined>
getStateRoot: () => Promise<string>
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks",
"version": "0.9.1-3",
"version": "0.9.1-4",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"bin": "./chopsticks.cjs",
Expand Down Expand Up @@ -55,10 +55,10 @@
"default": "./dist/esm/index.js"
},
"./*": {
"types": "./dist/types/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"default": "./dist/esm/index.js"
"types": "./dist/types/*.d.ts",
"require": "./dist/cjs/*.js",
"import": "./dist/esm/*.js",
"default": "./dist/esm/*.js"
},
"./plugins/*": {
"types": "./dist/types/plugins/*.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions packages/chopsticks/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import yargs from 'yargs'
import type { MiddlewareFunction } from 'yargs'

import { Blockchain, BuildBlockMode, connectParachains, connectVertical } from '@acala-network/chopsticks-core'
import { Config, fetchConfig } from './schema'
import { defaultOptions, mockOptions } from './cli-options'
import { pluginExtendCli } from './plugins'
import { setupWithServer } from '.'
import { Config, fetchConfig } from './schema/index.js'
import { defaultOptions, mockOptions } from './cli-options.js'
import { pluginExtendCli } from './plugins/index.js'
import { setupWithServer } from './index.js'

dotenvConfig()

Expand Down
6 changes: 3 additions & 3 deletions packages/chopsticks/src/context.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import './utils/tunnel'
import './utils/tunnel.js'
import { BlockEntry, GenesisProvider, defaultLogger, isUrl, setup, timeTravel } from '@acala-network/chopsticks-core'
import { Config } from './schema'
import { Config } from './schema/index.js'
import { HexString } from '@polkadot/util/types'
import { SqliteDatabase } from '@acala-network/chopsticks-db'
import { overrideStorage, overrideWasm } from './utils/override'
import { overrideStorage, overrideWasm } from './utils/override.js'
import axios from 'axios'

const logger = defaultLogger.child({ name: 'setup-context' })
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@polkadot/api-augment'

export * from '@acala-network/chopsticks-core'
export { setupWithServer } from './setup-with-server'
export { fetchConfig } from './schema'
export { setupWithServer } from './setup-with-server.js'
export { fetchConfig } from './schema/index.js'
6 changes: 3 additions & 3 deletions packages/chopsticks/src/plugins/decode-key/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Config } from '../../schema'
import { Config } from '../../schema/index.js'
import { HexString } from '@polkadot/util/types'
import { decodeKey } from '@acala-network/chopsticks-core'
import { defaultOptions } from '../../cli-options'
import { setupContext } from '../../context'
import { defaultOptions } from '../../cli-options.js'
import { setupContext } from '../../context.js'
import type { Argv } from 'yargs'

export const cli = (y: Argv) => {
Expand Down
8 changes: 4 additions & 4 deletions packages/chopsticks/src/plugins/dry-run/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Config } from '../../schema'
import { defaultOptions, mockOptions } from '../../cli-options'
import { dryRunExtrinsic } from './dry-run-extrinsic'
import { dryRunPreimage } from './dry-run-preimage'
import { Config } from '../../schema/index.js'
import { defaultOptions, mockOptions } from '../../cli-options.js'
import { dryRunExtrinsic } from './dry-run-extrinsic.js'
import { dryRunPreimage } from './dry-run-preimage.js'
import type { Argv } from 'yargs'

export const cli = (y: Argv) => {
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/src/plugins/dry-run/dry-run-extrinsic.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { blake2AsHex } from '@polkadot/util-crypto'
import { writeFileSync } from 'node:fs'

import { Config } from '../../schema'
import { defaultLogger } from '../../logger'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff'
import { openHtml } from '../../utils/open-html'
import { setupContext } from '../../context'
import { Config } from '../../schema/index.js'
import { defaultLogger } from '../../logger.js'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js'
import { openHtml } from '../../utils/open-html.js'
import { setupContext } from '../../context.js'

export const dryRunExtrinsic = async (argv: Config) => {
const context = await setupContext(argv)
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/src/plugins/dry-run/dry-run-preimage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { HexString } from '@polkadot/util/types'
import { blake2AsHex } from '@polkadot/util-crypto'
import { hexToU8a } from '@polkadot/util'

import { Config } from '../../schema'
import { defaultLogger } from '../../logger'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff'
import { Config } from '../../schema/index.js'
import { defaultLogger } from '../../logger.js'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js'
import { newHeader, printRuntimeLogs, runTask, setStorage, taskHandler } from '@acala-network/chopsticks-core'
import { openHtml } from '../../utils/open-html'
import { setupContext } from '../../context'
import { openHtml } from '../../utils/open-html.js'
import { setupContext } from '../../context.js'

export const dryRunPreimage = async (argv: Config) => {
const context = await setupContext(argv)
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/plugins/dry-run/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './cli'
export * from './rpc'
export * from './cli.js'
export * from './rpc.js'
4 changes: 2 additions & 2 deletions packages/chopsticks/src/plugins/dry-run/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { HexString } from '@polkadot/util/types'
import { z } from 'zod'

import { Context, ResponseError } from '@acala-network/chopsticks-core'
import { decodeStorageDiff } from '../../utils/decoder'
import { generateHtmlDiff } from '../../utils/generate-html-diff'
import { decodeStorageDiff } from '../../utils/decoder.js'
import { generateHtmlDiff } from '../../utils/generate-html-diff.js'

const zHex = z.custom<HexString>((val: any) => /^0x\w+$/.test(val))
const zHash = z.string().length(66).and(zHex)
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/src/plugins/follow-chain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { HexString } from '@polkadot/util/types'
import _ from 'lodash'
import type { Argv } from 'yargs'

import { createServer } from '../../server'
import { defaultOptions } from '../../cli-options'
import { handler } from '../../rpc'
import { setupContext } from '../../context'
import type { Config } from '../../schema'
import { createServer } from '../../server.js'
import { defaultOptions } from '../../cli-options.js'
import { handler } from '../../rpc/index.js'
import { setupContext } from '../../context.js'
import type { Config } from '../../schema/index.js'

const logger = defaultLogger.child({ name: 'follow-chain' })
const options = _.pick(defaultOptions, ['endpoint', 'wasm-override', 'runtime-log-level', 'offchain-worker'])
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Handlers } from '@acala-network/chopsticks-core'
import _ from 'lodash'
import type { Argv } from 'yargs'

import { defaultLogger } from '../logger'
import { defaultLogger } from '../logger.js'

const logger = defaultLogger.child({ name: 'plugin' })

Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/new-block/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Context, DownwardMessage, HorizontalMessage, ResponseError } from '@acala-network/chopsticks-core'
import { HexString } from '@polkadot/util/types'
import { defaultLogger } from '../../logger'
import { defaultLogger } from '../../logger.js'

export interface NewBlockParams {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/run-block/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest'

import { setup } from '@acala-network/chopsticks-core'

import { rpc } from '.'
import { rpc } from './index.js'

describe('run-block', () => {
it('should work', async () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/src/plugins/run-block/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ import {
taskHandler,
} from '@acala-network/chopsticks-core'

import { Config } from '../../schema'
import { defaultOptions, mockOptions } from '../../cli-options'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff'
import { openHtml } from '../../utils/open-html'
import { setupContext } from '../../context'
import { Config } from '../../schema/index.js'
import { defaultOptions, mockOptions } from '../../cli-options.js'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js'
import { openHtml } from '../../utils/open-html.js'
import { setupContext } from '../../context.js'

export const cli = (y: Argv) => {
y.command(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BuildBlockMode, Context, ResponseError } from '@acala-network/chopsticks-core'
import { defaultLogger } from '../../logger'
import { defaultLogger } from '../../logger.js'

/**
* Set a build block mode. See [BuildBlockMode](../core/enums/BuildBlockMode).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Context, ResponseError } from '@acala-network/chopsticks-core'
import { defaultLogger } from '../../logger'
import { defaultLogger } from '../../logger.js'

/**
* Set runtime log level.
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/plugins/set-storage/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Context, ResponseError, StorageValues, setStorage } from '@acala-network/chopsticks-core'
import { HexString } from '@polkadot/util/types'

import { defaultLogger } from '../../logger'
import { defaultLogger } from '../../logger.js'

/**
* Set storage values.
Expand Down
10 changes: 5 additions & 5 deletions packages/chopsticks/src/plugins/try-runtime/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { writeFileSync } from 'node:fs'
import type { Argv } from 'yargs'

import { Config } from '../../schema'
import { defaultOptions } from '../../cli-options'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff'
import { openHtml } from '../../utils/open-html'
import { setupContext } from '../../context'
import { Config } from '../../schema/index.js'
import { defaultOptions } from '../../cli-options.js'
import { generateHtmlDiffPreviewFile } from '../../utils/generate-html-diff.js'
import { openHtml } from '../../utils/open-html.js'
import { setupContext } from '../../context.js'

export const cli = (y: Argv) => {
y.command(
Expand Down
22 changes: 11 additions & 11 deletions packages/chopsticks/src/plugins/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export { rpc as newBlock } from './new-block'
export { rpc as dryRun } from './dry-run'
export { rpc as setBlockBuildMode } from './set-block-build-mode'
export { rpc as setHead } from './set-head'
export { rpc as setRuntimeLogLevel } from './set-runtime-log-level'
export { rpc as setStorage } from './set-storage'
export { rpc as timeTravel } from './time-travel'
export { rpc as runBlock } from './run-block'
export { rpc as newBlock } from './new-block/index.js'
export { rpc as dryRun } from './dry-run/index.js'
export { rpc as setBlockBuildMode } from './set-block-build-mode/index.js'
export { rpc as setHead } from './set-head/index.js'
export { rpc as setRuntimeLogLevel } from './set-runtime-log-level/index.js'
export { rpc as setStorage } from './set-storage/index.js'
export { rpc as timeTravel } from './time-travel/index.js'
export { rpc as runBlock } from './run-block/index.js'

export type { NewBlockParams } from './new-block'
export type { DryRunParams } from './dry-run'
export type { RunBlockParams } from './run-block'
export type { NewBlockParams } from './new-block/index.js'
export type { DryRunParams } from './dry-run/index.js'
export type { RunBlockParams } from './run-block/index.js'
2 changes: 1 addition & 1 deletion packages/chopsticks/src/rpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
substrate,
} from '@acala-network/chopsticks-core'

import { pluginHandlers } from '../plugins'
import { pluginHandlers } from '../plugins/index.js'

const allHandlers: Handlers = {
...substrate,
Expand Down
2 changes: 1 addition & 1 deletion packages/chopsticks/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AddressInfo, WebSocket, WebSocketServer } from 'ws'
import { ResponseError, SubscriptionManager } from '@acala-network/chopsticks-core'
import { z } from 'zod'

import { defaultLogger, truncate } from './logger'
import { defaultLogger, truncate } from './logger.js'

const logger = defaultLogger.child({ name: 'ws' })

Expand Down
8 changes: 4 additions & 4 deletions packages/chopsticks/src/setup-with-server.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Config } from './schema'
import { createServer } from './server'
import { handler } from './rpc'
import { Config } from './schema/index.js'
import { createServer } from './server.js'
import { handler } from './rpc/index.js'
import { logger } from '@acala-network/chopsticks-core'
import { setupContext } from './context'
import { setupContext } from './context.js'

export const setupWithServer = async (argv: Config) => {
const context = await setupContext(argv)
Expand Down
4 changes: 2 additions & 2 deletions packages/chopsticks/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export type {
SubscriptionManager,
Handler,
} from '@acala-network/chopsticks-core'
export * from '@acala-network/chopsticks-core/src/rpc/substrate'
export * from './plugins/types'
export * from '@acala-network/chopsticks-core/rpc/substrate/index.js'
export * from './plugins/types.js'
2 changes: 1 addition & 1 deletion packages/chopsticks/src/utils/generate-html-diff.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block } from '@acala-network/chopsticks-core'
import { HexString } from '@polkadot/util/types'
import { decodeStorageDiff } from './decoder'
import { decodeStorageDiff } from './decoder.js'
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs'
import _ from 'lodash'

Expand Down
8 changes: 4 additions & 4 deletions packages/chopsticks/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './decoder'
export * from './generate-html-diff'
export * from './open-html'
export * from './override'
export * from './decoder.js'
export * from './generate-html-diff.js'
export * from './open-html.js'
export * from './override.js'
2 changes: 1 addition & 1 deletion packages/chopsticks/src/utils/override.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HexString } from '@polkadot/util/types'
import { existsSync, readFileSync } from 'node:fs'
import yaml from 'js-yaml'

import { defaultLogger } from '../logger'
import { defaultLogger } from '../logger.js'

export const overrideStorage = async (chain: Blockchain, storage?: string | StorageValues, at?: HexString) => {
if (storage == null) {
Expand Down
10 changes: 5 additions & 5 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@acala-network/chopsticks-core",
"version": "0.9.1-3",
"version": "0.9.1-4",
"author": "Acala Developers <hello@acala.network>",
"license": "Apache-2.0",
"type": "module",
Expand Down Expand Up @@ -45,10 +45,10 @@
"default": "./dist/esm/index.js"
},
"./*": {
"types": "./dist/esm/index.d.ts",
"require": "./dist/cjs/index.js",
"import": "./dist/esm/index.js",
"default": "./dist/esm/index.js"
"types": "./dist/types/*.d.ts",
"require": "./dist/cjs/*.js",
"import": "./dist/esm/*.js",
"default": "./dist/esm/*.js"
},
"./package.json": "./package.json",
"./package.cjs.json": "./dist/cjs/package.json"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Api } from './api'
import { Api } from './api.js'
import { WsProvider } from '@polkadot/rpc-provider'
import { expect, test } from 'vitest'

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types'
import { HexString } from '@polkadot/util/types'
import { ProviderInterface, ProviderInterfaceCallback } from '@polkadot/rpc-provider/types'
import { prefixedChildKey, splitChildKey, stripChildPrefix } from './utils'
import { prefixedChildKey, splitChildKey, stripChildPrefix } from './utils/index.js'

export type ChainProperties = {
ss58Format?: number
Expand Down
Loading