helium/docs

Example given in Rewardable Entities does not compile; missing PublicKey import

ke6jjj opened this issue · 0 comments

ke6jjj commented

Summary

Example code for retrieving rewards for a Rewardable Entity in slug /solana/rewardable-entites/ is broken due to incomplete import list. Example needs to be updated with proper imports.

Details

The example snippet given to retrieve the retrievable rewards for a Rewardable Entity the slug solana/rewardable-entites/ gives the following snippet:

import { init, lazyDistributorKey } from "@helium/lazy-distributor-sdk";
import { getCurrentRewards } from "@helium/distributor-oracle";
import * as anchor from "@coral-xyz/anchor";

anchor.setProvider(anchor.AnchorProvider.local("...rpc url..."));
const provider = anchor.getProvider() as anchor.AnchorProvider;
const program = await init(provider)

const iotMint = new PublicKey("...iot mint...")

In this snippet, the class PublicKey is referenced in the last line, but it is not imported from any module in the header. Thus, it produces a compilation error:

example.ts:9:21 - error TS2304: Cannot find name 'PublicKey'.

9 const iotMint = new PublicKey("iotEVVZLEywoTn1QdwNPddxPWszn3zFhEot3MfL9fns")