From 65b20a516400508cff0781490fce5b8263760892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= Date: Wed, 10 Dec 2025 14:43:37 +0100 Subject: [PATCH 1/3] reorganize mainMethods and fix internal transaction handling when there is more than one main method event in the same transaction --- .../subgraph/src/mapping/utils/transaction.ts | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts b/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts index 7ede1ffc5a..6f91d268e5 100644 --- a/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts +++ b/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts @@ -5,12 +5,12 @@ import { toEventId, toPreviousEventId } from './event'; const mainMethods: string[] = [ 'createEscrow', 'setup', - 'fund', - 'bulkTransfer', - 'storeResults', - 'withdraw', 'requestCancellation', + 'withdraw', 'cancel', + 'complete', + 'storeResults', + 'bulkTransfer', 'stake', 'unstake', 'slash', @@ -71,13 +71,26 @@ export function createTransaction( mainMethods.includes(method) && Address.fromBytes(transaction.to) == to ) { - transaction.method = method; - transaction.from = from; - transaction.value = value !== null ? value : BigInt.fromI32(0); - transaction.token = token; - transaction.escrow = escrow; - transaction.receiver = receiver; - transaction.save(); + if (mainMethods.includes(transaction.method)) { + const internalTransaction = new InternalTransaction(toEventId(event)); + internalTransaction.method = method; + internalTransaction.from = from; + internalTransaction.to = to; + internalTransaction.value = value !== null ? value : BigInt.fromI32(0); + internalTransaction.transaction = transaction.txHash; + internalTransaction.token = token; + internalTransaction.escrow = escrow; + internalTransaction.receiver = receiver; + internalTransaction.save(); + } else { + transaction.method = method; + transaction.from = from; + transaction.value = value !== null ? value : BigInt.fromI32(0); + transaction.token = token; + transaction.escrow = escrow; + transaction.receiver = receiver; + transaction.save(); + } } else { if ( transaction.method == 'set' && From 5bd1ad2acc5016377871c5f19d87e20e9c1143b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20L=C3=B3pez?= Date: Thu, 11 Dec 2025 17:02:04 +0100 Subject: [PATCH 2/3] add 'fund' to mainMethods for transaction handling --- .../sdk/typescript/subgraph/src/mapping/utils/transaction.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts b/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts index 6f91d268e5..65eb1ed009 100644 --- a/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts +++ b/packages/sdk/typescript/subgraph/src/mapping/utils/transaction.ts @@ -7,6 +7,7 @@ const mainMethods: string[] = [ 'setup', 'requestCancellation', 'withdraw', + 'fund', 'cancel', 'complete', 'storeResults', From c5064ec7d7eb53f4b5fea34c9d1365ea31ea5175 Mon Sep 17 00:00:00 2001 From: portuu3 Date: Tue, 16 Dec 2025 16:32:46 +0100 Subject: [PATCH 3/3] update subgraphs with the fix --- .changeset/tasty-groups-sing.md | 6 ++++++ .../human_protocol_sdk/constants.py | 12 ++++++------ .../typescript/human-protocol-sdk/src/constants.ts | 12 ++++++------ 3 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 .changeset/tasty-groups-sing.md diff --git a/.changeset/tasty-groups-sing.md b/.changeset/tasty-groups-sing.md new file mode 100644 index 0000000000..e28a428f67 --- /dev/null +++ b/.changeset/tasty-groups-sing.md @@ -0,0 +1,6 @@ +--- +"@human-protocol/sdk": patch +"@human-protocol/python-sdk": patch +--- + +Subgraph fix - Fix internal transaction handling when there is more than one main method event in the same transaction. diff --git a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py index b02169384d..4c0abcf005 100644 --- a/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py +++ b/packages/sdk/python/human-protocol-sdk/human_protocol_sdk/constants.py @@ -37,7 +37,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/ethereum/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz" + "https://gateway.thegraph.com/api/deployments/id/QmeCB3KX49nRAkzgqancc3yL3VMJvt65YtL1zrLCFgr2n5" ), "hmt_address": "0xd1ba9BAC957322D6e8c07a160a3A8dA11A0d2867", "factory_address": "0xD9c75a1Aa4237BB72a41E5E26bd8384f10c1f55a", @@ -53,7 +53,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/sepolia/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB" + "https://gateway.thegraph.com/api/deployments/id/QmcMntqZSTh8wJddxgp2hYcdw78wZFU86LHTHzJ1bTVUDc" ), "hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33", "factory_address": "0x5987A5558d961ee674efe4A8c8eB7B1b5495D3bf", @@ -69,7 +69,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/bsc/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD" + "https://gateway.thegraph.com/api/deployments/id/QmRexbu8eLZ1iE7ZLMtKxAr9GJnQ1JVrXhybKq6JkJ9XLE" ), "hmt_address": "0x711Fd6ab6d65A98904522d4e3586F492B989c527", "factory_address": "0x92FD968AcBd521c232f5fB8c33b342923cC72714", @@ -85,7 +85,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ" + "https://gateway.thegraph.com/api/deployments/id/QmfFBXsAP7nbckFx34XYcNq2hRnfoVNrfqCvuk7hmAtYJT" ), "hmt_address": "0xE3D74BBFa45B4bCa69FF28891fBE392f4B4d4e4d", "factory_address": "0x2bfA592DBDaF434DDcbb893B1916120d181DAD18", @@ -103,7 +103,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/polygon/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2" + "https://gateway.thegraph.com/api/deployments/id/QmUwHMDjnDHDB5cowGqd96SRJ1sZegoAPanjxBWUyLZghv" ), "hmt_address": "0xc748B2A084F8eFc47E086ccdDD9b7e67aEb571BF", "factory_address": "0xBDBfD2cC708199C5640C6ECdf3B0F4A4C67AdfcB", @@ -121,7 +121,7 @@ class OperatorCategory(Enum): "https://api.studio.thegraph.com/query/74256/amoy/version/latest" ), "subgraph_url_api_key": ( - "https://gateway.thegraph.com/api/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa" + "https://gateway.thegraph.com/api/deployments/id/QmTJfcvVVmw8fe5CwRP6tZD5FzE2ESrm3ryygS1YZMYhM7" ), "hmt_address": "0x792abbcC99c01dbDec49c9fa9A828a186Da45C33", "factory_address": "0xAFf5a986A530ff839d49325A5dF69F96627E8D29", diff --git a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts index 1b4c19c402..adc9d298d5 100644 --- a/packages/sdk/typescript/human-protocol-sdk/src/constants.ts +++ b/packages/sdk/typescript/human-protocol-sdk/src/constants.ts @@ -36,7 +36,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmXGmcjEtwwEgB83KE2ECjjYY38kLMqzaq4ip8GWY7A6zz', + 'https://gateway.thegraph.com/api/deployments/id/QmeCB3KX49nRAkzgqancc3yL3VMJvt65YtL1zrLCFgr2n5', oldSubgraphUrl: '', oldFactoryAddress: '', }, @@ -51,7 +51,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmT4xNvZh8ymarrk1zdytjLhCW59iuTavsd4JgHS4LbCVB', + 'https://gateway.thegraph.com/api/deployments/id/QmcMntqZSTh8wJddxgp2hYcdw78wZFU86LHTHzJ1bTVUDc', oldSubgraphUrl: '', oldFactoryAddress: '', }, @@ -66,7 +66,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmdVdpm9NnFz5B8QyzhW1bW1nNfRWemTiFn2MrhYZGTSQD', + 'https://gateway.thegraph.com/api/deployments/id/QmRexbu8eLZ1iE7ZLMtKxAr9GJnQ1JVrXhybKq6JkJ9XLE', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc', oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4', }, @@ -81,7 +81,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmZjYMktZe8RAz7W7qL33VZBV6AC57xsLyE1cEfv6NABdZ', + 'https://gateway.thegraph.com/api/deployments/id/QmfFBXsAP7nbckFx34XYcNq2hRnfoVNrfqCvuk7hmAtYJT', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest', oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f', @@ -97,7 +97,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmUt9mmfNjtC5ZnQNiWHRbFG3k5zfngMuoTyky9jhXYqG2', + 'https://gateway.thegraph.com/api/deployments/id/QmUwHMDjnDHDB5cowGqd96SRJ1sZegoAPanjxBWUyLZghv', oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon', oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794', @@ -113,7 +113,7 @@ export const NETWORKS: { subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest', subgraphUrlApiKey: - 'https://gateway.thegraph.com/api/deployments/id/QmWRUFWpWoRRUh7Ec1HUJEwxc84DkP4iFTfLLsoVngJAPa', + 'https://gateway.thegraph.com/api/deployments/id/QmTJfcvVVmw8fe5CwRP6tZD5FzE2ESrm3ryygS1YZMYhM7', oldSubgraphUrl: '', oldFactoryAddress: '', },