-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Collection sponsoring | ||
|
||
In Unique Network, transactions can be sponsored, allowing for a gasless experience where the sponsor covers the transaction fees. This enables seamless and cost-free transfers of NFTs and the execution of smart contracts, even for accounts without native tokens. | ||
|
||
[[toc]] | ||
|
||
|
||
## Prerequisite | ||
|
||
Follow the [Getting started guide](./quick-start.md) to install required libraries, receive test network OPL tokens, and initialize SDK. | ||
|
||
At this point, you need to know how to manage collections. Learn how to do this in the [Working with collections](./collections.md) guide. | ||
|
||
You also need to know how to [mint and transfer NFTs](./tokens.md). | ||
|
||
## Setting collection sponsoring | ||
|
||
The process consists of two steps: | ||
|
||
1. Set collection sponsor – only the collection owner or admin can do | ||
2. Confirm sponsorship. The sponsor should confirm willingness to sponsor collection | ||
|
||
```ts:no-line-numbers | ||
// At this point we assume you already have a minted collection and NFT | ||
const collectionId = ... | ||
const tokenId = ... | ||
await sdk.collection.setSponsor({collectionId, sponsor: account.address}) | ||
await sdk.collection.confirmSponsorship({collectionId}); | ||
``` | ||
|
||
At this point, every action with tokens of this collection, such as transfer or minting, will be sponsored by `account`. | ||
<!-- | ||
TODO | ||
Let's check that an account without native tokens can perform NFT transfer. | ||
```ts:no-line-numbers | ||
// generate a new account without OPL | ||
const emptyAccount = Sr25519Account.fromUri(Sr25519Account.generateMnemonic()); | ||
// mint new token to `emptyAccount` | ||
const {result} = await sdk.token.mintNFTs({collectionId, tokens: [ | ||
{owner: account.address} | ||
]}); | ||
``` --> |