Skip to content

Commit

Permalink
docs: Fix markdown lint of transactions file
Browse files Browse the repository at this point in the history
  • Loading branch information
matevz committed Apr 5, 2022
1 parent b98acaa commit b0c608c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 13 deletions.
32 changes: 29 additions & 3 deletions docs/runtime/transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
## accounts

### accounts.Addresses (query) {#accounts-addresses}

[[Rust][rust-accounts.Addresses] | [Go][go-accounts.Addresses] | [TypeScript][typescript-accounts.Addresses]]

#### Parameters [[Rust][rust-accounts.Addresses-params] | [Go][go-accounts.Addresses-params] | [TypeScript][typescript-accounts.Addresses-params]]
Expand All @@ -24,6 +25,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-accounts.Addresses-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L111-L116

### accounts.Balances (query) {#accounts-balances}

[[Rust][rust-accounts.Balances] | [Go][go-accounts.Balances] | [TypeScript][typescript-accounts.Balances]]

#### Parameters [[Rust][rust-accounts.Balances-params] | [Go][go-accounts.Balances-params] | [TypeScript][typescript-accounts.Balances-params]]
Expand All @@ -44,6 +46,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-accounts.Balances-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L80-L85

### accounts.DenominationInfo (query) {#accounts-denominationinfo}

[[Rust][rust-accounts.DenominationInfo] | [Go][go-accounts.DenominationInfo] | [TypeScript][typescript-accounts.DenominationInfo]]

#### Parameters [[Rust][rust-accounts.DenominationInfo-params] | [Go][go-accounts.DenominationInfo-params] | [TypeScript][typescript-accounts.DenominationInfo-params]]
Expand All @@ -67,6 +70,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-accounts.DenominationInfo-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L125-L130

### accounts.Nonce (query) {#accounts-nonce}

[[Rust][rust-accounts.Nonce] | [Go][go-accounts.Nonce] | [TypeScript][typescript-accounts.Nonce]]

#### Parameters [[Rust][rust-accounts.Nonce-params] | [Go][go-accounts.Nonce-params] | [TypeScript][typescript-accounts.Nonce-params]]
Expand All @@ -81,6 +85,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-accounts.Nonce-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L104-L109

### accounts.Transfer (call) {#accounts-transfer}

[[Rust][rust-accounts.Transfer] | [Go][go-accounts.Transfer] | [TypeScript][typescript-accounts.Transfer]]

#### Parameters [[Rust][rust-accounts.Transfer-params] | [Go][go-accounts.Transfer-params] | [TypeScript][typescript-accounts.Transfer-params]]
Expand All @@ -98,6 +103,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
## consensus

### consensus.Account (query) {#consensus-account}

[[Rust][rust-consensus.Account] | [TypeScript][typescript-consensus.Account]]

#### Parameters [[Rust][rust-consensus.Account-params] | [Go][go-consensus.Account-params] | [TypeScript][typescript-consensus.Account-params]]
Expand All @@ -111,6 +117,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-consensus.Account-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L366-L371

### consensus.Balance (query) {#consensus-balance}

[[Rust][rust-consensus.Balance] | [Go][go-consensus.Balance] | [TypeScript][typescript-consensus.Balance]]

#### Parameters [[Rust][rust-consensus.Balance-params] | [Go][go-consensus.Balance-params] | [TypeScript][typescript-consensus.Balance-params]]
Expand All @@ -131,6 +138,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-consensus.Balance-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L359-L364

### consensus.Deposit (call) {#consensus-deposit}

[[Rust][rust-consensus.Deposit] | [Go][go-consensus.Deposit] | [TypeScript][typescript-consensus.Deposit]]

#### Parameters [[Rust][rust-consensus.Deposit-params] | [Go][go-consensus.Deposit-params] | [TypeScript][typescript-consensus.Deposit-params]]
Expand All @@ -146,6 +154,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-consensus.Deposit-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L336-L342

### consensus.Withdraw (call) {#consensus-withdraw}

[[Rust][rust-consensus.Withdraw] | [Go][go-consensus.Withdraw] | [TypeScript][typescript-consensus.Withdraw]]

#### Parameters [[Rust][rust-consensus.Withdraw-params] | [Go][go-consensus.Withdraw-params] | [TypeScript][typescript-consensus.Withdraw-params]]
Expand All @@ -163,6 +172,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
## contracts

### contracts.Call (call) {#contracts-call}

[[Rust][rust-contracts.Call] | [Go][go-contracts.Call] | [TypeScript][typescript-contracts.Call]]

#### Parameters [[Rust][rust-contracts.Call-params] | [Go][go-contracts.Call-params] | [TypeScript][typescript-contracts.Call-params]]
Expand All @@ -182,7 +192,6 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.

#### Result [[Go][go-contracts.Call-result]]


[rust-contracts.Call]: https://github.com/oasisprotocol/oasis-sdk/tree/master/runtime-sdk/modules/contracts/src/lib.rs#L493-L536
[go-contracts.Call]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/contracts/contracts.go#L144-L147
[typescript-contracts.Call]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/contracts.ts#L58-L60
Expand All @@ -192,6 +201,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[go-contracts.Call-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/contracts/types.go#L119-L120

### contracts.Code (query) {#contracts-code}

[[Rust][rust-contracts.Code] | [Go][go-contracts.Code] | [TypeScript][typescript-contracts.Code]]

#### Parameters [[Rust][rust-contracts.Code-params] | [Go][go-contracts.Code-params] | [TypeScript][typescript-contracts.Code-params]]
Expand Down Expand Up @@ -234,6 +244,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-contracts.Code-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L584-L608

### contracts.Custom (query) {#contracts-custom}

[[Rust][rust-contracts.Custom] | [Go][go-contracts.Custom] | [TypeScript][typescript-contracts.Custom]]

#### Parameters [[Rust][rust-contracts.Custom-params] | [Go][go-contracts.Custom-params] | [TypeScript][typescript-contracts.Custom-params]]
Expand All @@ -249,7 +260,6 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.

#### Result [[Go][go-contracts.Custom-result]]


[rust-contracts.Custom]: https://github.com/oasisprotocol/oasis-sdk/tree/master/runtime-sdk/modules/contracts/src/lib.rs#L645-L680
[go-contracts.Custom]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/contracts/contracts.go#L214-L224
[typescript-contracts.Custom]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/contracts.ts#L81-L83
Expand All @@ -259,6 +269,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[go-contracts.Custom-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/contracts/types.go#L194-L195

### contracts.Instance (query) {#contracts-instance}

[[Rust][rust-contracts.Instance] | [Go][go-contracts.Instance] | [TypeScript][typescript-contracts.Instance]]

#### Parameters [[Rust][rust-contracts.Instance-params] | [Go][go-contracts.Instance-params] | [TypeScript][typescript-contracts.Instance-params]]
Expand Down Expand Up @@ -297,6 +308,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-contracts.Instance-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L620-L640

### contracts.InstanceStorage (query) {#contracts-instancestorage}

[[Rust][rust-contracts.InstanceStorage] | [Go][go-contracts.InstanceStorage] | [TypeScript][typescript-contracts.InstanceStorage]]

#### Parameters [[Rust][rust-contracts.InstanceStorage-params] | [Go][go-contracts.InstanceStorage-params]]
Expand Down Expand Up @@ -326,6 +338,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[go-contracts.InstanceStorage-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/contracts/types.go#L154-L158

### contracts.Instantiate (call) {#contracts-instantiate}

[[Rust][rust-contracts.Instantiate] | [Go][go-contracts.Instantiate] | [TypeScript][typescript-contracts.Instantiate]]

#### Parameters [[Rust][rust-contracts.Instantiate-params] | [Go][go-contracts.Instantiate-params] | [TypeScript][typescript-contracts.Instantiate-params]]
Expand Down Expand Up @@ -365,6 +378,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-contracts.Instantiate-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L524-L532

### contracts.PublicKey (query) {#contracts-publickey}

[[Rust][rust-contracts.PublicKey] | [Go][go-contracts.PublicKey] | [TypeScript][typescript-contracts.PublicKey]]

#### Parameters [[Rust][rust-contracts.PublicKey-params] | [Go][go-contracts.PublicKey-params] | [TypeScript][typescript-contracts.PublicKey-params]]
Expand Down Expand Up @@ -404,6 +418,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-contracts.PublicKey-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L677-L693

### contracts.Upgrade (call) {#contracts-upgrade}

[[Rust][rust-contracts.Upgrade] | [Go][go-contracts.Upgrade] | [TypeScript][typescript-contracts.Upgrade]]

#### Parameters [[Rust][rust-contracts.Upgrade-params] | [Go][go-contracts.Upgrade-params] | [TypeScript][typescript-contracts.Upgrade-params]]
Expand Down Expand Up @@ -433,6 +448,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-contracts.Upgrade-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L552-L572

### contracts.Upload (call) {#contracts-upload}

[[Rust][rust-contracts.Upload] | [Go][go-contracts.Upload] | [TypeScript][typescript-contracts.Upload]]

#### Parameters [[Rust][rust-contracts.Upload-params] | [Go][go-contracts.Upload-params] | [TypeScript][typescript-contracts.Upload-params]]
Expand Down Expand Up @@ -470,6 +486,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
## core

### core.CallDataPublicKey (query) {#core-calldatapublickey}

[[Rust][rust-core.CallDataPublicKey] | [TypeScript][typescript-core.CallDataPublicKey]]

#### Parameters [[Rust][rust-core.CallDataPublicKey-params]]
Expand All @@ -493,6 +510,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-core.CallDataPublicKey-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L11-L19

### core.CheckInvariants (query) {#core-checkinvariants}

[[Rust][rust-core.CheckInvariants] | [TypeScript][typescript-core.CheckInvariants]]

#### Parameters [[Rust][rust-core.CheckInvariants-params]]
Expand All @@ -515,6 +533,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[rust-core.CheckInvariants-result]: https://github.com/oasisprotocol/oasis-sdk/tree/master/runtime-sdk/src/modules/core/types.rs#L29-L34

### core.EstimateGas (query) {#core-estimategas}

[[Rust][rust-core.EstimateGas] | [Go][go-core.EstimateGas] | [TypeScript][typescript-core.EstimateGas]]

#### Parameters [[Rust][rust-core.EstimateGas-params] | [Go][go-core.EstimateGas-params] | [TypeScript][typescript-core.EstimateGas-params]]
Expand All @@ -533,6 +552,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-core.EstimateGas-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L3-L9

### core.MinGasPrice (query) {#core-mingasprice}

[[Rust][rust-core.MinGasPrice] | [Go][go-core.MinGasPrice] | [TypeScript][typescript-core.MinGasPrice]]

#### Parameters [[Rust][rust-core.MinGasPrice-params]]
Expand All @@ -548,6 +568,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[rust-core.MinGasPrice-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/runtime-sdk/src/modules/core/types.rs#L11-L16

### core.RuntimeInfo (query) {#core-runtimeinfo}

[[Rust][rust-core.RuntimeInfo] | [Go][go-core.RuntimeInfo] | [TypeScript][typescript-core.RuntimeInfo]]

#### Parameters [[Rust][rust-core.RuntimeInfo-params]]
Expand All @@ -559,7 +580,6 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.

#### Result [[TypeScript][typescript-core.RuntimeInfo-result]]


[rust-core.RuntimeInfo]: https://github.com/oasisprotocol/oasis-sdk/tree/master/runtime-sdk/src/modules/core/mod.rs#L475-L486
[go-core.RuntimeInfo]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/go/modules/core/core.go#L141-L149
[typescript-core.RuntimeInfo]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/core.ts#L71-L73
Expand All @@ -569,6 +589,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
## evm

### evm.Balance (query) {#evm-balance}

[[Rust][rust-evm.Balance] | [Go][go-evm.Balance] | [TypeScript][typescript-evm.Balance]]

#### Parameters [[Rust][rust-evm.Balance-params] | [Go][go-evm.Balance-params] | [TypeScript][typescript-evm.Balance-params]]
Expand All @@ -583,6 +604,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-evm.Balance-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L426-L431

### evm.Call (call) {#evm-call}

[[Rust][rust-evm.Call] | [Go][go-evm.Call] | [TypeScript][typescript-evm.Call]]

#### Parameters [[Rust][rust-evm.Call-params] | [Go][go-evm.Call-params] | [TypeScript][typescript-evm.Call-params]]
Expand All @@ -599,6 +621,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-evm.Call-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L402-L409

### evm.Code (query) {#evm-code}

[[Rust][rust-evm.Code] | [Go][go-evm.Code] | [TypeScript][typescript-evm.Code]]

#### Parameters [[Rust][rust-evm.Code-params] | [Go][go-evm.Code-params] | [TypeScript][typescript-evm.Code-params]]
Expand All @@ -613,6 +636,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-evm.Code-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L419-L424

### evm.Create (call) {#evm-create}

[[Rust][rust-evm.Create] | [Go][go-evm.Create] | [TypeScript][typescript-evm.Create]]

#### Parameters [[Rust][rust-evm.Create-params] | [Go][go-evm.Create-params] | [TypeScript][typescript-evm.Create-params]]
Expand All @@ -628,6 +652,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-evm.Create-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L394-L400

### evm.SimulateCall (query) {#evm-simulatecall}

[[Rust][rust-evm.SimulateCall] | [Go][go-evm.SimulateCall] | [TypeScript][typescript-evm.SimulateCall]]

#### Parameters [[Rust][rust-evm.SimulateCall-params] | [Go][go-evm.SimulateCall-params] | [TypeScript][typescript-evm.SimulateCall-params]]
Expand All @@ -647,6 +672,7 @@ with references to Go, Rust and TypeScript bindings in Oasis SDK.
[typescript-evm.SimulateCall-params]: https://github.com/oasisprotocol/oasis-sdk/tree/master/client-sdk/ts-web/rt/src/types.ts#L433-L443

### evm.Storage (query) {#evm-storage}

[[Rust][rust-evm.Storage] | [Go][go-evm.Storage] | [TypeScript][typescript-evm.Storage]]

#### Parameters [[Rust][rust-evm.Storage-params] | [Go][go-evm.Storage-params] | [TypeScript][typescript-evm.Storage-params]]
Expand Down
27 changes: 17 additions & 10 deletions tools/extract-runtime-txs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ var (
scriptName = filepath.Base(os.Args[0])

rootCmd = &cobra.Command{
Use: scriptName,
Short: "Extracts Runtime transactions from formatted Rust, Go and TypeScript code.",
Long: "See README.md for details.",
Example: "./extract-runtime-txs --codebase.path ../.. --markdown",
Run: doExtractRuntimeTxs,
Use: scriptName,
Short: "Extracts Runtime transactions from formatted Rust, Go and TypeScript code.",
Example: `./extract-runtime-txs \
--codebase.path ../.. \
--markdown \
--markdown.template.file ../../docs/runtime/transactions.md.tpl \
--codebase.url https://github.com/oasisprotocol/oasis-sdk/tree/master/ \
> ../../docs/runtime/transactions.md`,
Run: doExtractRuntimeTxs,
}
)

Expand Down Expand Up @@ -76,7 +80,7 @@ func markdownRef(fullName string, snippets map[types.Lang]types.Snippet, t types

// markdownParams generates a markdown list of parameter or results fields of the transaction.
func markdownParams(params []types.Parameter) string {
paramsStr := "\n"
paramsStr := ""
for _, p := range params {
paramsStr += fmt.Sprintf("- `%s: %s`\n", p.Name, p.Type)
if p.Description != "" {
Expand Down Expand Up @@ -132,12 +136,15 @@ func printMarkdown(transactions map[string]types.Tx) {
markdown += fmt.Sprintf("## %s\n\n", tx.Module)
lastModule = tx.Module
}
markdown += fmt.Sprintf("### %s (%s) {#%s}\n", tx.FullName(), tx.Type, tx.Module+"-"+strings.ToLower(tx.Name))
markdown += fmt.Sprintf("### %s (%s) {#%s}\n\n", tx.FullName(), tx.Type, tx.Module+"-"+strings.ToLower(tx.Name))
markdown += fmt.Sprintf("%s\n\n", markdownRef(tx.FullName(), tx.Ref, types.Base))
markdown += fmt.Sprintf("#### Parameters %s\n%s\n", markdownRef(tx.FullName(), tx.ParametersRef, types.Params), markdownParams(tx.Parameters))
markdown += fmt.Sprintf("#### Parameters %s\n\n%s\n", markdownRef(tx.FullName(), tx.ParametersRef, types.Params), markdownParams(tx.Parameters))

if tx.Result != nil || len(tx.ResultRef) > 0 {
markdown += fmt.Sprintf("#### Result %s\n%s\n", markdownRef(tx.FullName(), tx.ResultRef, types.Result), markdownParams(tx.Result))
if len(tx.ResultRef) > 0 {
markdown += fmt.Sprintf("#### Result %s\n\n", markdownRef(tx.FullName(), tx.ResultRef, types.Result))
if tx.Result != nil {
markdown += fmt.Sprintf("%s\n", markdownParams(tx.Result))
}
}

markdown += markdownRefSrcs(tx.FullName(), tx.Ref, types.Base)
Expand Down

0 comments on commit b0c608c

Please sign in to comment.