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

[core-v2.4.0-alpha.8, react-v2.2.3-alpha.5, vue-v2.1.3-alpha.6] : Feature - Preflight notification handling #1138

Merged
merged 17 commits into from
Jul 11, 2022

Conversation

Adamj1232
Copy link
Member

@Adamj1232 Adamj1232 commented Jul 11, 2022

Description

Adds Pre-flight Notification functionality to deliver standard notifications along with preflight information by passing a PreflightNotificationOptions object to the preflightNotification action. This will return a a promise that resolves to the transaction hash or null Promise<string> | null.

Preflight event types include

  • txRequest : Alert user there is a transaction request awaiting confirmation by their wallet
  • txAwaitingApproval : A previous transaction is awaiting confirmation
  • txConfirmReminder : Reminder to confirm a transaction to continue - configurable with the txApproveReminderTimeout property; defaults to 15 seconds
  • nsfFail : The user has insufficient funds for transaction (requires gasPrice, estimateGas, balance, txDetails.value)
  • txError : General transaction error (requires sendTransaction)
  • txSendFail : The user rejected the transaction (requires sendTransaction)
  • txUnderpriced : The gas price for the transaction is too low (requires sendTransaction)
interface PreflightNotificationOptions {
  sendTransaction?: () => Promise<string>
  estimateGas?: () => Promise<string>
  gasPrice?: () => Promise<string>
  balance?: string | number
  txDetails?: {
    value: string | number
    to?: string
    from?: string
  }
  txApproveReminderTimeout?: number // defaults to 15 seconds if not specified <confirmed default with Gustavo>
}

Checklist

  • The version field in package.json is incremented following semantic versioning
  • The box that allows repo maintainers to update this PR is checked
  • I tested locally to make sure this feature/fix works
  • This PR passes the Circle CI checks

Copy link
Collaborator

@lnbc1QWFyb24 lnbc1QWFyb24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of comments, but otherwise looks pretty good 👍

@Adamj1232 Adamj1232 requested a review from lnbc1QWFyb24 July 11, 2022 20:37
Copy link
Collaborator

@lnbc1QWFyb24 lnbc1QWFyb24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@Adamj1232 Adamj1232 merged commit bdbd075 into v2-web3-onboard-develop Jul 11, 2022
@Adamj1232 Adamj1232 deleted the feature/preflight-notifications branch July 11, 2022 21:48
This was referenced Jul 15, 2022
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.

2 participants