Skip to content

Commit

Permalink
Merge pull request #428 from DestinyWei/main
Browse files Browse the repository at this point in the history
docs: add `transfer` function
  • Loading branch information
reveloper committed Nov 22, 2023
2 parents b76fc18 + a167828 commit 53707a4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions docs/develop/dapps/tutorials/collection-minting.md
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,36 @@ msgBody.storeBit(0); // no forward_payload
return msgBody.endCell();
```

And create a transfer function to transfer the NFT.

```ts
static async transfer(
wallet: OpenedWallet,
nftAddress: Address,
newOwner: Address
): Promise<number> {
const seqno = await wallet.contract.getSeqno();

await wallet.contract.sendTransfer({
seqno,
secretKey: wallet.keyPair.secretKey,
messages: [
internal({
value: "0.05",
to: nftAddress,
body: this.createTransferBody({
newOwner,
responseTo: wallet.contract.address,
forwardAmount: toNano("0.02"),
}),
}),
],
sendMode: SendMode.IGNORE_ERRORS + SendMode.PAY_GAS_SEPARATELY,
});
return seqno;
}
```

Nice, now we can we are already very close to the end. Back to the `app.ts` and let's get address of our nft, that we want to put on sale:
```ts
const nftToSaleAddress = await NftItem.getAddressByIndex(collection.address, 0);
Expand Down

0 comments on commit 53707a4

Please sign in to comment.