From d6610d2bb6e931568ff976086b5662aa472dae63 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Wed, 10 Apr 2024 16:09:26 +0700 Subject: [PATCH 01/18] docs: base init for Gas Tank API Documentation --- components/gas-tank/AutLogin.jsx | 11 ++ gas-tank/gas-tank-api.md | 280 ++++++++++++++++++++++++++++++- 2 files changed, 289 insertions(+), 2 deletions(-) create mode 100644 components/gas-tank/AutLogin.jsx diff --git a/components/gas-tank/AutLogin.jsx b/components/gas-tank/AutLogin.jsx new file mode 100644 index 000000000..56c357bd2 --- /dev/null +++ b/components/gas-tank/AutLogin.jsx @@ -0,0 +1,11 @@ +import React, { useEffect, useState } from "react"; + +const AutLogin = () => { + const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; + + useEffect(() => {}, []); + + return <>; +}; + +export default AutLogin; diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index 5464b97f8..dfa230aaf 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -1,3 +1,279 @@ -# Gas Tank API +# Gas Tank API Documentation -Coming soon... +The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. + +The base URL for all Gas Tank API is: https://gas-tank.xdefiservices.com + +Below are the available services provided by the Gas Tank API. To use the Gas Tank API, you need to have Authorization Token. + +## Authentication + +### Multiple Address Login + +This endpoint facilitates the generation of JWT tokens for multiple wallet addresses in a single request. The request payload should consist of an array of objects, each containing an address and its corresponding signature. Upon successful validation of the signatures, the server will generate JWT tokens for the provided addresses. + +::: code-group + +```javascript [Login] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +
+ +### Refresh JWT Token + +Clients can use this endpoint to obtain a new JWT token without re-authenticating, providing a refresh token. + +::: code-group + +```javascript [Resfresh Token] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +
+ +## Chains + +### Get all Tokens + +::: code-group + +```javascript [Get All Tokens] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +
+ +### Get chains Operational status + +::: code-group + +```javascript [Get Chains Status] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get information about the Gas Tank Balances + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +## Balance & Transactions + +### Get all balance entries for user + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get balances by address + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get balances by JWT + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Increase balance + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Withdraw balance + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Internal transfer + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Consume balance + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get a quote for consuming balance + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get user balance queue update + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get balance queue update by ID + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get pending transactions by address + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Get fee for a given amount + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +## Actions messages + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Construct Deposit Message + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Construct Withdraw Message + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Construct Internal Transfer Message + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Construct Consume Message + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +## Other services + +### Get information about the Gas Tank + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + +### Check the health status of the application + +::: code-group + +```javascript [] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +``` + +::: + + From 905a0e58e7ed2b04327e054e6da73401d52b45f9 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Wed, 10 Apr 2024 18:41:19 +0700 Subject: [PATCH 02/18] base: add code sample for some feature --- gas-tank/gas-tank-api.md | 46 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index dfa230aaf..17dbd548a 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -16,6 +16,28 @@ This endpoint facilitates the generation of JWT tokens for multiple wallet addre ```javascript [Login] const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; + +await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: [ + { + address: address1, // Address of the user // [!code highlight] + signature: signature1, // Signature // [!code highlight] + }, + { + address: address2, // [!code highlight] + signature: signature2, // [!code highlight] + }, + ... + ], +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) ``` ::: @@ -30,6 +52,20 @@ Clients can use this endpoint to obtain a new JWT token without re-authenticatin ```javascript [Resfresh Token] const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; + +await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: { + refresh: refreshToken, // Refresh token // [!code highlight] + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) ``` ::: @@ -44,12 +80,18 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ```javascript [Get All Tokens] const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; + +await fetch(`${GAS_TANK_ENDPOINT}/chains/tokens`, { + method: "GET", +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) ``` ::: -
- ### Get chains Operational status ::: code-group From 9736c638e0af072312a6fb8bb06c46b64dbb467a Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Wed, 10 Apr 2024 18:42:58 +0700 Subject: [PATCH 03/18] chore: update api endpoint --- gas-tank/gas-tank-api.md | 50 ++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index 17dbd548a..875b7f6df 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -2,7 +2,7 @@ The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. -The base URL for all Gas Tank API is: https://gas-tank.xdefiservices.com +The base URL for all Gas Tank API is: https://gas-tank.xdefi.services Below are the available services provided by the Gas Tank API. To use the Gas Tank API, you need to have Authorization Token. @@ -15,7 +15,7 @@ This endpoint facilitates the generation of JWT tokens for multiple wallet addre ::: code-group ```javascript [Login] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { method: "POST", @@ -51,7 +51,7 @@ Clients can use this endpoint to obtain a new JWT token without re-authenticatin ::: code-group ```javascript [Resfresh Token] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { method: "POST", @@ -79,7 +79,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { ::: code-group ```javascript [Get All Tokens] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; await fetch(`${GAS_TANK_ENDPOINT}/chains/tokens`, { method: "GET", @@ -97,7 +97,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/chains/tokens`, { ::: code-group ```javascript [Get Chains Status] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -107,7 +107,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -119,7 +119,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -129,7 +129,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -139,7 +139,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -149,7 +149,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -159,7 +159,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -169,7 +169,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -179,7 +179,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -189,7 +189,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -199,7 +199,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -209,7 +209,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -219,7 +219,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -229,7 +229,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -239,7 +239,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -249,7 +249,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -259,7 +259,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -269,7 +269,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -279,7 +279,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -291,7 +291,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: @@ -301,7 +301,7 @@ const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; ::: code-group ```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; ``` ::: From deacc12ed93e09d2038f52a071dc3a4a3368aaa8 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Thu, 11 Apr 2024 14:10:05 +0700 Subject: [PATCH 04/18] docs: update content for Gas Tank API Documentation --- .vitepress/config.ts | 24 +- components/gas-tank/AutLogin.jsx | 11 - gas-tank/authentication-services.md | 111 ++++++ gas-tank/balance-services.md | 509 ++++++++++++++++++++++++++++ gas-tank/chains-services.md | 169 +++++++++ gas-tank/gas-tank-api.md | 324 +----------------- gas-tank/other-services.md | 110 ++++++ 7 files changed, 934 insertions(+), 324 deletions(-) delete mode 100644 components/gas-tank/AutLogin.jsx create mode 100644 gas-tank/authentication-services.md create mode 100644 gas-tank/balance-services.md create mode 100644 gas-tank/chains-services.md create mode 100644 gas-tank/other-services.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index ba77dae9e..072ed2a7d 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -754,7 +754,29 @@ function sidebarHome() { { text: "โ›ฝ Gas Tank API", link: "/gas-tank/gas-tank-api", - items: [], + collapsed: true, + items: [ + { + text: "๐Ÿ”น Introduction", + link: "/gas-tank/gas-tank-api", + }, + { + text: "๐Ÿ”น Authentication services", + link: "/gas-tank/gas-tank-api#authentication", + }, + { + text: "๐Ÿ”น Chains services", + link: "/gas-tank/gas-tank-api#chains", + }, + { + text: "๐Ÿ”น Balance & Transactions", + link: "/gas-tank/gas-tank-api#balance-transactions", + }, + { + text: "๐Ÿ”น Other services", + link: "/gas-tank/gas-tank-api#other-services", + }, + ], }, { text: "๐Ÿ› ๏ธ Partners APIs", diff --git a/components/gas-tank/AutLogin.jsx b/components/gas-tank/AutLogin.jsx deleted file mode 100644 index 56c357bd2..000000000 --- a/components/gas-tank/AutLogin.jsx +++ /dev/null @@ -1,11 +0,0 @@ -import React, { useEffect, useState } from "react"; - -const AutLogin = () => { - const GAS_TANK_ENDPOINT = "https://gas-tank.xdefiservices.com"; - - useEffect(() => {}, []); - - return <>; -}; - -export default AutLogin; diff --git a/gas-tank/authentication-services.md b/gas-tank/authentication-services.md new file mode 100644 index 000000000..d52315f9f --- /dev/null +++ b/gas-tank/authentication-services.md @@ -0,0 +1,111 @@ +## Authentication + +### Multiple Address Login + +This endpoint facilitates the generation of JWT tokens for multiple wallet addresses in a single request. The request payload should consist of an array of objects, each containing an address and its corresponding signature. Upon successful validation of the signatures, the server will generate JWT tokens for the provided addresses. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: [ + { + address: address1, // Address of the user // [!code highlight] + signature: signature1, // Signature // [!code highlight] + }, + { + address: address2, // [!code highlight] + signature: signature2, // [!code highlight] + }, + ... + ], +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) +``` + +```json [Response] +{ + "access": "jwt.access.token", + "refresh": "jwt.refresh.token" +} +``` + +::: + +You can also add new wallets to an existing JWT token. Request will be secured by JWT header. Clients need to submit an array of objects containing the address and signature for each new wallet. The server will validate the signatures and, if successful, update the existing JWT token to include the new wallets and generate new JWT. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/update`, { + method: "POST", + headers: { + "Content-Type": "application/json", + "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: [ + { + address: newAddress, // [!code highlight] + signature: newSignature, // [!code highlight] + }, + ... + ], +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) +``` + +```json [Response] +{ + "access": "jwt.access.token", + "refresh": "jwt.refresh.token" +} +``` + +::: + +### Refresh JWT Token + +Clients can use this endpoint to obtain a new JWT token without re-authenticating, providing a refresh token. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + refresh: refreshToken, // Refresh token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "access": "jwt.access.token", + "refresh": "jwt.refresh.token" +} +``` + +::: diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md new file mode 100644 index 000000000..434c4fd0b --- /dev/null +++ b/gas-tank/balance-services.md @@ -0,0 +1,509 @@ +## Balance & Transactions + +### Get all balance entries for user + +This endpoint returns a list of all balance entries per address by using JWT + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "additionalProp1": [ + { + "id": "string", + "address": "string", + "tokenAddress": "string", + "balance": 0, + "chain": "string" + } + ], + "additionalProp2": [ + { + "id": "string", + "address": "string", + "tokenAddress": "string", + "balance": 0, + "chain": "string" + } + ], + ... +} +``` + +::: + +### Get balances by address + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/${address}`, { // Address to retrieve balances // [!code highlight] + method: "GET", + headers: { + "Content-Type": "application/json" + "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) +``` + +```json [Response] +[ + { + "id": "string", + "address": "string", + "tokenAddress": "string", + "balance": 0, + "chain": "string" + }, + ... +] +``` + +::: + +### Get total balances by JWT + +This endpoint returns a list of total balances for the specified JWT. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/totals`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +[ + { + "address": "string", + "symbol": "string", + "value": "string", + "decimals": 0 + }, + ... +] +``` + +::: + +### Increase balance + +This endpoint allows users to increase their balance on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { + method: "POST", + headers: { + "Content-Type": "application/json" + "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + address: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + chain: "string", // [!code highlight] + owner: "string", // [!code highlight] + spender: "string", // [!code highlight] + value: "string", // [!code highlight] + deadline: 0, // [!code highlight] + v: 0, // [!code highlight] + r: "string", // [!code highlight] + s: "string" // [!code highlight] + }, +}) + .then((response) => { + // Balance increased successfully + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +::: + +### Withdraw balance + +This endpoint allows users to withdraw their balance from the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { + method: "POST", + headers: { + "Content-Type": "application/json" + "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + address: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + amount: "string", // [!code highlight] + chain: "string", // [!code highlight] + recipient: "string", // [!code highlight] + message: "string", // [!code highlight] + signature: "string" // [!code highlight] + }, +}) + .then((response) => { + // Balance withdrawn successfully + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +::: + +### Internal transfer + +This endpoint allows users to create an internal transfer task on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + address: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + amount: "string", // [!code highlight] + chain: "string", // [!code highlight] + recipient: "string", // [!code highlight] + message: "string", // [!code highlight] + signature: "string", // [!code highlight] + }, +}) + .then((response) => { + // Internal transfer task created successfully + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +::: + +### Consume balance + +This endpoint allows users to consume their balance on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + address: "string", // [!code highlight] + minDestinationAmount: "string", // [!code highlight] + destinationAddress: "string", // [!code highlight] + destinationChain: "string", // [!code highlight] + message: "string", // [!code highlight] + signature: "string", // [!code highlight] + }, +}) + .then((response) => { + // Balance consumed successfully + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +::: + +### Get a quote for consuming balance + +This endpoint allows users to generate a quote for consuming their balance on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + body: { + address: "string", // [!code highlight] + minDestinationAmount: "string", // [!code highlight] + destinationChain: "string", // [!code highlight] + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "expectedOutput": "string", + "fee": "string", + "spentAssets": [ + { + "tokenAddress": "string", + "amount": "string", + "chain": "string" + } + ] +} +``` + +::: + +### Get user balance queue update + +This endpoint allows users to get the balance queue update for a specific address. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/transactions`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "additionalProp1": [ + { + "id": "string", + "type": "string", + "address": "string", + "tokenAddress": "string", + "amount": "string", + "chain": "string", + "destinationChain": "string", + "destinationAddress": "string", + "permitObject": {}, + "processed": true, + "processedMetadata": {}, + "pendingTransactions": [ + { + "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "chain": "ethereum", + "transactionHash": "0x6b175474e89094c44da98b954eedeac495271d0f", + "blockNumber": 123456, + "balanceUpdateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "confirmed": false, + "createdAt": "2023-01-01T00:00:00Z", + "updatedAt": "2023-01-01T00:00:00Z" + } + ], + "createdAt": "2024-04-11T04:13:07.102Z", + "updatedAt": "2024-04-11T04:13:07.102Z" + } + ], + ... +} +``` + +::: + +### Get balance queue update by ID + +This endpoint allows users to get the balance queue update for a specific ID. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/transactions/${id}`, { + method: "GET", + headers: { + "Content-Type": "application", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "id": "string", + "type": "string", + "address": "string", + "tokenAddress": "string", + "amount": "string", + "chain": "string", + "destinationChain": "string", + "destinationAddress": "string", + "permitObject": {}, + "processed": true, + "processedMetadata": {}, + "pendingTransactions": [ + { + "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "chain": "ethereum", + "transactionHash": "0x6b175474e89094c44da98b954eedeac495271d0f", + "blockNumber": 123456, + "balanceUpdateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "confirmed": false, + "createdAt": "2023-01-01T00:00:00Z", + "updatedAt": "2023-01-01T00:00:00Z" + } + ], + "createdAt": "2024-04-11T04:17:30.107Z", + "updatedAt": "2024-04-11T04:17:30.107Z" +} +``` + +::: + +### Get pending transactions by address + +This endpoint allows users to get pending transactions for a specific address. Results returned a list of pending transactions. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch( + `${GAS_TANK_ENDPOINT}/transactions/pending/${address}`, // Address to retrieve pending transaction // [!code highlight] + { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + }, +) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +[ + { + "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "chain": "ethereum", + "transactionHash": "0x6b175474e89094c44da98b954eedeac495271d0f", + "blockNumber": 123456, + "balanceUpdateId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + "confirmed": false, + "createdAt": "2023-01-01T00:00:00Z", + "updatedAt": "2023-01-01T00:00:00Z" + }, + ... +] +``` + +::: + +### Get fee for a given amount + +This endpoint allows users to get the fee for a given amount in a specific chain. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch( + `${GAS_TANK_ENDPOINT}/fees/${chain}`, // Chain to get fee // [!code highlight] + { + method: "POST", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, + }, +) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "high": "string", + "medium": "string", + "low": "string" +} +``` + +::: diff --git a/gas-tank/chains-services.md b/gas-tank/chains-services.md new file mode 100644 index 000000000..5eaed095b --- /dev/null +++ b/gas-tank/chains-services.md @@ -0,0 +1,169 @@ +## Chains + +### Get all Tokens + +This endpoint allows users to retrieve information about all tokens available on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/chains/tokens`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "additionalProp1": { + "name": "string", + "key": "string", + "chainId": "string", + "native": { + "symbol": "string", + "decimals": 0, + "address": "string", + "actions": [ + "string" + ] + }, + "tokens": [ + { + "name": "string", + "symbol": "string", + "decimals": 0, + "address": "string", + "actions": [ + "string" + ] + } + ] + }, + "additionalProp2": { + "name": "string", + "key": "string", + "chainId": "string", + "native": { + "symbol": "string", + "decimals": 0, + "address": "string", + "actions": [ + "string" + ] + }, + "tokens": [ + { + "name": "string", + "symbol": "string", + "decimals": 0, + "address": "string", + "actions": [ + "string" + ] + } + ] + }, + ... +} +``` + +::: + +### Get dispatchers information + +This endpoint provides information about the dispatchers on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/chains/dispatchers-info`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "additionalProp1": { + "chain": "string", + "address": "string", + "balance": "string", + "status": "string", + "threshold": "string" + }, + "additionalProp2": { + "chain": "string", + "address": "string", + "balance": "string", + "status": "string", + "threshold": "string" + }, + ... +} +``` + +::: + +### Get chains Operational status + +This endpoint provides information about the status of all supported chains on the Gas Tank platform. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/chains/status`, { + method: "GET", + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] + }, +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "operational": true, + "chains": [ + { + "chain": "string", + "operational": true, + "actions": { + "increase": true, + "withdraw": true, + "consume": true + }, + "extras": { + "address": "string", + "balance": "string", + "threshold": "string", + "status": "string" + }, + "comment": "string" + }, + ... + ] +} +``` + +::: diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index 875b7f6df..cc4baa862 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -1,321 +1,21 @@ +--- +next: + text: "๐Ÿ”น Campaigns Service API" + link: "/campaigns/campaigns-service-api" +--- + # Gas Tank API Documentation -The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. +The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. Check the [Gas Tank API Swagger](https://gas-tank.xdefiservices.com/docs/) for more information. The base URL for all Gas Tank API is: https://gas-tank.xdefi.services -Below are the available services provided by the Gas Tank API. To use the Gas Tank API, you need to have Authorization Token. - -## Authentication - -### Multiple Address Login - -This endpoint facilitates the generation of JWT tokens for multiple wallet addresses in a single request. The request payload should consist of an array of objects, each containing an address and its corresponding signature. Upon successful validation of the signatures, the server will generate JWT tokens for the provided addresses. - -::: code-group - -```javascript [Login] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; - -await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: [ - { - address: address1, // Address of the user // [!code highlight] - signature: signature1, // Signature // [!code highlight] - }, - { - address: address2, // [!code highlight] - signature: signature2, // [!code highlight] - }, - ... - ], -}) - .then((response) => { - console.log(response); - // Handle & do something with the response - }) -``` - -::: - -
- -### Refresh JWT Token - -Clients can use this endpoint to obtain a new JWT token without re-authenticating, providing a refresh token. - -::: code-group - -```javascript [Resfresh Token] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; - -await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: { - refresh: refreshToken, // Refresh token // [!code highlight] - }, -}) - .then((response) => { - console.log(response); - // Handle & do something with the response - }) -``` - -::: - -
- -## Chains - -### Get all Tokens - -::: code-group - -```javascript [Get All Tokens] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; - -await fetch(`${GAS_TANK_ENDPOINT}/chains/tokens`, { - method: "GET", -}) - .then((response) => { - console.log(response); - // Handle & do something with the response - }) -``` - -::: - -### Get chains Operational status - -::: code-group - -```javascript [Get Chains Status] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get information about the Gas Tank Balances - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -## Balance & Transactions - -### Get all balance entries for user - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get balances by address - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get balances by JWT - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Increase balance - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Withdraw balance - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Internal transfer - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Consume balance - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get a quote for consuming balance - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get user balance queue update - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get balance queue update by ID - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get pending transactions by address - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Get fee for a given amount - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -## Actions messages - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Construct Deposit Message - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Construct Withdraw Message - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Construct Internal Transfer Message - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Construct Consume Message - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -## Other services - -### Get information about the Gas Tank - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` - -::: - -### Check the health status of the application - -::: code-group - -```javascript [] -const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -``` +Below are the available services provided by the Gas Tank API. You need to have a valid JWT token to access the services. You can get the JWT token by using the _[Multiple Address Login](#multiple-address-login)_ endpoint. -::: + - + diff --git a/gas-tank/other-services.md b/gas-tank/other-services.md new file mode 100644 index 000000000..cbf3de9ce --- /dev/null +++ b/gas-tank/other-services.md @@ -0,0 +1,110 @@ +## Other services + +This section provides information about the other services provided by the Gas Tank API. APIs in this section not require JWT token for authentication. + +### Get information about the Gas Tank + +This endpoint provides information about the conversion rates between different tokens and fees for deposit, withdrawal and consume actions. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/balances/info`, { + method: "GET", + headers: { + "Content-Type": "application/json", + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "conversionRates": { + "xdefi": { + "eth": 0.00003406230336183101, + "bnb": 0.00020052618581142264, + "usdc": 0.13496037812654052, + "usdt": 0.1349557894736842, + ... + }, + "eth": { + "xdefi": 29357.967644682656, + "usdt": 3763.926315789474, + ... + }, + ... // Other pairs + }, + "spenderAddresses": [ + "0x0E87C393120410d1edd00Ae5b616419795c5B57D" + ], + "fees": { + "deposit": { + "fees": { + "high": "357840000000000", + "medium": "357420000000000", + "low": "357210000000000" + } + }, + "withdraw": { + "fees": { + "high": "357840000000000", + "medium": "357420000000000", + "low": "357210000000000" + } + }, + "consume": { + "fees": { + "high": "357840000000000", + "medium": "357420000000000", + "low": "357210000000000" + } + } + } +} +``` + +::: + +### Check the health status of the application + +This endpoint provides information about the health status of the Gas Tank application. + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/healthcheck`, { + method: "GET", + headers: { + "Content-Type": "application/json", + }, +}) + .then((response) => { + console.log(response); + // Handle & do something with the response + }) + .catch((error) => { + // Catch & handle the error + }); +``` + +```json [Response] +{ + "status": "OK", + "database": "Connected", + "mnemonic": "Set", + "nats": "Connected" +} +``` + +::: From 09c7ab59d44d4fd4a5047569df76f47bf01826e5 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Thu, 11 Apr 2024 14:19:35 +0700 Subject: [PATCH 05/18] chore: update api endpoint --- gas-tank/gas-tank-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index cc4baa862..a5e1853a0 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -6,7 +6,7 @@ next: # Gas Tank API Documentation -The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. Check the [Gas Tank API Swagger](https://gas-tank.xdefiservices.com/docs/) for more information. +The Gas Tank is a versatile platform that empowers users to manage gas tank balances seamlessly across different blockchain networks. This project facilitates actions such as depositing, withdrawing, internal transferring, and consuming gas tank balances, allowing users to efficiently utilize their resources on EVM, Cosmos-like, and UTXO chains. With support for multiple blockchain environments, The Gas Tank offers users a unified solution for gas utilization across diverse networks. Check the [Gas Tank API Swagger](https://gas-tank.xdefi.services/docs/) for more information. The base URL for all Gas Tank API is: https://gas-tank.xdefi.services From dad86cea44eb7e6664557d9ff09b4379956f8b52 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Fri, 26 Apr 2024 09:11:16 +0700 Subject: [PATCH 06/18] chore: fix comment --- gas-tank/balance-services.md | 6 ++++++ gas-tank/other-services.md | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 434c4fd0b..04a114fd7 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -121,6 +121,8 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/totals`, { This endpoint allows users to increase their balance on the Gas Tank platform. +To increase the balance, you need to sign the message with the private key of the address you want to increase the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner. + ::: code-group ```javascript [Request] @@ -159,6 +161,8 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { This endpoint allows users to withdraw their balance from the Gas Tank platform. +To withdraw the balance, you need to sign the message with the private key of the address you want to withdraw the balance from. The `signature` field is the signature of the message signed by the address owner. + ::: code-group ```javascript [Request] @@ -229,6 +233,8 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { This endpoint allows users to consume their balance on the Gas Tank platform. +To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner. + ::: code-group ```javascript [Request] diff --git a/gas-tank/other-services.md b/gas-tank/other-services.md index cbf3de9ce..327fd0078 100644 --- a/gas-tank/other-services.md +++ b/gas-tank/other-services.md @@ -74,9 +74,9 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/info`, { ::: -### Check the health status of the application +### Check the status of the application -This endpoint provides information about the health status of the Gas Tank application. +This endpoint provides information about the status of the Gas Tank application and its dependencies. ::: code-group From b18f65e19c4eaa2a6b456b248600dd9f5a7fd901 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Mon, 6 May 2024 10:15:39 +0700 Subject: [PATCH 07/18] docs: update for comment --- gas-tank/balance-services.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 04a114fd7..49a69a23e 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -123,10 +123,19 @@ This endpoint allows users to increase their balance on the Gas Tank platform. To increase the balance, you need to sign the message with the private key of the address you want to increase the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner. +You can sign a string of data using [ethers.js](https://docs.ethers.org/v5), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and increase the balance. + ::: code-group ```javascript [Request] +import { ethers } from "ethers"; + const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const message = "0x1234"; // Message to sign // [!code highlight] +const privateKey = "0x1234"; // Private key of the address // [!code highlight] +const wallet = new ethers.Wallet(privateKey); +const signature = await wallet.signMessage(message); +const { v, r, s } = ethers.utils.splitSignature(signature); await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { method: "POST", @@ -163,10 +172,18 @@ This endpoint allows users to withdraw their balance from the Gas Tank platform. To withdraw the balance, you need to sign the message with the private key of the address you want to withdraw the balance from. The `signature` field is the signature of the message signed by the address owner. +Same as the [Increase balance](#increase-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and withdraw the balance. + ::: code-group ```javascript [Request] +import { ethers } from "ethers"; + const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const message = "0x1234"; // Message to sign // [!code highlight] +const privateKey = "0x1234"; // Private key of the address // [!code highlight] +const wallet = new ethers.Wallet(privateKey); +const signature = await wallet.signMessage(message); await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { method: "POST", @@ -235,10 +252,18 @@ This endpoint allows users to consume their balance on the Gas Tank platform. To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner. +Same as the [Increase balance](#increase-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. + ::: code-group ```javascript [Request] +import { ethers } from "ethers"; + const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const message = "0x1234"; // Message to sign // [!code highlight] +const privateKey = "0x1234"; // Private key of the address // [!code highlight] +const wallet = new ethers.Wallet(privateKey); +const signature = await wallet.signMessage(message); await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { method: "POST", From 2f03c3a6697081d3b5b0de876c1e862c9c41d345 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Tue, 7 May 2024 11:25:10 +0700 Subject: [PATCH 08/18] base: fix comment --- gas-tank/authentication-services.md | 13 ++++++++ gas-tank/balance-services.md | 52 ++++++++++++++++++----------- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/gas-tank/authentication-services.md b/gas-tank/authentication-services.md index d52315f9f..b0cee4dce 100644 --- a/gas-tank/authentication-services.md +++ b/gas-tank/authentication-services.md @@ -4,11 +4,24 @@ This endpoint facilitates the generation of JWT tokens for multiple wallet addresses in a single request. The request payload should consist of an array of objects, each containing an address and its corresponding signature. Upon successful validation of the signatures, the server will generate JWT tokens for the provided addresses. +To get signatures, you can use `personal_sign` method from web3.js or ethers.js. Below is an example of how to get a signature using web3.js: + ::: code-group ```javascript [Request] +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const address1 = "0x1234567890123456789012345678901234567890"; +const message1 = "Sign this message to authenticate your address with Gas Tank"; + +const signature1 = await web3.eth.personal.sign(message1, address1); + +const address2 = "0x0987654321098765432109876543210987654321"; +const message2 = "Sign this message to authenticate your address with Gas Tank"; + +const signature2 = await web3.eth.personal.sign(message2, address2); + await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { method: "POST", headers: { diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 49a69a23e..d0d238d03 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -117,13 +117,13 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/totals`, { ::: -### Increase balance +### Deposit balance -This endpoint allows users to increase their balance on the Gas Tank platform. +This endpoint allows users to deposit balance to the Gas Tank platform. -To increase the balance, you need to sign the message with the private key of the address you want to increase the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner. +To deposit the balance, you need to sign the message with the private key of the address you want to deposit the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner. -You can sign a string of data using [ethers.js](https://docs.ethers.org/v5), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and increase the balance. +You can sign a string of data using [ethers.js](https://docs.ethers.org/v5), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and deposit the balance. ::: code-group @@ -157,7 +157,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { }, }) .then((response) => { - // Balance increased successfully + // Balance deposit successfully }) .catch((error) => { // Catch & handle the error @@ -172,15 +172,17 @@ This endpoint allows users to withdraw their balance from the Gas Tank platform. To withdraw the balance, you need to sign the message with the private key of the address you want to withdraw the balance from. The `signature` field is the signature of the message signed by the address owner. -Same as the [Increase balance](#increase-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and withdraw the balance. +Same as the [Deposit balance](#deposit-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and withdraw the balance. ::: code-group ```javascript [Request] import { ethers } from "ethers"; +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const message = "0x1234"; // Message to sign // [!code highlight] +const address = "0x1234567890123456789012345678901234567890"; // Address to withdraw balance // [!code highlight] +const message = web3.utils.sha3("Withdraw balance from Gas Tank"); // Message to sign // [!code highlight] const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); @@ -192,13 +194,13 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: { - address: "string", // [!code highlight] + address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] amount: "string", // [!code highlight] chain: "string", // [!code highlight] recipient: "string", // [!code highlight] - message: "string", // [!code highlight] - signature: "string" // [!code highlight] + message: message, // [!code highlight] + signature: signature // [!code highlight] }, }) .then((response) => { @@ -218,7 +220,15 @@ This endpoint allows users to create an internal transfer task on the Gas Tank p ::: code-group ```javascript [Request] +import { ethers } from "ethers"; + +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const address = "0x1234567890123456789012345678901234567890"; // Address to transfer balance // [!code +const message = web3.utils.sha3("Transfer balance from Gas Tank"); // Message to sign // [!code highlight] +const privateKey = "0x1234"; // Private key of the address // [!code highlight] +const wallet = new ethers.Wallet(privateKey); +const signature = await wallet.signMessage(message); await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { method: "POST", @@ -227,13 +237,13 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: { - address: "string", // [!code highlight] + address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] amount: "string", // [!code highlight] chain: "string", // [!code highlight] recipient: "string", // [!code highlight] - message: "string", // [!code highlight] - signature: "string", // [!code highlight] + message: message, // [!code highlight] + signature: signature, // [!code highlight] }, }) .then((response) => { @@ -252,15 +262,17 @@ This endpoint allows users to consume their balance on the Gas Tank platform. To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner. -Same as the [Increase balance](#increase-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. +Same as the [Deposit balance](#deposit-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. ::: code-group ```javascript [Request] import { ethers } from "ethers"; +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const message = "0x1234"; // Message to sign // [!code highlight] +const address = "0x1234567890123456789012345678901234567890"; // Address to consume balance // [!code highlight] +const message = web3.utils.sha3("Consume balance from Gas Tank"); // Message to sign // [!code highlight] const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); @@ -272,12 +284,12 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: { - address: "string", // [!code highlight] + address: address, // [!code highlight] minDestinationAmount: "string", // [!code highlight] destinationAddress: "string", // [!code highlight] destinationChain: "string", // [!code highlight] - message: "string", // [!code highlight] - signature: "string", // [!code highlight] + message: message, // [!code highlight] + signature: signature, // [!code highlight] }, }) .then((response) => { @@ -338,7 +350,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { ### Get user balance queue update -This endpoint allows users to get the balance queue update for a specific address. +This endpoint allows users to get the balance queue update for any job ongoing (e.g., deposit, withdrawal, transfer, consume). ::: code-group @@ -400,7 +412,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/transactions`, { ### Get balance queue update by ID -This endpoint allows users to get the balance queue update for a specific ID. +This endpoint allows users to get the balance queue update for a specific ID (e.g., deposit, withdrawal, transfer, consume). ::: code-group From ab7a1642ef2e8c75f780c799bd6aab5d14dbd734 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Tue, 7 May 2024 13:46:47 +0700 Subject: [PATCH 09/18] base: update --- gas-tank/balance-services.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index d0d238d03..ca65dc31c 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -130,8 +130,10 @@ You can sign a string of data using [ethers.js](https://docs.ethers.org/v5), bel ```javascript [Request] import { ethers } from "ethers"; +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const message = "0x1234"; // Message to sign // [!code highlight] +const address = "0x1234567890123456789012345678901234567890"; // Address to deposit balance // [!code +const message = web3.utils.sha3("Deposit balance to Gas Tank"); // Message to sign // [!code highlight] const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); From 0bf6a8878182e6c35503580fca677b32df1bfa1a Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Tue, 7 May 2024 13:48:18 +0700 Subject: [PATCH 10/18] base: update --- gas-tank/balance-services.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index ca65dc31c..80e7a9d31 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -146,16 +146,16 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: { - address: "string", // [!code highlight] + address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] chain: "string", // [!code highlight] owner: "string", // [!code highlight] spender: "string", // [!code highlight] value: "string", // [!code highlight] deadline: 0, // [!code highlight] - v: 0, // [!code highlight] - r: "string", // [!code highlight] - s: "string" // [!code highlight] + v: v, // [!code highlight] + r: r, // [!code highlight] + s: s // [!code highlight] }, }) .then((response) => { From 663e7c64747fef8e865069151f47de70f7296986 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Tue, 7 May 2024 14:29:02 +0700 Subject: [PATCH 11/18] chore: update --- gas-tank/balance-services.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 80e7a9d31..f609ee85f 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -132,7 +132,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const address = "0x1234567890123456789012345678901234567890"; // Address to deposit balance // [!code +const address = "0x1234567890123456789012345678901234567890"; // Address to deposit balance // [!code highlight] const message = web3.utils.sha3("Deposit balance to Gas Tank"); // Message to sign // [!code highlight] const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); @@ -226,7 +226,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const address = "0x1234567890123456789012345678901234567890"; // Address to transfer balance // [!code +const address = "0x1234567890123456789012345678901234567890"; // Address to transfer balance // [!code highlight] const message = web3.utils.sha3("Transfer balance from Gas Tank"); // Message to sign // [!code highlight] const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); From be0b435341d5133f01644bdcf73cb2209962fbc3 Mon Sep 17 00:00:00 2001 From: dp <25910069+davidp94@users.noreply.github.com> Date: Fri, 24 May 2024 09:15:34 +0300 Subject: [PATCH 12/18] chore: small updates --- .vitepress/config.ts | 6 +++--- gas-tank/authentication-services.md | 33 ++++++++++++++++++----------- gas-tank/balance-services.md | 2 +- gas-tank/chains-services.md | 2 +- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 072ed2a7d..119f96535 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -761,15 +761,15 @@ function sidebarHome() { link: "/gas-tank/gas-tank-api", }, { - text: "๐Ÿ”น Authentication services", + text: "๐Ÿ”น Authentication", link: "/gas-tank/gas-tank-api#authentication", }, { - text: "๐Ÿ”น Chains services", + text: "๐Ÿ”น Chains / Tokens / Status", link: "/gas-tank/gas-tank-api#chains", }, { - text: "๐Ÿ”น Balance & Transactions", + text: "๐Ÿ”น Balances & Gas top-up: Deposit, Withdraw, Send Gas", link: "/gas-tank/gas-tank-api#balance-transactions", }, { diff --git a/gas-tank/authentication-services.md b/gas-tank/authentication-services.md index b0cee4dce..8b5a65f52 100644 --- a/gas-tank/authentication-services.md +++ b/gas-tank/authentication-services.md @@ -1,6 +1,6 @@ ## Authentication -### Multiple Address Login +### Multiple Addresses Login This endpoint facilitates the generation of JWT tokens for multiple wallet addresses in a single request. The request payload should consist of an array of objects, each containing an address and its corresponding signature. Upon successful validation of the signatures, the server will generate JWT tokens for the provided addresses. @@ -13,21 +13,30 @@ const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; const address1 = "0x1234567890123456789012345678901234567890"; -const message1 = "Sign this message to authenticate your address with Gas Tank"; +const address2 = "0x0987654321098765432109876543210987654321"; + +const messageToSign = await ( + await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/message`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify([address1, address2]), + }) +).json(); -const signature1 = await web3.eth.personal.sign(message1, address1); +const message = messageToSign.message; -const address2 = "0x0987654321098765432109876543210987654321"; -const message2 = "Sign this message to authenticate your address with Gas Tank"; -const signature2 = await web3.eth.personal.sign(message2, address2); +const signature1 = await web3.eth.personal.sign(message, address1); +const signature2 = await web3.eth.personal.sign(message, address2); await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { method: "POST", headers: { "Content-Type": "application/json", }, - body: [ + body: JSON.stringify([ { address: address1, // Address of the user // [!code highlight] signature: signature1, // Signature // [!code highlight] @@ -37,7 +46,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/login`, { signature: signature2, // [!code highlight] }, ... - ], + ]), }) .then((response) => { console.log(response); @@ -67,13 +76,13 @@ await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/update`, { "Content-Type": "application/json", "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: [ + body: JSON.stringify([ { address: newAddress, // [!code highlight] signature: newSignature, // [!code highlight] }, ... - ], + ]), }) .then((response) => { console.log(response); @@ -105,9 +114,9 @@ await fetch(`${GAS_TANK_ENDPOINT}/v2/auth/refresh`, { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ refresh: refreshToken, // Refresh token // [!code highlight] - }, + }), }).then((response) => { console.log(response); // Handle & do something with the response diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index f609ee85f..eb4e8f64e 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -82,7 +82,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/${address}`, { // Address to retrieve ::: -### Get total balances by JWT +### Get total balances using JWT This endpoint returns a list of total balances for the specified JWT. diff --git a/gas-tank/chains-services.md b/gas-tank/chains-services.md index 5eaed095b..34df83920 100644 --- a/gas-tank/chains-services.md +++ b/gas-tank/chains-services.md @@ -1,4 +1,4 @@ -## Chains +## Chains / Status ### Get all Tokens From 59dc7ff450d32632bae811a74fbf6c2140d82b38 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Fri, 24 May 2024 15:59:33 +0700 Subject: [PATCH 13/18] chore: small update for body request --- gas-tank/balance-services.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index eb4e8f64e..c590dfa8c 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -145,7 +145,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { "Content-Type": "application/json" "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] chain: "string", // [!code highlight] @@ -156,7 +156,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { v: v, // [!code highlight] r: r, // [!code highlight] s: s // [!code highlight] - }, + }), }) .then((response) => { // Balance deposit successfully @@ -195,7 +195,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { "Content-Type": "application/json" "Authorization": `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] amount: "string", // [!code highlight] @@ -203,7 +203,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { recipient: "string", // [!code highlight] message: message, // [!code highlight] signature: signature // [!code highlight] - }, + }), }) .then((response) => { // Balance withdrawn successfully @@ -238,7 +238,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ address: address, // [!code highlight] tokenAddress: "string", // [!code highlight] amount: "string", // [!code highlight] @@ -246,7 +246,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { recipient: "string", // [!code highlight] message: message, // [!code highlight] signature: signature, // [!code highlight] - }, + }), }) .then((response) => { // Internal transfer task created successfully @@ -285,14 +285,14 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ address: address, // [!code highlight] minDestinationAmount: "string", // [!code highlight] destinationAddress: "string", // [!code highlight] destinationChain: "string", // [!code highlight] message: message, // [!code highlight] signature: signature, // [!code highlight] - }, + }), }) .then((response) => { // Balance consumed successfully @@ -319,11 +319,11 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, - body: { + body: JSON.stringify({ address: "string", // [!code highlight] minDestinationAmount: "string", // [!code highlight] destinationChain: "string", // [!code highlight] - }, + }), }) .then((response) => { console.log(response); From 61aaef6c5aa2ae24341157a20d8b1d18360a870a Mon Sep 17 00:00:00 2001 From: dp <25910069+davidp94@users.noreply.github.com> Date: Fri, 24 May 2024 12:13:38 +0300 Subject: [PATCH 14/18] chore: update title --- gas-tank/balance-services.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index c590dfa8c..1fcb9b07c 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -1,4 +1,4 @@ -## Balance & Transactions +## Balance & Transactions - Deposit, Withdraw, Send Gas ### Get all balance entries for user From ea64767b8d85b8965d572281d0c2b9e0ed2d5573 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Fri, 24 May 2024 18:06:49 +0700 Subject: [PATCH 15/18] base: add Message Gastank docs --- .vitepress/config.ts | 8 +- gas-tank/balance-services.md | 16 ++-- gas-tank/chains-services.md | 2 +- gas-tank/gas-tank-api.md | 2 + gas-tank/messages-service.md | 142 +++++++++++++++++++++++++++++++++++ 5 files changed, 159 insertions(+), 11 deletions(-) create mode 100644 gas-tank/messages-service.md diff --git a/.vitepress/config.ts b/.vitepress/config.ts index 119f96535..47da7d8c1 100644 --- a/.vitepress/config.ts +++ b/.vitepress/config.ts @@ -764,13 +764,17 @@ function sidebarHome() { text: "๐Ÿ”น Authentication", link: "/gas-tank/gas-tank-api#authentication", }, + { + text: "๐Ÿ”น Messages", + link: "/gas-tank/gas-tank-api#messages", + }, { text: "๐Ÿ”น Chains / Tokens / Status", - link: "/gas-tank/gas-tank-api#chains", + link: "/gas-tank/gas-tank-api#chains-token-status", }, { text: "๐Ÿ”น Balances & Gas top-up: Deposit, Withdraw, Send Gas", - link: "/gas-tank/gas-tank-api#balance-transactions", + link: "/gas-tank/gas-tank-api#balance-transactions-deposit-withdraw-send-gas", }, { text: "๐Ÿ”น Other services", diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 1fcb9b07c..3838958d2 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -121,7 +121,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/totals`, { This endpoint allows users to deposit balance to the Gas Tank platform. -To deposit the balance, you need to sign the message with the private key of the address you want to deposit the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner. +To deposit the balance, you need to sign the message with the private key of the address you want to deposit the balance for. `v`, `r`, `s` are the signature fields of the message signed by the address owner and `message` is generated in [Construct Deposit Message](#construct-deposit-message). You can sign a string of data using [ethers.js](https://docs.ethers.org/v5), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and deposit the balance. @@ -133,7 +133,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; const address = "0x1234567890123456789012345678901234567890"; // Address to deposit balance // [!code highlight] -const message = web3.utils.sha3("Deposit balance to Gas Tank"); // Message to sign // [!code highlight] +const message = message; // Message is generated in Construct Deposit Message const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); @@ -172,7 +172,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { This endpoint allows users to withdraw their balance from the Gas Tank platform. -To withdraw the balance, you need to sign the message with the private key of the address you want to withdraw the balance from. The `signature` field is the signature of the message signed by the address owner. +To withdraw the balance, you need to sign the message with the private key of the address you want to withdraw the balance from. The `signature` field is the signature of the message signed by the address owner and `message` is generated in [Aonstruct Withdraw Message](#construct-withdraw-message). Same as the [Deposit balance](#deposit-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and withdraw the balance. @@ -184,7 +184,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; const address = "0x1234567890123456789012345678901234567890"; // Address to withdraw balance // [!code highlight] -const message = web3.utils.sha3("Withdraw balance from Gas Tank"); // Message to sign // [!code highlight] +const message = message; // Message is generated in Construct Withdraw Message const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); @@ -217,7 +217,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { ### Internal transfer -This endpoint allows users to create an internal transfer task on the Gas Tank platform. +This endpoint allows users to create an internal transfer task on the Gas Tank platform. The internal transfer task is used to transfer balance from one address to another address on the Gas Tank platform. The `signature` field is the signature of the message signed by the address owner and `message` is generated in [Construct Internal Transfer Message](#construct-internal-transfer-message). ::: code-group @@ -227,7 +227,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; const address = "0x1234567890123456789012345678901234567890"; // Address to transfer balance // [!code highlight] -const message = web3.utils.sha3("Transfer balance from Gas Tank"); // Message to sign // [!code highlight] +const message = message; // Message is generated in Construct Internal Transfer Message const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); @@ -262,7 +262,7 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { This endpoint allows users to consume their balance on the Gas Tank platform. -To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner. +To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner and `message` is generated in [Construct Consume Message](#construct-consume-message). Same as the [Deposit balance](#deposit-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. @@ -274,7 +274,7 @@ import { ethers } from "ethers"; const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; const address = "0x1234567890123456789012345678901234567890"; // Address to consume balance // [!code highlight] -const message = web3.utils.sha3("Consume balance from Gas Tank"); // Message to sign // [!code highlight] +const message = message; // Message is generated in Construct Consume Message const privateKey = "0x1234"; // Private key of the address // [!code highlight] const wallet = new ethers.Wallet(privateKey); const signature = await wallet.signMessage(message); diff --git a/gas-tank/chains-services.md b/gas-tank/chains-services.md index 34df83920..c993f2e1f 100644 --- a/gas-tank/chains-services.md +++ b/gas-tank/chains-services.md @@ -1,4 +1,4 @@ -## Chains / Status +## Chains / Token / Status ### Get all Tokens diff --git a/gas-tank/gas-tank-api.md b/gas-tank/gas-tank-api.md index a5e1853a0..65ac786c3 100644 --- a/gas-tank/gas-tank-api.md +++ b/gas-tank/gas-tank-api.md @@ -14,6 +14,8 @@ Below are the available services provided by the Gas Tank API. You need to have + + diff --git a/gas-tank/messages-service.md b/gas-tank/messages-service.md new file mode 100644 index 000000000..15bc211f1 --- /dev/null +++ b/gas-tank/messages-service.md @@ -0,0 +1,142 @@ +## Messages + +### Construct Deposit Message + +This endpoint will generate `messages` parameter for [Deposit balances](#deposit-balance). + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/msg/increase`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + owner: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + amount: "string", // [!code highlight] + chain: "string", // [!code highlight] + }), +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "type": "string", + "message": "string" +} +``` + +::: + +### Construct Withdraw Message + +This endpoint will generate `messages` parameter for [Withdraw balances](#withdraw-balance). + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/msg/withdraw`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + address: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + amount: "string", // [!code highlight] + chain: "string", // [!code highlight] + recipient: "string", // [!code highlight] + }), +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "type": "string", + "message": "string" +} +``` + +::: + +### Construct Internal Transfer Message + +This endpoint will generate `messages` parameter for [Internal Transfer balances](#internal-transfer). + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/msg/internal-transfer`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + address: "string", // [!code highlight] + tokenAddress: "string", // [!code highlight] + amount: "string", // [!code highlight] + chain: "string", // [!code highlight] + recipient: "string", // [!code highlight] + }), +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "type": "string", + "message": "string" +} +``` + +::: + +### Construct Consume Message + +This endpoint will generate `messages` parameter for [Consume balances](#consume-balance). + +::: code-group + +```javascript [Request] +const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; + +await fetch(`${GAS_TANK_ENDPOINT}/msg/consume`, { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + address: "string", // [!code highlight] + minDestinationAmount: "string", // [!code highlight] + destinationChain: "string", // [!code highlight] + }), +}).then((response) => { + console.log(response); + // Handle & do something with the response +}); +``` + +```json [Response] +{ + "type": "string", + "message": "string" +} +``` + +::: From d4b448f8737161c266e141314696a0c2cbc8b784 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Fri, 24 May 2024 18:13:37 +0700 Subject: [PATCH 16/18] chore: update --- gas-tank/balance-services.md | 79 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index 3838958d2..e7c6a5a32 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -258,96 +258,95 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { ::: -### Consume balance - -This endpoint allows users to consume their balance on the Gas Tank platform. - -To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner and `message` is generated in [Construct Consume Message](#construct-consume-message). +### Get a quote for consuming balance -Same as the [Deposit balance](#deposit-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. +This endpoint allows users to generate a quote for consuming their balance on the Gas Tank platform. ::: code-group ```javascript [Request] -import { ethers } from "ethers"; - -const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; -const address = "0x1234567890123456789012345678901234567890"; // Address to consume balance // [!code highlight] -const message = message; // Message is generated in Construct Consume Message -const privateKey = "0x1234"; // Private key of the address // [!code highlight] -const wallet = new ethers.Wallet(privateKey); -const signature = await wallet.signMessage(message); -await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { +await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: JSON.stringify({ - address: address, // [!code highlight] + address: "string", // [!code highlight] minDestinationAmount: "string", // [!code highlight] - destinationAddress: "string", // [!code highlight] destinationChain: "string", // [!code highlight] - message: message, // [!code highlight] - signature: signature, // [!code highlight] }), }) .then((response) => { - // Balance consumed successfully + console.log(response); + // Handle & do something with the response }) .catch((error) => { // Catch & handle the error }); ``` +```json [Response] +{ + "expectedOutput": "string", + "fee": "string", + "spentAssets": [ + { + "tokenAddress": "string", + "amount": "string", + "chain": "string" + } + ] +} +``` ::: -### Get a quote for consuming balance +### Consume balance -This endpoint allows users to generate a quote for consuming their balance on the Gas Tank platform. +This endpoint allows users to consume their balance on the Gas Tank platform. + +To consume the balance, you need to sign the message with the private key of the address you want to consume the balance from. The `signature` field is the signature of the message signed by the address owner and `message` is generated in [Construct Consume Message](#construct-consume-message). + +Same as the [Deposit balance](#deposit-balance)/[Withdraw balance](#withdraw-balance), you can sign a string of data using [ethers.js](https://docs.ethers.org/v5/getting-started/), below is an example of [how to sign a message using ethers.js](https://docs.ethers.org/v5/getting-started/#getting-started--signing) and consume the balance. ::: code-group ```javascript [Request] +import { ethers } from "ethers"; + +const web3 = new Web3(window.ethereum); const GAS_TANK_ENDPOINT = "https://gas-tank.xdefi.services"; +const address = "0x1234567890123456789012345678901234567890"; // Address to consume balance // [!code highlight] +const message = message; // Message is generated in Construct Consume Message +const privateKey = "0x1234"; // Private key of the address // [!code highlight] +const wallet = new ethers.Wallet(privateKey); +const signature = await wallet.signMessage(message); -await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { +await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { method: "POST", headers: { "Content-Type": "application/json", Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: JSON.stringify({ - address: "string", // [!code highlight] + address: address, // [!code highlight] minDestinationAmount: "string", // [!code highlight] + destinationAddress: "string", // [!code highlight] destinationChain: "string", // [!code highlight] + message: message, // [!code highlight] + signature: signature, // [!code highlight] }), }) .then((response) => { - console.log(response); - // Handle & do something with the response + // Balance consumed successfully }) .catch((error) => { // Catch & handle the error }); ``` -```json [Response] -{ - "expectedOutput": "string", - "fee": "string", - "spentAssets": [ - { - "tokenAddress": "string", - "amount": "string", - "chain": "string" - } - ] -} -``` - ::: ### Get user balance queue update From 425d3f06fb943d8d364de7d5e4ad9cc4495ff75f Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Mon, 27 May 2024 13:49:17 +0700 Subject: [PATCH 17/18] chore: fix comment --- gas-tank/balance-services.md | 40 ++++++++++++++++++------------------ gas-tank/messages-service.md | 34 +++++++++++++++--------------- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/gas-tank/balance-services.md b/gas-tank/balance-services.md index e7c6a5a32..a4c424326 100644 --- a/gas-tank/balance-services.md +++ b/gas-tank/balance-services.md @@ -147,12 +147,12 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/increase`, { }, body: JSON.stringify({ address: address, // [!code highlight] - tokenAddress: "string", // [!code highlight] - chain: "string", // [!code highlight] - owner: "string", // [!code highlight] - spender: "string", // [!code highlight] - value: "string", // [!code highlight] - deadline: 0, // [!code highlight] + tokenAddress: "string", // Token contract address for deposit // [!code highlight] + chain: "string", // The blockchain network [!code highlight] + owner: "string", // The owner's address (can match the 'address' field) [!code highlight] + spender: "string", // Gas Tank's internal address [!code highlight] + value: "string", // Amount of deposited token [!code highlight] + deadline: 0, // Date for checking the validity of the signature [!code highlight] v: v, // [!code highlight] r: r, // [!code highlight] s: s // [!code highlight] @@ -197,10 +197,10 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/withdraw`, { }, body: JSON.stringify({ address: address, // [!code highlight] - tokenAddress: "string", // [!code highlight] - amount: "string", // [!code highlight] - chain: "string", // [!code highlight] - recipient: "string", // [!code highlight] + tokenAddress: "string", // Token contract address for withdraw [!code highlight] + amount: "string", // Amount of withdraw token [!code highlight] + chain: "string", // The blockchain network [!code highlight] + recipient: "string", // The recipient's wallet address [!code highlight] message: message, // [!code highlight] signature: signature // [!code highlight] }), @@ -240,10 +240,10 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/transfer`, { }, body: JSON.stringify({ address: address, // [!code highlight] - tokenAddress: "string", // [!code highlight] - amount: "string", // [!code highlight] - chain: "string", // [!code highlight] - recipient: "string", // [!code highlight] + tokenAddress: "string", // Token contract address for transfer [!code highlight] + amount: "string", // Amount of transfer [!code highlight] + chain: "string", // The blockchain network [!code highlight] + recipient: "string", // The recipient's wallet address [!code highlight] message: message, // [!code highlight] signature: signature, // [!code highlight] }), @@ -274,9 +274,9 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume/quote`, { Authorization: `Bearer ${jwtToken}`, // JWT token // [!code highlight] }, body: JSON.stringify({ - address: "string", // [!code highlight] - minDestinationAmount: "string", // [!code highlight] - destinationChain: "string", // [!code highlight] + address: "string", // Your wallet address // [!code highlight] + minDestinationAmount: "string", // Minimum amount of the token to consume // [!code highlight] + destinationChain: "string", // The blockchain network // [!code highlight] }), }) .then((response) => { @@ -332,9 +332,9 @@ await fetch(`${GAS_TANK_ENDPOINT}/balances/consume`, { }, body: JSON.stringify({ address: address, // [!code highlight] - minDestinationAmount: "string", // [!code highlight] - destinationAddress: "string", // [!code highlight] - destinationChain: "string", // [!code highlight] + minDestinationAmount: "string", // Minimum amount of the token to consume // [!code highlight] + destinationAddress: "string", // The recipient's wallet address // [!code highlight] + destinationChain: "string", // The blockchain network // [!code highlight] message: message, // [!code highlight] signature: signature, // [!code highlight] }), diff --git a/gas-tank/messages-service.md b/gas-tank/messages-service.md index 15bc211f1..a1bd5806f 100644 --- a/gas-tank/messages-service.md +++ b/gas-tank/messages-service.md @@ -15,10 +15,10 @@ await fetch(`${GAS_TANK_ENDPOINT}/msg/increase`, { "Content-Type": "application/json", }, body: JSON.stringify({ - owner: "string", // [!code highlight] - tokenAddress: "string", // [!code highlight] - amount: "string", // [!code highlight] - chain: "string", // [!code highlight] + owner: "0xOwnerWalletAddress", // The wallet address of the owner // [!code highlight] + tokenAddress: "0xTokenContractAddress", // The contract address of the token // [!code highlight] + amount: "1", // Amount of the token to deposit // [!code highlight] + chain: "ethereum", // The blockchain network, e.g., 'ethereum' // [!code highlight] }), }).then((response) => { console.log(response); @@ -50,11 +50,11 @@ await fetch(`${GAS_TANK_ENDPOINT}/msg/withdraw`, { "Content-Type": "application/json", }, body: JSON.stringify({ - address: "string", // [!code highlight] - tokenAddress: "string", // [!code highlight] - amount: "string", // [!code highlight] - chain: "string", // [!code highlight] - recipient: "string", // [!code highlight] + address: "0xYourWalletAddress", // Your wallet address // [!code highlight] + tokenAddress: "0xTokenContractAddress", // The contract address of the token // [!code highlight] + amount: "1", // Amount of the token to withdraw // [!code highlight] + chain: "ethereum", // The blockchain network, e.g., 'ethereum' // [!code highlight] + recipient: "0xRecipientWalletAddress", // The recipient's wallet address // [!code highlight] }), }).then((response) => { console.log(response); @@ -86,11 +86,11 @@ await fetch(`${GAS_TANK_ENDPOINT}/msg/internal-transfer`, { "Content-Type": "application/json", }, body: JSON.stringify({ - address: "string", // [!code highlight] - tokenAddress: "string", // [!code highlight] - amount: "string", // [!code highlight] - chain: "string", // [!code highlight] - recipient: "string", // [!code highlight] + address: "0xYourWalletAddress", // Your wallet address // [!code highlight] + tokenAddress: "0xTokenContractAddress", // The contract address of the token // [!code highlight] + amount: "1", // Amount of the token to transfer // [!code highlight] + chain: "ethereum", // The blockchain network, e.g., 'ethereum' // [!code highlight] + recipient: "0xRecipientWalletAddress", // The recipient's wallet address // [!code highlight] }), }).then((response) => { console.log(response); @@ -122,9 +122,9 @@ await fetch(`${GAS_TANK_ENDPOINT}/msg/consume`, { "Content-Type": "application/json", }, body: JSON.stringify({ - address: "string", // [!code highlight] - minDestinationAmount: "string", // [!code highlight] - destinationChain: "string", // [!code highlight] + address: "0xYourWalletAddress", // Your wallet address // [!code highlight] + minDestinationAmount: "1", // Minimum amount of the token to consume // [!code highlight] + destinationChain: "ethereum", // The blockchain network, e.g., 'ethereum' // [!code highlight] }), }).then((response) => { console.log(response); From 021ab24fc5beb8fc88bab592aedfbaeff22dc5d8 Mon Sep 17 00:00:00 2001 From: "Justin (HoangVD2)" Date: Wed, 12 Jun 2024 09:57:41 +0700 Subject: [PATCH 18/18] chore: update endpoint --- assets-services/assets-and-prices-api.md | 6 +++--- components/staking/CreateCosmosDelegateTx.jsx | 2 +- components/staking/CreateErc20ApproveTx.jsx | 2 +- components/staking/CreateLidoStakeTx.jsx | 2 +- .../staking/CreateStrideLiquidStakingTx.jsx | 2 +- components/staking/GetCosmosDelegations.jsx | 2 +- components/staking/GetLidoStakedBalance.jsx | 2 +- .../staking/GetStrideStakedAssetBalance.jsx | 2 +- staking/staking-api.md | 20 +++++++++---------- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/assets-services/assets-and-prices-api.md b/assets-services/assets-and-prices-api.md index 75397185b..19576a3be 100644 --- a/assets-services/assets-and-prices-api.md +++ b/assets-services/assets-and-prices-api.md @@ -129,7 +129,7 @@ getAssetsTokens(); Get Assets Crypto Currencies provides information about cryptocurrencies on various blockchains, including Ethereum, Binance Smart Chain, and Solana. The API returns data such as the cryptocurrency's name, symbol, icon, type, external data, scaling factor, chain, market cap, and price. -[Query GraphQL directly here](https://gql-router.dev.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAMKEAOKEJMeeyUAlggM4AUAJOQIYDmC6UhCRIEUFI2EBBPLxYBCADREOAM0YAbFPkFkClarXpIoBAGKbteZR26qrABTyMoAogBFu2gCqNENuytBTx8-BABKImAAHSQiIm4WFgQUFijY%2BPioCioaOgZmdh5%2BQS4%2BBGV1LR0VKqtlQPwnFzdbeybnVwb2vFLGvEiYuMz44oQQ7nThkayIGFQMmfiNP0YURaWIVVVk9enMgF8NzLGppdHygEkkVQgz8-iAC0SAOQQADxQHcuOl5DA8iwIHhfodQfEEGB%2BGkhg94kgIGAEPc4URGGBwTMkNxEJiRiwCHAAEYQDR4zIuYTk%2BIofQIalED5WbEaCYMuDcPAAaxSJG45AZLCg3BWSF4Zm44mBDKgz0YSAZ5E6yNhqMyOLmC32DyO2pmup1oINYOGuoOIEUIAAbpzGNwiRpWBgQKroiAxm7BKr4m71HgWOsMEQAKyKY5u-qeohIGAaMmmsPDX2WfBR71EN2y7jylhRmNxxMjN3o3NB-MaQuZN0E4mk0uCcuLA6ViM9ZquPOxiuLVtWTtx2Lmy3kCAB1QrXiPFAAeXI%2BC8kiQAGVsoxKM6QAcgA) +[Query GraphQL directly here](https://gql-router.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAMKEAOKEJMeeyUAlggM4AUAJOQIYDmC6UhCRIEUFI2EBBPLxYBCADREOAM0YAbFPkFkClarXpIoBAGKbteZR26qrABTyMoAogBFu2gCqNENuytBTx8-BABKImAAHSQiIm4WFgQUFijY%2BPioCioaOgZmdh5%2BQS4%2BBGV1LR0VKqtlQPwnFzdbeybnVwb2vFLGvEiYuMz44oQQ7nThkayIGFQMmfiNP0YURaWIVVVk9enMgF8NzLGppdHygEkkVQgz8-iAC0SAOQQADxQHcuOl5DA8iwIHhfodQfEEGB%2BGkhg94kgIGAEPc4URGGBwTMkNxEJiRiwCHAAEYQDR4zIuYTk%2BIofQIalED5WbEaCYMuDcPAAaxSJG45AZLCg3BWSF4Zm44mBDKgz0YSAZ5E6yNhqMyOLmC32DyO2pmup1oINYOGuoOIEUIAAbpzGNwiRpWBgQKroiAxm7BKr4m71HgWOsMEQAKyKY5u-qeohIGAaMmmsPDX2WfBR71EN2y7jylhRmNxxMjN3o3NB-MaQuZN0E4mk0uCcuLA6ViM9ZquPOxiuLVtWTtx2Lmy3kCAB1QrXiPFAAeXI%2BC8kiQAGVsoxKM6QAcgA) ::: code-group @@ -229,7 +229,7 @@ getCryptoCurrencies(); Get Assets Fiat Currencies provides information about fiat currencies on various blockchains, including Ethereum, Binance Smart Chain, and Solana. The API returns data such as the fiat currency's name, symbol, scaling factor, character, and price. -[Query GraphQL directly here](https://gql-router.dev.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAGICWAhigMIx57JRkIDOAFACQAOFA5guiLUISJAigoyIgIJ5eLAIQAaIhwBmZADYp8g8lVr1GBctvwqOFNTryCAIlQQAVMogtWbABTxkoAog46LogAlETAADpIREQULCwIKCzhUTExGgZ0DEhMrGw8-ILcfAgqGma2quU2Kh66qnV4tdb43r7%2Bli14bX5hkdFpMQUIgRQpA4MxUBAwqKmTMZquZCjzCxBqagmrE2kAvmtpw%2BMLQyUAkkhqECenMchghiwQeIcLABZxAHIIAB4onhKb32wPuYH4yX6dxiSAgYAQt2hRDIYFBkyQFEQaMGLAIcAARhBNNi0iwoBQlkheCQKBIXiSpp88LSbAyiFwfH5EUjYnAZnNdncDoLJsKhcCxSCBsK9iAlCAAG4UHwUfGaVgYEBQogREDDXWCbUxXUaPAsVYYIgAViUh11jQNRCQME0xOltoGJq0rMtRp1IBRLEdztd8z2HuNIAdlpDmgj-saPQQwZdbtl8q4EHNaiWvHeKAA8lx8FQpEgAMpQHxcNCYEB7IA) +[Query GraphQL directly here](https://gql-router.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABAGICWAhigMIx57JRkIDOAFACQAOFA5guiLUISJAigoyIgIJ5eLAIQAaIhwBmZADYp8g8lVr1GBctvwqOFNTryCAIlQQAVMogtWbABTxkoAog46LogAlETAADpIREQULCwIKCzhUTExGgZ0DEhMrGw8-ILcfAgqGma2quU2Kh66qnV4tdb43r7%2Bli14bX5hkdFpMQUIgRQpA4MxUBAwqKmTMZquZCjzCxBqagmrE2kAvmtpw%2BMLQyUAkkhqECenMchghiwQeIcLABZxAHIIAB4onhKb32wPuYH4yX6dxiSAgYAQt2hRDIYFBkyQFEQaMGLAIcAARhBNNi0iwoBQlkheCQKBIXiSpp88LSbAyiFwfH5EUjYnAZnNdncDoLJsKhcCxSCBsK9iAlCAAG4UHwUfGaVgYEBQogREDDXWCbUxXUaPAsVYYIgAViUh11jQNRCQME0xOltoGJq0rMtRp1IBRLEdztd8z2HuNIAdlpDmgj-saPQQwZdbtl8q4EHNaiWvHeKAA8lx8FQpEgAMpQHxcNCYEB7IA) ::: code-group @@ -321,7 +321,7 @@ getFiatCurrencies(); Get LP Tokens is fully the same structure as Get Assets Tokens but itโ€™s like "Low Priority" tokens. The API returns data such as the LP token's symbol, scaling factor, address, chain, fees, defi protocols and external data. -[Query GraphQL directly here](https://gql-router.dev.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABADIAKAKhANbIDOAFACQAOAhgOYLpEDCESJAigoAlgICCeDnQCEAGiJMAZqIA2KfDyq0kAMXWa8ipm2VGeAETaaKoxCbNGyeUVG5Frt%2BwgCURYAAdJCIiNjo6BBQ6AODQ0LUWHXoGdi4eVk4ERVUNLSVco0UnfNNzfGLyvBc3DzLnV3d-IJD40LSELzZY1rbQqAgYVDi%2BhPtRFBHRiGVlSMne%2BIBfKfiOntH2rIBJJGUIDc3Q5DBeGDw6CDxV0YALcIA5BAAPFDIsm%2BXP47AuGJajqEkBAwAhDoCiANUHg2CJ-t9NqIwAjRnQCHAAEYQNQovp0KBsNSiJAcPSwlBXXFtNhgMB4BARKnxKD3YlM0LKBBggEQvoAN0JuHZRBWiwhoNULggFIGanBvP6rKQwtCbgEKqISDYiGFooVet5LyMWrUXSZSPNUKZWp1Ys2cDYeFoKF4bBYTJYjW5wu1g2GdtGBohaMx2KZKAILAQuKDfVjoVjBtFSxA8hAAtcbAxagZGBAPMCIA6hZ4PNChdUF0mGCIAFZ5KtCyVrjWkDA1DjWksG60K4Z8CX5YWQ1i1HRB22Oz22oWkePW%2B21NP4oWWWxifOeJOl42QDS6QzN5rFyNuyMm1UJ4vlxeGrUrx3gim0ywIHQUMoiRxbigAPJRmExAEABlKBXBYNBMBAJYgA) +[Query GraphQL directly here](https://gql-router.xdefi.services/graphql?explorerURLState=N4IgJg9gxgrgtgUwHYBcQC4QEcYIE4CeABADIAKAKhANbIDOAFACQAOAhgOYLpEDCESJAigoAlgICCeDnQCEAGiJMAZqIA2KfDyq0kAMXWa8ipm2VGeAETaaKoxCbNGyeUVG5Frt%2BwgCURYAAdJCIiNjo6BBQ6AODQ0LUWHXoGdi4eVk4ERVUNLSVco0UnfNNzfGLyvBc3DzLnV3d-IJD40LSELzZY1rbQqAgYVDi%2BhPtRFBHRiGVlSMne%2BIBfKfiOntH2rIBJJGUIDc3Q5DBeGDw6CDxV0YALcIA5BAAPFDIsm%2BXP47AuGJajqEkBAwAhDoCiANUHg2CJ-t9NqIwAjRnQCHAAEYQNQovp0KBsNSiJAcPSwlBXXFtNhgMB4BARKnxKD3YlM0LKBBggEQvoAN0JuHZRBWiwhoNULggFIGanBvP6rKQwtCbgEKqISDYiGFooVet5LyMWrUXSZSPNUKZWp1Ys2cDYeFoKF4bBYTJYjW5wu1g2GdtGBohaMx2KZKAILAQuKDfVjoVjBtFSxA8hAAtcbAxagZGBAPMCIA6hZ4PNChdUF0mGCIAFZ5KtCyVrjWkDA1DjWksG60K4Z8CX5YWQ1i1HRB22Oz22oWkePW%2B21NP4oWWWxifOeJOl42QDS6QzN5rFyNuyMm1UJ4vlxeGrUrx3gim0ywIHQUMoiRxbigAPJRmExAEABlKBXBYNBMBAJYgA) ::: code-group diff --git a/components/staking/CreateCosmosDelegateTx.jsx b/components/staking/CreateCosmosDelegateTx.jsx index 0dda8fca0..7c23d2996 100644 --- a/components/staking/CreateCosmosDelegateTx.jsx +++ b/components/staking/CreateCosmosDelegateTx.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { cosmosSupportedAssets as assetSupported } from "../common"; const CreateCosmosDelegateTx = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const validators = ["Meria", "StakeLab", "Custom"]; const [loading, setLoading] = useState(false); diff --git a/components/staking/CreateErc20ApproveTx.jsx b/components/staking/CreateErc20ApproveTx.jsx index 04d711419..4c4ee99bf 100644 --- a/components/staking/CreateErc20ApproveTx.jsx +++ b/components/staking/CreateErc20ApproveTx.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { otherSupportedAssets as assetSupported } from "../common"; const CreateErc20ApproveTx = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/components/staking/CreateLidoStakeTx.jsx b/components/staking/CreateLidoStakeTx.jsx index 4e238b170..09a23a235 100644 --- a/components/staking/CreateLidoStakeTx.jsx +++ b/components/staking/CreateLidoStakeTx.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { otherSupportedAssets as assetSupported } from "../common"; const CreateLidoStakeTx = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/components/staking/CreateStrideLiquidStakingTx.jsx b/components/staking/CreateStrideLiquidStakingTx.jsx index 9b1866da1..b4027d270 100644 --- a/components/staking/CreateStrideLiquidStakingTx.jsx +++ b/components/staking/CreateStrideLiquidStakingTx.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { cosmosSupportedAssets as assetSupported } from "../common"; const CreateStrideLiquidStakingTx = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/components/staking/GetCosmosDelegations.jsx b/components/staking/GetCosmosDelegations.jsx index a6cb3d1c4..23f5b4052 100644 --- a/components/staking/GetCosmosDelegations.jsx +++ b/components/staking/GetCosmosDelegations.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { cosmosSupportedAssets as assetSupported } from "../common"; const GetCosmosDelegations = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/components/staking/GetLidoStakedBalance.jsx b/components/staking/GetLidoStakedBalance.jsx index 58a11540c..734c40c5a 100644 --- a/components/staking/GetLidoStakedBalance.jsx +++ b/components/staking/GetLidoStakedBalance.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { otherSupportedAssets as assetSupported } from "../common"; const GetLidoStakedBalance = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/components/staking/GetStrideStakedAssetBalance.jsx b/components/staking/GetStrideStakedAssetBalance.jsx index 200fb2709..512b70e2c 100644 --- a/components/staking/GetStrideStakedAssetBalance.jsx +++ b/components/staking/GetStrideStakedAssetBalance.jsx @@ -4,7 +4,7 @@ import PlayIcon from "../PlayIcon"; import { cosmosSupportedAssets as assetSupported } from "../common"; const GetStrideStakedAssetBalance = () => { - const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; + const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const [loading, setLoading] = useState(false); const [response, setResponse] = useState({}); const [assetSelected, setAssetSelected] = useState(undefined); diff --git a/staking/staking-api.md b/staking/staking-api.md index 1c9074a2c..5cf4c0b04 100644 --- a/staking/staking-api.md +++ b/staking/staking-api.md @@ -6,7 +6,7 @@ Staking is a process that involves holding funds in a cryptocurrency wallet to s XDEFI offers a staking API that enables developers to engage with the staking features across multiple blockchain networks. This API is crafted for simplicity and ease of use, emphasizing a high degree of abstraction from the complexities of the underlying blockchains. -The base URL for all API endpoints is: https://gql-router.dev.xdefi.services/graphql +The base URL for all API endpoints is: https://gql-router.xdefi.services/graphql Below are the services provided by the staking API. @@ -28,7 +28,7 @@ You can use the `getStrideStakedAssetBalance` query to get the balance of a stak ::: code-group ```javascript [GetStrideStakedAssetBalance] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query GetStrideStakedAssetBalance($strideAddress: String!, $asset: SupportedAssets!) { staking { getStrideStakedAssetBalance(asset: $asset, strideAddress: $strideAddress) { @@ -80,7 +80,7 @@ You can use the `createStrideLiquidStakingTx` mutation to create a staking trans ::: code-group ```javascript [CreateStrideLiquidStakingTx] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query CreateStrideLiquidStakingTx($input: StrideStakingInput!) { staking { createStrideLiquidStakingTx(input: $input) @@ -134,7 +134,7 @@ You can use the `getCosmosDelegations` query to get the delegations of a Cosmos ::: code-group ```javascript [GetCosmosDelegations] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query getCosmosDelegations($asset: SupportedAssets!, $address: String!) { staking { getCosmosDelegations(address: $address, asset: $asset) { @@ -189,7 +189,7 @@ You can use the `createCosmosDelegateTx` mutation to create a native staking tra ::: code-group ```javascript [Meria/StakeLab Validator] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query CreateCosmosDelegateTx($delegationInput: CosmosDelegationInput!, $validatorAddress: String, $provider: Providers) { staking { createCosmosDelegateTx( @@ -230,7 +230,7 @@ await fetch(GRAPHQL_ENDPOINT, { ``` ```javascript [Custom validatorโ€™s address] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query CreateCosmosDelegateTx($delegationInput: CosmosDelegationInput!, $validatorAddress: String, $provider: Providers) { staking { createCosmosDelegateTx( @@ -293,7 +293,7 @@ You can use the `getLidoStakedAssetBalance` query to get the balance of a staked ::: code-group ```javascript [GetLidoStakedBalance] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query GetLidoStakedBalance($asset: SupportedAssets!, $address: String!) { staking { getLidoStakedBalance(address: $address, asset: $asset) { @@ -343,7 +343,7 @@ You can use the `createLidoStakeTx` query to create a staking transaction on LID ::: code-group ```javascript [CreateLidoStakeTx] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query CreateLidoStakeTx($input: LidoStakingInput!) { staking { createLidoStakeTx(input: $input) { @@ -397,7 +397,7 @@ You can use the `lidoCheckErc20Allowance` query to check the allowance for staki ::: code-group ```javascript [LidoCheckErc20Allowance] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query LidoCheckErc20Allowance($ownerAddress: String!, $asset: SupportedAssets!) { staking { lidoCheckErc20Allowance(input: {ownerAddress: $ownerAddress, asset: $asset}) @@ -443,7 +443,7 @@ You can use the `createErc20ApproveTx` query to create an approval transaction t ::: code-group ```javascript [CreateErc20ApproveTx] -const GRAPHQL_ENDPOINT = "https://gql-router.dev.xdefi.services/graphql"; +const GRAPHQL_ENDPOINT = "https://gql-router.xdefi.services/graphql"; const query = `query createErc20ApproveTx($input: Erc20ApproveInput!) { staking { createErc20ApproveTx(input: $input) {