polkadot-js / apps

Basic Polkadot/Substrate UI for interacting with a Polkadot and Substrate node. This is the main user-facing application, allowing access to all features available on Substrate chains.
https://dotapps.io
Apache License 2.0
1.74k stars 1.53k forks source link

Support "Send funds" on "Accounts" page using derives #6780

Open gregdhill opened 2 years ago

gregdhill commented 2 years ago

@jacogr would it be possible to also support "Send" using derives? The "Accounts" page currently crashes with the error api.consts.balances is undefined when I try to open the modal.

Originally posted by @gregdhill in https://github.com/polkadot-js/apps/issues/6744#issuecomment-1004929722

jacogr commented 2 years ago

Change the const check to api.consts.balances?.<whatever> and see if that at least makes it work. So would suggest making it work first (i.e. don't crash if stuff is not available) and then looking at trying to extract the constants/etc. via another mechanism.

If it is api.consts.balances.* it is most-probably the existential/etc constants.

gregdhill commented 2 years ago

@jacogr I'll look into extracting the balance interactions into another mechanism, is derive suitable?

jacogr commented 2 years ago

I think atm that is the only option, i.e. it is the only place where JS code can be injected for use inside the apps UI.

gregdhill commented 2 years ago

@jacogr this needs to be added to @polkadot/api-derive right? What's the best way to link to apps locally for a development build?

jacogr commented 2 years ago

I would suggest adding it locally (see eq equilibrium) - if more chains and broader support we can move it to api.

gregdhill commented 2 years ago

@jacogr could you take a look at my draft PR? https://github.com/polkadot-js/apps/pull/6799

I'm new to RxJS so I'm not sure how best to integrate a custom call, getting the error TypeError: extrinsic.registry is undefined.