New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ckb-lumos/rpc

Package Overview
Dependencies
Maintainers
3
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckb-lumos/rpc - npm Package Compare versions

Comparing version 0.19.0-beta.0 to 0.19.0

lib/Base/chain.d.ts.map

1

lib/Base/chain.d.ts

@@ -94,1 +94,2 @@ declare const _default: {

export default _default;
//# sourceMappingURL=chain.d.ts.map

@@ -12,1 +12,2 @@ declare const _default: {

export default _default;
//# sourceMappingURL=experimental.d.ts.map

@@ -271,2 +271,39 @@ import { CKBComponents } from "../types/api";

getBlockchainInfo: () => Promise<CKBComponents.BlockchainInfo>;
/**
* @method getIndexerTip
* @memberof DefaultRPC
* @description rpc to get tip info of the longest blockchain
* @return {Promise<object>} tip info, including block number, block hash
*/
getIndexerTip: () => Promise<CKBComponents.Tip>;
/**
* @method getCells
* @memberof DefaultRPC
* @description rpc to get a cell by script
* @param {object} searchKey
* @param {string} order - order cells by blocknumber "asc" or "desc"
* @param {string} limit - limit the number of cells returned per call
* @param {string} [cursor]
* @return {Promise<object>} CKBComponents.GetLiveCellsResult
*/
getCells: <WithData extends boolean = true>(searchKey: CKBComponents.GetCellsSearchKey<WithData>, order: CKBComponents.Order, limit: CKBComponents.Hash | bigint, cursor?: CKBComponents.Hash256) => Promise<CKBComponents.GetLiveCellsResult<WithData>>;
/**
* @method getTransactions
* @memberof DefaultRPC
* @description rpc to get a transactions by script
* @param {object} searchKey
* @param {string} order - order cells by blocknumber "asc" or "desc"
* @param {string} limit - limit the number of cells returned per call
* @param {string} [cursor]
* @return {Promise<object>} CKBComponents.GetTransactionsResult
*/
getTransactions: <Group extends boolean = false>(searchKey: CKBComponents.GetTransactionsSearchKey<Group>, order: CKBComponents.Order, limit: CKBComponents.Hash | bigint, cursor?: CKBComponents.Hash256) => Promise<CKBComponents.GetTransactionsResult<Group>>;
/**
* @method getCellsCapacity
* @memberof DefaultRPC
* @description rpc to get capacities by script
* @param {object} searchKey
* @return {Promise<object>} CKBComponents.CellsCapacity
*/
getCellsCapacity: (searchKey: CKBComponents.SearchKey) => Promise<CKBComponents.CellsCapacity>;
}

@@ -277,1 +314,2 @@ export declare class Base {

}
//# sourceMappingURL=index.d.ts.map

@@ -18,2 +18,4 @@ "use strict";

var _indexer = _interopRequireDefault(require("./indexer"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -23,2 +25,3 @@

..._experimental.default,
..._indexer.default,
// skip minerRpc

@@ -25,0 +28,0 @@ ..._net.default,

@@ -48,1 +48,2 @@ declare const _default: {

export default _default;
//# sourceMappingURL=net.d.ts.map

@@ -23,1 +23,2 @@ declare const _default: {

export default _default;
//# sourceMappingURL=pool.d.ts.map

@@ -9,1 +9,2 @@ declare const _default: {

export default _default;
//# sourceMappingURL=stats.d.ts.map

@@ -22,1 +22,2 @@ import ErrorCode from "./ErrorCode";

export default _default;
//# sourceMappingURL=batch.d.ts.map

@@ -9,1 +9,2 @@ export declare enum ErrorCode {

export default ErrorCode;
//# sourceMappingURL=ErrorCode.d.ts.map

@@ -35,1 +35,2 @@ import ErrorCode from "./ErrorCode";

export default _default;
//# sourceMappingURL=formatter.d.ts.map
export * from "./formatter";
export * from "./rpc";
export * from "./batch";
//# sourceMappingURL=index.d.ts.map

@@ -14,1 +14,2 @@ import ErrorCode from "./ErrorCode";

export default _default;
//# sourceMappingURL=rpc.d.ts.map

@@ -17,2 +17,3 @@ import { Base } from "./Base";

toDepType: (type: import("@ckb-lumos/base").DepType) => "code" | "dep_group";
toOrder: (order: "asc" | "desc") => "asc" | "desc";
toCellDep: (cellDep: import("@ckb-lumos/base").CellDep) => import("./types/rpc").RPC.CellDep;

@@ -26,2 +27,6 @@ toRawTransaction: (transaction: CKBComponents.RawTransaction) => import("./types/rpc").RPC.RawTransaction;

toTransactionProof: (proof: import("@ckb-lumos/base").TransactionProof) => import("./types/rpc").RPC.TransactionProof;
toSearchFilter: (data: CKBComponents.SearchFilter) => import("./types/rpc").RPC.SearchFilter;
toSearchKey: (data: CKBComponents.SearchKey) => import("./types/rpc").RPC.SearchKey;
toGetCellsSearchKey: (data: CKBComponents.GetCellsSearchKey<boolean>) => import("./types/rpc").RPC.GetCellsSearchKey;
toGetTransactionsSearchKey: (data: CKBComponents.GetTransactionsSearchKey<boolean>) => import("./types/rpc").RPC.GetTransactionsSearchKey;
};

@@ -37,4 +42,5 @@ export declare const ResultFormatter: typeof resultFormatter;

addMethod: (options: CKBComponents.Method, config?: RPCConfig | undefined) => void;
createBatchRequest: <N extends "getTipBlockNumber" | "getTipHeader" | "getCurrentEpoch" | "getEpochByNumber" | "getBlockHash" | "getBlock" | "getHeader" | "getHeaderByNumber" | "getLiveCell" | "getTransaction" | "getCellbaseOutputCapacityDetails" | "getBlockEconomicState" | "getTransactionProof" | "verifyTransactionProof" | "getConsensus" | "getBlockByNumber" | "dryRunTransaction" | "calculateDaoMaximumWithdraw" | "localNodeInfo" | "getPeers" | "getBannedAddresses" | "clearBannedAddresses" | "setBan" | "syncState" | "setNetworkActive" | "addNode" | "removeNode" | "pingPeers" | "sendTransaction" | "txPoolInfo" | "clearTxPool" | "getRawTxPool" | "getBlockchainInfo" | "rpcProperties", P extends (string | number | object)[], R = any[]>(params?: any) => any;
createBatchRequest: <N extends "getTipBlockNumber" | "getTipHeader" | "getCurrentEpoch" | "getEpochByNumber" | "getBlockHash" | "getBlock" | "getHeader" | "getHeaderByNumber" | "getLiveCell" | "getTransaction" | "getCellbaseOutputCapacityDetails" | "getBlockEconomicState" | "getTransactionProof" | "verifyTransactionProof" | "getConsensus" | "getBlockByNumber" | "dryRunTransaction" | "calculateDaoMaximumWithdraw" | "localNodeInfo" | "getPeers" | "getBannedAddresses" | "clearBannedAddresses" | "setBan" | "syncState" | "setNetworkActive" | "addNode" | "removeNode" | "pingPeers" | "sendTransaction" | "txPoolInfo" | "clearTxPool" | "getRawTxPool" | "getBlockchainInfo" | "getIndexerTip" | "getCells" | "getTransactions" | "getCellsCapacity" | "rpcProperties", P extends (string | number | object)[], R = any[]>(params?: any) => any;
}
export { CKBRPC as RPC };
//# sourceMappingURL=index.d.ts.map

@@ -15,1 +15,2 @@ import { CKBComponents } from "./types/api";

}
//# sourceMappingURL=method.d.ts.map

@@ -13,2 +13,3 @@ import { RPC } from "./types/rpc";

toDepType: (type: CKBComponents.DepType) => "code" | "dep_group";
toOrder: (order: CKBComponents.Order) => "asc" | "desc";
toCellDep: (cellDep: CKBComponents.CellDep) => RPC.CellDep;

@@ -22,2 +23,7 @@ toRawTransaction: (transaction: CKBComponents.RawTransaction) => RPC.RawTransaction;

toTransactionProof: (proof: CKBComponents.TransactionProof) => RPC.TransactionProof;
toSearchFilter: (data: CKBComponents.SearchFilter) => RPC.SearchFilter;
toSearchKey: (data: CKBComponents.SearchKey) => RPC.SearchKey;
toGetCellsSearchKey: (data: CKBComponents.GetCellsSearchKey) => RPC.GetCellsSearchKey;
toGetTransactionsSearchKey: (data: CKBComponents.GetTransactionsSearchKey) => RPC.GetTransactionsSearchKey;
};
//# sourceMappingURL=paramsFormatter.d.ts.map

@@ -109,2 +109,5 @@ "use strict";

},
toOrder: order => {
return order;
},
toCellDep: cellDep => {

@@ -184,2 +187,32 @@ if (!cellDep) return cellDep;

};
},
toSearchFilter: data => {
if (!data) return data;
return {
script: data.script ? formatter.toScript(data.script) : data.script,
output_data_len_range: data.outputDataLenRange,
output_capacity_range: data.outputCapacityRange,
block_range: data.blockRange,
script_len_range: data.scriptLenRange
};
},
toSearchKey: data => {
if (!data) return data;
return {
script: formatter.toScript(data.script),
script_type: data.scriptType,
filter: data.filter ? formatter.toSearchFilter(data.filter) : data.filter
};
},
toGetCellsSearchKey: data => {
if (!data) return data;
return { ...formatter.toSearchKey(data),
with_data: data.withData
};
},
toGetTransactionsSearchKey: data => {
if (!data) return data;
return { ...formatter.toSearchKey(data),
group_by_transaction: data.groupByTransaction
};
}

@@ -186,0 +219,0 @@ };

@@ -15,2 +15,3 @@ import { CKBComponents } from "./types/api";

declare const toUncleBlock: (uncleBlock: RPC.UncleBlock) => CKBComponents.UncleBlock;
declare const toTip: (tip: RPC.Tip) => CKBComponents.Tip;
declare const toBlock: (block: RPC.Block) => CKBComponents.Block;

@@ -65,2 +66,6 @@ declare const toAlertMessage: (alertMessage: RPC.AlertMessage) => CKBComponents.AlertMessage;

declare const toRawTxPool: (rawTxPool: RPC.RawTxPool) => CKBComponents.RawTxPool;
export { toNumber, toHash, toHeader, toScript, toInput, toOutput, toOutPoint, toDepType, toCellDep, toTransaction, toUncleBlock, toBlock, toAlertMessage, toBlockchainInfo, toLocalNodeInfo, toRemoteNodeInfo, toTxPoolInfo, toPeers, toLiveCell, toLiveCellWithStatus, toCell, toCells, toCellIncludingOutPoint, toCellsIncludingOutPoint, toTransactionWithStatus, toEpoch, toTransactionPoint, toTransactionsByLockHash, toLiveCellsByLockHash, toLockHashIndexState, toLockHashIndexStates, toBannedAddress, toBannedAddresses, toCellbaseOutputCapacityDetails, toFeeRate, toCapacityByLockHash, toBlockEconomicState, toSyncState, toTransactionProof, toConsensus, toRawTxPool, };
declare const toGetCellsResult: (getCellsResult: RPC.GetLiveCellsResult) => CKBComponents.GetLiveCellsResult;
declare const toGetTransactionsResult: <Goruped extends boolean = false>(getTransactionsResult: RPC.GetTransactionsResult<Goruped>) => CKBComponents.GetTransactionsResult<Goruped>;
declare const toCellsCapacity: (cellsCapacity: RPC.CellsCapacity) => CKBComponents.CellsCapacity;
export { toNumber, toHash, toHeader, toScript, toInput, toOutput, toOutPoint, toDepType, toCellDep, toTransaction, toUncleBlock, toBlock, toTip, toAlertMessage, toBlockchainInfo, toLocalNodeInfo, toRemoteNodeInfo, toTxPoolInfo, toPeers, toLiveCell, toLiveCellWithStatus, toCell, toCells, toCellIncludingOutPoint, toCellsIncludingOutPoint, toTransactionWithStatus, toEpoch, toTransactionPoint, toTransactionsByLockHash, toLiveCellsByLockHash, toLockHashIndexState, toLockHashIndexStates, toBannedAddress, toBannedAddresses, toCellbaseOutputCapacityDetails, toFeeRate, toCapacityByLockHash, toBlockEconomicState, toSyncState, toTransactionProof, toConsensus, toRawTxPool, toCellsCapacity, toGetCellsResult, toGetTransactionsResult, };
//# sourceMappingURL=resultFormatter.d.ts.map

@@ -6,3 +6,3 @@ "use strict";

});
exports.toSyncState = exports.toScript = exports.toRemoteNodeInfo = exports.toRawTxPool = exports.toPeers = exports.toOutput = exports.toOutPoint = exports.toNumber = exports.toLockHashIndexStates = exports.toLockHashIndexState = exports.toLocalNodeInfo = exports.toLiveCellsByLockHash = exports.toLiveCellWithStatus = exports.toLiveCell = exports.toInput = exports.toHeader = exports.toHash = exports.toFeeRate = exports.toEpoch = exports.toDepType = exports.toConsensus = exports.toCellsIncludingOutPoint = exports.toCells = exports.toCellbaseOutputCapacityDetails = exports.toCellIncludingOutPoint = exports.toCellDep = exports.toCell = exports.toCapacityByLockHash = exports.toBlockchainInfo = exports.toBlockEconomicState = exports.toBlock = exports.toBannedAddresses = exports.toBannedAddress = exports.toAlertMessage = void 0;
exports.toTip = exports.toSyncState = exports.toScript = exports.toRemoteNodeInfo = exports.toRawTxPool = exports.toPeers = exports.toOutput = exports.toOutPoint = exports.toNumber = exports.toLockHashIndexStates = exports.toLockHashIndexState = exports.toLocalNodeInfo = exports.toLiveCellsByLockHash = exports.toLiveCellWithStatus = exports.toLiveCell = exports.toInput = exports.toHeader = exports.toHash = exports.toGetTransactionsResult = exports.toGetCellsResult = exports.toFeeRate = exports.toEpoch = exports.toDepType = exports.toConsensus = exports.toCellsIncludingOutPoint = exports.toCellsCapacity = exports.toCells = exports.toCellbaseOutputCapacityDetails = exports.toCellIncludingOutPoint = exports.toCellDep = exports.toCell = exports.toCapacityByLockHash = exports.toBlockchainInfo = exports.toBlockEconomicState = exports.toBlock = exports.toBannedAddresses = exports.toBannedAddress = exports.toAlertMessage = void 0;
exports.toTransaction = toTransaction;

@@ -166,2 +166,9 @@ exports.toUncleBlock = exports.toTxPoolInfo = exports.toTransactionsByLockHash = exports.toTransactionWithStatus = exports.toTransactionProof = exports.toTransactionPoint = void 0;

const toTip = tip => ({
blockHash: tip.block_hash,
blockNumber: tip.block_number
});
exports.toTip = toTip;
const toBlock = block => {

@@ -694,6 +701,74 @@ if (!block) return block;

};
exports.toRawTxPool = toRawTxPool;
const toIndexerCell = indexerCell => {
if (!indexerCell) return indexerCell;
return {
blockNumber: indexerCell.block_number,
outPoint: toOutPoint(indexerCell.out_point),
output: toOutput(indexerCell.output),
outputData: indexerCell.output_data,
txIndex: indexerCell.tx_index
};
};
const toGetCellsResult = getCellsResult => ({
lastCursor: getCellsResult.last_cursor,
objects: getCellsResult.objects.map(object => toIndexerCell(object))
});
exports.toGetCellsResult = toGetCellsResult;
const isUngroupedIndexerTransaction = value => {
if (value.cells) {
return false;
}
return true;
};
const toIndexerTransaction = indexerTransaction => {
if (!indexerTransaction) return indexerTransaction;
if (isUngroupedIndexerTransaction(indexerTransaction)) {
return {
txHash: indexerTransaction.tx_hash,
blockNumber: indexerTransaction.block_number,
ioIndex: indexerTransaction.io_index,
ioType: indexerTransaction.io_type,
txIndex: indexerTransaction.tx_index
};
}
return {
txHash: indexerTransaction.tx_hash,
txIndex: indexerTransaction.tx_index,
blockNumber: indexerTransaction.block_number,
cells: indexerTransaction.cells
};
};
const toGetTransactionsResult = getTransactionsResult => {
if (!getTransactionsResult) return getTransactionsResult;
return {
lastCursor: getTransactionsResult.last_cursor,
objects: getTransactionsResult.objects.map(object => toIndexerTransaction(object))
};
};
exports.toGetTransactionsResult = toGetTransactionsResult;
const toCellsCapacity = cellsCapacity => {
if (!cellsCapacity) return cellsCapacity;
return {
capacity: cellsCapacity.capacity,
blockHash: cellsCapacity.block_hash,
blockNumber: cellsCapacity.block_number
};
};
/* eslint-enable camelcase */
exports.toRawTxPool = toRawTxPool;
exports.toCellsCapacity = toCellsCapacity;
//# sourceMappingURL=resultFormatter.js.map

@@ -88,2 +88,3 @@ import type * as api from "@ckb-lumos/base";

type Consensus = api.Consensus;
type QueryOptions = api.QueryOptions;
interface TransactionPoint {

@@ -154,2 +155,82 @@ blockNumber: BlockNumber;

type TxPoolIds = Record<"pending" | "proposed", Array<Hash256>>;
interface Tip {
blockNumber: BlockNumber;
blockHash: Hash256;
}
type ScriptType = "type" | "lock";
type Order = "asc" | "desc";
type IOType = "input" | "output" | "both";
interface IndexerCell {
blockNumber: BlockNumber;
outPoint: OutPoint;
output: {
capacity: Capacity;
lock: Script;
type?: Script;
};
outputData: string;
txIndex: string;
}
interface IndexerCellWithoutData extends Omit<IndexerCell, "outputData"> {
outputData: null;
}
interface GetCellsResult<WithData extends boolean = true> {
lastCursor: string;
objects: WithData extends true ? IndexerCell[] : IndexerCellWithoutData[];
}
type IndexerTransaction<Goruped extends boolean = false> = Goruped extends true ? GroupedIndexerTransaction : UngroupedIndexerTransaction;
type UngroupedIndexerTransaction = {
txHash: Hash256;
blockNumber: BlockNumber;
ioIndex: Number;
ioType: IOType;
txIndex: Number;
};
type GroupedIndexerTransaction = {
txHash: Hash256;
blockNumber: BlockNumber;
txIndex: Number;
cells: Array<[IOType, Number]>;
};
interface GetTransactionsResult<Goruped extends boolean = false> {
lastCursor: Hash256;
objects: IndexerTransaction<Goruped>[];
}
interface CKBIndexerQueryOptions extends QueryOptions {
outputDataLenRange?: HexadecimalRange;
outputCapacityRange?: HexadecimalRange;
scriptLenRange?: HexadecimalRange;
bufferSize?: number;
withData?: boolean;
groupByTransaction?: boolean;
}
type HexadecimalRange = [string, string];
interface SearchFilter {
script?: Script;
scriptLenRange?: HexadecimalRange;
outputDataLenRange?: HexadecimalRange;
outputCapacityRange?: HexadecimalRange;
blockRange?: HexadecimalRange;
}
interface SearchKey {
script: Script;
scriptType: ScriptType;
filter?: SearchFilter;
}
interface GetLiveCellsResult<WithData extends boolean = true> {
lastCursor: string;
objects: WithData extends true ? IndexerCell[] : IndexerCellWithoutData[];
}
interface GetCellsSearchKey<WithData extends boolean = boolean> extends SearchKey {
withData?: WithData;
}
interface GetTransactionsSearchKey<Group extends boolean = boolean> extends SearchKey {
groupByTransaction?: Group;
}
interface CellsCapacity {
capacity: Capacity;
blockHash: Hash256;
blockNumber: BlockNumber;
}
}
//# sourceMappingURL=api.d.ts.map
export declare type RPCConfig = {
timeout: number;
};
//# sourceMappingURL=common.d.ts.map

@@ -29,2 +29,3 @@ /**

type JsonBytes = CKBComponents.JsonBytes;
type IOType = CKBComponents.IOType;
enum TransactionStatus {

@@ -296,2 +297,61 @@ Pending = "pending",

}
interface Tip {
block_hash: Hash256;
block_number: BlockNumber;
}
interface IndexerCell {
block_number: BlockNumber;
out_point: OutPoint;
output: CellOutput;
output_data: string;
tx_index: string;
}
type IndexerTransaction<Goruped extends boolean = false> = Goruped extends true ? GroupedIndexerTransaction : UngroupedIndexerTransaction;
interface UngroupedIndexerTransaction {
tx_hash: Hash256;
block_number: BlockNumber;
io_index: string;
io_type: IOType;
tx_index: string;
}
interface GroupedIndexerTransaction {
tx_hash: Hash256;
block_number: BlockNumber;
tx_index: string;
cells: Array<[IOType, string]>;
}
interface GetTransactionsResult<Goruped extends boolean = false> {
last_cursor: Hash256;
objects: IndexerTransaction<Goruped>[];
}
interface GetLiveCellsResult {
last_cursor: Hash256;
objects: IndexerCell[];
}
interface CellsCapacity {
capacity: Capacity;
block_hash: Hash256;
block_number: BlockNumber;
}
type HexadecimalRange = [string, string];
type ScriptType = "type" | "lock";
interface SearchFilter {
script?: Script;
output_data_len_range?: HexadecimalRange;
output_capacity_range?: HexadecimalRange;
block_range?: HexadecimalRange;
script_len_range?: HexadecimalRange;
}
interface SearchKey {
script: Script;
script_type: ScriptType;
filter?: SearchFilter;
}
interface GetCellsSearchKey extends SearchKey {
with_data?: boolean;
}
interface GetTransactionsSearchKey extends SearchKey {
group_by_transaction?: boolean;
}
}
//# sourceMappingURL=rpc.d.ts.map

8

package.json
{
"name": "@ckb-lumos/rpc",
"version": "0.19.0-beta.0",
"version": "0.19.0",
"description": "RPC module for CKB",

@@ -41,4 +41,4 @@ "homepage": "https://github.com/ckb-js/lumos#readme",

"dependencies": {
"@ckb-lumos/base": "^0.19.0-beta.0",
"@ckb-lumos/bi": "^0.19.0-beta.0",
"@ckb-lumos/base": "^0.19.0",
"@ckb-lumos/bi": "^0.19.0",
"axios": "0.21.4",

@@ -53,3 +53,3 @@ "tslib": "2.3.1"

},
"gitHead": "6f7065672f047445f109385a8bf56fe42d8d5f91"
"gitHead": "ce18d6d2b15793e61e0e35072aa65ebe4aea5b55"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc