diff --git a/.eslintrc.json b/.eslintrc.json
index 938d5f0..f3ff4a8 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -54,7 +54,7 @@
"error",
"always"
],
- "padding-line-between-statements": [
+ "@typescript-eslint/padding-line-between-statements": [
"error",
{
"blankLine": "always",
diff --git a/README.md b/README.md
index 3071b21..a56d6c3 100644
--- a/README.md
+++ b/README.md
@@ -170,9 +170,9 @@ client.Solana.stake('devnet', '8rMGARtkJY5QygP1mgvBFLsE9JrvXByARJiyNfcSE5Z', '10
-### View Ethereum Rewards :moneybag:
+### View Partial ETH Rewards :moneybag:
-This code sample helps view rewards for an Ethereum validator address. View the full source [here](examples/ethereum/list-rewards.ts).
+This code sample helps view rewards for an Ethereum address. View the full source [here](examples/ethereum/list-rewards.ts).
@@ -188,15 +188,18 @@ const client = new StakingClient(apiKeyName, apiPrivateKey);
// Defines which address and rewards we want to see
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'`;
+ '0x60c7e246344ae3856cf9abe3a2e258d495fc39e0';
+const filter: string = `address='${address}' AND period_end_time > '2024-05-01T00:00:00Z' AND period_end_time < '2024-05-02T00:00:00Z'`;
// Loops through rewards array and prints each reward
-client.Ethereum.listRewards(filter).then((resp) => {
+var list = async function () {
+ const resp = await client.Ethereum.listRewards(filter)
resp.rewards!.forEach((reward) => {
console.log(JSON.stringify(reward, null, 2));
});
-});
+}
+
+list();
```
@@ -205,62 +208,35 @@ client.Ethereum.listRewards(filter).then((resp) => {
Output
```json
- {
- "address": "0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474",
- "date": "2024-02-25",
- "aggregationUnit": "DAY",
- "periodStartTime": "2024-02-25T00:00:00Z",
- "periodEndTime": "2024-02-25T23:59:59Z",
- "totalEarnedNativeUnit": {
- "amount": "0.002183619",
- "exp": "18",
- "ticker": "ETH",
- "rawNumeric": "2183619000000000"
- },
- "totalEarnedUsd": [
- {
- "source": "COINBASE_EXCHANGE",
- "conversionTime": "2024-02-26T00:09:00Z",
- "amount": {
- "amount": "6.79",
- "exp": "2",
- "ticker": "USD",
- "rawNumeric": "679"
- },
- "conversionPrice": "3105.780029"
- }
- ],
- "endingBalance": null,
- "protocol": "ethereum"
- }
- {
- "address": "0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474",
- "date": "2024-02-26",
- "aggregationUnit": "DAY",
- "periodStartTime": "2024-02-26T00:00:00Z",
- "periodEndTime": "2024-02-26T23:59:59Z",
- "totalEarnedNativeUnit": {
- "amount": "0.002182946",
- "exp": "18",
- "ticker": "ETH",
- "rawNumeric": "2182946000000000"
- },
- "totalEarnedUsd": [
- {
- "source": "COINBASE_EXCHANGE",
- "conversionTime": "2024-02-27T00:09:00Z",
- "amount": {
- "amount": "6.94",
- "exp": "2",
- "ticker": "USD",
- "rawNumeric": "694"
- },
- "conversionPrice": "3178.889893"
- }
- ],
- "endingBalance": null,
- "protocol": "ethereum"
- }
+ {
+ "address": "0x60c7e246344ae3856cf9abe3a2e258d495fc39e0",
+ "date": "2024-05-01",
+ "aggregationUnit": "DAY",
+ "periodStartTime": "2024-05-01T00:00:00Z",
+ "periodEndTime": "2024-05-01T23:59:59Z",
+ "totalEarnedNativeUnit": {
+ "amount": "0.001212525541415161",
+ "exp": "18",
+ "ticker": "ETH",
+ "rawNumeric": "1212525541415161"
+ },
+ "totalEarnedUsd": [
+ {
+ "source": "COINBASE_EXCHANGE",
+ "conversionTime": "2024-05-02T00:09:00Z",
+ "amount": {
+ "amount": "3.61",
+ "exp": "2",
+ "ticker": "USD",
+ "rawNumeric": "361"
+ },
+ "conversionPrice": "2971.419922"
+ }
+ ],
+ "endingBalance": null,
+ "protocol": "ethereum",
+ "rewardState": "PENDING_CLAIMABLE"
+ }
```
diff --git a/examples/ethereum/list-rewards.ts b/examples/ethereum/list-rewards.ts
index f3d1989..4239248 100644
--- a/examples/ethereum/list-rewards.ts
+++ b/examples/ethereum/list-rewards.ts
@@ -1,20 +1,34 @@
import { StakingClient } from '../../src/client/staking-client';
-// 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'`;
-
// 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) => {
+// Defines which partial eth address and rewards we want to see.
+const partialETHAddress: string = '0x60c7e246344ae3856cf9abe3a2e258d495fc39e0';
+const partialETHFilter: string = `address='${partialETHAddress}' AND period_end_time > '2024-05-01T00:00:00Z' AND period_end_time < '2024-05-02T00:00:00Z'`;
+
+// Defines which validator address and rewards we want to see.
+const validatorAddress: string =
+ '0xac53512c39d0081ca4437c285305eb423f474e6153693c12fbba4a3df78bcaa3422b31d800c5bea71c1b017168a60474';
+const validatorFilter: string = `address='${validatorAddress}' AND period_end_time > '2024-02-25T00:00:00Z' AND period_end_time < '2024-02-27T00:00:00Z'`;
+
+// Loops through partial eth rewards array and prints each reward
+(async (): Promise => {
+ const resp = await client.Ethereum.listRewards(partialETHFilter);
+ // eslint-disable-next-line @typescript-eslint/padding-line-between-statements
+ resp.rewards!.forEach((reward) => {
+ console.log(JSON.stringify(reward, null, 2));
+ });
+})();
+
+// Loops through validator rewards array and prints each reward
+(async (): Promise => {
+ const resp = await client.Ethereum.listRewards(validatorFilter);
+ // eslint-disable-next-line @typescript-eslint/padding-line-between-statements
resp.rewards!.forEach((reward) => {
console.log(JSON.stringify(reward, null, 2));
});
-});
+})();
diff --git a/package-lock.json b/package-lock.json
index f1a388b..44b314d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@coinbase/staking-client-library-ts",
- "version": "0.7.1",
+ "version": "0.8.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@coinbase/staking-client-library-ts",
- "version": "0.7.1",
+ "version": "0.8.1",
"license": "Apache-2.0",
"dependencies": {
"@ethereumjs/tx": "^5.1.0",
@@ -19,7 +19,7 @@
"@types/node-jose": "^1.1.10",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
- "eslint": "^8.49.0",
+ "eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-filename-rules": "^1.3.1",
"eslint-plugin-node": "^11.1.0",
diff --git a/package.json b/package.json
index ac535c8..d4ffe12 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,7 @@
"@types/node-jose": "^1.1.10",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@typescript-eslint/parser": "^6.7.0",
- "eslint": "^8.49.0",
+ "eslint": "^8.57.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-filename-rules": "^1.3.1",
"eslint-plugin-node": "^11.1.0",