-
Notifications
You must be signed in to change notification settings - Fork 323
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
CIP-0030 GetBalance and Account/Network change #178
Comments
We talked about this in the original CIP-30 PR as well as #171 about how we might want to have more granularity for the balance/utxos endpoints but no consensus has been reached as of yet.
What do you mean attached? Perhaps I'm misunderstanding you but can't you use ADA that is together with a non-ADA multiasset? You'll just want to return said asset(s) in a change output to the user to only use the ADA. Although if it's juts a single one then you'll still have the min ADA per utxo calculation coming into play so if that UTXO only had the minimum attached to it potentially wouldn't help if you weren't going to have a change output for some reason. Or if you're using multiple and bunching them in a single change output that ADA is still usable. Of course the user may or may not want that to happen but I'm not sure what the ideal general API for that would be about controlling what the user wants done with his or her UTXOs/bundling and that seems like it may be more on the wallet's side than the CIP-30 spec side but we haven't had this come up in discussion so far so maybe there is a better solution.
See #151 these were removed from CIP-30's first PR in order to get it merged as we had not reached a consensus yet by that time in the original PR and #151 was opened up to continue work there. We should move this discussion over to #151 and #171 respectively instead of this issue. |
"What do you mean attached?" -> Sorry I meant 'locked'. I know I can make use of locked ADA in the inputs. But the problem comes when you build/submit an ADA transaction where quantity is between the 'usable' balance and total balance. For example, I had a case where user had 18 ADA (total balance). But had 6 ADA locked with assets (So 12 'free' ADA). I was trying to make a transaction of 14 ADA (Wallet allowed me to build the tx because the getBalance() is telling me I have enough ADA). But...when submitting the transaction it fails because the built tx is not ok (because minimum utxo not met for ex.). This could be managed before submitting the tx, if we had a getNonLockedBalance() or something like that. As you said, I will continue the discussion in #151 and #171 . Thanks. |
Input selection is a wallet concept, so it might make sense to have on CIP-30. It requires access to protocol parameters, so the interface is currently not sufficient to be able to do that on the dApp side without having an external source for it.
Input selection API could look something like that (preliminary, would need to think about this a little more, e. g. might be a good idea to return new outputs instead of change if we think it's wallet's responsibility to pick a change address): type Lovelace = number;
type Selection = { inputs: TransactionUnspentOutput[]; change: cbor<value>[]; minFee: Lovelace; };
type BuildTx = (selection: Selection): Promise<cbor<transaction>>;
api.selectUtxo(buildTx: BuildTx): Promise<Selection>; |
Hello,
After integrating ccvault wallet (making use of CIP-0030), I have two suggestions.
getBalance(). It returns now the full balance of the account. Could it be possible to add another endpoint that returns the actual available balance? (total balance - ada attached to tokens). I am having the issue where I retrieve the balance to see if a user can pay for a CNFT, and total balance is higher than CNFT price, but their actual available balance is not. So when submitting the tx, it fails and user dont know why (when it is only that they dont have enough 'free' balance). It will always happen this. And problem will be bigger the more assets an account has.
Account/Network change: Is it possible to have events when account/network is changed? Just like Nami wallet has now. That way is easier to subscribe to this event, and act accordingly (calling .enable() again to resfresh the API for example). Without this events it is more difficult to manage when user changes to testnet, or changes account, having the website with dApp connector 'opened' and not knowing this changes took place.
Thanks
The text was updated successfully, but these errors were encountered: