Skip to content

Commit

Permalink
Merge pull request #234 from liubq7/ckb-js-toolkit
Browse files Browse the repository at this point in the history
Integrate ckb-js-toolkit into lumos
  • Loading branch information
homura authored Jan 18, 2022
2 parents 684e906 + a3e316d commit 0770773
Show file tree
Hide file tree
Showing 56 changed files with 5,741 additions and 85 deletions.
2 changes: 1 addition & 1 deletion packages/base/lib/denormalizers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Reader } = require("ckb-js-toolkit");
const { Reader } = require("@ckb-lumos/toolkit");

function DenormalizeOutPoint(outPoint) {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/base/lib/indexer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { validators } = require("ckb-js-toolkit");
const { validators } = require("@ckb-lumos/toolkit");
const utils = require("./utils");

// Notice this TransactionCollector implementation only uses indexer
Expand Down
2 changes: 1 addition & 1 deletion packages/base/lib/utils.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Reader } from "ckb-js-toolkit";
import { Reader } from "@ckb-lumos/toolkit";
import { HexNumber } from "..";
import { Script, Input } from "./api";
import { Hash, HexString } from "./primitive";
Expand Down
2 changes: 1 addition & 1 deletion packages/base/lib/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const blake2b = require("blake2b");
const { validators, normalizers, Reader } = require("ckb-js-toolkit");
const { validators, normalizers, Reader } = require("@ckb-lumos/toolkit");
const { SerializeScript, SerializeCellInput } = require("./core");
const { xxHash32 } = require("js-xxhash");

Expand Down
2 changes: 1 addition & 1 deletion packages/base/lib/values.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This module provides a ValueObject implementation for CKB related data
// structures to allow seamless immutable.js integration.
const { validators, normalizers, Reader } = require("ckb-js-toolkit");
const { validators, normalizers, Reader } = require("@ckb-lumos/toolkit");
const { xxHash32 } = require("js-xxhash");
const core = require("./core");
const { ckbHash } = require("./utils");
Expand Down
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"dependencies": {
"blake2b": "^2.1.3",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc6",
"js-xxhash": "^1.0.4"
}
}
2 changes: 1 addition & 1 deletion packages/base/tests/denormalizers.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require("ava");
const { normalizers } = require("ckb-js-toolkit");
const { normalizers } = require("@ckb-lumos/toolkit");

const core = require("../lib/core");
const denormalizers = require("../lib/denormalizers");
Expand Down
2 changes: 1 addition & 1 deletion packages/base/tests/utils.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const test = require("ava");
const { Reader } = require("ckb-js-toolkit");
const { Reader } = require("@ckb-lumos/toolkit");

const {
CKBHasher,
Expand Down
2 changes: 1 addition & 1 deletion packages/ckb-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@ckb-lumos/base": "^0.17.0-rc7",
"@ckb-lumos/rpc": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc7",
"cross-fetch": "^3.1.4",
"events": "^3.3.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ckb-indexer/src/collector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { utils, Cell, BaseCellCollector } from "@ckb-lumos/base";
import { validators } from "ckb-js-toolkit";
import { validators } from "@ckb-lumos/toolkit";
import {
SearchKeyFilter,
CKBIndexerQueryOptions,
Expand Down
2 changes: 1 addition & 1 deletion packages/ckb-indexer/src/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
utils,
Block,
} from "@ckb-lumos/base";
import { validators } from "ckb-js-toolkit";
import { validators } from "@ckb-lumos/toolkit";
import { RPC } from "@ckb-lumos/rpc";
import { request, requestBatch } from "./services";
import { CKBCellCollector } from "./collector";
Expand Down
2 changes: 1 addition & 1 deletion packages/ckb-indexer/src/rpc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RPC as ToolkitRPC } from "ckb-js-toolkit";
import { RPC as ToolkitRPC } from "@ckb-lumos/toolkit";
import { HexString, Tip } from "@ckb-lumos/base";
import {
GetCellsResults,
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/examples/pw_lock/lock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
createTransactionFromSkeleton,
} from "@ckb-lumos/helpers";
import { getConfig, Config, initializeConfig } from "@ckb-lumos/config-manager";
import { Reader, normalizers } from "ckb-js-toolkit";
import { Reader, normalizers } from "@ckb-lumos/toolkit";
import { Set } from "immutable";
import keccak, { Keccak } from "keccak";

Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@ckb-lumos/config-manager": "^0.17.0-rc7",
"@ckb-lumos/helpers": "^0.17.0-rc7",
"@ckb-lumos/rpc": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc7",
"immutable": "^4.0.0-rc.12"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/anyone_can_pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
parseAddress,
TransactionSkeletonType,
} from "@ckb-lumos/helpers";
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import { List, Set } from "immutable";
import { FromInfo, parseFromInfo } from "./from_info";
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import anyoneCanPay from "./anyone_can_pay";
const { ScriptValue } = values;
import { Set } from "immutable";
import { SerializeTransaction } from "@ckb-lumos/base/lib/core";
import { normalizers } from "ckb-js-toolkit";
import { normalizers } from "@ckb-lumos/toolkit";
import { isAcpScript } from "./helper";

function defaultLogger(level: string, message: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/dao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { getConfig, Config } from "@ckb-lumos/config-manager";
const { toBigUInt64LE, readBigUInt64LE } = utils;
const { parseSince } = sinceUtils;
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import secp256k1Blake160 from "./secp256k1_blake160";
import secp256k1Blake160Multisig from "./secp256k1_blake160_multisig";
import { FromInfo, parseFromInfo } from "./from_info";
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
createTransactionFromSkeleton,
parseAddress,
} from "@ckb-lumos/helpers";
import { Reader, normalizers } from "ckb-js-toolkit";
import { Reader, normalizers } from "@ckb-lumos/toolkit";
import { RPC } from "@ckb-lumos/rpc";
import { Set } from "immutable";
import { FromInfo, parseFromInfo, MultisigScript } from "./from_info";
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
HexString,
} from "@ckb-lumos/base";
const { CKBHasher, ckbHash } = utils;
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import { Config } from "@ckb-lumos/config-manager";

export function addCellDep(
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/locktime_pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
} from "@ckb-lumos/base";
const { toBigUInt64LE, readBigUInt64LE } = utils;
const { ScriptValue } = values;
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import {
generateDaoScript,
isSecp256k1Blake160MultisigScript,
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/secp256k1_blake160.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Set } from "immutable";
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import { parseAddress, minimalCellCapacity } from "@ckb-lumos/helpers";
import {
core,
Expand Down
2 changes: 1 addition & 1 deletion packages/common-scripts/src/secp256k1_blake160_multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "@ckb-lumos/base";
import { getConfig, Config } from "@ckb-lumos/config-manager";
const { ScriptValue } = values;
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";
import { Set } from "immutable";
import {
addCellDep,
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"@ckb-lumos/bi": "^0.17.0-rc7",
"@ckb-lumos/config-manager": "^0.17.0-rc7",
"bech32": "^1.1.4",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc6",
"immutable": "^4.0.0-rc.12"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
WitnessArgs,
} from "@ckb-lumos/base";
import * as bech32 from "bech32";
import { normalizers, validators, Reader } from "ckb-js-toolkit";
import { normalizers, validators, Reader } from "@ckb-lumos/toolkit";
import { List, Record, Map as ImmutableMap } from "immutable";
import { getConfig, Config } from "@ckb-lumos/config-manager";

Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { validators, normalizers, Reader, RPC } = require("ckb-js-toolkit");
const { validators, normalizers, Reader, RPC } = require("@ckb-lumos/toolkit");
const { OrderedSet, Map } = require("immutable");
const XXHash = require("xxhash");
const { Indexer: NativeIndexer, Emitter, BlockEmitter } = require("../native");
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
],
"dependencies": {
"@ckb-lumos/base": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.9.2",
"@ckb-lumos/toolkit": "^0.17.0-rc7",
"neon-cli": "^0.4.0",
"node-pre-gyp": "^0.14.0",
"request": "^2.88.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/lumos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@ckb-lumos/hd": "^0.17.0-rc7",
"@ckb-lumos/helpers": "^0.17.0-rc7",
"@ckb-lumos/rpc": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.10.2"
"@ckb-lumos/toolkit": "^0.17.0-rc7"
},
"devDependencies": {
"buffer": "^6.0.3",
Expand Down
7 changes: 6 additions & 1 deletion packages/lumos/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { Reader, validators, normalizers, transformers } from "ckb-js-toolkit";
import {
Reader,
validators,
normalizers,
transformers,
} from "@ckb-lumos/toolkit";

export const toolkit = { Reader, validators, normalizers, transformers };

Expand Down
2 changes: 1 addition & 1 deletion packages/rpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"dependencies": {
"@ckb-lumos/base": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.10.2"
"@ckb-lumos/toolkit": "^0.17.0-rc7"
},
"ava": {
"extensions": [
Expand Down
2 changes: 1 addition & 1 deletion packages/rpc/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RPC as ToolkitRPC } from "ckb-js-toolkit";
import { RPC as ToolkitRPC } from "@ckb-lumos/toolkit";
import {
Alert,
BannedAddr,
Expand Down
2 changes: 1 addition & 1 deletion packages/sql-indexer/lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { RPC, Reader, validators } = require("ckb-js-toolkit");
const { RPC, Reader, validators } = require("@ckb-lumos/toolkit");
const { EventEmitter } = require("events");
const { utils, indexer: BaseIndexerModule } = require("@ckb-lumos/base");
const SCRIPT_TYPE_LOCK = 0;
Expand Down
2 changes: 1 addition & 1 deletion packages/sql-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"dependencies": {
"@ckb-lumos/base": "^0.17.0-rc7",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc7",
"knex": "^0.21.1"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/testkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@types/body-parser": "^1.19.1",
"@types/express": "^4.17.13",
"body-parser": "^1.19.0",
"ckb-js-toolkit": "^0.10.2",
"@ckb-lumos/toolkit": "^0.17.0-rc6",
"express": "^4.17.1",
"json-rpc-2.0": "^0.2.19",
"ts-node": "^10.4.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/testkit/src/mock-ckb-jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { JSONRPCResponse, JSONRPCServer } from "json-rpc-2.0";
import express, { Express } from "express";
import bodyParser from "body-parser";
import { LocalNode, Block, core } from "@ckb-lumos/base";
import { normalizers, Reader } from "ckb-js-toolkit";
import { normalizers, Reader } from "@ckb-lumos/toolkit";

interface Options {
blocks: Block[];
Expand Down
4 changes: 4 additions & 0 deletions packages/toolkit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
build/
lib/
dist/
Loading

0 comments on commit 0770773

Please sign in to comment.