entropyxyz / cli

CLI utility to ease interactions with an Entropy network.
GNU Affero General Public License v3.0
5 stars 0 forks source link

How does `entropy transfer` work? #189

Open johnnymatthews opened 1 month ago

johnnymatthews commented 1 month ago

The help file for entropy transfer says:

Transfer funds between two Entropy accounts.

Arguments:
  source                     Account address funds will be drawn from
  destination                Account address funds will be sent to
  amount                     Amount of funds to be moved
  1. Does the source address have to be a private seed? Or can we just supply a public address of an account that we've created/imported into the CLI?
  2. Is amount in bits or, some other value?
rh0delta commented 1 month ago

The documentation may need some updating as the source is technically not an address, but rather the the pair/signer that comes from the registration account, which will require the account the funds are coming from to be included in a user's saved account list. We can still allow users to enter a SS58 Address as the source, but will still need that address to be attached to an account the user has access to and is available in their config so we can grab the necessary information needed for the transfer request. As for the amount, it will be any whole number, no relation to BITS. That conversion is done in the code.

johnnymatthews commented 1 month ago

to be included in a user's saved account list

Not sure I'm following. This is different to any verifyingKeys that an account has, correct?

As for the amount, it will be any whole number, no relation to BITS. That conversion is done in the code.

I'm a bit confused. If Alice uses the CLI to send 1 to Bob, how many things does Bob receive? What's this conversion you speak of?

rh0delta commented 1 month ago

Not sure I'm following. This is different to any verifyingKeys that an account has, correct?

the saved account list refers to the list in the users entropy config, similar to how i needed to have the Infinite Funds account in my config to be able to send you or anyone else tokens from my CLI instance. However, I may be mistaken. We do require an entropy instance to be created in order to perform these transfer requests, we also require access to the keyring of the account sending the funds, but I am unsure if we need to require the user to have this account saved in their config, but it couldn't hurt if they do.

I'm a bit confused. If Alice uses the CLI to send 1 to Bob, how many things does Bob receive? What's this conversion you speak of?

1 corresponds to 1 * 10^10 BITS or 10, 000, 000 BITS, the conversion is the whole number to the actual representation of BITS

const amountToSend = BigInt(parseInt(amount) * 1e10)