diff --git a/packages/agent/README.md b/packages/agent/README.md index 6bf12b4f3c..18bb05fb61 100644 --- a/packages/agent/README.md +++ b/packages/agent/README.md @@ -8,7 +8,7 @@ that are based on Tendermint and CosmWasm**. The Fadroma Agent API provides the following features: * [Connecting and authenticating to blockchain RPC endpoints](./chain.md) -* Transacting and [staking](./staking.md) with native and custom tokens +* Transacting and [staking](./staking.md) with [native and custom tokens](./token.md) * [Submitting and voting on governance proposals](./governance.md) * [Interacting with smart contracts](./program.md) * [Deploying groups of interconnected smart contracts from source](./deploy.md) diff --git a/packages/agent/chain.md b/packages/agent/chain.md index 17ad78bec9..e048cfba87 100644 --- a/packages/agent/chain.md +++ b/packages/agent/chain.md @@ -7,8 +7,53 @@ with a local blockchain node instead, see `@fadroma/devnet`. +# class *Endpoint* +Base class representing a remote API endpoint. + +You shouldn't need to instantiate this class directly. +Instead, see `Connection` and its subclasses. + +
+const endpoint = new Endpoint({
+  alive,
+  api,
+  chainId,
+  log,
+  url,
+})
+
+ + + + + + + + + + + +
+aliveboolean. Setting this to false stops retries.
+apiunknown. Instance of platform SDK. This must be provided in a subclass. + +Since most chain SDKs initialize asynchronously, this is usually a `Promise` +that resolves to an instance of the underlying client class (e.g. `CosmWasmClient` or `SecretNetworkClient`). + +Since transaction and query methods are always asynchronous as well, well-behaved +implementations of Fadroma Agent begin each method that talks to the chain with +e.g. `const { api } = await this.api`, making sure an initialized platform SDK instance +is available.
+chainIdstring. Chain ID. This is a string that uniquely identifies a chain. +A project's mainnet and testnet have different chain IDs.
+logConsole.
+urlstring. Connection URL. + +The same chain may be accessible via different endpoints, so +this property contains the URL to which requests are sent.
+ # class *Backend* -This is the base class for any connection backend, such as: +Base class representing any connection backend, such as: * Remote RPC endpoint. * Local devnet RPC endpoint. @@ -18,9 +63,11 @@ You shouldn't need to instantiate this class directly. Instead, see `Connection`, `Devnet`, and their subclasses.
-const backend = new Backend(
-  properties: Partial<Backend>,
-)
+const backend = new Backend({
+  chainId,
+  gasToken,
+  log,
+})
 
@@ -34,63 +81,40 @@ Instead, see `Connection`, `Devnet`, and their subclasses. log
Console.
-## abstract method [*backend.connect*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L108) +## abstract method [*backend.connect*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
 const result: Connection = await backend.connect(
-  parameter: string | Partial<Identity>,
+  parameter:  | ,
 )
 
-## abstract method [*backend.getIdentity*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L110) +## abstract method [*backend.getIdentity*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
 backend.getIdentity(
   name: string,
 )
 
-# class *Block* -The building block of a blockchain. -Each block contains collection of transactions that are -appended to the blockchain at a given point in time. - -
-const block = new Block(
-  properties: Partial<Block>,
-)
-
- - - - - - - -
-chainConnection. Connection to the chain to which this block belongs.
-hashstring. Content-dependent ID of block.
-heightnumber. Monotonically incrementing ID of block.
- -## abstract method [*block.getTransactionsById*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L616) -
-const result: Record<string, Transaction> = await block.getTransactionsById()
-
- -## abstract method [*block.getTransactionsInOrder*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L619) -
-const result: Transaction[] = await block.getTransactionsInOrder()
-
- # class *Connection* -This is the base class for a connection to a blockchain via a given endpoint. +Base class representing a connection to a blockchain via a given endpoint. Use one of its subclasses in `@fadroma/scrt`, `@fadroma/cw`, `@fadroma/namada` to connect to the corresponding chain. Or, extend this class to implement support for new kinds of blockchains.
-const connection = new Connection(
-  properties: Partial<Connection>,
-)
+const connection = new Connection({
+  alive,
+  api,
+  blockInterval,
+  chainId,
+  fees,
+  identity,
+  log,
+  mode,
+  url,
+  gasToken,
+})
 
@@ -155,17 +179,17 @@ this property contains the URL to which requests are sent.nextBlock
-## method [*connection.batch*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L595) +## method [*connection.batch*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Construct a transaction batch.
 const result: Batch<Connection> = connection.batch()
 
-## method [*connection.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L568) +## method [*connection.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Call a given program's transaction method.
 const result: unknown = await connection.execute(
-  contract: string | Partial<ContractInstance>,
+  contract:  | ,
   message: Message,
   options: {
     execFee,
@@ -175,33 +199,29 @@ Call a given program's transaction method.
 )
 
-## method [*connection.getBalanceIn*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L389) +## method [*connection.getBalanceIn*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the balance in a given native token, of either this connection's identity's address, or of another given address.
 const result: unknown = await connection.getBalanceIn(
   token: string,
-  address: string | {
-    address,
-  },
+  address:  | ,
 )
 
-## method [*connection.getBalanceOf*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L364) +## method [*connection.getBalanceOf*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the balance in a native token of a given address, either in this connection's gas token, or in another given token.
 const result: unknown = await connection.getBalanceOf(
-  address: string | {
-    address,
-  },
+  address:  | ,
   token: string,
 )
 
-## method [*connection.getBlock*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L222) +## method [*connection.getBlock*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get info about a specific block. If no height is passed, gets info about the latest block.
@@ -210,52 +230,44 @@ If no height is passed, gets info about the latest block.
 )
 
-## method [*connection.getCodeHashOfAddress*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L264) +## method [*connection.getCodeHashOfAddress*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code hash of a given address.
 const result: string = await connection.getCodeHashOfAddress(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
 )
 
-## method [*connection.getCodeHashOfCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L248) +## method [*connection.getCodeHashOfCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code hash of a given code id.
 const result: string = await connection.getCodeHashOfCodeId(
-  contract: string | {
-    codeId,
-  },
+  contract:  | ,
 )
 
-## method [*connection.getCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L232) +## method [*connection.getCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code id of a given address.
 const result: string = await connection.getCodeId(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
 )
 
-## method [*connection.getCodes*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L294) +## method [*connection.getCodes*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
 const result: Record<string, UploadedCode> = await connection.getCodes()
 
-## method [*connection.getContract*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L280) +## 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.
 const result: Contract = connection.getContract(
-  options: string | {
-    address,
-  },
+  options:  | ,
 )
 
-## method [*connection.getContractsByCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L303) +## 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
 const result: Record<string, Contract> = await connection.getContractsByCodeId(
@@ -269,7 +281,7 @@ Get client handles for all contracts that match a code ID
 )
 
-## method [*connection.getContractsByCodeIds*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L325) +## 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
 const result: Record<string, Record> = await connection.getContractsByCodeIds(
@@ -288,34 +300,30 @@ Get client handles for all contracts that match multiple code IDs
 )
 
-## method [*connection.instantiate*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L524) +## 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.
 connection.instantiate(
-  contract: string | Partial<UploadedCode>,
+  contract:  | ,
   options: Partial<ContractInstance>,
 )
 
-## method [*connection.query*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L416) +## method [*connection.query*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Query a contract.
 const result: Q = await connection.query(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
   message: Message,
 )
 
-## method [*connection.send*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L432) +## method [*connection.send*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Send native tokens to 1 recipient.
 const result: unknown = await connection.send(
-  recipient: string | {
-    address,
-  },
-  amounts: ICoin | TokenAmount,
+  recipient:  | ,
+  amounts:  | ,
   options: {
     sendFee,
     sendMemo,
@@ -323,11 +331,11 @@ Send native tokens to 1 recipient.
 )
 
-## method [*connection.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L464) +## method [*connection.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Upload a contract's code, generating a new code id/hash pair.
 connection.upload(
-  code: string | Uint8Array | URL | Partial<CompiledCode>,
+  code:  |  |  | ,
   options: {
     reupload,
     uploadFee,
@@ -337,21 +345,61 @@ connection.upload(
 )
 
-## method [*connection.gas*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L122) +## method [*connection.gas*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Native token of chain.
 const result: TokenAmount = connection.gas(
-  amount: string | number,
+  amount:  | ,
 )
 
+# class *Block* +The building block of a blockchain. + +Each block contains collection of transactions that are +appended to the blockchain at a given point in time. + +You shouldn't have to instantiate this directly; +instead, it's returned from `connection.getBlock()` + +
+const block = new Block({
+  chain,
+  hash,
+  height,
+})
+
+ + + + + + + +
+chainConnection. Connection to the chain to which this block belongs.
+hashstring. Content-dependent ID of block.
+heightnumber. Monotonically incrementing ID of block.
+ +## abstract method [*block.getTransactionsById*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) +
+const result: Record<string, Transaction> = await block.getTransactionsById()
+
+ +## abstract method [*block.getTransactionsInOrder*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) +
+const result: Transaction[] = await block.getTransactionsInOrder()
+
+ # class *Contract* -Base class representing the API of a particular instance of a smart contract. -Subclass this to add custom query and transaction methods. +Base class representing a particular instance of a smart contract. + +Subclass this to add custom query and transaction methods corresponding +to the contract's API.
 const contract = new Contract(
-  properties: string | Partial<Contract>,
+  properties:  | ,
 )
 
@@ -366,7 +414,7 @@ Subclass this to add custom query and transaction methods. log Console. -## method [*contract.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L657) +## method [*contract.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Execute a transaction on the specified instance as the specified Connection.
 const result: unknown = await contract.execute(
@@ -379,52 +427,11 @@ Execute a transaction on the specified instance as the specified Connection.
 )
 
-## method [*contract.query*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L644) +## 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.
 const result: Q = await contract.query(
   message: Message,
 )
 
- -# class *Endpoint* -This is the base class for a remote endpoint. - -You shouldn't need to instantiate this class directly. -Instead, see `Connection` and its subclasses. - -
-const endpoint = new Endpoint(
-  properties: Partial<Endpoint>,
-)
-
- - - - - - - - - - - -
-aliveboolean. Setting this to false stops retries.
-apiunknown. Instance of platform SDK. This must be provided in a subclass. - -Since most chain SDKs initialize asynchronously, this is usually a `Promise` -that resolves to an instance of the underlying client class (e.g. `CosmWasmClient` or `SecretNetworkClient`). - -Since transaction and query methods are always asynchronous as well, well-behaved -implementations of Fadroma Agent begin each method that talks to the chain with -e.g. `const { api } = await this.api`, making sure an initialized platform SDK instance -is available.
-chainIdstring. Chain ID. This is a string that uniquely identifies a chain. -A project's mainnet and testnet have different chain IDs.
-logConsole.
-urlstring. Connection URL. - -The same chain may be accessible via different endpoints, so -this property contains the URL to which requests are sent.
diff --git a/packages/agent/chain.ts b/packages/agent/chain.ts index b232a37609..001d757e64 100644 --- a/packages/agent/chain.ts +++ b/packages/agent/chain.ts @@ -40,7 +40,7 @@ export type Message = string|Record /** A transaction hash, uniquely identifying an executed transaction on a chain. */ export type TxHash = string -/** This is the base class for a remote endpoint. +/** Base class representing a remote API endpoint. * * You shouldn't need to instantiate this class directly. * Instead, see `Connection` and its subclasses. */ @@ -86,7 +86,7 @@ export abstract class Endpoint extends Logged { } } -/** This is the base class for any connection backend, such as: +/** Base class representing any connection backend, such as: * * * Remote RPC endpoint. * * Local devnet RPC endpoint. @@ -110,7 +110,7 @@ export abstract class Backend extends Logged { abstract getIdentity (name: string): Promise<{ address?: Address, mnemonic?: string }> } -/** This is the base class for a connection to a blockchain via a given endpoint. +/** Base class representing a connection to a blockchain via a given endpoint. * * Use one of its subclasses in `@fadroma/scrt`, `@fadroma/cw`, `@fadroma/namada` * to connect to the corresponding chain. Or, extend this class to implement @@ -598,8 +598,12 @@ export abstract class Connection extends Endpoint { } /** The building block of a blockchain. + * * Each block contains collection of transactions that are - * appended to the blockchain at a given point in time. */ + * appended to the blockchain at a given point in time. + * + * You shouldn't have to instantiate this directly; + * instead, it's returned from `connection.getBlock()` */ export abstract class Block { /** Connection to the chain to which this block belongs. */ chain?: Connection @@ -620,8 +624,10 @@ export abstract class Block { Promise } -/** Base class representing the API of a particular instance of a smart contract. - * Subclass this to add custom query and transaction methods. */ +/** Base class representing a particular instance of a smart contract. + * + * Subclass this to add custom query and transaction methods corresponding + * to the contract's API. */ export class Contract extends Logged { /** Connection to the chain on which this contract is deployed. */ diff --git a/packages/agent/core.md b/packages/agent/core.md index ae5653b259..a33827cce8 100644 --- a/packages/agent/core.md +++ b/packages/agent/core.md @@ -30,7 +30,7 @@ stackTraceLimit number. -## method [*error.captureStackTrace*](undefined) +## method [*error.captureStackTrace*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/@types+node@20.10.3/node_modules/@types/node/globals.d.ts) Create .stack property on a target object
 const result: void = error.captureStackTrace(
@@ -39,12 +39,12 @@ Create .stack property on a target object
 )
 
-## method [*error.define*](undefined) +## method [*error.define*](https://github.com/hackbg/fadroma/tree/v2/toolbox/oops/oops.ts) Define an error subclass.
 error.define(
   name: string,
-  getMessage: string | ???,
+  getMessage:  | ,
   construct: ???,
 )
 
diff --git a/packages/agent/deploy.md b/packages/agent/deploy.md index 8bb995b806..f7903b4372 100644 --- a/packages/agent/deploy.md +++ b/packages/agent/deploy.md @@ -7,9 +7,15 @@ Represents a contract's code in all its forms, and the contract's lifecycle up to and including uploading it, but not instantiating it.
-const contractCode = new ContractCode(
-  properties: Partial<ContractCode>,
-)
+const contractCode = new ContractCode({
+  compiled,
+  compiler,
+  deployer,
+  log,
+  source,
+  uploaded,
+  uploader,
+})
 
@@ -35,7 +41,7 @@ up to and including uploading it, but not instantiating it. uploader
undefined.
-## method [*contractCode.compile*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L41) +## method [*contractCode.compile*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Compile this contract. If a valid binary is present and a rebuild is not requested, @@ -49,7 +55,7 @@ contractCode.compile( ) -## method [*contractCode.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L81) +## method [*contractCode.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Upload this contract. If a valid binary is not present, compile it first. @@ -61,37 +67,68 @@ If a valid binary is not present, but valid source is present, this compiles the source code first to obtain a binary.
 contractCode.upload(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  },
+   &  & ,
 )
 
-# class *ContractInstance* +# class *UploadedCode* +Represents a contract's code, in binary form, uploaded to a given chain. + +
+const uploadedCode = new UploadedCode({
+  chainId,
+  codeHash,
+  codeId,
+  uploadBy,
+  uploadGas,
+  uploadTx,
+})
+
+ + + + + + + + + + + + + + + + + +
+chainIdstring. ID of chain on which this contract is uploaded.
+codeHashstring. Code hash uniquely identifying the compiled code.
+codeIdstring. Code ID representing the identity of the contract's code on a specific chain.
+uploadByundefined. address of agent that performed the upload.
+uploadGasundefined. address of agent that performed the upload.
+uploadTxstring. TXID of transaction that performed the upload.
+canInstantiate
+canInstantiateInfo
+ +## method [*uploadedCode.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +
+uploadedCode.serialize()
+
+ +# class *DeploymentUnit* A contract that is part of a deploment. - needed for deployment-wide deduplication - generates structured label
-const contractInstance = new ContractInstance(
-  properties: Partial<ContractCode> & Partial<DeploymentUnit> & Partial<ContractInstance>,
+const deploymentUnit = new DeploymentUnit(
+  properties:  & ,
 )
 
- - - +log + - +name + - +source + - +uploaded + - +uploader +
-addressstring. Address of this contract instance. Unique per chain.
chainId string. Code ID representing the identity of the contract's code on a specific chain.
@@ -113,32 +150,92 @@ A contract that is part of a deploment. deployment Deployment. Deployment to which this unit belongs.
-initByundefined. Address of agent that performed the init tx.
Console.
-initFeeunknown. Fee to use for init.
string. Name of this unit.
-initGasunknown. Contents of init message.
SourceCode.
-initMemostring. Instantiation memo.
UploadedCode.
-initMsgInto. Contents of init message.
undefined.
+ +## method [*deploymentUnit.compile*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +Compile this contract. + +If a valid binary is present and a rebuild is not requested, +this does not compile it again, but reuses the binary. +
+deploymentUnit.compile(
+  {
+    compiler,
+    rebuild,
+  },
+)
+
+ +## method [*deploymentUnit.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +
+deploymentUnit.serialize()
+
+ +## method [*deploymentUnit.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +Upload this contract. + +If a valid binary is not present, compile it first. + +If a valid code ID is present and reupload is not requested, +this does not upload it again, but reuses the code ID. + +If a valid binary is not present, but valid source is present, +this compiles the source code first to obtain a binary. +
+deploymentUnit.upload(
+   &  & ,
+)
+
+ +# class *ContractTemplate* +A contract that is part of a deploment. +- needed for deployment-wide deduplication +- generates structured label + +
+const contractTemplate = new ContractTemplate(
+  properties:  & ,
+)
+
+ + - +chainId + - +codeHash + +codeId + + + + + + - +deployment + + + @@ -155,13 +252,13 @@ A contract that is part of a deploment. uploader
-initSendundefined. Native tokens to send to the new contract.
string. Code ID representing the identity of the contract's code on a specific chain.
-initTxstring. ID of transaction that performed the init.
string. Code hash uniquely identifying the compiled code.
-isTemplatestring. Code ID representing the identity of the contract's code on a specific chain.
+compiledCompiledCode.
+compilerCompiler.
+deployer undefined.
-labelstring. Full label of the instance. Unique for a given chain.
Deployment. Deployment to which this unit belongs.
+isTemplateundefined.
log Console.
undefined.
-## method [*contractInstance.compile*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L41) +## method [*contractTemplate.compile*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Compile this contract. If a valid binary is present and a rebuild is not requested, this does not compile it again, but reuses the binary.
-contractInstance.compile(
+contractTemplate.compile(
   {
     compiler,
     rebuild,
@@ -169,46 +266,29 @@ contractInstance.compile(
 )
 
-## method [*contractInstance.connect*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L287) -Returns a client to this contract instance. +## method [*contractTemplate.contract*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +Create a new instance of this contract.
-const result: Contract = contractInstance.connect(
-  agent: Connection,
+const result: ContractInstance = contractTemplate.contract(
+  name: string,
+  parameters: Partial<ContractInstance>,
 )
 
-## method [*contractInstance.deploy*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L248) +## method [*contractTemplate.contracts*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +Create multiple instances of this contract.
-contractInstance.deploy(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  } & Partial<ContractInstance> & {
-    deployer,
-    redeploy,
-  },
+const result: Record<string, ContractInstance> = contractTemplate.contracts(
+  instanceParameters: Record<string, Partial>,
 )
 
-## method [*contractInstance.isValid*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L295) -
-contractInstance.isValid()
-
- -## method [*contractInstance.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L278) +## method [*contractTemplate.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
-contractInstance.serialize()
+contractTemplate.serialize()
 
-## method [*contractInstance.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L81) +## method [*contractTemplate.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Upload this contract. If a valid binary is not present, compile it first. @@ -219,35 +299,27 @@ this does not upload it again, but reuses the code ID. If a valid binary is not present, but valid source is present, this compiles the source code first to obtain a binary.
-contractInstance.upload(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  },
+contractTemplate.upload(
+   &  & ,
 )
 
-# class *ContractTemplate* +# class *ContractInstance* A contract that is part of a deploment. - needed for deployment-wide deduplication - generates structured label
-const contractTemplate = new ContractTemplate(
-  properties: Partial<ContractCode> & Partial<DeploymentUnit>,
+const contractInstance = new ContractInstance(
+  properties:  &  & ,
 )
 
+ + + + + + + + + + + + + + + + + +
+addressstring. Address of this contract instance. Unique per chain.
chainId string. Code ID representing the identity of the contract's code on a specific chain.
@@ -269,9 +341,33 @@ A contract that is part of a deploment. deployment Deployment. Deployment to which this unit belongs.
+initByundefined. Address of agent that performed the init tx.
+initFeeunknown. Fee to use for init.
+initGasunknown. Contents of init message.
+initMemostring. Instantiation memo.
+initMsgInto. Contents of init message.
+initSendundefined. Native tokens to send to the new contract.
+initTxstring. ID of transaction that performed the init.
isTemplate undefined.
+labelstring. Full label of the instance. Unique for a given chain.
log Console.
@@ -287,13 +383,13 @@ A contract that is part of a deploment. uploader undefined.
-## method [*contractTemplate.compile*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L41) +## method [*contractInstance.compile*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Compile this contract. If a valid binary is present and a rebuild is not requested, this does not compile it again, but reuses the binary.
-contractTemplate.compile(
+contractInstance.compile(
   {
     compiler,
     rebuild,
@@ -301,29 +397,32 @@ contractTemplate.compile(
 )
 
-## method [*contractTemplate.contract*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L200) -Create a new instance of this contract. +## method [*contractInstance.connect*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +Returns a client to this contract instance.
-const result: ContractInstance = contractTemplate.contract(
-  name: string,
-  parameters: Partial<ContractInstance>,
+const result: Contract = contractInstance.connect(
+  agent: Connection,
 )
 
-## method [*contractTemplate.contracts*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L206) -Create multiple instances of this contract. +## method [*contractInstance.deploy*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
-const result: Record<string, ContractInstance> = contractTemplate.contracts(
-  instanceParameters: Record<string, Partial>,
+contractInstance.deploy(
+   &  &  &  & ,
 )
 
-## method [*contractTemplate.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L191) +## method [*contractInstance.isValid*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
-contractTemplate.serialize()
+contractInstance.isValid()
 
-## method [*contractTemplate.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L81) +## method [*contractInstance.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) +
+contractInstance.serialize()
+
+ +## method [*contractInstance.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Upload this contract. If a valid binary is not present, compile it first. @@ -334,19 +433,8 @@ this does not upload it again, but reuses the code ID. If a valid binary is not present, but valid source is present, this compiles the source code first to obtain a binary.
-contractTemplate.upload(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  },
+contractInstance.upload(
+   &  & ,
 )
 
@@ -354,9 +442,13 @@ contractTemplate.upload( A collection of contracts.
-const deployment = new Deployment(
-  properties: Partial<Deployment>,
-)
+const deployment = new Deployment({
+  [toStringTag],
+  log,
+  name,
+  size,
+  [species],
+})
 
@@ -373,66 +465,49 @@ A collection of contracts. [species]
MapConstructor.
-## method [*deployment.[iterator]*](undefined) +## method [*deployment.[iterator]*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of entries in the map.
 const result: IterableIterator<> = deployment.[iterator]()
 
-## method [*deployment.addContract*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L387) +## method [*deployment.addContract*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Deployment = deployment.addContract(
-  ...args: [string, {
-    language,
-  } & Partial<RustSourceCode> | {
-    language,
-  } & Partial<SourceCode> & Partial<CompiledCode> & Partial<UploadedCode> & Partial<ContractInstance>],
+  ...args: [, ],
 )
 
-## method [*deployment.addContracts*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L395) +## method [*deployment.addContracts*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Deployment = deployment.addContracts(
-  ...args: [string, {
-    language,
-  } & Partial<RustSourceCode> | {
-    language,
-  } & Partial<SourceCode> & Partial<CompiledCode> & Partial<UploadedCode>],
+  ...args: [, ],
 )
 
-## method [*deployment.build*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L403) +## method [*deployment.build*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Record<string, > = await deployment.build(
-  {
-    compiler,
-    rebuild,
-  } & {
-    units,
-  },
+   & ,
 )
 
-## method [*deployment.clear*](undefined) +## method [*deployment.clear*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: void = deployment.clear()
 
-## method [*deployment.contract*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L365) +## method [*deployment.contract*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Define a contract that will be automatically compiled, uploaded, and instantiated as part of this deployment.
 const result: ContractInstance = deployment.contract(
   name: string,
-  properties: {
-    language,
-  } & Partial<RustSourceCode> | {
-    language,
-  } & Partial<SourceCode> & Partial<CompiledCode> & Partial<UploadedCode> & Partial<ContractInstance>,
+  properties:  &  &  & ,
 )
 
-## method [*deployment.delete*](undefined) +## method [*deployment.delete*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = deployment.delete(
@@ -440,37 +515,20 @@ and instantiated as part of this deployment.
 )
 
-## method [*deployment.deploy*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L457) +## method [*deployment.deploy*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Record<string, > = await deployment.deploy(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  } & Partial<ContractInstance> & {
-    deployer,
-    redeploy,
-  } & {
-    deployStore,
-    units,
-  },
+   &  &  &  &  & ,
 )
 
-## method [*deployment.entries*](undefined) +## method [*deployment.entries*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of key, value pairs for every entry in the map.
 const result: IterableIterator<> = deployment.entries()
 
-## method [*deployment.forEach*](undefined) +## method [*deployment.forEach*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts) Executes a provided function once per each key/value pair in the Map, in insertion order.
 const result: void = deployment.forEach(
@@ -479,7 +537,7 @@ Executes a provided function once per each key/value pair in the Map, in inserti
 )
 
-## method [*deployment.get*](undefined) +## method [*deployment.get*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts) Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
 const result: DeploymentUnit = deployment.get(
@@ -487,7 +545,7 @@ Returns a specified element from the Map object. If the value that is associated
 )
 
-## method [*deployment.has*](undefined) +## method [*deployment.has*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = deployment.has(
@@ -495,18 +553,18 @@ Returns a specified element from the Map object. If the value that is associated
 )
 
-## method [*deployment.keys*](undefined) +## method [*deployment.keys*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of keys in the map
 const result: IterableIterator<string> = deployment.keys()
 
-## method [*deployment.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L323) +## method [*deployment.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 deployment.serialize()
 
-## method [*deployment.set*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L331) +## method [*deployment.set*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 deployment.set(
   name: string,
@@ -514,7 +572,7 @@ deployment.set(
 )
 
-## method [*deployment.template*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L342) +## method [*deployment.template*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts) Define a template, representing code that can be compiled and uploaded, but will not be automatically instantiated. This can then be used to define multiple instances of @@ -522,180 +580,27 @@ the same code.
 const result: ContractTemplate = deployment.template(
   name: string,
-  properties: {
-    language,
-  } & Partial<RustSourceCode> | {
-    language,
-  } & Partial<SourceCode> & Partial<CompiledCode> & Partial<UploadedCode>,
+  properties:  &  & ,
 )
 
-## method [*deployment.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L440) +## method [*deployment.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Record<string, > = await deployment.upload(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  } & {
-    units,
-    uploadStore,
-  },
+   &  &  & ,
 )
 
-## method [*deployment.values*](undefined) +## method [*deployment.values*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of values in the map
 const result: IterableIterator<DeploymentUnit> = deployment.values()
 
-## method [*deployment.fromSnapshot*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L308) +## method [*deployment.fromSnapshot*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/deploy.ts)
 const result: Deployment = deployment.fromSnapshot(
   Partial<>,
 )
 
- -# class *DeploymentUnit* -A contract that is part of a deploment. -- needed for deployment-wide deduplication -- generates structured label - -
-const deploymentUnit = new DeploymentUnit(
-  properties: Partial<ContractCode> & Partial<DeploymentUnit>,
-)
-
- - - - - - - - - - - - - - - - - - - - - - - - - -
-chainIdstring. Code ID representing the identity of the contract's code on a specific chain.
-codeHashstring. Code hash uniquely identifying the compiled code.
-codeIdstring. Code ID representing the identity of the contract's code on a specific chain.
-compiledCompiledCode.
-compilerCompiler.
-deployerundefined.
-deploymentDeployment. Deployment to which this unit belongs.
-logConsole.
-namestring. Name of this unit.
-sourceSourceCode.
-uploadedUploadedCode.
-uploaderundefined.
- -## method [*deploymentUnit.compile*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L41) -Compile this contract. - -If a valid binary is present and a rebuild is not requested, -this does not compile it again, but reuses the binary. -
-deploymentUnit.compile(
-  {
-    compiler,
-    rebuild,
-  },
-)
-
- -## method [*deploymentUnit.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L191) -
-deploymentUnit.serialize()
-
- -## method [*deploymentUnit.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L81) -Upload this contract. - -If a valid binary is not present, compile it first. - -If a valid code ID is present and reupload is not requested, -this does not upload it again, but reuses the code ID. - -If a valid binary is not present, but valid source is present, -this compiles the source code first to obtain a binary. -
-deploymentUnit.upload(
-  {
-    compiler,
-    rebuild,
-  } & {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  } & {
-    reupload,
-    uploader,
-  },
-)
-
- -# class *UploadedCode* -Represents a contract's code, in binary form, uploaded to a given chain. - -
-const uploadedCode = new UploadedCode(
-  properties: Partial<UploadedCode>,
-)
-
- - - - - - - - - - - - - - - - - -
-chainIdstring. ID of chain on which this contract is uploaded.
-codeHashstring. Code hash uniquely identifying the compiled code.
-codeIdstring. Code ID representing the identity of the contract's code on a specific chain.
-uploadByundefined. address of agent that performed the upload.
-uploadGasundefined. address of agent that performed the upload.
-uploadTxstring. TXID of transaction that performed the upload.
-canInstantiate
-canInstantiateInfo
- -## method [*uploadedCode.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/deploy.ts#L137) -
-uploadedCode.serialize()
-
diff --git a/packages/agent/docs.ts b/packages/agent/docs.ts index c105e5a306..ba109b48f5 100755 --- a/packages/agent/docs.ts +++ b/packages/agent/docs.ts @@ -1,14 +1,18 @@ #!/usr/bin/env -S node --import=@ganesha/esbuild import { readFileSync } from 'node:fs' -import { documentModule } from '@hackbg/docs' -const data = JSON.parse(readFileSync('docs.json', 'utf8')) -documentModule({ data, target: 'core.md', sources: ['core.ts'], }) -documentModule({ data, target: 'chain.md', sources: ['chain.ts'], }) -documentModule({ data, target: 'deploy.md', sources: ['deploy.ts'], }) -documentModule({ data, target: 'governance.md', sources: ['governance.ts'], }) -documentModule({ data, target: 'program.md', sources: ['program.browser.ts', 'program.ts'], }) -documentModule({ data, target: 'staking.md', sources: ['staking.ts'], }) -documentModule({ data, target: 'store.md', sources: ['store.ts'], }) -documentModule({ data, target: 'stub.md', sources: ['stub.ts'], }) -documentModule({ data, target: 'token.md', sources: ['token.ts'], }) -documentModule({ data, target: 'tx.md', sources: ['tx.ts'], }) +import { generateDocumentation } from '@hackbg/docs' +generateDocumentation({ + data: JSON.parse(readFileSync('docs.json', 'utf8')), + pages: { + 'core.md': { sources: ['core.ts'] }, + 'chain.md': { sources: ['chain.ts'] }, + 'deploy.md': { sources: ['deploy.ts'] }, + 'governance.md': { sources: ['governance.ts'] }, + 'program.md': { sources: ['program.browser.ts', 'program.ts'] }, + 'staking.md': { sources: ['staking.ts'] }, + 'store.md': { sources: ['store.ts'] }, + 'stub.md': { sources: ['stub.ts'] }, + 'token.md': { sources: ['token.ts'] }, + 'tx.md': { sources: ['tx.ts'] }, + } +}) diff --git a/packages/agent/governance.md b/packages/agent/governance.md index 056f6319ee..322a222bee 100644 --- a/packages/agent/governance.md +++ b/packages/agent/governance.md @@ -2,9 +2,12 @@ # class *Proposal*
-const proposal = new Proposal(
-  properties: Partial<Proposal>,
-)
+const proposal = new Proposal({
+  chain,
+  id,
+  result,
+  votes,
+})
 
@@ -23,9 +26,12 @@ # class *Vote*
-const vote = new Vote(
-  properties: Partial<Vote>,
-)
+const vote = new Vote({
+  power,
+  proposal,
+  value,
+  voter,
+})
 
diff --git a/packages/agent/package.json b/packages/agent/package.json index ccd70a4294..49e8a1ec0b 100644 --- a/packages/agent/package.json +++ b/packages/agent/package.json @@ -10,7 +10,7 @@ "keywords": [ "cosmwasm", "scrt", "secret network", "interchain" ], "description": "Isomorphic base layer for implementing dAPI clients. See @fadroma/scrt for Secret Network support.", "scripts": { - "doc": "typedoc --json docs.json", + "doc": "typedoc --disableGit --sourceLinkTemplate 'https://github.com/hackbg/fadroma/tree/v2/{path}' --json docs.json && ./docs.ts", "check": "tsc --noEmit", "test": "time ensuite agent.test.ts", "cov": "time ensuite-cov -r text -r lcov -- agent.test.ts", diff --git a/packages/agent/program.md b/packages/agent/program.md index cfdeb90e71..34fa6f892b 100644 --- a/packages/agent/program.md +++ b/packages/agent/program.md @@ -149,11 +149,11 @@ new LocalCompiledCode( -# class *CompiledCode* -An object representing a given compiled binary. +# class *LocalCompiledCode* +An object representing a given compiled binary on the local filesystem.
-const compiledCode = new CompiledCode(
+const localCompiledCode = new LocalCompiledCode(
   properties: Partial<CompiledCode>,
 )
 
@@ -181,25 +181,25 @@ An object representing a given compiled binary. canUploadInfo
-## method [*compiledCode.computeHash*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L262) +## method [*localCompiledCode.computeHash*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) Compute the code hash if missing; throw if different.
-compiledCode.computeHash()
+localCompiledCode.computeHash()
 
-## method [*compiledCode.fetch*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L226) +## method [*localCompiledCode.fetch*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts)
-const result: Uint8Array = await compiledCode.fetch()
+const result: Uint8Array = await localCompiledCode.fetch()
 
-## method [*compiledCode.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L194) +## method [*localCompiledCode.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts)
-compiledCode.serialize()
+localCompiledCode.serialize()
 
-## method [*compiledCode.toCodeHash*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L274) +## method [*localCompiledCode.toCodeHash*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts)
-const result: string = compiledCode.toCodeHash(
+const result: string = localCompiledCode.toCodeHash(
   data: Uint8Array,
 )
 
@@ -224,18 +224,18 @@ binary and checksum are both present in wasm/ directory log Console. -## abstract method [*compiler.build*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L21) +## abstract method [*compiler.build*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) Compile a source. `@hackbg/fadroma` implements dockerized and non-dockerized variants using its `build.impl.mjs` script.
 const result: CompiledCode = await compiler.build(
-  source: string | Partial<SourceCode>,
+  source:  | ,
   ...args: unknown,
 )
 
-## method [*compiler.buildMany*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L27) +## method [*compiler.buildMany*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) Build multiple sources. Default implementation of buildMany is sequential. Compiler classes may override this to optimize. @@ -245,68 +245,68 @@ Compiler classes may override this to optimize. ) -# class *LocalCompiledCode* -An object representing a given compiled binary on the local filesystem. +# class *SourceCode* +An object representing a given source code.
-const localCompiledCode = new LocalCompiledCode(
-  properties: Partial<CompiledCode>,
-)
+const sourceCode = new SourceCode({
+  log,
+  sourceDirty,
+  sourceOrigin,
+  sourcePath,
+  sourceRef,
+})
 
- +log + - +sourceDirty + - +sourceOrigin + +sourcePath + + + + +canCompileInfo +canFetch +canFetchInfo
-codeDataUint8Array. The compiled code.
Console.
-codeHashstring. Code hash uniquely identifying the compiled code.
boolean. Whether the code contains uncommitted changes.
-codePathundefined. Location of the compiled code.
undefined. URL pointing to Git upstream containing the canonical source code.
-canFetchstring. Path to local checkout of the source code (with .git directory if sourceRef is set).
+sourceRefstring. Pointer to the source commit.
+canCompile
-canFetchInfo
-canUpload
-canUploadInfo
-## method [*localCompiledCode.computeHash*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L262) -Compute the code hash if missing; throw if different. -
-localCompiledCode.computeHash()
-
- -## method [*localCompiledCode.fetch*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L226) -
-const result: Uint8Array = await localCompiledCode.fetch()
-
- -## method [*localCompiledCode.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L194) -
-localCompiledCode.serialize()
-
- -## method [*localCompiledCode.toCodeHash*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L274) +## method [*sourceCode.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts)
-const result: string = localCompiledCode.toCodeHash(
-  data: Uint8Array,
-)
+sourceCode.serialize()
 
# class *RustSourceCode* An object representing a given source code.
-const rustSourceCode = new RustSourceCode(
-  properties: Partial<RustSourceCode>,
-)
+const rustSourceCode = new RustSourceCode({
+  cargoCrate,
+  cargoFeatures,
+  cargoToml,
+  cargoWorkspace,
+  log,
+  sourceDirty,
+  sourceOrigin,
+  sourcePath,
+  sourceRef,
+})
 
@@ -350,51 +350,65 @@ An object representing a given source code. canFetchInfo
-## method [*rustSourceCode.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L116) +## method [*rustSourceCode.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts)
 rustSourceCode.serialize()
 
-# class *SourceCode* -An object representing a given source code. +# class *CompiledCode* +An object representing a given compiled binary.
-const sourceCode = new SourceCode(
-  properties: Partial<SourceCode>,
-)
+const compiledCode = new CompiledCode({
+  codeData,
+  codeHash,
+  codePath,
+})
 
- - - - - +codeData + - +codeHash + - +codePath + +canFetch +canFetchInfo +canUpload +canUploadInfo
-logConsole.
-sourceDirtyboolean. Whether the code contains uncommitted changes.
-sourceOriginundefined. URL pointing to Git upstream containing the canonical source code.
Uint8Array. The compiled code.
-sourcePathstring. Path to local checkout of the source code (with .git directory if sourceRef is set).
string. Code hash uniquely identifying the compiled code.
-sourceRefstring. Pointer to the source commit.
undefined. Location of the compiled code.
-canCompile
-canCompileInfo
-canFetch
-canFetchInfo
-## method [*sourceCode.serialize*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L61) +## method [*compiledCode.computeHash*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) +Compute the code hash if missing; throw if different.
-sourceCode.serialize()
+compiledCode.computeHash()
+
+ +## method [*compiledCode.fetch*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) +
+const result: Uint8Array = await compiledCode.fetch()
+
+ +## method [*compiledCode.serialize*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) +
+compiledCode.serialize()
+
+ +## method [*compiledCode.toCodeHash*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) +
+const result: string = compiledCode.toCodeHash(
+  data: Uint8Array,
+)
 
diff --git a/packages/agent/staking.md b/packages/agent/staking.md index 1d2d6b7dcd..73ec6c0365 100644 --- a/packages/agent/staking.md +++ b/packages/agent/staking.md @@ -2,9 +2,10 @@ # class *Validator*
-const validator = new Validator(
-  properties: Partial<Validator>,
-)
+const validator = new Validator({
+  address,
+  chain,
+})
 
diff --git a/packages/agent/store.md b/packages/agent/store.md index c81db3b849..7828d4a14e 100644 --- a/packages/agent/store.md +++ b/packages/agent/store.md @@ -22,18 +22,18 @@ and can create Deployment objects with the data from the receipts. [species]
MapConstructor.
-## method [*deployStore.[iterator]*](undefined) +## method [*deployStore.[iterator]*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of entries in the map.
 const result: IterableIterator<> = deployStore.[iterator]()
 
-## method [*deployStore.clear*](undefined) +## method [*deployStore.clear*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: void = deployStore.clear()
 
-## method [*deployStore.delete*](undefined) +## method [*deployStore.delete*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = deployStore.delete(
@@ -41,13 +41,13 @@ Returns an iterable of entries in the map.
 )
 
-## method [*deployStore.entries*](undefined) +## method [*deployStore.entries*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of key, value pairs for every entry in the map.
 const result: IterableIterator<> = deployStore.entries()
 
-## method [*deployStore.forEach*](undefined) +## method [*deployStore.forEach*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts) Executes a provided function once per each key/value pair in the Map, in insertion order.
 const result: void = deployStore.forEach(
@@ -56,14 +56,14 @@ Executes a provided function once per each key/value pair in the Map, in inserti
 )
 
-## method [*deployStore.get*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/store.ts#L17) +## method [*deployStore.get*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/store.ts)
 const result: Partial<> = deployStore.get(
   name: string,
 )
 
-## method [*deployStore.has*](undefined) +## method [*deployStore.has*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = deployStore.has(
@@ -71,21 +71,21 @@ Executes a provided function once per each key/value pair in the Map, in inserti
 )
 
-## method [*deployStore.keys*](undefined) +## method [*deployStore.keys*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of keys in the map
 const result: IterableIterator<string> = deployStore.keys()
 
-## method [*deployStore.set*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/store.ts#L24) +## method [*deployStore.set*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/store.ts)
 deployStore.set(
   name: string,
-  state: Partial<> | Partial<Deployment>,
+  state:  | ,
 )
 
-## method [*deployStore.values*](undefined) +## method [*deployStore.values*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of values in the map
 const result: IterableIterator<Partial> = deployStore.values()
@@ -107,18 +107,18 @@ Returns an iterable of values in the map
 [species]
 MapConstructor. 
 
-## method [*uploadStore.[iterator]*](undefined)
+## method [*uploadStore.[iterator]*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts)
 Returns an iterable of entries in the map.
 
 const result: IterableIterator<> = uploadStore.[iterator]()
 
-## method [*uploadStore.clear*](undefined) +## method [*uploadStore.clear*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: void = uploadStore.clear()
 
-## method [*uploadStore.delete*](undefined) +## method [*uploadStore.delete*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = uploadStore.delete(
@@ -126,13 +126,13 @@ Returns an iterable of entries in the map.
 )
 
-## method [*uploadStore.entries*](undefined) +## method [*uploadStore.entries*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of key, value pairs for every entry in the map.
 const result: IterableIterator<> = uploadStore.entries()
 
-## method [*uploadStore.forEach*](undefined) +## method [*uploadStore.forEach*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts) Executes a provided function once per each key/value pair in the Map, in insertion order.
 const result: void = uploadStore.forEach(
@@ -141,14 +141,14 @@ Executes a provided function once per each key/value pair in the Map, in inserti
 )
 
-## method [*uploadStore.get*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/store.ts#L37) +## method [*uploadStore.get*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/store.ts)
 const result: UploadedCode = uploadStore.get(
   codeHash: string,
 )
 
-## method [*uploadStore.has*](undefined) +## method [*uploadStore.has*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.collection.d.ts)
 const result: boolean = uploadStore.has(
@@ -156,13 +156,13 @@ Executes a provided function once per each key/value pair in the Map, in inserti
 )
 
-## method [*uploadStore.keys*](undefined) +## method [*uploadStore.keys*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of keys in the map
 const result: IterableIterator<string> = uploadStore.keys()
 
-## method [*uploadStore.set*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/store.ts#L41) +## method [*uploadStore.set*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/store.ts)
 uploadStore.set(
   codeHash: string,
@@ -170,7 +170,7 @@ uploadStore.set(
 )
 
-## method [*uploadStore.values*](undefined) +## method [*uploadStore.values*](https://github.com/hackbg/fadroma/tree/v2/node_modules/.pnpm/typescript@5.3.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts) Returns an iterable of values in the map
 const result: IterableIterator<UploadedCode> = uploadStore.values()
diff --git a/packages/agent/stub.md b/packages/agent/stub.md
index 27dcd9a79b..f57610c7f0 100644
--- a/packages/agent/stub.md
+++ b/packages/agent/stub.md
@@ -1,181 +1,14 @@
 
 
-# class *StubBackend*
-This is the base class for any connection backend, such as:
-
-  * Remote RPC endpoint.
-  * Local devnet RPC endpoint.
-  * Stub/mock implementation of chain.
-
-You shouldn't need to instantiate this class directly.
-Instead, see `Connection`, `Devnet`, and their subclasses.
-
-
-const stubBackend = new StubBackend(
-  properties: Partial<>,
-)
-
- - - - - - - - - - - - - - - - - - - - - - - -
-accountsMap.
-aliveboolean.
-balancesMap.
-chainIdstring. The chain ID that will be passed to the devnet node.
-gasTokenNativeToken. Denomination of base gas token for this chain.
-instancesMap.
-lastCodeIdnumber.
-logConsole.
-prefixstring.
-uploadsMap.
-urlstring.
- -## method [*stubBackend.connect*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L190) -
-const result: Connection = await stubBackend.connect(
-  parameter: string | Partial<>,
-)
-
- -## method [*stubBackend.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L258) -
-const result: unknown = await stubBackend.execute(
-  ...args: unknown,
-)
-
- -## method [*stubBackend.export*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L229) -
-const result: unknown = await stubBackend.export(
-  ...args: unknown,
-)
-
- -## method [*stubBackend.getIdentity*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L208) -
-const result: Identity = await stubBackend.getIdentity(
-  name: string,
-)
-
- -## method [*stubBackend.import*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L225) -
-const result: unknown = await stubBackend.import(
-  ...args: unknown,
-)
-
- -## method [*stubBackend.instantiate*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L243) -
-stubBackend.instantiate(
-  creator: string,
-  codeId: string,
-  options: unknown,
-)
-
- -## method [*stubBackend.pause*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L220) -
-const result: StubBackend = await stubBackend.pause()
-
- -## method [*stubBackend.start*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L215) -
-const result: StubBackend = await stubBackend.start()
-
- -## method [*stubBackend.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L233) -
-stubBackend.upload(
-  codeData: Uint8Array,
-)
-
- -# class *StubBatch* -Builder object for batched transactions. - -
-const stubBatch = new StubBatch(
-  properties: Partial<Batch>,
-)
-
- - - - - - - -
-connectionStubConnection.
-logConsole.
-messagesundefined.
- -## method [*stubBatch.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L276) -Add an execute message to the batch. -
-const result: StubBatch = stubBatch.execute(
-  ...args: [string | Partial<ContractInstance>, Message, {
-    execFee,
-    execMemo,
-    execSend,
-  }],
-)
-
- -## method [*stubBatch.instantiate*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L271) -Add an instantiate message to the batch. -
-const result: StubBatch = stubBatch.instantiate(
-  ...args: [string | Partial<UploadedCode>, Partial<ContractInstance>],
-)
-
- -## method [*stubBatch.submit*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L281) -Submit the batch. -
-const result: object = await stubBatch.submit()
-
- -## method [*stubBatch.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L266) -Add an upload message to the batch. -
-const result: StubBatch = stubBatch.upload(
-  ...args: [string | Uint8Array | URL | Partial<CompiledCode>, {
-    reupload,
-    uploadFee,
-    uploadMemo,
-    uploadStore,
-  }],
-)
-
- # class *StubBlock* The building block of a blockchain. + Each block contains collection of transactions that are appended to the blockchain at a given point in time. +You shouldn't have to instantiate this directly; +instead, it's returned from `connection.getBlock()` +
 const stubBlock = new StubBlock(
   properties: Partial<Block>,
@@ -193,70 +26,37 @@ appended to the blockchain at a given point in time.
 height
 number. Monotonically incrementing ID of block.
 
-## method [*stubBlock.getTransactionsById*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L18)
+## method [*stubBlock.getTransactionsById*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts)
 
 const result: Record<string, Transaction> = await stubBlock.getTransactionsById()
 
-## method [*stubBlock.getTransactionsInOrder*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L21) +## method [*stubBlock.getTransactionsInOrder*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts)
 const result: Transaction[] = await stubBlock.getTransactionsInOrder()
 
-# class *StubCompiler* -A compiler that does nothing. Used for testing. - -
-const stubCompiler = new StubCompiler(
-  properties: Partial<Logged>,
-)
-
- - - - - - - -
-cachingboolean. Whether to enable build caching. -When set to false, this compiler will rebuild even when -binary and checksum are both present in wasm/ directory
-idstring. Unique identifier of this compiler implementation.
-logConsole.
- -## method [*stubCompiler.build*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L297) -Compile a source. -`@hackbg/fadroma` implements dockerized and non-dockerized -variants using its `build.impl.mjs` script. -
-const result: CompiledCode = await stubCompiler.build(
-  source: string | Partial<SourceCode>,
-  ...args: any,
-)
-
- -## method [*stubCompiler.buildMany*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/program.browser.ts#L27) -Build multiple sources. -Default implementation of buildMany is sequential. -Compiler classes may override this to optimize. -
-const result: CompiledCode[] = await stubCompiler.buildMany(
-  inputs: Partial<SourceCode>[],
-)
-
- # class *StubConnection* -This is the base class for a connection to a blockchain via a given endpoint. +Base class representing a connection to a blockchain via a given endpoint. Use one of its subclasses in `@fadroma/scrt`, `@fadroma/cw`, `@fadroma/namada` to connect to the corresponding chain. Or, extend this class to implement support for new kinds of blockchains.
-const stubConnection = new StubConnection(
-  properties: Partial<StubConnection>,
-)
+const stubConnection = new StubConnection({
+  alive,
+  api,
+  backend,
+  blockInterval,
+  chainId,
+  fees,
+  identity,
+  log,
+  mode,
+  url,
+  gasToken,
+})
 
@@ -324,17 +124,17 @@ this property contains the URL to which requests are sent.nextBlock
-## method [*stubConnection.batch*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/stub.ts#L36) +## method [*stubConnection.batch*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) Construct a transaction batch.
 const result: Batch<StubConnection> = stubConnection.batch()
 
-## method [*stubConnection.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L568) +## method [*stubConnection.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Call a given program's transaction method.
 const result: unknown = await stubConnection.execute(
-  contract: string | Partial<ContractInstance>,
+  contract:  | ,
   message: Message,
   options: {
     execFee,
@@ -344,33 +144,29 @@ Call a given program's transaction method.
 )
 
-## method [*stubConnection.getBalanceIn*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L389) +## method [*stubConnection.getBalanceIn*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the balance in a given native token, of either this connection's identity's address, or of another given address.
 const result: unknown = await stubConnection.getBalanceIn(
   token: string,
-  address: string | {
-    address,
-  },
+  address:  | ,
 )
 
-## method [*stubConnection.getBalanceOf*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L364) +## method [*stubConnection.getBalanceOf*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the balance in a native token of a given address, either in this connection's gas token, or in another given token.
 const result: unknown = await stubConnection.getBalanceOf(
-  address: string | {
-    address,
-  },
+  address:  | ,
   token: string,
 )
 
-## method [*stubConnection.getBlock*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L222) +## method [*stubConnection.getBlock*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get info about a specific block. If no height is passed, gets info about the latest block.
@@ -379,52 +175,44 @@ If no height is passed, gets info about the latest block.
 )
 
-## method [*stubConnection.getCodeHashOfAddress*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L264) +## method [*stubConnection.getCodeHashOfAddress*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code hash of a given address.
 const result: string = await stubConnection.getCodeHashOfAddress(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
 )
 
-## method [*stubConnection.getCodeHashOfCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L248) +## method [*stubConnection.getCodeHashOfCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code hash of a given code id.
 const result: string = await stubConnection.getCodeHashOfCodeId(
-  contract: string | {
-    codeId,
-  },
+  contract:  | ,
 )
 
-## method [*stubConnection.getCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L232) +## method [*stubConnection.getCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get the code id of a given address.
 const result: string = await stubConnection.getCodeId(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
 )
 
-## method [*stubConnection.getCodes*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L294) +## method [*stubConnection.getCodes*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts)
 const result: Record<string, UploadedCode> = await stubConnection.getCodes()
 
-## method [*stubConnection.getContract*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L280) +## method [*stubConnection.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.
 const result: Contract = stubConnection.getContract(
-  options: string | {
-    address,
-  },
+  options:  | ,
 )
 
-## method [*stubConnection.getContractsByCodeId*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L303) +## method [*stubConnection.getContractsByCodeId*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get client handles for all contracts that match a code ID
 const result: Record<string, Contract> = await stubConnection.getContractsByCodeId(
@@ -438,7 +226,7 @@ Get client handles for all contracts that match a code ID
 )
 
-## method [*stubConnection.getContractsByCodeIds*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L325) +## method [*stubConnection.getContractsByCodeIds*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Get client handles for all contracts that match multiple code IDs
 const result: Record<string, Record> = await stubConnection.getContractsByCodeIds(
@@ -457,34 +245,30 @@ Get client handles for all contracts that match multiple code IDs
 )
 
-## method [*stubConnection.instantiate*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L524) +## method [*stubConnection.instantiate*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Instantiate a new program from a code id, label and init message.
 stubConnection.instantiate(
-  contract: string | Partial<UploadedCode>,
+  contract:  | ,
   options: Partial<ContractInstance>,
 )
 
-## method [*stubConnection.query*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L416) +## method [*stubConnection.query*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Query a contract.
 const result: Q = await stubConnection.query(
-  contract: string | {
-    address,
-  },
+  contract:  | ,
   message: Message,
 )
 
-## method [*stubConnection.send*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L432) +## method [*stubConnection.send*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Send native tokens to 1 recipient.
 const result: unknown = await stubConnection.send(
-  recipient: string | {
-    address,
-  },
-  amounts: ICoin | TokenAmount,
+  recipient:  | ,
+  amounts:  | ,
   options: {
     sendFee,
     sendMemo,
@@ -492,11 +276,11 @@ Send native tokens to 1 recipient.
 )
 
-## method [*stubConnection.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L464) +## method [*stubConnection.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Upload a contract's code, generating a new code id/hash pair.
 stubConnection.upload(
-  code: string | Uint8Array | URL | Partial<CompiledCode>,
+  code:  |  |  | ,
   options: {
     reupload,
     uploadFee,
@@ -506,11 +290,216 @@ stubConnection.upload(
 )
 
-## method [*stubConnection.gas*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/chain.ts#L122) +## method [*stubConnection.gas*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/chain.ts) Native token of chain.
 const result: TokenAmount = stubConnection.gas(
-  amount: string | number,
+  amount:  | ,
+)
+
+ +# class *StubBackend* +Base class representing any connection backend, such as: + + * Remote RPC endpoint. + * Local devnet RPC endpoint. + * Stub/mock implementation of chain. + +You shouldn't need to instantiate this class directly. +Instead, see `Connection`, `Devnet`, and their subclasses. + +
+const stubBackend = new StubBackend(
+  properties: Partial<>,
+)
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+accountsMap.
+aliveboolean.
+balancesMap.
+chainIdstring. The chain ID that will be passed to the devnet node.
+gasTokenNativeToken. Denomination of base gas token for this chain.
+instancesMap.
+lastCodeIdnumber.
+logConsole.
+prefixstring.
+uploadsMap.
+urlstring.
+ +## method [*stubBackend.connect*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: Connection = await stubBackend.connect(
+  parameter:  | ,
+)
+
+ +## method [*stubBackend.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: unknown = await stubBackend.execute(
+  ...args: unknown,
+)
+
+ +## method [*stubBackend.export*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: unknown = await stubBackend.export(
+  ...args: unknown,
+)
+
+ +## method [*stubBackend.getIdentity*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: Identity = await stubBackend.getIdentity(
+  name: string,
+)
+
+ +## method [*stubBackend.import*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: unknown = await stubBackend.import(
+  ...args: unknown,
+)
+
+ +## method [*stubBackend.instantiate*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+stubBackend.instantiate(
+  creator: string,
+  codeId: string,
+  options: unknown,
+)
+
+ +## method [*stubBackend.pause*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: StubBackend = await stubBackend.pause()
+
+ +## method [*stubBackend.start*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+const result: StubBackend = await stubBackend.start()
+
+ +## method [*stubBackend.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +
+stubBackend.upload(
+  codeData: Uint8Array,
+)
+
+ +# class *StubBatch* +Builder object for batched transactions. + +
+const stubBatch = new StubBatch(
+  properties: Partial<Batch>,
+)
+
+ + + + + + + +
+connectionStubConnection.
+logConsole.
+messagesundefined.
+ +## method [*stubBatch.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +Add an execute message to the batch. +
+const result: StubBatch = stubBatch.execute(
+  ...args: [, , ],
+)
+
+ +## method [*stubBatch.instantiate*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +Add an instantiate message to the batch. +
+const result: StubBatch = stubBatch.instantiate(
+  ...args: [, ],
+)
+
+ +## method [*stubBatch.submit*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +Submit the batch. +
+const result: object = await stubBatch.submit()
+
+ +## method [*stubBatch.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +Add an upload message to the batch. +
+const result: StubBatch = stubBatch.upload(
+  ...args: [, ],
+)
+
+ +# class *StubCompiler* +A compiler that does nothing. Used for testing. + +
+const stubCompiler = new StubCompiler(
+  properties: Partial<Logged>,
+)
+
+ + + + + + + +
+cachingboolean. Whether to enable build caching. +When set to false, this compiler will rebuild even when +binary and checksum are both present in wasm/ directory
+idstring. Unique identifier of this compiler implementation.
+logConsole.
+ +## method [*stubCompiler.build*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/stub.ts) +Compile a source. +`@hackbg/fadroma` implements dockerized and non-dockerized +variants using its `build.impl.mjs` script. +
+const result: CompiledCode = await stubCompiler.build(
+  source:  | ,
+  ...args: any,
+)
+
+ +## method [*stubCompiler.buildMany*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/program.browser.ts) +Build multiple sources. +Default implementation of buildMany is sequential. +Compiler classes may override this to optimize. +
+const result: CompiledCode[] = await stubCompiler.buildMany(
+  inputs: Partial<SourceCode>[],
 )
 
\ No newline at end of file diff --git a/packages/agent/token.md b/packages/agent/token.md index 2c91a95b4e..f8d065028b 100644 --- a/packages/agent/token.md +++ b/packages/agent/token.md @@ -9,53 +9,39 @@ using various tokens: -# class *Amount* -An amount of a fungible token. +# class *Fee* +A constructable gas fee in native tokens.
-const amount = new Amount(
-  amount: string | number | bigint,
-  token: FungibleToken,
+const fee = new Fee(
+  amount:  |  | ,
+  denom: string,
+  gas: string,
 )
 
- - - - - + -
amountstring.
-tokenFungibleToken.
-asNativeBalance
undefined.
-denom
- -## method [*amount.asCoin*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L115) -
-const result: ICoin = amount.asCoin()
-
+gas +string. -## method [*amount.asFee*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L122) +## method [*fee.add*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
-const result: IFee = amount.asFee(
-  gas: string,
+const result: void = fee.add(
+  amount:  |  | ,
+  denom: string,
 )
 
-## method [*amount.toString*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L111) -
-const result: string = amount.toString()
-
- # class *Coin* Represents some amount of native token.
 const coin = new Coin(
-  amount: string | number,
+  amount:  | ,
   denom: string,
 )
 
@@ -68,85 +54,22 @@ Represents some amount of native token. denom string. -# class *Custom* -A contract-based token. +# class *Token* +An identifiable token on a network.
-const custom = new Custom(
-  address: string,
-  codeHash: string,
-)
+const token = new Token()
 
- - - -
-addressstring.
-codeHashstring.
id
-## method [*custom.amount*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L84) -
-const result: TokenAmount = custom.amount(
-  amount: string | number,
-)
-
- -## method [*custom.isCustom*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L151) - -
-const result: boolean = custom.isCustom()
-
- -## method [*custom.isFungible*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L74) - -
-const result: boolean = custom.isFungible()
-
- -## method [*custom.isNative*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L153) - -
-const result: boolean = custom.isNative()
-
- -## method [*custom.addZeros*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L80) -
-const result: string = custom.addZeros(
-  n: string | number,
-  z: number,
-)
-
- -# class *Fee* -A constructable gas fee in native tokens. - -
-const fee = new Fee(
-  amount: string | number | bigint,
-  denom: string,
-  gas: string,
-)
-
- - - - - -
-amountundefined.
-gasstring.
- -## method [*fee.add*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L32) +## abstract method [*token.isFungible*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) +Whether this token is fungible.
-const result: void = fee.add(
-  amount: string | number | bigint,
-  denom: string,
-)
+token.isFungible()
 
# class *Fungible* @@ -161,39 +84,57 @@ An abstract fungible token. id -## method [*fungible.amount*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L84) +## method [*fungible.amount*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: TokenAmount = fungible.amount(
-  amount: string | number,
+  amount:  | ,
 )
 
-## abstract method [*fungible.isCustom*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L78) +## abstract method [*fungible.isCustom*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) Whether this token is implemented by a smart contract.
 fungible.isCustom()
 
-## method [*fungible.isFungible*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L74) +## method [*fungible.isFungible*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: boolean = fungible.isFungible()
 
-## abstract method [*fungible.isNative*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L76) +## abstract method [*fungible.isNative*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) Whether this token is natively supported by the chain.
 fungible.isNative()
 
-## method [*fungible.addZeros*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L80) +## method [*fungible.addZeros*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: string = fungible.addZeros(
-  n: string | number,
+  n:  | ,
   z: number,
 )
 
+# class *NonFungible* +An abstract non-fungible token. + +
+const nonFungible = new NonFungible()
+
+ + + +
+id
+ +## method [*nonFungible.isFungible*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) + +
+const result: boolean = nonFungible.isFungible()
+
+ # class *Native* The chain's natively implemented token (such as SCRT on Secret Network). @@ -211,62 +152,98 @@ The chain's natively implemented token (such as SCRT on Secret Network). id -## method [*native.amount*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L84) +## method [*native.amount*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: TokenAmount = native.amount(
-  amount: string | number,
+  amount:  | ,
 )
 
-## method [*native.fee*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L140) +## method [*native.fee*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: IFee = native.fee(
-  amount: string | number | bigint,
+  amount:  |  | ,
 )
 
-## method [*native.isCustom*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L136) +## method [*native.isCustom*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: boolean = native.isCustom()
 
-## method [*native.isFungible*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L74) +## method [*native.isFungible*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: boolean = native.isFungible()
 
-## method [*native.isNative*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L138) +## method [*native.isNative*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: boolean = native.isNative()
 
-## method [*native.addZeros*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L80) +## method [*native.addZeros*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
 const result: string = native.addZeros(
-  n: string | number,
+  n:  | ,
   z: number,
 )
 
-# class *NonFungible* -An abstract non-fungible token. +# class *Custom* +A contract-based token.
-const nonFungible = new NonFungible()
+const custom = new Custom(
+  address: string,
+  codeHash: string,
+)
 
+ + + +
+addressstring.
+codeHashstring.
id
-## method [*nonFungible.isFungible*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L68) +## method [*custom.amount*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) +
+const result: TokenAmount = custom.amount(
+  amount:  | ,
+)
+
+ +## method [*custom.isCustom*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
-const result: boolean = nonFungible.isFungible()
+const result: boolean = custom.isCustom()
+
+ +## method [*custom.isFungible*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) + +
+const result: boolean = custom.isFungible()
+
+ +## method [*custom.isNative*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) + +
+const result: boolean = custom.isNative()
+
+ +## method [*custom.addZeros*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) +
+const result: string = custom.addZeros(
+  n:  | ,
+  z: number,
+)
 
# class *Pair* @@ -290,42 +267,65 @@ A pair of tokens. reverse -# class *Swap* -A pair of token amounts. +# class *Amount* +An amount of a fungible token.
-const swap = new Swap(
-  a: NonFungibleToken | TokenAmount,
-  b: NonFungibleToken | TokenAmount,
+const amount = new Amount(
+  amount:  |  | ,
+  token: FungibleToken,
 )
 
- +amount + - +token + +asNativeBalance + +
-aundefined.
string.
-bundefined.
FungibleToken.
-reverse
+denom
-# class *Token* -An identifiable token on a network. +## method [*amount.asCoin*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) +
+const result: ICoin = amount.asCoin()
+
+## method [*amount.asFee*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts)
-const token = new Token()
+const result: IFee = amount.asFee(
+  gas: string,
+)
 
- - -
-id
+## method [*amount.toString*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/token.ts) +
+const result: string = amount.toString()
+
+ +# class *Swap* +A pair of token amounts. -## abstract method [*token.isFungible*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/token.ts#L62) -Whether this token is fungible.
-token.isFungible()
+const swap = new Swap(
+  a:  | ,
+  b:  | ,
+)
 
+ + + + + + + +
+aundefined.
+bundefined.
+reverse
diff --git a/packages/agent/tx.md b/packages/agent/tx.md index 2c30a652a7..34a26e3ccb 100644 --- a/packages/agent/tx.md +++ b/packages/agent/tx.md @@ -54,13 +54,44 @@ assert.deepEqual(await client.withFee(fee2).getFee('my_method'), fee2) +# class *Transaction* +A transaction in a block on a chain. + +
+const transaction = new Transaction()
+
+ + + + + + + + + + + + + + + +
+blockBlock.
+dataunknown.
+gasLimitundefined.
+gasUsedundefined.
+hashstring.
+statusundefined.
+typeunknown.
+ # class *Batch* Builder object for batched transactions.
-const batch = new Batch(
-  properties: Partial<Batch>,
-)
+const batch = new Batch({
+  connection,
+  log,
+})
 
@@ -71,7 +102,7 @@ Builder object for batched transactions. log
Console.
-## method [*batch.execute*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/tx.ts#L38) +## method [*batch.execute*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/tx.ts) Add an execute message to the batch.
 batch.execute(
@@ -79,7 +110,7 @@ batch.execute(
 )
 
-## method [*batch.instantiate*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/tx.ts#L32) +## method [*batch.instantiate*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/tx.ts) Add an instantiate message to the batch.
 batch.instantiate(
@@ -87,7 +118,7 @@ batch.instantiate(
 )
 
-## method [*batch.submit*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/tx.ts#L44) +## method [*batch.submit*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/tx.ts) Submit the batch.
 const result: unknown = await batch.submit(
@@ -95,41 +126,11 @@ Submit the batch.
 )
 
-## method [*batch.upload*](https://github.com/hackbg/fadroma/blob/8021010d3bd291bbf15b55b54602374c0e5488a2/packages/agent/tx.ts#L26) +## method [*batch.upload*](https://github.com/hackbg/fadroma/tree/v2/packages/agent/tx.ts) Add an upload message to the batch.
 batch.upload(
   ...args: Parameters<>,
 )
 
- -# class *Transaction* -A transaction in a block on a chain. - -
-const transaction = new Transaction()
-
- - - - - - - - - - - - - - - -
-blockBlock.
-dataunknown.
-gasLimitundefined.
-gasUsedundefined.
-hashstring.
-statusundefined.
-typeunknown.
diff --git a/toolbox b/toolbox index b79b653241..46f2535f28 160000 --- a/toolbox +++ b/toolbox @@ -1 +1 @@ -Subproject commit b79b65324159ab1fef2cf496458e35688bc37116 +Subproject commit 46f2535f28a18fc6ddfd563ddf4b61880e598c90