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 TransactionResult type #125

Merged
merged 8 commits into from
Nov 9, 2020
Merged

Fix TransactionResult type #125

merged 8 commits into from
Nov 9, 2020

Conversation

germartinez
Copy link
Member

Check #118

@germartinez germartinez requested a review from cag October 23, 2020 19:22
@germartinez germartinez linked an issue Oct 23, 2020 that may be closed by this pull request
Copy link
Contributor

@cag cag left a 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']
Copy link
Contributor

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>
Copy link
Contributor

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 awaiting it in the past.

sendOptions?: SendOptions
promiEvent?: any
transactionResponse?: Record<string, any>
}
Copy link
Contributor

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> => {
Copy link
Contributor

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> => {
Copy link
Contributor

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.

@cag cag merged commit 4d738f7 into development Nov 9, 2020
@germartinez germartinez deleted the fix-txresult branch December 7, 2020 17:06
@germartinez germartinez mentioned this pull request Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix TransactionResult type
2 participants