@ckb-lumos/rpc
Advanced tools
Comparing version 0.0.0-canary-54f8aff-20230815035108 to 0.0.0-canary-58ff5e4-20240712061301
@@ -0,1 +1,2 @@ | ||
import * as resultFmts from "../resultFormatter"; | ||
declare const _default: { | ||
@@ -10,3 +11,3 @@ getTipBlockNumber: { | ||
paramsFormatters: never[]; | ||
resultFormatters: (header: import("../types/rpc").RPC.Header) => import("@ckb-lumos/base").Header; | ||
resultFormatters: typeof resultFmts.toHeader; | ||
}; | ||
@@ -30,3 +31,3 @@ getCurrentEpoch: { | ||
paramsFormatters: ((hash: string) => string)[]; | ||
resultFormatters: (block: import("../types/rpc").RPC.Block) => import("@ckb-lumos/base").Block; | ||
resultFormatters: typeof resultFmts.toBlock; | ||
}; | ||
@@ -36,3 +37,3 @@ getBlockByNumber: { | ||
paramsFormatters: ((number: string | bigint) => string)[]; | ||
resultFormatters: (block: import("../types/rpc").RPC.Block) => import("@ckb-lumos/base").Block; | ||
resultFormatters: typeof resultFmts.toBlock; | ||
}; | ||
@@ -42,3 +43,3 @@ getHeader: { | ||
paramsFormatters: ((hash: string) => string)[]; | ||
resultFormatters: (header: import("../types/rpc").RPC.Header) => import("@ckb-lumos/base").Header; | ||
resultFormatters: typeof resultFmts.toHeader; | ||
}; | ||
@@ -48,3 +49,3 @@ getHeaderByNumber: { | ||
paramsFormatters: ((number: string | bigint) => string)[]; | ||
resultFormatters: (header: import("../types/rpc").RPC.Header) => import("@ckb-lumos/base").Header; | ||
resultFormatters: typeof resultFmts.toHeader; | ||
}; | ||
@@ -65,9 +66,3 @@ getLiveCell: { | ||
paramsFormatters: ((hash: string) => string)[]; | ||
resultFormatters: (txWithStatus: import("../types/rpc").RPC.TransactionWithStatus) => { | ||
transaction: import("../types/api").CKBComponents.RawTransaction; | ||
txStatus: { | ||
blockHash: string | undefined; | ||
status: import("../types/rpc").RPC.TransactionStatus; | ||
}; | ||
}; | ||
resultFormatters: <Tx>(txWithStatus: import("../types/rpc").RPC.TransactionWithStatus) => import("../types/api").CKBComponents.TransactionWithStatus<Tx>; | ||
}; | ||
@@ -74,0 +69,0 @@ getCellbaseOutputCapacityDetails: { |
@@ -9,5 +9,5 @@ "use strict"; | ||
var resultFmts = _interopRequireWildcard(require("../resultFormatter")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = { | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var _default = exports.default = { | ||
getTipBlockNumber: { | ||
@@ -92,3 +92,2 @@ method: "get_tip_block_number", | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=chain.js.map |
@@ -8,3 +8,3 @@ "use strict"; | ||
var _paramsFormatter = require("../paramsFormatter"); | ||
var _default = { | ||
var _default = exports.default = { | ||
dryRunTransaction: { | ||
@@ -25,3 +25,2 @@ method: "dry_run_transaction", | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=experimental.js.map |
@@ -6,2 +6,24 @@ import { CKBComponents } from "../types/api"; | ||
export declare const rpcProperties: RpcPropertes; | ||
interface GetBlock<Q> { | ||
(query: Q, verbosity?: '0x2', withCycle?: false): Promise<CKBComponents.BlockView>; | ||
(query: Q, verbosity: '0x0', withCycle?: false): Promise<string>; | ||
(query: Q, verbosity: '0x0', withCycle: true): Promise<{ | ||
block: string; | ||
cycles: CKBComponents.UInt64; | ||
}>; | ||
(query: Q, verbosity: '0x2', withCycle: true): Promise<{ | ||
block: CKBComponents.BlockView; | ||
cycles: CKBComponents.UInt64; | ||
}>; | ||
} | ||
export interface GetTransaction { | ||
(hash: CKBComponents.Hash): Promise<CKBComponents.TransactionWithStatus>; | ||
(hash: CKBComponents.Hash, verbosity: "0x0", onlyCommitted?: boolean): Promise<CKBComponents.TransactionWithStatus<string>>; | ||
(hash: CKBComponents.Hash, verbosity: "0x1", onlyCommitted?: boolean): Promise<CKBComponents.TransactionWithStatus<null>>; | ||
(hash: CKBComponents.Hash, verbosity: "0x2", onlyCommitted?: boolean): Promise<CKBComponents.TransactionWithStatus>; | ||
} | ||
export interface GetHeader<Q> { | ||
(query: Q, verbosity?: "0x1"): Promise<CKBComponents.BlockHeader>; | ||
(query: Q, verbosity: "0x0"): Promise<string>; | ||
} | ||
export interface Base { | ||
@@ -49,6 +71,8 @@ /** | ||
* @description rpc to get block by its hash | ||
* @param {string} hash - the block hash of the target block | ||
* @returns {Promise<object>} block object | ||
* @param {string} hash | ||
* @param {string} verbosity | ||
* @param {boolean} withCycle | ||
* @return {Promise<GetBlock | null>} | ||
*/ | ||
getBlock: (hash: CKBComponents.Hash) => Promise<CKBComponents.Block>; | ||
getBlock: GetBlock<CKBComponents.Hash>; | ||
/** | ||
@@ -60,3 +84,3 @@ * @method getHeader | ||
*/ | ||
getHeader: (blockHash: CKBComponents.Hash) => Promise<CKBComponents.BlockHeader>; | ||
getHeader: GetHeader<CKBComponents.Hash>; | ||
/** | ||
@@ -68,3 +92,3 @@ * @method getHeaderByNumber | ||
*/ | ||
getHeaderByNumber: (blockNumber: CKBComponents.BlockNumber | bigint) => Promise<CKBComponents.BlockHeader>; | ||
getHeaderByNumber: GetHeader<CKBComponents.BlockNumber | bigint>; | ||
/** | ||
@@ -80,3 +104,3 @@ * @method getLiveCell | ||
getLiveCell: (outPoint: CKBComponents.OutPoint, withData: boolean) => Promise<{ | ||
cell: CKBComponents.LiveCell; | ||
cell: Option<CKBComponents.LiveCell>; | ||
status: CKBComponents.CellStatus; | ||
@@ -91,3 +115,3 @@ }>; | ||
*/ | ||
getTransaction: (hash: CKBComponents.Hash) => Promise<CKBComponents.TransactionWithStatus>; | ||
getTransaction: GetTransaction; | ||
/** | ||
@@ -137,7 +161,9 @@ * @method getCellbaseOutputCapacityDetails | ||
* @memberof DefaultRPC | ||
* @description rpc to get block by its number | ||
* @param {string} number - the block number of the target block | ||
* @returns {Promise<object>} block object | ||
* @description rpc to get block by its hash | ||
* @param {CKBComponents.BlockNumber | bigint} number | ||
* @param {string} verbosity | ||
* @param {boolean} withCycle | ||
* @return {Promise<GetBlock | null>} | ||
*/ | ||
getBlockByNumber: (number: CKBComponents.BlockNumber | bigint) => Promise<CKBComponents.Block>; | ||
getBlockByNumber: GetBlock<CKBComponents.BlockNumber | bigint>; | ||
/** | ||
@@ -377,3 +403,4 @@ * @method dryRunTransaction | ||
*/ | ||
getFeeRateStatistics: () => Promise<CKBComponents.FeeRateStatistics>; | ||
getFeeRateStatistics: (target?: CKBComponents.UInt64) => Promise<CKBComponents.FeeRateStatistics>; | ||
getDeploymentsInfo: () => Promise<CKBComponents.DeploymentsInfo>; | ||
} | ||
@@ -384,2 +411,4 @@ export declare class Base { | ||
} | ||
export type Option<T> = T | null; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -14,8 +14,3 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } | ||
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } | ||
const rpcProperties = { | ||
const rpcProperties = exports.rpcProperties = { | ||
..._chain.default, | ||
@@ -30,13 +25,13 @@ ..._experimental.default, | ||
}; | ||
exports.rpcProperties = rpcProperties; | ||
var _rpcProperties = /*#__PURE__*/new WeakMap(); | ||
// prettier-ignore | ||
// prettier-ignore | ||
// prettier-ignore | ||
class Base { | ||
constructor() { | ||
_classPrivateFieldInitSpec(this, _rpcProperties, { | ||
writable: true, | ||
value: rpcProperties | ||
}); | ||
} | ||
#rpcProperties = rpcProperties; | ||
get rpcProperties() { | ||
return _classPrivateFieldGet(this, _rpcProperties); | ||
return this.#rpcProperties; | ||
} | ||
@@ -43,0 +38,0 @@ } |
@@ -9,4 +9,4 @@ "use strict"; | ||
var resultFmts = _interopRequireWildcard(require("../resultFormatter")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -76,4 +76,3 @@ | ||
}; | ||
var _default = schemas; | ||
exports.default = _default; | ||
var _default = exports.default = schemas; | ||
//# sourceMappingURL=indexer.js.map |
@@ -9,5 +9,5 @@ "use strict"; | ||
var resultFmts = _interopRequireWildcard(require("../resultFormatter")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = { | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var _default = exports.default = { | ||
localNodeInfo: { | ||
@@ -58,3 +58,2 @@ method: "local_node_info", | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=net.js.map |
@@ -9,5 +9,5 @@ "use strict"; | ||
var resultFmts = _interopRequireWildcard(require("../resultFormatter")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = { | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var _default = exports.default = { | ||
sendTransaction: { | ||
@@ -33,3 +33,2 @@ method: "send_transaction", | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=pool.js.map |
@@ -5,6 +5,11 @@ declare const _default: { | ||
paramsFormatters: never[]; | ||
resultFormatters: (info: import("../types/rpc").RPC.BlockchainInfo) => import("@ckb-lumos/base").ChainInfo; | ||
resultFormatters: (info: import("../types/rpc").RPC.ChainInfo) => import("@ckb-lumos/base").ChainInfo; | ||
}; | ||
getDeploymentsInfo: { | ||
method: string; | ||
paramsFormatters: never[]; | ||
resultFormatters: (deploymentInfo: import("../types/rpc").RPC.DeploymentsInfo) => import("@ckb-lumos/base").DeploymentsInfo; | ||
}; | ||
}; | ||
export default _default; | ||
//# sourceMappingURL=stats.d.ts.map |
@@ -8,5 +8,5 @@ "use strict"; | ||
var resultFmts = _interopRequireWildcard(require("../resultFormatter")); | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
var _default = { | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
var _default = exports.default = { | ||
getBlockchainInfo: { | ||
@@ -16,5 +16,9 @@ method: "get_blockchain_info", | ||
resultFormatters: resultFmts.toBlockchainInfo | ||
}, | ||
getDeploymentsInfo: { | ||
method: "get_deployments_info", | ||
paramsFormatters: [], | ||
resultFormatters: resultFmts.toDeploymentsInfo | ||
} | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=stats.js.map |
@@ -10,10 +10,7 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
const ERROR_LABEL = "Batch Request"; | ||
class MethodInBatchNotFoundException extends Error { | ||
code = _ErrorCode.default.MethodNotFound; | ||
constructor(name) { | ||
super(`[${ERROR_LABEL}]: Method ${name} is not found`); | ||
_defineProperty(this, "code", _ErrorCode.default.MethodNotFound); | ||
} | ||
@@ -23,5 +20,5 @@ } | ||
class PayloadInBatchException extends Error { | ||
code = _ErrorCode.default.PayloadMessage; | ||
constructor(index, message) { | ||
super(`[${ERROR_LABEL} ${index}]: ${message}`); | ||
_defineProperty(this, "code", _ErrorCode.default.PayloadMessage); | ||
this.index = index; | ||
@@ -39,3 +36,3 @@ } | ||
exports.IdNotMatchedInBatchException = IdNotMatchedInBatchException; | ||
var _default = { | ||
var _default = exports.default = { | ||
MethodInBatchNotFoundException, | ||
@@ -45,3 +42,2 @@ PayloadInBatchException, | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=batch.js.map |
@@ -7,3 +7,3 @@ "use strict"; | ||
exports.default = exports.ErrorCode = void 0; | ||
let ErrorCode = /*#__PURE__*/function (ErrorCode) { | ||
let ErrorCode = exports.ErrorCode = /*#__PURE__*/function (ErrorCode) { | ||
ErrorCode[ErrorCode["ParameterInvalid"] = 101] = "ParameterInvalid"; | ||
@@ -16,5 +16,3 @@ ErrorCode[ErrorCode["IdNotMatch"] = 201] = "IdNotMatch"; | ||
}({}); | ||
exports.ErrorCode = ErrorCode; | ||
var _default = ErrorCode; | ||
exports.default = _default; | ||
var _default = exports.default = ErrorCode; | ||
//# sourceMappingURL=ErrorCode.js.map |
@@ -9,9 +9,8 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } // eslint-disable-next-line import/no-named-as-default | ||
// eslint-disable-next-line import/no-named-as-default | ||
class PageSizeTooLargeException extends RangeError { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor(pageSize, maxSize) { | ||
super(`Expect page size to be at most ${maxSize}, but ${pageSize} received`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
@@ -21,5 +20,5 @@ } | ||
class PageSizeTooSmallException extends RangeError { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor(pageSize, minSize) { | ||
super(`Expect page size to be at least ${minSize}, but ${pageSize} received`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
@@ -29,5 +28,5 @@ } | ||
class OutputsValidatorTypeException extends TypeError { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor() { | ||
super(`Expect outputs validator to be 'default' or 'passthrough'`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
@@ -39,5 +38,5 @@ } | ||
class BigintOrHexStringTypeException extends TypeError { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor(value) { | ||
super(`Expect number to be bigint or hex string, but ${value} received`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
@@ -47,5 +46,5 @@ } | ||
class StringHashTypeException extends TypeError { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor(hash) { | ||
super(`Expect hash to be string, but ${hash} received`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
@@ -56,9 +55,9 @@ } | ||
class HexStringWithout0xException extends Error { | ||
code = _ErrorCode.default.ParameterInvalid; | ||
constructor(hex) { | ||
super(`Hex string ${hex} should start with 0x`); | ||
_defineProperty(this, "code", _ErrorCode.default.ParameterInvalid); | ||
} | ||
} | ||
exports.HexStringWithout0xException = HexStringWithout0xException; | ||
var _default = { | ||
var _default = exports.default = { | ||
PageSizeTooLargeException, | ||
@@ -71,3 +70,2 @@ PageSizeTooSmallException, | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=formatter.js.map |
@@ -9,9 +9,6 @@ "use strict"; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
class IdNotMatchException extends Error { | ||
code = _ErrorCode.default.IdNotMatch; | ||
constructor(requestId, responseId) { | ||
super(`Expect json rpc id to be ${requestId}, but ${responseId} received`); | ||
_defineProperty(this, "code", _ErrorCode.default.IdNotMatch); | ||
} | ||
@@ -21,13 +18,9 @@ } | ||
class ResponseException extends Error { | ||
constructor(...args) { | ||
super(...args); | ||
_defineProperty(this, "code", _ErrorCode.default.ResponseMessage); | ||
} | ||
code = _ErrorCode.default.ResponseMessage; | ||
} | ||
exports.ResponseException = ResponseException; | ||
var _default = { | ||
var _default = exports.default = { | ||
IdNotMatchException, | ||
ResponseException | ||
}; | ||
exports.default = _default; | ||
//# sourceMappingURL=rpc.js.map |
@@ -33,2 +33,3 @@ import { Base } from "./Base"; | ||
export declare const ResultFormatter: typeof resultFormatter; | ||
export declare const DEFAULT_RPC_TIMEOUT = 30000; | ||
export declare class CKBRPC extends Base { | ||
@@ -39,8 +40,12 @@ #private; | ||
get resultFormatter(): typeof resultFormatter; | ||
constructor(url: string, config?: RPCConfig); | ||
constructor(url: string, config?: Partial<RPCConfig>); | ||
setNode(node: CKBComponents.Node): CKBComponents.Node; | ||
addMethod: (options: CKBComponents.Method, config?: RPCConfig) => void; | ||
createBatchRequest: <N extends keyof Base, P extends (string | number | object)[], R = any[]>(params?: any) => any; | ||
createBatchRequest: <N extends keyof Base, P extends (string | number | object)[], R = any[]>(params?: [method: N, ...rest: P][]) => [method: N, ...rest: P][] & { | ||
add: (n: N, ...p: P) => [method: N, ...rest: P][]; | ||
remove: (index: number) => [method: N, ...rest: P][]; | ||
exec: () => Promise<R>; | ||
}; | ||
} | ||
export { CKBRPC as RPC }; | ||
//# sourceMappingURL=index.d.ts.map |
234
lib/index.js
@@ -6,148 +6,45 @@ "use strict"; | ||
}); | ||
exports.ResultFormatter = exports.RPC = exports.ParamsFormatter = exports.CKBRPC = void 0; | ||
exports.ResultFormatter = exports.RPC = exports.ParamsFormatter = exports.DEFAULT_RPC_TIMEOUT = exports.CKBRPC = void 0; | ||
var _Base = require("./Base"); | ||
var _method = require("./method"); | ||
var _paramsFormatter2 = require("./paramsFormatter"); | ||
var _paramsFormatter = require("./paramsFormatter"); | ||
var resultFormatter = _interopRequireWildcard(require("./resultFormatter")); | ||
var _exceptions = require("./exceptions"); | ||
var _axios = _interopRequireDefault(require("axios")); | ||
var _initAxiosWebworkerAdapter = require("./initAxiosWebworkerAdapter"); | ||
var _crossFetch = _interopRequireDefault(require("cross-fetch")); | ||
var _abortController = _interopRequireDefault(require("abort-controller")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; } | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } | ||
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } | ||
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } // import axios from 'axios' | ||
const ParamsFormatter = _paramsFormatter2.formatter; | ||
exports.ParamsFormatter = ParamsFormatter; | ||
const ResultFormatter = resultFormatter; | ||
exports.ResultFormatter = ResultFormatter; | ||
(0, _initAxiosWebworkerAdapter.initAxiosWebworkerAdapter)(); | ||
var _config = /*#__PURE__*/new WeakMap(); | ||
var _node = /*#__PURE__*/new WeakMap(); | ||
var _paramsFormatter = /*#__PURE__*/new WeakMap(); | ||
var _resultFormatter = /*#__PURE__*/new WeakMap(); | ||
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } | ||
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } | ||
const ParamsFormatter = exports.ParamsFormatter = _paramsFormatter.formatter; | ||
const ResultFormatter = exports.ResultFormatter = resultFormatter; | ||
const DEFAULT_RPC_TIMEOUT = exports.DEFAULT_RPC_TIMEOUT = 30000; | ||
class CKBRPC extends _Base.Base { | ||
#config; | ||
#node = { | ||
url: "" | ||
}; | ||
get node() { | ||
return _classPrivateFieldGet(this, _node); | ||
return this.#node; | ||
} | ||
#paramsFormatter = _paramsFormatter.formatter; | ||
get paramsFormatter() { | ||
return _classPrivateFieldGet(this, _paramsFormatter); | ||
return this.#paramsFormatter; | ||
} | ||
#resultFormatter = resultFormatter; | ||
get resultFormatter() { | ||
return _classPrivateFieldGet(this, _resultFormatter); | ||
return this.#resultFormatter; | ||
} | ||
constructor(url, _config2 = { | ||
timeout: 30000 | ||
}) { | ||
constructor(url, config = {}) { | ||
super(); | ||
_classPrivateFieldInitSpec(this, _config, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _node, { | ||
writable: true, | ||
value: { | ||
url: "" | ||
} | ||
}); | ||
_classPrivateFieldInitSpec(this, _paramsFormatter, { | ||
writable: true, | ||
value: _paramsFormatter2.formatter | ||
}); | ||
_classPrivateFieldInitSpec(this, _resultFormatter, { | ||
writable: true, | ||
value: resultFormatter | ||
}); | ||
_defineProperty(this, "addMethod", (options, config) => { | ||
const method = new _method.Method(this.node, options, config); | ||
Object.defineProperty(this, options.name, { | ||
value: method.call, | ||
enumerable: true | ||
}); | ||
}); | ||
/* eslint-disable */ | ||
_defineProperty(this, "createBatchRequest", ( | ||
// TODO fix me | ||
// params: [method: N, ...rest: P][] = [], | ||
params = []) => { | ||
const ctx = this; | ||
// TODO fix me | ||
const proxied = new Proxy([], { | ||
set(...p) { | ||
const methods = Object.keys(ctx); | ||
if (p[1] !== "length") { | ||
var _p$; | ||
const name = p === null || p === void 0 ? void 0 : (_p$ = p[2]) === null || _p$ === void 0 ? void 0 : _p$[0]; | ||
if (methods.indexOf(name) === -1) { | ||
throw new _exceptions.MethodInBatchNotFoundException(name); | ||
} | ||
} | ||
return Reflect.set(...p); | ||
} | ||
}); | ||
Object.defineProperties(proxied, { | ||
add: { | ||
value(...args) { | ||
this.push(args); | ||
return this; | ||
} | ||
}, | ||
remove: { | ||
value(i) { | ||
this.splice(i, 1); | ||
return this; | ||
} | ||
}, | ||
exec: { | ||
async value() { | ||
// TODO fix me | ||
const payload = proxied.map(([f, ...p], i) => { | ||
try { | ||
const method = new _method.Method(ctx.node, { | ||
...ctx.rpcProperties[f], | ||
name: f | ||
}); | ||
return method.getPayload(...p); | ||
} catch (err) { | ||
throw new _exceptions.PayloadInBatchException(i, err.message); | ||
} | ||
}); | ||
const batchRes = await (0, _axios.default)({ | ||
method: "POST", | ||
headers: { | ||
"content-type": "application/json" | ||
}, | ||
data: payload, | ||
url: _classPrivateFieldGet(ctx, _node).url, | ||
httpAgent: _classPrivateFieldGet(ctx, _node).httpAgent, | ||
httpsAgent: _classPrivateFieldGet(ctx, _node).httpsAgent, | ||
timeout: _classPrivateFieldGet(ctx, _config).timeout | ||
}); | ||
return batchRes.data.map((res, i) => { | ||
var _ctx$rpcProperties$pr, _ctx$rpcProperties$pr2, _ctx$rpcProperties$pr3; | ||
if (res.id !== payload[i].id) { | ||
return new _exceptions.IdNotMatchedInBatchException(i, payload[i].id, res.id); | ||
} | ||
return (_ctx$rpcProperties$pr = (_ctx$rpcProperties$pr2 = (_ctx$rpcProperties$pr3 = ctx.rpcProperties[proxied[i][0]]).resultFormatters) === null || _ctx$rpcProperties$pr2 === void 0 ? void 0 : _ctx$rpcProperties$pr2.call(_ctx$rpcProperties$pr3, res.result)) !== null && _ctx$rpcProperties$pr !== void 0 ? _ctx$rpcProperties$pr : res.result; | ||
}); | ||
} | ||
} | ||
}); | ||
// TODO fix me | ||
params.forEach(p => proxied.push(p)); | ||
return proxied; | ||
}); | ||
this.setNode({ | ||
url | ||
}); | ||
_classPrivateFieldSet(this, _config, _config2); | ||
const { | ||
timeout = DEFAULT_RPC_TIMEOUT, | ||
fetch = _crossFetch.default | ||
} = config; | ||
this.#config = { | ||
timeout, | ||
fetch | ||
}; | ||
Object.defineProperties(this, { | ||
@@ -168,3 +65,2 @@ addMethod: { | ||
}); | ||
Object.keys(this.rpcProperties).forEach(name => { | ||
@@ -174,3 +70,3 @@ this.addMethod({ | ||
...this.rpcProperties[name] | ||
}, _config2); | ||
}, this.#config); | ||
}); | ||
@@ -182,4 +78,78 @@ } | ||
} | ||
addMethod = (options, config) => { | ||
const method = new _method.Method(this.node, options, config); | ||
Object.defineProperty(this, options.name, { | ||
value: method.call, | ||
enumerable: true | ||
}); | ||
}; | ||
/* eslint-disable */ | ||
createBatchRequest = (params = []) => { | ||
const ctx = this; | ||
const proxied = new Proxy([], { | ||
set(...p) { | ||
const methods = Object.keys(ctx); | ||
if (p[1] !== "length") { | ||
var _p$; | ||
const name = p === null || p === void 0 || (_p$ = p[2]) === null || _p$ === void 0 ? void 0 : _p$[0]; | ||
if (methods.indexOf(name) === -1) { | ||
throw new _exceptions.MethodInBatchNotFoundException(name); | ||
} | ||
} | ||
return Reflect.set(...p); | ||
} | ||
}); | ||
Object.defineProperties(proxied, { | ||
add: { | ||
value(...args) { | ||
this.push(args); | ||
return this; | ||
} | ||
}, | ||
remove: { | ||
value(i) { | ||
this.splice(i, 1); | ||
return this; | ||
} | ||
}, | ||
exec: { | ||
async value() { | ||
const payload = proxied.map(([f, ...p], i) => { | ||
try { | ||
const method = new _method.Method(ctx.node, { | ||
...ctx.rpcProperties[f], | ||
name: f | ||
}); | ||
return method.getPayload(...p); | ||
} catch (err) { | ||
throw new _exceptions.PayloadInBatchException(i, err.message); | ||
} | ||
}); | ||
const controller = new _abortController.default(); | ||
const signal = controller.signal; | ||
const timeout = setTimeout(() => controller.abort(), ctx.#config.timeout); | ||
const batchRes = await ctx.#config.fetch(ctx.#node.url, { | ||
method: "POST", | ||
headers: { | ||
"content-type": "application/json" | ||
}, | ||
body: JSON.stringify(payload), | ||
signal | ||
}).then(res => res.json()); | ||
clearTimeout(timeout); | ||
return batchRes.map((res, i) => { | ||
var _ctx$rpcProperties$pr, _ctx$rpcProperties$pr2, _ctx$rpcProperties$pr3; | ||
if (res.id !== payload[i].id) { | ||
return new _exceptions.IdNotMatchedInBatchException(i, payload[i].id, res.id); | ||
} | ||
return (_ctx$rpcProperties$pr = (_ctx$rpcProperties$pr2 = (_ctx$rpcProperties$pr3 = ctx.rpcProperties[proxied[i][0]]).resultFormatters) === null || _ctx$rpcProperties$pr2 === void 0 ? void 0 : _ctx$rpcProperties$pr2.call(_ctx$rpcProperties$pr3, res.result)) !== null && _ctx$rpcProperties$pr !== void 0 ? _ctx$rpcProperties$pr : res.result; | ||
}); | ||
} | ||
} | ||
}); | ||
params.forEach(p => proxied.push(p)); | ||
return proxied; | ||
}; | ||
} | ||
exports.RPC = exports.CKBRPC = CKBRPC; | ||
//# sourceMappingURL=index.js.map |
@@ -6,3 +6,3 @@ import { CKBComponents } from "./types/api"; | ||
get name(): string; | ||
constructor(node: CKBComponents.Node, options: CKBComponents.Method, config?: RPCConfig); | ||
constructor(node: CKBComponents.Node, options: CKBComponents.Method, config?: Partial<RPCConfig>); | ||
call: (...params: (string | number | object)[]) => Promise<any>; | ||
@@ -9,0 +9,0 @@ getPayload: (...params: (string | number | object)[]) => { |
@@ -7,88 +7,32 @@ "use strict"; | ||
exports.Method = void 0; | ||
var _axios = _interopRequireDefault(require("axios")); | ||
var _exceptions = require("./exceptions"); | ||
var _initAxiosWebworkerAdapter = require("./initAxiosWebworkerAdapter"); | ||
var _ = require("."); | ||
var _abortController = _interopRequireDefault(require("abort-controller")); | ||
var _crossFetch = _interopRequireDefault(require("cross-fetch")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } | ||
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } | ||
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); } | ||
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } } | ||
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; } | ||
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } | ||
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); } | ||
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); } | ||
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; } | ||
(0, _initAxiosWebworkerAdapter.initAxiosWebworkerAdapter)(); | ||
var _name = /*#__PURE__*/new WeakMap(); | ||
var _config = /*#__PURE__*/new WeakMap(); | ||
var _options = /*#__PURE__*/new WeakMap(); | ||
var _node = /*#__PURE__*/new WeakMap(); | ||
class Method { | ||
#name; | ||
#config; | ||
get name() { | ||
return _classPrivateFieldGet(this, _name); | ||
return this.#name; | ||
} | ||
constructor(node, options, config = { | ||
timeout: 30000 | ||
}) { | ||
_classPrivateFieldInitSpec(this, _name, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _config, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
_classPrivateFieldInitSpec(this, _options, { | ||
writable: true, | ||
value: { | ||
name: "", | ||
method: "", | ||
paramsFormatters: [], | ||
resultFormatters: undefined | ||
} | ||
}); | ||
_classPrivateFieldInitSpec(this, _node, { | ||
writable: true, | ||
value: void 0 | ||
}); | ||
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types */ | ||
_defineProperty(this, "call", (...params) => { | ||
const payload = this.getPayload(...params); | ||
return (0, _axios.default)({ | ||
method: "POST", | ||
headers: { | ||
"content-type": "application/json" | ||
}, | ||
data: payload, | ||
url: _classPrivateFieldGet(this, _node).url, | ||
httpAgent: _classPrivateFieldGet(this, _node).httpAgent, | ||
httpsAgent: _classPrivateFieldGet(this, _node).httpsAgent, | ||
timeout: _classPrivateFieldGet(this, _config).timeout | ||
}).then(res => { | ||
var _classPrivateFieldGet2, _classPrivateFieldGet3, _classPrivateFieldGet4; | ||
if (res.data.id !== payload.id) { | ||
throw new _exceptions.IdNotMatchException(payload.id, res.data.id); | ||
} | ||
if (res.data.error) { | ||
throw new _exceptions.ResponseException(JSON.stringify(res.data.error)); | ||
} | ||
return (_classPrivateFieldGet2 = (_classPrivateFieldGet3 = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _options)).resultFormatters) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.call(_classPrivateFieldGet4, res.data.result)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : res.data.result; | ||
}); | ||
}); | ||
_defineProperty(this, "getPayload", (...params) => { | ||
const data = params.map((p, i) => _classPrivateFieldGet(this, _options).paramsFormatters[i] && _classPrivateFieldGet(this, _options).paramsFormatters[i](p) || p); | ||
const id = Math.round(Math.random() * 10000); | ||
const payload = { | ||
id, | ||
method: _classPrivateFieldGet(this, _options).method, | ||
params: data, | ||
jsonrpc: "2.0" | ||
}; | ||
return payload; | ||
}); | ||
_classPrivateFieldSet(this, _node, node); | ||
_classPrivateFieldSet(this, _options, options); | ||
_classPrivateFieldSet(this, _name, options.name); | ||
_classPrivateFieldSet(this, _config, config); | ||
#options = { | ||
name: "", | ||
method: "", | ||
paramsFormatters: [], | ||
resultFormatters: undefined | ||
}; | ||
#node; | ||
constructor(node, options, config = {}) { | ||
this.#node = node; | ||
this.#options = options; | ||
this.#name = options.name; | ||
const { | ||
timeout = _.DEFAULT_RPC_TIMEOUT, | ||
fetch = _crossFetch.default | ||
} = config; | ||
this.#config = { | ||
timeout, | ||
fetch | ||
}; | ||
Object.defineProperty(this.call, "name", { | ||
@@ -100,2 +44,41 @@ value: options.name, | ||
} | ||
/* eslint-disable @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types */ | ||
call = async (...params) => { | ||
const payload = this.getPayload(...params); | ||
const controller = new _abortController.default(); | ||
const signal = controller.signal; | ||
const timeout = setTimeout(() => controller.abort(), this.#config.timeout); | ||
const res = await this.#config.fetch(this.#node.url, { | ||
method: "POST", | ||
headers: { | ||
"content-type": "application/json" | ||
}, | ||
body: JSON.stringify(payload), | ||
signal | ||
}).then(res => res.json()).then(res => { | ||
var _this$options$resultF, _this$options$resultF2, _this$options; | ||
if (res.id !== payload.id) { | ||
throw new _exceptions.IdNotMatchException(payload.id, res.id); | ||
} | ||
if (res.error) { | ||
throw new _exceptions.ResponseException(JSON.stringify(res.error)); | ||
} | ||
return (_this$options$resultF = (_this$options$resultF2 = (_this$options = this.#options).resultFormatters) === null || _this$options$resultF2 === void 0 ? void 0 : _this$options$resultF2.call(_this$options, res.result)) !== null && _this$options$resultF !== void 0 ? _this$options$resultF : res.result; | ||
}); | ||
clearTimeout(timeout); | ||
return res; | ||
}; | ||
getPayload = (...params) => { | ||
const data = params.map((p, i) => this.#options.paramsFormatters[i] && this.#options.paramsFormatters[i](p) || p); | ||
/* eslint-disable @typescript-eslint/no-magic-numbers */ | ||
const id = Math.round(Math.random() * 10000); | ||
const payload = { | ||
id, | ||
method: this.#options.method, | ||
params: data, | ||
jsonrpc: "2.0" | ||
}; | ||
return payload; | ||
}; | ||
} | ||
@@ -102,0 +85,0 @@ /* eslint-enable @typescript-eslint/ban-types, @typescript-eslint/explicit-module-boundary-types */ |
@@ -10,3 +10,3 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */ | ||
const formatter = { | ||
const formatter = exports.formatter = { | ||
toOptional: format => arg => { | ||
@@ -217,3 +217,2 @@ if (!format || arg === undefined || arg === null) { | ||
/* eslint-enable camelcase, @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types */ | ||
exports.formatter = formatter; | ||
//# sourceMappingURL=paramsFormatter.js.map |
@@ -7,3 +7,4 @@ import { CKBComponents } from "./types/api"; | ||
declare const toHash: (hash: RPC.Hash256) => CKBComponents.Hash256; | ||
declare const toHeader: (header: RPC.Header) => CKBComponents.BlockHeader; | ||
declare function toHeader(header: RPC.Header): CKBComponents.BlockHeader; | ||
declare function toHeader(header: string): string; | ||
declare const toScript: (script: RPC.Script) => CKBComponents.Script; | ||
@@ -19,3 +20,9 @@ declare const toInput: (input: RPC.CellInput) => CKBComponents.CellInput; | ||
declare const toTip: (tip: RPC.Tip) => CKBComponents.Tip; | ||
declare const toBlock: (block: RPC.Block) => CKBComponents.Block; | ||
type BlockWithCycles = { | ||
block: RPC.Block | string; | ||
cycles: string[]; | ||
}; | ||
declare function toBlock(block: string): string; | ||
declare function toBlock(block: RPC.Block): CKBComponents.Block; | ||
declare function toBlock<T extends BlockWithCycles>(block: T): T; | ||
declare const toAlertMessage: (alertMessage: RPC.AlertMessage) => CKBComponents.AlertMessage; | ||
@@ -46,9 +53,3 @@ declare const toBlockchainInfo: (info: RPC.BlockchainInfo) => CKBComponents.BlockchainInfo; | ||
declare const toCellsIncludingOutPoint: (cells: RPC.CellIncludingOutPoint[]) => CKBComponents.CellIncludingOutPoint[]; | ||
declare const toTransactionWithStatus: (txWithStatus: RPC.TransactionWithStatus) => { | ||
transaction: CKBComponents.RawTransaction; | ||
txStatus: { | ||
blockHash: string | undefined; | ||
status: RPC.TransactionStatus; | ||
}; | ||
}; | ||
declare const toTransactionWithStatus: <Tx>(txWithStatus: RPC.TransactionWithStatus) => CKBComponents.TransactionWithStatus<Tx>; | ||
declare const toEpoch: (epoch: RPC.Epoch) => CKBComponents.Epoch; | ||
@@ -68,5 +69,6 @@ declare const toTransactionPoint: (transactionPoint: RPC.TransactionPoint) => CKBComponents.TransactionPoint; | ||
declare const toTransactionProof: (proof: RPC.TransactionProof) => CKBComponents.TransactionProof; | ||
declare const toDeployment: (deployment: RPC.Deployment) => CKBComponents.Deployment; | ||
declare const toConsensus: (consensus: RPC.Consensus) => CKBComponents.Consensus; | ||
declare const toRawTxPool: (rawTxPool: RPC.RawTxPool) => CKBComponents.RawTxPool; | ||
declare const toGetCellsResult: (getCellsResult: RPC.GetLiveCellsResult) => CKBComponents.GetLiveCellsResult; | ||
declare const toGetCellsResult: <WithData extends boolean = true>(getCellsResult: RPC.GetLiveCellsResult) => CKBComponents.GetLiveCellsResult<WithData>; | ||
declare const toGetTransactionsResult: <Goruped extends boolean = false>(getTransactionsResult: RPC.GetTransactionsResult<Goruped>) => CKBComponents.GetTransactionsResult<Goruped>; | ||
@@ -79,3 +81,6 @@ declare const toCellsCapacity: (cellsCapacity: RPC.CellsCapacity) => CKBComponents.CellsCapacity; | ||
declare const toEstimateCycles: (cycle: RPC.EstimateCycles) => CKBComponents.EstimateCycles; | ||
export { toNumber, toHash, toArray, toNullable, 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, toBlockFilter, toTransactionAndWitnessProof, toFeeRateStatistics, toForkBlockResult, toEstimateCycles, }; | ||
declare const toDeployState: (state: RPC.DeploymentState) => CKBComponents.DeploymentState; | ||
declare const toDeploymentInfo: (deploymentInfo: RPC.DeploymentInfo) => CKBComponents.DeploymentInfo; | ||
declare const toDeploymentsInfo: (deploymentInfo: RPC.DeploymentsInfo) => CKBComponents.DeploymentsInfo; | ||
export { toNumber, toHash, toArray, toNullable, 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, toBlockFilter, toTransactionAndWitnessProof, toFeeRateStatistics, toForkBlockResult, toEstimateCycles, toDeployment, toDeployState, toDeploymentInfo, toDeploymentsInfo, }; | ||
//# sourceMappingURL=resultFormatter.d.ts.map |
@@ -6,3 +6,7 @@ "use strict"; | ||
}); | ||
exports.toTip = exports.toSyncState = exports.toScript = exports.toRemoteNodeInfo = exports.toRawTxPool = exports.toPeers = exports.toOutput = exports.toOutPoint = exports.toNumber = exports.toNullable = exports.toLockHashIndexStates = exports.toLockHashIndexState = exports.toLocalNodeInfo = exports.toLiveCellsByLockHash = exports.toLiveCellWithStatus = exports.toLiveCell = exports.toInput = exports.toHeader = exports.toHash = exports.toGetTransactionsResult = exports.toGetCellsResult = exports.toForkBlockResult = exports.toFeeRateStatistics = exports.toFeeRate = exports.toEstimateCycles = 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.toBlockFilter = exports.toBlockEconomicState = exports.toBlock = exports.toBannedAddresses = exports.toBannedAddress = exports.toArray = exports.toAlertMessage = void 0; | ||
exports.toBannedAddresses = exports.toBannedAddress = exports.toArray = exports.toAlertMessage = void 0; | ||
exports.toBlock = toBlock; | ||
exports.toHash = exports.toGetTransactionsResult = exports.toGetCellsResult = exports.toForkBlockResult = exports.toFeeRateStatistics = exports.toFeeRate = exports.toEstimateCycles = exports.toEpoch = exports.toDeploymentsInfo = exports.toDeploymentInfo = exports.toDeployment = exports.toDeployState = exports.toDepType = exports.toConsensus = exports.toCellsIncludingOutPoint = exports.toCellsCapacity = exports.toCells = exports.toCellbaseOutputCapacityDetails = exports.toCellIncludingOutPoint = exports.toCellDep = exports.toCell = exports.toCapacityByLockHash = exports.toBlockchainInfo = exports.toBlockFilter = exports.toBlockEconomicState = void 0; | ||
exports.toHeader = toHeader; | ||
exports.toTip = exports.toSyncState = exports.toScript = exports.toRemoteNodeInfo = exports.toRawTxPool = exports.toPeers = exports.toOutput = exports.toOutPoint = exports.toNumber = exports.toNullable = exports.toLockHashIndexStates = exports.toLockHashIndexState = exports.toLocalNodeInfo = exports.toLiveCellsByLockHash = exports.toLiveCellWithStatus = exports.toLiveCell = exports.toInput = void 0; | ||
exports.toTransaction = toTransaction; | ||
@@ -31,3 +35,4 @@ exports.toUncleBlock = exports.toTxPoolInfo = exports.toTransactionsByLockHash = exports.toTransactionWithStatus = exports.toTransactionProof = exports.toTransactionPoint = exports.toTransactionAndWitnessProof = void 0; | ||
exports.toHash = toHash; | ||
const toHeader = header => { | ||
function toHeader(header) { | ||
if (typeof header === "string") return header; | ||
if (!header) return header; | ||
@@ -50,4 +55,3 @@ const { | ||
}; | ||
}; | ||
exports.toHeader = toHeader; | ||
} | ||
const toScript = script => { | ||
@@ -126,3 +130,3 @@ if (!script) return script; | ||
function toTransaction(tx) { | ||
if (!tx) return tx; | ||
if (!tx || typeof tx !== "object") return tx; | ||
const { | ||
@@ -162,4 +166,11 @@ cell_deps: cellDeps = [], | ||
exports.toTip = toTip; | ||
const toBlock = block => { | ||
if (!block) return block; | ||
function toBlock(res) { | ||
if (!res) return res; | ||
if (typeof res === "string") return res; | ||
if ("block" in res && "cycles" in res) { | ||
return { | ||
cycles: res.cycles, | ||
block: toBlock(res.block) | ||
}; | ||
} | ||
const { | ||
@@ -170,3 +181,3 @@ header, | ||
...rest | ||
} = block; | ||
} = res; | ||
return { | ||
@@ -178,4 +189,3 @@ header: toHeader(header), | ||
}; | ||
}; | ||
exports.toBlock = toBlock; | ||
} | ||
const toAlertMessage = alertMessage => { | ||
@@ -268,2 +278,5 @@ if (!alertMessage) return alertMessage; | ||
min_fee_rate: minFeeRate, | ||
min_rbf_rate: minRbfRate, | ||
tx_size_limit: txSizeLimit, | ||
max_tx_pool_size: maxTxPoolSize, | ||
...rest | ||
@@ -278,2 +291,5 @@ } = info; | ||
minFeeRate, | ||
minRbfRate, | ||
txSizeLimit, | ||
maxTxPoolSize, | ||
...rest | ||
@@ -356,3 +372,2 @@ }; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types | ||
exports.toCellsIncludingOutPoint = toCellsIncludingOutPoint; | ||
@@ -367,2 +382,5 @@ const toTransactionWithStatus = txWithStatus => { | ||
}, | ||
time_added_to_pool, | ||
min_replace_fee, | ||
fee, | ||
...rest | ||
@@ -374,4 +392,10 @@ } = txWithStatus; | ||
blockHash, | ||
status | ||
status, | ||
...("reason" in txWithStatus.tx_status ? { | ||
reason: txWithStatus.tx_status.reason | ||
} : {}) | ||
}, | ||
timeAddedToPool: time_added_to_pool, | ||
minReplaceFee: min_replace_fee, | ||
fee, | ||
...rest | ||
@@ -565,5 +589,34 @@ }; | ||
exports.toTransactionProof = toTransactionProof; | ||
const toHardforkFeature = feature => { | ||
return { | ||
rfc: feature.rfc, | ||
epochNumber: feature.epoch_number | ||
}; | ||
}; | ||
const toDeployment = deployment => { | ||
return { | ||
bit: deployment.bit, | ||
start: deployment.start, | ||
timeout: deployment.timeout, | ||
minActivationEpoch: deployment.min_activation_epoch, | ||
period: deployment.period, | ||
threshold: deployment.threshold | ||
}; | ||
}; | ||
exports.toDeployment = toDeployment; | ||
const toSoftFork = softFork => { | ||
if ("rfc0043" in softFork) { | ||
return { | ||
status: softFork.status, | ||
rfc0043: toDeployment(softFork.rfc0043) | ||
}; | ||
} | ||
return softFork; | ||
}; | ||
const toConsensus = consensus => { | ||
var _consensus$hardfork_f, _consensus$hardfork_f2; | ||
if (!consensus) return consensus; | ||
const rpcHardforkFeatures = consensus.hardfork_features; | ||
const softforks = consensus.softforks; | ||
const lightClient = softforks.light_client && toSoftFork(softforks.light_client); | ||
const testdummy = softforks.testdummy && toSoftFork(softforks.testdummy); | ||
return { | ||
@@ -592,9 +645,11 @@ blockVersion: consensus.block_version, | ||
typeIdCodeHash: consensus.type_id_code_hash, | ||
hardforkFeatures: (_consensus$hardfork_f = (_consensus$hardfork_f2 = consensus.hardfork_features) === null || _consensus$hardfork_f2 === void 0 ? void 0 : _consensus$hardfork_f2.map(({ | ||
epoch_number: epochNumber, | ||
...rest | ||
}) => ({ | ||
epochNumber, | ||
...rest | ||
}))) !== null && _consensus$hardfork_f !== void 0 ? _consensus$hardfork_f : consensus.hardfork_features | ||
hardforkFeatures: rpcHardforkFeatures.map(toHardforkFeature), | ||
softforks: { | ||
...(lightClient && { | ||
lightClient | ||
}), | ||
...(testdummy && { | ||
testdummy | ||
}) | ||
} | ||
}; | ||
@@ -719,3 +774,4 @@ }; | ||
transactions: result.transactions.map(toTransaction), | ||
proposals: result.proposals | ||
proposals: result.proposals, | ||
extension: result.extension | ||
}; | ||
@@ -729,5 +785,45 @@ }; | ||
}; | ||
exports.toEstimateCycles = toEstimateCycles; | ||
const toDeployState = state => { | ||
if (state === "locked_in") { | ||
return "lockedIn"; | ||
} | ||
return state; | ||
}; | ||
exports.toDeployState = toDeployState; | ||
const toDeploymentInfo = deploymentInfo => { | ||
return { | ||
bit: deploymentInfo.bit, | ||
/// specifies the first epoch in which the bit gains meaning. | ||
start: deploymentInfo.start, | ||
timeout: deploymentInfo.timeout, | ||
minActivationEpoch: deploymentInfo.min_activation_epoch, | ||
period: deploymentInfo.period, | ||
threshold: deploymentInfo.threshold, | ||
since: deploymentInfo.since, | ||
state: toDeployState(deploymentInfo.state) | ||
}; | ||
}; | ||
exports.toDeploymentInfo = toDeploymentInfo; | ||
const toDeploymentsInfo = deploymentInfo => { | ||
const { | ||
light_client, | ||
testdummy | ||
} = deploymentInfo.deployments; | ||
return { | ||
hash: deploymentInfo.hash, | ||
epoch: deploymentInfo.epoch, | ||
deployments: { | ||
...(light_client ? { | ||
lightClient: toDeploymentInfo(light_client) | ||
} : {}), | ||
...(testdummy ? { | ||
testdummy: toDeploymentInfo(testdummy) | ||
} : {}) | ||
} | ||
}; | ||
}; | ||
/* eslint-enable camelcase */ | ||
exports.toEstimateCycles = toEstimateCycles; | ||
exports.toDeploymentsInfo = toDeploymentsInfo; | ||
//# sourceMappingURL=resultFormatter.js.map |
@@ -12,2 +12,3 @@ import type * as api from "@ckb-lumos/base"; | ||
type UInt64 = string; | ||
type U256 = string; | ||
type Index = string; | ||
@@ -29,2 +30,3 @@ type Version = string; | ||
type EpochNumberWithFraction = string; | ||
type EpochNumber = string; | ||
enum TransactionStatus { | ||
@@ -35,3 +37,3 @@ Pending = "pending", | ||
} | ||
type ScriptHashType = "data" | "type" | "data1"; | ||
type ScriptHashType = api.HashType; | ||
type DepType = "code" | "depGroup"; | ||
@@ -48,4 +50,2 @@ type JsonBytes = string; | ||
url: string; | ||
httpAgent?: any; | ||
httpsAgent?: any; | ||
} | ||
@@ -72,4 +72,4 @@ interface Method { | ||
type Transaction = Required<api.Transaction>; | ||
type TransactionWithStatus = api.TransactionWithStatus; | ||
type BlockHeader = api.Header; | ||
type TransactionWithStatus<Tx = Transaction> = api.TransactionWithStatus<Tx>; | ||
type BlockHeader<T = api.Header> = T; | ||
type Block = api.Block; | ||
@@ -94,2 +94,10 @@ type UncleBlock = api.UncleBlock; | ||
type Consensus = api.Consensus; | ||
type HardForks = api.HardForks; | ||
type HardForkFeature = api.HardforkFeature; | ||
type SoftForkStatus = api.SoftForkStatus; | ||
type SoftFork = api.SoftFork; | ||
type Buried = api.Buried; | ||
type Rfc0043 = api.Rfc0043; | ||
type Ratio = api.Ratio; | ||
type Deployment = api.Deployment; | ||
type QueryOptions = api.QueryOptions; | ||
@@ -259,2 +267,3 @@ interface TransactionPoint { | ||
proposals: ProposalShortId[]; | ||
extension: Hash; | ||
} | ||
@@ -269,3 +278,7 @@ type SerializedBlock = api.HexString; | ||
} | ||
type DeploymentPos = api.DeploymentPos; | ||
type DeploymentState = api.DeploymentState; | ||
type DeploymentInfo = api.DeploymentInfo; | ||
type DeploymentsInfo = api.DeploymentsInfo; | ||
} | ||
//# sourceMappingURL=api.d.ts.map |
@@ -11,4 +11,3 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types */ | ||
let CKBComponents; | ||
exports.CKBComponents = CKBComponents; | ||
let CKBComponents = exports.CKBComponents = void 0; | ||
(function (_CKBComponents) { | ||
@@ -15,0 +14,0 @@ let TransactionStatus = /*#__PURE__*/function (TransactionStatus) { |
@@ -0,4 +1,6 @@ | ||
/// <reference lib="dom" /> | ||
export type RPCConfig = { | ||
timeout: number; | ||
fetch: typeof fetch; | ||
}; | ||
//# sourceMappingURL=common.d.ts.map |
@@ -7,34 +7,43 @@ /** | ||
export declare namespace RPC { | ||
type ProposalShortId = CKBComponents.ProposalShortId; | ||
type Number = CKBComponents.Number; | ||
type UInt32 = CKBComponents.UInt32; | ||
type Count = CKBComponents.Count; | ||
type DAO = CKBComponents.DAO; | ||
type Hash = CKBComponents.Hash; | ||
type Hash256 = CKBComponents.Hash256; | ||
type Version = CKBComponents.Version; | ||
type Capacity = CKBComponents.Capacity; | ||
type Witness = CKBComponents.Witness; | ||
type Bytes = CKBComponents.Bytes; | ||
type Index = CKBComponents.Index; | ||
type Since = CKBComponents.Since; | ||
type Timestamp = CKBComponents.Timestamp; | ||
type BlockNumber = CKBComponents.BlockNumber; | ||
type EpochInHeader = string; | ||
type Difficulty = CKBComponents.Difficulty; | ||
type Cycles = CKBComponents.Cycles; | ||
type Size = CKBComponents.Size; | ||
type RationalU256 = CKBComponents.RationalU256; | ||
type ProposalWindow = CKBComponents.ProposalWindow; | ||
type EpochNumberWithFraction = CKBComponents.EpochNumberWithFraction; | ||
type JsonBytes = CKBComponents.JsonBytes; | ||
type IOType = CKBComponents.IOType; | ||
enum TransactionStatus { | ||
export type ProposalShortId = CKBComponents.ProposalShortId; | ||
export type Number = CKBComponents.Number; | ||
export type UInt32 = CKBComponents.UInt32; | ||
export type Uint64 = CKBComponents.UInt64; | ||
export type U256 = CKBComponents.U256; | ||
export type Count = CKBComponents.Count; | ||
export type DAO = CKBComponents.DAO; | ||
export type Hash = CKBComponents.Hash; | ||
export type Hash256 = CKBComponents.Hash256; | ||
export type Version = CKBComponents.Version; | ||
export type Capacity = CKBComponents.Capacity; | ||
export type Witness = CKBComponents.Witness; | ||
export type Bytes = CKBComponents.Bytes; | ||
export type Index = CKBComponents.Index; | ||
export type Since = CKBComponents.Since; | ||
export type Timestamp = CKBComponents.Timestamp; | ||
export type BlockNumber = CKBComponents.BlockNumber; | ||
export type EpochInHeader = string; | ||
export type Difficulty = CKBComponents.Difficulty; | ||
export type Cycles = CKBComponents.Cycles; | ||
export type Size = CKBComponents.Size; | ||
export type RationalU256 = CKBComponents.RationalU256; | ||
export type ProposalWindow = CKBComponents.ProposalWindow; | ||
export type EpochNumberWithFraction = CKBComponents.EpochNumberWithFraction; | ||
export type JsonBytes = CKBComponents.JsonBytes; | ||
export type IOType = CKBComponents.IOType; | ||
export type EpochNumber = CKBComponents.EpochNumber; | ||
type MapLike<K extends string, V> = { | ||
[key in K]?: V; | ||
}; | ||
type Vec<T> = T[]; | ||
export enum TransactionStatus { | ||
Pending = "pending", | ||
Proposed = "proposed", | ||
Committed = "committed" | ||
Committed = "committed", | ||
Unknown = "unknown", | ||
Rejected = "rejected" | ||
} | ||
type ScriptHashType = CKBComponents.ScriptHashType; | ||
type DepType = "code" | "dep_group"; | ||
interface Script { | ||
export type DepType = "code" | "dep_group"; | ||
export type ScriptHashType = CKBComponents.ScriptHashType; | ||
export interface Script { | ||
args: Bytes; | ||
@@ -44,11 +53,11 @@ code_hash: Hash256; | ||
} | ||
interface OutPoint { | ||
export interface OutPoint { | ||
tx_hash: Hash256; | ||
index: Index; | ||
} | ||
interface CellInput { | ||
export interface CellInput { | ||
previous_output: OutPoint; | ||
since: Since; | ||
} | ||
interface CellOutput { | ||
export interface CellOutput { | ||
capacity: Capacity; | ||
@@ -58,4 +67,4 @@ lock: Script; | ||
} | ||
type Cell = CellOutput; | ||
interface LiveCell { | ||
export type Cell = CellOutput; | ||
export interface LiveCell { | ||
data: { | ||
@@ -67,7 +76,7 @@ content: Hash; | ||
} | ||
interface CellDep { | ||
export interface CellDep { | ||
out_point: OutPoint; | ||
dep_type: DepType; | ||
} | ||
interface CellIncludingOutPoint { | ||
export interface CellIncludingOutPoint { | ||
block_hash: Hash256; | ||
@@ -80,3 +89,3 @@ capacity: Capacity; | ||
} | ||
interface RawTransaction { | ||
export interface RawTransaction { | ||
version: Version; | ||
@@ -90,6 +99,6 @@ cell_deps: CellDep[]; | ||
} | ||
interface Transaction extends RawTransaction { | ||
export interface Transaction extends RawTransaction { | ||
hash: Hash256; | ||
} | ||
interface TransactionWithStatus { | ||
export interface TransactionWithStatus { | ||
transaction: Transaction; | ||
@@ -101,6 +110,11 @@ tx_status: { | ||
block_hash: undefined; | ||
status: TransactionStatus.Pending | TransactionStatus.Proposed; | ||
status: TransactionStatus.Pending | TransactionStatus.Proposed | TransactionStatus.Rejected | TransactionStatus.Unknown; | ||
reason?: string; | ||
}; | ||
time_added_to_pool: Uint64 | null; | ||
cycles: Uint64 | null; | ||
fee: Capacity | null; | ||
min_replace_fee: Capacity | null; | ||
} | ||
interface TransactionPoint { | ||
export interface TransactionPoint { | ||
block_number: BlockNumber; | ||
@@ -110,8 +124,8 @@ index: Index; | ||
} | ||
interface TransactionByLockHash { | ||
export interface TransactionByLockHash { | ||
consumed_by: undefined | TransactionPoint; | ||
created_by: TransactionPoint; | ||
} | ||
type TransactionsByLockHash = TransactionByLockHash[]; | ||
interface LiveCellByLockHash { | ||
export type TransactionsByLockHash = TransactionByLockHash[]; | ||
export interface LiveCellByLockHash { | ||
cell_output: CellOutput; | ||
@@ -122,4 +136,4 @@ created_by: TransactionPoint; | ||
} | ||
type LiveCellsByLockHash = LiveCellByLockHash[]; | ||
interface Header { | ||
export type LiveCellsByLockHash = LiveCellByLockHash[]; | ||
export interface Header { | ||
compact_target: Hash; | ||
@@ -138,7 +152,7 @@ dao: DAO; | ||
} | ||
interface UncleBlock { | ||
export interface UncleBlock { | ||
header: Header; | ||
proposals: ProposalShortId[]; | ||
} | ||
interface Block { | ||
export interface Block { | ||
header: Header; | ||
@@ -150,3 +164,3 @@ uncles: UncleBlock[]; | ||
} | ||
interface AlertMessage { | ||
export interface AlertMessage { | ||
id: string; | ||
@@ -157,11 +171,7 @@ priority: string; | ||
} | ||
interface BlockchainInfo { | ||
is_initial_block_download: boolean; | ||
epoch: string; | ||
difficulty: string; | ||
median_time: string; | ||
chain: string; | ||
alerts: AlertMessage[]; | ||
} | ||
interface LocalNodeInfo { | ||
/** | ||
* @deprecated please migrate to {@link ChainInfo} | ||
*/ | ||
export type BlockchainInfo = ChainInfo; | ||
export interface LocalNodeInfo { | ||
active: boolean; | ||
@@ -178,3 +188,3 @@ addresses: Record<"address" | "score", string>[]; | ||
} | ||
interface RemoteNodeInfo { | ||
export interface RemoteNodeInfo { | ||
addresses: Record<"address" | "score", string>[]; | ||
@@ -189,3 +199,3 @@ connected_duration: string; | ||
} | ||
interface PeersState { | ||
export interface PeersState { | ||
last_updated: string; | ||
@@ -195,3 +205,3 @@ blocks_in_flight: string; | ||
} | ||
interface TxPoolInfo { | ||
export interface TxPoolInfo { | ||
last_txs_updated_at: Timestamp; | ||
@@ -206,4 +216,7 @@ min_fee_rate: string; | ||
total_tx_size: Size; | ||
min_rbf_rate: Uint64; | ||
tx_size_limit: Uint64; | ||
max_tx_pool_size: Uint64; | ||
} | ||
interface Epoch { | ||
export interface Epoch { | ||
compact_target: Hash; | ||
@@ -214,3 +227,3 @@ length: string; | ||
} | ||
interface LockHashIndexState { | ||
export interface LockHashIndexState { | ||
block_hash: Hash256; | ||
@@ -220,4 +233,4 @@ block_number: BlockNumber; | ||
} | ||
type LockHashIndexStates = LockHashIndexState[]; | ||
interface BannedAddress { | ||
export type LockHashIndexStates = LockHashIndexState[]; | ||
export interface BannedAddress { | ||
address: string; | ||
@@ -228,4 +241,4 @@ ban_reason: string; | ||
} | ||
type BannedAddresses = BannedAddress[]; | ||
interface CellbaseOutputCapacityDetails { | ||
export type BannedAddresses = BannedAddress[]; | ||
export interface CellbaseOutputCapacityDetails { | ||
primary: string; | ||
@@ -237,6 +250,6 @@ proposal_reward: string; | ||
} | ||
interface FeeRate { | ||
export interface FeeRate { | ||
fee_rate: string; | ||
} | ||
interface CapacityByLockHash { | ||
export interface CapacityByLockHash { | ||
block_number: BlockNumber; | ||
@@ -246,3 +259,3 @@ capacity: Capacity; | ||
} | ||
interface BlockEconomicState { | ||
export interface BlockEconomicState { | ||
finalized_at: string; | ||
@@ -261,3 +274,3 @@ issuance: { | ||
} | ||
interface SyncState { | ||
export interface SyncState { | ||
best_known_block_number: string; | ||
@@ -272,3 +285,3 @@ best_known_block_timestamp: string; | ||
} | ||
interface TransactionProof { | ||
export interface TransactionProof { | ||
block_hash: Hash; | ||
@@ -281,4 +294,4 @@ proof: { | ||
} | ||
type TxPoolIds = Record<"pending" | "proposed", Array<Hash256>>; | ||
interface TxVerbosity { | ||
export type TxPoolIds = Record<"pending" | "proposed", Array<Hash256>>; | ||
export interface TxVerbosity { | ||
cycles: Cycles; | ||
@@ -291,11 +304,7 @@ size: Size; | ||
} | ||
type TxPoolVerbosity = Record<"pending" | "proposed", Record<Hash256, TxVerbosity>>; | ||
type RawTxPool = TxPoolIds | TxPoolVerbosity; | ||
interface Consensus { | ||
export type TxPoolVerbosity = Record<"pending" | "proposed", Record<Hash256, TxVerbosity>>; | ||
export type RawTxPool = TxPoolIds | TxPoolVerbosity; | ||
export interface Consensus { | ||
id: string; | ||
genesis_hash: Hash256; | ||
hardfork_features: Array<{ | ||
rfc: string; | ||
epoch_number: string | undefined; | ||
}>; | ||
dao_type_hash: Hash256 | undefined; | ||
@@ -321,8 +330,40 @@ secp256k1_blake160_sighash_all_type_hash: Hash256 | undefined; | ||
permanent_difficulty_in_dummy: boolean; | ||
hardfork_features: HardForks; | ||
softforks: { | ||
[key in DeploymentPos]?: SoftFork; | ||
}; | ||
} | ||
interface Tip { | ||
export type HardForks = Array<HardforkFeature>; | ||
export interface HardforkFeature { | ||
rfc: string; | ||
epoch_number: EpochNumber | null; | ||
} | ||
export type SoftFork = Buried | Rfc0043; | ||
export interface Buried { | ||
status: SoftForkStatus; | ||
active: boolean; | ||
epoch: EpochNumber; | ||
} | ||
export interface Rfc0043 { | ||
status: SoftForkStatus; | ||
rfc0043: Deployment; | ||
} | ||
export type SoftForkStatus = "buried" | "rfc0043"; | ||
export interface Ratio { | ||
numer: Uint64; | ||
denom: Uint64; | ||
} | ||
export interface Deployment { | ||
bit: number; | ||
start: EpochNumber; | ||
timeout: EpochNumber; | ||
min_activation_epoch: EpochNumber; | ||
period: EpochNumber; | ||
threshold: Ratio; | ||
} | ||
export interface Tip { | ||
block_hash: Hash256; | ||
block_number: BlockNumber; | ||
} | ||
interface IndexerCell { | ||
export interface IndexerCell { | ||
block_number: BlockNumber; | ||
@@ -334,4 +375,4 @@ out_point: OutPoint; | ||
} | ||
type IndexerTransaction<Goruped extends boolean = false> = Goruped extends true ? GroupedIndexerTransaction : UngroupedIndexerTransaction; | ||
interface UngroupedIndexerTransaction { | ||
export type IndexerTransaction<Goruped extends boolean = false> = Goruped extends true ? GroupedIndexerTransaction : UngroupedIndexerTransaction; | ||
export interface UngroupedIndexerTransaction { | ||
tx_hash: Hash256; | ||
@@ -343,3 +384,3 @@ block_number: BlockNumber; | ||
} | ||
interface GroupedIndexerTransaction { | ||
export interface GroupedIndexerTransaction { | ||
tx_hash: Hash256; | ||
@@ -350,11 +391,11 @@ block_number: BlockNumber; | ||
} | ||
interface GetTransactionsResult<Goruped extends boolean = false> { | ||
export interface GetTransactionsResult<Goruped extends boolean = false> { | ||
last_cursor: Hash256; | ||
objects: IndexerTransaction<Goruped>[]; | ||
} | ||
interface GetLiveCellsResult { | ||
export interface GetLiveCellsResult { | ||
last_cursor: Hash256; | ||
objects: IndexerCell[]; | ||
} | ||
interface CellsCapacity { | ||
export interface CellsCapacity { | ||
capacity: Capacity; | ||
@@ -364,6 +405,6 @@ block_hash: Hash256; | ||
} | ||
type HexadecimalRange = [string, string]; | ||
type ScriptType = "type" | "lock"; | ||
type ScriptSearchMode = "prefix" | "exact"; | ||
interface SearchFilter { | ||
export type HexadecimalRange = [string, string]; | ||
export type ScriptType = "type" | "lock"; | ||
export type ScriptSearchMode = "prefix" | "exact"; | ||
export interface SearchFilter { | ||
script?: Script; | ||
@@ -375,3 +416,3 @@ output_data_len_range?: HexadecimalRange; | ||
} | ||
interface SearchKey { | ||
export interface SearchKey { | ||
script: Script; | ||
@@ -382,13 +423,13 @@ script_type: ScriptType; | ||
} | ||
interface GetCellsSearchKey extends SearchKey { | ||
export interface GetCellsSearchKey extends SearchKey { | ||
with_data?: boolean; | ||
} | ||
interface GetTransactionsSearchKey extends SearchKey { | ||
export interface GetTransactionsSearchKey extends SearchKey { | ||
group_by_transaction?: boolean; | ||
} | ||
interface BlockFilter { | ||
export interface BlockFilter { | ||
data: HexString; | ||
hash: Hash; | ||
} | ||
interface TransactionAndWitnessProof { | ||
export interface TransactionAndWitnessProof { | ||
block_hash: Hash; | ||
@@ -398,17 +439,17 @@ transactions_proof: MerkleProof; | ||
} | ||
interface FeeRateStatistics { | ||
export interface FeeRateStatistics { | ||
mean: HexNumber; | ||
median: HexNumber; | ||
} | ||
type HeaderView = Header & { | ||
export type HeaderView = Header & { | ||
hash: Hash; | ||
}; | ||
interface UncleBlockView { | ||
export interface UncleBlockView { | ||
header: HeaderView; | ||
proposals: ProposalShortId[]; | ||
} | ||
type TransactionView = Transaction & { | ||
export type TransactionView = Transaction & { | ||
hash: Hash; | ||
}; | ||
interface BlockView { | ||
export interface BlockView { | ||
header: HeaderView; | ||
@@ -418,8 +459,35 @@ uncles: UncleBlockView[]; | ||
proposals: ProposalShortId[]; | ||
extension: Hash256; | ||
} | ||
type SerializedBlock = HexString; | ||
interface EstimateCycles { | ||
export type SerializedBlock = HexString; | ||
export interface EstimateCycles { | ||
cycles: HexNumber; | ||
} | ||
export type DeploymentPos = "testdummy" | "light_client"; | ||
export type DeploymentState = "defined" | "started" | "locked_in" | "active" | "failed"; | ||
export interface DeploymentsInfo { | ||
hash: Hash256; | ||
epoch: EpochNumber; | ||
deployments: MapLike<DeploymentPos, DeploymentInfo>; | ||
} | ||
export interface DeploymentInfo { | ||
bit: number; | ||
start: EpochNumber; | ||
timeout: EpochNumber; | ||
min_activation_epoch: EpochNumber; | ||
period: EpochNumber; | ||
threshold: Ratio; | ||
since: EpochNumber; | ||
state: DeploymentState; | ||
} | ||
export interface ChainInfo { | ||
chain: string; | ||
median_time: Timestamp; | ||
epoch: EpochNumberWithFraction; | ||
difficulty: U256; | ||
is_initial_block_download: boolean; | ||
alerts: Vec<AlertMessage>; | ||
} | ||
export {}; | ||
} | ||
//# sourceMappingURL=rpc.d.ts.map |
@@ -11,6 +11,6 @@ "use strict"; | ||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
let RPC; | ||
/* eslint-enable camelcase */ | ||
exports.RPC = RPC; | ||
let RPC = exports.RPC = void 0; | ||
(function (_RPC) { | ||
// this is a type to mapping the `HashMap`, `BTreeMap` in `jsonrpc-types` | ||
// there are some returns of CKB RPC are in this format, like `Softfork` | ||
let TransactionStatus = /*#__PURE__*/function (TransactionStatus) { | ||
@@ -20,6 +20,12 @@ TransactionStatus["Pending"] = "pending"; | ||
TransactionStatus["Committed"] = "committed"; | ||
TransactionStatus["Unknown"] = "unknown"; | ||
TransactionStatus["Rejected"] = "rejected"; | ||
return TransactionStatus; | ||
}({}); | ||
_RPC.TransactionStatus = TransactionStatus; | ||
/** | ||
* @deprecated please migrate to {@link ChainInfo} | ||
*/ | ||
/* https://github.com/nervosnetwork/ckb/blob/develop/util/jsonrpc-types/src/info.rs */ | ||
})(RPC || (exports.RPC = RPC = {})); | ||
//# sourceMappingURL=rpc.js.map |
{ | ||
"name": "@ckb-lumos/rpc", | ||
"version": "0.0.0-canary-54f8aff-20230815035108", | ||
"version": "0.0.0-canary-58ff5e4-20240712061301", | ||
"description": "RPC module for CKB", | ||
@@ -29,7 +29,6 @@ "homepage": "https://github.com/ckb-js/lumos#readme", | ||
"dependencies": { | ||
"@ckb-lumos/base": "0.0.0-canary-54f8aff-20230815035108", | ||
"@ckb-lumos/bi": "0.0.0-canary-54f8aff-20230815035108", | ||
"@vespaiach/axios-fetch-adapter": "^0.3.1", | ||
"axios": "0.27.2", | ||
"tslib": "2.3.1" | ||
"@ckb-lumos/base": "0.0.0-canary-58ff5e4-20240712061301", | ||
"@ckb-lumos/bi": "0.0.0-canary-58ff5e4-20240712061301", | ||
"abort-controller": "^3.0.0", | ||
"cross-fetch": "^3.1.5" | ||
}, | ||
@@ -36,0 +35,0 @@ "devDependencies": { |
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
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
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
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
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
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
326146
4
3398
78
2
+ Addedabort-controller@^3.0.0
+ Addedcross-fetch@^3.1.5
+ Added@ckb-lumos/base@0.0.0-canary-58ff5e4-20240712061301(transitive)
+ Added@ckb-lumos/bi@0.0.0-canary-58ff5e4-20240712061301(transitive)
+ Added@ckb-lumos/codec@0.0.0-canary-58ff5e4-20240712061301(transitive)
+ Added@ckb-lumos/toolkit@0.0.0-canary-58ff5e4-20240712061301(transitive)
+ Addedabort-controller@3.0.0(transitive)
+ Addedevent-target-shim@5.0.1(transitive)
- Removedaxios@0.27.2
- Removedtslib@2.3.1
- Removed@ckb-lumos/base@0.0.0-canary-54f8aff-20230815035108(transitive)
- Removed@ckb-lumos/bi@0.0.0-canary-54f8aff-20230815035108(transitive)
- Removed@ckb-lumos/codec@0.0.0-canary-54f8aff-20230815035108(transitive)
- Removed@ckb-lumos/toolkit@0.0.0-canary-54f8aff-20230815035108(transitive)
- Removed@vespaiach/axios-fetch-adapter@0.3.1(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaxios@0.27.2(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedes-set-tostringtag@2.1.0(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedform-data@4.0.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.3.0(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedlodash.isequal@4.5.0(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removedtslib@2.3.1(transitive)