Transaction class

Transaction represents a unitary transaction in the Archethic network.

Annotations
  • @freezed

Constructors

Transaction({@AddressJsonConverter() Address? address, Balance? balance, int? chainLength, @Default([]) List<CrossValidationStamp> crossValidationStamps, Data? data, @Default([]) List<TransactionInput> inputs, String? originSignature, @AddressJsonConverter() Address? previousAddress, String? previousPublicKey, String? previousSignature, String? type, ValidationStamp? validationStamp, @Default(cVersion) int version})
const
factory
Transaction.fromJson(Map<String, dynamic> json)
factory
Transaction.fromNodeRPC(Map<String, dynamic> json)
factory

Properties

address Address?
hash of the new generated public key for the given transaction
no setterinherited
balance Balance?
Balance represents a ledger balance
no setterinherited
chainLength int?
Length of the chain
no setterinherited
copyWith → $TransactionCopyWith<Transaction>
Create a copy of Transaction with the given fields replaced by the non-null parameter values.
no setterinherited
crossValidationStamps List<CrossValidationStamp>
Cross validation stamps: endorsements of the validation stamp from the coordinator
no setterinherited
data Data?
Transaction data zone (identity, keychain, smart contract, etc.)
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
inputs List<TransactionInput>
Represents the inputs from the transaction
no setterinherited
originSignature String?
Signature from the device which originated the transaction (used in the Proof of work)
no setterinherited
previousAddress Address?
Previous address
no setterinherited
previousPublicKey String?
Previous generated public key matching the previous signature
no setterinherited
previousSignature String?
Signature from the previous public key
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
type String?
Transaction type
no setterinherited
validationStamp ValidationStamp?
Coordinator work result
no setterinherited
version int
Version of the transaction (used for backward compatiblity)
no setterinherited

Methods

addOwnership(String secret, List<AuthorizedKey> authorizedKeys) Transaction
Add an ownership with a secret and its authorized public keys
addRecipient(String to, {String? action, List<Object>? args}) Transaction
Add recipient to the transaction (with a named action)
addTokenTransfer(String to, int amount, String tokenAddress, {int tokenId = 0}) Transaction
Add a token transfer to the transaction
addUCOTransfer(String to, int amount) Transaction
Add a UCO transfer to the transaction
build(String seed, int index, {String? curve = 'ed25519', String? hashAlgo = 'sha256', bool isSeedHexa = true}) → ({KeyPair keyPair, Transaction transaction})
Generate the transaction address, keys and signatures
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
originSign(String privateKey) Transaction
Sign the transaction with an origin private key
originSignaturePayload() Uint8List
previousSignaturePayload() Uint8List
Generate the payload for the previous signature by encoding address, type and data
setAddress(Address address) Transaction
Set the transaction builder with address (required for originSign)
setCode(String code) Transaction
Add smart contract code to the transaction
setContent(String content) Transaction
Add a content to the transaction
setOriginSignature(String originSignature) Transaction
Set the the transaction with an origin private key
setPreviousSignatureAndPreviousPublicKey(String prevSign, String prevPubKey) Transaction
Set the transaction builder with Previous Publickey and Previous Signature
toJson() Map<String, dynamic>
Serializes this Transaction to a JSON map.
inherited
toNodeRPC() String
Convert the transaction in JSON
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

initData() Data