-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implement callbacks #13
Conversation
/// You must verify this message was called by an approved ICS721 contract, either by code_id or address. | ||
#[cw_serde] | ||
pub struct Ics721ReceiveMsg { | ||
pub original_packet: NonFungibleTokenPacketData, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just name it packet
or nft_data
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to keep the original here, to make it obvious that this is the original packet that was sent, and not anything else.
packages/ics721/src/types.rs
Outdated
/// Being called on receiving the NFT after transfer was completed. (destination side) | ||
/// `on_recieve` hook | ||
/// Note - Failing this message will fail the transfer. | ||
ReceiveNftIcs721(Ics721ReceiveMsg), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would rename this to Ics721ReceiveNft.
Would also rename:
Ics721Callback -> Ics721CallbackNft
Ics721ReceiveMsg -> Ics721ReceiveNftMsg
Ics721CallbackMsg -> Ics721CallbackNftMsg
Would make naming more consistent.
Out of consistenty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What you think about this:
pub enum ReceiverExecuteMsg {
Ics721ReceiveCallback(Ics721ReceiveCallbackMsg),
Ics721AckCallback(Ics721AckCallbackMsg),
}
I want to make it clear we have 2 type of callbacks (hooks).
- Receive callback: is being called on the target (receiver) chain, after NFT was transferred successfully.
- Ack callback: is being called on the source (sender) chain after transfer, letting the contract know of the status of the transfer (succeed or failed).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
LGTM. Only minor renaming suggestions - for better understanding. |
…props are optional
… additional custom data
…data CollectionData with minimal props, name and symbol, all others are optional.
#10