Execution
Execution
Executing messages in an ADO is a fairly simple process. We expose a new struct called ExecuteContext
which has your regular dependencies, info and environment alongside a new AMPPkt
struct (amp_ctx
) that includes info about the current AMP packet if the message was received via the AMPReceive
message type.
An AMP Packet includes some useful information such as the origin
field which includes the original sender of the packet. If you are using this for authorisation purposes please verify that the sender is someone you can trust.
In order to expose this data we must first call the method for handling AMPReceive
messages and provide it your standard execution handler like so:
Here we provide our handle_execute
method to the execute_amp_receive
method so that the handler can verify and create the ExecuteContext
object appropriately before passing it to the handler.
As a catchall we provide the .execute(ctx, msg)
call to handle any Andromeda specific messages. If you are looking to use another execute message handler such as cw721-base check out our CW721 contract here.
Last updated