forked from Polymarket/clob-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateApiKey.ts
More file actions
22 lines (17 loc) · 755 Bytes
/
Copy pathcreateApiKey.ts
File metadata and controls
22 lines (17 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { ethers } from "ethers";
import { config as dotenvConfig } from "dotenv";
import { resolve } from "path";
import { Chain, ClobClient } from "../src/index.ts";
dotenvConfig({ path: resolve(import.meta.dirname, "../.env") });
async function main() {
const wallet = new ethers.Wallet(`${process.env.PK}`);
const chainId = parseInt(`${process.env.CHAIN_ID || Chain.AMOY}`) as Chain;
console.log(`Address: ${await wallet.getAddress()}, chainId: ${chainId}`);
const host = process.env.CLOB_API_URL || "http://localhost:8080";
const clobClient = new ClobClient(host, chainId, wallet);
console.log(`Response: `);
const resp = await clobClient.createApiKey();
console.log(resp);
console.log(`Complete!`);
}
main();