Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cd-subgraph-hmt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
- name: Install dependencies
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces focus @tools/subgraph-hmt
- name: Build packages (scoped)
- name: Build core dependency
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces foreach -Rpt --from @tools/subgraph-hmt run build
run: yarn workspace @human-protocol/core build
- name: Generate and build Subgraph
if: steps.filter_networks.outputs.continue == 'true'
run: yarn generate && yarn build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd-subgraph-human.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ jobs:
- name: Install dependencies
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces focus @tools/subgraph-human-protocol
- name: Build packages (scoped)
- name: Build core dependency
if: steps.filter_networks.outputs.continue == 'true'
run: yarn workspaces foreach -Rpt --from @tools/subgraph-human-protocol run build
run: yarn workspace @human-protocol/core build
- name: Generate and build Subgraph
if: steps.filter_networks.outputs.continue == 'true'
run: yarn generate && yarn build
Expand Down
6 changes: 6 additions & 0 deletions packages/sdk/python/human-protocol-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @human-protocol/python-sdk

## 7.2.0

### Minor Changes

- af6ec22: Add cancellationRequestedAt field to Escrow data model

## 7.1.0

### Minor Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-ethereum/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmQZ3yL1FzydDwaB56ozgTiBESciTNFsMLyTBfHXzNd1gg"
"https://gateway.thegraph.com/api/deployments/id/QmceuRi331MC3NMajeLejepHShGNRaK87VRiePtHRbNsVV"
),
"hmt_address": "0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867",
"factory_address": "0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a",
Expand All @@ -75,7 +75,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-sepolia/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmQEbyGSf8VG9pdskowsK6C977wkcyJSxw9q6EDctKEkUw"
"https://gateway.thegraph.com/api/deployments/id/QmdsJaanpNKXd3ov2Cp6vmpu8uvA69iBfwxswFMu4ZcmNJ"
),
"hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33",
"factory_address": "0x5987A5558d961ee674efe4A8c8eB7B1b5495D3bf",
Expand All @@ -93,7 +93,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-bsc/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmV3nZUM51NGt7F8RpZP9GxKPpKox3F24iJ8H1ekPb6ha4"
"https://gateway.thegraph.com/api/deployments/id/QmcEAT53JPUfddhdxAdFMcHjEtQYpbzNiLkP5dMHZ9Stm7"
),
"hmt_address": "0x711Fd6ab6d65A98904522d4e3586F492B989c527",
"factory_address": "0x92FD968AcBd521c232f5fB8c33b342923cC72714",
Expand All @@ -111,7 +111,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-bsc-testnet/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmdQJog9vMghK2o39U9YJL8vpU9VZnkJa7jGg7wnsod7qV"
"https://gateway.thegraph.com/api/deployments/id/QmNNb3ZQdJiziXksfUNiKYKio7A9u8eMTJYB8jpWQza2uv"
),
"hmt_address": "0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d",
"factory_address": "0x2bfA592DBDaF434DDcbb893B1916120d181DAD18",
Expand All @@ -131,7 +131,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-polygon/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmSu7B48kgGgMgXaD6Yb4fXjbnsJNmobKAU9qZgescZXid"
"https://gateway.thegraph.com/api/deployments/id/QmXPEzDjLTU8AiJ3Zemcodq8hVax3BvC3wskAqjULrgX7Z"
),
"hmt_address": "0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF",
"factory_address": "0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB",
Expand All @@ -151,7 +151,7 @@ class OperatorCategory(Enum):
"https://api.studio.thegraph.com/query/74256/human-amoy/version/latest"
),
"subgraph_url_api_key": (
"https://gateway.thegraph.com/api/deployments/id/QmRx5WSi7o9FtENWnE5eEz8Dr7kYUazk4TNPRt65UZkKkB"
"https://gateway.thegraph.com/api/deployments/id/QmW3KQfZu1sGz1CedPKC9okCuMFvi8EbrjKncoHn3UPFry"
),
"hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33",
"factory_address": "0xAFf5a986A530ff839d49325A5dF69F96627E8D29",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class EscrowData:
token (str): Address of the payment token.
total_funded_amount (int): Total amount funded to the escrow.
created_at (int): Creation timestamp in milliseconds.
cancellation_requested_at (Optional[int]): Cancellation request timestamp in
milliseconds.
chain_id (ChainId): Chain where the escrow is deployed.
"""

Expand All @@ -86,6 +88,7 @@ def __init__(
token: str,
total_funded_amount: str,
created_at: str,
cancellation_requested_at: Optional[str] = None,
final_results_url: Optional[str] = None,
final_results_hash: Optional[str] = None,
intermediate_results_url: Optional[str] = None,
Expand Down Expand Up @@ -129,6 +132,11 @@ def __init__(
self.token = token
self.total_funded_amount = int(total_funded_amount)
self.created_at = int(created_at) * 1000
self.cancellation_requested_at = (
int(cancellation_requested_at) * 1000
if cancellation_requested_at is not None
else None
)
self.chain_id = chain_id


Expand Down Expand Up @@ -325,6 +333,7 @@ def get_escrows(
token=escrow.get("token"),
total_funded_amount=escrow.get("totalFundedAmount"),
created_at=escrow.get("createdAt"),
cancellation_requested_at=escrow.get("cancellationRequestedAt"),
final_results_url=escrow.get("finalResultsUrl"),
final_results_hash=escrow.get("finalResultsHash"),
intermediate_results_url=escrow.get("intermediateResultsUrl"),
Expand Down Expand Up @@ -423,6 +432,7 @@ def get_escrow(
token=escrow.get("token"),
total_funded_amount=escrow.get("totalFundedAmount"),
created_at=escrow.get("createdAt"),
cancellation_requested_at=escrow.get("cancellationRequestedAt"),
final_results_url=escrow.get("finalResultsUrl"),
final_results_hash=escrow.get("finalResultsHash"),
intermediate_results_url=escrow.get("intermediateResultsUrl"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
token
totalFundedAmount
createdAt
cancellationRequestedAt
}
"""

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/python/human-protocol-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@human-protocol/python-sdk",
"version": "7.1.0",
"version": "7.2.0",
"private": true,
"description": "Stub package to integrate the Python SDK with Changesets (dev-only).",
"license": "MIT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def test_get_escrows(self):
"token": "0x1234567890123456789012345678901234567891",
"totalFundedAmount": "1000000000000000000",
"createdAt": "1683811973",
"cancellationRequestedAt": "1683812000",
}

def side_effect(subgraph_url, query, params, options):
Expand Down Expand Up @@ -134,6 +135,10 @@ def side_effect(subgraph_url, query, params, options):
self.assertEqual(
int(filtered[0].created_at), int(mock_escrow["createdAt"]) * 1000
)
self.assertEqual(
int(filtered[0].cancellation_requested_at),
int(mock_escrow["cancellationRequestedAt"]) * 1000,
)

filter = EscrowFilter(chain_id=ChainId.POLYGON_AMOY)

Expand Down Expand Up @@ -184,6 +189,7 @@ def test_get_escrows_with_status_array(self):
"token": "0x1234567890123456789012345678901234567891",
"totalFundedAmount": "1000000000000000000",
"createdAt": "1672531200000",
"cancellationRequestedAt": None,
}
mock_escrow_2 = {
"id": "0x1234567890123456789012345678901234567891",
Expand All @@ -204,6 +210,7 @@ def test_get_escrows_with_status_array(self):
"token": "0x1234567890123456789012345678901234567891",
"totalFundedAmount": "1000000000000000000",
"createdAt": "1672531200000",
"cancellationRequestedAt": None,
}

def side_effect(subgraph_url, query, params, options):
Expand Down Expand Up @@ -239,6 +246,8 @@ def side_effect(subgraph_url, query, params, options):
self.assertEqual(len(filtered), 2)
self.assertEqual(filtered[0].address, mock_escrow_1["address"])
self.assertEqual(filtered[1].address, mock_escrow_2["address"])
self.assertIsNone(filtered[0].cancellation_requested_at)
self.assertIsNone(filtered[1].cancellation_requested_at)

def test_get_escrow(self):
with patch(
Expand Down Expand Up @@ -268,6 +277,7 @@ def test_get_escrow(self):
"token": "0x1234567890123456789012345678901234567891",
"totalFundedAmount": "1000000000000000000",
"createdAt": "1683813973",
"cancellationRequestedAt": "1683814000",
}

mock_function.return_value = {
Expand Down Expand Up @@ -326,6 +336,10 @@ def test_get_escrow(self):
self.assertEqual(
int(escrow.created_at), int(mock_escrow["createdAt"]) * 1000
)
self.assertEqual(
int(escrow.cancellation_requested_at),
int(mock_escrow["cancellationRequestedAt"]) * 1000,
)

def test_get_escrow_empty_data(self):
with patch(
Expand Down
6 changes: 6 additions & 0 deletions packages/sdk/typescript/human-protocol-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @human-protocol/sdk

## 7.2.0

### Minor Changes

- af6ec22: Add cancellationRequestedAt field to Escrow data model

## 7.1.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/typescript/human-protocol-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@human-protocol/sdk",
"description": "Human Protocol SDK",
"version": "7.1.0",
"version": "7.2.0",
"files": [
"src",
"dist"
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/typescript/human-protocol-sdk/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-ethereum/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmQZ3yL1FzydDwaB56ozgTiBESciTNFsMLyTBfHXzNd1gg',
'https://gateway.thegraph.com/api/deployments/id/QmceuRi331MC3NMajeLejepHShGNRaK87VRiePtHRbNsVV',
oldSubgraphUrl: '',
oldFactoryAddress: '',
hmtSubgraphUrl:
Expand All @@ -55,7 +55,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-sepolia/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmQEbyGSf8VG9pdskowsK6C977wkcyJSxw9q6EDctKEkUw',
'https://gateway.thegraph.com/api/deployments/id/QmdsJaanpNKXd3ov2Cp6vmpu8uvA69iBfwxswFMu4ZcmNJ',
oldSubgraphUrl: '',
oldFactoryAddress: '',
hmtSubgraphUrl:
Expand All @@ -74,7 +74,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-bsc/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmV3nZUM51NGt7F8RpZP9GxKPpKox3F24iJ8H1ekPb6ha4',
'https://gateway.thegraph.com/api/deployments/id/QmcEAT53JPUfddhdxAdFMcHjEtQYpbzNiLkP5dMHZ9Stm7',
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
hmtSubgraphUrl:
Expand All @@ -93,7 +93,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-bsc-testnet/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmdQJog9vMghK2o39U9YJL8vpU9VZnkJa7jGg7wnsod7qV',
'https://gateway.thegraph.com/api/deployments/id/QmNNb3ZQdJiziXksfUNiKYKio7A9u8eMTJYB8jpWQza2uv',
oldSubgraphUrl:
'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
Expand All @@ -113,7 +113,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-polygon/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmSu7B48kgGgMgXaD6Yb4fXjbnsJNmobKAU9qZgescZXid',
'https://gateway.thegraph.com/api/deployments/id/QmXPEzDjLTU8AiJ3Zemcodq8hVax3BvC3wskAqjULrgX7Z',
oldSubgraphUrl:
'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
Expand All @@ -133,7 +133,7 @@ export const NETWORKS: {
subgraphUrl:
'https://api.studio.thegraph.com/query/74256/human-amoy/version/latest',
subgraphUrlApiKey:
'https://gateway.thegraph.com/api/deployments/id/QmRx5WSi7o9FtENWnE5eEz8Dr7kYUazk4TNPRt65UZkKkB',
'https://gateway.thegraph.com/api/deployments/id/QmW3KQfZu1sGz1CedPKC9okCuMFvi8EbrjKncoHn3UPFry',
oldSubgraphUrl: '',
oldFactoryAddress: '',
hmtSubgraphUrl:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ function mapEscrow(e: EscrowData, chainId: ChainId | number): IEscrow {
token: e.token,
totalFundedAmount: BigInt(e.totalFundedAmount),
createdAt: Number(e.createdAt) * 1000,
cancellationRequestedAt: e.cancellationRequestedAt
? Number(e.cancellationRequestedAt) * 1000
: null,
chainId: Number(chainId),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const ESCROW_FRAGMENT = gql`
token
totalFundedAmount
createdAt
cancellationRequestedAt
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type EscrowData = {
token: string;
totalFundedAmount: string;
createdAt: string;
cancellationRequestedAt: string | null;
};

export type WorkerData = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export interface IEscrow {
token: string;
totalFundedAmount: bigint;
createdAt: number;
cancellationRequestedAt: number | null;
chainId: number;
}

Expand Down
Loading
Loading