Skip to content

Commit a49202f

Browse files
portuu3flopez7
andauthored
Delete references to totalHMTAmountReceived (#3832)
Co-authored-by: flopez7 <francisco@hmt.ai>
1 parent 45057ab commit a49202f

12 files changed

Lines changed: 25 additions & 39 deletions

File tree

.changeset/warm-pillows-crash.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@human-protocol/sdk": patch
3+
"@human-protocol/python-sdk": patch
4+
---
5+
6+
Delete references to totalHMTAmountReceived that was removed from subgraph

packages/apps/dashboard/client/src/features/searchResults/model/addressDetailsSchema.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const walletSchema = z.object({
1111
lockedAmount: z.string(),
1212
withdrawableAmount: z.string(),
1313
reputation: reputationSchema,
14-
totalHMTAmountReceived: z.string(),
1514
payoutCount: z.number().or(z.string()),
1615
});
1716

packages/apps/dashboard/client/src/features/searchResults/ui/WalletAddress.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const WalletAddress: FC<Props> = ({ data }) => {
3030
reputation,
3131
withdrawableAmount,
3232
} = data;
33-
const isWallet = 'totalHMTAmountReceived' in data;
33+
const isWallet = 'payoutCount' in data;
3434

3535
return (
3636
<>
@@ -51,10 +51,10 @@ const WalletAddress: FC<Props> = ({ data }) => {
5151
</TitleSectionWrapper>
5252
{isWallet && (
5353
<TitleSectionWrapper
54-
title="Earned Payouts"
55-
tooltip="Total amount earned by participating in jobs"
54+
title="Payouts received"
55+
tooltip="Total count of payouts received by participating in jobs"
5656
>
57-
<TokenAmount amount={data?.totalHMTAmountReceived} />
57+
<TokenAmount amount={data?.payoutCount} />
5858
</TitleSectionWrapper>
5959
)}
6060
</Stack>

packages/apps/dashboard/server/src/modules/details/details.service.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,6 @@ export class DetailsService {
128128
withdrawableAmount: ethers.formatEther(stakingData.withdrawableAmount),
129129
reputation: (await this.fetchOperatorReputation(chainId, address))
130130
.reputation,
131-
totalHMTAmountReceived: ethers.formatEther(
132-
workerData?.totalHMTAmountReceived || 0,
133-
),
134131
payoutCount: workerData?.payoutCount || 0,
135132
});
136133

packages/sdk/python/human-protocol-sdk/human_protocol_sdk/gql/worker.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
fragment WorkerFields on Worker {
55
id
66
address
7-
totalHMTAmountReceived
87
payoutCount
98
}
109
"""

packages/sdk/python/human-protocol-sdk/human_protocol_sdk/worker/worker_utils.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
WorkerFilter(chain_id=ChainId.POLYGON_AMOY)
1010
)
1111
for worker in workers:
12-
print(f"{worker.address}: {worker.total_amount_received}")
12+
print(f"{worker.address}: {worker.payout_count}")
1313
```
1414
"""
1515

@@ -37,20 +37,17 @@ class WorkerData:
3737
Attributes:
3838
id (str): Unique worker identifier.
3939
address (str): Worker's Ethereum address.
40-
total_amount_received (int): Total amount of HMT tokens received by the worker.
4140
payout_count (int): Number of payouts the worker has received.
4241
"""
4342

4443
def __init__(
4544
self,
4645
id: str,
4746
address: str,
48-
total_amount_received: str,
4947
payout_count: str,
5048
):
5149
self.id = id
5250
self.address = address
53-
self.total_amount_received = int(total_amount_received)
5451
self.payout_count = int(payout_count)
5552

5653

@@ -94,7 +91,7 @@ def get_workers(
9491
WorkerFilter(chain_id=ChainId.POLYGON_AMOY)
9592
)
9693
for worker in workers:
97-
print(f"{worker.address}: {worker.total_amount_received} HMT")
94+
print(f"{worker.address}: {worker.payout_count} payouts")
9895
9996
# Get specific worker
10097
workers = WorkerUtils.get_workers(
@@ -141,7 +138,6 @@ def get_workers(
141138
WorkerData(
142139
id=worker.get("id"),
143140
address=worker.get("address"),
144-
total_amount_received=worker.get("totalHMTAmountReceived"),
145141
payout_count=worker.get("payoutCount"),
146142
)
147143
)
@@ -180,7 +176,6 @@ def get_worker(
180176
"0x1234567890123456789012345678901234567890",
181177
)
182178
if worker:
183-
print(f"Total received: {worker.total_amount_received} HMT")
184179
print(f"Payout count: {worker.payout_count}")
185180
```
186181
"""
@@ -215,6 +210,5 @@ def get_worker(
215210
return WorkerData(
216211
id=worker.get("id"),
217212
address=worker.get("address"),
218-
total_amount_received=worker.get("totalHMTAmountReceived"),
219213
payout_count=worker.get("payoutCount"),
220214
)

packages/sdk/python/human-protocol-sdk/test/human_protocol_sdk/worker/test_worker_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ def test_get_workers(self):
1515
mock_worker_1 = {
1616
"id": "worker1",
1717
"address": "0x1234567890123456789012345678901234567890",
18-
"totalHMTAmountReceived": "1000",
1918
"payoutCount": 5,
2019
}
2120
mock_worker_2 = {
2221
"id": "worker2",
2322
"address": "0x9876543210987654321098765432109876543210",
24-
"totalHMTAmountReceived": "2000",
2523
"payoutCount": 10,
2624
}
2725

@@ -31,7 +29,7 @@ def test_get_workers(self):
3129

3230
filter = WorkerFilter(
3331
chain_id=ChainId.POLYGON_AMOY,
34-
order_by="totalHMTAmountReceived",
32+
order_by="payoutCount",
3533
order_direction=OrderDirection.ASC,
3634
)
3735

@@ -44,14 +42,16 @@ def test_get_workers(self):
4442
"address": None,
4543
"first": 10,
4644
"skip": 0,
47-
"orderBy": "totalHMTAmountReceived",
45+
"orderBy": "payoutCount",
4846
"orderDirection": "asc",
4947
},
5048
options=None,
5149
)
5250
self.assertEqual(len(workers), 2)
5351
self.assertEqual(workers[0].id, "worker1")
5452
self.assertEqual(workers[1].id, "worker2")
53+
self.assertEqual(workers[0].payout_count, 5)
54+
self.assertEqual(workers[1].payout_count, 10)
5555

5656
def test_get_workers_empty_response(self):
5757
with patch(
@@ -93,7 +93,6 @@ def test_get_worker(self):
9393
mock_worker = {
9494
"id": "worker1",
9595
"address": "0x1234567890123456789012345678901234567890",
96-
"totalHMTAmountReceived": "1000",
9796
"payoutCount": 5,
9897
}
9998

@@ -115,6 +114,7 @@ def test_get_worker(self):
115114
self.assertEqual(
116115
worker.address, "0x1234567890123456789012345678901234567890"
117116
)
117+
self.assertEqual(worker.payout_count, 5)
118118

119119
def test_get_worker_empty_data(self):
120120
with patch(

packages/sdk/typescript/human-protocol-sdk/src/graphql/queries/worker.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export const GET_WORKER_QUERY = gql`
66
worker(id: $address) {
77
id
88
address
9-
totalHMTAmountReceived
109
payoutCount
1110
}
1211
}
@@ -34,7 +33,6 @@ export const GET_WORKERS_QUERY = (filter: IWorkersFilter) => {
3433
) {
3534
id
3635
address
37-
totalHMTAmountReceived
3836
payoutCount
3937
}
4038
}`;

packages/sdk/typescript/human-protocol-sdk/src/graphql/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export type EscrowData = {
3030
export type WorkerData = {
3131
id: string;
3232
address: string;
33-
totalHMTAmountReceived: string;
3433
payoutCount: string;
3534
};
3635

packages/sdk/typescript/human-protocol-sdk/src/interfaces.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ export interface IStatusEventFilter extends IPagination {
181181
export interface IWorker {
182182
id: string;
183183
address: string;
184-
totalHMTAmountReceived: bigint;
185184
payoutCount: number;
186185
}
187186

0 commit comments

Comments
 (0)