Skip to content

Commit

Permalink
wip: docs(agent): collapse newlines and fix missing types
Browse files Browse the repository at this point in the history
  • Loading branch information
egasimus committed May 2, 2024
1 parent b338af1 commit 00e227a
Show file tree
Hide file tree
Showing 8 changed files with 275 additions and 286 deletions.
84 changes: 37 additions & 47 deletions packages/agent/chain.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,12 @@ Instead, see `Connection`, `Devnet`, and their subclasses.

## abstract method [*backend.connect*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
<pre>
<strong>const</strong> result: <em><a href="#">Connection</a></em> = <strong>await</strong> backend.connect(
parameter: <em> | </em>,
)
<strong>const</strong> result: <em><a href="#">Connection</a></em> = <strong>await</strong> backend.connect(parameter: <em>string | Partial&lt;Identity&gt;</em>)
</pre>

## abstract method [*backend.getIdentity*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
<pre>
backend.getIdentity(
name: <em>string</em>,
)
backend.getIdentity(name: <em>string</em>)
</pre>

# class *Connection*
Expand Down Expand Up @@ -189,7 +185,7 @@ Construct a transaction batch.
Call a given program's transaction method.
<pre>
<strong>const</strong> result: <em>unknown</em> = <strong>await</strong> connection.execute(
contract: <em> | </em>,
contract: <em>string | Partial&lt;ContractInstance&gt;</em>,
message: <em>Message</em>,
options: <em>{
execFee,
Expand All @@ -206,7 +202,9 @@ or of another given address.
<pre>
<strong>const</strong> result: <em>unknown</em> = <strong>await</strong> connection.getBalanceIn(
token: <em>string</em>,
address: <em> | </em>,
address: <em>string | {
address,
}</em>,
)
</pre>

Expand All @@ -216,7 +214,9 @@ either in this connection's gas token,
or in another given token.
<pre>
<strong>const</strong> result: <em>unknown</em> = <strong>await</strong> connection.getBalanceOf(
address: <em> | </em>,
address: <em>string | {
address,
}</em>,
token: <em>string</em>,
)
</pre>
Expand All @@ -225,33 +225,31 @@ or in another given token.
Get info about a specific block.
If no height is passed, gets info about the latest block.
<pre>
<strong>const</strong> result: <em><a href="#">Block</a></em> = <strong>await</strong> connection.getBlock(
height: <em>number</em>,
)
<strong>const</strong> result: <em><a href="#">Block</a></em> = <strong>await</strong> connection.getBlock(height: <em>number</em>)
</pre>

## method [*connection.getCodeHashOfAddress*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get the code hash of a given address.
<pre>
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeHashOfAddress(
contract: <em> | </em>,
)
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeHashOfAddress(contract: <em>string | {
address,
}</em>)
</pre>

## method [*connection.getCodeHashOfCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get the code hash of a given code id.
<pre>
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeHashOfCodeId(
contract: <em> | </em>,
)
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeHashOfCodeId(contract: <em>string | {
codeId,
}</em>)
</pre>

## method [*connection.getCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get the code id of a given address.
<pre>
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeId(
contract: <em> | </em>,
)
<strong>const</strong> result: <em>string</em> = <strong>await</strong> connection.getCodeId(contract: <em>string | {
address,
}</em>)
</pre>

## method [*connection.getCodes*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Expand All @@ -262,17 +260,15 @@ Get the code id of a given address.
## method [*connection.getContract*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get a client handle for a specific smart contract, authenticated as as this agent.
<pre>
<strong>const</strong> result: <em><a href="#">Contract</a></em> = connection.getContract(
options: <em> | </em>,
)
<strong>const</strong> result: <em><a href="#">Contract</a></em> = connection.getContract(options: <em>string | {
address,
}</em>)
</pre>

## method [*connection.getContractsByCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get client handles for all contracts that match a code ID
<pre>
<strong>const</strong> result: <em>Record&lt;string, Contract&gt;</em> = <strong>await</strong> connection.getContractsByCodeId(
id: <em>string</em>,
)
<strong>const</strong> result: <em>Record&lt;string, Contract&gt;</em> = <strong>await</strong> connection.getContractsByCodeId(id: <em>string</em>)
</pre>
<pre>
<strong>const</strong> result: <em>Record&lt;string, InstanceType&gt;</em> = <strong>await</strong> connection.getContractsByCodeId(
Expand All @@ -284,9 +280,7 @@ Get client handles for all contracts that match a code ID
## method [*connection.getContractsByCodeIds*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Get client handles for all contracts that match multiple code IDs
<pre>
<strong>const</strong> result: <em>Record&lt;string, Record&gt;</em> = <strong>await</strong> connection.getContractsByCodeIds(
ids: <em>Iterable&lt;string&gt;</em>,
)
<strong>const</strong> result: <em>Record&lt;string, Record&gt;</em> = <strong>await</strong> connection.getContractsByCodeIds(ids: <em>Iterable&lt;string&gt;</em>)
</pre>
<pre>
<strong>const</strong> result: <em>Record&lt;string, Record&gt;</em> = <strong>await</strong> connection.getContractsByCodeIds(
Expand All @@ -295,16 +289,14 @@ Get client handles for all contracts that match multiple code IDs
)
</pre>
<pre>
<strong>const</strong> result: <em>Record&lt;string, Record&gt;</em> = <strong>await</strong> connection.getContractsByCodeIds(
ids: <em>Record&lt;string, C&gt;</em>,
)
<strong>const</strong> result: <em>Record&lt;string, Record&gt;</em> = <strong>await</strong> connection.getContractsByCodeIds(ids: <em>Record&lt;string, C&gt;</em>)
</pre>

## method [*connection.instantiate*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Instantiate a new program from a code id, label and init message.
<pre>
connection.instantiate(
contract: <em> | </em>,
contract: <em>string | Partial&lt;UploadedCode&gt;</em>,
options: <em>Partial&lt;ContractInstance&gt;</em>,
)
</pre>
Expand All @@ -313,7 +305,9 @@ connection.instantiate(
Query a contract.
<pre>
<strong>const</strong> result: <em>Q</em> = <strong>await</strong> connection.query(
contract: <em> | </em>,
contract: <em>string | {
address,
}</em>,
message: <em>Message</em>,
)
</pre>
Expand All @@ -322,8 +316,10 @@ Query a contract.
Send native tokens to 1 recipient.
<pre>
<strong>const</strong> result: <em>unknown</em> = <strong>await</strong> connection.send(
recipient: <em> | </em>,
amounts: <em> | </em>,
recipient: <em>string | {
address,
}</em>,
amounts: <em>ICoin | TokenAmount</em>,
options: <em>{
sendFee,
sendMemo,
Expand All @@ -335,7 +331,7 @@ Send native tokens to 1 recipient.
Upload a contract's code, generating a new code id/hash pair.
<pre>
connection.upload(
code: <em> | | | </em>,
code: <em>string | Uint8Array | URL | Partial&lt;CompiledCode&gt;</em>,
options: <em>{
reupload,
uploadFee,
Expand All @@ -348,9 +344,7 @@ connection.upload(
## method [*connection.gas*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Native token of chain.
<pre>
<strong>const</strong> result: <em><a href="#">TokenAmount</a></em> = connection.gas(
amount: <em> | </em>,
)
<strong>const</strong> result: <em><a href="#">TokenAmount</a></em> = connection.gas(amount: <em>string | number</em>)
</pre>

# class *Block*
Expand Down Expand Up @@ -398,9 +392,7 @@ Subclass this to add custom query and transaction methods corresponding
to the contract's API.

<pre>
<strong>const</strong> contract = new Contract(
properties: <em> | </em>,
)
<strong>const</strong> contract = new Contract(properties: <em>string | Partial&lt;Contract&gt;</em>)
</pre>

<table><tbody>
Expand Down Expand Up @@ -430,8 +422,6 @@ Execute a transaction on the specified instance as the specified Connection.
## method [*contract.query*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
Execute a query on the specified instance as the specified Connection.
<pre>
<strong>const</strong> result: <em>Q</em> = <strong>await</strong> contract.query(
message: <em>Message</em>,
)
<strong>const</strong> result: <em>Q</em> = <strong>await</strong> contract.query(message: <em>Message</em>)
</pre>
<!-- @hackbg/docs: end -->
6 changes: 2 additions & 4 deletions packages/agent/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

# class *Error*
<pre>
<strong>const</strong> error = new Error(
message: <em>string</em>,
)<strong>const</strong> error = new Error(
<strong>const</strong> error = new Error(message: <em>string</em>)<strong>const</strong> error = new Error(
message: <em>string</em>,
options: <em>ErrorOptions</em>,
)
Expand Down Expand Up @@ -44,7 +42,7 @@ Define an error subclass.
<pre>
error.define(
name: <em>string</em>,
getMessage: <em> | </em>,
getMessage: <em>string | ???</em>,
construct: <em>???</em>,
)
</pre>
Expand Down
Loading

0 comments on commit 00e227a

Please sign in to comment.