generated from okp4/template-oss
-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #571 from okp4/docs/one-md-per-predicate
Docs/one md per predicate
- Loading branch information
Showing
37 changed files
with
725 additions
and
589 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
sidebar_position: 1 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# bank_balances/2 | ||
|
||
## Description | ||
|
||
`bank_balances/2` is a predicate which unifies the given terms with the list of balances \(coins\) of the given account. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
bank_balances(?Account, ?Balances) | ||
``` | ||
|
||
where: | ||
|
||
- Account represents the account address \(in Bech32 format\). | ||
- Balances represents the balances of the account as a list of pairs of coin denomination and amount. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the balances of the account. | ||
- bank_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', X). | ||
# Query the balances of all accounts. The result is a list of pairs of account address and balances. | ||
- bank_balances(X, Y). | ||
# Query the first balance of the given account by unifying the denomination and amount with the given terms. | ||
- bank_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', [-(D, A), _]). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
sidebar_position: 2 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# bank_locked_balances/2 | ||
|
||
## Description | ||
|
||
`bank_locked_balances/2` is a predicate which unifies the given terms with the list of locked coins of the given account. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
bank_locked_balances(?Account, ?Balances) | ||
``` | ||
|
||
where: | ||
|
||
- Account represents the account address \(in Bech32 format\). | ||
- Balances represents the locked balances of the account as a list of pairs of coin denomination and amount. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the locked coins of the account. | ||
- bank_locked_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', X). | ||
# Query the locked balances of all accounts. The result is a list of pairs of account address and balances. | ||
- bank_locked_balances(X, Y). | ||
# Query the first locked balances of the given account by unifying the denomination and amount with the given terms. | ||
- bank_locked_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', [-(D, A), _]). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
sidebar_position: 3 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# bank_spendable_balances/2 | ||
|
||
## Description | ||
|
||
`bank_spendable_balances/2` is a predicate which unifies the given terms with the list of spendable coins of the given account. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
bank_spendable_balances(?Account, ?Balances) | ||
``` | ||
|
||
where: | ||
|
||
- Account represents the account address \(in Bech32 format\). | ||
- Balances represents the spendable balances of the account as a list of pairs of coin denomination and amount. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the spendable balances of the account. | ||
- bank_spendable_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', X). | ||
# Query the spendable balances of all accounts. The result is a list of pairs of account address and balances. | ||
- bank_spendable_balances(X, Y). | ||
# Query the first spendable balances of the given account by unifying the denomination and amount with the given terms. | ||
- bank_spendable_balances('okp41ffd5wx65l407yvm478cxzlgygw07h79sq0m3fm', [-(D, A), _]). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
--- | ||
sidebar_position: 4 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# bech32_address/2 | ||
|
||
## Description | ||
|
||
`bech32_address/2` is a predicate that convert a [bech32](<https://docs.cosmos.network/main/build/spec/addresses/bech32#hrp-table>) encoded string into [base64](<https://fr.wikipedia.org/wiki/Base64>) bytes and give the address prefix, or convert a prefix \(HRP\) and [base64](<https://fr.wikipedia.org/wiki/Base64>) encoded bytes to [bech32](<https://docs.cosmos.network/main/build/spec/addresses/bech32#hrp-table>) encoded string. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
bech32_address(-Address, +Bech32) | ||
bech32_address(+Address, -Bech32) | ||
bech32_address(+Address, +Bech32) | ||
``` | ||
|
||
where: | ||
|
||
- Address is a pair of the HRP \(Human\-Readable Part\) which holds the address prefix and a list of numbers ranging from 0 to 255 that represent the base64 encoded bech32 address string. | ||
- Bech32 is an Atom or string representing the bech32 encoded string address | ||
|
||
## Examples | ||
|
||
```text | ||
# Convert the given bech32 address into base64 encoded byte by unify the prefix of given address (Hrp) and the | ||
base64 encoded value (Address). | ||
- bech32_address(-(Hrp, Address), 'okp415wn30a9z4uc692s0kkx5fp5d4qfr3ac7sj9dqn'). | ||
# Convert the given pair of HRP and base64 encoded address byte by unify the Bech32 string encoded value. | ||
- bech32_address(-('okp4', [163,167,23,244,162,175,49,162,170,15,181,141,68,134,141,168,18,56,247,30]), Bech32). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 5 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# block_height/1 | ||
|
||
## Description | ||
|
||
`block_height/1` is a predicate which unifies the given term with the current block height. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
block_height(?Height) | ||
``` | ||
|
||
where: | ||
|
||
- Height represents the current chain height at the time of the query. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the current block height. | ||
- block_height(Height). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 6 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# block_time/1 | ||
|
||
## Description | ||
|
||
`block_time/1` is a predicate which unifies the given term with the current block time. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
block_time(?Time) | ||
``` | ||
|
||
where: | ||
|
||
- Time represents the current chain time at the time of the query. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the current block time. | ||
- block_time(Time). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
sidebar_position: 7 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# chain_id/1 | ||
|
||
## Description | ||
|
||
`chain_id/1` is a predicate which unifies the given term with the current chain ID. The signature is: | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
chain_id(?ID) | ||
``` | ||
|
||
where: | ||
|
||
- ID represents the current chain ID at the time of the query. | ||
|
||
## Examples | ||
|
||
```text | ||
# Query the current chain ID. | ||
- chain_id(ID). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# crypto_data_hash/3 | ||
|
||
## Description | ||
|
||
`crypto_data_hash/3` is a predicate that computes the Hash of the given Data using different algorithms. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
crypto_data_hash(+Data, -Hash, +Options) is det | ||
crypto_data_hash(+Data, +Hash, +Options) is det | ||
``` | ||
|
||
Where: | ||
|
||
- Data represents the data to be hashed, given as an atom, or code\-list. | ||
- Hash represents the Hashed value of Data, which can be given as an atom or a variable. | ||
- Options are additional configurations for the hashing process. Supported options include: encoding\(\+Format\) which specifies the encoding used for the Data, and algorithm\(\+Alg\) which chooses the hashing algorithm among the supported ones \(see below for details\). | ||
|
||
For Format, the supported encodings are: | ||
|
||
- utf8 \(default\), the UTF\-8 encoding represented as an atom. | ||
- text, the plain text encoding represented as an atom. | ||
- hex, the hexadecimal encoding represented as an atom. | ||
- octet, the raw byte encoding depicted as a list of integers ranging from 0 to 255. | ||
|
||
For Alg, the supported algorithms are: | ||
|
||
- sha256 \(default\): The SHA\-256 algorithm. | ||
- sha512: The SHA\-512 algorithm. | ||
- md5: \(insecure\) The MD5 algorithm. | ||
|
||
Note: Due to the principles of the hash algorithm \(pre\-image resistance\), this predicate can only compute the hash value from input data, and cannot compute the original input data from the hash value. | ||
|
||
## Examples | ||
|
||
```text | ||
# Compute the SHA-256 hash of the given data and unify it with the given Hash. | ||
- crypto_data_hash('Hello OKP4', Hash). | ||
# Compute the SHA-256 hash of the given hexadecimal data and unify it with the given Hash. | ||
- crypto_data_hash('9b038f8ef6918cbb56040dfda401b56b...', Hash, encoding(hex)). | ||
# Compute the SHA-256 hash of the given hexadecimal data and unify it with the given Hash. | ||
- crypto_data_hash([127, ...], Hash, encoding(octet)). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
sidebar_position: 9 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# did_components/2 | ||
|
||
## Description | ||
|
||
`did_components/2` is a predicate which breaks down a DID into its components according to the [W3C DID](<https://w3c.github.io/did-core>) specification. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
did_components(+DID, -Components) is det | ||
did_components(-DID, +Components) is det | ||
``` | ||
|
||
where: | ||
|
||
- DID represent DID URI, given as an Atom, compliant with [W3C DID](<https://w3c.github.io/did-core>) specification. | ||
- Components is a compound Term in the format did\(Method, ID, Path, Query, Fragment\), aligned with the [DID syntax](<https://w3c.github.io/did-core/#did-syntax>), where: Method is the method name, ID is the method\-specific identifier, Path is the path component, Query is the query component and Fragment is the fragment component. Values are given as an Atom and are url encoded. For any component not present, its value will be null and thus will be left as an uninstantiated variable. | ||
|
||
## Examples | ||
|
||
```text | ||
# Decompose a DID into its components. | ||
- did_components('did:example:123456?versionId=1', did_components(Method, ID, Path, Query, Fragment)). | ||
# Reconstruct a DID from its components. | ||
- did_components(DID, did_components('example', '123456', _, 'versionId=1', _42)). | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
sidebar_position: 10 | ||
--- | ||
[//]: # (This file is auto-generated. Please do not modify it yourself.) | ||
|
||
# ecdsa_verify/4 | ||
|
||
## Description | ||
|
||
`ecdsa_verify/4` determines if a given signature is valid as per the ECDSA algorithm for the provided data, using the specified public key. | ||
|
||
The signature is as follows: | ||
|
||
```text | ||
ecdsa_verify(+PubKey, +Data, +Signature, +Options), which is semi-deterministic. | ||
``` | ||
|
||
Where: | ||
|
||
- PubKey is the 33\-byte compressed public key, as specified in section 4.3.6 of ANSI X9.62. | ||
|
||
- Data is the hash of the signed message, which can be either an atom or a list of bytes. | ||
|
||
- Signature represents the ASN.1 encoded signature corresponding to the Data. | ||
|
||
- Options are additional configurations for the verification process. Supported options include: encoding\(\+Format\) which specifies the encoding used for the data, and type\(\+Alg\) which chooses the algorithm within the ECDSA family \(see below for details\). | ||
|
||
For Format, the supported encodings are: | ||
|
||
- hex \(default\), the hexadecimal encoding represented as an atom. | ||
- octet, the plain byte encoding depicted as a list of integers ranging from 0 to 255. | ||
- text, the plain text encoding represented as an atom. | ||
- utf8 \(default\), the UTF\-8 encoding represented as an atom. | ||
|
||
For Alg, the supported algorithms are: | ||
|
||
- secp256r1 \(default\): Also known as P\-256 and prime256v1. | ||
- secp256k1: The Koblitz elliptic curve used in Bitcoin's public\-key cryptography. | ||
|
||
## Examples | ||
|
||
```text | ||
# Verify a signature for hexadecimal data using the ECDSA secp256r1 algorithm. | ||
- ecdsa_verify([127, ...], '9b038f8ef6918cbb56040dfda401b56b...', [23, 56, ...], encoding(hex)) | ||
# Verify a signature for binary data using the ECDSA secp256k1 algorithm. | ||
- ecdsa_verify([127, ...], [56, 90, ..], [23, 56, ...], [encoding(octet), type(secp256k1)]) | ||
``` |
Oops, something went wrong.