You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then the handler of this action gets access to the receiver already parsed and the validation happens behind the scenes. A handler could look like this:
#[collection]pubmod my_actions {usesuper::*;pubfnsend_donation(ctx:Context<SendDonationAction>) -> Result<Transaction>{let account_pubkey = &ctx.payload.account;// payload.account should be parsed toolet receiver_pubkey = &ctx.params.receiver;// receiver is already a pubkey// ...}}
Note that the account and receiver come from the HTTP request as strings. Look into extractors with custom types.
The text was updated successfully, but these errors were encountered:
Using the type Pubkey in the query and params attributes from a derive Action should be validated and parsed before reaching the context.
Assuming there's a case like this:
Then the handler of this action gets access to the receiver already parsed and the validation happens behind the scenes. A handler could look like this:
Note that the account and receiver come from the HTTP request as strings. Look into extractors with custom types.
The text was updated successfully, but these errors were encountered: