mirror of
https://github.com/Xahau/xahau-web.git
synced 2025-11-29 23:45:52 +00:00
@@ -64,7 +64,7 @@ if (tx_len <= 0)
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
```javascript
|
||||
const result = sto_validate(./tx_out)
|
||||
const result = sto_validate(tx_out)
|
||||
|
||||
if (result <= 0)
|
||||
rollback("Invalid STO.", 1)
|
||||
|
||||
@@ -45,7 +45,7 @@ function slot_float(slotno: number): ErrorCode | bigint
|
||||
<TabItem label="C">
|
||||
```c
|
||||
int64_t xfl =
|
||||
slot_float(./amt_slot);
|
||||
slot_float(amt_slot);
|
||||
```
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ int64_t xfl =
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
```javascript
|
||||
const xfl = slot_float(./amt_slot)
|
||||
const xfl = slot_float(amt_slot)
|
||||
```
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { Tabs, TabItem } from '@astrojs/starlight/components';
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
* Locate an object given the Keylet provided in `read_ptr`
|
||||
* Emplace the located object into the slot specified or into a new slot if no slot (./zero) is specified
|
||||
* Emplace the located object into the slot specified or into a new slot if no slot (zero) is specified
|
||||
</TabItem>
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
* Read a 32 byte Hook State key from the `kread_ptr`
|
||||
* Write the data (./value) at that key to the buffer pointed to by `write_ptr`
|
||||
* Write the data (value) at that key to the buffer pointed to by `write_ptr`
|
||||
</TabItem>
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
@@ -48,15 +48,15 @@ function state(key: ByteArray | HexString): ErrorCode | ByteArray
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
```c
|
||||
#define SBUF(./str) (uint32_t)(./str), sizeof(./str)
|
||||
if (state(SBUF(./vault), SBUF(./vault_key)) != 16)
|
||||
#define SBUF(str) (uint32_t)(str), sizeof(str)
|
||||
if (state(SBUF(vault), SBUF(vault_key)) != 16)
|
||||
rollback(SBUF("Error: could not read state!"), 1);
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
```javascript
|
||||
const value = state(SBUF(./vault), SBUF(./vault_key))
|
||||
const value = state(SBUF(vault), SBUF(vault_key))
|
||||
if (typeof value === 'number' || value.length != 16)
|
||||
rollback("Error: could not read state!", 1);
|
||||
```
|
||||
|
||||
@@ -12,7 +12,7 @@ import { Tabs, TabItem, Aside } from '@astrojs/starlight/components';
|
||||
<TabItem label="C">
|
||||
* Read a 20 byte Account ID from the `aread_ptr`
|
||||
* Read a 32 byte Hook State key from the `kread_ptr`
|
||||
* Write the data (./value) at that key at that Account ID to the buffer pointed to by `write_ptr`
|
||||
* Write the data (value) at that key at that Account ID to the buffer pointed to by `write_ptr`
|
||||
</TabItem>
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
@@ -57,10 +57,10 @@ function state_foreign(
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
```c
|
||||
#define SBUF(./str) (uint32_t)(./str), sizeof(./str)
|
||||
#define SBUF(str) (uint32_t)(str), sizeof(str)
|
||||
uint8_t ns[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
int64_t lookup =
|
||||
state_foreign(SBUF(./blacklist_status), SBUF(./otxn_accid), SBUF(./ns), SBUF(./blacklist_accid));
|
||||
state_foreign(SBUF(blacklist_status), SBUF(otxn_accid), SBUF(ns), SBUF(blacklist_accid));
|
||||
if (lookup < 0)
|
||||
rollback(SBUF("Error: could not find key on foreign state."), 1);
|
||||
```
|
||||
|
||||
@@ -61,8 +61,8 @@ function state_foreign_set(
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
```c
|
||||
#define SBUF(./str) (uint32_t)(./str), sizeof(./str)
|
||||
if (state_foreign_set(SBUF(./vault), SBUF(./vault_key), SBUF(./namespace), SBUF(./account)) < 0)
|
||||
#define SBUF(str) (uint32_t)(str), sizeof(str)
|
||||
if (state_foreign_set(SBUF(vault), SBUF(vault_key), SBUF(namespace), SBUF(account)) < 0)
|
||||
rollback(SBUF("Error: could not set foreign state!"), 1);
|
||||
```
|
||||
</TabItem>
|
||||
@@ -83,8 +83,8 @@ if (state_foreign_set(vault, vault_key, namespace, account) < 0)
|
||||
<TabItem label="C">
|
||||
| Name | Type | Description |
|
||||
| ---------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| read_ptr | uint32_t | <p>Pointer to the data (./value) to write into Hook State.<br />If this is <code>0</code> (./null) then delete the data at this key. <em>May be null.</em></p> |
|
||||
| read_len | uint32_t | <p>The length of the data.<br />If this is <code>0</code> (./null) then delete the data at this key. <em>May be null.</em></p> |
|
||||
| read_ptr | uint32_t | <p>Pointer to the data (value) to write into Hook State.<br />If this is <code>0</code> (null) then delete the data at this key. <em>May be null.</em></p> |
|
||||
| read_len | uint32_t | <p>The length of the data.<br />If this is <code>0</code> (null) then delete the data at this key. <em>May be null.</em></p> |
|
||||
| kread_ptr | uint32_t | A pointer to the Hook State key at which to store the value. |
|
||||
| kread_len | uint32_t | The length of the key. (Should always be 32.) |
|
||||
| nread_ptr | uint32_t | A pointer to the namespace which the key belongs to. |
|
||||
|
||||
@@ -50,13 +50,13 @@ function state_set(
|
||||
<Tabs>
|
||||
<TabItem label="C">
|
||||
```c
|
||||
#define SBUF(./str) (uint32_t)(./str), sizeof(./str)
|
||||
if (state_set(SBUF(./vault), SBUF(./vault_key)) < 0)
|
||||
#define SBUF(str) (uint32_t)(str), sizeof(str)
|
||||
if (state_set(SBUF(vault), SBUF(vault_key)) < 0)
|
||||
rollback(SBUF("Error: could not set state!"), 1);
|
||||
```
|
||||
|
||||
<Aside type="tip">
|
||||
To delete the state use `state_set(0, 0, SBUF(./key);`.
|
||||
To delete the state use `state_set(0, 0, SBUF(key);`.
|
||||
</Aside>
|
||||
</TabItem>
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ if (util_sha512h(hash_out, 32, data_in_ptr, data_in_len) < 0)
|
||||
|
||||
<TabItem label="JavaScript">
|
||||
```javascript
|
||||
if (util_sha512h(./data) < 0)
|
||||
if (util_sha512h(data) < 0)
|
||||
rollback("Could not generate Hash", 1)
|
||||
```
|
||||
</TabItem>
|
||||
|
||||
@@ -36,7 +36,7 @@ An `AccountRoot` object has the following fields:
|
||||
| ---------------------- | --------- | ------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `Account` | String | AccountID | Yes | The identifying (classic) address of this account. |
|
||||
| `Sequence` | Number | UInt32 | Yes | The sequence number of the next valid transaction for this account. |
|
||||
| `Balance` | String | Amount | No | The account's current \[XAH balance in drops][drops of XAH], represented as a string. |
|
||||
| `Balance` | String | Amount | No | The account's current [XAH balance in drops][drops of XAH], represented as a string. |
|
||||
| `OwnerCount` | Number | UInt32 | Yes | The number of objects this account owns in the ledger, which contributes to its owner reserve. |
|
||||
| `PreviousTxnID` | String | Hash256 | Yes | The identifying hash of the transaction that most recently modified this object. |
|
||||
| `PreviousTxnLgrSeq` | Number | UInt32 | Yes | The \[index of the ledger]\[Ledger Index] that contains the transaction that most recently modified this object. |
|
||||
|
||||
Reference in New Issue
Block a user