-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Description
Description
The documented parameters for function createSubAccount
are not appropriate namely contract
near-api-js/packages/client/src/transactions/create_account.ts
Lines 35 to 51 in c49fd67
* 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!
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Shipped 🚀