-
Notifications
You must be signed in to change notification settings - Fork 18
test: fix with custom transport #755
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
Conversation
test/relayFeeCalculator.test.ts
Outdated
@@ -74,6 +75,7 @@ class ExampleQueries implements QueryInterface { | |||
constructor(private defaultGas = "305572") {} | |||
|
|||
getGasCosts(): Promise<TransactionCostEstimate> { | |||
console.log("#####"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw you can use the logger in test by running LOG_IN_TEST=yes yarn test ...
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok good to know
options: Partial<{ | ||
gasPrice: BigNumberish; | ||
gasUnits: BigNumberish; | ||
omitMarkup: boolean; | ||
transport: Transport; | ||
}> = {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for this approach - I really think it improves usability to eliminate the need for long convoluted sets of parameters.
|
||
// This needs to be implemented for every chain and passed into RelayFeeCalculator | ||
export interface QueryInterface { | ||
getGasCosts: ( | ||
deposit: Deposit, | ||
relayer: string, | ||
gasPrice?: BigNumberish, | ||
gasLimit?: BigNumberish | ||
options?: Partial<{ gasPrice: BigNumberish; gasUnits: BigNumberish; omitMarkup: boolean; transport: Transport }> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it'd be nice to avoid having Transport
bleed out into the QueryInterface
definitions. I'm not sure if that's acheivable atm and it may not be actionable right now. But in general I think it would be good to keep the implementation choices of the gas price oracle defined internally - especially since it's only really used for test (...it might hint at the need to define a special class for test? idk).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So currently we use getGasCosts
directly in the API. That's why I had to expose it here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But yea agree it would be nicer to keep it internal
No description provided.