@0xsequence/replacer
Advanced tools
Comparing version 0.0.0-20240807210827 to 0.0.0-20240812142652
@@ -64,3 +64,3 @@ 'use strict'; | ||
try { | ||
const addr = ethers.ethers.utils.recoverAddress(digest, signature); | ||
const addr = ethers.ethers.recoverAddress(digest, ethers.ethers.hexlify(signature)); | ||
if (addr.toLowerCase() === address.toLowerCase()) return true; | ||
@@ -99,5 +99,7 @@ } catch (_unused) {} | ||
if (!altUri || altUri === '') throw new Error('EIP5719 - Invalid signature and no alternative signature'); | ||
const altSignature = ethers.ethers.utils.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
const altSignature = ethers.ethers.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
if (!altSignature || altSignature === '') throw new Error('EIP5719 - Empty alternative signature'); | ||
if (altSignature === ethers.ethers.utils.hexlify(signature)) throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
if (altSignature === ethers.ethers.hexlify(signature)) { | ||
throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
} | ||
return runByEIP5719(address, provider, digest, altSignature, solver, tries + 1); | ||
@@ -104,0 +106,0 @@ } |
@@ -64,3 +64,3 @@ 'use strict'; | ||
try { | ||
const addr = ethers.ethers.utils.recoverAddress(digest, signature); | ||
const addr = ethers.ethers.recoverAddress(digest, ethers.ethers.hexlify(signature)); | ||
if (addr.toLowerCase() === address.toLowerCase()) return true; | ||
@@ -99,5 +99,7 @@ } catch (_unused) {} | ||
if (!altUri || altUri === '') throw new Error('EIP5719 - Invalid signature and no alternative signature'); | ||
const altSignature = ethers.ethers.utils.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
const altSignature = ethers.ethers.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
if (!altSignature || altSignature === '') throw new Error('EIP5719 - Empty alternative signature'); | ||
if (altSignature === ethers.ethers.utils.hexlify(signature)) throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
if (altSignature === ethers.ethers.hexlify(signature)) { | ||
throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
} | ||
return runByEIP5719(address, provider, digest, altSignature, solver, tries + 1); | ||
@@ -104,0 +106,0 @@ } |
@@ -60,3 +60,3 @@ import { ethers } from 'ethers'; | ||
try { | ||
const addr = ethers.utils.recoverAddress(digest, signature); | ||
const addr = ethers.recoverAddress(digest, ethers.hexlify(signature)); | ||
if (addr.toLowerCase() === address.toLowerCase()) return true; | ||
@@ -95,5 +95,7 @@ } catch (_unused) {} | ||
if (!altUri || altUri === '') throw new Error('EIP5719 - Invalid signature and no alternative signature'); | ||
const altSignature = ethers.utils.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
const altSignature = ethers.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)); | ||
if (!altSignature || altSignature === '') throw new Error('EIP5719 - Empty alternative signature'); | ||
if (altSignature === ethers.utils.hexlify(signature)) throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
if (altSignature === ethers.hexlify(signature)) { | ||
throw new Error('EIP5719 - Alternative signature is invalid or the same'); | ||
} | ||
return runByEIP5719(address, provider, digest, altSignature, solver, tries + 1); | ||
@@ -100,0 +102,0 @@ } |
import { ethers } from 'ethers'; | ||
import { URISolver } from "./index.js"; | ||
export declare class CachedEIP5719 { | ||
provider: ethers.providers.Provider; | ||
provider: ethers.Provider; | ||
solver?: URISolver | undefined; | ||
window: number; | ||
constructor(provider: ethers.providers.Provider, solver?: URISolver | undefined, window?: number); | ||
constructor(provider: ethers.Provider, solver?: URISolver | undefined, window?: number); | ||
private pending; | ||
runByEIP5719(address: string, digest: ethers.BytesLike, signature: ethers.BytesLike): Promise<ethers.BytesLike>; | ||
} |
import { ethers } from 'ethers'; | ||
export * from "./cached.js"; | ||
export declare function eip5719Contract(address: string, provider: ethers.providers.Provider): ethers.Contract; | ||
export declare function eip1271Contract(address: string, provider: ethers.providers.Provider): ethers.Contract; | ||
export declare function isValidSignature(address: string, provider: ethers.providers.Provider, digest: ethers.BytesLike, signature: ethers.BytesLike): Promise<boolean>; | ||
export declare function eip5719Contract(address: string, provider: ethers.Provider): ethers.Contract; | ||
export declare function eip1271Contract(address: string, provider: ethers.Provider): ethers.Contract; | ||
export declare function isValidSignature(address: string, provider: ethers.Provider, digest: ethers.BytesLike, signature: ethers.BytesLike): Promise<boolean>; | ||
export interface URISolver { | ||
resolve: (uri: string) => Promise<string>; | ||
} | ||
export declare function runByEIP5719(address: string, provider: ethers.providers.Provider, digest: ethers.BytesLike, signature: ethers.BytesLike, solver?: URISolver, tries?: number): Promise<ethers.BytesLike>; | ||
export declare function runByEIP5719(address: string, provider: ethers.Provider, digest: ethers.BytesLike, signature: ethers.BytesLike, solver?: URISolver, tries?: number): Promise<ethers.BytesLike>; | ||
export declare class URISolverIPFS implements URISolver { | ||
@@ -11,0 +11,0 @@ gateway: string; |
{ | ||
"name": "@0xsequence/replacer", | ||
"version": "0.0.0-20240807210827", | ||
"version": "0.0.0-20240812142652", | ||
"description": "EIP-5719 client implementation", | ||
@@ -12,7 +12,7 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/replacer", | ||
"dependencies": { | ||
"@0xsequence/abi": "0.0.0-20240807210827", | ||
"@0xsequence/core": "0.0.0-20240807210827" | ||
"@0xsequence/abi": "0.0.0-20240812142652", | ||
"@0xsequence/core": "0.0.0-20240812142652" | ||
}, | ||
"peerDependencies": { | ||
"ethers": ">=5.5" | ||
"ethers": ">=6" | ||
}, | ||
@@ -19,0 +19,0 @@ "devDependencies": {}, |
@@ -6,3 +6,3 @@ import { ethers } from 'ethers' | ||
constructor( | ||
public provider: ethers.providers.Provider, | ||
public provider: ethers.Provider, | ||
public solver?: URISolver, | ||
@@ -9,0 +9,0 @@ public window: number = 1000 |
@@ -8,3 +8,3 @@ import { ethers } from 'ethers' | ||
export function eip5719Contract(address: string, provider: ethers.providers.Provider): ethers.Contract { | ||
export function eip5719Contract(address: string, provider: ethers.Provider): ethers.Contract { | ||
// TODO: for some reason walletContracts is not being loaded from local | ||
@@ -35,3 +35,3 @@ // remove this code once fixed | ||
export function eip1271Contract(address: string, provider: ethers.providers.Provider): ethers.Contract { | ||
export function eip1271Contract(address: string, provider: ethers.Provider): ethers.Contract { | ||
return new ethers.Contract(address, walletContracts.erc1271.abi, provider) | ||
@@ -42,3 +42,3 @@ } | ||
address: string, | ||
provider: ethers.providers.Provider, | ||
provider: ethers.Provider, | ||
digest: ethers.BytesLike, | ||
@@ -49,3 +49,3 @@ signature: ethers.BytesLike | ||
try { | ||
const addr = ethers.utils.recoverAddress(digest, signature) | ||
const addr = ethers.recoverAddress(digest, ethers.hexlify(signature)) | ||
if (addr.toLowerCase() === address.toLowerCase()) return true | ||
@@ -79,3 +79,3 @@ } catch {} | ||
address: string, | ||
provider: ethers.providers.Provider, | ||
provider: ethers.Provider, | ||
digest: ethers.BytesLike, | ||
@@ -102,6 +102,7 @@ signature: ethers.BytesLike, | ||
const altSignature = ethers.utils.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)) | ||
const altSignature = ethers.hexlify(await (solver || new URISolverIPFS()).resolve(altUri)) | ||
if (!altSignature || altSignature === '') throw new Error('EIP5719 - Empty alternative signature') | ||
if (altSignature === ethers.utils.hexlify(signature)) throw new Error('EIP5719 - Alternative signature is invalid or the same') | ||
if (altSignature === ethers.hexlify(signature)) { | ||
throw new Error('EIP5719 - Alternative signature is invalid or the same') | ||
} | ||
return runByEIP5719(address, provider, digest, altSignature, solver, tries + 1) | ||
@@ -108,0 +109,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
519
32262
+ Added@0xsequence/abi@0.0.0-20240812142652(transitive)
+ Added@0xsequence/core@0.0.0-20240812142652(transitive)
+ Added@0xsequence/utils@0.0.0-20240812142652(transitive)
+ Addedjs-base64@3.7.7(transitive)
- Removed@0xsequence/abi@0.0.0-20240807210827(transitive)
- Removed@0xsequence/core@0.0.0-20240807210827(transitive)