Skip to content

Commit

Permalink
fix: remove sign typed data (#548)
Browse files Browse the repository at this point in the history
* fix: remove signTypedData implementation

* fix: fixed build issues

---------

Co-authored-by: GabiDev <gv@popoo.io>
  • Loading branch information
VGabriel45 and GabiDev45 authored Aug 8, 2024
1 parent 907a2dc commit 41140a7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
14 changes: 8 additions & 6 deletions src/account/BaseSmartContractAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export abstract class BaseSmartContractAccount<
* @param _params -- Typed Data params to sign
*/
async signTypedData(_params: SignTypedDataParams): Promise<`0x${string}`> {
return this.signer.signTypedData(_params)
throw new Error("signTypedData not supported")
}

/**
Expand All @@ -158,14 +158,16 @@ export abstract class BaseSmartContractAccount<
* @param params -- Typed Data params to sign
*/
async signTypedDataWith6492(
// @ts-ignore
params: SignTypedDataParams
): Promise<`0x${string}`> {
const [isDeployed, signature] = await Promise.all([
this.isAccountDeployed(),
this.signTypedData(params)
])
throw new Error("signTypedDataWith6492 not supported")
// const [isDeployed, signature] = await Promise.all([
// this.isAccountDeployed(),
// this.signTypedData(params)
// ])

return this.create6492Signature(isDeployed, signature)
// return this.create6492Signature(isDeployed, signature)
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/account/utils/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ export interface ISmartContractAccount<
* @param params - {@link SignTypedDataParams}
* @returns the signed hash for the message passed
*/
signTypedData(params: SignTypedDataParams): Promise<Hash>;
// signTypedData(params: SignTypedDataParams): Promise<Hash>;

/**
* If the account is not deployed, it will sign the message and then wrap it in 6492 format
Expand All @@ -574,7 +574,7 @@ export interface ISmartContractAccount<
* @param params - {@link SignTypedDataParams}
* @returns the signed hash for the params passed in wrapped in 6492 format
*/
signTypedDataWith6492(params: SignTypedDataParams): Promise<Hash>;
// signTypedDataWith6492(params: SignTypedDataParams): Promise<Hash>;

/**
* @returns the address of the account
Expand Down
9 changes: 2 additions & 7 deletions tests/account/read.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,12 +967,7 @@ describe("Account:Read", () => {
}
}

const signature = await smartAccount.signTypedData(typedData)
const isVerified = await publicClient.verifyTypedData({
address: account.address,
signature,
...typedData
})
expect(isVerified).toBeTruthy()
const signature = smartAccount.signTypedData(typedData)
expect(signature).rejects.toThrowError("signTypedData not supported")
})
})

0 comments on commit 41140a7

Please sign in to comment.