Skip to content

Commit 42ee333

Browse files
authored
refactor(eip712): rename EIP712Repository.signTypedDataEIP712 to signTypedData (#52)
* refactor(eip712): rename EIP712Repository.signTypedDataEIP712 to signTypedData The public repository method consumed by the wallet is renamed back to `signTypedData`. Internal signing utilities (`signTypedDataEIP712`, `...DigestWithKey`, `...WithRawKey`) and the error-source tag keep the EIP-712 suffix. * style(eip712): collapse signTypedData signature onto one line (prettier)
1 parent 4947d06 commit 42ee333

3 files changed

Lines changed: 5 additions & 9 deletions

File tree

src/data/repositories/eip712/eip712.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ describe('EIP712Repository', () => {
5555
expect(result.digest).toBe(EXPECTED_DIGEST);
5656
});
5757

58-
it('signTypedDataEIP712 computes then signs', () => {
58+
it('signTypedData computes then signs', () => {
5959
const key = PrivateKey.fromHex('11'.repeat(32), KeyAlgorithm.SECP256K1);
60-
const result = repo.signTypedDataEIP712({ typedData: TYPED_DATA, privateKey: key });
60+
const result = repo.signTypedData({ typedData: TYPED_DATA, privateKey: key });
6161
expect(result.digest).toBe(EXPECTED_DIGEST);
6262
});
6363

src/data/repositories/eip712/index.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import {
4242
* contract-package data over HTTP (best-effort — each lookup is isolated in its own try/catch, so a
4343
* flaky API never breaks the request). The other methods are synchronous pure-CPU work.
4444
*
45-
* `computeDigest`, `signDigest` and `signTypedDataEIP712` wrap unexpected failures in {@link EIP712Error}.
45+
* `computeDigest`, `signDigest` and `signTypedData` wrap unexpected failures in {@link EIP712Error}.
4646
* `prepareSignatureRequest` surfaces digest/validation failures as {@link EIP712Error} (via
4747
* `computeDigest`) and swallows enrichment-lookup failures (best-effort). `recoverSigner` and
4848
* `verifySignature` surface raw library errors.
@@ -74,11 +74,7 @@ export class EIP712Repository implements IEIP712Repository {
7474
}
7575
}
7676

77-
signTypedDataEIP712({
78-
typedData,
79-
privateKey,
80-
options,
81-
}: IEIP712SignTypedDataParams): IEIP712SignResult {
77+
signTypedData({ typedData, privateKey, options }: IEIP712SignTypedDataParams): IEIP712SignResult {
8278
try {
8379
return signTypedDataEIP712Util(typedData, privateKey, options);
8480
} catch (e) {

src/domain/eip712/repository.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export interface IEIP712Repository {
5454
computeDigest(typedData: IEIP712TypedData, options?: IEIP712SignTypedDataOptions): IEIP712Digest;
5555
buildDisplayModel(typedData: IEIP712TypedData): IEIP712DisplayModel;
5656
signDigest(params: IEIP712SignDigestParams): IEIP712SignResult;
57-
signTypedDataEIP712(params: IEIP712SignTypedDataParams): IEIP712SignResult;
57+
signTypedData(params: IEIP712SignTypedDataParams): IEIP712SignResult;
5858
recoverSigner(params: IEIP712RecoverSignerParams): string;
5959
verifySignature(params: IEIP712VerifySignatureParams): boolean;
6060
prepareSignatureRequest(

0 commit comments

Comments
 (0)