You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/smart-accounts/3-custom-instruction.mdx
+5Lines changed: 5 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,11 @@ Only function calls with specific parameter values included can be registered.
80
80
That means that a new custom instruction needs to be registered for each unique action (though this can be done just seconds in advance).
81
81
It is also the reason why special FAsset actions have their own IDs, instead of defaulting to the custom call - it allows us to also specify certain parameters within the instructions on XRPL.
82
82
83
+
:::warning
84
+
Encoding calldata by hand is error prone.
85
+
It is recommended to use established libraries, or an [online tool](https://abi.hashex.org/) (if you want to quickly check something).
86
+
:::
87
+
83
88
## Call hash
84
89
85
90
To produce the custom instructions calldata, we first ABI encode the array of the `IMasterAccountController.CustomInstruction` struct.
Copy file name to clipboardExpand all lines: docs/smart-accounts/guides/01-fsa-cli.mdx
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,7 +89,7 @@ That number of lots of FXRP are burned from the user's smart account, and the sa
89
89
### `mint`
90
90
91
91
Mints a number of `lots` of FXRP to the user's smart account.
92
-
The script first reserves collateral with the agent with the `address`, by sending a `reserveCollateral` instruction.
92
+
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.
93
93
It then sends a `lots` amount of XRP to the agent's underlying address.
94
94
An executor, determined by the `MasterAccountController`, will complete the minting process, and `lots` of FXRP will be minted to the user's smart account.
95
95
@@ -114,7 +114,7 @@ Make a transaction to the `address`, paying the `value`, and attaching the `call
114
114
The `calldata` is the encoding of a function and its argument values, on the smart contract at the `address.
115
115
116
116
```sh
117
-
./smart_accounts.py bridge deposit -a <address> -v <value> -d <calldata>
117
+
./smart_accounts.py bridge custom -a <address> -v <value> -d <calldata>
118
118
```
119
119
120
120
Before making a transaction on XRPL with the necessary instructions, this command performs an additional step.
@@ -123,6 +123,13 @@ Then, it calls the `registerCustomInstruction` function of the `MasterAccountCon
123
123
124
124
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.
125
125
126
+
You can also use the command with json file containing an array of custom instructions.
127
+
Two provided json files in `json_examples/` directory demonstrate the expected format.
Copy file name to clipboardExpand all lines: docs/smart-accounts/guides/02-custom-instructions.mdx
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -80,6 +80,11 @@ We want to send `1 FLR` to the contract, and save it under number `42`.
80
80
The address of the `Foo` contract is `0x296432C15504Ed465fAce11E54Ce4aac50cCd8A3`.
81
81
Using an online ABI-encoding tool, we get that the following hash for the `bar` function, with `42` as input: `0x0423a132000000000000000000000000000000000000000000000000000000000000002a`.
82
82
83
+
:::warning
84
+
Encoding calldata by hand is error prone.
85
+
It is recommended to use established libraries, or an [online tool](https://abi.hashex.org/) (if you want to quickly check something).
86
+
:::
87
+
83
88
There are two ways we can go about developing the custom instructions.
84
89
We will start with an approach, which is what the production code would take.
85
90
Afterwards, we will use the the mock functions to speed up the development.
@@ -97,14 +102,14 @@ It is necessary to send some instructions, because that is what creates an accou
97
102
We then need to retrieve the smart account address.
0 commit comments