From 25b03a09950a21624c7483de0ed096c661120e33 Mon Sep 17 00:00:00 2001 From: Maksandre Date: Wed, 24 Jul 2024 19:00:24 +0400 Subject: [PATCH] add sponsoring docs --- docs/.vuepress/configs/sidebar.ts | 1 + docs/build/sdk/v2/sponsoring.md | 48 +++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 docs/build/sdk/v2/sponsoring.md diff --git a/docs/.vuepress/configs/sidebar.ts b/docs/.vuepress/configs/sidebar.ts index 73ab853..f28cc67 100644 --- a/docs/.vuepress/configs/sidebar.ts +++ b/docs/.vuepress/configs/sidebar.ts @@ -83,6 +83,7 @@ export const sidebar: Record = { '/build/sdk/v2/balances.md', '/build/sdk/v2/collections.md', '/build/sdk/v2/tokens.md', + '/build/sdk/v2/sponsoring.md', ] }, { diff --git a/docs/build/sdk/v2/sponsoring.md b/docs/build/sdk/v2/sponsoring.md new file mode 100644 index 0000000..59f2b6a --- /dev/null +++ b/docs/build/sdk/v2/sponsoring.md @@ -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`. + \ No newline at end of file