Certainly! Below is a detailed description for Slack explaining the problem you’re facing with sending a text message using the provided code, along with the code reference.
Issue with Sending Text Message using sendMintNft Function
Hey
I am encountering an issue with sending a text message using the sendMintNft
function in our smart contract. The function is intended to mint an NFT and send it along with some additional data. However, I am facing difficulties getting the text message to send correctly.
Function Code:
async sendMintNft(provider: ContractProvider, via: Sender,
opts: {
value: bigint;
queryId: number;
amount: bigint; // to send with nft
itemIndex: number;
itemOwnerAddress: Address;
itemContent: Cell;
}
) {
const nftMessage = beginCell();
nftMessage.storeAddress(opts.itemOwnerAddress)
nftMessage.storeRef(opts.itemContent)
await provider.internal(via, {
value: opts.value,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell()
.storeUint(0x05138d91,32) // operation
.storeUint(opts.queryId,64)
.storeUint(opts.itemIndex,64)
.storeCoins(opts.amount)
.storeRef(nftMessage) // body
.endCell()
})
}
Description:
-
Parameters:
provider
: The contract provider instance.via
: The sender instance.opts
: An object containing various options like value, queryId, amount, itemIndex, itemOwnerAddress, and itemContent.
-
Process:
- The function begins by creating a cell to store the NFT message.
- The
itemOwnerAddress
anditemContent
are stored in this cell. - It then sends an internal message to the contract using the provider, including the value, send mode, and the body of the message.
-
Issues Faced:
- When trying to send a text message, the
itemContent
(which should include the text) does not seem to be processed or sent correctly.
- When trying to send a text message, the
Request for Assistance:
- I need help understanding why the text message is not being sent as expected.
Thank you!
Feel free to adjust the description based on any additional specifics or context you might want to include.
I attempted to use the sendMintNft function to mint an NFT and send a text message along with it. My goal was to include the text message within the itemContent parameter, which is stored as a cell reference in the NFT message.