Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(relay-kit): fix relay-kit tests to use a dynamic identifier #1130

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions packages/relay-kit/src/packs/safe-4337/Safe4337Pack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1011,9 +1011,23 @@ describe('Safe4337Pack', () => {
}
})

expect(safe4337Pack.getOnchainIdentifier()).toBe(
'5afe006137303238633936636562316132623939353333646561393063346135'
const onchainIdentifier = await safe4337Pack.getOnchainIdentifier()

expect(onchainIdentifier).toBeDefined()

const identifierWithoutToolVersion = onchainIdentifier.slice(0, -6)

expect(identifierWithoutToolVersion).toBe(
'5afe006137303238633936636562316132623939353333646561393063'
)

const relayKitCurrentVersion = utils.getRelayKitVersion()

// check the tool version hash
const toolversionHash = viem
.toHex(viem.keccak256(viem.toHex(relayKitCurrentVersion)).slice(-3))
.replace('0x', '')
expect(onchainIdentifier.endsWith(toolversionHash)).toBeTruthy()
})

it('should include th onchain identifier at the end of the callData property', async () => {
Expand All @@ -1038,8 +1052,15 @@ describe('Safe4337Pack', () => {
transactions: [transferUSDC]
})

expect(safeOperation.userOperation.callData).toContain(
'5afe006137303238633936636562316132623939353333646561393063346135'
const onchainIdentifier = await safe4337Pack.getOnchainIdentifier()

expect(onchainIdentifier).toBeDefined()
expect(safeOperation.userOperation.callData.endsWith(onchainIdentifier)).toBeTruthy()

const identifierWithoutToolVersion = onchainIdentifier.slice(0, -6)

expect(identifierWithoutToolVersion).toBe(
'5afe006137303238633936636562316132623939353333646561393063'
)
})

Expand Down
Loading