Skip to content

Commit

Permalink
Update naj-account.md (#1958)
Browse files Browse the repository at this point in the history
  • Loading branch information
PiVortex authored May 5, 2024
1 parent 7e6b932 commit 4fdbde3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions docs/4.tools/near-api-js/naj-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,22 @@ const account = await nearConnection.account("example-account.testnet");

### Create Account {#create-account}

Create a sub-account.

```js
// create a new account using funds from the account used to create it.
// creates a sub-account using funds from the account used to create it.
const account = await nearConnection.account("example-account.testnet");
await account.createAccount(
"example-account2.testnet", // new account name
"8hSHprDq2StXwMtNd43wDTXQYsjXcD4MJTXQYsjXcc", // public key for new account
"sub.example-account.testnet", // sub-account name
"8hSHprDq2StXwMtNd43wDTXQYsjXcD4MJTXQYsjXcc", // public key for sub account
"10000000000000000000" // initial balance for new account in yoctoNEAR
);
```

[<span className="typedoc-icon typedoc-icon-method"></span> Method `Account.createAccount`](https://near.github.io/near-api-js/classes/near_api_js.account.Account.html#createAccount)

For creating .near or .testnet accounts please refer to the [cookbook](https://github.com/near/near-api-js/tree/master/packages/cookbook/accounts).

### Delete Account {#delete-account}

```js
Expand Down

0 comments on commit 4fdbde3

Please sign in to comment.