Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@0xsequence/migration

Package Overview
Dependencies
Maintainers
5
Versions
298
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xsequence/migration - npm Package Compare versions

Comparing version 0.0.0-20230417133433 to 0.0.0-20230504182418

30

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

@@ -5,33 +5,6 @@ 'use strict';

var core = require('@0xsequence/core');
var ethers = require('ethers');
var core = require('@0xsequence/core');
var abi = require('@0xsequence/abi');
async function versionOf(address, firstImageHash, contexts, reader) {
if (!core.commons.context.isValidVersionedContext(contexts)) {
throw new Error("Invalid versioned context");
}
const versions = Object.values(contexts);
// if not deployed we need to check to which version
// the counterfactual address belongs to
if (!(await reader.isDeployed(address))) {
return counterfactualVersion(address, firstImageHash, versions);
}
// if deployed we need to check the implementation address
const implementation = await reader.implementation(address);
if (!implementation || implementation === ethers.ethers.constants.AddressZero) {
throw new Error('Invalid implementation address');
}
for (let i = 0; i < versions.length; i++) {
if (versions[i].mainModule === implementation || versions[i].mainModuleUpgradable === implementation) {
return versions[i].version;
}
}
// If we can't find the version then either the address is invalid,
// or the version is not in VersionedContext
throw new Error('Could not find version for deployed address');
}
function counterfactualVersion(address, firstImageHash, versions) {

@@ -51,3 +24,2 @@ for (let i = 0; i < versions.length; i++) {

__proto__: null,
versionOf: versionOf,
counterfactualVersion: counterfactualVersion

@@ -54,0 +26,0 @@ });

@@ -5,33 +5,6 @@ 'use strict';

var core = require('@0xsequence/core');
var ethers = require('ethers');
var core = require('@0xsequence/core');
var abi = require('@0xsequence/abi');
async function versionOf(address, firstImageHash, contexts, reader) {
if (!core.commons.context.isValidVersionedContext(contexts)) {
throw new Error("Invalid versioned context");
}
const versions = Object.values(contexts);
// if not deployed we need to check to which version
// the counterfactual address belongs to
if (!(await reader.isDeployed(address))) {
return counterfactualVersion(address, firstImageHash, versions);
}
// if deployed we need to check the implementation address
const implementation = await reader.implementation(address);
if (!implementation || implementation === ethers.ethers.constants.AddressZero) {
throw new Error('Invalid implementation address');
}
for (let i = 0; i < versions.length; i++) {
if (versions[i].mainModule === implementation || versions[i].mainModuleUpgradable === implementation) {
return versions[i].version;
}
}
// If we can't find the version then either the address is invalid,
// or the version is not in VersionedContext
throw new Error('Could not find version for deployed address');
}
function counterfactualVersion(address, firstImageHash, versions) {

@@ -51,3 +24,2 @@ for (let i = 0; i < versions.length; i++) {

__proto__: null,
versionOf: versionOf,
counterfactualVersion: counterfactualVersion

@@ -54,0 +26,0 @@ });

@@ -0,32 +1,5 @@

import { commons, v2 } from '@0xsequence/core';
import { ethers } from 'ethers';
import { commons, v2 } from '@0xsequence/core';
import { walletContracts } from '@0xsequence/abi';
async function versionOf(address, firstImageHash, contexts, reader) {
if (!commons.context.isValidVersionedContext(contexts)) {
throw new Error("Invalid versioned context");
}
const versions = Object.values(contexts);
// if not deployed we need to check to which version
// the counterfactual address belongs to
if (!(await reader.isDeployed(address))) {
return counterfactualVersion(address, firstImageHash, versions);
}
// if deployed we need to check the implementation address
const implementation = await reader.implementation(address);
if (!implementation || implementation === ethers.constants.AddressZero) {
throw new Error('Invalid implementation address');
}
for (let i = 0; i < versions.length; i++) {
if (versions[i].mainModule === implementation || versions[i].mainModuleUpgradable === implementation) {
return versions[i].version;
}
}
// If we can't find the version then either the address is invalid,
// or the version is not in VersionedContext
throw new Error('Could not find version for deployed address');
}
function counterfactualVersion(address, firstImageHash, versions) {

@@ -46,3 +19,2 @@ for (let i = 0; i < versions.length; i++) {

__proto__: null,
versionOf: versionOf,
counterfactualVersion: counterfactualVersion

@@ -49,0 +21,0 @@ });

import { commons } from '@0xsequence/core';
export declare function versionOf(address: string, firstImageHash: string, contexts: commons.context.VersionedContext, reader: commons.reader.Reader): Promise<number>;
export declare function counterfactualVersion(address: string, firstImageHash: string, versions: commons.context.WalletContext[]): number;

@@ -4,0 +3,0 @@ export interface Version<C extends commons.config.Config, S extends commons.signature.Signature<C>, U extends commons.signature.UnrecoveredSignature> {

8

package.json
{
"name": "@0xsequence/migration",
"version": "0.0.0-20230417133433",
"version": "0.0.0-20230504182418",
"description": "tools for migrating sequence wallets to new versions",

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

"ethers": "^5.5.2",
"@0xsequence/abi": "0.0.0-20230417133433",
"@0xsequence/wallet": "0.0.0-20230417133433",
"@0xsequence/core": "0.0.0-20230417133433"
"@0xsequence/abi": "0.0.0-20230504182418",
"@0xsequence/core": "0.0.0-20230504182418",
"@0xsequence/wallet": "0.0.0-20230504182418"
},

@@ -18,0 +18,0 @@ "devDependencies": {

import { ethers } from "ethers"
import { commons } from '@0xsequence/core'
export async function versionOf(
address: string,
firstImageHash: string,
contexts: commons.context.VersionedContext,
reader: commons.reader.Reader
): Promise<number> {
if (!commons.context.isValidVersionedContext(contexts)) {
throw new Error("Invalid versioned context")
}
const versions = Object.values(contexts)
// if not deployed we need to check to which version
// the counterfactual address belongs to
if (!(await reader.isDeployed(address))) {
return counterfactualVersion(address, firstImageHash, versions)
}
// if deployed we need to check the implementation address
const implementation = await reader.implementation(address)
if (!implementation || implementation === ethers.constants.AddressZero) {
throw new Error('Invalid implementation address')
}
for (let i = 0; i < versions.length; i++) {
if (versions[i].mainModule === implementation || versions[i].mainModuleUpgradable === implementation) {
return versions[i].version
}
}
// If we can't find the version then either the address is invalid,
// or the version is not in VersionedContext
throw new Error('Could not find version for deployed address')
}
export function counterfactualVersion(

@@ -40,0 +5,0 @@ address: string,

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