Skip to content

Commit

Permalink
Update type names in CDDL to standardize version
Browse files Browse the repository at this point in the history
  • Loading branch information
hansl committed Mar 29, 2022
1 parent e5991ed commit 299a20f
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 42 deletions.
20 changes: 10 additions & 10 deletions attributes/network/cddl/0_base.cddl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; tag::status[]
status-arguments = ()
status-returns = status
status@param = ()
status@return = status

status = {
; Protocol version.
Expand Down Expand Up @@ -42,21 +42,21 @@ status = {
; end::status[]

; tag::heartbeat[]
heartbeat-arguments = ()
heartbeat-returns = ()
heartbeat@param = ()
heartbeat@return = ()
; end::heartbeat[]

; tag::endpoints[]
endpoints-arguments = ? {
endpoints@param = () // {
? 0 => str,
}
endpoints-returns = [ * str ]
endpoints@return = [ * str ]
; end::endpoints[]

; tag::async-result[]
async-result-arguments = {
; tag::result[]
result@param = {
; A token returned by an async attribute.
? 0 => bstr,
}
async-result-returns = bstr .cbor request;
; end::result[]
result@result = bstr .cbor request;
; end::async[]
20 changes: 10 additions & 10 deletions attributes/network/cddl/1_blockchain.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ block = {
; tag::info[]
; The blockchain.info endpoint returns information about the current state of this
; blockchain.
info-arguments = ()
blockchain.info@param = ()

info-returns = {
blockchain.info@return = {
; The latest block identifier.
0 => block-identifier,

Expand All @@ -157,46 +157,46 @@ info-returns = {

; tag::block[]
; The blockchain.block endpoint returns a single block from the blockchain.
block-arguments = {
blockchain.block@param = {
; A single block query.
0 => single-block-query,
}

block-returns = {
blockchain.block@return = {
; The block being requested.
0 => block,
}
; end::block[]

; tag::transaction[]
; The blockchain.transaction endpoint returns a single transaction by its identifier.
transaction-arguments = {
blockchain.transaction@param = {
0 => single-transaction-query,
}

transaction-returns = {
blockchain.transaction@return = {
0 => transaction,
}
; end::transaction[]

; tag::request[]
; The blockchain.request endpoint returns a request of a transaction by its identifier.
request-arguments = {
blockchain.request@param = {
0 => single-transaction-query,
}

request-returns = {
blockchain.request@return = {
0 => bstr .cbor request / bstr .size 0,
}
; end::request[]

; tag::response[]
; The blockchain.response endpoint returns a response of a transaction by its identifier.
response-arguments = {
blockchain.response@param = {
0 => single-transaction-query,
}

response-returns = {
blockchain.response@return = {
0 => bstr .cbor response / bstr .size 0,
}
; end::response[]
8 changes: 4 additions & 4 deletions attributes/network/cddl/2_ledger.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ amount = biguint / uint

; tag::info[]
; Info endpoint.
info-arguments = ()
info-returns = (info)
ledger.info@param = ()
ledger.info@return = (info)

info = {
; List of supported symbols for this ledger.
Expand Down Expand Up @@ -100,7 +100,7 @@ fixed-point-percent = uint
; end::info[]

; tag::balance[]
balance-arguments = {
ledger.balance@param = {
; Account's identity. If not specified, will use the message sender.
? 0 => identity,

Expand All @@ -112,7 +112,7 @@ balance-arguments = {

; Return value for "ledger.balance".
; Contains
balance-returns = {
ledger.balance@return = {
; Balances as a record of Symbol => Amount.
; Balances of zero might not be listed here.
0 => {
Expand Down
8 changes: 4 additions & 4 deletions attributes/network/cddl/3_kvstore.cddl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
; tag::info[]
; Info endpoint.
info-arguments = ()
info-returns = (info)
kvstore.info@param = ()
kvstore.info@return = (info)

info = {
; Hash value of the key value state. If two stores have the same hashes,
Expand All @@ -15,12 +15,12 @@ info = {
; end::info[]

; tag::get[]
get-arguments = {
kvstore.get@param = {
; The key to get.
0 => bstr,
}

get-returns = {
kvstore.get@return = {
; The value directly returned.
? 0 => bstr,
}
Expand Down
9 changes: 5 additions & 4 deletions attributes/network/cddl/4_ledger_transactions.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,16 @@ amount = biguint / uint

; tag::info[]
; `ledger.transactions` endpoint.
transactions-arguments = ()
transactions-returns = {
ledger.transactions@param = ()
ledger.transactions@return = {
; Total number of transactions.
0 => uint,
}
; end::info[]

; tag::list[]
; `ledger.list` endpoint for listing, filtering and sorting transactions.
list-arguments = {
ledger.list@param = {
; Maximum number of transactions to return. The server can still limit the number of
; transactions it returns if this number is high.
? 0 => uint,
Expand All @@ -142,7 +142,7 @@ list-arguments = {
; Transaction filter criteria.
? 2 => filter,
}
list-returns = {
ledger.list@return = {
; Total number of transactions (currently). This is the same number that info
; would give, but it's atomic to this call.
0 => uint,
Expand All @@ -152,3 +152,4 @@ list-returns = {
}
; end::list[]

ledger.list@param
12 changes: 6 additions & 6 deletions attributes/network/cddl/6_ledger_commands.cddl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
; tag::mint[]
mint-arguments = {
ledger.mint@param = {
; Account that will receive the minted tokens.
0 => identity,

Expand All @@ -9,11 +9,11 @@ mint-arguments = {
; The symbol to mint.
2 => symbol,
}
mint-returns = ()
ledger.mint@return = ()
; end::mint[]

; tag::burn[]
burn-arguments = {
ledger.burn@param = {
; Account whose tokens will be removed.
0 => identity,

Expand All @@ -23,11 +23,11 @@ burn-arguments = {
; The symbol to burn.
2 => symbol,
}
burn-returns = ()
ledger.burn@return = ()
; end::burn[]

; tag::send[]
send-arguments = {
ledger.send@param = {
; Account that will send the tokens (From).
; If omitted, will use the message sender.
; The ledger may refuse to send from a different account than
Expand All @@ -43,5 +43,5 @@ send-arguments = {
; The symbol to send.
3 => symbol,
}
send-returns = ()
ledger.send@return = ()
; end::burn[]
8 changes: 4 additions & 4 deletions attributes/network/cddl/7_kvstore_commands.cddl
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
; tag::put[]
put-arguments = {
kvstore.put@param = {
; Key.
0 => bstr,

; Value
1 => bstr,
}

put-returns = {}
kvstore.put@return = {}
; end::put[]

; tag::delete[]
delete-arguments = {
kvstore.delete@param = {
; Key.
0 => bstr,
}

delete-returns = {}
kvstore.delete@return = {}
; end::delete[]

0 comments on commit 299a20f

Please sign in to comment.