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

@ckb-lumos/base

Package Overview
Dependencies
Maintainers
3
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckb-lumos/base - npm Package Compare versions

Comparing version 0.0.0-canary-1cb43fe-20230816060512 to 0.0.0-canary-1dd7cac-20231209043510

90

lib/api.d.ts

@@ -1,2 +0,2 @@

import { Hash, HexNumber, HexString, PackedSince } from "./primitive";
import { Hash, Hexadecimal, HexNumber, HexString, PackedSince } from "./primitive";
export interface Header {

@@ -16,3 +16,3 @@ timestamp: HexNumber;

}
export type HashType = "type" | "data" | "data1";
export type HashType = "type" | "data" | "data1" | "data2";
export interface Script {

@@ -65,9 +65,13 @@ codeHash: Hash;

}
type Status = "pending" | "proposed" | "committed" | "unknown" | "rejected";
export interface TxStatus {
status: Status;
blockHash?: Hash;
status: string;
reason?: string;
}
export interface TransactionWithStatus {
transaction: Transaction;
export interface TransactionWithStatus<Tx = Transaction> {
transaction: Tx;
txStatus: TxStatus;
timeAddedToPool: Uint64 | null;
cycles: Uint64 | null;
}

@@ -147,6 +151,2 @@ export interface Cell {

genesisHash: Hash;
hardforkFeatures: Array<{
rfc: string;
epochNumber: string | undefined;
}>;
daoTypeHash?: Hash;

@@ -172,3 +172,33 @@ secp256k1Blake160SighashAllTypeHash?: Hash;

permanentDifficultyInDummy: boolean;
hardforkFeatures: HardForks;
softforks: MapLike<DeploymentPos, SoftFork>;
}
export type HardForks = HardforkFeature[];
export interface HardforkFeature {
rfc: string;
epochNumber: EpochNumber | null;
}
export type SoftForkStatus = "buried" | "rfc0043";
export type SoftFork = Buried | Rfc0043;
export type Buried = {
status: SoftForkStatus;
active: boolean;
epoch: EpochNumber;
};
export type Rfc0043 = {
status: SoftForkStatus;
rfc0043: Deployment;
};
export type Ratio = {
numer: Uint64;
denom: Uint64;
};
export type Deployment = {
bit: number;
start: EpochNumber;
timeout: EpochNumber;
minActivationEpoch: EpochNumber;
period: EpochNumber;
threshold: Ratio;
};
export interface DryRunResult {

@@ -265,2 +295,3 @@ cycles: HexNumber;

export type RawTxPool = TxPoolIds | TxPoolVerbosity;
/** https://github.com/nervosnetwork/ckb/blob/develop/util/jsonrpc-types/src/alert.rs **/
export interface AlertMessage {

@@ -272,10 +303,2 @@ id: HexNumber;

}
export interface ChainInfo {
chain: string;
medianTime: HexNumber;
epoch: HexNumber;
difficulty: HexNumber;
isInitialBlockDownload: boolean;
alerts: AlertMessage[];
}
export interface Alert {

@@ -291,2 +314,35 @@ id: HexNumber;

}
/** https://github.com/nervosnetwork/ckb/blob/develop/util/jsonrpc-types/src/info.rs **/
export type DeploymentPos = "testdummy" | "lightClient";
export type DeploymentState = "defined" | "started" | "lockedIn" | "active" | "failed";
export type DeploymentsInfo = {
hash: Hash;
epoch: EpochNumber;
deployments: MapLike<DeploymentPos, DeploymentInfo>;
};
export type DeploymentInfo = {
bit: number;
start: EpochNumber;
timeout: EpochNumber;
minActivationEpoch: EpochNumber;
period: EpochNumber;
threshold: Ratio;
since: EpochNumber;
state: DeploymentState;
};
export interface ChainInfo {
chain: string;
medianTime: HexNumber;
epoch: EpochNumberWithFraction;
difficulty: HexNumber;
isInitialBlockDownload: boolean;
alerts: AlertMessage[];
}
type Uint64 = Hexadecimal;
type EpochNumber = Hexadecimal;
type EpochNumberWithFraction = Uint64;
type MapLike<K extends string, V> = {
[key in K]?: V;
};
export {};
//# sourceMappingURL=api.d.ts.map

@@ -56,2 +56,12 @@ import { AnyCodec, BytesLike, PackParam, UnpackResult } from "@ckb-lumos/codec";

/**
* <pre>
* 0b0000000 0
* ───┬─── │
* │ ▼
* │ type - use the default vm version
* │
* ▼
* data* - use a particular vm version
* </pre>
*
* Implementation of blockchain.mol

@@ -58,0 +68,0 @@ * https://github.com/nervosnetwork/ckb/blob/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol

26

lib/blockchain.js

@@ -90,2 +90,12 @@ "use strict";

/**
* <pre>
* 0b0000000 0
* ───┬─── │
* │ ▼
* │ type - use the default vm version
* │
* ▼
* data* - use a particular vm version
* </pre>
*
* Implementation of blockchain.mol

@@ -98,5 +108,8 @@ * https://github.com/nervosnetwork/ckb/blob/5a7efe7a0b720de79ff3761dc6e8424b8d5b22ea/util/types/schemas/blockchain.mol

pack: type => {
if (type === "data") return Uint8.pack(0);
if (type === "type") return Uint8.pack(1);
if (type === "data1") return Uint8.pack(2);
// prettier-ignore
if (type === "type") return Uint8.pack(0b0000000_1);
// prettier-ignore
if (type === "data") return Uint8.pack(0b0000000_0);
if (type === "data1") return Uint8.pack(0b0000001_0);
if (type === "data2") return Uint8.pack(0b0000010_0);
throw new Error(`Invalid hash type: ${type}`);

@@ -106,5 +119,6 @@ },

const hashTypeBuf = Uint8.unpack(buf);
if (hashTypeBuf === 0) return "data";
if (hashTypeBuf === 1) return "type";
if (hashTypeBuf === 2) return "data1";
if (hashTypeBuf === 0b0000000_1) return "type";
if (hashTypeBuf === 0b0000000_0) return "data";
if (hashTypeBuf === 0b0000001_0) return "data1";
if (hashTypeBuf === 0b0000010_0) return "data2";
throw new Error(`Invalid hash type: ${hashTypeBuf}`);

@@ -111,0 +125,0 @@ }

{
"name": "@ckb-lumos/base",
"version": "0.0.0-canary-1cb43fe-20230816060512",
"version": "0.0.0-canary-1dd7cac-20231209043510",
"description": "Base data structures and utilities used in lumos",

@@ -38,5 +38,5 @@ "author": "Xuejie Xiao <xxuejie@gmail.com>",

"dependencies": {
"@ckb-lumos/bi": "0.0.0-canary-1cb43fe-20230816060512",
"@ckb-lumos/codec": "0.0.0-canary-1cb43fe-20230816060512",
"@ckb-lumos/toolkit": "0.0.0-canary-1cb43fe-20230816060512",
"@ckb-lumos/bi": "0.0.0-canary-1dd7cac-20231209043510",
"@ckb-lumos/codec": "0.0.0-canary-1dd7cac-20231209043510",
"@ckb-lumos/toolkit": "0.0.0-canary-1dd7cac-20231209043510",
"@types/blake2b": "^2.1.0",

@@ -43,0 +43,0 @@ "@types/lodash.isequal": "^4.5.5",

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