-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from Polymarket/feat/rewards-service
Reward service endpoints
- Loading branch information
Showing
6 changed files
with
176 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { ethers } from "ethers"; | ||
import { config as dotenvConfig } from "dotenv"; | ||
import { resolve } from "path"; | ||
import { ApiKeyCreds, Chain, ClobClient } from "../src"; | ||
|
||
dotenvConfig({ path: resolve(__dirname, "../.env") }); | ||
|
||
async function main() { | ||
const wallet = new ethers.Wallet(`${process.env.PK}`); | ||
const chainId = parseInt(`${process.env.CHAIN_ID || Chain.MUMBAI}`) as Chain; | ||
console.log(`Address: ${await wallet.getAddress()}, chainId: ${chainId}`); | ||
|
||
const host = process.env.CLOB_API_URL || "http://localhost:8080"; | ||
const creds: ApiKeyCreds = { | ||
key: `${process.env.CLOB_API_KEY}`, | ||
secret: `${process.env.CLOB_SECRET}`, | ||
passphrase: `${process.env.CLOB_PASS_PHRASE}`, | ||
}; | ||
const clobClient = new ClobClient(host, chainId, wallet, creds); | ||
|
||
console.log( | ||
"today earnings", | ||
await clobClient.getEarningsForUserForDay("2024-04-03" /* UTC TIME */), | ||
); | ||
console.log("rewards percentages", await clobClient.getLRewardPercentages()); | ||
console.log("current rewards", await clobClient.getCurrentRewards()); | ||
console.log( | ||
"rewards for market", | ||
await clobClient.getRawRewardsForMarket( | ||
"0xbd31dc8a20211944f6b70f31557f1001557b59905b7738480ca09bd4532f84af", | ||
), | ||
); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters