'TS2345 - Argument of type 'string' is not assignable to parameter of type 'PublicKey'

Running this code:

import * as dotenv from "dotenv";
dotenv.config();

import { Connection, Keypair } from "@solana/web3.js";
import {
 Client,
 Exchange,
 Network,
 Wallet,
 utils,
 types,
} from "@zetamarkets/sdk";
import fetch from "node-fetch";
const program_id = process.env.PROGRAM_ID!;
const network_url = process.env.NETWORK_URL!;
const private_key = process.env.PRIVATE_KEY!;
const server_url = process.env.SERVER_URL!;

await Exchange.load(
program_id,
Network.DEVNET,
connection,
utils.defaultCommitment(),
undefined, // Exchange wallet can be ignored for normal clients.
0, // ThrottleMs - increase if you are running into rate limit issues on startup.
undefined // Callback - See below for more details.
);

Produces the following error: error TS2345: Argument of type 'string' is not assignable to parameter of type 'PublicKey'.program_id,

Any help / hints?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source