-
Notifications
You must be signed in to change notification settings - Fork 38
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 TransactionResult type #125
Conversation
7c7b534
to
03208a9
Compare
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.
Merging as is since detecting contract versions is built on the tip of this branch, and there's no glaring issues, but made the comments for reference later.
@@ -151,6 +146,8 @@ class Web3Adapter extends EthLibAdapter { | |||
} | |||
|
|||
toSafeRelayTxResult(txHash: string, tx: Record<string, any>): Promise<Web3TransactionResult> { | |||
tx['transactionHash'] = tx['txHash'] | |||
delete tx['txHash'] |
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.
Note to self: this is done to make the result of the relay look like a web3 transaction result.
hash?: string | ||
safeTxHash?: string | ||
} | ||
|
||
export interface Web3TransactionResult extends SimpleTransactionResult { | ||
sendOptions?: SendOptions | ||
promiEvent: Promise<any> |
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.
Not sure if promiEvent
should be typed as a Promise, as I've had issues directly await
ing it in the past.
sendOptions?: SendOptions | ||
promiEvent?: any | ||
transactionResponse?: Record<string, any> | ||
} |
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 was under the impression that TransactionResult would be the only transaction result type from this, but instead it looks like there are now 4 different transaction result types? Couldn't those other types be removed with this being the only type?
Alternatively, with this approach, could use multiple inheritance:
export interface TransactionResult extends Web3TransactionResult, EthersTransactionResult {}
if (isCpkTransactionManager) { | ||
should.exist(txResult.sendOptions) | ||
} | ||
} | ||
}, | ||
waitTxReceipt: async (txResult: TransactionResult): Promise<any> => { |
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.
Should check if waitTxReceipt
is still used.
@@ -62,6 +74,22 @@ export function shouldWorkWithWeb3({ | |||
receipt = await web3Box[0].eth.getTransactionReceipt(txResult.hash) | |||
} | |||
return receipt | |||
}, | |||
waitSafeTxReceipt: async (txResult: TransactionResult): Promise<any> => { |
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.
Maybe should be a Promise<Record<string, any> | undefined>
, or even a Promise<Record<string, any>>
if returning undefined can get changed to throwing an error.
Check #118