Transaction class
Transaction represents a unitary transaction in the Archethic network.
Constructors
-
Transaction({String? address, Balance? balance, int? chainLength, List<
CrossValidationStamp> ? crossValidationStamps, Data? data, List<TransactionInput> ? inputs, String? originSignature, String? previousPublicKey, String? previousSignature, required String? type, ValidationStamp? validationStamp, int? version = cVersion}) -
Transaction.fromJson(Map<
String, dynamic> json) -
factory
Properties
- address ↔ String?
-
- Address: hash of the new generated public key for the given transaction
getter/setter pair - balance ↔ Balance?
-
- Balance represents a ledger balance
getter/setter pair - chainLength ↔ int?
-
- Length of the chain
getter/setter pair -
crossValidationStamps
↔ List<
CrossValidationStamp> ? -
- Cross validation stamps: endorsements of the validation stamp from the coordinator
getter/setter pair - data ↔ Data?
-
- Data: transaction data zone (identity, keychain, smart contract, etc.)
getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
-
inputs
↔ List<
TransactionInput> ? -
- TransactionInput represents the inputs from the transaction
getter/setter pair - originSignature ↔ String?
-
- Origin signature: signature from the device which originated the transaction (used in the Proof of work)
getter/setter pair - previousPublicKey ↔ String?
-
- Previous public key: previous generated public key matching the previous signature
getter/setter pair - previousSignature ↔ String?
-
- Previous signature: signature from the previous public key
getter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type ↔ String?
-
- Type: transaction type
getter/setter pair - validationStamp ↔ ValidationStamp?
-
- ValidationStamp: coordinator work result
getter/setter pair - version ↔ int?
-
- Version: version of the transaction (used for backward compatiblity)
getter/setter pair
Methods
-
addOwnership(
dynamic secret, List< AuthorizedKey> authorizedKeys) → Transaction - Add an ownership with a secret and its authorized public keys @param {String | Uint8List} secret Secret encrypted (hexadecimal or binary buffer) @param {List
-
addRecipient(
dynamic to) → Transaction - Add recipient to the transaction @param {String | Uint8List} to Recipient address (hexadecimal or binary buffer)
-
addTokenTransfer(
dynamic to, int amount, dynamic tokenAddress, {int tokenId = 0}) → Transaction - Add a token transfer to the transaction @param {String | Uint8List} to Address of the recipient (hexadecimal or binary buffer) @param {int} amount Amount of token to transfer @param {String | Uint8List} tokenAddress Address of token to spend (hexadecimal or binary buffer) @param {int} tokenId ID of the token to use (default to 0)
-
addUCOTransfer(
dynamic to, int amount) → Transaction - Add a UCO transfer to the transaction @param {String | Uint8List} to Address of the recipient (hexadecimal or binary buffer) @param {int} amount Amount of UCO to transfer
-
build(
String seed, int index, {String? curve = 'ed25519', String? hashAlgo = 'sha256'}) → Transaction - Generate the transaction address, keys and signatures @param {String} seed Transaction chain seed (hexadecimal or binary buffer) @param {int} index Number of transaction on the chain @param {String} curve Elliptic curve to use for the key generation @param {String} hashAlgo Hash algorithm to use for the address generation
-
convertToJSON(
) → String - Convert the transaction in JSON
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
originSign(
dynamic privateKey) → Transaction - Sign the transaction with an origin private key @param {String | Uint8List} originPv Origin Private Key (hexadecimal or binary buffer)
-
originSignaturePayload(
) → Uint8List -
previousSignaturePayload(
) → Uint8List - Generate the payload for the previous signature by encoding address, type and data
-
setAddress(
dynamic addr) → Transaction - Set the transaction builder with address (required for originSign) @param {String | Uint8List} to Address (hexadecimal | Uint8List)
-
setCode(
String code) → Transaction - Add smart contract code to the transaction @param {String} code Smart contract code
-
setContent(
dynamic content) → Transaction - Add a content to the transaction @param {String | Uint8List} content Hosted content
-
setPreviousSignatureAndPreviousPublicKey(
dynamic prevSign, dynamic prevPubKey) → Transaction - Set the transaction builder with Previous Publickey and Previous Signature @param {String | Uint8List} to Previous Signature (hexadecimal) @param {String | Uint8List} to Previous PublicKey (hexadecimal)
-
toJson(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- kTransactionBalanceQueryAllFields → const String
- kTransactionInputQueryAllFields → const String
- kTransactionQueryAllFields → const String