From 29e93ee76fea9cf74b35288c4a5e471737c77b07 Mon Sep 17 00:00:00 2001 From: ausias-armesto Date: Tue, 1 Oct 2024 09:08:21 +0200 Subject: [PATCH] Unify workflows (#130) * Unify workflows * fix formatting * Use bigger node * Add docs to pipeline * Comment if * Change ignore parameters * Removing fetch * Fetching history * Adding new branch * Update docs before merge * Restore code * Create gh-pages --------- Co-authored-by: ausias-armesto --- .../scripts/commit-and-push-all-changes.sh | 27 - .github/scripts/config-git-info.sh | 11 - .github/workflows/README.md | 29 + .github/workflows/build.yaml | 67 + .github/workflows/docs.yml | 49 - .github/workflows/gh-pages.yaml | 40 + .github/workflows/merge.yaml | 55 + .github/workflows/node.js.yml | 74 - .github/workflows/publish.yml | 33 - .github/workflows/release.yaml | 144 ++ .gitignore | 5 +- .prettierignore | 9 + README.md | 4 + docs/.nojekyll | 1 + docs/README.md | 199 ++ docs/classes/HoprSDK.md | 59 + docs/classes/utils.sdkApiError.md | 238 ++ docs/modules.md | 2023 +++++++++++++++++ docs/modules/api.md | 1268 +++++++++++ docs/modules/flows.md | 151 ++ docs/modules/utils.md | 87 + docs/modules/web3.md | 210 ++ 22 files changed, 4587 insertions(+), 196 deletions(-) delete mode 100755 .github/scripts/commit-and-push-all-changes.sh delete mode 100755 .github/scripts/config-git-info.sh create mode 100644 .github/workflows/README.md create mode 100644 .github/workflows/build.yaml delete mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/gh-pages.yaml create mode 100644 .github/workflows/merge.yaml delete mode 100644 .github/workflows/node.js.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yaml create mode 100644 .prettierignore create mode 100644 docs/.nojekyll create mode 100644 docs/README.md create mode 100644 docs/classes/HoprSDK.md create mode 100644 docs/classes/utils.sdkApiError.md create mode 100644 docs/modules.md create mode 100644 docs/modules/api.md create mode 100644 docs/modules/flows.md create mode 100644 docs/modules/utils.md create mode 100644 docs/modules/web3.md diff --git a/.github/scripts/commit-and-push-all-changes.sh b/.github/scripts/commit-and-push-all-changes.sh deleted file mode 100755 index 4042b020..00000000 --- a/.github/scripts/commit-and-push-all-changes.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -test -z "${HOPR_GIT_MSG:-}" && ( - echo "Missing environment variable HOPR_GIT_MSG" - exit 1 -) -test -z "${HOPR_GITHUB_REF:-}" && ( - echo "Missing environment variable HOPR_GITHUB_REF" - exit 1 -) - -# Check if there are changes in the docs/ directory from docs generated steps before -if [ -n "$(git diff --name-only origin/docs -- docs/)" ]; then - git add --all docs/ - git add README.md - git commit -m "${HOPR_GIT_MSG}" - - # must get the latest version of the branch from origin before pushing - git pull origin docs --rebase --strategy-option recursive -X theirs # NB! when pull rebasing, ours is the incoming change (see https://stackoverflow.com/a/3443225) - git push origin HEAD:refs/heads/docs # Push changes to the 'docs' branch -else - echo "No changes found in the docs/ directory. Skipping commit and push." -fi diff --git a/.github/scripts/config-git-info.sh b/.github/scripts/config-git-info.sh deleted file mode 100755 index 85e01c2f..00000000 --- a/.github/scripts/config-git-info.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - -set -o errexit -set -o nounset -set -o pipefail - -if [ "${CI:-}" = "true" ] && [ -z "${ACT:-}" ]; then - git config user.email "tech@hoprnet.org" - git config user.name "HOPR CI robot" - git config pull.rebase false -fi diff --git a/.github/workflows/README.md b/.github/workflows/README.md new file mode 100644 index 00000000..ec4d2edb --- /dev/null +++ b/.github/workflows/README.md @@ -0,0 +1,29 @@ +# GitHub Workflows + +This document describes the GitHub workflows used in this project. + +## Build + +Builds, Lint, Test and publish every commit on a pull request + +The published artifact will have the version x.y.z-pr.+ +The artifact will be published as well in the release channel `next` so it can be used as `@hoprnet/hopr-sdk@next` + +## Merge PR + +Exclusively publish the closure of a pull request in the alpha release channel so it can be used as `@hoprnet/hopr-sdk@alpha` + +The published artifact will have the version x.y.z-pr. + +## Close release + +This is a workflow triggered manually from Github Actions [Close Release](https://github.com/hoprnet/hopr-sdk/actions/workflows/release.yaml). The tasks performed by this workflow include: + +- Publish the version in the latest release channel so it can be used as `@hoprnet/hopr-sdk@latest` +- Publish the artifact with version x.y.z +- Published in the internal Google Artifact Registry and in public NPM registry +- Create a Github release +- Tag code +- Add a changelog to the Github release with the list of PR merged during this release +- Bumps the new version by opening a new PR +- Sends a Zulip notification diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 00000000..e1137eb8 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,67 @@ +name: Build + +on: + pull_request: + types: [synchronize, opened, reopened] + +concurrency: + group: build + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: self-hosted-hoprnet-big + strategy: + matrix: + node-version: [20.x, 22.x] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: hoprnet/hopr-workflows/actions/setup-node-js@master + with: + node-version: ${{ matrix.node-version }} + + - name: Building + run: yarn build + + - name: Linting + run: yarn lint:ci + + - name: Formatting + run: yarn format:ci + + - name: Testing + run: yarn test + + publish: + name: Publish + runs-on: self-hosted-hoprnet-small + needs: build + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: hoprnet/hopr-workflows/actions/setup-node-js@master + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Setup GCP + id: gcp + uses: hoprnet/hopr-workflows/actions/setup-gcp@master + with: + google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} + login-artifact-registry: 'true' + + - name: Publish next version + run: | + BUILD_DATE=$(date +%Y%m%d%H%M%S) + PR_VERSION=$(jq -r '.version' package.json)-pr.${{ github.event.pull_request.number }} + jq --arg version "${PR_VERSION}-${BUILD_DATE}" '.version = $version' package.json > temp.json + mv temp.json package.json + yarn publish --no-git-tag-version --tag next + env: + NODE_AUTH_TOKEN: ${{ steps.gcp.outputs.access_token }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index 9f024578..00000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Generate Docs -env: - HOPR_GITHUB_REF: ${{ github.ref }} - -on: - push: - branches: [main] - paths-ignore: - - 'docs/**' - -concurrency: - # group runs by -- - group: ${{ github.workflow }}-${{ github.job }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - docs: - name: Generate Docs & Push - timeout-minutes: 2 - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Fetch docs branch - run: git fetch origin docs:refs/remotes/origin/docs - - - name: Setup Node.js environment - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: 'yarn' - cache-dependency-path: ./yarn.lock - - - name: Install dependencies - run: yarn --frozen-lockfile - - - name: Configure Git info - run: ./.github/scripts/config-git-info.sh - - - name: Create docs - run: yarn docs - - - name: Commit docs changes - # only commit changes when not running via act and when on final branches - if: ${{ !env.ACT }} - run: ./.github/scripts/commit-and-push-all-changes.sh - env: - HOPR_GIT_MSG: 'Re-generate API docs for packages' diff --git a/.github/workflows/gh-pages.yaml b/.github/workflows/gh-pages.yaml new file mode 100644 index 00000000..ab02eafa --- /dev/null +++ b/.github/workflows/gh-pages.yaml @@ -0,0 +1,40 @@ +name: Merge PR + +on: + pull_request: + types: [synchronize] + push: + branches: + - main + +concurrency: + group: docs + cancel-in-progress: false + +jobs: + merge: + name: Merge PR + runs-on: self-hosted-hoprnet-small + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: hoprnet/hopr-workflows/actions/setup-node-js@master + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Create docs + run: | + rm -rf docs/* + yarn docs + + - name: Deploy to GitHub Pages + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + publish_dir: docs + cname: hoprnet.org + force_orphan: true diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml new file mode 100644 index 00000000..5128f20c --- /dev/null +++ b/.github/workflows/merge.yaml @@ -0,0 +1,55 @@ +name: Merge PR + +on: + pull_request: + types: + - closed + branches: + - main + +concurrency: + group: merge + cancel-in-progress: false + +jobs: + merge: + name: Merge PR + runs-on: self-hosted-hoprnet-small + if: github.event.pull_request.merged == true + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: hoprnet/hopr-workflows/actions/setup-node-js@master + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Setup GCP + id: gcp + uses: hoprnet/hopr-workflows/actions/setup-gcp@master + with: + google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} + login-artifact-registry: 'true' + + - name: Unpublish PR commit versions + run: | + gcloud artifacts versions list --repository=npm --location=europe-west3 --project=hoprassociation --package="${{ vars.NPM_PACKAGE_NAME }}" --format=json 2> /dev/null | jq -r ' .[] | select(.name | contains("-pr.${{ github.event.pull_request.number }}-")).name' | sed 's/.*versions\///g' > pr_commit_versions.txt + while read -r version; do + echo "Unpublishing commit version: $version" + gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package "${{ vars.NPM_PACKAGE_NAME }}" $version + done < pr_commit_versions.txt + + - name: Publish alpha version + run: | + BUILD_DATE=$(date +%Y%m%d%H%M%S) + PR_VERSION=$(jq -r '.version' package.json)-pr.${{ github.event.pull_request.number }} + jq --arg version "${PR_VERSION}-${BUILD_DATE}" '.version = $version' package.json > temp.json + mv temp.json package.json + yarn publish --no-git-tag-version --tag next + jq --arg version "${PR_VERSION}" '.version = $version' package.json > temp.json + mv temp.json package.json + yarn publish --no-git-tag-version --tag alpha + env: + NODE_AUTH_TOKEN: ${{ steps.gcp.outputs.access_token }} diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 3474cb04..00000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,74 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [main] - paths-ignore: - - 'docs/**' - pull_request: - types: [opened, synchronize] - -jobs: - general: - name: CI run (node ${{ matrix.node-version }}) - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x, 21.x] - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ - - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'yarn' - cache-dependency-path: ./yarn.lock - - - name: Install dependencies - run: yarn --frozen-lockfile - - - name: Building - run: yarn build - - - name: Linting - run: yarn lint:ci - - - name: Formatting - run: yarn format:ci - - - name: Testing - run: yarn test - - # Run E2E tests - # e2e_testing: - # name: E2E tests - # needs: general - # timeout-minutes: 30 - # runs-on: ubuntu-latest - - # steps: - # - uses: actions/checkout@v3 - - # - name: Setup Node.js environment - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # cache: 'yarn' - # cache-dependency-path: ./yarn.lock - - # - name: Install dependencies - # run: yarn --frozen-lockfile - - # - name: Building - # run: yarn build - - # - name: Run E2E - # shell: bash - # run: yarn test:e2e diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index ac6c846c..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Publish Package to npmjs -on: - workflow_dispatch: - inputs: - tag: - type: string - required: true - default: latest - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Use Node.js 20 - uses: actions/setup-node@v3 - with: - node-version: 20 - cache: 'yarn' - cache-dependency-path: ./yarn.lock - registry-url: 'https://registry.npmjs.org' - - - name: Install dependencies - run: yarn --frozen-lockfile - - - name: Building - run: yarn build - - - name: Publish - run: yarn publish --tag ${{ github.event.inputs.tag }} - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..8ea87983 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,144 @@ +name: Close release + +on: + workflow_dispatch: + inputs: + release_type: + description: 'Next version type' + required: true + type: choice + default: 'patch' + options: + - patch + - minor + - major + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + name: Close release + runs-on: self-hosted-hoprnet-small + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: hoprnet/hopr-workflows/actions/setup-node-js@master + with: + node-version: ${{ vars.NODE_VERSION }} + + - name: Setup GCP + id: gcp + uses: hoprnet/hopr-workflows/actions/setup-gcp@master + with: + google-credentials: ${{ secrets.GOOGLE_HOPRASSOCIATION_CREDENTIALS_REGISTRY }} + login-artifact-registry: 'true' + + - name: Building + run: yarn build + + - name: Linting + run: yarn lint:ci + + - name: Formatting + run: yarn format:ci + + - name: Testing + run: yarn test + + - name: Generate changelog + id: changelog + run: | + PACKAGE_VERSION=$(node -p "require('./package.json').version") + echo "current_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT + gcloud artifacts versions list --repository=npm --location=europe-west3 --project=hoprassociation --package="${{ vars.NPM_PACKAGE_NAME }}" --format=json 2> /dev/null | jq --arg version "${PACKAGE_VERSION}-pr." -r ' .[] | select(.name | contains($version)).name' | sed "s/.*versions\/${PACKAGE_VERSION}-pr.//g" > pr_numbers.txt + echo "### Changelog" > changelog.md + echo "" >> changelog.md + while read -r pr_number; do + if [[ $pr_number == *"-"* ]]; then + echo "Deleting obsolete artifact ${PACKAGE_VERSION}-pr.${pr_number}" + gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package "${{ vars.NPM_PACKAGE_NAME }}" "${PACKAGE_VERSION}-pr.${pr_number}" + else + gh pr view ${pr_number} --json number,title | jq -r '"- #\(.number) - \(.title)"' >> changelog.md + fi + done < pr_numbers.txt + echo "" >> changelog.md + echo "### Npm package" >> changelog.md + echo "" >> changelog.md + echo "[Download package](https://www.npmjs.com/package/${{ vars.NPM_PACKAGE_NAME }}/v/${PACKAGE_VERSION})" >> changelog.md + cat changelog.md + echo "release_version=${PACKAGE_VERSION}" >> $GITHUB_OUTPUT + env: + GH_TOKEN: ${{ github.token }} + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + body_path: changelog.md + name: '${{ vars.NPM_PACKAGE_NAME }} - v${{ steps.changelog.outputs.release_version }}' + tag_name: v${{ steps.changelog.outputs.release_version }} + + - name: Unpublish PR versions + run: | + gcloud artifacts versions list --repository=npm --location=europe-west3 --project=hoprassociation --package="${{ vars.NPM_PACKAGE_NAME }}" --format=json 2> /dev/null | jq -r ' .[] | select(.name | contains("${{ steps.changelog.outputs.current_version }}-pr.")).name' | sed 's/.*versions\///g' > pr_versions.txt + while read -r version; do + echo "Unpublishing PR version: $version" + gcloud artifacts versions delete --delete-tags --quiet --repository=npm --location=europe-west3 --project=hoprassociation --package "${{ vars.NPM_PACKAGE_NAME }}" $version + done < pr_versions.txt + + - name: Publish to Google Artifact Registry + run: yarn publish --tag latest + env: + NODE_AUTH_TOKEN: ${{ steps.gcp.outputs.access_token }} + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ vars.NODE_VERSION }} + cache: 'yarn' + cache-dependency-path: ./yarn.lock + registry-url: https://registry.npmjs.org + + - name: Publish to npm + run: | + sed -i '/hoprassociation/d' .npmrc + yarn publish --no-git-tag-version --tag latest + git checkout .npmrc + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Bump Version + id: bump + run: | + npm version ${{ inputs.release_type }} --no-git-tag-version + BUMP_VERSION=$(node -p "require('./package.json').version") + echo "bump_version=${BUMP_VERSION}" >> $GITHUB_OUTPUT + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GH_RUNNER_TOKEN }} + commit-message: 'Bump to version ${{ steps.bump.outputs.bump_version }}' + base: main + title: 'Open release ${{ steps.bump.outputs.bump_version }}' + body: 'The scope of this PR is to bump the new release ${{ steps.bump.outputs.bump_version }}' + branch: bot/open-${{ inputs.release_type }}-${{ steps.bump.outputs.bump_version }} + delete-branch: true + assignees: ${{ github.actor }} + team-reviewers: '@hoprnet/hopr-products-team' + + - name: Notify new release + uses: zulip/github-actions-zulip/send-message@v1 + with: + api-key: ${{ secrets.ZULIP_API_KEY }} + email: ${{ secrets.ZULIP_EMAIL }} + organization-url: 'https://hopr.zulipchat.com' + type: 'stream' + to: 'Releases' + topic: 'main' + content: | + I'm thrilled to inform that version **${{ vars.NPM_PACKAGE_NAME }}@${{ steps.changelog.outputs.current_version }}** has been released. See [ChangeLog](https://github.com/${{ github.repository }}/releases/tag/v${{ steps.changelog.outputs.current_version }}) diff --git a/.gitignore b/.gitignore index e377cd50..2167ffc4 100644 --- a/.gitignore +++ b/.gitignore @@ -52,7 +52,8 @@ dist # e2e env file !/e2e/.env -# generated docs -docs/ # generated package hoprnet-hopr-sdk-*.tgz + +# Created by github pipeline +gha-creds-*.json diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..2cdfed29 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,9 @@ +# Ignore artifacts: +node_modules/ +build/ +public/ +*.min.js +src/index.tsx + +# Created by github pipeline +gha-creds-*.json \ No newline at end of file diff --git a/README.md b/README.md index 2adb9ada..cabe6cfa 100644 --- a/README.md +++ b/README.md @@ -193,3 +193,7 @@ async function getResource(payload: ResourcePayloadType) { throw new ZodError(parsedRes.error.issues); } ``` + +## Deployment process + +To contribute to this repository you will need to create a pull request. More information about the existing automated workflows can be found in [GitHub Actions](./.github/workflows/README.md) diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 00000000..e2ac6616 --- /dev/null +++ b/docs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 00000000..cabe6cfa --- /dev/null +++ b/docs/README.md @@ -0,0 +1,199 @@ +# @hoprnet/hopr-sdk + +## Description + +The `@hoprnet/hopr-sdk` package is a software development kit for interacting with [HOPRd's Rest API functions](https://docs.hoprnet.org/developers/rest-api). +It provides a set of functions that allow developers to interact with the HOPR protocol and perform various actions such as node and account management, messaging, address retrieval, balance retrieval, and withdrawal and other operations. + +## Installation + +To install the `@hoprnet/hopr-sdk` package, follow these steps: + +1. Make sure you have [node.js](https://nodejs.org) >=18 installed on your machine. +2. Open your terminal or command prompt. +3. Navigate to your project directory. +4. Run the following command to install the package using: + +```shell +npm install @hoprnet/hopr-sdk +``` + +or + +```shell +yarn add @hoprnet/hopr-sdk +``` + +## Usage + +You can use the `@hoprnet/hopr-sdk` in two different ways: + +### HoprSDK class + +By creating a new instance of the HoprSDK class. + +1. Import the HoprSDK class from the package: + +```ts +import { HoprSDK } from '@hoprnet/hopr-sdk'; +``` + +2. Create an instance of the HoprSDK class by providing the required parameters: + +```ts +const sdk = new HoprSDK({ + apiEndpoint: 'http://localhost:3001', // Replace with your HOPR API endopoint. + apiToken: 'your-api-token', // Replace with your API token + timeout: 5000 // Optional timeout in milliseconds (defaults to 30000) +}); +``` + +3. You can now use the `sdk` instance to access the available functions. For example, to get the HOPR and native addresses associated with the node: + +```ts +const addresses = await sdk.api.account.getAddresses(); + +console.log(addresses); +``` + +#### HOPR API functions + +By calling directly the rest API functions. + +1. Import the API object from the package: + +```ts +import { api } from '@hoprnet/hopr-sdk'; +``` + +- If your ts config includes `"moduleResolution": "nodenext" or "node16"`, you can import the functions like this: + +```ts +import { getAddresses } from '@hoprnet/hopr-sdk/api'; +``` + +2. Access the desired function, keep in mind that you'll need to provide a **payload object** with the `apiEndpoint` and `apiToken` for each individual function: + +```ts +const addresses = await api.getAddresses({ + apiEndpoint: 'http://localhost:3001', // Replace with your HOPR API endopoint + apiToken: 'your-api-token' // Replace with your API token + timeout: 5000 // Optional timeout in milliseconds (defaults to 30000) +}); + +console.log(addresses); +``` + +#### HOPR Flows functions + +By calling directly the flows functions. + +1. Import the flows object from the package: + +```ts +import { flows } from '@hoprnet/hopr-sdk'; +``` + +- If your ts config includes `"moduleResolution": "nodenext" or "node16"`, you can import the functions like this: + +```ts +import { openMultipleChannels } from '@hoprnet/hopr-sdk/flows'; +``` + +2. Access the desired function, keep in mind that you'll need to provide a **payload object** with the `apiEndpoint` and `apiToken` for each individual function: + +```ts +const res = await flows.openMultipleChannels({ + apiEndpoint: 'http://localhost:3001', // Replace with your HOPR API endopoint + apiToken: 'your-api-token' // Replace with your API token + timeout: 60e3 * 7 // Optional timeout in milliseconds (defaults to 30000) | This function takes really long +}); + +console.log(res); +``` + +## Documentation + +- [HoprSDK Class](https://github.com/hoprnet/hopr-sdk/blob/docs/docs/classes/HoprSDK.md) +- [API functions](https://github.com/hoprnet/hopr-sdk/blob/docs/docs/modules/api.md) +- [Flows functions](https://github.com/hoprnet/hopr-sdk/blob/docs/docs/modules/flows.md) +- [Utils](https://github.com/hoprnet/hopr-sdk/blob/docs/docs/modules/utils.md) +- [Type Aliases and Variables](https://github.com/hoprnet/hopr-sdk/blob/docs/docs/modules.md) + +## Project setup + +Source code resides under `src/` folder. + +- api: the api routes seperated by resource +- ethereum: ethereum ABIs and Addresses that are relevant to Hopr +- flows: common uses of multiple functions in a row +- types: api response and request types using zod +- utils: extras that are used throughout the repo, such as `fetchWithTimeout` + +## API + +### Directory Setup + +The api folder is used to find routes with ease. + +For example if you are looking for `GET /api/v3/node/info` you would go straight +to the node folder and find the file `getInfo.ts` alongside `getInfo.spec.ts` to +understand how this function will react to different responses from the node. + +In a more general sense it looks like this: + +``` +├── api +│ ├── resource (example: node) +│ │ ├── adapter.ts +│ │ ├── getResource.ts +│ │ ├── getResource.spec.ts +``` + +The adapter creates a resource class used by the [sdk class](./sdk.ts) + +#### Adding a new route + +The resource of the route can be seen after the `v3` keyword, for example in this example `/api/v3/node/info` the resource is `node`. + +##### New Resource + +- Create a the resource folder that must contain: adapter.ts and functions with tests. + +##### Exisiting Resource + +- Add the function to the resource folder with tests showing how the route would react to + different status codes + +#### Basic function structure + +```Typescript +async function getResource(payload: ResourcePayloadType) { + const rawResponse = await fetchResource() + + // received unexpected error from server + if (isServerError(rawResponse)) { + throw new Error(); + } + + // received expected response + // this can either be done with a Zod object or a status code + if (receivedExpectedResponse(rawResponse)) { + return parseResponse(rawResponse); + } + + // check if response has the structure of an expected sdk api error + if (isApiErrorResponse(rawResponse)) { + throw new sdkApiError(); + } + + // if we get to this point then we could not parse the response + // and it is not unexpected error + // we probably need to update the zod type + throw new ZodError(parsedRes.error.issues); +} +``` + +## Deployment process + +To contribute to this repository you will need to create a pull request. More information about the existing automated workflows can be found in [GitHub Actions](./.github/workflows/README.md) diff --git a/docs/classes/HoprSDK.md b/docs/classes/HoprSDK.md new file mode 100644 index 00000000..e9d35dd9 --- /dev/null +++ b/docs/classes/HoprSDK.md @@ -0,0 +1,59 @@ +# Class: HoprSDK + +Main SDK class that exposes all functionality of the HOPR SDK. + +## Table of contents + +### Constructors + +- [constructor](HoprSDK.md#constructor) + +### Properties + +- [api](HoprSDK.md#api) +- [flows](HoprSDK.md#flows) + +## Constructors + +### constructor + +• **new HoprSDK**(`«destructured»`): [`HoprSDK`](HoprSDK.md) + +Creates a new instance of the HOPR SDK. + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `«destructured»` | `Object` | +| › `apiEndpoint` | `string` | +| › `apiToken` | `string` | +| › `timeout?` | `number` | + +#### Returns + +[`HoprSDK`](HoprSDK.md) + +#### Defined in + +[src/sdk.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/sdk.ts#L15) + +## Properties + +### api + +• **api**: `ApiAdapter` + +#### Defined in + +[src/sdk.ts:7](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/sdk.ts#L7) + +___ + +### flows + +• **flows**: `FlowsAdapter` + +#### Defined in + +[src/sdk.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/sdk.ts#L8) diff --git a/docs/classes/utils.sdkApiError.md b/docs/classes/utils.sdkApiError.md new file mode 100644 index 00000000..9fd18bca --- /dev/null +++ b/docs/classes/utils.sdkApiError.md @@ -0,0 +1,238 @@ +# Class: sdkApiError + +[utils](../modules/utils.md).sdkApiError + +Represents an HOPR SDK API error. + +## Hierarchy + +- `Error` + + ↳ **`sdkApiError`** + +## Table of contents + +### Constructors + +- [constructor](utils.sdkApiError.md#constructor) + +### Properties + +- [description](utils.sdkApiError.md#description) +- [hoprdErrorPayload](utils.sdkApiError.md#hoprderrorpayload) +- [message](utils.sdkApiError.md#message) +- [name](utils.sdkApiError.md#name) +- [stack](utils.sdkApiError.md#stack) +- [status](utils.sdkApiError.md#status) +- [statusText](utils.sdkApiError.md#statustext) +- [prepareStackTrace](utils.sdkApiError.md#preparestacktrace) +- [stackTraceLimit](utils.sdkApiError.md#stacktracelimit) + +### Methods + +- [captureStackTrace](utils.sdkApiError.md#capturestacktrace) + +## Constructors + +### constructor + +• **new sdkApiError**(`customError`): [`sdkApiError`](utils.sdkApiError.md) + +Creates a new instance of the APIError class. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `customError` | `Object` | An object containing custom error properties. | +| `customError.description?` | `string` | - | +| `customError.hoprdErrorPayload?` | `Object` | - | +| `customError.hoprdErrorPayload.error?` | `string` | - | +| `customError.hoprdErrorPayload.status` | `string` | - | +| `customError.status` | `number` | - | +| `customError.statusText` | `string` | - | + +#### Returns + +[`sdkApiError`](utils.sdkApiError.md) + +#### Overrides + +Error.constructor + +#### Defined in + +[src/utils/sdkApiError.ts:41](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/sdkApiError.ts#L41) + +## Properties + +### description + +• `Optional` **description**: `string` + +Descriton of the error + +#### Defined in + +[src/utils/sdkApiError.ts:35](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/sdkApiError.ts#L35) + +___ + +### hoprdErrorPayload + +• `Optional` **hoprdErrorPayload**: `Object` + +Error Object + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `error?` | `string` | +| `status` | `string` | + +#### Defined in + +[src/utils/sdkApiError.ts:30](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/sdkApiError.ts#L30) + +___ + +### message + +• **message**: `string` + +#### Inherited from + +Error.message + +#### Defined in + +node_modules/typescript/lib/lib.es5.d.ts:1077 + +___ + +### name + +• **name**: `string` + +#### Inherited from + +Error.name + +#### Defined in + +node_modules/typescript/lib/lib.es5.d.ts:1076 + +___ + +### stack + +• `Optional` **stack**: `string` + +#### Inherited from + +Error.stack + +#### Defined in + +node_modules/typescript/lib/lib.es5.d.ts:1078 + +___ + +### status + +• **status**: `number` + +The status code associated with the error + +#### Defined in + +[src/utils/sdkApiError.ts:20](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/sdkApiError.ts#L20) + +___ + +### statusText + +• **statusText**: `string` + +The status message associated with the error. + +#### Defined in + +[src/utils/sdkApiError.ts:25](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/sdkApiError.ts#L25) + +___ + +### prepareStackTrace + +▪ `Static` `Optional` **prepareStackTrace**: (`err`: `Error`, `stackTraces`: `CallSite`[]) => `any` + +Optional override for formatting stack traces + +**`See`** + +https://v8.dev/docs/stack-trace-api#customizing-stack-traces + +#### Type declaration + +▸ (`err`, `stackTraces`): `any` + +##### Parameters + +| Name | Type | +| :------ | :------ | +| `err` | `Error` | +| `stackTraces` | `CallSite`[] | + +##### Returns + +`any` + +#### Inherited from + +Error.prepareStackTrace + +#### Defined in + +node_modules/@types/node/globals.d.ts:28 + +___ + +### stackTraceLimit + +▪ `Static` **stackTraceLimit**: `number` + +#### Inherited from + +Error.stackTraceLimit + +#### Defined in + +node_modules/@types/node/globals.d.ts:30 + +## Methods + +### captureStackTrace + +▸ **captureStackTrace**(`targetObject`, `constructorOpt?`): `void` + +Create .stack property on a target object + +#### Parameters + +| Name | Type | +| :------ | :------ | +| `targetObject` | `object` | +| `constructorOpt?` | `Function` | + +#### Returns + +`void` + +#### Inherited from + +Error.captureStackTrace + +#### Defined in + +node_modules/@types/node/globals.d.ts:21 diff --git a/docs/modules.md b/docs/modules.md new file mode 100644 index 00000000..17d1c550 --- /dev/null +++ b/docs/modules.md @@ -0,0 +1,2023 @@ +# @hoprnet/hopr-sdk + +## Table of contents + +### Namespaces + +- [api](modules/api.md) +- [flows](modules/flows.md) +- [utils](modules/utils.md) +- [web3](modules/web3.md) + +### Classes + +- [HoprSDK](classes/HoprSDK.md) + +### Type Aliases + +- [AggregateChannelTicketsPayloadType](modules.md#aggregatechannelticketspayloadtype) +- [AliasPayloadType](modules.md#aliaspayloadtype) +- [ApiErrorResponseType](modules.md#apierrorresponsetype) +- [BasePayloadType](modules.md#basepayloadtype) +- [ChainPayloadType](modules.md#chainpayloadtype) +- [CloseChannelPayloadType](modules.md#closechannelpayloadtype) +- [CloseChannelResponseType](modules.md#closechannelresponsetype) +- [CreateTokenPayloadType](modules.md#createtokenpayloadtype) +- [CreateTokenResponseType](modules.md#createtokenresponsetype) +- [DeleteMessagesPayloadType](modules.md#deletemessagespayloadtype) +- [DeleteTokenPayloadType](modules.md#deletetokenpayloadtype) +- [FundChannelsPayloadType](modules.md#fundchannelspayloadtype) +- [FundChannelsResponseType](modules.md#fundchannelsresponsetype) +- [GetAddressesResponseType](modules.md#getaddressesresponsetype) +- [GetAliasResponseType](modules.md#getaliasresponsetype) +- [GetAliasesResponseType](modules.md#getaliasesresponsetype) +- [GetBalancesResponseType](modules.md#getbalancesresponsetype) +- [GetChannelPayloadType](modules.md#getchannelpayloadtype) +- [GetChannelResponseType](modules.md#getchannelresponsetype) +- [GetChannelTicketsPayloadType](modules.md#getchannelticketspayloadtype) +- [GetChannelTicketsResponseType](modules.md#getchannelticketsresponsetype) +- [GetChannelsPayloadType](modules.md#getchannelspayloadtype) +- [GetChannelsResponseType](modules.md#getchannelsresponsetype) +- [GetConfigurationPayloadType](modules.md#getconfigurationpayloadtype) +- [GetConfigurationResponseType](modules.md#getconfigurationresponsetype) +- [GetEntryNodesResponseType](modules.md#getentrynodesresponsetype) +- [GetInfoResponseType](modules.md#getinforesponsetype) +- [GetMessagesSizePayloadType](modules.md#getmessagessizepayloadtype) +- [GetMessagesSizeResponseType](modules.md#getmessagessizeresponsetype) +- [GetPeerPayloadType](modules.md#getpeerpayloadtype) +- [GetPeerResponseType](modules.md#getpeerresponsetype) +- [GetPeersPayloadType](modules.md#getpeerspayloadtype) +- [GetPeersResponseType](modules.md#getpeersresponsetype) +- [GetTicketPricePayloadType](modules.md#getticketpricepayloadtype) +- [GetTicketPriceResponseType](modules.md#getticketpriceresponsetype) +- [GetTicketStatisticsResponseType](modules.md#getticketstatisticsresponsetype) +- [GetTokenResponseType](modules.md#gettokenresponsetype) +- [IsNodeHealthyPayloadType](modules.md#isnodehealthypayloadtype) +- [IsNodeHealthyResponseType](modules.md#isnodehealthyresponsetype) +- [IsNodeReadyPayloadType](modules.md#isnodereadypayloadtype) +- [IsNodeReadyResponseType](modules.md#isnodereadyresponsetype) +- [IsNodeStartedPayloadType](modules.md#isnodestartedpayloadtype) +- [IsNodeStartedResponseType](modules.md#isnodestartedresponsetype) +- [NetworkPayloadType](modules.md#networkpayloadtype) +- [OpenChannelPayloadType](modules.md#openchannelpayloadtype) +- [OpenChannelResponseType](modules.md#openchannelresponsetype) +- [PeekAllMessagesPayloadType](modules.md#peekallmessagespayloadtype) +- [PeekAllMessagesResponseType](modules.md#peekallmessagesresponsetype) +- [PeekMessagePayloadType](modules.md#peekmessagepayloadtype) +- [PeekMessageResponseType](modules.md#peekmessageresponsetype) +- [PingPeerPayloadType](modules.md#pingpeerpayloadtype) +- [PingPeerResponseType](modules.md#pingpeerresponsetype) +- [PopAllMessagesPayloadType](modules.md#popallmessagespayloadtype) +- [PopAllMessagesResponseType](modules.md#popallmessagesresponsetype) +- [PopMessagePayloadType](modules.md#popmessagepayloadtype) +- [PopMessageResponseType](modules.md#popmessageresponsetype) +- [RedeemChannelTicketsPayloadType](modules.md#redeemchannelticketspayloadtype) +- [RemoveBasicAuthenticationPayloadType](modules.md#removebasicauthenticationpayloadtype) +- [SendMessagePayloadType](modules.md#sendmessagepayloadtype) +- [SetAliasPayloadType](modules.md#setaliaspayloadtype) +- [StrategiesPayloadType](modules.md#strategiespayloadtype) +- [WithdrawPayloadType](modules.md#withdrawpayloadtype) +- [createWsUrlType](modules.md#createwsurltype) + +### Variables + +- [AggregateChannelTicketsPayload](modules.md#aggregatechannelticketspayload) +- [AliasPayload](modules.md#aliaspayload) +- [ApiErrorResponse](modules.md#apierrorresponse) +- [BasePayload](modules.md#basepayload) +- [Channel](modules.md#channel) +- [CloseChannelPayload](modules.md#closechannelpayload) +- [CloseChannelResponse](modules.md#closechannelresponse) +- [CreateTokenPayload](modules.md#createtokenpayload) +- [CreateTokenResponse](modules.md#createtokenresponse) +- [DeleteMessagesPayload](modules.md#deletemessagespayload) +- [DeleteTokenPayload](modules.md#deletetokenpayload) +- [FundChannelsPayload](modules.md#fundchannelspayload) +- [FundChannelsResponse](modules.md#fundchannelsresponse) +- [GetAddressesResponse](modules.md#getaddressesresponse) +- [GetAliasResponse](modules.md#getaliasresponse) +- [GetAliasesResponse](modules.md#getaliasesresponse) +- [GetBalancesResponse](modules.md#getbalancesresponse) +- [GetChannelPayload](modules.md#getchannelpayload) +- [GetChannelResponse](modules.md#getchannelresponse) +- [GetChannelTicketsPayload](modules.md#getchannelticketspayload) +- [GetChannelTicketsResponse](modules.md#getchannelticketsresponse) +- [GetChannelsPayload](modules.md#getchannelspayload) +- [GetChannelsResponse](modules.md#getchannelsresponse) +- [GetConfigurationPayload](modules.md#getconfigurationpayload) +- [GetConfigurationResponse](modules.md#getconfigurationresponse) +- [GetEntryNodesResponse](modules.md#getentrynodesresponse) +- [GetInfoResponse](modules.md#getinforesponse) +- [GetMessagesSizePayload](modules.md#getmessagessizepayload) +- [GetMessagesSizeResponse](modules.md#getmessagessizeresponse) +- [GetPeerPayload](modules.md#getpeerpayload) +- [GetPeerResponse](modules.md#getpeerresponse) +- [GetPeersPayload](modules.md#getpeerspayload) +- [GetPeersResponse](modules.md#getpeersresponse) +- [GetTicketPricePayload](modules.md#getticketpricepayload) +- [GetTicketPriceResponse](modules.md#getticketpriceresponse) +- [GetTicketStatisticsResponse](modules.md#getticketstatisticsresponse) +- [GetTokenResponse](modules.md#gettokenresponse) +- [IsNodeHealthyPayload](modules.md#isnodehealthypayload) +- [IsNodeHealthyResponse](modules.md#isnodehealthyresponse) +- [IsNodeReadyPayload](modules.md#isnodereadypayload) +- [IsNodeReadyResponse](modules.md#isnodereadyresponse) +- [IsNodeStartedPayload](modules.md#isnodestartedpayload) +- [IsNodeStartedResponse](modules.md#isnodestartedresponse) +- [OpenChannelPayload](modules.md#openchannelpayload) +- [OpenChannelResponse](modules.md#openchannelresponse) +- [PeekAllMessagesPayload](modules.md#peekallmessagespayload) +- [PeekAllMessagesResponse](modules.md#peekallmessagesresponse) +- [PeekMessagePayload](modules.md#peekmessagepayload) +- [PeekMessageResponse](modules.md#peekmessageresponse) +- [PeerAnnounced](modules.md#peerannounced) +- [PeerConnected](modules.md#peerconnected) +- [PingPeerPayload](modules.md#pingpeerpayload) +- [PingPeerResponse](modules.md#pingpeerresponse) +- [PopAllMessagesPayload](modules.md#popallmessagespayload) +- [PopAllMessagesResponse](modules.md#popallmessagesresponse) +- [PopMessagePayload](modules.md#popmessagepayload) +- [PopMessageResponse](modules.md#popmessageresponse) +- [ReceivedMessage](modules.md#receivedmessage) +- [RedeemChannelTicketsPayload](modules.md#redeemchannelticketspayload) +- [SendMessagePayload](modules.md#sendmessagepayload) +- [SetAliasPayload](modules.md#setaliaspayload) +- [Ticket](modules.md#ticket) +- [TokenCapability](modules.md#tokencapability) +- [WithdrawPayload](modules.md#withdrawpayload) +- [WithdrawResponse](modules.md#withdrawresponse) +- [createWsUrlPayload](modules.md#createwsurlpayload) + +## Type Aliases + +### AggregateChannelTicketsPayloadType + +Ƭ **AggregateChannelTicketsPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:48](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L48) + +___ + +### AliasPayloadType + +Ƭ **AliasPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `alias` | `string` | - | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/aliases.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L12) + +___ + +### ApiErrorResponseType + +Ƭ **ApiErrorResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `error?` | `string` | +| `status` | `string` | + +#### Defined in + +[src/types/ApiErrorResponse.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/ApiErrorResponse.ts#L8) + +___ + +### BasePayloadType + +Ƭ **BasePayloadType**: `Object` + +Represents the inferred TypeScript type from BasicAuthenticationPayload. + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/general.ts:26](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/general.ts#L26) + +___ + +### ChainPayloadType + +Ƭ **ChainPayloadType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `block_time` | ``null`` \| `number` | +| `chain_id` | `number` | +| `default_provider` | ``null`` \| `string` | +| `description` | ``null`` \| `string` | +| `etherscan_api_url` | ``null`` \| `string` | +| `hopr_token_name` | ``null`` \| `string` | +| `live` | `boolean` | +| `max_fee_per_gas` | ``null`` \| `string` | +| `max_priority_fee_per_gas` | ``null`` \| `string` | +| `native_token_name` | ``null`` \| `string` | +| `tags` | ``null`` \| `string`[] | + +#### Defined in + +[src/types/configuration.ts:53](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L53) + +___ + +### CloseChannelPayloadType + +Ƭ **CloseChannelPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:134](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L134) + +___ + +### CloseChannelResponseType + +Ƭ **CloseChannelResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `channelStatus` | ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` | +| `receipt` | `string` | + +#### Defined in + +[src/types/channels.ts:141](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L141) + +___ + +### CreateTokenPayloadType + +Ƭ **CreateTokenPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `capabilities` | \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }[] | - | +| `description` | `string` | - | +| `lifetime` | `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/tokens.ts:77](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L77) + +___ + +### CreateTokenResponseType + +Ƭ **CreateTokenResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `token` | `string` | + +#### Defined in + +[src/types/tokens.ts:83](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L83) + +___ + +### DeleteMessagesPayloadType + +Ƭ **DeleteMessagesPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag?` | `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:34](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L34) + +___ + +### DeleteTokenPayloadType + +Ƭ **DeleteTokenPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `id` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/tokens.ts:106](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L106) + +___ + +### FundChannelsPayloadType + +Ƭ **FundChannelsPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `amount` | `string` | - | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:61](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L61) + +___ + +### FundChannelsResponseType + +Ƭ **FundChannelsResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `receipt` | `string` | + +#### Defined in + +[src/types/channels.ts:67](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L67) + +___ + +### GetAddressesResponseType + +Ƭ **GetAddressesResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `hopr` | `string` | +| `native` | `string` | + +#### Defined in + +[src/types/account.ts:27](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L27) + +___ + +### GetAliasResponseType + +Ƭ **GetAliasResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `peerId` | `string` | + +#### Defined in + +[src/types/aliases.ts:39](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L39) + +___ + +### GetAliasesResponseType + +Ƭ **GetAliasesResponseType**: `Record`\<`string`, `string`\> + +#### Defined in + +[src/types/aliases.ts:20](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L20) + +___ + +### GetBalancesResponseType + +Ƭ **GetBalancesResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `hopr` | `string` | +| `native` | `string` | +| `safeHopr` | `string` | +| `safeHoprAllowance` | `string` | +| `safeNative` | `string` | + +#### Defined in + +[src/types/account.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L16) + +___ + +### GetChannelPayloadType + +Ƭ **GetChannelPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:149](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L149) + +___ + +### GetChannelResponseType + +Ƭ **GetChannelResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `balance` | `string` | +| `channelEpoch` | `number` | +| `channelId` | `string` | +| `closureTime` | `number` | +| `destinationAddress` | `string` | +| `destinationPeerId` | `string` | +| `sourceAddress` | `string` | +| `sourcePeerId` | `string` | +| `status` | ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` | +| `ticketIndex` | `string` | + +#### Defined in + +[src/types/channels.ts:153](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L153) + +___ + +### GetChannelTicketsPayloadType + +Ƭ **GetChannelTicketsPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:108](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L108) + +___ + +### GetChannelTicketsResponseType + +Ƭ **GetChannelTicketsResponseType**: \{ `amount`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `index`: `number` ; `indexOffset`: `number` ; `signature`: `string` ; `winProb`: `string` }[] + +#### Defined in + +[src/types/channels.ts:124](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L124) + +___ + +### GetChannelsPayloadType + +Ƭ **GetChannelsPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `fullTopology?` | `boolean` | - | +| `includingClosed?` | `boolean` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:92](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L92) + +___ + +### GetChannelsResponseType + +Ƭ **GetChannelsResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `all` | \{ `balance`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `closureTime`: `number` ; `destinationAddress`: `string` ; `destinationPeerId`: `string` ; `sourceAddress`: `string` ; `sourcePeerId`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `ticketIndex`: `string` }[] | +| `incoming` | \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] | +| `outgoing` | \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] | + +#### Defined in + +[src/types/channels.ts:100](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L100) + +___ + +### GetConfigurationPayloadType + +Ƭ **GetConfigurationPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/configuration.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L10) + +___ + +### GetConfigurationResponseType + +Ƭ **GetConfigurationResponseType**: `any` + +#### Defined in + +[src/types/configuration.ts:164](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L164) + +___ + +### GetEntryNodesResponseType + +Ƭ **GetEntryNodesResponseType**: `Record`\<`string`, \{ `isEligible`: `boolean` ; `multiaddrs`: `string`[] }\> + +#### Defined in + +[src/types/node.ts:79](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L79) + +___ + +### GetInfoResponseType + +Ƭ **GetInfoResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `announcedAddress` | `string`[] | +| `chain` | `string` | +| `channelClosurePeriod` | `number` | +| `connectivityStatus` | ``"Unknown"`` \| ``"Red"`` \| ``"Orange"`` \| ``"Yellow"`` \| ``"Green"`` | +| `hoprChannels` | `string` | +| `hoprManagementModule` | `string` | +| `hoprNetworkRegistry?` | `string` | +| `hoprNodeSafe` | `string` | +| `hoprNodeSafeRegistry?` | `string` | +| `hoprToken` | `string` | +| `indexBlockPrevChecksum?` | `number` | +| `indexerBlock?` | `number` | +| `indexerChecksum?` | `string` | +| `isEligible` | `boolean` | +| `listeningAddress` | `string`[] | +| `network` | `string` | + +#### Defined in + +[src/types/node.ts:66](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L66) + +___ + +### GetMessagesSizePayloadType + +Ƭ **GetMessagesSizePayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag` | `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:42](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L42) + +___ + +### GetMessagesSizeResponseType + +Ƭ **GetMessagesSizeResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `size` | `number` | + +#### Defined in + +[src/types/messages.ts:48](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L48) + +___ + +### GetPeerPayloadType + +Ƭ **GetPeerPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `peerId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/peers.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L12) + +___ + +### GetPeerResponseType + +Ƭ **GetPeerResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `announced` | `string`[] | +| `observed` | `string`[] | + +#### Defined in + +[src/types/peers.ts:19](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L19) + +___ + +### GetPeersPayloadType + +Ƭ **GetPeersPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `quality?` | `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/node.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L12) + +___ + +### GetPeersResponseType + +Ƭ **GetPeersResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `announced` | \{ `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` }[] | +| `connected` | \{ `backoff`: `number` ; `heartbeats`: \{ `sent`: `number` ; `success`: `number` } ; `isNew`: `boolean` ; `lastSeen`: `number` ; `lastSeenLatency`: `number` ; `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` ; `quality`: `number` ; `reportedVersion`: `string` }[] | + +#### Defined in + +[src/types/node.ts:41](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L41) + +___ + +### GetTicketPricePayloadType + +Ƭ **GetTicketPricePayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/network.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/network.ts#L10) + +___ + +### GetTicketPriceResponseType + +Ƭ **GetTicketPriceResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `price` | `string` | + +#### Defined in + +[src/types/network.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/network.ts#L16) + +___ + +### GetTicketStatisticsResponseType + +Ƭ **GetTicketStatisticsResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `neglectedValue` | `string` | +| `redeemedValue` | `string` | +| `rejectedValue` | `string` | +| `unredeemedValue` | `string` | +| `winningCount` | `number` | + +#### Defined in + +[src/types/tickets.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tickets.ts#L15) + +___ + +### GetTokenResponseType + +Ƭ **GetTokenResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `capabilities` | \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }[] | +| `description?` | `string` | +| `id` | `string` | +| `valid_until?` | `number` | + +#### Defined in + +[src/types/tokens.ts:96](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L96) + +___ + +### IsNodeHealthyPayloadType + +Ƭ **IsNodeHealthyPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/checks.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L10) + +___ + +### IsNodeHealthyResponseType + +Ƭ **IsNodeHealthyResponseType**: `boolean` + +#### Defined in + +[src/types/checks.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L14) + +___ + +### IsNodeReadyPayloadType + +Ƭ **IsNodeReadyPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/checks.ts:22](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L22) + +___ + +### IsNodeReadyResponseType + +Ƭ **IsNodeReadyResponseType**: `boolean` + +#### Defined in + +[src/types/checks.ts:26](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L26) + +___ + +### IsNodeStartedPayloadType + +Ƭ **IsNodeStartedPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/checks.ts:34](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L34) + +___ + +### IsNodeStartedResponseType + +Ƭ **IsNodeStartedResponseType**: `boolean` + +#### Defined in + +[src/types/checks.ts:38](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L38) + +___ + +### NetworkPayloadType + +Ƭ **NetworkPayloadType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `addresses` | \{ `announcements`: `string` ; `channels`: `string` ; `module_implementation`: `string` ; `network_registry`: `string` ; `network_registry_proxy`: `string` ; `node_safe_registry`: `string` ; `node_stake_v2_factory`: `string` ; `ticket_price_oracle`: `string` ; `token`: `string` } | +| `addresses.announcements` | `string` | +| `addresses.channels` | `string` | +| `addresses.module_implementation` | `string` | +| `addresses.network_registry` | `string` | +| `addresses.network_registry_proxy` | `string` | +| `addresses.node_safe_registry` | `string` | +| `addresses.node_stake_v2_factory` | `string` | +| `addresses.ticket_price_oracle` | `string` | +| `addresses.token` | `string` | +| `chain` | `string` | +| `confirmations` | `number` | +| `environment_type` | `string` | +| `indexer_start_block_number` | `number` | +| `max_block_range` | `number` | +| `tags` | ``null`` \| `string`[] | +| `tx_polling_interval` | `number` | +| `version_range` | `string` | + +#### Defined in + +[src/types/configuration.ts:36](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L36) + +___ + +### OpenChannelPayloadType + +Ƭ **OpenChannelPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `amount` | `string` | - | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `peerAddress` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:76](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L76) + +___ + +### OpenChannelResponseType + +Ƭ **OpenChannelResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `channelId` | `string` | +| `transactionReceipt` | `string` | + +#### Defined in + +[src/types/channels.ts:83](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L83) + +___ + +### PeekAllMessagesPayloadType + +Ƭ **PeekAllMessagesPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag?` | ``null`` \| `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:96](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L96) + +___ + +### PeekAllMessagesResponseType + +Ƭ **PeekAllMessagesResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `messages` | \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] | + +#### Defined in + +[src/types/messages.ts:102](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L102) + +___ + +### PeekMessagePayloadType + +Ƭ **PeekMessagePayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag?` | ``null`` \| `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:84](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L84) + +___ + +### PeekMessageResponseType + +Ƭ **PeekMessageResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `body` | `string` | +| `receivedAt` | `number` | +| `tag` | `number` | + +#### Defined in + +[src/types/messages.ts:88](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L88) + +___ + +### PingPeerPayloadType + +Ƭ **PingPeerPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `peerId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/peers.ts:29](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L29) + +___ + +### PingPeerResponseType + +Ƭ **PingPeerResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `latency` | `number` | +| `reportedVersion` | `string` | + +#### Defined in + +[src/types/peers.ts:36](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L36) + +___ + +### PopAllMessagesPayloadType + +Ƭ **PopAllMessagesPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag?` | ``null`` \| `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:70](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L70) + +___ + +### PopAllMessagesResponseType + +Ƭ **PopAllMessagesResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `messages` | \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] | + +#### Defined in + +[src/types/messages.ts:76](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L76) + +___ + +### PopMessagePayloadType + +Ƭ **PopMessagePayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `tag?` | ``null`` \| `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:58](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L58) + +___ + +### PopMessageResponseType + +Ƭ **PopMessageResponseType**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `body` | `string` | +| `receivedAt` | `number` | +| `tag` | `number` | + +#### Defined in + +[src/types/messages.ts:62](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L62) + +___ + +### RedeemChannelTicketsPayloadType + +Ƭ **RedeemChannelTicketsPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `channelId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/channels.ts:36](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L36) + +___ + +### RemoveBasicAuthenticationPayloadType + +Ƭ **RemoveBasicAuthenticationPayloadType**\<`T`\>: `Pick`\<`T`, `Exclude`\\> + +Removes the basic authentication properties from a payload type. + +**`Typeparam`** + +T - The payload type from which to remove the properties. + +#### Type parameters + +| Name | Type | +| :------ | :------ | +| `T` | extends [`BasePayloadType`](modules.md#basepayloadtype) | + +#### Defined in + +[src/types/general.ts:32](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/general.ts#L32) + +___ + +### SendMessagePayloadType + +Ƭ **SendMessagePayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `body` | `string` | - | +| `hops?` | `number` | - | +| `path?` | `string`[] | - | +| `peerId` | `string` | - | +| `tag` | `number` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/messages.ts:26](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L26) + +___ + +### SetAliasPayloadType + +Ƭ **SetAliasPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `alias` | `string` | - | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `peerId` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/aliases.ts:31](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L31) + +___ + +### StrategiesPayloadType + +Ƭ **StrategiesPayloadType**: `Record`\<`string`, `Record`\<`string`, `string` \| `number` \| `boolean`\>\> + +#### Defined in + +[src/types/configuration.ts:61](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L61) + +___ + +### WithdrawPayloadType + +Ƭ **WithdrawPayloadType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `amount` | `string` | - | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `currency` | ``"NATIVE"`` \| ``"HOPR"`` | - | +| `ethereumAddress` | `string` | - | +| `timeout?` | `number` | optional timeout for the requests | + +#### Defined in + +[src/types/account.ts:39](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L39) + +___ + +### createWsUrlType + +Ƭ **createWsUrlType**: `Object` + +#### Type declaration + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `apiToken` | `string` | The API token for authentication. | +| `path?` | `string` | optional path for the websocker | + +#### Defined in + +[src/types/websocket.ts:24](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/websocket.ts#L24) + +## Variables + +### AggregateChannelTicketsPayload + +• `Const` **AggregateChannelTicketsPayload**: `ZodObject`\<\{ `apiEndpoint`: `ZodUnion`\<[`ZodString`, `ZodType`\<`URL`, `ZodTypeDef`, `URL`\>]\> ; `apiToken`: `ZodString` ; `channelId`: `ZodString` ; `timeout`: `ZodOptional`\<`ZodNumber`\> }, ``"strip"``, `ZodTypeAny`, \{ `apiEndpoint`: `string` \| `URL` & `undefined` \| `string` \| `URL` ; `apiToken`: `string` ; `channelId`: `string` ; `timeout?`: `number` }, \{ `apiEndpoint`: `string` \| `URL` & `undefined` \| `string` \| `URL` ; `apiToken`: `string` ; `channelId`: `string` ; `timeout?`: `number` }\> + +Aggregate channel tickets + +#### Defined in + +[src/types/channels.ts:44](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L44) + +___ + +### AliasPayload + +• `Const` **AliasPayload**: `ZodObject`\<[`AliasPayloadType`](modules.md#aliaspayloadtype)\> + +General + +#### Defined in + +[src/types/aliases.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L8) + +___ + +### ApiErrorResponse + +• `Const` **ApiErrorResponse**: `ZodObject`\<[`ApiErrorResponseType`](modules.md#apierrorresponsetype)\> + +#### Defined in + +[src/types/ApiErrorResponse.ts:3](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/ApiErrorResponse.ts#L3) + +___ + +### BasePayload + +• `Const` **BasePayload**: `ZodObject`\<[`BasePayloadType`](modules.md#basepayloadtype)\> + +Represents the minimum payload needed to interact with hoprd node. + +#### Defined in + +[src/types/general.ts:6](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/general.ts#L6) + +___ + +### Channel + +• `Const` **Channel**: `ZodObject`\<\{ `balance`: `ZodString` ; `id`: `ZodString` ; `peerAddress`: `ZodString` ; `status`: `ZodEnum`\<[``"Open"``, ``"PendingToClose"``, ``"Closed"``]\> = ChannelStatus }, ``"strip"``, `ZodTypeAny`, \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }, \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }\> + +#### Defined in + +[src/types/channels.ts:21](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L21) + +___ + +### CloseChannelPayload + +• `Const` **CloseChannelPayload**: `ZodObject`\<[`CloseChannelPayloadType`](modules.md#closechannelpayloadtype)\> + +Close channel + +#### Defined in + +[src/types/channels.ts:130](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L130) + +___ + +### CloseChannelResponse + +• `Const` **CloseChannelResponse**: `ZodObject`\<[`CloseChannelResponseType`](modules.md#closechannelresponsetype)\> + +#### Defined in + +[src/types/channels.ts:136](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L136) + +___ + +### CreateTokenPayload + +• `Const` **CreateTokenPayload**: `ZodObject`\<[`CreateTokenPayloadType`](modules.md#createtokenpayloadtype)\> + +createToken + +#### Defined in + +[src/types/tokens.ts:71](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L71) + +___ + +### CreateTokenResponse + +• `Const` **CreateTokenResponse**: `ZodObject`\<[`CreateTokenResponseType`](modules.md#createtokenresponsetype)\> + +#### Defined in + +[src/types/tokens.ts:79](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L79) + +___ + +### DeleteMessagesPayload + +• `Const` **DeleteMessagesPayload**: `ZodObject`\<[`DeleteMessagesPayloadType`](modules.md#deletemessagespayloadtype)\> + +Delete Messages + +#### Defined in + +[src/types/messages.ts:30](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L30) + +___ + +### DeleteTokenPayload + +• `Const` **DeleteTokenPayload**: `ZodObject`\<[`DeleteTokenPayloadType`](modules.md#deletetokenpayloadtype)\> + +deleteToken + +#### Defined in + +[src/types/tokens.ts:102](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L102) + +___ + +### FundChannelsPayload + +• `Const` **FundChannelsPayload**: `ZodObject`\<[`FundChannelsPayloadType`](modules.md#fundchannelspayloadtype)\> + +Fund channel + +#### Defined in + +[src/types/channels.ts:56](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L56) + +___ + +### FundChannelsResponse + +• `Const` **FundChannelsResponse**: `ZodObject`\<[`FundChannelsResponseType`](modules.md#fundchannelsresponsetype)\> + +#### Defined in + +[src/types/channels.ts:63](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L63) + +___ + +### GetAddressesResponse + +• `Const` **GetAddressesResponse**: `ZodObject`\<[`GetAddressesResponseType`](modules.md#getaddressesresponsetype)\> + +addresses + +#### Defined in + +[src/types/account.ts:22](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L22) + +___ + +### GetAliasResponse + +• `Const` **GetAliasResponse**: `ZodObject`\<[`GetAliasResponseType`](modules.md#getaliasresponsetype)\> + +getAlias + +#### Defined in + +[src/types/aliases.ts:37](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L37) + +___ + +### GetAliasesResponse + +• `Const` **GetAliasesResponse**: `ZodRecord`\<[`GetAliasesResponseType`](modules.md#getaliasesresponsetype)\> + +getAliases + +#### Defined in + +[src/types/aliases.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L18) + +___ + +### GetBalancesResponse + +• `Const` **GetBalancesResponse**: `ZodObject`\<[`GetBalancesResponseType`](modules.md#getbalancesresponsetype)\> + +balances + +#### Defined in + +[src/types/account.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L8) + +___ + +### GetChannelPayload + +• `Const` **GetChannelPayload**: `ZodObject`\<[`GetChannelPayloadType`](modules.md#getchannelpayloadtype)\> + +Get channel + +#### Defined in + +[src/types/channels.ts:145](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L145) + +___ + +### GetChannelResponse + +• `Const` **GetChannelResponse**: `ZodObject`\<[`GetChannelResponseType`](modules.md#getchannelresponsetype)\> = `TopologyChannel` + +#### Defined in + +[src/types/channels.ts:151](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L151) + +___ + +### GetChannelTicketsPayload + +• `Const` **GetChannelTicketsPayload**: `ZodObject`\<[`GetChannelTicketsPayloadType`](modules.md#getchannelticketspayloadtype)\> + +Get channel tickets + +#### Defined in + +[src/types/channels.ts:104](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L104) + +___ + +### GetChannelTicketsResponse + +• `Const` **GetChannelTicketsResponse**: `ZodArray`\<[`GetChannelTicketsResponseType`](modules.md#getchannelticketsresponsetype)\> + +#### Defined in + +[src/types/channels.ts:122](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L122) + +___ + +### GetChannelsPayload + +• `Const` **GetChannelsPayload**: `ZodObject`\<[`GetChannelsPayloadType`](modules.md#getchannelspayloadtype)\> + +Get channels + +#### Defined in + +[src/types/channels.ts:87](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L87) + +___ + +### GetChannelsResponse + +• `Const` **GetChannelsResponse**: `ZodObject`\<[`GetChannelsResponseType`](modules.md#getchannelsresponsetype)\> + +#### Defined in + +[src/types/channels.ts:94](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L94) + +___ + +### GetConfigurationPayload + +• `Const` **GetConfigurationPayload**: `ZodObject`\<[`GetConfigurationPayloadType`](modules.md#getconfigurationpayloadtype)\> = `BasePayload` + +Get node configuration + +#### Defined in + +[src/types/configuration.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L8) + +___ + +### GetConfigurationResponse + +• `Const` **GetConfigurationResponse**: `ZodAny`\<[`GetConfigurationResponseType`](modules.md#getconfigurationresponsetype)\> + +#### Defined in + +[src/types/configuration.ts:63](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/configuration.ts#L63) + +___ + +### GetEntryNodesResponse + +• `Const` **GetEntryNodesResponse**: `ZodRecord`\<[`GetEntryNodesResponseType`](modules.md#getentrynodesresponsetype)\> + +#### Defined in + +[src/types/node.ts:77](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L77) + +___ + +### GetInfoResponse + +• `Const` **GetInfoResponse**: `ZodObject`\<[`GetInfoResponseType`](modules.md#getinforesponsetype)\> + +Get Info + +#### Defined in + +[src/types/node.ts:47](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L47) + +___ + +### GetMessagesSizePayload + +• `Const` **GetMessagesSizePayload**: `ZodObject`\<[`GetMessagesSizePayloadType`](modules.md#getmessagessizepayloadtype)\> + +Get Messages Size + +#### Defined in + +[src/types/messages.ts:38](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L38) + +___ + +### GetMessagesSizeResponse + +• `Const` **GetMessagesSizeResponse**: `ZodObject`\<[`GetMessagesSizeResponseType`](modules.md#getmessagessizeresponsetype)\> + +#### Defined in + +[src/types/messages.ts:44](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L44) + +___ + +### GetPeerPayload + +• `Const` **GetPeerPayload**: `ZodObject`\<[`GetPeerPayloadType`](modules.md#getpeerpayloadtype)\> + +Get peer + +#### Defined in + +[src/types/peers.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L8) + +___ + +### GetPeerResponse + +• `Const` **GetPeerResponse**: `ZodObject`\<[`GetPeerResponseType`](modules.md#getpeerresponsetype)\> + +#### Defined in + +[src/types/peers.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L14) + +___ + +### GetPeersPayload + +• `Const` **GetPeersPayload**: `ZodObject`\<[`GetPeersPayloadType`](modules.md#getpeerspayloadtype)\> + +Get peers + +#### Defined in + +[src/types/node.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L8) + +___ + +### GetPeersResponse + +• `Const` **GetPeersResponse**: `ZodObject`\<[`GetPeersResponseType`](modules.md#getpeersresponsetype)\> + +#### Defined in + +[src/types/node.ts:36](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L36) + +___ + +### GetTicketPricePayload + +• `Const` **GetTicketPricePayload**: `ZodObject`\<[`GetTicketPricePayloadType`](modules.md#getticketpricepayloadtype)\> = `BasePayload` + +Get network price + +#### Defined in + +[src/types/network.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/network.ts#L8) + +___ + +### GetTicketPriceResponse + +• `Const` **GetTicketPriceResponse**: `ZodObject`\<[`GetTicketPriceResponseType`](modules.md#getticketpriceresponsetype)\> + +#### Defined in + +[src/types/network.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/network.ts#L12) + +___ + +### GetTicketStatisticsResponse + +• `Const` **GetTicketStatisticsResponse**: `ZodObject`\<[`GetTicketStatisticsResponseType`](modules.md#getticketstatisticsresponsetype)\> + +Get statistics + +#### Defined in + +[src/types/tickets.ts:7](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tickets.ts#L7) + +___ + +### GetTokenResponse + +• `Const` **GetTokenResponse**: `ZodObject`\<[`GetTokenResponseType`](modules.md#gettokenresponsetype)\> + +getToken + +#### Defined in + +[src/types/tokens.ts:89](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L89) + +___ + +### IsNodeHealthyPayload + +• `Const` **IsNodeHealthyPayload**: `ZodObject`\<[`IsNodeHealthyPayloadType`](modules.md#isnodehealthypayloadtype)\> = `BasePayload` + +Check whether the node is healthy + +#### Defined in + +[src/types/checks.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L8) + +___ + +### IsNodeHealthyResponse + +• `Const` **IsNodeHealthyResponse**: `ZodBoolean`\<[`IsNodeHealthyResponseType`](modules.md#isnodehealthyresponsetype)\> + +#### Defined in + +[src/types/checks.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L12) + +___ + +### IsNodeReadyPayload + +• `Const` **IsNodeReadyPayload**: `ZodObject`\<[`IsNodeReadyPayloadType`](modules.md#isnodereadypayloadtype)\> = `BasePayload` + +Check whether the node is ready to accept connections. + +#### Defined in + +[src/types/checks.ts:20](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L20) + +___ + +### IsNodeReadyResponse + +• `Const` **IsNodeReadyResponse**: `ZodBoolean`\<[`IsNodeReadyResponseType`](modules.md#isnodereadyresponsetype)\> + +#### Defined in + +[src/types/checks.ts:24](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L24) + +___ + +### IsNodeStartedPayload + +• `Const` **IsNodeStartedPayload**: `ZodObject`\<[`IsNodeStartedPayloadType`](modules.md#isnodestartedpayloadtype)\> = `BasePayload` + +Check whether the node is ready to accept connections. + +#### Defined in + +[src/types/checks.ts:32](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L32) + +___ + +### IsNodeStartedResponse + +• `Const` **IsNodeStartedResponse**: `ZodBoolean`\<[`IsNodeStartedResponseType`](modules.md#isnodestartedresponsetype)\> + +#### Defined in + +[src/types/checks.ts:36](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/checks.ts#L36) + +___ + +### OpenChannelPayload + +• `Const` **OpenChannelPayload**: `ZodObject`\<[`OpenChannelPayloadType`](modules.md#openchannelpayloadtype)\> + +Open channel + +#### Defined in + +[src/types/channels.ts:71](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L71) + +___ + +### OpenChannelResponse + +• `Const` **OpenChannelResponse**: `ZodObject`\<[`OpenChannelResponseType`](modules.md#openchannelresponsetype)\> + +#### Defined in + +[src/types/channels.ts:78](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L78) + +___ + +### PeekAllMessagesPayload + +• `Const` **PeekAllMessagesPayload**: `ZodObject`\<[`PeekAllMessagesPayloadType`](modules.md#peekallmessagespayloadtype)\> + +Peek all messages + +#### Defined in + +[src/types/messages.ts:92](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L92) + +___ + +### PeekAllMessagesResponse + +• `Const` **PeekAllMessagesResponse**: `ZodObject`\<[`PeekAllMessagesResponseType`](modules.md#peekallmessagesresponsetype)\> + +#### Defined in + +[src/types/messages.ts:98](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L98) + +___ + +### PeekMessagePayload + +• `Const` **PeekMessagePayload**: `ZodObject`\<[`PeekMessagePayloadType`](modules.md#peekmessagepayloadtype)\> + +Peek message + +#### Defined in + +[src/types/messages.ts:80](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L80) + +___ + +### PeekMessageResponse + +• `Const` **PeekMessageResponse**: `ZodObject`\<[`PeekMessageResponseType`](modules.md#peekmessageresponsetype)\> = `ReceivedMessage` + +#### Defined in + +[src/types/messages.ts:86](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L86) + +___ + +### PeerAnnounced + +• `Const` **PeerAnnounced**: `ZodObject`\<\{ `multiaddr`: `ZodNullable`\<`ZodString`\> ; `peerAddress`: `ZodString` ; `peerId`: `ZodString` }, ``"strip"``, `ZodTypeAny`, \{ `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` }, \{ `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` }\> + +#### Defined in + +[src/types/node.ts:30](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L30) + +___ + +### PeerConnected + +• `Const` **PeerConnected**: `ZodObject`\<\{ `backoff`: `ZodNumber` ; `heartbeats`: `ZodObject`\<\{ `sent`: `ZodNumber` ; `success`: `ZodNumber` }, ``"strip"``, `ZodTypeAny`, \{ `sent`: `number` ; `success`: `number` }, \{ `sent`: `number` ; `success`: `number` }\> ; `isNew`: `ZodBoolean` ; `lastSeen`: `ZodNumber` ; `lastSeenLatency`: `ZodNumber` ; `multiaddr`: `ZodNullable`\<`ZodString`\> ; `peerAddress`: `ZodString` ; `peerId`: `ZodString` ; `quality`: `ZodNumber` ; `reportedVersion`: `ZodString` }, ``"strip"``, `ZodTypeAny`, \{ `backoff`: `number` ; `heartbeats`: \{ `sent`: `number` ; `success`: `number` } ; `isNew`: `boolean` ; `lastSeen`: `number` ; `lastSeenLatency`: `number` ; `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` ; `quality`: `number` ; `reportedVersion`: `string` }, \{ `backoff`: `number` ; `heartbeats`: \{ `sent`: `number` ; `success`: `number` } ; `isNew`: `boolean` ; `lastSeen`: `number` ; `lastSeenLatency`: `number` ; `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` ; `quality`: `number` ; `reportedVersion`: `string` }\> + +#### Defined in + +[src/types/node.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/node.ts#L14) + +___ + +### PingPeerPayload + +• `Const` **PingPeerPayload**: `ZodObject`\<[`PingPeerPayloadType`](modules.md#pingpeerpayloadtype)\> + +Ping peer + +#### Defined in + +[src/types/peers.ts:25](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L25) + +___ + +### PingPeerResponse + +• `Const` **PingPeerResponse**: `ZodObject`\<[`PingPeerResponseType`](modules.md#pingpeerresponsetype)\> + +#### Defined in + +[src/types/peers.ts:31](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/peers.ts#L31) + +___ + +### PopAllMessagesPayload + +• `Const` **PopAllMessagesPayload**: `ZodObject`\<[`PopAllMessagesPayloadType`](modules.md#popallmessagespayloadtype)\> + +Pop all messages + +#### Defined in + +[src/types/messages.ts:66](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L66) + +___ + +### PopAllMessagesResponse + +• `Const` **PopAllMessagesResponse**: `ZodObject`\<[`PopAllMessagesResponseType`](modules.md#popallmessagesresponsetype)\> + +#### Defined in + +[src/types/messages.ts:72](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L72) + +___ + +### PopMessagePayload + +• `Const` **PopMessagePayload**: `ZodObject`\<[`PopMessagePayloadType`](modules.md#popmessagepayloadtype)\> + +Pop message + +#### Defined in + +[src/types/messages.ts:54](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L54) + +___ + +### PopMessageResponse + +• `Const` **PopMessageResponse**: `ZodObject`\<[`PopMessageResponseType`](modules.md#popmessageresponsetype)\> = `ReceivedMessage` + +#### Defined in + +[src/types/messages.ts:60](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L60) + +___ + +### ReceivedMessage + +• `Const` **ReceivedMessage**: `ZodObject`\<\{ `body`: `ZodString` ; `receivedAt`: `ZodNumber` ; `tag`: `ZodNumber` }, ``"strip"``, `ZodTypeAny`, \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }, \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }\> + +General + +#### Defined in + +[src/types/messages.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L8) + +___ + +### RedeemChannelTicketsPayload + +• `Const` **RedeemChannelTicketsPayload**: `ZodObject`\<[`AggregateChannelTicketsPayloadType`](modules.md#aggregatechannelticketspayloadtype)\> + +Redeem channel tickets + +#### Defined in + +[src/types/channels.ts:32](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L32) + +___ + +### SendMessagePayload + +• `Const` **SendMessagePayload**: `ZodObject`\<[`SendMessagePayloadType`](modules.md#sendmessagepayloadtype)\> + +Send Message + +#### Defined in + +[src/types/messages.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/messages.ts#L18) + +___ + +### SetAliasPayload + +• `Const` **SetAliasPayload**: `ZodObject`\<[`SetAliasPayloadType`](modules.md#setaliaspayloadtype)\> + +setAlias + +#### Defined in + +[src/types/aliases.ts:26](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/aliases.ts#L26) + +___ + +### Ticket + +• `Const` **Ticket**: `ZodObject`\<\{ `amount`: `ZodString` ; `channelEpoch`: `ZodNumber` ; `channelId`: `ZodString` ; `index`: `ZodNumber` ; `indexOffset`: `ZodNumber` ; `signature`: `ZodString` ; `winProb`: `ZodString` }, ``"strip"``, `ZodTypeAny`, \{ `amount`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `index`: `number` ; `indexOffset`: `number` ; `signature`: `string` ; `winProb`: `string` }, \{ `amount`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `index`: `number` ; `indexOffset`: `number` ; `signature`: `string` ; `winProb`: `string` }\> + +#### Defined in + +[src/types/channels.ts:112](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/channels.ts#L112) + +___ + +### TokenCapability + +• `Const` **TokenCapability**: `ZodObject`\<\{ `endpoint`: `ZodEnum`\<[``"accountWithdraw"``, ``"accountGetBalances"``, ``"accountGetAddresses"``, ``"aliasesGetAliases"``, ``"aliasesSetAlias"``, ``"aliasesGetAlias"``, ``"aliasesRemoveAlias"``, ``"channelsFundChannels"``, ``"channelsOpenChannel"``, ``"channelsGetChannels"``]\> ; `limits`: `ZodArray`\<`ZodObject`\<\{ `conditions`: `ZodOptional`\<`ZodObject`\<\{ `max`: `ZodOptional`\<`ZodNumber`\> }, ``"strip"``, `ZodTypeAny`, \{ `max?`: `number` }, \{ `max?`: `number` }\>\> ; `type`: `ZodString` }, ``"strip"``, `ZodTypeAny`, \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }, \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }\>, ``"many"``\> }, ``"strip"``, `ZodTypeAny`, \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }, \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }\> + +#### Defined in + +[src/types/tokens.ts:55](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/tokens.ts#L55) + +___ + +### WithdrawPayload + +• `Const` **WithdrawPayload**: `ZodObject`\<[`WithdrawPayloadType`](modules.md#withdrawpayloadtype)\> + +withdraw + +#### Defined in + +[src/types/account.ts:33](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L33) + +___ + +### WithdrawResponse + +• `Const` **WithdrawResponse**: `ZodObject`\<\{ `receipt`: `ZodString` }, ``"strip"``, `ZodTypeAny`, \{ `receipt`: `string` }, \{ `receipt`: `string` }\> + +#### Defined in + +[src/types/account.ts:41](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/account.ts#L41) + +___ + +### createWsUrlPayload + +• `Const` **createWsUrlPayload**: `ZodObject`\<[`createWsUrlType`](modules.md#createwsurltype)\> + +createWsUrl + +#### Defined in + +[src/types/websocket.ts:7](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/types/websocket.ts#L7) diff --git a/docs/modules/api.md b/docs/modules/api.md new file mode 100644 index 00000000..a2774e71 --- /dev/null +++ b/docs/modules/api.md @@ -0,0 +1,1268 @@ +# Namespace: api + +## Table of contents + +### Functions + +- [closeChannel](api.md#closechannel) +- [createToken](api.md#createtoken) +- [deleteMessages](api.md#deletemessages) +- [deleteToken](api.md#deletetoken) +- [fundChannel](api.md#fundchannel) +- [getAddresses](api.md#getaddresses) +- [getAlias](api.md#getalias) +- [getAliases](api.md#getaliases) +- [getBalances](api.md#getbalances) +- [getChannel](api.md#getchannel) +- [getChannelTickets](api.md#getchanneltickets) +- [getChannels](api.md#getchannels) +- [getConfiguration](api.md#getconfiguration) +- [getEntryNodes](api.md#getentrynodes) +- [getHoprAddress](api.md#gethopraddress) +- [getInfo](api.md#getinfo) +- [getMessagesSize](api.md#getmessagessize) +- [getMetrics](api.md#getmetrics) +- [getNativeAddress](api.md#getnativeaddress) +- [getNativeBalance](api.md#getnativebalance) +- [getPeer](api.md#getpeer) +- [getPeers](api.md#getpeers) +- [getTicketPrice](api.md#getticketprice) +- [getTicketStatistics](api.md#getticketstatistics) +- [getToken](api.md#gettoken) +- [getVersion](api.md#getversion) +- [isNodeHealthy](api.md#isnodehealthy) +- [isNodeReady](api.md#isnodeready) +- [isNodeStarted](api.md#isnodestarted) +- [openChannel](api.md#openchannel) +- [peekAllMessages](api.md#peekallmessages) +- [peekMessage](api.md#peekmessage) +- [pingPeer](api.md#pingpeer) +- [popAllMessages](api.md#popallmessages) +- [popMessage](api.md#popmessage) +- [redeemChannelTickets](api.md#redeemchanneltickets) +- [redeemTickets](api.md#redeemtickets) +- [removeAlias](api.md#removealias) +- [sendMessage](api.md#sendmessage) +- [setAlias](api.md#setalias) +- [websocket](api.md#websocket) +- [withdraw](api.md#withdraw) + +## Functions + +### closeChannel + +▸ **closeChannel**(`payload`): `Promise`\<\{ `channelStatus`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `receipt`: `string` }\> + +Closes a HOPR channel given a payload that specifies the API endpoint of the HOPR node, the peerId and the direction of the channel. + +This operation may take more than 5 minutes to complete as it involves on-chain operations. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.channelId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `channelStatus`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `receipt`: `string` }\> + +A Promise that resolves with the response of the close channel operation. + +**`Throws`** + +APIError - If the operation fails. The error object contains the status code and the error message. + +#### Defined in + +[src/api/channels/closeChannel.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/closeChannel.ts#L18) + +___ + +### createToken + +▸ **createToken**(`payload`): `Promise`\<\{ `token`: `string` }\> + +Create a new authentication token based on the given information. +The new token is returned as part of the response body and must be stored by the client. +It cannot be read again in cleartext and is lost, if the client loses the token. +An authentication has a lifetime. It can be unbound, meaning it will not expire. +Or it has a limited lifetime after which it expires. +The requested limited lifetime is requested by the client in seconds. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.capabilities` | \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }[] | - | +| `payload.description` | `string` | - | +| `payload.lifetime` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `token`: `string` }\> + +A Promise that resolves to the generated token which must be used when authenticating for API calls. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/tokens/createToken.ts:22](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/tokens/createToken.ts#L22) + +___ + +### deleteMessages + +▸ **deleteMessages**(`payload`): `Promise`\<`boolean`\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag?` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +#### Defined in + +[src/api/messages/deleteMessages.ts:5](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/deleteMessages.ts#L5) + +___ + +### deleteToken + +▸ **deleteToken**(`payload`): `Promise`\<`boolean`\> + +Deletes a token. Can only be done before the lifetime expired. +After the lifetime expired the token is automatically deleted. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.id` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to true if successful. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/tokens/deleteToken.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/tokens/deleteToken.ts#L15) + +___ + +### fundChannel + +▸ **fundChannel**(`payload`): `Promise`\<\{ `receipt`: `string` }\> + +Funds an existing channel with the given amount. The channel must be in state OPEN + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.amount` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.channelId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `receipt`: `string` }\> + +#### Defined in + +[src/api/channels/fundChannel.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/fundChannel.ts#L14) + +___ + +### getAddresses + +▸ **getAddresses**(`payload`): `Promise`\<\{ `hopr`: `string` ; `native`: `string` }\> + +Gets the HOPR and native addresses associated to the node. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `hopr`: `string` ; `native`: `string` }\> + +A promise that resolves with an object containing the HOPR and native addresses. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/getAddresses.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/getAddresses.ts#L18) + +___ + +### getAlias + +▸ **getAlias**(`payload`): `Promise`\<`string`\> + +Get the PeerId (Hopr address) that have this alias assigned to it. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.alias` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +A promise that resolves to the peer ID associated with the alias. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/aliases/getAlias.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/aliases/getAlias.ts#L18) + +___ + +### getAliases + +▸ **getAliases**(`payload`): `Promise`\<`Record`\<`string`, `string`\>\> + +Get all aliases you set previously and their corresponding peer IDs. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`Record`\<`string`, `string`\>\> + +An object with alias names as keys and the peerId associated with the alias. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/aliases/getAliases.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/aliases/getAliases.ts#L18) + +___ + +### getBalances + +▸ **getBalances**(`payload`): `Promise`\<\{ `hopr`: `string` ; `native`: `string` ; `safeHopr`: `string` ; `safeHoprAllowance`: `string` ; `safeNative`: `string` }\> + +Fetches the HOPR and native balances of the node. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `hopr`: `string` ; `native`: `string` ; `safeHopr`: `string` ; `safeHoprAllowance`: `string` ; `safeNative`: `string` }\> + +A Promise that resolves with an object containing the HOPR and native balances. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/getBalances.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/getBalances.ts#L18) + +___ + +### getChannel + +▸ **getChannel**(`payload`): `Promise`\<\{ `balance`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `closureTime`: `number` ; `destinationAddress`: `string` ; `destinationPeerId`: `string` ; `sourceAddress`: `string` ; `sourcePeerId`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `ticketIndex`: `string` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.channelId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `balance`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `closureTime`: `number` ; `destinationAddress`: `string` ; `destinationPeerId`: `string` ; `sourceAddress`: `string` ; `sourcePeerId`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `ticketIndex`: `string` }\> + +#### Defined in + +[src/api/channels/getChannel.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/getChannel.ts#L10) + +___ + +### getChannelTickets + +▸ **getChannelTickets**(`payload`): `Promise`\<\{ `amount`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `index`: `number` ; `indexOffset`: `number` ; `signature`: `string` ; `winProb`: `string` }[]\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.channelId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `amount`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `index`: `number` ; `indexOffset`: `number` ; `signature`: `string` ; `winProb`: `string` }[]\> + +#### Defined in + +[src/api/channels/getChannelTickets.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/getChannelTickets.ts#L10) + +___ + +### getChannels + +▸ **getChannels**(`payload`): `Promise`\<\{ `all`: \{ `balance`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `closureTime`: `number` ; `destinationAddress`: `string` ; `destinationPeerId`: `string` ; `sourceAddress`: `string` ; `sourcePeerId`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `ticketIndex`: `string` }[] ; `incoming`: \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] ; `outgoing`: \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.fullTopology?` | `boolean` | - | +| `payload.includingClosed?` | `boolean` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `all`: \{ `balance`: `string` ; `channelEpoch`: `number` ; `channelId`: `string` ; `closureTime`: `number` ; `destinationAddress`: `string` ; `destinationPeerId`: `string` ; `sourceAddress`: `string` ; `sourcePeerId`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `ticketIndex`: `string` }[] ; `incoming`: \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] ; `outgoing`: \{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[] }\> + +#### Defined in + +[src/api/channels/getChannels.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/getChannels.ts#L10) + +___ + +### getConfiguration + +▸ **getConfiguration**(`payload`): `Promise`\<`any`\> + +Get the configuration of your node. +Configuration is not type safe + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`any`\> + +An object with configuration of your node. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/configuration/getConfiguration.ts:19](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/configuration/getConfiguration.ts#L19) + +___ + +### getEntryNodes + +▸ **getEntryNodes**(`payload`): `Promise`\<`Record`\<`string`, \{ `isEligible`: `boolean` ; `multiaddrs`: `string`[] }\>\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`Record`\<`string`, \{ `isEligible`: `boolean` ; `multiaddrs`: `string`[] }\>\> + +#### Defined in + +[src/api/node/getEntryNodes.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/node/getEntryNodes.ts#L10) + +___ + +### getHoprAddress + +▸ **getHoprAddress**(`payload`): `Promise`\<`string`\> + +Get the HOPR address of the node. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +A Promise that resolves to the HOPR address. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/getHoprAddress.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/getHoprAddress.ts#L12) + +___ + +### getInfo + +▸ **getInfo**(`payload`): `Promise`\<\{ `announcedAddress`: `string`[] ; `chain`: `string` ; `channelClosurePeriod`: `number` ; `connectivityStatus`: ``"Unknown"`` \| ``"Red"`` \| ``"Orange"`` \| ``"Yellow"`` \| ``"Green"`` ; `hoprChannels`: `string` ; `hoprManagementModule`: `string` ; `hoprNetworkRegistry?`: `string` ; `hoprNodeSafe`: `string` ; `hoprNodeSafeRegistry?`: `string` ; `hoprToken`: `string` ; `indexBlockPrevChecksum?`: `number` ; `indexerBlock?`: `number` ; `indexerChecksum?`: `string` ; `isEligible`: `boolean` ; `listeningAddress`: `string`[] ; `network`: `string` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `announcedAddress`: `string`[] ; `chain`: `string` ; `channelClosurePeriod`: `number` ; `connectivityStatus`: ``"Unknown"`` \| ``"Red"`` \| ``"Orange"`` \| ``"Yellow"`` \| ``"Green"`` ; `hoprChannels`: `string` ; `hoprManagementModule`: `string` ; `hoprNetworkRegistry?`: `string` ; `hoprNodeSafe`: `string` ; `hoprNodeSafeRegistry?`: `string` ; `hoprToken`: `string` ; `indexBlockPrevChecksum?`: `number` ; `indexerBlock?`: `number` ; `indexerChecksum?`: `string` ; `isEligible`: `boolean` ; `listeningAddress`: `string`[] ; `network`: `string` }\> + +#### Defined in + +[src/api/node/getInfo.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/node/getInfo.ts#L10) + +___ + +### getMessagesSize + +▸ **getMessagesSize**(`payload`): `Promise`\<\{ `size`: `number` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `size`: `number` }\> + +#### Defined in + +[src/api/messages/getMessagesSize.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/getMessagesSize.ts#L10) + +___ + +### getMetrics + +▸ **getMetrics**(`payload`): `Promise`\<`string`\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +#### Defined in + +[src/api/node/getMetrics.ts:5](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/node/getMetrics.ts#L5) + +___ + +### getNativeAddress + +▸ **getNativeAddress**(`payload`): `Promise`\<`string`\> + +Get the native address of the node. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +A Promise that resolves to the native address. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/getNativeAddress.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/getNativeAddress.ts#L12) + +___ + +### getNativeBalance + +▸ **getNativeBalance**(`payload`): `Promise`\<`string`\> + +Get the native balance of the node. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +A Promise that resolves with a string representing the native balance. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/getNativeBalance.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/getNativeBalance.ts#L12) + +___ + +### getPeer + +▸ **getPeer**(`payload`): `Promise`\<\{ `announced`: `string`[] ; `observed`: `string`[] }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.peerId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `announced`: `string`[] ; `observed`: `string`[] }\> + +#### Defined in + +[src/api/peers/getPeer.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/peers/getPeer.ts#L10) + +___ + +### getPeers + +▸ **getPeers**(`payload`): `Promise`\<\{ `announced`: \{ `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` }[] ; `connected`: \{ `backoff`: `number` ; `heartbeats`: \{ `sent`: `number` ; `success`: `number` } ; `isNew`: `boolean` ; `lastSeen`: `number` ; `lastSeenLatency`: `number` ; `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` ; `quality`: `number` ; `reportedVersion`: `string` }[] }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.quality?` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `announced`: \{ `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` }[] ; `connected`: \{ `backoff`: `number` ; `heartbeats`: \{ `sent`: `number` ; `success`: `number` } ; `isNew`: `boolean` ; `lastSeen`: `number` ; `lastSeenLatency`: `number` ; `multiaddr`: ``null`` \| `string` ; `peerAddress`: `string` ; `peerId`: `string` ; `quality`: `number` ; `reportedVersion`: `string` }[] }\> + +#### Defined in + +[src/api/node/getPeers.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/node/getPeers.ts#L10) + +___ + +### getTicketPrice + +▸ **getTicketPrice**(`payload`): `Promise`\<\{ `price`: `string` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `price`: `string` }\> + +#### Defined in + +[src/api/network/getTicketPrice.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/network/getTicketPrice.ts#L10) + +___ + +### getTicketStatistics + +▸ **getTicketStatistics**(`payload`): `Promise`\<\{ `neglectedValue`: `string` ; `redeemedValue`: `string` ; `rejectedValue`: `string` ; `unredeemedValue`: `string` ; `winningCount`: `number` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `neglectedValue`: `string` ; `redeemedValue`: `string` ; `rejectedValue`: `string` ; `unredeemedValue`: `string` ; `winningCount`: `number` }\> + +#### Defined in + +[src/api/tickets/getTicketStatistics.ts:9](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/tickets/getTicketStatistics.ts#L9) + +___ + +### getToken + +▸ **getToken**(`payload`): `Promise`\<\{ `capabilities`: \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }[] ; `description?`: `string` ; `id`: `string` ; `valid_until?`: `number` }\> + +Get the full token information for the token used in authentication. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `capabilities`: \{ `endpoint`: ``"accountWithdraw"`` \| ``"accountGetBalances"`` \| ``"accountGetAddresses"`` \| ``"aliasesGetAliases"`` \| ``"aliasesSetAlias"`` \| ``"aliasesGetAlias"`` \| ``"aliasesRemoveAlias"`` \| ``"channelsFundChannels"`` \| ``"channelsOpenChannel"`` \| ``"channelsGetChannels"`` \| ``"channelsRedeemTickets"`` \| ``"channelsGetTickets"`` \| ``"channelsGetChannel"`` \| ``"channelsCloseChannel"`` \| ``"messagesWebsocket"`` \| ``"messagesSign"`` \| ``"messagesSendMessage"`` \| ``"nodeGetVersion"`` \| ``"nodeStreamWebsocket"`` \| ``"nodePing"`` \| ``"nodeGetPeers"`` \| ``"nodeGetMetrics"`` \| ``"nodeGetInfo"`` \| ``"nodeGetEntryNodes"`` \| ``"peerInfoGetPeerInfo"`` \| ``"settingsGetSettings"`` \| ``"settingsSetSetting"`` \| ``"ticketsGetStatistics"`` \| ``"ticketsRedeemTickets"`` \| ``"ticketsGetTickets"`` \| ``"tokensCreate"`` \| ``"tokensGetToken"`` \| ``"tokensDelete"`` ; `limits`: \{ `conditions?`: \{ `max?`: `number` } ; `type`: `string` }[] }[] ; `description?`: `string` ; `id`: `string` ; `valid_until?`: `number` }\> + +A Promise that resolves to an object with the token info. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/tokens/getToken.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/tokens/getToken.ts#L18) + +___ + +### getVersion + +▸ **getVersion**(`payload`): `Promise`\<`string`\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +#### Defined in + +[src/api/node/getVersion.ts:5](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/node/getVersion.ts#L5) + +___ + +### isNodeHealthy + +▸ **isNodeHealthy**(`payload`): `Promise`\<`boolean`\> + +Check whether the node is healthy. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to a boolean stating that the node is healthy or not. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/checks/isNodeHealthy.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/checks/isNodeHealthy.ts#L15) + +___ + +### isNodeReady + +▸ **isNodeReady**(`payload`): `Promise`\<`boolean`\> + +Check whether the node is healthy. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to a boolean stating that the node is healthy or not. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/checks/isNodeReady.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/checks/isNodeReady.ts#L15) + +___ + +### isNodeStarted + +▸ **isNodeStarted**(`payload`): `Promise`\<`boolean`\> + +Check whether the node is healthy. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to a boolean stating that the node is healthy or not. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/checks/isNodeStarted.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/checks/isNodeStarted.ts#L15) + +___ + +### openChannel + +▸ **openChannel**(`payload`): `Promise`\<\{ `channelId`: `string` ; `transactionReceipt`: `string` }\> + +Opens a HOPR channel given a payload that specifies the API endpoint of the HOPR node, the peerId, and the amount of HOPR tokens to be staked in the channel. + +This operation may take more than 5 minutes to complete as it involves on-chain operations. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.amount` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.peerAddress` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `channelId`: `string` ; `transactionReceipt`: `string` }\> + +A Promise that resolves with the response of the open channel operation. + +**`Throws`** + +APIError - If the operation fails. The error object contains the status code and the error message. + +#### Defined in + +[src/api/channels/openChannel.ts:19](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/openChannel.ts#L19) + +___ + +### peekAllMessages + +▸ **peekAllMessages**(`payload`): `Promise`\<\{ `messages`: \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] }\> + +Peek the list of messages currently present in the nodes message inbox, +filtered by tag, and optionally by timestamp (epoch in milliseconds). +The messages are not removed from the inbox. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag?` | ``null`` \| `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `messages`: \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] }\> + +- A promise that resolves to the list of messages currently present in the nodes message inbox. + +#### Defined in + +[src/api/messages/peekAllMessages.ts:17](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/peekAllMessages.ts#L17) + +___ + +### peekMessage + +▸ **peekMessage**(`payload`): `Promise`\<\{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }\> + +Peek the oldest message currently present in the nodes message inbox. +The message is not removed from the inbox. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag?` | ``null`` \| `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }\> + +- A promise that resolves to the oldest message currently present in the nodes message inbox. + +#### Defined in + +[src/api/messages/peekMessage.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/peekMessage.ts#L16) + +___ + +### pingPeer + +▸ **pingPeer**(`payload`): `Promise`\<\{ `latency`: `number` ; `reportedVersion`: `string` }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.peerId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `latency`: `number` ; `reportedVersion`: `string` }\> + +#### Defined in + +[src/api/peers/pingPeer.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/peers/pingPeer.ts#L10) + +___ + +### popAllMessages + +▸ **popAllMessages**(`payload`): `Promise`\<\{ `messages`: \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] }\> + +Get the list of messages currently present in the nodes message inbox. +The messages are removed from the inbox. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag?` | ``null`` \| `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `messages`: \{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }[] }\> + +- A promise that resolves to the list of messages currently present in the nodes message inbox. + +#### Defined in + +[src/api/messages/popAllMessages.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/popAllMessages.ts#L16) + +___ + +### popMessage + +▸ **popMessage**(`payload`): `Promise`\<\{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }\> + +Get the oldest message currently present in the nodes message inbox. +The message is removed from the inbox. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.tag?` | ``null`` \| `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `body`: `string` ; `receivedAt`: `number` ; `tag`: `number` }\> + +- A promise that resolves to the oldest message currently present in the nodes message inbox. + +#### Defined in + +[src/api/messages/popMessage.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/popMessage.ts#L16) + +___ + +### redeemChannelTickets + +▸ **redeemChannelTickets**(`payload`): `Promise`\<`boolean`\> + +Redeems all the unredeemed HOPR tickets in a channel. + +This operation may take more than 5 minutes to complete as it involves on-chain operations. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.channelId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to a boolean indicating the success of the operation. +True if the operation is successful, false otherwise. + +**`Throws`** + +APIError - If the operation fails. The error object contains the status code and the error message. + +#### Defined in + +[src/api/channels/redeemChannelTickets.ts:18](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/channels/redeemChannelTickets.ts#L18) + +___ + +### redeemTickets + +▸ **redeemTickets**(`payload`): `Promise`\<`boolean`\> + +Redeems all the unredeemed HOPR tickets owned by the HOPR node. + +This operation may take more than 5 minutes to complete as it involves on-chain operations. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to a boolean indicating the success of the operation. +True if the operation is successful, false otherwise. + +**`Throws`** + +APIError - If the operation fails. The error object contains the status code and the error message. + +#### Defined in + +[src/api/tickets/redeemTickets.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/tickets/redeemTickets.ts#L14) + +___ + +### removeAlias + +▸ **removeAlias**(`payload`): `Promise`\<`boolean`\> + +Unassign an alias from a PeerId. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.alias` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to true if the alias was successfully removed. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/aliases/removeAlias.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/aliases/removeAlias.ts#L14) + +___ + +### sendMessage + +▸ **sendMessage**(`payload`): `Promise`\<`string`\> + +Send a message to another peer using a given path (list of node addresses that should relay our message through network). If no path is given, HOPR will attempt to find a path. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.body` | `string` | - | +| `payload.hops?` | `number` | - | +| `payload.path?` | `string`[] | - | +| `payload.peerId` | `string` | - | +| `payload.tag` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +- A promise that resolves to the sent message. + +#### Defined in + +[src/api/messages/sendMessage.ts:13](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/sendMessage.ts#L13) + +___ + +### setAlias + +▸ **setAlias**(`payload`): `Promise`\<`boolean`\> + +Instead of using HOPR address, we can assign HOPR address to a specific name called alias. +Give an address a more memorable alias and use it instead of Hopr address. +Aliases are kept locally and are not saved or shared on the network. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.alias` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.peerId` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`boolean`\> + +A Promise that resolves to true if alias successfully linked to peerId. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/aliases/setAlias.ts:20](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/aliases/setAlias.ts#L20) + +___ + +### websocket + +▸ **websocket**(`payload`): `WebSocket` + +Creates a WebSocket instance with the specified IP and API token. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`WebSocket` + +A WebSocket instance. + +#### Defined in + +[src/api/messages/websocket.ts:14](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/messages/websocket.ts#L14) + +___ + +### withdraw + +▸ **withdraw**(`payload`): `Promise`\<`string`\> + +Withdraw the given currency amount to the specified recipient address. +This operation may take more than 5 minutes to complete as it involves on-chain operations. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.amount` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.currency` | ``"NATIVE"`` \| ``"HOPR"`` | - | +| `payload.ethereumAddress` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`string`\> + +A Promise that resolves to the transaction receipt. + +**`Throws`** + +An error that occurred while processing the request. + +#### Defined in + +[src/api/account/withdraw.ts:16](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/api/account/withdraw.ts#L16) diff --git a/docs/modules/flows.md b/docs/modules/flows.md new file mode 100644 index 00000000..f7affbfc --- /dev/null +++ b/docs/modules/flows.md @@ -0,0 +1,151 @@ +# Namespace: flows + +## Table of contents + +### Functions + +- [cashOut](flows.md#cashout) +- [closeEverything](flows.md#closeeverything) +- [getOutgoingChannels](flows.md#getoutgoingchannels) +- [openMultipleChannels](flows.md#openmultiplechannels) +- [safeSendMessage](flows.md#safesendmessage) + +## Functions + +### cashOut + +▸ **cashOut**(`payload`): `Promise`\<\{ `hopr?`: `string` ; `native?`: `string` }\> + +Withdraw all funds from the node. +Does not include funds locked in open channels. +This is a long running function and may take a more than 5 minutes to run + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.ethereumAddress` | `string` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `hopr?`: `string` ; `native?`: `string` }\> + +The transaction receipts for the cash out transactions. + +#### Defined in + +[src/flows/cashOut.ts:11](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/flows/cashOut.ts#L11) + +___ + +### closeEverything + +▸ **closeEverything**(`payload`): `Promise`\<\{ `closedChannels`: \{ `channelStatus`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `receipt`: `string` }[] ; `redeemedTickets`: `boolean` = ticketsHaveBeenRedeemed }\> + +Closes all open outgoing channels and redeems any pending tickets. +This is a long running function and may take a more than 5 minutes to run + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `closedChannels`: \{ `channelStatus`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus; `receipt`: `string` }[] ; `redeemedTickets`: `boolean` = ticketsHaveBeenRedeemed }\> + +#### Defined in + +[src/flows/closeEverything.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/flows/closeEverything.ts#L10) + +___ + +### getOutgoingChannels + +▸ **getOutgoingChannels**(`payload`): `Promise`\<\{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[]\> + +Gets the outgoing channels with optional status filter. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.status?` | ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` \| ``"WaitingForCommitment"`` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<\{ `balance`: `string` ; `id`: `string` ; `peerAddress`: `string` ; `status`: ``"Open"`` \| ``"PendingToClose"`` \| ``"Closed"`` = ChannelStatus }[]\> + +An array of outgoing channels matching the status filter. + +#### Defined in + +[src/flows/getOutgoingChannels.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/flows/getOutgoingChannels.ts#L10) + +___ + +### openMultipleChannels + +▸ **openMultipleChannels**(`payload`): `Promise`\<`undefined` \| \{ `[peerId: string]`: \{ `channelId`: `string` ; `transactionReceipt`: `string` }; }\> + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | - | +| `payload.amount` | `string` | - | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.peerAddresses` | `string`[] | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`undefined` \| \{ `[peerId: string]`: \{ `channelId`: `string` ; `transactionReceipt`: `string` }; }\> + +#### Defined in + +[src/flows/openMultipleChannels.ts:13](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/flows/openMultipleChannels.ts#L13) + +___ + +### safeSendMessage + +▸ **safeSendMessage**(`payload`): `Promise`\<`undefined` \| `string`\> + +Safely send a message through the network. Checks if node has at least +one open outgoing channel + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `payload` | `Object` | The payload of the message. | +| `payload.apiEndpoint` | `string` \| `URL` & `undefined` \| `string` \| `URL` | The API endpoint for authentication. | +| `payload.apiToken` | `string` | The API token for authentication. | +| `payload.body` | `string` | - | +| `payload.hops?` | `number` | - | +| `payload.path?` | `string`[] | - | +| `payload.peerId` | `string` | - | +| `payload.tag` | `number` | - | +| `payload.timeout?` | `number` | optional timeout for the requests | + +#### Returns + +`Promise`\<`undefined` \| `string`\> + +#### Defined in + +[src/flows/safeSendMessage.ts:13](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/flows/safeSendMessage.ts#L13) diff --git a/docs/modules/utils.md b/docs/modules/utils.md new file mode 100644 index 00000000..9ece049a --- /dev/null +++ b/docs/modules/utils.md @@ -0,0 +1,87 @@ +# Namespace: utils + +## Table of contents + +### Classes + +- [sdkApiError](../classes/utils.sdkApiError.md) + +### Functions + +- [createLogger](utils.md#createlogger) +- [fetchWithTimeout](utils.md#fetchwithtimeout) +- [getHeaders](utils.md#getheaders) + +## Functions + +### createLogger + +▸ **createLogger**(`suffix`, `extraInfo?`): `Object` + +Creates a a custom logger + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `suffix` | `string` | name of the module you are working on | +| `extraInfo?` | `string` | any other key that can help distinguish where this log is coming from | + +#### Returns + +`Object` + +| Name | Type | +| :------ | :------ | +| `debug` | `Debugger` | +| `error` | `Debugger` | + +#### Defined in + +[src/utils/log.ts:15](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/log.ts#L15) + +___ + +### fetchWithTimeout + +▸ **fetchWithTimeout**(`apiEndpoint`, `options?`, `ms?`): `Promise`\<`Response`\> + +#### Parameters + +| Name | Type | Default value | +| :------ | :------ | :------ | +| `apiEndpoint` | `URL` \| `RequestInfo` | `undefined` | +| `options?` | `RequestInit` | `undefined` | +| `ms` | `number` | `30000` | + +#### Returns + +`Promise`\<`Response`\> + +#### Defined in + +[src/utils/fetchWithTimeout.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/fetchWithTimeout.ts#L1) + +___ + +### getHeaders + +▸ **getHeaders**(`apiToken`): `Headers` + +Generates the headers needed for making API requests. + +#### Parameters + +| Name | Type | Description | +| :------ | :------ | :------ | +| `apiToken` | `string` | The API token to include in the headers. | + +#### Returns + +`Headers` + +The headers for making API requests. + +#### Defined in + +[src/utils/headers.ts:7](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/utils/headers.ts#L7) diff --git a/docs/modules/web3.md b/docs/modules/web3.md new file mode 100644 index 00000000..53aeb990 --- /dev/null +++ b/docs/modules/web3.md @@ -0,0 +1,210 @@ +# Namespace: web3 + +## Table of contents + +### Variables + +- [DUFOUR](web3.md#dufour) +- [HOPR\_CHANNELS\_SMART\_CONTRACT\_ADDRESS](web3.md#hopr_channels_smart_contract_address) +- [erc721ABI](web3.md#erc721abi) +- [hoprBoostNFTABI](web3.md#hoprboostnftabi) +- [hoprChannelsABI](web3.md#hoprchannelsabi) +- [hoprMultiSendABI](web3.md#hoprmultisendabi) +- [hoprNetworkRegistryABI](web3.md#hoprnetworkregistryabi) +- [hoprNodeManagementModuleABI](web3.md#hoprnodemanagementmoduleabi) +- [hoprNodeSafeRegistryABI](web3.md#hoprnodesaferegistryabi) +- [hoprNodeStakeFactoryABI](web3.md#hoprnodestakefactoryabi) +- [hoprSafeABI](web3.md#hoprsafeabi) +- [hoprWrapperABI](web3.md#hoprwrapperabi) +- [mHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS](web3.md#mhopr_token_smart_contract_address) +- [wrapperABI](web3.md#wrapperabi) +- [wxHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS](web3.md#wxhopr_token_smart_contract_address) +- [wxHOPR\_WRAPPER\_SMART\_CONTRACT\_ADDRESS](web3.md#wxhopr_wrapper_smart_contract_address) +- [xHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS](web3.md#xhopr_token_smart_contract_address) + +## Variables + +### DUFOUR + +• `Const` **DUFOUR**: `Object` + +#### Type declaration + +| Name | Type | +| :------ | :------ | +| `addresses` | \{ `announcements`: `string` = '0x619eabE23FD0E2291B50a507719aa633fE6069b8'; `channels`: `string` = '0x693Bac5ce61c720dDC68533991Ceb41199D8F8ae'; `module_implementation`: `string` = '0xB7397C218766eBe6A1A634df523A1a7e412e67eA'; `network_registry`: `string` = '0x582b4b586168621dAf83bEb2AeADb5fb20F8d50d'; `network_registry_proxy`: `string` = '0x2bc6b78B0aA892e97714F0e3b1c74487f92C5884'; `node_safe_registry`: `string` = '0xe15C24a0910311c83aC78B5930d771089E93077b'; `node_stake_v2_factory`: `string` = '0x098B275485c406573D042848D66eb9d63fca311C'; `ticket_price_oracle`: `string` = '0xcA5656Fe6F2d847ACA32cf5f38E51D2054cA1273'; `token`: `string` = '0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1' } | +| `addresses.announcements` | `string` | +| `addresses.channels` | `string` | +| `addresses.module_implementation` | `string` | +| `addresses.network_registry` | `string` | +| `addresses.network_registry_proxy` | `string` | +| `addresses.node_safe_registry` | `string` | +| `addresses.node_stake_v2_factory` | `string` | +| `addresses.ticket_price_oracle` | `string` | +| `addresses.token` | `string` | +| `environment_type` | `string` | +| `indexer_start_block_number` | `number` | + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:12](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L12) + +___ + +### HOPR\_CHANNELS\_SMART\_CONTRACT\_ADDRESS + +• `Const` **HOPR\_CHANNELS\_SMART\_CONTRACT\_ADDRESS**: ``"0xfabee463f31e39ec8952bbfb4490c41103bf573e"`` + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:2](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L2) + +___ + +### erc721ABI + +• `Const` **erc721ABI**: (\{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'balanceOf'; `outputs`: \{ `internalType`: `string` = 'uint256'; `name`: `string` = 'balance'; `type`: `string` = 'uint256' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/erc721ABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/erc721ABI.ts#L1) + +___ + +### hoprBoostNFTABI + +• `Const` **hoprBoostNFTABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'newAdmin'; `type`: `string` = 'address' }[] ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'balanceOf'; `outputs`: \{ `internalType`: `string` = 'uint256'; `name`: `string` = ''; `type`: `string` = 'uint256' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprBoostNFTABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprBoostNFTABI.ts#L1) + +___ + +### hoprChannelsABI + +• `Const` **hoprChannelsABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = '\_token'; `type`: `string` = 'address' }[] ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'string'; `name`: `string` = 'reason'; `type`: `string` = 'string' }[] ; `name`: `string` = 'WrongChannelState'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'error' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'bytes32'; `name`: `string` = 'channelId'; `type`: `string` = 'bytes32' }[] ; `name`: `string` = 'ChannelBalanceDecreased'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: (\{ `components?`: `undefined` ; `internalType`: `string` = 'bytes32'; `name`: `string` = 'ticketHash'; `type`: `string` = 'bytes32' } \| \{ `components`: (\{ `components`: \{ `internalType`: ... = 'bytes32'; `name`: ... = 'channelId'; `type`: ... = 'bytes32' }[] ; `internalType`: `string` = 'struct HoprChannels.TicketData'; `name`: `string` = 'data'; `type`: `string` = 'tuple' } \| \{ `components?`: `undefined` ; `internalType`: `string` = 'uint256'; `name`: `string` = 'porSecret'; `type`: `string` = 'uint256' })[] ; `internalType`: `string` = 'struct HoprChannels.RedeemableTicket'; `name`: `string` = 'redeemable'; `type`: `string` = 'tuple' })[] ; `name`: `string` = '\_isWinningTicket'; `outputs`: \{ `internalType`: `string` = 'bool'; `name`: `string` = ''; `type`: `string` = 'bool' }[] ; `stateMutability`: `string` = 'pure'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprChannelsABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprChannelsABI.ts#L1) + +___ + +### hoprMultiSendABI + +• `Const` **hoprMultiSendABI**: (\{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'balanceOf'; `outputs`: \{ `internalType`: `string` = 'uint256'; `name`: `string` = 'balance'; `type`: `string` = 'uint256' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprMultiSendABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprMultiSendABI.ts#L1) + +___ + +### hoprNetworkRegistryABI + +• `Const` **hoprNetworkRegistryABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = '\_requirementImplementation'; `type`: `string` = 'address' }[] ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'nodeAddress'; `type`: `string` = 'address' }[] ; `name`: `string` = 'CannotOperateForNode'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'error' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'address'; `name`: `string` = 'stakingAccount'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Deregistered'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = ''; `type`: `string` = 'address' }[] ; `name`: `string` = 'countRegisterdNodesPerAccount'; `outputs`: \{ `internalType`: `string` = 'uint256'; `name`: `string` = ''; `type`: `string` = 'uint256' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprNetworkRegistryABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprNetworkRegistryABI.ts#L1) + +___ + +### hoprNodeManagementModuleABI + +• `Const` **hoprNodeManagementModuleABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name`: `string` = 'AddressIsZero'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'error' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = false; `internalType`: `string` = 'address'; `name`: `string` = 'previousAdmin'; `type`: `string` = 'address' }[] ; `name`: `string` = 'AdminChanged'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'bytes32'; `name`: `string` = 'encoded'; `type`: `string` = 'bytes32' }[] ; `name`: `string` = 'decodeFunctionSigsAndPermissions'; `outputs`: \{ `internalType`: `string` = 'bytes4[]'; `name`: `string` = 'functionSigs'; `type`: `string` = 'bytes4[]' }[] ; `stateMutability`: `string` = 'pure'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprNodeModuleABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprNodeModuleABI.ts#L1) + +___ + +### hoprNodeSafeRegistryABI + +• `Const` **hoprNodeSafeRegistryABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name`: `string` = 'NodeAddressZero'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'error' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = true; `internalType`: `string` = 'address'; `name`: `string` = 'safeAddress'; `type`: `string` = 'address' }[] ; `name`: `string` = 'DergisteredNodeSafe'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `components`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'safeAddress'; `type`: `string` = 'address' }[] ; `internalType`: `string` = 'struct HoprNodeSafeRegistry.NodeSafe'; `name`: `string` = 'nodeSafe'; `type`: `string` = 'tuple' }[] ; `name`: `string` = 'isNodeSafeRegistered'; `outputs`: \{ `internalType`: `string` = 'bool'; `name`: `string` = ''; `type`: `string` = 'bool' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = ''; `type`: `string` = 'address' }[] ; `name`: `string` = 'nodeToSafe'; `outputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = ''; `type`: `string` = 'address' }[] ; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' } \| \{ `anonymous?`: `undefined` = false; `inputs`: (\{ `components`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'safeAddress'; `type`: `string` = 'address' }[] ; `internalType`: `string` = 'struct HoprNodeSafeRegistry.NodeSafe'; `name`: `string` = 'nodeSafe'; `type`: `string` = 'tuple' } \| \{ `components?`: `undefined` ; `internalType`: `string` = 'bytes'; `name`: `string` = 'sig'; `type`: `string` = 'bytes' })[] ; `name`: `string` = 'registerSafeWithNodeSig'; `outputs`: `never`[] = []; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprNodeSafeRegistryABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprNodeSafeRegistryABI.ts#L1) + +___ + +### hoprNodeStakeFactoryABI + +• `Const` **hoprNodeStakeFactoryABI**: (\{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous?`: `undefined` = false; `inputs`: `never`[] = []; `name`: `string` = 'TooFewOwners'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'error' } \| \{ `anonymous`: `boolean` = false; `inputs`: \{ `indexed`: `boolean` = false; `internalType`: `string` = 'address'; `name`: `string` = 'instance'; `type`: `string` = 'address' }[] ; `name`: `string` = 'NewHoprNodeStakeModule'; `outputs?`: `undefined` ; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = 'moduleSingletonAddress'; `type`: `string` = 'address' }[] ; `name`: `string` = 'clone'; `outputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = ''; `type`: `string` = 'address' }[] ; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprNodeStakeFactoryABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprNodeStakeFactoryABI.ts#L1) + +___ + +### hoprSafeABI + +• `Const` **hoprSafeABI**: (\{ `anonymous?`: `undefined` = false; `constant?`: `undefined` = true; `inputs`: `never`[] = []; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = false; `stateMutability`: `string` = 'nonpayable'; `type`: `string` = 'constructor' } \| \{ `anonymous`: `boolean` = false; `constant?`: `undefined` = true; `inputs`: \{ `indexed`: `boolean` = false; `internalType`: `string` = 'address'; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'AddedOwner'; `outputs?`: `undefined` ; `payable?`: `undefined` = true; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' } \| \{ `anonymous?`: `undefined` = false; `constant?`: `undefined` = true; `inputs?`: `undefined` ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = true; `stateMutability`: `string` = 'payable'; `type`: `string` = 'fallback' } \| \{ `anonymous?`: `undefined` = false; `constant`: `boolean` = true; `inputs`: \{ `internalType`: `string` = 'address'; `name`: `string` = ''; `type`: `string` = 'address' }[] ; `name`: `string` = 'approvedHashes'; `outputs`: \{ `internalType`: `string` = 'uint256'; `name`: `string` = ''; `type`: `string` = 'uint256' }[] ; `payable`: `boolean` = false; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprSafeABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprSafeABI.ts#L1) + +___ + +### hoprWrapperABI + +• `Const` **hoprWrapperABI**: (\{ `anonymous?`: `undefined` = false; `constant`: `boolean` = true; `inputs`: \{ `name`: `string` = '\_owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'balanceOf'; `outputs`: \{ `name`: `string` = 'balance'; `type`: `string` = 'uint256' }[] ; `payable`: `boolean` = false; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' } \| \{ `anonymous?`: `undefined` = false; `constant?`: `undefined` = true; `inputs?`: `undefined` ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = true; `stateMutability`: `string` = 'payable'; `type`: `string` = 'fallback' } \| \{ `anonymous`: `boolean` = false; `constant?`: `undefined` = true; `inputs`: \{ `indexed`: `boolean` = true; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `payable?`: `undefined` = true; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' })[] + +#### Defined in + +[src/ethereum/stakingV2/hoprWrapperABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/stakingV2/hoprWrapperABI.ts#L1) + +___ + +### mHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS + +• `Const` **mHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS**: ``"0x66225dE86Cac02b32f34992eb3410F59DE416698"`` + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:4](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L4) + +___ + +### wrapperABI + +• `Const` **wrapperABI**: (\{ `anonymous?`: `undefined` = false; `constant`: `boolean` = true; `inputs`: \{ `name`: `string` = '\_owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'balanceOf'; `outputs`: \{ `name`: `string` = 'balance'; `type`: `string` = 'uint256' }[] ; `payable`: `boolean` = false; `stateMutability`: `string` = 'view'; `type`: `string` = 'function' } \| \{ `anonymous?`: `undefined` = false; `constant?`: `undefined` = true; `inputs?`: `undefined` ; `name?`: `undefined` = 'Approval'; `outputs?`: `undefined` ; `payable`: `boolean` = true; `stateMutability`: `string` = 'payable'; `type`: `string` = 'fallback' } \| \{ `anonymous`: `boolean` = false; `constant?`: `undefined` = true; `inputs`: \{ `indexed`: `boolean` = true; `name`: `string` = 'owner'; `type`: `string` = 'address' }[] ; `name`: `string` = 'Approval'; `outputs?`: `undefined` ; `payable?`: `undefined` = true; `stateMutability?`: `undefined` = 'payable'; `type`: `string` = 'event' })[] + +#### Defined in + +[src/ethereum/wrapperABI.ts:1](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/wrapperABI.ts#L1) + +___ + +### wxHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS + +• `Const` **wxHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS**: ``"0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1"`` + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:8](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L8) + +___ + +### wxHOPR\_WRAPPER\_SMART\_CONTRACT\_ADDRESS + +• `Const` **wxHOPR\_WRAPPER\_SMART\_CONTRACT\_ADDRESS**: ``"0x097707143e01318734535676cfe2e5cF8b656ae8"`` + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:10](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L10) + +___ + +### xHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS + +• `Const` **xHOPR\_TOKEN\_SMART\_CONTRACT\_ADDRESS**: ``"0xD057604A14982FE8D88c5fC25Aac3267eA142a08"`` + +#### Defined in + +[src/ethereum/smartContractAddresses.ts:6](https://github.com/hoprnet/hopr-sdk/blob/7b4777d5661880e8518778cfcfa0ac332679e349/src/ethereum/smartContractAddresses.ts#L6)