import { expect, test } from 'vitest' import { computeFillHash } from './computeFillHash.js' const resolvedOrder = { user: '0x62398788692aDed44638F8b9F3eE4B977C78ff46', originChainId: 17000n, openDeadline: 0, fillDeadline: 1748953139, orderId: '0xaaeb519d4bd58099767a64d9e00cd661a661ccfa3989550b613362af2cf66a00', maxSpent: [ { token: '0x0000000000000000000000000000000000000000000000000000000000000000', amount: 9970089730807577n, recipient: '0x0000000000000000000000000000000000000000000000000000000000000000', chainId: 84532n, }, ], minReceived: [ { token: '0x0000000000000000000000000000000000000000000000000000000000000000', amount: 10000000000000000n, recipient: '0x0000000000000000000000000000000000000000000000000000000000000000', chainId: 17000n, }, ], fillInstructions: [ { destinationChainId: 84532n, destinationSettler: '0x000000000000000000000000ae9e2e3acb2914604ca8f13c734388f05c697ef0', originData: '0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000042680000000000000000000000000000000000000000000000000000000000014a3400000000000000000000000000000000000000000000000000000000683ee83300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000062398788692aded44638f8b9f3ee4b977c78ff46000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000236bbe68c89719000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', }, ], } as const const expectedHash = '0x9c944d5aae984cca845663fd6a40dab5fcb5aa52e826776286e90666e7fd06cc' test('default: matches expected hash calculation', () => { const actual = computeFillHash(resolvedOrder) expect(typeof actual).toBe('string') expect(actual.startsWith('0x')).toBe(true) expect(actual.toLowerCase()).toBe(expectedHash.toLowerCase()) })