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

wallet.AccountInfo is null #21

Open
ArtemShe opened this issue Oct 8, 2021 · 6 comments
Open

wallet.AccountInfo is null #21

ArtemShe opened this issue Oct 8, 2021 · 6 comments

Comments

@ArtemShe
Copy link

ArtemShe commented Oct 8, 2021

Hi!
I'm new in crypto.
Trying to use your SDK
Idea its to create wallets and manage them- at least see balances and transfer 'money' between wallets.
As I understood - balance information is placed at wallet.AccountInfo.AccountData
Problem that when wallet is created or loaded -wallet.AccountInfo is null
Using different domains

  • Mandala test network "wss://mandala6.laminar.codes"
  • Karura "wss://karura.api.onfinality.io/public-ws"

I debug SDK code and looks like my problem here (class Wallet)
image

So what should I do to have wallet.AccountInfo?

Regards)

@darkfriend77
Copy link
Collaborator

Hi,

Did you tried with an Account that exists?

@ArtemShe
Copy link
Author

I'm confused)
According code of class Wallet method CreateAsync that contains a line
Account = Account.Build(keyType, privateKey, publicKey);
this method create account, and account means/equals a wallet.

Could you provide example of code with your SDK how to create account/wallet from scratch and check balance.

Another interesting point is that looks like Wallet.CreateAsync generate public and private key of wallet at client side.
Its also unclear for because

  1. usually server return to client "Id" on registration
  2. Looks like Wallet.CreateAsync logic not depend on sever/network, but regarding documentation - base on network is start with specifics symbols.
    And this SDK generate public key not regarding this rules.

Regards)

@darkfriend77
Copy link
Collaborator

That's correct the private key is generated client-side and is encrypted with a seed you provide.

This will not create an account on the blockchain itself for that purpose you will need to create a transaction sending you some tokens at that point your public key will be registered on the chain as an account. maybe that can clarify some of your questions, https://support.polkadot.network/support/solutions/articles/65000168651-what-is-the-existential-deposit-

@darkfriend77
Copy link
Collaborator

Here is an example of how to create a transaction.

var subscription = await _substrateClient.Author.SubmitAndWatchExtrinsicAsync(ActionExtrinsicUpdate, ExtrinsicCall.BalanceTransfer(Bob.Value, 100000000000), Alice, 0, 64, cts.Token);

As we are currently heavily refactoring the API, you might wait for one a few days then I will provide more code snippets with the most actual monthly release which makes everything much more smooth with the newest API release.

@RostislavLitovkin
Copy link

Hello, could you please also provide the example how to get the current balance?

@darkfriend77
Copy link
Collaborator

Sure,
The easiest way is that you create your SDK for your node with this repository. https://github.com/ajuna-network/Ajuna.SDK

Use this step-by-step https://github.com/ajuna-network/Ajuna.SDK#installing-the-template

If you exchange here SystemStorage.Number with SystemStorageAccountInfo your are good to go.
https://github.com/ajuna-network/Ajuna.SDK.Demos/blob/master/Ajuna.SDK.Demos.DirectPolling/Program.cs

@darkfriend77 darkfriend77 reopened this Mar 7, 2023
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

No branches or pull requests

3 participants