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

provider: include txmeta in transaction response #282

Merged
merged 4 commits into from
Sep 24, 2020
Merged
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
15 changes: 13 additions & 2 deletions packages/provider/src/app/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,26 @@ export class OptimismProvider extends JsonRpcProvider {
this._ethersType = 'Provider'

// Handle properly deriving "from" on the transaction
const format = this.formatter.transaction
const format = this.formatter.transaction.bind(this.formatter)
this.formatter.transaction = (transaction) => {
const tx = format(transaction)
const sig = joinSignature(tx as SignatureLike)
const hash = utils.sighashEthSign(tx)
// need to concat and hash with
tx.from = verifyMessage(hash, sig)
return tx
}

// Handle additional data sent from RPC
const formatTxResponse = this.formatter.transactionResponse.bind(
this.formatter
)
this.formatter.transactionResponse = (transaction) => {
const tx = formatTxResponse(transaction) as any
tx.type = transaction.type
tx.queueOrigin = transaction.queueOrigin
tx.l1MessageSender = transaction.l1MessageSender
return tx
}
}

public get ethereum() {
Expand Down