Deno & Fetch

Using Deno & fetch to delegate to a stake pool.

Prepare Pool Delegation Transaction

Payload

{
  "changeAddress": "addr_test1...",
  "delegations": [
    {
      "type": "pool",
      "address": "addr_test1...",
      "keyHash": "pool1z5uq..."
    }
  ]
}

Example (using Deno & fetch)

Using a preprod wallet all value needed for a delegation

const POOL_ID = "pool1n3sjq3qvu5vvcd6aud6ndcwq7r3ghmkafcg60gznlwfrk2ucxku";
const ADDR = "addr_test1qzyttcj6czjltcs3tn3vls6yg90542lctrzwg5aagduqlfgupztxhczzmuakzfuwvrht542yrx7ll3fk29lcl2xl8axqh3pjdh";
// See Authentication page for API key details.
const X_API_KEY = "testnet_EyrkvCWDZqjkfLSe1pxaF0hXxUcByHEhHuXIBjt9";

API POST Request Body

Body Structure for a delegation to a pool using the previously collected values.

Fetch Command with Deno

POST call with Fetch

Deno Command

Output

The Whole File (Deno Version)

chevron-rightdelegate-pool.tshashtag

Last updated

Was this helpful?