0xa1::message_ticket
MessageTicket
source_id
destination_chain
destination_address
payload
version
new
destroy
use 0x1::ascii;
MessageTicket
This hot potato object is created to capture all the information about a remote contract call. In can then be submitted to the gateway to send the Message. It is advised that modules return this Message ticket to be submitted by the frontend, so that when the gateway package is upgraded, the app doesn’t need to upgrade as well, ensuring forward compatibility. The version is captured to ensure that future packages can restrict which messages they can send, and to ensure that no future messages are sent from earlier versions.
struct MessageTicket
source_id: address
destination_chain: ascii::String
destination_address: ascii::String
payload: vector<u8>
version: u64
source_id
public fun source_id(self: &message_ticket::MessageTicket): address
public fun source_id(self: &MessageTicket): address {
self.source_id
}
destination_chain
public fun destination_chain(self: &message_ticket::MessageTicket): ascii::String
public fun destination_chain(self: &MessageTicket): String {
self.destination_chain
}
destination_address
public fun destination_address(self: &message_ticket::MessageTicket): ascii::String
public fun destination_address(self: &MessageTicket): String {
self.destination_address
}
payload
public fun payload(self: &message_ticket::MessageTicket): vector<u8>
public fun payload(self: &MessageTicket): vector<u8> {
self.payload
}
version
public fun version(self: &message_ticket::MessageTicket): u64
public fun version(self: &MessageTicket): u64 {
self.version
}
new
public(friend) fun new(source_id: address, destination_chain: ascii::String, destination_address: ascii::String, payload: vector<u8>, version: u64): message_ticket::MessageTicket
public(package) fun new(
source_id: address,
destination_chain: String,
destination_address: String,
payload: vector<u8>,
version: u64,
): MessageTicket {
MessageTicket {
source_id,
destination_chain,
destination_address,
payload,
version,
}
}
destroy
public(friend) fun destroy(self: message_ticket::MessageTicket): (address, ascii::String, ascii::String, vector<u8>, u64)
public(package) fun destroy(
self: MessageTicket,
): (address, String, String, vector<u8>, u64) {
let MessageTicket {
source_id,
destination_chain,
destination_address,
payload,
version,
} = self;
(source_id, destination_chain, destination_address, payload, version)
}