Deno & Fetch

Using Deno & fetch to delegate to a DRep.

Prepare Delegation Transaction

Payload

{
  "changeAddress": "addr...",
  "delegations": [
    {
      "type": "drep",
      "address": "addr..",
      "keyHash": "drep..."
    }
  ]
}

Example (using Deno & fetch)

Using a preprod wallet all value needed for a delegation

const DREP_ID = "drep13d6sxkyz6st9h65qqrzd8ukpywhr8swe9f6357qntgjqye0gttd";
const ADDR = "addr_test1qq7fc3ke49nkcsfglltut7apa9t3gdul4utwhxt6j2hdrw7pg4vk6erdshyhdj5xeq0vh8qdy34cpdfstvc8l9su8hgq679eew";
// See Authentication page for API key details.
const X_API_KEY = "testnet_EyrkvCWDZqjkfLSe1pxaF0hXxUcByHEhHuXIBjt9";

API POST Request Body

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

Fetch Command with Deno

POST call with Fetch

Deno Command

Output

The Whole File (Deno Version)

chevron-rightdelegate-drep.tshashtag

Last updated

Was this helpful?