From f39da4d248733384e7cd561342805f3bc1517f63 Mon Sep 17 00:00:00 2001 From: trikunai Date: Thu, 23 Apr 2026 13:45:54 +0100 Subject: [PATCH 1/5] feat: chatwoot implementation --- .env-example | 4 +- .env.development | 4 +- .env.production | 4 +- .github/workflows/build-push-commit.yaml | 6 +-- docusaurus.config.js | 2 + package-lock.json | 10 ++++ package.json | 1 + src/components/ChatwootWidget.jsx | 64 ++++++++++++++++++++++++ src/theme/Root.jsx | 11 ++++ 9 files changed, 100 insertions(+), 6 deletions(-) create mode 100644 src/components/ChatwootWidget.jsx create mode 100644 src/theme/Root.jsx diff --git a/.env-example b/.env-example index f66b833..2a1fbc2 100644 --- a/.env-example +++ b/.env-example @@ -1,3 +1,5 @@ STAKING_API_URL=https://staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://staking-api.stakely.io/docs-json -APP_URL=https://app.stakely.io \ No newline at end of file +APP_URL=https://app.stakely.io +CHATWOOT_WEBSITE_TOKEN=your_token_here +CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file diff --git a/.env.development b/.env.development index 4b038d7..21698db 100644 --- a/.env.development +++ b/.env.development @@ -1,3 +1,5 @@ STAKING_API_URL=https://dev-staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://dev-staking-api.stakely.io/docs-json -APP_URL=https://dev-app.stakely.io \ No newline at end of file +APP_URL=https://dev-app.stakely.io +CHATWOOT_WEBSITE_TOKEN=your_token_here +CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file diff --git a/.env.production b/.env.production index f66b833..2a1fbc2 100644 --- a/.env.production +++ b/.env.production @@ -1,3 +1,5 @@ STAKING_API_URL=https://staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://staking-api.stakely.io/docs-json -APP_URL=https://app.stakely.io \ No newline at end of file +APP_URL=https://app.stakely.io +CHATWOOT_WEBSITE_TOKEN=your_token_here +CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file diff --git a/.github/workflows/build-push-commit.yaml b/.github/workflows/build-push-commit.yaml index a9b11ee..1e72b7f 100644 --- a/.github/workflows/build-push-commit.yaml +++ b/.github/workflows/build-push-commit.yaml @@ -27,10 +27,10 @@ jobs: run: | if [ "${{ env.BRANCH_NAME }}" = "develop" ] then - docker build --build-arg STAKING_API_URL="https://dev-staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://dev-staking-api.stakely.io/docs-json" --build-arg APP_URL="https://dev-app.stakely.io" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . + docker build --build-arg STAKING_API_URL="https://dev-staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://dev-staking-api.stakely.io/docs-json" --build-arg APP_URL="https://dev-app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . elif [ "${{ env.BRANCH_NAME }}" = "main" ] then - docker build --build-arg STAKING_API_URL="https://staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://staking-api.stakely.io/docs-json" --build-arg APP_URL="https://app.stakely.io" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . + docker build --build-arg STAKING_API_URL="https://staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://staking-api.stakely.io/docs-json" --build-arg APP_URL="https://app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . fi echo '${{ secrets.DOCKERHUB_PASSWORD }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin docker push stakely/stakely-docs:${{ env.BRANCH_NAME }} @@ -54,7 +54,7 @@ jobs: run: | cd kubernetes-manifests echo "Image Digest: ${{ env.IMAGE_DIGEST }}" - # Replaces the image digest with the new one to trigger ArgoCD + # Replaces the image digest with the new one to trigger ArgoCD if [ "${{ env.BRANCH_NAME }}" = "main" ] then yq e '.frontend.docs.image = "${{ env.IMAGE_DIGEST }}"' -i web/values.production.yaml diff --git a/docusaurus.config.js b/docusaurus.config.js index 852b2f0..1933fc6 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -18,6 +18,8 @@ const config = { customFields: { stakingApiUrl: process.env.STAKING_API_URL, appUrl: process.env.APP_URL, + chatwootWebsiteToken: process.env.CHATWOOT_WEBSITE_TOKEN, + chatwootBaseUrl: process.env.CHATWOOT_BASE_URL, }, title: 'Stakely Docs', favicon: 'img/favicon.ico', diff --git a/package-lock.json b/package-lock.json index 77d24a7..6437bae 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@easyops-cn/docusaurus-search-local": "^0.44.2", "@mdx-js/react": "^3.0.0", "@scalar/docusaurus": "^0.7.18", + "ahize": "^0.2.1", "clsx": "^2.0.0", "docusaurus-preset-openapi": "^0.7.5", "dotenv": "^16.4.5", @@ -6774,6 +6775,15 @@ "node": ">=8" } }, + "node_modules/ahize": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/ahize/-/ahize-0.2.1.tgz", + "integrity": "sha512-G8Neae0NvGWRZNm3/eQ2iNKsUt5dLJSBL7emVvw+d7uSeZLS94NOUMYIa9evh3SKuvwr2Fh6HCocwsAq6XNFYA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/productdevbook" + } + }, "node_modules/ajv": { "version": "8.11.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", diff --git a/package.json b/package.json index da45f00..d769355 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@easyops-cn/docusaurus-search-local": "^0.44.2", "@mdx-js/react": "^3.0.0", "@scalar/docusaurus": "^0.7.18", + "ahize": "^0.2.1", "clsx": "^2.0.0", "docusaurus-preset-openapi": "^0.7.5", "dotenv": "^16.4.5", diff --git a/src/components/ChatwootWidget.jsx b/src/components/ChatwootWidget.jsx new file mode 100644 index 0000000..ef248f8 --- /dev/null +++ b/src/components/ChatwootWidget.jsx @@ -0,0 +1,64 @@ +import { useEffect } from 'react'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import * as chatwoot from 'ahize/chatwoot'; + +const STORAGE_KEY = 'chatwoot_visitor_id'; + +function fallbackVisitorId() { + return `anon_${Date.now()}_${Math.random().toString(16).slice(2)}`; +} + +function getOrCreateVisitorId() { + const existingId = window.localStorage.getItem(STORAGE_KEY); + if (existingId) { + return existingId; + } + + const generatedId = + typeof window.crypto?.randomUUID === 'function' + ? window.crypto.randomUUID() + : fallbackVisitorId(); + window.localStorage.setItem(STORAGE_KEY, generatedId); + return generatedId; +} + +export default function ChatwootWidget() { + const { siteConfig } = useDocusaurusContext(); + const { chatwootWebsiteToken, chatwootBaseUrl } = siteConfig.customFields ?? {}; + + useEffect(() => { + if (typeof window === 'undefined') { + return; + } + if (!chatwootWebsiteToken || !chatwootBaseUrl) { + return; + } + + const visitorId = getOrCreateVisitorId(); + + let cancelled = false; + const boot = async () => { + try { + await chatwoot.load({ + websiteToken: chatwootWebsiteToken, + baseUrl: chatwootBaseUrl, + darkMode: 'auto', + }); + await chatwoot.ready(); + if (!cancelled) { + await chatwoot.identify({ id: visitorId }); + } + } catch (error) { + console.error('Failed to initialize Chatwoot widget:', error); + } + }; + + void boot(); + + return () => { + cancelled = true; + }; + }, [chatwootWebsiteToken, chatwootBaseUrl]); + + return null; +} diff --git a/src/theme/Root.jsx b/src/theme/Root.jsx new file mode 100644 index 0000000..34d352b --- /dev/null +++ b/src/theme/Root.jsx @@ -0,0 +1,11 @@ +import React from 'react'; +import ChatwootWidget from '@site/src/components/ChatwootWidget'; + +export default function Root({ children }) { + return ( + <> + {children} + + + ); +} From 52ec071d3b99ba4f149307370957f8048f4b5f35 Mon Sep 17 00:00:00 2001 From: trikunai Date: Thu, 23 Apr 2026 14:16:18 +0100 Subject: [PATCH 2/5] fix: missing chatwoot vars in dockerfile for build --- Dockerfile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Dockerfile b/Dockerfile index 0c0afe2..681487a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,6 +25,12 @@ ENV STAKING_API_DOC_JSON_URL=$STAKING_API_DOC_JSON_URL ARG APP_URL ENV APP_URL=$APP_URL +ARG CHATWOOT_WEBSITE_TOKEN +ENV CHATWOOT_WEBSITE_TOKEN=$CHATWOOT_WEBSITE_TOKEN + +ARG CHATWOOT_BASE_URL +ENV CHATWOOT_BASE_URL=$CHATWOOT_BASE_URL + RUN npm ci ## Build the static site. RUN npm run build From 92b63b60435e97cb3413d2a9c157de4ca36ff106 Mon Sep 17 00:00:00 2001 From: trikunai Date: Fri, 24 Apr 2026 14:43:23 +0100 Subject: [PATCH 3/5] feat: dto naming in camelCase fix --- .../cosmos-hub/native-staking/endpoints.md | 20 +++++----- .../ethereum/stakewise/endpoints.md | 30 +++++++-------- .../monad/native-staking/endpoints.md | 38 +++++++++---------- .../solana/native-staking/endpoints.md | 24 ++++++------ 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/docs/staking-api/cosmos-hub/native-staking/endpoints.md b/docs/staking-api/cosmos-hub/native-staking/endpoints.md index 08533b8..1874665 100644 --- a/docs/staking-api/cosmos-hub/native-staking/endpoints.md +++ b/docs/staking-api/cosmos-hub/native-staking/endpoints.md @@ -69,11 +69,11 @@ This endpoint will craft a stake transaction ready to be signed. #### Request body parameters -StakeActionDto +StakeActionDto #### Returned -StakingActionResponseDto +StakingActionResponseDto ____ @@ -89,11 +89,11 @@ This endpoint will craft an unstake transaction ready to be signed. #### Request body parameters -UnstakeActionDto +UnstakeActionDto #### Returned -StakingActionResponseDto +StakingActionResponseDto ____ @@ -109,11 +109,11 @@ This endpoint will craft a claim rewards transaction ready to be signed. #### Request body parameters -ClaimRewardsActionDto +ClaimRewardsActionDto #### Returned -StakingActionResponseDto +StakingActionResponseDto ____ @@ -129,11 +129,11 @@ Prepare a signed transaction by gathering the provided signatures with the unsig #### Request body parameters -PrepareActionDto +PrepareActionDto #### Returned -PrepareActionResponseDto +PrepareActionResponseDto ____ @@ -149,8 +149,8 @@ Broadcast a signed transaction. Usually you will brodcast the signed transaction #### Request body parameters -BroadcastActionDto +BroadcastActionDto #### Returned -BroadcastActionResponseDto +BroadcastActionResponseDto diff --git a/docs/staking-api/ethereum/stakewise/endpoints.md b/docs/staking-api/ethereum/stakewise/endpoints.md index a980bb6..7eb7f7b 100644 --- a/docs/staking-api/ethereum/stakewise/endpoints.md +++ b/docs/staking-api/ethereum/stakewise/endpoints.md @@ -76,11 +76,11 @@ This endpoint will craft a stake transaction ready to be signed. #### Request body parameters -StakewiseStakeActionDto +StakewiseStakeActionDto #### Returned -StakewiseStakingActionResponseDto +StakewiseStakingActionResponseDto ____ @@ -96,11 +96,11 @@ This endpoint will build an "enter exit queue" unstake transaction ready to be s #### Request param -StakewiseStakeActionDto +StakewiseStakeActionDto #### Returned -StakewiseStakingActionResponseDto +StakewiseStakingActionResponseDto ____ @@ -115,11 +115,11 @@ Craft a withdraw transaction Once the assets in queue are ready to be claimable you can claim them. This action will craft a withdraw transaction of the withdrawable assets. -StakewiseWithdrawActionDto +StakewiseWithdrawActionDto #### Returned -StakewiseStakingActionResponseDto +StakewiseStakingActionResponseDto ____ @@ -135,11 +135,11 @@ Prepare a signed transaction by gathering the provided signatures with the unsig #### Request body parameters -EthPrepareActionDto +EthPrepareActionDto #### Returned -EthPrepareActionResponseDto +EthPrepareActionResponseDto ____ @@ -155,11 +155,11 @@ Broadcast a signed transaction. Usually you will brodcast the signed transaction #### Request body parameters -EthBroadcastActionDto +EthBroadcastActionDto #### Returned -EthBroadcastActionResponseDto +EthBroadcastActionResponseDto ____ @@ -180,7 +180,7 @@ At url param you will need to pass the `address` you want to retrieve actions fr #### Returned -Array of StakewiseGetActionResponseDto +Array of StakewiseGetActionResponseDto ____ @@ -201,7 +201,7 @@ At url param you will need to pass the `address` you want to retrieve actions fr #### Returned -Array of StakewiseGetStakeBalanceResponseDto +Array of StakewiseGetStakeBalanceResponseDto ____ @@ -223,7 +223,7 @@ At url param you will need to pass the `address` you want to retrieve actions fr #### Returned -Array of StakewiseGetExitedBalanceResponseDto +Array of StakewiseGetExitedBalanceResponseDto ____ @@ -241,7 +241,7 @@ Get vault details, as current APY #### Returned -Array of StakewiseGetVaultResponseDto +Array of StakewiseGetVaultResponseDto ____ @@ -258,4 +258,4 @@ Get vault details, as current APY #### Returned -Array of StakewiseGetUserStatsResponseDto \ No newline at end of file +Array of StakewiseGetUserStatsResponseDto \ No newline at end of file diff --git a/docs/staking-api/monad/native-staking/endpoints.md b/docs/staking-api/monad/native-staking/endpoints.md index 0815540..e3116d8 100644 --- a/docs/staking-api/monad/native-staking/endpoints.md +++ b/docs/staking-api/monad/native-staking/endpoints.md @@ -76,11 +76,11 @@ This endpoint will craft a delegate transaction ready to be signed. The transact #### Request body parameters -MonadStakeActionDto +MonadStakeActionDto #### Returned -MonadActionResponseDto +MonadActionResponseDto ____ @@ -96,11 +96,11 @@ This endpoint will craft an undelegate transaction ready to be signed. The undel #### Request body parameters -MonadUndelegateActionDto +MonadUndelegateActionDto #### Returned -MonadActionResponseDto +MonadActionResponseDto ____ @@ -116,11 +116,11 @@ Once the withdrawal is available (after the withdrawal epoch), you can claim it. #### Request body parameters -MonadWithdrawActionDto +MonadWithdrawActionDto #### Returned -MonadActionResponseDto +MonadActionResponseDto ____ @@ -136,11 +136,11 @@ This endpoint will craft a claim rewards transaction ready to be signed. It allo #### Request body parameters -MonadClaimRewardsActionDto +MonadClaimRewardsActionDto #### Returned -MonadActionResponseDto +MonadActionResponseDto ____ @@ -156,11 +156,11 @@ This endpoint will craft a compound rewards transaction ready to be signed. It a #### Request body parameters -MonadCompoundActionDto +MonadCompoundActionDto #### Returned -MonadActionResponseDto +MonadActionResponseDto ____ @@ -176,11 +176,11 @@ Prepare a signed transaction by gathering the provided signatures (r, s, v) with #### Request body parameters -EthPrepareActionDto +EthPrepareActionDto #### Returned -EthPrepareActionResponseDto +EthPrepareActionResponseDto ____ @@ -196,11 +196,11 @@ Broadcast a signed transaction. Usually you will broadcast the signed transactio #### Request body parameters -EthBroadcastActionDto +EthBroadcastActionDto #### Returned -EthBroadcastActionResponseDto +EthBroadcastActionResponseDto ____ @@ -220,7 +220,7 @@ At url param you will need to pass the `address` you want to retrieve stake bala #### Returned -GetStakeBalanceResponseDto +GetStakeBalanceResponseDto ____ @@ -240,14 +240,14 @@ At url param you will need to pass the `address` you want to retrieve withdrawal #### Query parameters -MonadWithdrawalQueryDto +MonadWithdrawalQueryDto - `startWithdrawId` (optional): Start withdrawal ID in the range (0-255, defaults to 0) - `endWithdrawId` (optional): End withdrawal ID in the range (0-255, defaults to 255) #### Returned -GetWithdrawalRequestsResponseDto +GetWithdrawalRequestsResponseDto ____ @@ -263,14 +263,14 @@ Get a single withdrawal request for the given delegator address and withdrawal s #### Request parameters -MonadWithdrawalParamsDto +MonadWithdrawalParamsDto - `address`: Delegator address - `withdrawId`: Withdrawal slot identifier (0-255) #### Returned -GetWithdrawalRequestResponseDto +GetWithdrawalRequestResponseDto ____ diff --git a/docs/staking-api/solana/native-staking/endpoints.md b/docs/staking-api/solana/native-staking/endpoints.md index 902d6f1..90a7d2e 100644 --- a/docs/staking-api/solana/native-staking/endpoints.md +++ b/docs/staking-api/solana/native-staking/endpoints.md @@ -70,11 +70,11 @@ This endpoint will craft a create nonce account transaction ready to be signed. #### Request body parameters -CreateNonceAccountActionDto +CreateNonceAccountActionDto #### Returned -SolanaStakingActionResponseDto +SolanaStakingActionResponseDto ____ @@ -93,11 +93,11 @@ The stake action combines these steps into a single transaction, simplifying the #### Request body parameters -SolanaStakeActionDto +SolanaStakeActionDto #### Returned -SolanaStakingActionResponseDto +SolanaStakingActionResponseDto ____ @@ -115,11 +115,11 @@ The unstake action through the Staking API initiates this process by creating a #### Request body parameters -SolanaUnstakeActionDto +SolanaUnstakeActionDto #### Returned -SolanaStakingActionResponseDto +SolanaStakingActionResponseDto ____ @@ -140,11 +140,11 @@ The withdraw action through the Staking API creates a transaction that performs #### Request body parameters -SolanaWithdrawActionDto +SolanaWithdrawActionDto #### Returned -SolanaStakingActionResponseDto +SolanaStakingActionResponseDto ____ @@ -160,11 +160,11 @@ Prepare a signed transaction by gathering the provided signatures with the unsig #### Request body parameters -SolanaPrepareActionDto +SolanaPrepareActionDto #### Returned -SolanaPrepareActionResponseDto +SolanaPrepareActionResponseDto ____ @@ -180,8 +180,8 @@ Broadcast a signed transaction. Usually you will brodcast the signed transaction #### Request body parameters -SolanaBroadcastActionDto +SolanaBroadcastActionDto #### Returned -SolanaBroadcastActionResponseDto +SolanaBroadcastActionResponseDto From a43310a52aae8b9593c41098a237ad423aabf569 Mon Sep 17 00:00:00 2001 From: trikunai Date: Fri, 24 Apr 2026 14:56:31 +0100 Subject: [PATCH 4/5] feat: chatwoot enabled variable on build --- .env-example | 3 ++- .env.development | 3 ++- .env.production | 3 ++- .github/workflows/build-push-commit.yaml | 4 ++-- Dockerfile | 3 +++ docusaurus.config.js | 1 + src/components/ChatwootWidget.jsx | 6 +++--- 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.env-example b/.env-example index 2a1fbc2..9085b1e 100644 --- a/.env-example +++ b/.env-example @@ -2,4 +2,5 @@ STAKING_API_URL=https://staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://staking-api.stakely.io/docs-json APP_URL=https://app.stakely.io CHATWOOT_WEBSITE_TOKEN=your_token_here -CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file +CHATWOOT_BASE_URL=https://your.chatwoot.instance +CHATWOOT_ENABLED=false diff --git a/.env.development b/.env.development index 21698db..9486019 100644 --- a/.env.development +++ b/.env.development @@ -2,4 +2,5 @@ STAKING_API_URL=https://dev-staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://dev-staking-api.stakely.io/docs-json APP_URL=https://dev-app.stakely.io CHATWOOT_WEBSITE_TOKEN=your_token_here -CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file +CHATWOOT_BASE_URL=https://your.chatwoot.instance +CHATWOOT_ENABLED=true diff --git a/.env.production b/.env.production index 2a1fbc2..9085b1e 100644 --- a/.env.production +++ b/.env.production @@ -2,4 +2,5 @@ STAKING_API_URL=https://staking-api.stakely.io/docs STAKING_API_DOC_JSON_URL=https://staking-api.stakely.io/docs-json APP_URL=https://app.stakely.io CHATWOOT_WEBSITE_TOKEN=your_token_here -CHATWOOT_BASE_URL=https://your.chatwoot.instance \ No newline at end of file +CHATWOOT_BASE_URL=https://your.chatwoot.instance +CHATWOOT_ENABLED=false diff --git a/.github/workflows/build-push-commit.yaml b/.github/workflows/build-push-commit.yaml index 1e72b7f..217d959 100644 --- a/.github/workflows/build-push-commit.yaml +++ b/.github/workflows/build-push-commit.yaml @@ -27,10 +27,10 @@ jobs: run: | if [ "${{ env.BRANCH_NAME }}" = "develop" ] then - docker build --build-arg STAKING_API_URL="https://dev-staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://dev-staking-api.stakely.io/docs-json" --build-arg APP_URL="https://dev-app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . + docker build --build-arg STAKING_API_URL="https://dev-staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://dev-staking-api.stakely.io/docs-json" --build-arg APP_URL="https://dev-app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" --build-arg CHATWOOT_ENABLED="true" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . elif [ "${{ env.BRANCH_NAME }}" = "main" ] then - docker build --build-arg STAKING_API_URL="https://staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://staking-api.stakely.io/docs-json" --build-arg APP_URL="https://app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . + docker build --build-arg STAKING_API_URL="https://staking-api.stakely.io/docs" --build-arg STAKING_API_DOC_JSON_URL="https://staking-api.stakely.io/docs-json" --build-arg APP_URL="https://app.stakely.io" --build-arg CHATWOOT_WEBSITE_TOKEN="${{ secrets.CHATWOOT_WEBSITE_TOKEN }}" --build-arg CHATWOOT_BASE_URL="${{ secrets.CHATWOOT_BASE_URL }}" --build-arg CHATWOOT_ENABLED="false" -t stakely/stakely-docs:${{ env.BRANCH_NAME }} . fi echo '${{ secrets.DOCKERHUB_PASSWORD }}' | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin docker push stakely/stakely-docs:${{ env.BRANCH_NAME }} diff --git a/Dockerfile b/Dockerfile index 681487a..94a2593 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,6 +31,9 @@ ENV CHATWOOT_WEBSITE_TOKEN=$CHATWOOT_WEBSITE_TOKEN ARG CHATWOOT_BASE_URL ENV CHATWOOT_BASE_URL=$CHATWOOT_BASE_URL +ARG CHATWOOT_ENABLED +ENV CHATWOOT_ENABLED=$CHATWOOT_ENABLED + RUN npm ci ## Build the static site. RUN npm run build diff --git a/docusaurus.config.js b/docusaurus.config.js index 1933fc6..56c4a06 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -20,6 +20,7 @@ const config = { appUrl: process.env.APP_URL, chatwootWebsiteToken: process.env.CHATWOOT_WEBSITE_TOKEN, chatwootBaseUrl: process.env.CHATWOOT_BASE_URL, + chatwootEnabled: process.env.CHATWOOT_ENABLED === 'true', }, title: 'Stakely Docs', favicon: 'img/favicon.ico', diff --git a/src/components/ChatwootWidget.jsx b/src/components/ChatwootWidget.jsx index ef248f8..d17a067 100644 --- a/src/components/ChatwootWidget.jsx +++ b/src/components/ChatwootWidget.jsx @@ -24,13 +24,13 @@ function getOrCreateVisitorId() { export default function ChatwootWidget() { const { siteConfig } = useDocusaurusContext(); - const { chatwootWebsiteToken, chatwootBaseUrl } = siteConfig.customFields ?? {}; + const { chatwootWebsiteToken, chatwootBaseUrl, chatwootEnabled } = siteConfig.customFields ?? {}; useEffect(() => { if (typeof window === 'undefined') { return; } - if (!chatwootWebsiteToken || !chatwootBaseUrl) { + if (!chatwootEnabled || !chatwootWebsiteToken || !chatwootBaseUrl) { return; } @@ -58,7 +58,7 @@ export default function ChatwootWidget() { return () => { cancelled = true; }; - }, [chatwootWebsiteToken, chatwootBaseUrl]); + }, [chatwootEnabled, chatwootWebsiteToken, chatwootBaseUrl]); return null; } From d19f6a99595cf4399f25e0f1b59630922bd05c99 Mon Sep 17 00:00:00 2001 From: trikunai Date: Fri, 24 Apr 2026 15:08:08 +0100 Subject: [PATCH 5/5] feat: magma docs --- docs/staking-api/monad/index.md | 1 + docs/staking-api/monad/magma/_category_.json | 8 + docs/staking-api/monad/magma/endpoints.md | 220 +++++++++++++++++++ docs/staking-api/monad/magma/index.md | 80 +++++++ 4 files changed, 309 insertions(+) create mode 100644 docs/staking-api/monad/magma/_category_.json create mode 100644 docs/staking-api/monad/magma/endpoints.md create mode 100644 docs/staking-api/monad/magma/index.md diff --git a/docs/staking-api/monad/index.md b/docs/staking-api/monad/index.md index b90e9cf..bc516c9 100644 --- a/docs/staking-api/monad/index.md +++ b/docs/staking-api/monad/index.md @@ -15,6 +15,7 @@ This section covers Monad staking integrations using the Stakely Staking API. It - **Signing transactions**: how to sign Monad transactions returned by the crafting endpoints, with examples for common signing setups. - **Native staking**: end-to-end flows and endpoints for delegating, claiming rewards, and undelegating for native Monad staking. +- **Magma liquid staking**: flows and endpoints for staking MON for gMON, undelegating, and withdrawing via the Magma protocol. ## Notes diff --git a/docs/staking-api/monad/magma/_category_.json b/docs/staking-api/monad/magma/_category_.json new file mode 100644 index 0000000..1bc294e --- /dev/null +++ b/docs/staking-api/monad/magma/_category_.json @@ -0,0 +1,8 @@ +{ + "label": "Magma", + "position": 4, + "link": { + "type": "doc", + "id": "staking-api/monad/magma/index" + } +} diff --git a/docs/staking-api/monad/magma/endpoints.md b/docs/staking-api/monad/magma/endpoints.md new file mode 100644 index 0000000..dbf02cc --- /dev/null +++ b/docs/staking-api/monad/magma/endpoints.md @@ -0,0 +1,220 @@ +--- +sidebar_position: 3 +--- + +# Endpoints + +import StakingOpenApiLink from '@site/src/components/StakingOpenApiLink'; + +## API Usage + +Once you already have access to the Staking API with a validated user and existing apikeys you can start using this service. + +### API Reference docs + +:::tip + +You can check the **Staking API Reference** here: +- Rendered doc page. +- +::: + +## Authentication + +In order to use staking api related endpoints you need to include your **API KEY** + +:::tip + +**Heads up!** +To obtain a valid API key required for authentication, please refer to the [Authentication > Auth](/staking-api/authentication#auth) section of the documentation. + +::: + +**Header:** + +| Name | Description | Example value | Required | +|---|---|---|---| +| `X-API-KEY` | Your api key value | `` | ✅ | +| `X-NETWORK` | Blockchain network identifier | `143` | ⚪ | + +### X-NETWORK header + +Use the `X-NETWORK` header to select the Monad network (currently `143` for Monad Mainnet). + +::::info +If you omit the header the API falls back to the default Monad network configured for your account. +:::: + +### List available networks + +Use this helper endpoint to obtain the list of Monad Magma networks that are currently enabled for your API key. + +- Endpoint: /api/v1/monad/magma/networks + +Response payload fields: + +| Field | Description | +|---|---| +| `name` | Internal blockchain entry name | +| `type` | Blockchain type string (always `ETHEREUM`) | +| `chain_id` | Chain identifier (currently `143`) | +| `is_default` | `true` when this network is used as fallback | + +____ + +### Delegate action + +Craft a Magma delegate transaction: + +- Endpoint: /api/v1/monad/magma/action/delegate + +#### Description + +This endpoint crafts a Magma delegate transaction ready to be signed. + +#### Request body parameters + +MagmaStakeActionDto + +- `address`: wallet address that performs the action +- `amount`: MON amount to delegate (minimum `100` MON) + +#### Returned + +MonadActionResponseDto + +____ + +### Undelegate action + +Craft a Magma undelegate transaction: + +- Endpoint: /api/v1/monad/magma/action/undelegate + +#### Description + +This endpoint crafts a Magma undelegate transaction ready to be signed. + +#### Request body parameters + +MagmaUndelegateActionDto + +- `address`: wallet address that performs the action +- `amount`: MON amount to undelegate + +#### Returned + +MonadActionResponseDto + +____ + +### Withdraw action + +Craft a Magma withdraw transaction: + +- Endpoint: /api/v1/monad/magma/action/withdraw + +#### Description + +This endpoint crafts a Magma withdraw transaction for a specific withdrawal request. + +#### Request body parameters + +MagmaWithdrawActionDto + +- `address`: wallet address that performs the action +- `request_id`: owner request ID to withdraw + +#### Returned + +MonadActionResponseDto + +____ + +### Prepare action + +Gathers signature and unsigned tx: + +- Endpoint: /api/v1/monad/magma/action/prepare + +#### Description + +Prepare a signed transaction by gathering the provided signatures (`r`, `s`, `v`) with the unsigned transaction hex string. + +#### Request body parameters + +EthPrepareActionDto + +#### Returned + +EthPrepareActionResponseDto + +____ + +### Broadcast action + +Broadcast a signed transaction: + +- Endpoint: /api/v1/monad/magma/action/broadcast + +#### Description + +Broadcast a signed Magma transaction. + +#### Request body parameters + +EthBroadcastActionDto + +#### Returned + +EthBroadcastActionResponseDto + +____ + +### Balance + +Get Magma staking balance for the given address: + +- Endpoint: /api/v1/monad/magma/balance/{address} + +#### Description + +Get current Magma balance values for a delegator address. + +#### Request parameters + +At url param you will need to pass the `address` you want to retrieve balance from. + +#### Returned + +MagmaBalanceResponseDto + +- `staked`: currently staked MON +- `unstaked`: pending unstaked MON +- `withdrawable`: withdrawable redeem request shares + +____ + +### Withdrawal info + +Get Magma withdrawal requests for the given address: + +- Endpoint: /api/v1/monad/magma/withdrawal/{address} + +#### Description + +Get current pending withdrawal information for a Magma address. + +#### Request parameters + +At url param you will need to pass the `address` you want to retrieve withdrawal info from. + +#### Returned + +MagmaWithdrawalResponseDto[] + +- `request_id`: current owner request ID +- `assets`: requested assets in MON +- `withdrawable_time`: unix timestamp for withdraw availability + +____ diff --git a/docs/staking-api/monad/magma/index.md b/docs/staking-api/monad/magma/index.md new file mode 100644 index 0000000..fa56d1a --- /dev/null +++ b/docs/staking-api/monad/magma/index.md @@ -0,0 +1,80 @@ +--- +sidebar_position: 1 +--- + +# Staking Flow + +Before interacting with the API methods, it is useful to understand how Magma works on Monad. + +Magma is a liquid staking protocol on Monad. Magma's staking pool allows users to stake Monad tokens and receive liquid staked Monad (`gMON`) in return. + +Magma is built on Monad, an EVM L1 designed for high throughput, low costs, and censorship resistance. The protocol is operated in a decentralized way, with a strong focus on community participation and socially conscious decision-making. + +## Liquid staking + +Magma allows MON holders to generate staking rewards while remaining liquid. When users stake MON to participate in Monad's DPoS consensus, they receive `gMON`, which represents their staked MON and accrued staking position. + +`gMON` can be used across DeFi applications in the Monad ecosystem for collateral, liquidity provision, lending and borrowing, and trading activities. `gMON` is designed as a fully collateralized asset, backed 1:1 and redeemable for MON. + +## gVaults + +Magma introduces staking vaults (`gVaults`) on Monad. This architecture is designed to isolate risks and provide stronger operational and regulatory flexibility for institutional users. + +### Delegate + +Delegation stakes MON into Magma and mints the liquid staking position. + +1. **Initiate delegation**: Use the delegate action to craft a transaction with the amount you want to stake. +2. **Transaction confirmation**: Once confirmed on-chain, your MON is staked in Magma. +3. **Receive gMON**: Your liquid staking position is represented by `gMON`. + +### Undelegate + +Undelegation starts the process of exiting part of your staked position. + +1. **Initiate undelegation**: Use the undelegate action for the amount you want to exit. +2. **Request creation**: The protocol creates a withdrawal request associated with a `request_id`. +3. **Wait period**: Funds become withdrawable after the protocol-defined unlock period. + +### Withdraw + +Once a withdrawal request is available, you can claim it. + +1. **Check withdrawal status**: Retrieve your pending requests and identify a withdrawable `request_id`. +2. **Withdraw funds**: Use the withdraw action with that `request_id`. +3. **Post-withdrawal**: Claimed MON is returned to your wallet and can be reused or restaked. + +___ + +## Staking API Diagram + +```mermaid +sequenceDiagram +autonumber +actor User +participant StakingAPI +User->>+StakingAPI: Delegate action +Note left of User: Offline: Stake MON +Note right of StakingAPI: Delegate action crafting +StakingAPI-->>-User: Delegate action return +activate User +rect rgb(255,178,216) +Note left of User: Sign unsigned transaction +Note left of User: a) Local private key +Note left of User: b) Custodian +end +deactivate User + +User->>+StakingAPI: Prepare +Note right of StakingAPI: Adds signature to tx +StakingAPI-->>-User: Returns signed transaction +activate User +rect rgba(228, 173, 77, 0.8) +Note left of User: Broadcast it using any RPC +Note left of User: or use the broadcast endpoint +end +deactivate User +User->>+StakingAPI: Broadcast +Note right of StakingAPI: Broadcast to network +StakingAPI-->>-User: Returns transaction status +```