@0xsequence/account 2.3.8 → 2.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -75,17 +75,17 @@ class AccountSigner {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Signs a message.
|
|
78
|
-
*
|
|
78
|
+
*
|
|
79
79
|
* This method will sign the message using the account associated with this signer
|
|
80
80
|
* and the specified chain ID. The message is already being prefixed with the EIP-191 prefix.
|
|
81
|
-
*
|
|
81
|
+
*
|
|
82
82
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
83
83
|
* @returns A Promise that resolves to the signature as a hexadecimal string
|
|
84
|
-
*
|
|
84
|
+
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```typescript
|
|
87
87
|
* const signer = account.getSigner(chainId)
|
|
88
|
-
*
|
|
88
|
+
*
|
|
89
89
|
* const message = "Hello, Sequence!";
|
|
90
90
|
* const signature = await signer.signMessage(message);
|
|
91
91
|
* console.log(signature);
|
|
@@ -803,11 +803,11 @@ class Account {
|
|
|
803
803
|
|
|
804
804
|
/**
|
|
805
805
|
* Signs a message.
|
|
806
|
-
*
|
|
806
|
+
*
|
|
807
807
|
* This method will sign the message using the account associated with this signer
|
|
808
|
-
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
808
|
+
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
809
809
|
* prefix, it will be hashed directly. Otherwise, it will be prefixed before hashing.
|
|
810
|
-
*
|
|
810
|
+
*
|
|
811
811
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
812
812
|
* @param chainId - The chain ID to use for signing
|
|
813
813
|
* @param cantValidateBehavior - Behavior when the wallet cannot validate on-chain
|
|
@@ -75,17 +75,17 @@ class AccountSigner {
|
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Signs a message.
|
|
78
|
-
*
|
|
78
|
+
*
|
|
79
79
|
* This method will sign the message using the account associated with this signer
|
|
80
80
|
* and the specified chain ID. The message is already being prefixed with the EIP-191 prefix.
|
|
81
|
-
*
|
|
81
|
+
*
|
|
82
82
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
83
83
|
* @returns A Promise that resolves to the signature as a hexadecimal string
|
|
84
|
-
*
|
|
84
|
+
*
|
|
85
85
|
* @example
|
|
86
86
|
* ```typescript
|
|
87
87
|
* const signer = account.getSigner(chainId)
|
|
88
|
-
*
|
|
88
|
+
*
|
|
89
89
|
* const message = "Hello, Sequence!";
|
|
90
90
|
* const signature = await signer.signMessage(message);
|
|
91
91
|
* console.log(signature);
|
|
@@ -803,11 +803,11 @@ class Account {
|
|
|
803
803
|
|
|
804
804
|
/**
|
|
805
805
|
* Signs a message.
|
|
806
|
-
*
|
|
806
|
+
*
|
|
807
807
|
* This method will sign the message using the account associated with this signer
|
|
808
|
-
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
808
|
+
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
809
809
|
* prefix, it will be hashed directly. Otherwise, it will be prefixed before hashing.
|
|
810
|
-
*
|
|
810
|
+
*
|
|
811
811
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
812
812
|
* @param chainId - The chain ID to use for signing
|
|
813
813
|
* @param cantValidateBehavior - Behavior when the wallet cannot validate on-chain
|
|
@@ -71,17 +71,17 @@ class AccountSigner {
|
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Signs a message.
|
|
74
|
-
*
|
|
74
|
+
*
|
|
75
75
|
* This method will sign the message using the account associated with this signer
|
|
76
76
|
* and the specified chain ID. The message is already being prefixed with the EIP-191 prefix.
|
|
77
|
-
*
|
|
77
|
+
*
|
|
78
78
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
79
79
|
* @returns A Promise that resolves to the signature as a hexadecimal string
|
|
80
|
-
*
|
|
80
|
+
*
|
|
81
81
|
* @example
|
|
82
82
|
* ```typescript
|
|
83
83
|
* const signer = account.getSigner(chainId)
|
|
84
|
-
*
|
|
84
|
+
*
|
|
85
85
|
* const message = "Hello, Sequence!";
|
|
86
86
|
* const signature = await signer.signMessage(message);
|
|
87
87
|
* console.log(signature);
|
|
@@ -799,11 +799,11 @@ class Account {
|
|
|
799
799
|
|
|
800
800
|
/**
|
|
801
801
|
* Signs a message.
|
|
802
|
-
*
|
|
802
|
+
*
|
|
803
803
|
* This method will sign the message using the account associated with this signer
|
|
804
|
-
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
804
|
+
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
805
805
|
* prefix, it will be hashed directly. Otherwise, it will be prefixed before hashing.
|
|
806
|
-
*
|
|
806
|
+
*
|
|
807
807
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
808
808
|
* @param chainId - The chain ID to use for signing
|
|
809
809
|
* @param cantValidateBehavior - Behavior when the wallet cannot validate on-chain
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xsequence/account",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.10",
|
|
4
4
|
"description": "tools for migrating sequence wallets to new versions",
|
|
5
5
|
"repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/account",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
"ethers": ">=6"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@0xsequence/abi": "2.3.
|
|
16
|
-
"@0xsequence/
|
|
17
|
-
"@0xsequence/
|
|
18
|
-
"@0xsequence/
|
|
19
|
-
"@0xsequence/
|
|
20
|
-
"@0xsequence/
|
|
21
|
-
"@0xsequence/
|
|
22
|
-
"@0xsequence/
|
|
15
|
+
"@0xsequence/abi": "2.3.10",
|
|
16
|
+
"@0xsequence/core": "2.3.10",
|
|
17
|
+
"@0xsequence/network": "2.3.10",
|
|
18
|
+
"@0xsequence/sessions": "2.3.10",
|
|
19
|
+
"@0xsequence/wallet": "2.3.10",
|
|
20
|
+
"@0xsequence/utils": "2.3.10",
|
|
21
|
+
"@0xsequence/relayer": "2.3.10",
|
|
22
|
+
"@0xsequence/migration": "2.3.10"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
26
26
|
"ethers": "6.13.4",
|
|
27
27
|
"nyc": "^15.1.0",
|
|
28
|
-
"@0xsequence/
|
|
29
|
-
"@0xsequence/
|
|
28
|
+
"@0xsequence/tests": "2.3.10",
|
|
29
|
+
"@0xsequence/signhub": "2.3.10"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"src",
|
package/src/account.ts
CHANGED
|
@@ -790,11 +790,11 @@ export class Account {
|
|
|
790
790
|
|
|
791
791
|
/**
|
|
792
792
|
* Signs a message.
|
|
793
|
-
*
|
|
793
|
+
*
|
|
794
794
|
* This method will sign the message using the account associated with this signer
|
|
795
|
-
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
795
|
+
* and the specified chain ID. If the message is already prefixed with the EIP-191
|
|
796
796
|
* prefix, it will be hashed directly. Otherwise, it will be prefixed before hashing.
|
|
797
|
-
*
|
|
797
|
+
*
|
|
798
798
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
799
799
|
* @param chainId - The chain ID to use for signing
|
|
800
800
|
* @param cantValidateBehavior - Behavior when the wallet cannot validate on-chain
|
|
@@ -805,20 +805,20 @@ export class Account {
|
|
|
805
805
|
chainId: ethers.BigNumberish,
|
|
806
806
|
cantValidateBehavior: 'ignore' | 'eip6492' | 'throw' = 'ignore'
|
|
807
807
|
): Promise<string> {
|
|
808
|
-
const messageHex = ethers.hexlify(message)
|
|
809
|
-
const prefixHex = ethers.hexlify(ethers.toUtf8Bytes(MessagePrefix))
|
|
810
|
-
|
|
811
|
-
let digest: string
|
|
812
|
-
|
|
808
|
+
const messageHex = ethers.hexlify(message)
|
|
809
|
+
const prefixHex = ethers.hexlify(ethers.toUtf8Bytes(MessagePrefix))
|
|
810
|
+
|
|
811
|
+
let digest: string
|
|
812
|
+
|
|
813
813
|
// We check if the message is already prefixed with EIP-191
|
|
814
814
|
// This will avoid breaking changes for codebases where the message is already prefixed
|
|
815
815
|
if (messageHex.substring(2).startsWith(prefixHex.substring(2))) {
|
|
816
|
-
digest = ethers.keccak256(message)
|
|
816
|
+
digest = ethers.keccak256(message)
|
|
817
817
|
} else {
|
|
818
|
-
digest = ethers.hashMessage(message)
|
|
818
|
+
digest = ethers.hashMessage(message)
|
|
819
819
|
}
|
|
820
|
-
|
|
821
|
-
return this.signDigest(digest, chainId, true, cantValidateBehavior)
|
|
820
|
+
|
|
821
|
+
return this.signDigest(digest, chainId, true, cantValidateBehavior)
|
|
822
822
|
}
|
|
823
823
|
|
|
824
824
|
async signTransactions(
|
package/src/signer.ts
CHANGED
|
@@ -79,17 +79,17 @@ export class AccountSigner implements ethers.AbstractSigner<ethers.Provider> {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* Signs a message.
|
|
82
|
-
*
|
|
82
|
+
*
|
|
83
83
|
* This method will sign the message using the account associated with this signer
|
|
84
84
|
* and the specified chain ID. The message is already being prefixed with the EIP-191 prefix.
|
|
85
|
-
*
|
|
85
|
+
*
|
|
86
86
|
* @param message - The message to sign. Can be a string or BytesLike.
|
|
87
87
|
* @returns A Promise that resolves to the signature as a hexadecimal string
|
|
88
|
-
*
|
|
88
|
+
*
|
|
89
89
|
* @example
|
|
90
90
|
* ```typescript
|
|
91
91
|
* const signer = account.getSigner(chainId)
|
|
92
|
-
*
|
|
92
|
+
*
|
|
93
93
|
* const message = "Hello, Sequence!";
|
|
94
94
|
* const signature = await signer.signMessage(message);
|
|
95
95
|
* console.log(signature);
|