Skip to content

Commit d5df17b

Browse files
feat(docs): update cli commands
1 parent 590f7f6 commit d5df17b

File tree

1 file changed

+74
-15
lines changed

1 file changed

+74
-15
lines changed

docs/smart-accounts/guides/01-fsa-cli.mdx

Lines changed: 74 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,21 @@ You can then run the script with the command:
5252
smart_accounts [-h] [--version] {bridge,debug} ...
5353
```
5454

55+
## `encode` command
56+
57+
The `encode` command prints encoded memo fields that can be used in XRPL transactions to instruct the operator to perform certain actions on Flare.
58+
It allows for the following positional arguments: `deposit`, `withdraw`, `redeem`, `mint`, `claim-withdraw`, and `custom`.
59+
The command produces a payment reference corresponding to each instruction type.
60+
61+
For example, the following command
62+
63+
```sh
64+
./smart_accounts.py encode mint -l 1
65+
```
66+
67+
would result in the payment reference `0100000000000000000000000000000000000000000000000000000000000001`.
68+
The first `01` here signals that it is a `mint` instruction, while the remaining bytes give the amount - in this case `1`.
69+
5570
## `bridge` command
5671

5772
The `bridge` command executes an XRPL transaction with instructions for one of the actions, determined by the positional argument provided.
@@ -88,14 +103,18 @@ That number of lots of FXRP are burned from the user's smart account, and the sa
88103
### `mint`
89104

90105
Mints a number of `lots` of FXRP to the user's smart account.
91-
The script first reserves collateral with the agent with the `address` (if you are unsure what agent to choose on coston2, use `0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC`), by sending a `reserveCollateral` instruction.
106+
The script first reserves collateral with the agent with the `address`, by sending a `reserveCollateral` instruction.
92107
It then sends a `lots` amount of XRP to the agent's underlying address.
93108
An executor, determined by the `MasterAccountController`, will complete the minting process, and `lots` of FXRP will be minted to the user's smart account.
94109

95110
```sh
96111
./smart_accounts.py bridge mint -a <address> -l <lots>
97112
```
98113

114+
:::info
115+
On Coston2, you can use `0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC` as the agent address.
116+
:::
117+
99118
### `claim-withdraw`
100119

101120
Complete the withdrawal process from the Firelight vault by claiming the funds.
@@ -122,18 +141,67 @@ Then, it calls the `registerCustomInstruction` function of the `MasterAccountCon
122141

123142
Thus, it both registers a custom instruction with the `MasterAccountController` contract and retrieves the required `callHash`, which it can then send to the operator's XRPL address as instructions.
124143

125-
You can also use the command with json file containing an array of custom instructions.
126-
Two provided json files in `json_examples/` directory demonstrate the expected format.
144+
Instead of the `address`, `value` and `calldata` parameters, a JSON file with an array of custom instructions can be used.
145+
The command then reads as follows:
146+
147+
```sh
148+
./smart_accounts.py bridge custom <json_file>
149+
```
150+
151+
## `personal-account` command
152+
153+
The `personal-account` command gives insight into personal accounts of XRPL addresses.
154+
{/* TODO:(Nik) is it equivalent to calling getPersonalAccount */}
155+
156+
It allows for the following positional arguments: `print` and `faucet`.
157+
158+
### `print`
159+
160+
Prints the Flare address of the personal account belonging to the `xrpl_address`.
161+
162+
```sh
163+
./smart_accounts.py personal-account print <xrpl_address>
164+
```
165+
166+
### `faucet`
167+
168+
{/* TODO:(Nik) fix the bellow text once it can faucet */}
169+
Prints the Flare address of the personal account belonging to the `xrpl_address` and the faucet instructions.
170+
In the future, it will faucet funds to the address instead.
127171

128172
```sh
129-
./smart_accounts.py bridge custom json_example/sendFXRPCoston.json
173+
./smart_accounts.py personal-account faucet <xrpl_address>
130174
```
131175

132176
## `debug` command
133177

134178
The `debug` command offers some utility options for running the CLI.
135179
It allows three positional arguments: `mock-custom`, `check-status`, and `simulation`.
136180

181+
### `mock-print`
182+
183+
Prints the Flare address of the personal account created by the mock `MasterAccountController` contract from the `seed` string.
184+
The personal account is created by the `createFundPersonalAccount` developer function.
185+
It represents the XRPL "address" of the concatenated string of `msg.sender` and `seed`.
186+
This allows for easier creation of multiple personal accounts with invocative names, for easier development.
187+
188+
```sh
189+
./smart_accounts.py debug mock-print -s <seed>
190+
```
191+
192+
### `mock-create-fund`
193+
194+
Creates a personal account for the `seed` address string through the `MasterAccountController` contract, and sends to it the `value` amount.
195+
The personal account is created by the `createFundPersonalAccount` developer function.
196+
It represents the XRPL "address" of the concatenated string of `msg.sender` and `seed`.
197+
This allows for easier creation of multiple personal accounts with invocative names, for easier development.
198+
199+
```sh
200+
./smart_accounts.py debug mock-create-fund -s <seed> -v <value>
201+
```
202+
203+
The `value` can be expressed as as `flr` (ex. `42flr`).
204+
137205
### `mock-custom`
138206

139207
Simulate a custom instruction with the mock `MasterAccountController` contract.
@@ -147,10 +215,10 @@ The `seed` is a string representing an XRPL account.
147215
./smart_accounts.py debug mock-custom -s <seed> -a <address> -v <value> -d <calldata>
148216
```
149217

150-
As with the `custom` command, you can also use a json file containing an array of custom instructions.
218+
As with the `custom` command, a JSON file containing an array of custom instructions can be used.
151219

152220
```sh
153-
./smart_accounts.py debug mock-custom -s <seed> json_example/sendFXRPCoston.json
221+
./smart_accounts.py debug mock-custom -s <seed> <json_file>
154222
```
155223

156224
### `check-status`
@@ -179,12 +247,3 @@ This is equivalent to running the following commands:
179247
./smart_accounts.py bridge claim-withdraw
180248
./smart_accounts.py bridge redeem -l <mint>
181249
```
182-
183-
## `encode` command
184-
185-
The `encode` command prints encoded memo fields that can be used in XRPL transactions to instruct the operator to perform certain actions on Flare.
186-
187-
```sh
188-
./smart_accounts.py encode custom json_example/requestRedemption.json
189-
./smart_accounts.py encode mint -l 1
190-
```

0 commit comments

Comments
 (0)