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

[Spike] Update PaymentInfo to use Assets pallet for fee asset if applicable #8324

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aidan-starke
Copy link
Contributor

The problem

  • At futureverse we use an asset from our Assets pallet to handle all fees for the network. The number displayed in PaymentInfo is correct, but the symbol is not, and the fee error can trigger when it shouldn't

The solution

  • Add a feeAssets map in @polkadot/apps-config where any chain can add their fee asset's details
  • Add a hook that attempts to fetch the fee asset balance based on that map
  • If that hook finds anything, use that data for the fee error and feesForSubmission section of PaymentInfo

@aidan-starke
Copy link
Contributor Author

@jacogr keen to get some feedback on this - I've had an idea that we could add in the module/call to the feeAssets mapping to keep the useFeeAssetBalance hook generic, i.e.

root: {
  module: "assets",
  call: "account",
  feeAsset: {
    assetId: 2,
    decimals: 6,
    symbol: 'XRP'
  }  

@evilrobot-01
Copy link
Contributor

Additional hacky implementation based on Aidan's great work available at https://github.com/evilrobot-01/polkadot-js-apps for anyone interested. It still uses the static assets defined in feeAssets.ts, but adds an option to select an asset in the UI, which is then passed through via SignerOptions when sending the signed transaction.

@jacogr
Copy link
Member

jacogr commented Nov 29, 2022

We certainly need UI support, so PRs would be appreciated for "proper" support, see #7812 (It is still going to take "some" time to get around to it)

Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

On first glance, it certainly look above-board, although very localized to a specific instance. But it moves in the right direction, so it is good.

Lemme take a proper look and pull down/play with it.

@ken-futureverse ken-futureverse deleted the spike/fee-asset branch February 14, 2023 08:53
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.

None yet

3 participants