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

@aresrpg/sui-checkpoint-reader

Package Overview
Dependencies
Maintainers
0
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aresrpg/sui-checkpoint-reader - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

src/bcs-checkpoints.js

30

package.json
{
"name": "@aresrpg/sui-checkpoint-reader",
"version": "3.3.0",
"version": "3.3.1",
"description": "",

@@ -12,2 +12,3 @@ "main": "src/index.js",

"format": "prettier . --write && eslint . --fix",
"generate": "node ./src/bcs-generator.js",
"postversion": "git push --follow-tags"

@@ -36,21 +37,22 @@ },

"dependencies": {
"@mongodb-js/zstd": "^1.2.0",
"@mysten/bcs": "^1.0.2",
"chokidar": "^3.6.0",
"classic-level": "^1.4.1"
"@mongodb-js/zstd": "^1.2.2",
"@mysten/bcs": "^1.0.4",
"chokidar": "^4.0.0",
"classic-level": "^1.4.1",
"yaml": "^2.5.1"
},
"devDependencies": {
"@types/node": "^20.14.10",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"eslint": "^8.57.0",
"@types/node": "^22.5.5",
"@typescript-eslint/eslint-plugin": "^8.6.0",
"@typescript-eslint/parser": "^8.6.0",
"eslint": "^8.57.1",
"eslint-config-prettier": "9.1.0",
"eslint-config-standard": "17.1.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-import": "2.30.0",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "6.4.0",
"eslint-plugin-promise": "^6.6.0",
"husky": "^4.3.8",
"lint-staged": "15.2.7",
"prettier": "3.3.2",
"typescript": "5.5.3"
"lint-staged": "15.2.10",
"prettier": "3.3.3",
"typescript": "5.6.2"
},

@@ -57,0 +59,0 @@ "husky": {

@@ -11,9 +11,5 @@ import { setInterval, setTimeout } from 'timers/promises'

import standard_bcs from './generated/0x1.js'
import {
BLOB_ENCODING_BCS,
CheckpointData,
read_blob,
SuiAddress,
} from './bcs.js'
import { get_local_checkpoints } from './get_local_checkpoints.js'
import { SuiAddress } from './generated/bcs-sui.js'
import { CheckpointData } from './bcs-checkpoints.js'

@@ -39,3 +35,4 @@ function mapper(object_source, mappings) {

const to_address = bytes => `0x${toHEX(bytes)}`
// @ts-ignore
const to_address = bytes => (Array.isArray(bytes) ? `0x${toHEX(bytes)}` : bytes)

@@ -84,3 +81,3 @@ function parse_content(struct, { contents, known_types }) {

if (!found_bcs) return
if (!found_bcs?.parse) return

@@ -193,3 +190,3 @@ const parsed = found_bcs.parse(new Uint8Array(contents))

const final_contents = bcs
const final_contents = bcs?.parse
? Object.fromEntries(

@@ -457,3 +454,4 @@ Object.entries(bcs.parse(new Uint8Array(contents))).map(

console.error(
'Error while processing checkpoint, this should never happen and is an internal problem:',
'/!\\ Error while processing checkpoint, this should never happen and is an internal problem of the sui-checkpoint-reader lib:',
'\ncurrent checkpoint:',
current_checkpoint_number,

@@ -496,2 +494,15 @@ error,

// https://github.com/MystenLabs/sui/blob/testnet-v1.28.3/crates/sui-storage/src/blob.rs#L19
const BLOB_ENCODING_BCS = 1
// https://github.com/MystenLabs/sui/blob/testnet-v1.28.3/crates/sui-storage/src/blob.rs#L78-L85
function read_blob(buffer) {
const view = new Uint8Array(buffer)
return {
encoding: view[0],
// TODO: subarray seems to cause an issue with the bcs library
data: view.slice(1),
}
}
function read_checkpoint(buffer, known_types, object_filter) {

@@ -502,2 +513,4 @@ const { encoding, data } = read_blob(buffer)

console.dir({ encoding, data })
const { checkpoint_summary, checkpoint_contents, transactions } =

@@ -521,4 +534,6 @@ CheckpointData.parse(data)

const get_object_digest = id => {
console.dir(mapped, { depth: Infinity })
const object_write =
mapped.effects.V2.changed_objects[id]?.output_state?.ObjectWrite ?? {}
mapped.effects.V2?.changed_objects[id]?.output_state?.ObjectWrite ??
{}
return Object.keys(object_write)[0]

@@ -525,0 +540,0 @@ }

import { existsSync } from 'fs'
import { mkdir, readFile, writeFile } from 'fs/promises'
import { Manifest } from '../bcs.js'
import { Manifest } from '../bcs-checkpoints.js'

@@ -6,0 +6,0 @@ async function fetch_manifest({ network, epoch }) {

import { decompress as zstdDecompress } from '@mongodb-js/zstd'
import { toB58, toHEX } from '@mysten/bcs'
import { LiveObject } from '../bcs.js'
import { LiveObject } from '../bcs-checkpoints.js'

@@ -6,0 +6,0 @@ const BLOB_ENCODING_BCS = 1

@@ -21,3 +21,3 @@ export function parse_reference({ buffer, file_compression }: {

name: string;
type_params: any[];
type_args: any[];
};

@@ -24,0 +24,0 @@ GasCoin: unknown;

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