From 5225b08df657318f31c6cb88bb1433e2626265da Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Fri, 10 May 2024 15:12:57 -0400 Subject: [PATCH] Update rewards examples with new client version --- examples/cosmos/list-rewards.ts | 9 +++++++-- examples/cosmos/list-stakes.ts | 8 ++++++-- examples/ethereum/list-rewards.ts | 9 +++++++-- examples/ethereum/list-stakes.ts | 8 ++++++-- examples/solana/list-rewards.ts | 8 ++++++-- 5 files changed, 32 insertions(+), 10 deletions(-) diff --git a/examples/cosmos/list-rewards.ts b/examples/cosmos/list-rewards.ts index 2be233c..db96cbd 100644 --- a/examples/cosmos/list-rewards.ts +++ b/examples/cosmos/list-rewards.ts @@ -1,10 +1,15 @@ import { StakingClient } from '../../src/client/staking-client'; -// Defines which address and rewards we want to see +// Address can be substituted with any Cosmos validator. const address: string = 'cosmosvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwympnc4en'; + const filter: string = `address='${address}' AND period_end_time > '2024-03-25T00:00:00Z' AND period_end_time < '2024-03-27T00:00:00Z'`; -const client = new StakingClient(); +// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api +const apiKeyName: string = 'your-api-key-name'; +const apiPrivateKey: string = 'your-api-private-key'; + +const client = new StakingClient(apiKeyName, apiPrivateKey); // Loops through rewards array and prints each reward client.Cosmos.listRewards(filter).then((resp) => { diff --git a/examples/cosmos/list-stakes.ts b/examples/cosmos/list-stakes.ts index e51903b..8fe0e3d 100644 --- a/examples/cosmos/list-stakes.ts +++ b/examples/cosmos/list-stakes.ts @@ -1,9 +1,13 @@ import { StakingClient } from '../../src/client/staking-client'; -// TODO: Replace address as per your requirement. +// Address can be substituted with any Cosmos validator. const address: string = 'cosmosvaloper1c4k24jzduc365kywrsvf5ujz4ya6mwympnc4en'; -const client = new StakingClient(); +// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api +const apiKeyName: string = 'your-api-key-name'; +const apiPrivateKey: string = 'your-api-private-key'; + +const client = new StakingClient(apiKeyName, apiPrivateKey); async function listStakes(): Promise { if (address === '') { diff --git a/examples/ethereum/list-rewards.ts b/examples/ethereum/list-rewards.ts index c45ec0b..f3d1989 100644 --- a/examples/ethereum/list-rewards.ts +++ b/examples/ethereum/list-rewards.ts @@ -1,11 +1,16 @@ import { StakingClient } from '../../src/client/staking-client'; -// Defines which address and rewards we want to see +// Address can be substituted with any Ethereum validator. const address: string = '0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474'; + const filter: string = `address='${address}' AND period_end_time > '2024-02-25T00:00:00Z' AND period_end_time < '2024-02-27T00:00:00Z'`; -const client = new StakingClient(); +// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api +const apiKeyName: string = 'your-api-key-name'; +const apiPrivateKey: string = 'your-api-private-key'; + +const client = new StakingClient(apiKeyName, apiPrivateKey); // Loops through rewards array and prints each reward client.Ethereum.listRewards(filter).then((resp) => { diff --git a/examples/ethereum/list-stakes.ts b/examples/ethereum/list-stakes.ts index 1c9ee0d..b82f186 100644 --- a/examples/ethereum/list-stakes.ts +++ b/examples/ethereum/list-stakes.ts @@ -1,10 +1,14 @@ import { StakingClient } from '../../src/client/staking-client'; -// TODO: Replace address as per your requirement. +// Address can be substituted with any Ethereum validator. const address: string = '0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474'; -const client = new StakingClient(); +// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api +const apiKeyName: string = 'your-api-key-name'; +const apiPrivateKey: string = 'your-api-private-key'; + +const client = new StakingClient(apiKeyName, apiPrivateKey); async function listStakes(): Promise { if (address === '') { diff --git a/examples/solana/list-rewards.ts b/examples/solana/list-rewards.ts index 6a66aa0..1d1148b 100644 --- a/examples/solana/list-rewards.ts +++ b/examples/solana/list-rewards.ts @@ -1,9 +1,13 @@ import { StakingClient } from '../../src/client/staking-client'; -// TODO: Replace address as per your requirement. +// Address can be substituted with any Solana validator. const address: string = 'beefKGBWeSpHzYBHZXwp5So7wdQGX6mu4ZHCsH3uTar'; -const client = new StakingClient(); +// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api +const apiKeyName: string = 'your-api-key-name'; +const apiPrivateKey: string = 'your-api-private-key'; + +const client = new StakingClient(apiKeyName, apiPrivateKey); async function listRewards(): Promise { if (address === '') {