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

Incorrect description and confusing operation of the createSubAccount function #1445

Open
AlexKushnir1 opened this issue Jan 6, 2025 · 0 comments

Comments

@AlexKushnir1
Copy link

AlexKushnir1 commented Jan 6, 2025

Description

The documented parameters for function createSubAccount are not appropriate namely contract

* Create a new sub-account under an existing account
* (e.g. create `sub.new.near` by signing with `new.near`)
* @param account name of the existing account under which the new account is created
* @param contract root contract for the target network (e.g. `testnet`)
* @param newAccount name of the created account
* @param newPublicKey public key for the created account's initial full access key
* @param initialBalance initial account balance in yN
* @param blockReference block ID/finality
* @param deps sign-and-send dependencies
*/
export async function createSubAccount({ account, newAccount, newPublicKey, initialBalance, blockReference, deps }: CreateAccountParams) {
return SignedTransactionComposer.init({ sender: account, receiver: newAccount, deps })
.createAccount()
.transfer(initialBalance)
.addFullAccessKey(newPublicKey)
.signAndSend(blockReference);
}

Also it"s weird for me that we must to pass the name of existing account and then new name with parent"s suffix. Like:

{
  account: 'true-pull.testnet',
  newAccount: 'alex.true-pull.testnet',
...

It"s need to be described, I"m not sure that we can change due to the design

Optional: User Story

As a user, I realy like the near-api-rs way to creating accounts and its checking is_sub_account_of()

I would like to work on it. Grateful for every feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: NEW❗
Development

No branches or pull requests

1 participant