Socket
Socket
Sign inDemoInstall

@0xsequence/sessions

Package Overview
Dependencies
Maintainers
5
Versions
262
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xsequence/sessions - npm Package Compare versions

Comparing version 0.0.0-20230621190344 to 0.0.0-20230621213028

15

dist/0xsequence-sessions.cjs.dev.js

@@ -309,3 +309,3 @@ 'use strict';

function isPlainV2Config(config) {
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined;
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined && typeof config.tree === 'string';
}

@@ -405,4 +405,12 @@

// if they share information
const imageHash = core.v2.config.ConfigCoder.imageHashOf(config);
// This is an optimization, it allows us to avoid splitting the tree if it's already complete
let storeConfigFullPromise;
if (!core.v2.config.isComplete(config.tree)) {
storeConfigFullPromise = _this.store.saveConfig(imageHash, config);
}
const storeTree = _this.saveTopology(config.tree);
const storeConfig = _this.store.saveConfig(core.v2.config.ConfigCoder.imageHashOf(config), {
const storeConfig = _this.store.saveConfig(imageHash, {
version: 2,

@@ -414,2 +422,3 @@ threshold: ethers.ethers.BigNumber.from(config.threshold).toString(),

await Promise.all([storeTree, storeConfig]);
await storeConfigFullPromise;
}

@@ -424,3 +433,3 @@ return;

if (!config) return undefined;
if (config.version === 1) {
if (config.version === 1 || config.version === 2 && !isPlainV2Config(config)) {
return config;

@@ -427,0 +436,0 @@ }

@@ -309,3 +309,3 @@ 'use strict';

function isPlainV2Config(config) {
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined;
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined && typeof config.tree === 'string';
}

@@ -405,4 +405,12 @@

// if they share information
const imageHash = core.v2.config.ConfigCoder.imageHashOf(config);
// This is an optimization, it allows us to avoid splitting the tree if it's already complete
let storeConfigFullPromise;
if (!core.v2.config.isComplete(config.tree)) {
storeConfigFullPromise = _this.store.saveConfig(imageHash, config);
}
const storeTree = _this.saveTopology(config.tree);
const storeConfig = _this.store.saveConfig(core.v2.config.ConfigCoder.imageHashOf(config), {
const storeConfig = _this.store.saveConfig(imageHash, {
version: 2,

@@ -414,2 +422,3 @@ threshold: ethers.ethers.BigNumber.from(config.threshold).toString(),

await Promise.all([storeTree, storeConfig]);
await storeConfigFullPromise;
}

@@ -424,3 +433,3 @@ return;

if (!config) return undefined;
if (config.version === 1) {
if (config.version === 1 || config.version === 2 && !isPlainV2Config(config)) {
return config;

@@ -427,0 +436,0 @@ }

@@ -305,3 +305,3 @@ import { v2, v1, universal, commons } from '@0xsequence/core';

function isPlainV2Config(config) {
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined;
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined && typeof config.tree === 'string';
}

@@ -401,4 +401,12 @@

// if they share information
const imageHash = v2.config.ConfigCoder.imageHashOf(config);
// This is an optimization, it allows us to avoid splitting the tree if it's already complete
let storeConfigFullPromise;
if (!v2.config.isComplete(config.tree)) {
storeConfigFullPromise = _this.store.saveConfig(imageHash, config);
}
const storeTree = _this.saveTopology(config.tree);
const storeConfig = _this.store.saveConfig(v2.config.ConfigCoder.imageHashOf(config), {
const storeConfig = _this.store.saveConfig(imageHash, {
version: 2,

@@ -410,2 +418,3 @@ threshold: ethers.BigNumber.from(config.threshold).toString(),

await Promise.all([storeTree, storeConfig]);
await storeConfigFullPromise;
}

@@ -420,3 +429,3 @@ return;

if (!config) return undefined;
if (config.version === 1) {
if (config.version === 1 || config.version === 2 && !isPlainV2Config(config)) {
return config;

@@ -423,0 +432,0 @@ }

4

dist/declarations/src/trackers/stores/index.d.ts

@@ -22,4 +22,4 @@ import { commons, v1, v2 } from "@0xsequence/core";

export interface TrackerStore {
loadConfig: (imageHash: string) => Promise<v1.config.WalletConfig | PlainV2Config | undefined>;
saveConfig: (imageHash: string, config: v1.config.WalletConfig | PlainV2Config) => Promise<void>;
loadConfig: (imageHash: string) => Promise<v1.config.WalletConfig | PlainV2Config | v2.config.WalletConfig | undefined>;
saveConfig: (imageHash: string, config: v1.config.WalletConfig | PlainV2Config | v2.config.WalletConfig) => Promise<void>;
loadV2Node: (nodeHash: string) => Promise<PlainNode | PlainNested | v2.config.Topology | undefined>;

@@ -26,0 +26,0 @@ saveV2Node: (nodeHash: string, node: PlainNode | PlainNested | v2.config.Topology) => Promise<void>;

{
"name": "@0xsequence/sessions",
"version": "0.0.0-20230621190344",
"version": "0.0.0-20230621213028",
"description": "tools for migrating sequence wallets to new versions",

@@ -14,5 +14,5 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/sessions",

"idb": "^7.1.1",
"@0xsequence/core": "0.0.0-20230621190344",
"@0xsequence/migration": "0.0.0-20230621190344",
"@0xsequence/replacer": "0.0.0-20230621190344"
"@0xsequence/core": "0.0.0-20230621213028",
"@0xsequence/migration": "0.0.0-20230621213028",
"@0xsequence/replacer": "0.0.0-20230621213028"
},

@@ -23,4 +23,4 @@ "devDependencies": {

"nyc": "^15.1.0",
"@0xsequence/signhub": "0.0.0-20230621190344",
"@0xsequence/tests": "0.0.0-20230621190344"
"@0xsequence/signhub": "0.0.0-20230621213028",
"@0xsequence/tests": "0.0.0-20230621213028"
},

@@ -27,0 +27,0 @@ "files": [

@@ -106,4 +106,13 @@ import { commons, universal, v1, v2 } from '@0xsequence/core'

// if they share information
const imageHash = v2.config.ConfigCoder.imageHashOf(config)
// This is an optimization, it allows us to avoid splitting the tree if it's already complete
let storeConfigFullPromise: Promise<void> | undefined
if (!v2.config.isComplete(config.tree)) {
storeConfigFullPromise = this.store.saveConfig(imageHash, config)
}
const storeTree = this.saveTopology(config.tree)
const storeConfig = this.store.saveConfig(v2.config.ConfigCoder.imageHashOf(config), {
const storeConfig = this.store.saveConfig(imageHash, {
version: 2,

@@ -116,2 +125,3 @@ threshold: ethers.BigNumber.from(config.threshold).toString(),

await Promise.all([storeTree, storeConfig])
await storeConfigFullPromise
}

@@ -130,3 +140,3 @@

if (config.version === 1) {
if (config.version === 1 || (config.version === 2 && !isPlainV2Config(config))) {
return config

@@ -133,0 +143,0 @@ }

@@ -31,3 +31,9 @@ import { commons, v1, v2 } from "@0xsequence/core"

export function isPlainV2Config(config: any): config is PlainV2Config {
return config.version === 2 && config.threshold !== undefined && config.checkpoint !== undefined && config.tree !== undefined
return (
config.version === 2 &&
config.threshold !== undefined &&
config.checkpoint !== undefined &&
config.tree !== undefined &&
typeof config.tree === 'string'
)
}

@@ -37,4 +43,4 @@

// top level configurations store
loadConfig: (imageHash: string) => Promise<v1.config.WalletConfig | PlainV2Config | undefined>
saveConfig: (imageHash: string, config: v1.config.WalletConfig | PlainV2Config) => Promise<void>
loadConfig: (imageHash: string) => Promise<v1.config.WalletConfig | PlainV2Config | v2.config.WalletConfig | undefined>
saveConfig: (imageHash: string, config: v1.config.WalletConfig | PlainV2Config | v2.config.WalletConfig) => Promise<void>

@@ -41,0 +47,0 @@ // v2 configurations store

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