Methods
# static new(seq_id) → {TransactionBuilder}
Create a new transaction builder.
Parameters:
Name | Type | Description |
---|---|---|
seq_id |
BigInt | Unique sequence ID to prevent replay attacks. |
# add_basic_issue_asset(key_pair, code, seq_num, amount, conf_amount, zei_params) → {TransactionBuilder}
Wraps around TransactionBuilder to add an asset issuance to a transaction builder instance.
Use this function for simple one-shot issuances.
Parameters:
Name | Type | Description |
---|---|---|
key_pair |
XfrKeyPair | Issuer XfrKeyPair. and types of traced assets. |
code |
string | base64 string representing the token code of the asset to be issued. |
seq_num |
BigInt | Issuance sequence number. Every subsequent issuance of a given asset type must have a higher sequence number than before. |
amount |
BigInt | Amount to be issued. |
conf_amount |
boolean |
|
zei_params |
PublicParams | Public parameters necessary to generate asset records. |
# add_operation_air_assign(key_pair, user_public_key, issuer_public_key, commitment, pok-) → {TransactionBuilder}
Adds an operation to the transaction builder that appends a credential commitment to the address identity registry.
Parameters:
Name | Type | Description |
---|---|---|
key_pair |
XfrKeyPair | Ledger key that is tied to the credential. |
user_public_key |
CredUserPublicKey | Public key of the credential user. |
issuer_public_key |
CredIssuerPublicKey | Public key of the credential issuer. |
commitment |
CredentialCommitment | Credential commitment to add to the address identity registry. |
pok- |
CredPoK | Proof that the credential commitment is valid. |
- See:
-
- wasm_credential_commit for information about how to generate a credential commitment.
# add_operation_create_asset(key_pair, memo, token_code, asset_rules) → {TransactionBuilder}
Wraps around TransactionBuilder to add an asset definition operation to a transaction builder instance.
Parameters:
Name | Type | Description |
---|---|---|
key_pair |
XfrKeyPair | Issuer XfrKeyPair. |
memo |
string | Text field for asset definition. |
token_code |
string | Optional Base64 string representing the token code of the asset to be issued. If empty, a token code will be chosen at random. |
asset_rules |
AssetRules | Asset rules object specifying which simple policies apply to the asset. |
Example
Error handling
try {
await wasm.add_operation_create_asset(wasm.new_keypair(), "test_memo", wasm.random_asset_type(), wasm.AssetRules.default());
} catch (err) {
console.log(err)
}
# add_operation_kv_update_no_hash(auth_key_pair, key, seq_num) → {TransactionBuilder}
Adds an operation to the transaction builder that removes a hash from ledger's custom data store.
Parameters:
Name | Type | Description |
---|---|---|
auth_key_pair |
XfrKeyPair | Key pair that is authorized to delete the hash at the provided key. |
key |
Key | The key of the custom data store whose value will be cleared if the transaction validates. |
seq_num |
BigInt | Nonce to prevent replays. |
# add_operation_kv_update_with_hash(auth_key_pair, key, hash, seq_num) → {TransactionBuilder}
Adds an operation to the transaction builder that adds a hash to the ledger's custom data store.
Parameters:
Name | Type | Description |
---|---|---|
auth_key_pair |
XfrKeyPair | Key pair that is authorized to add the hash at the provided key. |
key |
Key | The key of the custom data store the value will be added to if the transaction validates. |
hash |
KVHash | The hash to add to the custom data store. |
seq_num |
BigInt | Nonce to prevent replays. |
# add_operation_update_memo(auth_key_pair, code, new_memo) → {TransactionBuilder}
Adds an operation to the transaction builder that adds a hash to the ledger's custom data store.
Parameters:
Name | Type | Description |
---|---|---|
auth_key_pair |
XfrKeyPair | Asset creator key pair. |
code |
String | base64 string representing token code of the asset whose memo will be updated. transaction validates. |
new_memo |
String | The new asset memo. |
- See:
-
- AssetRules.set_updatable for more information about how to define an updatable asset.
# add_transfer_operation(op) → {TransactionBuilder}
Adds a serialized transfer asset operation to a transaction builder instance.
Parameters:
Name | Type | Description |
---|---|---|
op |
string | a JSON-serialized transfer operation. |
- See:
-
- module:Findora-Wasm~TransferOperationBuilder for details on constructing a transfer operation.
Will throw an error if op
fails to deserialize.
# get_owner_memo(idx) → {OwnerMemo|undefined}
Fetches an owner memo from a transaction
Parameters:
Name | Type | Description |
---|---|---|
idx |
number | Owner memo to fetch. Owner memos are added to the transaction builder sequentially. |
# get_owner_record(idx) → {ClientAssetRecord}
Fetches a client record from a transaction.
Parameters:
Name | Type | Description |
---|---|---|
idx |
number | Record to fetch. Records are added to the transaction builder sequentially. |