AuditTrailClient
@iota/audit-trails API documentation
Class: AuditTrailClient
Signing audit-trail client.
Remarks
Wraps an AuditTrailClientReadOnly together with a transaction signer so that typed write transactions can be built. The actual transaction submission and execution remain the responsibility of the caller.
Methods
chainId()
chainId():
string
Returns the chain ID of the network this client is connected to.
Returns
string
Hex-encoded chain identifier.
create()
staticcreate(client,signer):Promise<AuditTrailClient>
Creates a signing client from an existing read-only client and signer.
Parameters
client
Read-only client whose network and package configuration will be reused.
signer
TransactionSigner
Signer that will sign transactions built by this client.
Returns
Promise<AuditTrailClient>
A signing audit-trail client bound to client's network and the given signer.
Throws
When the signer cannot be queried for its public key or address.
createFromIotaClient()
staticcreateFromIotaClient(iota_client,signer,package_id?):Promise<AuditTrailClient>
Creates a signing client directly from an IOTA client and signer.
Parameters
iota_client
IotaClient
signer
TransactionSigner
Signer that will sign transactions built by this client.
package_id?
string | null
Returns
Promise<AuditTrailClient>
A signing audit-trail client bound to the resolved or supplied package IDs.
Remarks
Pass packageId when connecting to a custom deployment that is not known to the package
registry; otherwise package IDs are resolved from the connected network.
Throws
When package resolution fails or the supplied packageId is malformed.
createFromIotaClientWithPackageOverrides()
staticcreateFromIotaClientWithPackageOverrides(iota_client,signer,package_overrides?):Promise<AuditTrailClient>
Creates a signing client directly from an IOTA client, signer, and full package overrides.
Parameters
iota_client
IotaClient
signer
TransactionSigner
Signer that will sign transactions built by this client.
package_overrides?
PackageOverrides | null
Returns
Promise<AuditTrailClient>
A signing audit-trail client bound to the resolved or supplied package IDs.
Throws
When package resolution fails or the supplied overrides are malformed.
createTrail()
createTrail():
AuditTrailBuilder
Creates a builder for a new audit trail.
Returns
A pre-configured AuditTrailBuilder.
Remarks
The builder is pre-populated with the signer address as the initial admin, so the trail's initial-admin capability lands in the signer's wallet on execution. Override with AuditTrailBuilder.withAdmin when a different recipient is needed.
iotaClient()
iotaClient():
IotaClient
Returns the underlying IOTA client used to talk to the network.
Returns
IotaClient
The IOTA client carried by the wrapped read-only client.
network()
network():
string
Returns the human-readable name of the network this client is connected to.
Returns
string
Network name (e.g. "mainnet", "testnet", "localnet").
packageHistory()
packageHistory():
string[]
Returns the resolved audit-trail package upgrade history.
Returns
string[]
Stringified object IDs of every published version, most recent first.
packageId()
packageId():
string
Returns the audit-trail package ID currently in use.
Returns
string
Stringified object ID of the resolved audit-trail package.
readOnly()
readOnly():
AuditTrailClientReadOnly
Returns the read-only view of this client.
Returns
A AuditTrailClientReadOnly sharing this client's network configuration.
Remarks
Useful when passing the client into code that only needs read capabilities.
senderAddress()
senderAddress():
string
Returns the address that signs transactions built by this client.
Returns
string
Stringified IOTA address of the signer.
senderPublicKey()
senderPublicKey():
PublicKey
Returns the public key of the address that signs transactions built by this client.
Returns
PublicKey
Public key bound to the signer.
Throws
When the signer's public key cannot be converted to the expected representation.
signer()
signer():
TransactionSigner
Returns the signer attached to this client.
Returns
TransactionSigner
A clone of the configured transaction signer.
tfComponentsPackageId()
tfComponentsPackageId():
string
Returns the tf_components package ID currently in use.
Returns
string
Stringified object ID of the resolved tf_components package.
trail()
trail(
trail_id):AuditTrailHandle
Returns a trail-scoped handle for the given trail object ID.
Parameters
trail_id
string
Returns
A signing AuditTrailHandle bound to trailId.
Remarks
Creating the handle is cheap. Network reads and transaction building happen on the returned handle and its subsystem wrappers.
Throws
When trailId is not a valid object ID.
withSigner()
withSigner(
signer):Promise<AuditTrailClient>
Returns a clone of this client whose transactions are signed by signer instead.
Parameters
signer
TransactionSigner
Replacement transaction signer.
Returns
Promise<AuditTrailClient>
A new client with the signer swapped in.
Remarks
Network and package configuration are preserved. The returned client's AuditTrailClient.senderAddress reflects the new signer.
Throws
When the replacement signer cannot be queried for its public key or address.