Skip to content

Commit

Permalink
fix: fix order signing
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Nov 22, 2024
1 parent 3191677 commit 228f3d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/cow-sdk",
"version": "5.8.0-RC.4",
"version": "5.8.0-RC.5",
"license": "(MIT OR Apache-2.0)",
"files": [
"/dist"
Expand Down
8 changes: 8 additions & 0 deletions src/trading/getOrderTypedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { ORDER_PRIMARY_TYPE, OrderTypedData } from './types'
import { OrderSigningUtils, UnsignedOrder } from '../order-signing'
import { SupportedChainId } from '../common'

const EIP712DomainTypes = [
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
]

export async function getOrderTypedData(
chainId: SupportedChainId,
orderToSign: UnsignedOrder
Expand All @@ -14,6 +21,7 @@ export async function getOrderTypedData(
primaryType: ORDER_PRIMARY_TYPE,
types: {
[ORDER_PRIMARY_TYPE]: ORDER_TYPE_FIELDS,
EIP712Domain: EIP712DomainTypes,
},
message: orderToSign,
}
Expand Down
4 changes: 1 addition & 3 deletions src/trading/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ interface TypedDataField {
export interface OrderTypedData {
domain: TypedDataDomain
primaryType: typeof ORDER_PRIMARY_TYPE
types: {
Order: TypedDataField[]
}
types: Record<string, TypedDataField[]>
message: UnsignedOrder
}

Expand Down

0 comments on commit 228f3d7

Please sign in to comment.