Skip to content

Commit

Permalink
feat: add SignatureType type (#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniSomoza authored Dec 2, 2024
1 parent e0317d5 commit 535f2b8
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion guides/integrating-the-safe-core-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ type SafeMultisigTransactionResponse = {
transactionHash?: string
confirmationType?: string
signature: string
signatureType?: string
signatureType?: SignatureType
},
// ...
]
Expand Down
5 changes: 3 additions & 2 deletions packages/api-kit/src/types/safeTransactionServiceTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
SafeTransactionData,
UserOperation,
SafeOperationResponse,
ListResponse
ListResponse,
SignatureType
} from '@safe-global/types-kit'

export type ListOptions = {
Expand Down Expand Up @@ -231,7 +232,7 @@ export type SafeMessageConfirmation = {
readonly modified: string
readonly owner: string
readonly signature: string
readonly signatureType: string
readonly signatureType: SignatureType
}

export type SafeMessage = {
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol-kit/tests/e2e/offChainSignatures.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,15 @@ describe('Off-chain signatures', () => {
transactionHash: '',
confirmationType: '',
signature: '0x111111',
signatureType: ''
signatureType: 'EOA'
},
{
owner: '0x2222222222222222222222222222222222222222',
submissionDate: '',
transactionHash: '',
confirmationType: '',
signature: '0x222222',
signatureType: ''
signatureType: 'EOA'
}
],
trusted: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { SignatureTypes } from '@safe-global/types-kit'
import { ENTRYPOINT_ADDRESS_V06, ENTRYPOINT_ADDRESS_V07 } from '../constants'

export const OWNER_1 = '0xFfAC5578BE8AC1B2B9D13b34cAf4A074B96B8A1b'
Expand Down Expand Up @@ -109,7 +110,7 @@ export const SAFE_OPERATION_RESPONSE = {
owner: '0x3059EfD1BCe33be41eeEfd5fb6D520d7fEd54E43',
signature:
'0xcb28e74375889e400a4d8aca46b8c59e1cf8825e373c26fa99c2fd7c078080e64fe30eaf1125257bdfe0b358b5caef68aa0420478145f52decc8e74c979d43ab1d',
signatureType: 'EOA'
signatureType: SignatureTypes.EOA
}
],
preparedSignature:
Expand Down
13 changes: 11 additions & 2 deletions packages/types-kit/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,22 @@ export interface EIP712TypedData {
primaryType?: string
}

export const SignatureTypes = {
CONTRACT_SIGNATURE: 'CONTRACT_SIGNATURE',
EOA: 'EOA',
APPROVED_HASH: 'APPROVED_HASH',
ETH_SIGN: 'ETH_SIGN'
} as const

export type SignatureType = (typeof SignatureTypes)[keyof typeof SignatureTypes]

export type SafeMultisigConfirmationResponse = {
readonly owner: string
readonly submissionDate: string
readonly transactionHash?: string
readonly confirmationType?: string
readonly signature: string
readonly signatureType?: string
readonly signatureType: SignatureType
}

export type ListResponse<T> = {
Expand Down Expand Up @@ -313,7 +322,7 @@ export type SafeOperationConfirmation = {
readonly modified: string
readonly owner: string
readonly signature: string
readonly signatureType: string
readonly signatureType: SignatureType
}

export type UserOperationResponse = {
Expand Down

0 comments on commit 535f2b8

Please sign in to comment.