MultiAgentRawTransaction - OpenDive/AptosKit GitHub Wiki
MultiAgentRawTransaction
Aptos Blockchain Multi-Agent Raw Transaction
public struct MultiAgentRawTransaction
Properties
rawTransaction
The raw transaction itself
public var rawTransaction: RawTransaction
secondarySigners
The other parties involved
public var secondarySigners: [AccountAddress]
Methods
inner()
Returns the Multi-Agent's raw transaction
public func inner() -> RawTransaction
Returns
A RawTransaction object
prehash()
Compute the SHA3-256 hash of a string representation of a transaction with data.
public func prehash() throws -> Data
This function computes the SHA3-256 hash of the string "APTOS::RawTransactionWithData", which serves as a prefix to the transaction data, and returns the result.
Throws
An AptosError object indicating that the conversion from string to Data object has failed.
Returns
A Data object containing the SHA3-256 hash of the string "APTOS::RawTransactionWithData".
keyed()
Serialize and hash a multi-agent raw transaction for signing.
public func keyed() throws -> Data
This function serializes the multi-agent raw transaction using a Serializer instance, computes the SHA3-256 hash of the serialized transaction concatenated with a prehash, and returns the result.
Throws
An error of type AptosError indicating that the serialization or prehash computation has failed.
Returns
A Data object containing the SHA3-256 hash of the serialized transaction concatenated with a prehash.
sign(_:)
Sign the multi-agent raw transaction using the provided private key.
public func sign(_ key: PrivateKey) throws -> Signature
This function signs the multi-agent raw transaction using the provided private key and returns the resulting signature.
Parameters
- key: A PrivateKey object to be used for signing the multi-agent raw transaction.
- Returns: A Signature object containing the signature of the multi-agent raw transaction.
- Throws: An error of type Ed25519Error indicating that the signing operation has failed.
verify(_:_:)
Verify the signature of the multi-agent raw transaction using the provided public key.
public func verify(_ key: PublicKey, _ signature: Signature) throws -> Bool
This function verifies the signature of the multi-agent raw transaction using the provided public key and returns a Boolean value indicating whether the signature is valid or not.
Parameters
- key: A PublicKey object to be used for verifying the signature of the multi-agent raw transaction.
- signature: A Signature object containing the signature to be verified.
- Returns: A Boolean value indicating whether the signature is valid or not.
- Throws: An error of type Ed25519Error indicating that the verification operation has failed.