Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Fix TransactionResult type - #125

Merged
Alan Lu (cag) merged 8 commits into
developmentfrom
fix-txresult
Nov 9, 2020
Merged

Fix TransactionResult type#125
Alan Lu (cag) merged 8 commits into
developmentfrom
fix-txresult

Conversation

@germartinez

Copy link
Copy Markdown
Contributor

Check #118

@cag Alan Lu (cag) left a comment

Copy link
Copy Markdown
Contributor

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.


toSafeRelayTxResult(txHash: string, tx: Record<string, any>): Promise<Web3TransactionResult> {
tx['transactionHash'] = tx['txHash']
delete tx['txHash']

Copy link
Copy Markdown
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.

Comment thread src/utils/transactions.ts

export interface Web3TransactionResult extends SimpleTransactionResult {
sendOptions?: SendOptions
promiEvent: Promise<any>

Copy link
Copy Markdown
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.

Comment thread src/utils/transactions.ts
sendOptions?: SendOptions
promiEvent?: any
transactionResponse?: Record<string, any>
}

Copy link
Copy Markdown
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 {}

}
}
},
waitTxReceipt: async (txResult: TransactionResult): Promise<any> => {

Copy link
Copy Markdown
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.

}
return receipt
},
waitSafeTxReceipt: async (txResult: TransactionResult): Promise<any> => {

Copy link
Copy Markdown
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
Alan Lu (cag) merged commit 4d738f7 into development Nov 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix TransactionResult type

2 participants