From 287785fbeefae85ac1d312b32aac7b6dcb9eaa23 Mon Sep 17 00:00:00 2001 From: Quentin Burg Date: Fri, 8 Dec 2023 18:06:14 +0100 Subject: [PATCH] :memo: review docs --- docs/src/library.md | 4 ++-- docs/src/tutorial.md | 26 ++++++++++++++++++++------ docs/src/welcome.md | 2 +- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/docs/src/library.md b/docs/src/library.md index db87843..075488d 100644 --- a/docs/src/library.md +++ b/docs/src/library.md @@ -43,8 +43,8 @@ This class has two methods: - `generatePermit` creates a permit from a transfer operation. It returns an object containing: ```ts { - bytes: string, // les bytes contenant le permis - transfer_hash: string, // le hash de l'operation de transfet + bytes: string, // the bytes containing the permit + transfer_hash: string, // the hash of the transfer operation } ``` diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index 87e8b69..27bdd66 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -4,22 +4,29 @@ To understand the potential and how to use the Gas Station, let's walk through t ## Template -The first step is to retrieve the code template located [here](https://github.com/marigold-dev/gas-station-lib). +The first step is to retrieve the code template located [here](https://github.com/marigold-dev/gas-station-nft-example-template). Once retrieved, you can run the following commands: -``` +```bash npm install npm run check ``` + +ℹī¸ Note: If `npm run check` returns some errors, it's ok. It's just to initialize some Svelte tools. + + To test that everything works well, you can use: -``` +```bash npm run dev ``` The files of interest are located in `src/lib`. You will find Svelte components and a `tezos.ts` file that contains utility functions such as wallet connection, etc. +We will writing some pieces of code in `src/lib/MintingComponent.svelte` and `src/lib/StakingComponent.svelte`. +Let's go ! đŸ’Ē + ## Minting -We'll start with minting an NFT by a user. The contract we'll use is available at this address on Ghostnet: `KT199yuNkHQKpy331A6fvWJtQ1uan9uya2jx`. +We'll start with minting an NFT by a user. The contract we'll use is available at this address on Ghostnet: [`KT199yuNkHQKpy331A6fvWJtQ1uan9uya2jx`](https://ghostnet.tzkt.io/KT199yuNkHQKpy331A6fvWJtQ1uan9uya2jx/operations). The goal here is for the user to initiate the mint action and retrieve their NFT without having to pay gas fees. For this, we will use the TypeScript SDK, and you can find more information [here](./library.md). First, we'll setup the GasStation SDK as follows: @@ -93,7 +100,7 @@ const permitData = await permitContract.generatePermit({ }); ``` Some explanations: -- The variable `PUBLIC_STAKING_CONTRACT` contains the address of the staking contract (available at this address `KT1MLMXwFEMcfByGbGcQ9ow3nsrQCkLbcRAu` on Ghostnet). +- The variable `PUBLIC_STAKING_CONTRACT` contains the address of the staking contract (available at this address [`KT1MLMXwFEMcfByGbGcQ9ow3nsrQCkLbcRAu`](https://ghostnet.tzkt.io/KT1MLMXwFEMcfByGbGcQ9ow3nsrQCkLbcRAu/operations) on Ghostnet). - The `token_id` corresponds to the ID of the token you want to stake. `permitData` then contains the hash of the permit `bytes` and the hash of transfer operation `transfer_hash`: @@ -161,4 +168,11 @@ const response = await gasStationApi.postOperations(userAddress, Here, we use `postOperations` to submit a batch of operations. This batch contains the operation to register the permit and the staking operation. When calling the staking contract's `stake` entrypoint, the permit will be revealed and consumed. -Similar to the minting operation, the Gas Station will respond in a few tens of seconds. \ No newline at end of file +Similar to the minting operation, the Gas Station will respond in a few tens of seconds. + +## Conclusion + +We have some pieces of code allowing a user without any XTZ to mint an NFT and stake it on the contract. This is possible thanks to the Gas Station, which relays the transaction by paying the fees. + + +Feel free to send us your feedback and comments on this tutorial. 😃 \ No newline at end of file diff --git a/docs/src/welcome.md b/docs/src/welcome.md index 10afc0e..e211035 100644 --- a/docs/src/welcome.md +++ b/docs/src/welcome.md @@ -6,5 +6,5 @@ The Gas Station is a tool designed for developers aiming to provide sponsored tr The Gas Station would typically be used by video game developers seeking to subsidize activities for users without any tez in their wallets. It does not require these users to do any transaction or reveal their account, as the Gas Station account independently processes those transactions. However, it's important to note that this workflow may necessitate the use of specific smart contract patterns, such as permit (TZIP 17). -Currently, the API URL for Ghostnet is: https://ghostnet.gas-station-api.marigold.dev. The Gas Station is not yet available on the Mainnet. +Currently, the API URL for Ghostnet is: [https://ghostnet.gas-station-api.marigold.dev](https://ghostnet.gas-station-api.marigold.dev). The Gas Station is not yet available on the Mainnet.