@0xsequence/migration
Advanced tools
Comparing version
@@ -43,3 +43,3 @@ 'use strict'; | ||
const context = contexts[2]; | ||
const contract = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi); | ||
const contract = new ethers.ethers.Interface(abi.walletContracts.mainModule.abi); | ||
@@ -74,12 +74,12 @@ // WARNING: v1 wallets CAN NOT use v2 configurations so we ALWAYS need to update | ||
} | ||
if (!tx.nonce || !core.commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0).eq(tx.nonce)) { | ||
if (!tx.nonce || core.commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0) !== BigInt(tx.nonce)) { | ||
throw new Error('Invalid transaction bundle nonce'); | ||
} | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && !ethers.ethers.constants.Zero.eq(tx.transactions[0].value) || tx.transactions[1].value && !ethers.ethers.constants.Zero.eq(tx.transactions[1].value) || tx.transactions[0].gasLimit && !ethers.ethers.constants.Zero.eq(tx.transactions[0].gasLimit) || tx.transactions[1].gasLimit && !ethers.ethers.constants.Zero.eq(tx.transactions[1].gasLimit)) { | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && BigInt(tx.transactions[0].value) !== 0n || tx.transactions[1].value && BigInt(tx.transactions[1].value) !== 0n || tx.transactions[0].gasLimit && BigInt(tx.transactions[0].gasLimit) !== 0n || tx.transactions[1].gasLimit && BigInt(tx.transactions[1].gasLimit) !== 0n) { | ||
throw new Error('Invalid transaction bundle format'); | ||
} | ||
const context = contexts[2]; | ||
const contract = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi); | ||
const data1 = ethers.ethers.utils.hexlify(tx.transactions[0].data || []); | ||
const expectData1 = ethers.ethers.utils.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
const contract = new ethers.ethers.Interface(abi.walletContracts.mainModule.abi); | ||
const data1 = ethers.ethers.hexlify(tx.transactions[0].data || new Uint8Array()); | ||
const expectData1 = ethers.ethers.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
if (data1 !== expectData1) { | ||
@@ -86,0 +86,0 @@ throw new Error('Invalid new implementation on transaction'); |
@@ -43,3 +43,3 @@ 'use strict'; | ||
const context = contexts[2]; | ||
const contract = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi); | ||
const contract = new ethers.ethers.Interface(abi.walletContracts.mainModule.abi); | ||
@@ -74,12 +74,12 @@ // WARNING: v1 wallets CAN NOT use v2 configurations so we ALWAYS need to update | ||
} | ||
if (!tx.nonce || !core.commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0).eq(tx.nonce)) { | ||
if (!tx.nonce || core.commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0) !== BigInt(tx.nonce)) { | ||
throw new Error('Invalid transaction bundle nonce'); | ||
} | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && !ethers.ethers.constants.Zero.eq(tx.transactions[0].value) || tx.transactions[1].value && !ethers.ethers.constants.Zero.eq(tx.transactions[1].value) || tx.transactions[0].gasLimit && !ethers.ethers.constants.Zero.eq(tx.transactions[0].gasLimit) || tx.transactions[1].gasLimit && !ethers.ethers.constants.Zero.eq(tx.transactions[1].gasLimit)) { | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && BigInt(tx.transactions[0].value) !== 0n || tx.transactions[1].value && BigInt(tx.transactions[1].value) !== 0n || tx.transactions[0].gasLimit && BigInt(tx.transactions[0].gasLimit) !== 0n || tx.transactions[1].gasLimit && BigInt(tx.transactions[1].gasLimit) !== 0n) { | ||
throw new Error('Invalid transaction bundle format'); | ||
} | ||
const context = contexts[2]; | ||
const contract = new ethers.ethers.utils.Interface(abi.walletContracts.mainModule.abi); | ||
const data1 = ethers.ethers.utils.hexlify(tx.transactions[0].data || []); | ||
const expectData1 = ethers.ethers.utils.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
const contract = new ethers.ethers.Interface(abi.walletContracts.mainModule.abi); | ||
const data1 = ethers.ethers.hexlify(tx.transactions[0].data || new Uint8Array()); | ||
const expectData1 = ethers.ethers.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
if (data1 !== expectData1) { | ||
@@ -86,0 +86,0 @@ throw new Error('Invalid new implementation on transaction'); |
@@ -39,3 +39,3 @@ import { commons, v2 } from '@0xsequence/core'; | ||
const context = contexts[2]; | ||
const contract = new ethers.utils.Interface(walletContracts.mainModule.abi); | ||
const contract = new ethers.Interface(walletContracts.mainModule.abi); | ||
@@ -70,12 +70,12 @@ // WARNING: v1 wallets CAN NOT use v2 configurations so we ALWAYS need to update | ||
} | ||
if (!tx.nonce || !commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0).eq(tx.nonce)) { | ||
if (!tx.nonce || commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0) !== BigInt(tx.nonce)) { | ||
throw new Error('Invalid transaction bundle nonce'); | ||
} | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && !ethers.constants.Zero.eq(tx.transactions[0].value) || tx.transactions[1].value && !ethers.constants.Zero.eq(tx.transactions[1].value) || tx.transactions[0].gasLimit && !ethers.constants.Zero.eq(tx.transactions[0].gasLimit) || tx.transactions[1].gasLimit && !ethers.constants.Zero.eq(tx.transactions[1].gasLimit)) { | ||
if (tx.transactions[0].to !== address || tx.transactions[1].to !== address || tx.transactions[0].delegateCall || tx.transactions[1].delegateCall || !tx.transactions[0].revertOnError || !tx.transactions[1].revertOnError || tx.transactions[0].value && BigInt(tx.transactions[0].value) !== 0n || tx.transactions[1].value && BigInt(tx.transactions[1].value) !== 0n || tx.transactions[0].gasLimit && BigInt(tx.transactions[0].gasLimit) !== 0n || tx.transactions[1].gasLimit && BigInt(tx.transactions[1].gasLimit) !== 0n) { | ||
throw new Error('Invalid transaction bundle format'); | ||
} | ||
const context = contexts[2]; | ||
const contract = new ethers.utils.Interface(walletContracts.mainModule.abi); | ||
const data1 = ethers.utils.hexlify(tx.transactions[0].data || []); | ||
const expectData1 = ethers.utils.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
const contract = new ethers.Interface(walletContracts.mainModule.abi); | ||
const data1 = ethers.hexlify(tx.transactions[0].data || new Uint8Array()); | ||
const expectData1 = ethers.hexlify(contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable])); | ||
if (data1 !== expectData1) { | ||
@@ -82,0 +82,0 @@ throw new Error('Invalid new implementation on transaction'); |
import { commons } from '@0xsequence/core'; | ||
import { Wallet } from '@0xsequence/wallet'; | ||
import { Migration } from "./migrations/index.js"; | ||
import { ethers } from 'ethers'; | ||
import { Migration } from "./migrations/index.js"; | ||
export type UnsignedMigration = { | ||
@@ -6,0 +6,0 @@ tx: commons.transaction.TransactionBundle; |
{ | ||
"name": "@0xsequence/migration", | ||
"version": "0.0.0-20240613131211", | ||
"version": "0.0.0-20240613194955", | ||
"description": "tools for migrating sequence wallets to new versions", | ||
@@ -12,6 +12,6 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/migration", | ||
"dependencies": { | ||
"ethers": "^5.5.2", | ||
"@0xsequence/abi": "0.0.0-20240613131211", | ||
"@0xsequence/core": "0.0.0-20240613131211", | ||
"@0xsequence/wallet": "0.0.0-20240613131211" | ||
"ethers": "^6.13.0", | ||
"@0xsequence/abi": "0.0.0-20240613194955", | ||
"@0xsequence/core": "0.0.0-20240613194955", | ||
"@0xsequence/wallet": "0.0.0-20240613194955" | ||
}, | ||
@@ -18,0 +18,0 @@ "devDependencies": { |
@@ -31,3 +31,3 @@ import { commons, v1, v2 } from '@0xsequence/core' | ||
const context = contexts[2] | ||
const contract = new ethers.utils.Interface(walletContracts.mainModule.abi) | ||
const contract = new ethers.Interface(walletContracts.mainModule.abi) | ||
@@ -49,3 +49,3 @@ // WARNING: v1 wallets CAN NOT use v2 configurations so we ALWAYS need to update | ||
delegateCall: false, | ||
data: contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable]) | ||
data: contract.encodeFunctionData(contract.getFunction('updateImplementation')!, [context.mainModuleUpgradable]) | ||
}, | ||
@@ -77,3 +77,3 @@ ...updateBundle.transactions | ||
if (!tx.nonce || !commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0).eq(tx.nonce)) { | ||
if (!tx.nonce || commons.transaction.encodeNonce(MIGRATION_NONCE_SPACE, 0) !== BigInt(tx.nonce)) { | ||
throw new Error('Invalid transaction bundle nonce') | ||
@@ -89,6 +89,6 @@ } | ||
!tx.transactions[1].revertOnError || | ||
(tx.transactions[0].value && !ethers.constants.Zero.eq(tx.transactions[0].value)) || | ||
(tx.transactions[1].value && !ethers.constants.Zero.eq(tx.transactions[1].value)) || | ||
(tx.transactions[0].gasLimit && !ethers.constants.Zero.eq(tx.transactions[0].gasLimit)) || | ||
(tx.transactions[1].gasLimit && !ethers.constants.Zero.eq(tx.transactions[1].gasLimit)) | ||
(tx.transactions[0].value && BigInt(tx.transactions[0].value) !== 0n) || | ||
(tx.transactions[1].value && BigInt(tx.transactions[1].value) !== 0n) || | ||
(tx.transactions[0].gasLimit && BigInt(tx.transactions[0].gasLimit) !== 0n) || | ||
(tx.transactions[1].gasLimit && BigInt(tx.transactions[1].gasLimit) !== 0n) | ||
) { | ||
@@ -99,7 +99,7 @@ throw new Error('Invalid transaction bundle format') | ||
const context = contexts[2] | ||
const contract = new ethers.utils.Interface(walletContracts.mainModule.abi) | ||
const contract = new ethers.Interface(walletContracts.mainModule.abi) | ||
const data1 = ethers.utils.hexlify(tx.transactions[0].data || []) | ||
const expectData1 = ethers.utils.hexlify( | ||
contract.encodeFunctionData(contract.getFunction('updateImplementation'), [context.mainModuleUpgradable]) | ||
const data1 = ethers.hexlify(tx.transactions[0].data || new Uint8Array()) | ||
const expectData1 = ethers.hexlify( | ||
contract.encodeFunctionData(contract.getFunction('updateImplementation')!, [context.mainModuleUpgradable]) | ||
) | ||
@@ -106,0 +106,0 @@ |
import { commons } from '@0xsequence/core' | ||
import { Wallet } from '@0xsequence/wallet' | ||
import { ethers } from 'ethers' | ||
import { Migration } from './migrations' | ||
import { ethers } from 'ethers' | ||
@@ -7,0 +7,0 @@ export type UnsignedMigration = { |
@@ -1,2 +0,1 @@ | ||
import { ethers } from 'ethers' | ||
import { commons } from '@0xsequence/core' | ||
@@ -3,0 +2,0 @@ |
49351
-0.58%937
-0.43%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated