Skip to content

Commit

Permalink
feat: support rpc esm
Browse files Browse the repository at this point in the history
  • Loading branch information
homura committed Nov 16, 2023
1 parent 13b727c commit 7fa4d36
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 17 deletions.
3 changes: 3 additions & 0 deletions devtools/playground/module.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const MODULES = [
"@ckb-lumos/base/blockchain",
"@ckb-lumos/base/since",
"@ckb-lumos/base/utils",
"@ckb-lumos/rpc",
"@ckb-lumos/rpc/types/api",
"@ckb-lumos/rpc/types/rpc",
];

const require = createRequire(import.meta.url);
Expand Down
1 change: 1 addition & 0 deletions devtools/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@ckb-lumos/base": "workspace:*",
"@ckb-lumos/bi": "workspace:*",
"@ckb-lumos/codec": "workspace:*",
"@ckb-lumos/rpc": "workspace:*",
"@ckb-lumos/toolkit": "workspace:*",
"minimatch": "^9.0.3"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/ckb-indexer/src/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import type * as RPCType from "./rpcType";
import { toSearchKey } from "./resultFormatter";
import { unwrapScriptWrapper } from "./ckbIndexerFilter";
import { ResultFormatter } from "@ckb-lumos/rpc";
import { RPC as RpcTypes } from "@ckb-lumos/rpc/lib/types/rpc";
import { CKBComponents } from "@ckb-lumos/rpc/lib/types/api";
import { RPC as RpcTypes } from "@ckb-lumos/rpc/types/rpc";
import { CKBComponents } from "@ckb-lumos/rpc/types/api";

const generateSearchKey = (queries: CKBIndexerQueryOptions): SearchKey => {
let script: RPCType.Script | undefined = undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "./transaction_collector_unit_test_case";
import { SinonStub, stub } from "sinon";
import * as services from "../src/services";
import { CKBComponents } from "@ckb-lumos/rpc/lib/types/api";
import { CKBComponents } from "@ckb-lumos/rpc/types/api";
import { CkbIndexer } from "../src/indexer";
import { bytes } from "@ckb-lumos/codec";

Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ckb-lumos/crypto",
"version": "0.21.0-next.0",
"version": "0.21.0-next.2",
"description": "Crypto library for Lumos",
"author": "",
"homepage": "https://github.com/ckb-js/lumos#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/debugger/src/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CellDep, HexString } from "@ckb-lumos/base";
import { bytify } from "@ckb-lumos/codec/bytes";
import { OutPointVec } from "./codecs";
import { ParamsFormatter } from "@ckb-lumos/rpc";
import { RPC } from "@ckb-lumos/rpc/lib/types/rpc";
import { RPC } from "@ckb-lumos/rpc/types/rpc";

export function parseDebuggerMessage(
message: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/debugger/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TransactionSkeletonType } from "@ckb-lumos/helpers";
import { Hash, Header, HexString, OutPoint } from "@ckb-lumos/base";
import { CKBDebugger } from "./executor";
import { LocaleCode } from "./context";
import type { RPC } from "@ckb-lumos/rpc/lib/types/rpc";
import type { RPC } from "@ckb-lumos/rpc/types/rpc";

export interface ExecuteResult {
code: number;
Expand Down
2 changes: 1 addition & 1 deletion packages/light-client/src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HexString, utils, Header, Block } from "@ckb-lumos/base";
import { CKBComponents } from "@ckb-lumos/rpc/lib/types/api";
import { CKBComponents } from "@ckb-lumos/rpc/types/api";
import { ParamsFormatter } from "@ckb-lumos/rpc";

import {
Expand Down
28 changes: 20 additions & 8 deletions packages/rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,30 @@
"homepage": "https://github.com/ckb-js/lumos#readme",
"license": "MIT",
"main": "lib/index.js",
"module": "./lib.esm/index.js",
"engines": {
"node": ">=12.0.0"
},
"directories": {
"lib": "lib",
"test": "__tests__"
},
"files": [
"lib"
],
"exports": {
".": {
"import": "./lib.esm/index.js",
"require": "./lib/index.js",
"types": "./lib/index.d.ts"
},
"./types/api": {
"import": "./lib.esm/types/api.js",
"require": "./lib/types/api.js",
"types": "./lib/types/api.d.ts"
},
"./types/rpc": {
"import": "./lib.esm/types/rpc.js",
"require": "./lib/types/rpc.js",
"types": "./lib/types/rpc.d.ts"
}
},
"publishConfig": {
"access": "public"
},
Expand All @@ -26,13 +40,11 @@
"url": "https://github.com/ckb-js/lumos/issues"
},
"scripts": {
"doc": "npx typedoc --out docs --mode modules --includeDeclarations --excludeExternals --ignoreCompilerErrors --theme default",
"fmt": "prettier --write \"{src,tests,examples}/**/*.ts\" package.json",
"lint": "eslint -c ../../.eslintrc.js \"{src,tests,examples}/**/*.ts\"",
"test": "npx jest",
"build": "pnpm run build:types && pnpm run build:js",
"build:types": "tsc --declaration --emitDeclarationOnly",
"build:js": "babel --root-mode upward src --out-dir lib --extensions .ts -s",
"build": "npm run build:all",
"build:all": "lumos-build --types --cjs --esm",
"clean": "rm -rf lib"
},
"dependencies": {
Expand Down
7 changes: 5 additions & 2 deletions pnpm-lock.yaml

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

0 comments on commit 7fa4d36

Please sign in to comment.