}
-/** 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,
+})
+
+
+
+
+chainId |
+string. ID of chain on which this contract is uploaded. |
+
+codeHash |
+string. Code hash uniquely identifying the compiled code. |
+
+codeId |
+string. Code ID representing the identity of the contract's code on a specific chain. |
+
+uploadBy |
+undefined. address of agent that performed the upload. |
+
+uploadGas |
+undefined. address of agent that performed the upload. |
+
+uploadTx |
+string. 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: & ,
)
-address |
-string. 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. |
-initBy |
-undefined. Address of agent that performed the init tx. |
+log
+Console. |
-initFee |
-unknown. Fee to use for init. |
+name
+string. Name of this unit. |
-initGas |
-unknown. Contents of init message. |
+source
+SourceCode. |
-initMemo |
-string. Instantiation memo. |
+uploaded
+UploadedCode. |
-initMsg |
-Into. Contents of init message. |
+uploader
+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: & ,
+)
+
+
+
-initSend |
-undefined. Native tokens to send to the new contract. |
+chainId
+string. Code ID representing the identity of the contract's code on a specific chain. |
-initTx |
-string. ID of transaction that performed the init. |
+codeHash
+string. Code hash uniquely identifying the compiled code. |
-isTemplate |
+codeId
+string. Code ID representing the identity of the contract's code on a specific chain. |
+
+compiled |
+CompiledCode. |
+
+compiler |
+Compiler. |
+
+deployer |
undefined. |
-label |
-string. Full label of the instance. Unique for a given chain. |
+deployment
+Deployment. Deployment to which this unit belongs. |
+
+isTemplate |
+undefined. |
log |
Console. |
@@ -155,13 +252,13 @@ A contract that is part of a deploment.
uploader
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: & & ,
)
+address |
+string. 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. |
+initBy |
+undefined. Address of agent that performed the init tx. |
+
+initFee |
+unknown. Fee to use for init. |
+
+initGas |
+unknown. Contents of init message. |
+
+initMemo |
+string. Instantiation memo. |
+
+initMsg |
+Into. Contents of init message. |
+
+initSend |
+undefined. Native tokens to send to the new contract. |
+
+initTx |
+string. ID of transaction that performed the init. |
+
isTemplate |
undefined. |
+label |
+string. 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>,
-)
-
-
-
-
-chainId |
-string. Code ID representing the identity of the contract's code on a specific chain. |
-
-codeHash |
-string. Code hash uniquely identifying the compiled code. |
-
-codeId |
-string. Code ID representing the identity of the contract's code on a specific chain. |
-
-compiled |
-CompiledCode. |
-
-compiler |
-Compiler. |
-
-deployer |
-undefined. |
-
-deployment |
-Deployment. Deployment to which this unit belongs. |
-
-log |
-Console. |
-
-name |
-string. Name of this unit. |
-
-source |
-SourceCode. |
-
-uploaded |
-UploadedCode. |
-
-uploader |
-undefined. |
-
-## 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>,
-)
-
-
-
-
-chainId |
-string. ID of chain on which this contract is uploaded. |
-
-codeHash |
-string. Code hash uniquely identifying the compiled code. |
-
-codeId |
-string. Code ID representing the identity of the contract's code on a specific chain. |
-
-uploadBy |
-undefined. address of agent that performed the upload. |
-
-uploadGas |
-undefined. address of agent that performed the upload. |
-
-uploadTx |
-string. 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,
+})
-codeData |
-Uint8Array. The compiled code. |
+log
+Console. |
-codeHash |
-string. Code hash uniquely identifying the compiled code. |
+sourceDirty
+boolean. Whether the code contains uncommitted changes. |
-codePath |
-undefined. Location of the compiled code. |
+sourceOrigin
+undefined. URL pointing to Git upstream containing the canonical source code. |
-canFetch |
+sourcePath
+string. Path to local checkout of the source code (with .git directory if sourceRef is set). |
+
+sourceRef |
+string. Pointer to the source commit. |
+
+canCompile |
|
-canFetchInfo |
+canCompileInfo
|
-canUpload |
+canFetch
|
-canUploadInfo |
+canFetchInfo
|
-## 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,
+})
-log |
-Console. |
-
-sourceDirty |
-boolean. Whether the code contains uncommitted changes. |
-
-sourceOrigin |
-undefined. URL pointing to Git upstream containing the canonical source code. |
+codeData
+Uint8Array. The compiled code. |
-sourcePath |
-string. Path to local checkout of the source code (with .git directory if sourceRef is set). |
+codeHash
+string. Code hash uniquely identifying the compiled code. |
-sourceRef |
-string. Pointer to the source commit. |
+codePath
+undefined. Location of the compiled code. |
-canCompile |
+canFetch
|
-canCompileInfo |
+canFetchInfo
|
-canFetch |
+canUpload
|
-canFetchInfo |
+canUploadInfo
|
-## 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<>,
-)
-
-
-
-
-accounts |
-Map. |
-
-alive |
-boolean. |
-
-balances |
-Map. |
-
-chainId |
-string. The chain ID that will be passed to the devnet node. |
-
-gasToken |
-NativeToken. Denomination of base gas token for this chain. |
-
-instances |
-Map. |
-
-lastCodeId |
-number. |
-
-log |
-Console. |
-
-prefix |
-string. |
-
-uploads |
-Map. |
-
-url |
-string. |
-
-## 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>,
-)
-
-
-
-
-connection |
-StubConnection. |
-
-log |
-Console. |
-
-messages |
-undefined. |
-
-## 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>,
-)
-
-
-
-
-caching |
-boolean. Whether to enable build caching.
-When set to false, this compiler will rebuild even when
-binary and checksum are both present in wasm/ directory |
-
-id |
-string. Unique identifier of this compiler implementation. |
-
-log |
-Console. |
-
-## 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<>,
+)
+
+
+
+
+accounts |
+Map. |
+
+alive |
+boolean. |
+
+balances |
+Map. |
+
+chainId |
+string. The chain ID that will be passed to the devnet node. |
+
+gasToken |
+NativeToken. Denomination of base gas token for this chain. |
+
+instances |
+Map. |
+
+lastCodeId |
+number. |
+
+log |
+Console. |
+
+prefix |
+string. |
+
+uploads |
+Map. |
+
+url |
+string. |
+
+## 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>,
+)
+
+
+
+
+connection |
+StubConnection. |
+
+log |
+Console. |
+
+messages |
+undefined. |
+
+## 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>,
+)
+
+
+
+
+caching |
+boolean. Whether to enable build caching.
+When set to false, this compiler will rebuild even when
+binary and checksum are both present in wasm/ directory |
+
+id |
+string. Unique identifier of this compiler implementation. |
+
+log |
+Console. |
+
+## 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,
)
amount |
-string. |
-
-token |
-FungibleToken. |
-
-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()
-address |
-string. |
-
-codeHash |
-string. |
-
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,
-)
-
-
-
-
-amount |
-undefined. |
-
-gas |
-string. |
-
-## 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()
+
+
+
+
+## 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,
+)
+address |
+string. |
+
+codeHash |
+string. |
+
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,
)
-a |
-undefined. |
+amount
+string. |
-b |
-undefined. |
+token
+FungibleToken. |
-reverse |
+asNativeBalance
+ |
+
+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,
+)
-
+## 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: | ,
+)
+
+
+
+a |
+undefined. |
+
+b |
+undefined. |
+
+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()
+
+
+
+
+block |
+Block. |
+
+data |
+unknown. |
+
+gasLimit |
+undefined. |
+
+gasUsed |
+undefined. |
+
+hash |
+string. |
+
+status |
+undefined. |
+
+type |
+unknown. |
+
# 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()
-
-
-
-
-block |
-Block. |
-
-data |
-unknown. |
-
-gasLimit |
-undefined. |
-
-gasUsed |
-undefined. |
-
-hash |
-string. |
-
-status |
-undefined. |
-
-type |
-unknown. |
diff --git a/toolbox b/toolbox
index b79b653241..46f2535f28 160000
--- a/toolbox
+++ b/toolbox
@@ -1 +1 @@
-Subproject commit b79b65324159ab1fef2cf496458e35688bc37116
+Subproject commit 46f2535f28a18fc6ddfd563ddf4b61880e598c90