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

[wip/test] Try uuid lib #2931

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions packages/sdk-router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ If either of the input/output tokens is a native gas token (e.g. ETH on Ethereum

```ts
export type BridgeQuote = {
// UUID (v7), unique id corresponding to quote
id: string
// Address of the Router contract that user will be interacting with
routerAddress: string
// Expected final amount of tokens to be received on the destination chain by the user,
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
setupFiles: ['<rootDir>/jest.setup.js'],
maxConcurrency: 1,
testTimeout: 30000,
}
6 changes: 6 additions & 0 deletions packages/sdk-router/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
jest.mock('node:crypto', () => {
return {
...jest.requireActual('crypto'),
randomBytes: jest.fn(() => Buffer.from('mockedRandomBytes')),
}
})
4 changes: 3 additions & 1 deletion packages/sdk-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@ethersproject/providers": "^5.7.0",
"@types/big.js": "^4.0.5",
"@types/jest": "^24.0.25",
"@types/uuid": "^10.0.0",
"dotenv": "^16.3.1",
"husky": "^8.0.1",
"jest-fetch-mock": "^3.0.3",
Expand Down Expand Up @@ -75,6 +76,7 @@
"node-cache": "^5.1.2",
"tiny-invariant": "^1.2.0",
"toformat": "^2.0.0",
"ts-xor": "^1.1.0"
"ts-xor": "^1.1.0",
"uuid": "^10.0.0"
}
}
4 changes: 4 additions & 0 deletions packages/sdk-router/src/module/synapseModuleSet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BigNumber } from '@ethersproject/bignumber'
import invariant from 'tiny-invariant'
import { v7 as uuidv7 } from 'uuid'

import { BigintIsh } from '../constants'
import { BridgeQuote, BridgeRoute, FeeConfig } from './types'
Expand Down Expand Up @@ -205,7 +206,10 @@ export abstract class SynapseModuleSet {
originQuery.deadline = originModuleDeadline
destQuery.deadline = destModuleDeadline
const { feeAmount, feeConfig } = await this.getFeeData(bridgeRoute)
const id = uuidv7()

return {
id,
feeAmount,
feeConfig,
routerAddress: originModule.address,
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-router/src/module/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export type SwapQuote = {
* Returned by SDK to the consumer.
*/
export type BridgeQuote = {
id: string
feeAmount: BigNumber
feeConfig: FeeConfig
routerAddress: string
Expand Down
Loading
Loading