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

feat: New command export-account #226

Merged
merged 58 commits into from
Sep 9, 2023
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b6db103
start
Jun 28, 2023
92d458f
added is_used_account_list_exist()
Jun 28, 2023
5d3ad3a
added get_used_account_list()
Jun 28, 2023
98887da
added update_used_account_list()
Jun 28, 2023
4c49962
refactored get_used_account_list()
Jun 29, 2023
976455e
clippy
Jun 29, 2023
4cce503
refactored AddKeyCommand
Jun 29, 2023
6e5a13b
refactored input_owner_account_id()
Jun 29, 2023
5fb1bc4
refactored input_owner_account_id()
Jun 29, 2023
3a0d673
refactored ViewAccountSummary
Jun 29, 2023
7f3c009
refactored input_account_id_from_used_account_list
Jun 29, 2023
f73c639
refactored create-account (fund-myself)
Jun 29, 2023
c9d519a
refactored DeleteAccount
Jun 29, 2023
55d6739
refactored ViewListKeys
Jun 29, 2023
984a7b2
refactored DeleteKeyCommand
Jun 29, 2023
8e19524
refactored ManageStorageDeposit
Jun 29, 2023
5d901a2
refactored input_account_id_from_used_account_list
Jun 30, 2023
7992832
fixed create_used_account_list_from_keychain
Jun 30, 2023
6427598
refactored TokensCommands
Jun 30, 2023
dfbabd8
refactored update_used_account_list()
Jul 1, 2023
5640c9a
fixed CreateAccount
Jul 1, 2023
5044157
updated ImportAccountCommand
Jul 2, 2023
5decf9c
refactored ContractCommands
Jul 2, 2023
bf1ed07
refactored TransactionActions
Jul 2, 2023
fa06d0a
started export-account
Jul 4, 2023
f97cd45
refactored
Jul 5, 2023
07ef901
added UsingPrivateKey to export-account
Jul 5, 2023
97ddce5
refactored
Jul 6, 2023
7b59747
Update src/commands/account/add_key/mod.rs
FroVolod Jul 6, 2023
544e677
fixed
Jul 6, 2023
03fd212
refactored
Jul 6, 2023
efa076e
added UsingSeedPhrase to export-account
Jul 6, 2023
929e087
refactored
Jul 9, 2023
70851f9
resolved conflicts
Jul 11, 2023
85bb197
Merge branch 'master' into feat/new-command-export-account
FroVolod Jul 11, 2023
428b852
fixed
Jul 11, 2023
70fe5cb
added "Storage management" for GUIDE
Jul 14, 2023
775b67e
added "Export existing account" for GUIDE
Jul 14, 2023
d70e27a
Merge branch 'master' into feat/new-command-export-account
FroVolod Aug 23, 2023
8e642d6
Merge branch 'master' into feat/new-command-export-account
FroVolod Aug 29, 2023
de6a84d
updated to PR #225 (order networks selection ...)
Aug 29, 2023
7194da9
clippy
Aug 29, 2023
f4c38f1
refactored
Sep 1, 2023
4649d6e
I will adjust this code after #195
Sep 1, 2023
dd901a7
Merge branch 'master' into feat/new-command-export-account
FroVolod Sep 1, 2023
08c31c4
refactored for "keyring"
Sep 2, 2023
af92b01
fmt
Sep 2, 2023
9d7a9d4
fmt
Sep 2, 2023
67bc6d8
Merge branch 'master' into feat/new-command-export-account
FroVolod Sep 3, 2023
9ddee92
Merge branch 'master' into feat/new-command-export-account
FroVolod Sep 4, 2023
cdf86d8
Update src/commands/account/export_account/mod.rs
FroVolod Sep 5, 2023
900d3fc
Update src/commands/account/export_account/mod.rs
FroVolod Sep 5, 2023
b77ceb8
refactored
Sep 5, 2023
dbeaced
Update src/commands/account/export_account/mod.rs
FroVolod Sep 9, 2023
8f5e329
Update src/commands/account/export_account/mod.rs
FroVolod Sep 9, 2023
ed393bc
refactored get_account_properties_data_path()
Sep 9, 2023
be00cb3
fmt
Sep 9, 2023
c3c624f
Merge branch 'master' into feat/new-command-export-account
frol Sep 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions docs/GUIDE.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ View account details ([View properties for an account](#view-account-summary---v
- [list-keys](#list-keys---View-a-list-of-access-keys-of-an-account)
- [add-key](#add-key---Add-an-access-key-to-an-account)
- [delete-key](#delete-key---Delete-an-access-key-from-an-account)
- [manage-storage-deposit](#manage-storage-deposit---Storage-management-deposit-withdrawal-balance-review)

#### view-account-summary - View properties for an account

Expand Down Expand Up @@ -314,6 +315,72 @@ The data for the access key is saved in macOS Keychain
</a>
</details>

#### export-account - Export existing account

- [using-web-wallet](#using-web-wallet---Export-existing-account-using-NEAR-Wallet-aka-sign-in)
- [using-seed-phrase](#using-seed-phrase---Export-existing-account-using-a-seed-phrase)
- [using-private-key](#using-private-key---Export-existing-account-using-a-private-key)


#### using-web-wallet - Export existing account using NEAR Wallet

To export an existing account, enter in the terminal command line:
```txt
near account \
export-account volodymyr.testnet \
using-web-wallet \
network-config testnet
```

You will be redirected to the browser for authorization.
Default wallet url is https://app.mynearwallet.com/ (for testnet - https://testnet.mynearwallet.com/). But if you want to change to a different wallet url, you can use `--wallet-url` option:
```txt
near account \
export-account volodymyr.testnet \
using-web-wallet \
network-config testnet\
--wallet-url 'https://wallet.testnet.near.org/'
```
<details><summary><i>Demonstration of the command in interactive mode</i></summary>
<a href="https://asciinema.org/a/QqVhhVaBP4MP7XFDeb6arIB3S?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/QqVhhVaBP4MP7XFDeb6arIB3S.png" width="836"/>
</a>
</details>

#### using-seed-phrase - Export existing account using a seed phrase

To export an existing account, enter in the terminal command line:
```txt
near account \
export-account volodymyr.testnet \
using-seed-phrase \
network-config testnet
```

<details><summary><i>The result of this command will be as follows:</i></summary>

```txt
Here is the secret recovery seed phrase for account <volodymyr.testnet>: "feature army carpet ..." (HD Path: m/44'/397'/0').
```
</details>

#### using-private-key - Export existing account using a private key

To export an existing account, enter in the terminal command line:
```txt
near account \
export-account volodymyr.testnet \
using-private-key \
network-config testnet
```

<details><summary><i>The result of this command will be as follows:</i></summary>

```txt
Here is the private key for account <volodymyr.testnet>: ed25519:4TKr1c7p...y7p8BvGdB
```
</details>

#### create-account - Create a new account

- sponsor-by-linkdrop (Not implemented yet)
Expand Down Expand Up @@ -871,6 +938,93 @@ https://explorer.testnet.near.org/transactions/6S7bJ76QNFypUvP7PCB1hkLM7X5GxPxP2
</a>
</details>

#### manage-storage-deposit - Storage management: deposit, withdrawal, balance review

- [view-balance](#view-balance---View-storage-balance-for-an-account)
- [deposit](#deposit---Make-a-storage-deposit-for-the-account)
- [withdraw](#withdraw---Withdraw-a-deposit-from-storage-for-an-account-ID)

##### view-balance - View storage balance for an account

To view the account balance on the contract on the last block, you must enter in the terminal command line:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
view-balance volodymyr.testnet \
network-config testnet \
now
```

<details><summary><i>The result of this command will be as follows:</i></summary>

```txt
storage balance for <volodymyr.testnet>:
available: 1.6 MB (15.878059999854543210876557 NEAR [ 15878059999854543210876557 yoctoNEAR])
total: 1.6 MB (16.238949999854543210876557 NEAR [ 16238949999854543210876557 yoctoNEAR])
```
</details>

<details><summary><i>Demonstration of the command in interactive mode</i></summary>
<a href="https://asciinema.org/a/mxCOOQk8xRLvY4mIhDsrapwmG?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/mxCOOQk8xRLvY4mIhDsrapwmG.png" width="836"/>
</a>
</details>

##### deposit - Make a storage deposit for the account

To add a deposit to the account balance under the contract, you must enter in the terminal command line:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
deposit volodymyr.testnet '1 NEAR' \
sign-as fro_volod.testnet \
network-config testnet \
sign-with-macos-keychain \
send
```

<details><summary><i>The result of this command will be as follows:</i></summary>

```txt
<fro_volod.testnet> has successfully added a deposit of 1 NEAR to <volodymyr.testnet> on contract <v1.social08.testnet>.
```
</details>

<details><summary><i>Demonstration of the command in interactive mode</i></summary>
<a href="https://asciinema.org/a/QXXvnhz2HasKtQdT5KPVr6d1n?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/QXXvnhz2HasKtQdT5KPVr6d1n.png" width="836"/>
</a>
</details>

##### withdraw - Withdraw a deposit from storage for an account ID

To withdraw funds from the account balance under the contract, you must enter in the terminal command line:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
withdraw '0.5 NEAR' \
sign-as volodymyr.testnet \
network-config testnet \
sign-with-keychain \
send
```

<details><summary><i>The result of this command will be as follows:</i></summary>

```txt
<volodymyr.testnet> has successfully withdraw 0.5 NEAR from <v1.social08.testnet>.
```
</details>

<details><summary><i>Demonstration of the command in interactive mode</i></summary>
<a href="https://asciinema.org/a/veTOTpLZZ6mKHxkn0zizpXcjx?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/veTOTpLZZ6mKHxkn0zizpXcjx.png" width="836"/>
</a>
</details>

### tokens - Manage token assets such as NEAR, FT, NFT
- [send-near](#send-near---The-transfer-is-carried-out-in-NEAR-tokens)
- [send-ft](#send-ft---The-transfer-is-carried-out-in-FT-tokens)
Expand Down
157 changes: 156 additions & 1 deletion docs/GUIDE.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,14 @@ near --offline tokens \
Просмотреть сведения об аккаунте ([View properties for an account](#view-account-summary---view-properties-for-an-account)) и просмотреть ключи доступа к аккаунту ([View a list of access keys of an account](#list-keys---View-a-list-of-access-keys-of-an-account)) возможно на текущий момент времени (***now***) и на определеный момент в прошлом, указав блок (***at-block-height*** или ***at-block-hash***). На примерах ниже показаны варианты применения этих режимов.

- [view-account-summary](#view-account-summary---View-properties-for-an-account)
- [import-account](#import-account---import-existing-account-aka-sign-in)
- [import-account](#import-account---Import-existing-account-aka-sign-in)
- [export-account](#export-account---Export-existing-account)
- [create-account](#create-account---Create-a-new-account)
- [delete-account](#delete-account---Delete-an-account)
- [list-keys](#list-keys---View-a-list-of-access-keys-of-an-account)
- [add-key](#add-key---Add-an-access-key-to-an-account)
- [delete-key](#delete-key---Delete-an-access-key-from-an-account)
- [manage-storage-deposit](#manage-storage-deposit---Storage-management-deposit-withdrawal-balance-review)

#### view-account-summary - View properties for an account

Expand Down Expand Up @@ -313,6 +315,72 @@ The data for the access key is saved in macOS Keychain
</a>
</details>

#### export-account - Export existing account

- [using-web-wallet](#using-web-wallet---Export-existing-account-using-NEAR-Wallet-aka-sign-in)
- [using-seed-phrase](#using-seed-phrase---Export-existing-account-using-a-seed-phrase)
- [using-private-key](#using-private-key---Export-existing-account-using-a-private-key)


#### using-web-wallet - Export existing account using NEAR Wallet

Для экспорта существующего аккаунта необходимо ввести в командной строке терминала:
```txt
near account \
export-account volodymyr.testnet \
using-web-wallet \
network-config testnet
```

Вы будете перенаправлены браузер.
По умолчанию - это https://app.mynearwallet.com/ (для testnet - https://testnet.mynearwallet.com/). Но вы можете изменить адрес для авторизации с помощью флага `--wallet-url`:
```txt
near account \
export-account volodymyr.testnet \
using-web-wallet \
network-config testnet\
--wallet-url 'https://wallet.testnet.near.org/'
```
<details><summary><i>Демонстрация работы команды в интерактивном режиме</i></summary>
<a href="https://asciinema.org/a/QqVhhVaBP4MP7XFDeb6arIB3S?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/QqVhhVaBP4MP7XFDeb6arIB3S.png" width="836"/>
</a>
</details>

#### using-seed-phrase - Export existing account using a seed phrase

Для экспорта существующего аккаунта необходимо ввести в командной строке терминала:
```txt
near account \
export-account volodymyr.testnet \
using-seed-phrase \
network-config testnet
```

<details><summary><i>Результат выполнения команды</i></summary>

```txt
Here is the secret recovery seed phrase for account <volodymyr.testnet>: "feature army carpet ..." (HD Path: m/44'/397'/0').
```
</details>

#### using-private-key - Export existing account using a private key

Для экспорта существующего аккаунта необходимо ввести в командной строке терминала:
```txt
near account \
export-account volodymyr.testnet \
using-private-key \
network-config testnet
```

<details><summary><i>Результат выполнения команды</i></summary>

```txt
Here is the private key for account <volodymyr.testnet>: ed25519:4TKr1c7p...y7p8BvGdB
```
</details>

#### create-account - Create a new account

- sponsor-by-linkdrop (Находится в разработке)
Expand Down Expand Up @@ -872,6 +940,93 @@ https://explorer.testnet.near.org/transactions/6S7bJ76QNFypUvP7PCB1hkLM7X5GxPxP2
</a>
</details>

#### manage-storage-deposit - Storage management: deposit, withdrawal, balance review

- [view-balance](#view-balance---View-storage-balance-for-an-account)
- [deposit](#deposit---Make-a-storage-deposit-for-the-account)
- [withdraw](#withdraw---Withdraw-a-deposit-from-storage-for-an-account-ID)

##### view-balance - View storage balance for an account

Для просмотра баланса аккаунта на контракте на последнем блоке необходимо ввести в командной строке терминала:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
view-balance volodymyr.testnet \
network-config testnet \
now
```

<details><summary><i>Результат выполнения команды</i></summary>

```txt
storage balance for <volodymyr.testnet>:
available: 1.6 MB (15.878059999854543210876557 NEAR [ 15878059999854543210876557 yoctoNEAR])
total: 1.6 MB (16.238949999854543210876557 NEAR [ 16238949999854543210876557 yoctoNEAR])
```
</details>

<details><summary><i>Демонстрация работы команды в интерактивном режиме</i></summary>
<a href="https://asciinema.org/a/mxCOOQk8xRLvY4mIhDsrapwmG?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/mxCOOQk8xRLvY4mIhDsrapwmG.png" width="836"/>
</a>
</details>

##### deposit - Make a storage deposit for the account

Для пополнения баланса аккаунта на контракте необходимо ввести в командной строке терминала:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
deposit volodymyr.testnet '1 NEAR' \
sign-as fro_volod.testnet \
network-config testnet \
sign-with-macos-keychain \
send
```

<details><summary><i>Результат выполнения команды</i></summary>

```txt
<fro_volod.testnet> has successfully added a deposit of 1 NEAR to <volodymyr.testnet> on contract <v1.social08.testnet>.
```
</details>

<details><summary><i>Демонстрация работы команды в интерактивном режиме</i></summary>
<a href="https://asciinema.org/a/QXXvnhz2HasKtQdT5KPVr6d1n?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/QXXvnhz2HasKtQdT5KPVr6d1n.png" width="836"/>
</a>
</details>

##### withdraw - Withdraw a deposit from storage for an account ID

Для вывода средств с баланса аккаунта на контракте необходимо ввести в командной строке терминала:

```txt
near account \
manage-storage-deposit v1.social08.testnet \
withdraw '0.5 NEAR' \
sign-as volodymyr.testnet \
network-config testnet \
sign-with-keychain \
send
```

<details><summary><i>Результат выполнения команды</i></summary>

```txt
<volodymyr.testnet> has successfully withdraw 0.5 NEAR from <v1.social08.testnet>.
```
</details>

<details><summary><i>Демонстрация работы команды в интерактивном режиме</i></summary>
<a href="https://asciinema.org/a/veTOTpLZZ6mKHxkn0zizpXcjx?autoplay=1&t=1&speed=2">
<img src="https://asciinema.org/a/veTOTpLZZ6mKHxkn0zizpXcjx.png" width="836"/>
</a>
</details>

### tokens - Manage token assets such as NEAR, FT, NFT
- [send-near](#send-near---The-transfer-is-carried-out-in-NEAR-tokens)
- [send-ft](#send-ft---The-transfer-is-carried-out-in-FT-tokens)
Expand Down
Loading
Loading