@0xsequence/core
Advanced tools
Comparing version 0.0.0-20241216114019 to 0.0.0-20241218203257
@@ -6,3 +6,2 @@ import { ethers } from 'ethers'; | ||
isDynamic: boolean; | ||
validationSignature?: string; | ||
}; | ||
@@ -28,3 +27,3 @@ export type Signature<T extends config.Config> = { | ||
trim: (data: string) => Promise<string>; | ||
recover: (data: Z, payload: SignedPayload, provider?: ethers.Provider, validateBehavior?: 'ignore' | 'throw') => Promise<T>; | ||
recover: (data: Z, payload: SignedPayload, provider: ethers.Provider) => Promise<T>; | ||
supportsNoChainId: boolean; | ||
@@ -38,3 +37,3 @@ encodeSigners: (config: Y, signatures: Map<string, SignaturePart>, subdigests: string[], chainId: ethers.BigNumberish) => { | ||
hashSetImageHash: (imageHash: string) => string; | ||
signaturesOf: (config: Y, referenceChainId?: ethers.BigNumberish) => { | ||
signaturesOf: (config: Y) => { | ||
address: string; | ||
@@ -41,0 +40,0 @@ signature: string; |
@@ -27,3 +27,3 @@ import { ethers } from 'ethers'; | ||
export declare function encodeSignature(signature: Signature | UnrecoveredSignature | ethers.BytesLike): string; | ||
export declare function recoverSignature(data: UnrecoveredSignature, payload: base.SignedPayload, provider?: ethers.Provider, validateBehavior?: 'ignore' | 'throw'): Promise<Signature>; | ||
export declare function recoverSignature(data: UnrecoveredSignature, payload: base.SignedPayload, provider: ethers.Provider): Promise<Signature>; | ||
export declare function encodeSigners(config: WalletConfig, signatures: Map<string, base.SignaturePart>, subdigests: string[], _: ethers.BigNumberish): { | ||
@@ -30,0 +30,0 @@ encoded: string; |
@@ -46,3 +46,3 @@ import { ethers } from 'ethers'; | ||
} | ||
export declare function recoverTopology(unrecovered: UnrecoveredTopology, subdigest: string, provider?: ethers.Provider, validateBehavior?: 'ignore' | 'throw'): Promise<Topology>; | ||
export declare function recoverTopology(unrecovered: UnrecoveredTopology, subdigest: string, provider: ethers.Provider): Promise<Topology>; | ||
export declare const partEncoder: { | ||
@@ -99,3 +99,3 @@ concat: (a: ethers.BytesLike, b: ethers.BytesLike) => string; | ||
subdigest: string; | ||
}, provider?: ethers.Provider, validateBehavior?: 'ignore' | 'throw'): Promise<Signature | ChainedSignature>; | ||
}, provider: ethers.Provider): Promise<Signature | ChainedSignature>; | ||
export declare function encodeChain(main: ethers.BytesLike, suffix: ethers.BytesLike[]): string; | ||
@@ -102,0 +102,0 @@ export declare function encodeSignature(decoded: UnrecoveredChainedSignature | ChainedSignature | UnrecoveredSignature | Signature | ethers.BytesLike): string; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "2.2.1"; | ||
export declare const VERSION = "2.2.2"; |
{ | ||
"name": "@0xsequence/core", | ||
"version": "0.0.0-20241216114019", | ||
"version": "0.0.0-20241218203257", | ||
"description": "core primitives for interacting with the sequence wallet contracts", | ||
@@ -24,4 +24,4 @@ "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/core", | ||
"dependencies": { | ||
"@0xsequence/utils": "0.0.0-20241216114019", | ||
"@0xsequence/abi": "0.0.0-20241216114019" | ||
"@0xsequence/abi": "0.0.0-20241218203257", | ||
"@0xsequence/utils": "0.0.0-20241218203257" | ||
}, | ||
@@ -28,0 +28,0 @@ "scripts": { |
@@ -7,3 +7,2 @@ import { ethers } from 'ethers' | ||
isDynamic: boolean | ||
validationSignature?: string | ||
} | ||
@@ -39,3 +38,3 @@ | ||
recover: (data: Z, payload: SignedPayload, provider?: ethers.Provider, validateBehavior?: 'ignore' | 'throw') => Promise<T> | ||
recover: (data: Z, payload: SignedPayload, provider: ethers.Provider) => Promise<T> | ||
@@ -60,3 +59,3 @@ supportsNoChainId: boolean | ||
signaturesOf: (config: Y, referenceChainId?: ethers.BigNumberish) => { address: string; signature: string }[] | ||
signaturesOf: (config: Y) => { address: string; signature: string }[] | ||
@@ -63,0 +62,0 @@ signaturesOfDecoded: (decoded: Z) => string[] |
@@ -128,4 +128,3 @@ import { ethers } from 'ethers' | ||
payload: base.SignedPayload, | ||
provider?: ethers.Provider, | ||
validateBehavior: 'ignore' | 'throw' = 'throw' | ||
provider: ethers.Provider | ||
): Promise<Signature> { | ||
@@ -141,11 +140,4 @@ const subdigest = base.subdigestOf(payload) | ||
if (!s.address) throw new Error('Dynamic signature part must have address') | ||
if (validateBehavior !== 'ignore') { | ||
if (!provider) { | ||
throw new Error('Provider is required to validate EIP1271 signatures') | ||
} | ||
if (!isValidSignature(s.address, subdigest, s.signature, provider)) { | ||
throw new Error(`Invalid dynamic signature part ${s.address}`) | ||
} | ||
if (!isValidSignature(s.address, subdigest, s.signature, provider)) { | ||
throw new Error(`Invalid dynamic signature part ${s.address}`) | ||
} | ||
@@ -229,9 +221,4 @@ | ||
recover: ( | ||
data: UnrecoveredSignature, | ||
payload: base.SignedPayload, | ||
provider?: ethers.Provider, | ||
validateBehavior: 'ignore' | 'throw' = 'throw' | ||
): Promise<Signature> => { | ||
return recoverSignature(data, payload, provider, validateBehavior) | ||
recover: (data: UnrecoveredSignature, payload: base.SignedPayload, provider: ethers.Provider): Promise<Signature> => { | ||
return recoverSignature(data, payload, provider) | ||
}, | ||
@@ -267,3 +254,3 @@ | ||
signaturesOf(config: WalletConfig, referenceChainId?: ethers.BigNumberish): { address: string; signature: string }[] { | ||
signaturesOf(config: WalletConfig): { address: string; signature: string }[] { | ||
return config.signers.filter(s => s.signature !== undefined).map(s => ({ address: s.address, signature: s.signature! })) | ||
@@ -270,0 +257,0 @@ }, |
@@ -229,9 +229,8 @@ import { ethers } from 'ethers' | ||
subdigest: string, | ||
provider?: ethers.Provider, | ||
validateBehavior: 'ignore' | 'throw' = 'throw' | ||
provider: ethers.Provider | ||
): Promise<Topology> { | ||
if (isUnrecoveredNode(unrecovered)) { | ||
const [left, right] = await Promise.all([ | ||
recoverTopology(unrecovered.left, subdigest, provider, validateBehavior), | ||
recoverTopology(unrecovered.right, subdigest, provider, validateBehavior) | ||
recoverTopology(unrecovered.left, subdigest, provider), | ||
recoverTopology(unrecovered.right, subdigest, provider) | ||
]) | ||
@@ -246,3 +245,3 @@ | ||
threshold: unrecovered.threshold, | ||
tree: await recoverTopology(unrecovered.tree, subdigest, provider, validateBehavior) | ||
tree: await recoverTopology(unrecovered.tree, subdigest, provider) | ||
} | ||
@@ -257,11 +256,5 @@ } | ||
if (validateBehavior !== 'ignore') { | ||
if (!provider) { | ||
throw new Error('Provider is required to validate EIP1271 signatures') | ||
} | ||
const isValid = await isValidSignature(unrecovered.address, subdigest, unrecovered.signature, provider) | ||
if (!isValid) { | ||
throw new InvalidSignatureLeafError(unrecovered) | ||
} | ||
const isValid = await isValidSignature(unrecovered.address, subdigest, unrecovered.signature, provider) | ||
if (!isValid) { | ||
throw new InvalidSignatureLeafError(unrecovered) | ||
} | ||
@@ -611,4 +604,3 @@ | ||
payload: base.SignedPayload | { subdigest: string }, | ||
provider?: ethers.Provider, | ||
validateBehavior: 'ignore' | 'throw' = 'throw' | ||
provider: ethers.Provider | ||
): Promise<Signature | ChainedSignature> { | ||
@@ -625,3 +617,3 @@ const signedPayload = (payload as { subdigest: string }).subdigest === undefined ? (payload as base.SignedPayload) : undefined | ||
if (!isUnrecoveredChainedSignature(signature)) { | ||
const tree = await recoverTopology(signature.decoded.tree, subdigest, provider, validateBehavior) | ||
const tree = await recoverTopology(signature.decoded.tree, subdigest, provider) | ||
return { version: 2, type: signature.type, subdigest, config: { version: 2, ...signature.decoded, tree } } | ||
@@ -641,3 +633,3 @@ } | ||
for (const sig of [{ ...signature, suffix: undefined }, ...signature.suffix]) { | ||
const recovered = await recoverSignature(sig, mutatedPayload, provider, validateBehavior) | ||
const recovered = await recoverSignature(sig, mutatedPayload, provider) | ||
result.unshift(recovered) | ||
@@ -944,6 +936,5 @@ | ||
payload: base.SignedPayload, | ||
provider?: ethers.Provider, | ||
validateBehavior: 'ignore' | 'throw' = 'throw' | ||
provider: ethers.Provider | ||
): Promise<Signature> => { | ||
return recoverSignature(data, payload, provider, validateBehavior) | ||
return recoverSignature(data, payload, provider) | ||
}, | ||
@@ -950,0 +941,0 @@ |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '2.2.1' | ||
export const VERSION = '2.2.2' |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
426423
10457
+ Added@0xsequence/abi@0.0.0-20241218203257(transitive)
+ Added@0xsequence/utils@0.0.0-20241218203257(transitive)
- Removed@0xsequence/abi@0.0.0-20241216114019(transitive)
- Removed@0xsequence/utils@0.0.0-20241216114019(transitive)