massaging API encoding page
parent
c7e5881a6d
commit
fc13b2317c
@ -1,5 +1,55 @@
|
|||||||
# API Encoding (`xy_ABCD` strings)
|
# API Encoding (`xy_ABCD` strings)
|
||||||
|
|
||||||
|
## tl;dr
|
||||||
|
|
||||||
|
```erlang
|
||||||
|
%% DECODE: pull the binary data out of an xy_ABCD string
|
||||||
|
%% deconstructing and pulling useful data out of the resultant bytestring is a
|
||||||
|
%% different task (see Protocol page)
|
||||||
|
%% https://git.qpq.swiss/QPQ-AG/gmserialization/src/commit/dda5cac7a91ba0ad105815ec3cb1de551a04d719/src/gmser_api_encoder.erl#L69-L82
|
||||||
|
{KnownType, Payload} = gmser_api_encoder:decode(ApiStr)
|
||||||
|
|
||||||
|
%% ENCODE: from actual data to API garbage
|
||||||
|
%% https://git.qpq.swiss/QPQ-AG/gmserialization/src/commit/dda5cac7a91ba0ad105815ec3cb1de551a04d719/src/gmser_api_encoder.erl#L57-L67
|
||||||
|
ApiStr = gmser_api_encoder:encode(KnownType, Payload)
|
||||||
|
|
||||||
|
%% ApiStr :: binary()
|
||||||
|
%% Payload :: binary()
|
||||||
|
%% KnownType :: known_type()
|
||||||
|
|
||||||
|
%% https://git.qpq.swiss/QPQ-AG/gmserialization/src/commit/dda5cac7a91ba0ad105815ec3cb1de551a04d719/src/gmser_api_encoder.erl#L18-L46
|
||||||
|
-type known_type() :: key_block_hash
|
||||||
|
| micro_block_hash
|
||||||
|
| block_pof_hash
|
||||||
|
| block_tx_hash
|
||||||
|
| block_state_hash
|
||||||
|
| block_witness_hash
|
||||||
|
| channel
|
||||||
|
| contract_bytearray
|
||||||
|
| contract_pubkey
|
||||||
|
| contract_store_key
|
||||||
|
| contract_store_value
|
||||||
|
| contract_source
|
||||||
|
| transaction
|
||||||
|
| tx_hash
|
||||||
|
| account_pubkey
|
||||||
|
| account_seckey
|
||||||
|
| associate_chain
|
||||||
|
| entry
|
||||||
|
| signature
|
||||||
|
| name
|
||||||
|
| native_token
|
||||||
|
| commitment
|
||||||
|
| peer_pubkey
|
||||||
|
| state
|
||||||
|
| poi
|
||||||
|
| state_trees
|
||||||
|
| call_state_tree
|
||||||
|
| mp_tree_hash
|
||||||
|
| bytearray.
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
|
||||||
- [GMSerialization API Encoder](https://git.qpq.swiss/QPQ-AG/gmserialization/src/commit/ac64e01b0f675c1a34c70a827062f381920742db/src/gmser_api_encoder.erl)
|
- [GMSerialization API Encoder](https://git.qpq.swiss/QPQ-AG/gmserialization/src/commit/ac64e01b0f675c1a34c70a827062f381920742db/src/gmser_api_encoder.erl)
|
||||||
|
|||||||
26
Home.md
26
Home.md
@ -10,16 +10,28 @@
|
|||||||
|
|
||||||
## Principles
|
## Principles
|
||||||
|
|
||||||
- ~Every article should have a "YouTube Thumbnail" diagram at the top that
|
- **PICTURES:** ~Every article should have a "YouTube Thumbnail" diagram at the
|
||||||
visually illustrates whatever is explained in the page
|
top that visually illustrates whatever is explained in the page
|
||||||
- Things should be illustrated with code examples that work when possible
|
- **QUICKREF:** Every page should have a "I just need to get a thing to work
|
||||||
- Move links to aeternity things to QPQ repos
|
and don't have time to read a whole article" section that links to which
|
||||||
- Every article should have a "I just need to get a thing to work and don't
|
things you should just use in practice and maybe a short example of how to
|
||||||
have time to read a whole article" section that links to which things you
|
use them.
|
||||||
should just use in practice and maybe a short example of how to use them.
|
- **DEMOS DEMOS DEMOS:** Things should be illustrated with code examples that
|
||||||
|
work when possible
|
||||||
|
- **CENTRALIZE:** All public technical documentation should be on this wiki,
|
||||||
|
not in a billion separate repos.
|
||||||
|
- **LINK:** Provide receipts; i.e. whenever possible, provide a permalink
|
||||||
|
reference to whatever code actually does the thing you're talking about. For
|
||||||
|
instance, the [[API Encoding]] page should link to `gmser_api_encoder` source
|
||||||
|
code whenever it makes sense to do so.
|
||||||
|
|
||||||
|
Part of the goal of this wiki is to acquaint newcomers with the actual
|
||||||
|
gajumaru codebase and to demystify it.
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
|
|
||||||
|
- Move links to aeternity things to QPQ repos
|
||||||
|
|
||||||
- API-Encoding:
|
- API-Encoding:
|
||||||
- needs practical reference (which functions to call)
|
- needs practical reference (which functions to call)
|
||||||
- maybe could use a diagram
|
- maybe could use a diagram
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user