From 817091332ad5976e887a8967cbfe8078e333f936 Mon Sep 17 00:00:00 2001 From: JP Date: Tue, 21 Apr 2026 14:57:34 +0100 Subject: [PATCH] feat: convex claim --- .../__snapshots__/txCategorize.test.ts.snap | 17 ++++++ packages/tx-categorize/src/testCases.mock.ts | 2 + .../src/txSchemas/heuristicMap.ts | 11 ++++ ...e79b145f31f351175f77be1bbd96362871351.json | 61 +++++++++++++++++++ 4 files changed, 91 insertions(+) create mode 100644 packages/tx-categorize/test-fixtures/nock/1-0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351.json diff --git a/packages/tx-categorize/src/__snapshots__/txCategorize.test.ts.snap b/packages/tx-categorize/src/__snapshots__/txCategorize.test.ts.snap index b4bee58..5a162ac 100644 --- a/packages/tx-categorize/src/__snapshots__/txCategorize.test.ts.snap +++ b/packages/tx-categorize/src/__snapshots__/txCategorize.test.ts.snap @@ -444,6 +444,23 @@ exports[`V5 / V6 categorization snapshots (alongside nock HTTP fixtures) matches "transactionType": "COMPOUND_V2_WITHDRAW", }, }, + "CONVEX_CLAIM": { + "txHash": "0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351", + "v5": { + "readable": "Convex: Claim", + "toAddressName": "CONVEX_STAKED_CVX_POOL", + "transactionCategory": "CLAIM", + "transactionProtocol": "CONVEX", + "transactionType": "CONVEX_CLAIM", + }, + "v6": { + "readable": "Claimed 97.2854 cvxCRV", + "toAddressName": "CONVEX_STAKED_CVX_POOL", + "transactionCategory": "CLAIM", + "transactionProtocol": "CONVEX", + "transactionType": "CONVEX_CLAIM", + }, + }, "CURVE_DEPOSIT": { "txHash": "0xa0051bc2323b729274c4be4e0bf9d51c9a406725dcc3d6b654b281dd762873e4", "v5": { diff --git a/packages/tx-categorize/src/testCases.mock.ts b/packages/tx-categorize/src/testCases.mock.ts index 7c56b9f..fb98932 100644 --- a/packages/tx-categorize/src/testCases.mock.ts +++ b/packages/tx-categorize/src/testCases.mock.ts @@ -104,6 +104,7 @@ export const txTestCases = { HOP_BRIDGE_IN: '0xa41a27f3f89357345b0c25c144a90bab78160a3130bb6d7d39f4fddf91a89e45', CURVE_DEPOSIT: '0xa0051bc2323b729274c4be4e0bf9d51c9a406725dcc3d6b654b281dd762873e4', METAMASK_STAKE_V1_CLAIM: '0x2ebb958fef3b51fe3306d5a027a83f22292d106773768e3748a4553b796333f9', + CONVEX_CLAIM: '0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351', } /** @@ -166,6 +167,7 @@ export const txTestCaseReadableLabels: Record = { SHAPESHIFT_CLAIM: 'Claimed 200 FOX', GITCOIN_CLAIM: 'Claimed 16.492 GTC', COMPOUND_CLAIM: 'Claimed 2.5091 COMP', + CONVEX_CLAIM: 'Claimed 97.2854 cvxCRV', ERC_721_TRANSFER: 'Sent PLSR', ERC_721_MINT: 'Minted Token', ERC_721_APPROVE: 'Approved to spend', diff --git a/packages/tx-categorize/src/txSchemas/heuristicMap.ts b/packages/tx-categorize/src/txSchemas/heuristicMap.ts index 505d667..d5e3383 100644 --- a/packages/tx-categorize/src/txSchemas/heuristicMap.ts +++ b/packages/tx-categorize/src/txSchemas/heuristicMap.ts @@ -389,6 +389,11 @@ const determinants: DeterminantMap = { protocol: 'AAVE', version: 'V3', }, + { + address: '0xcf50b810e57ac33b91dcf525c6ddd9881b139332', + name: 'CONVEX_STAKED_CVX_POOL', + protocol: 'CONVEX', + }, ], methodIds: [ { id: '0xaf7060fd', name: EXCHANGE, priority: 1, protocol: 'LIFI' }, // lifi @@ -680,6 +685,12 @@ const determinants: DeterminantMap = { protocol: 'CURVE', priority: 14, }, + // Convex reward pool RewardPaid + { + hash: '0xe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e0486', + name: CLAIM, + priority: 14, + }, ], } diff --git a/packages/tx-categorize/test-fixtures/nock/1-0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351.json b/packages/tx-categorize/test-fixtures/nock/1-0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351.json new file mode 100644 index 0000000..a20e0f0 --- /dev/null +++ b/packages/tx-categorize/test-fixtures/nock/1-0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351.json @@ -0,0 +1,61 @@ +[ + { + "scope": "https://primitives.api.cx.metamask.io:443", + "method": "GET", + "path": "/v1/networks/1/transactions/0x22288abb8adf55b26445812dcf9e79b145f31f351175f77be1bbd96362871351?includeLogs=true&includeValueTransfers=true", + "body": "", + "status": 200, + "response": "1b0c0e00e4656ffaa7ab87b392012124a4db2fb5808abd2efbb235dde7b919383416599cadf1b3f240020d6c72208b7a89677954e0f9a2ba533cc72359aa73858f8f188cb27565fa891bf5b7707ef5b99deea001be8a31aa9abbda58221e734aa214475f7596ea9464312d16a222ab149fe43e6ae61cb5100b41807e67bbfd17031a05e8db657f864601869d0dda5bb8b3d31d34c0d9188d4f021a448cf919a667c43f93b4244dea7344fc138c2ae78f5b7ff8f6f2e4f3082d262da49c4f3144bcd48cb98cb48c86a8634993f3986912ad2e7926999c254a5f43d914bb275d3a96bbf3acc64520c0ad9da0512daa14e0d64ebf9ce68046924963805b3b7d7fdcf5090d222a89644a1060ae35fb79779d9fd9e9fbe3ae4f6810514924538200fb6ddf2734ca2540bf3c5d1eedbcbb809aa158b5a45c5280a779bedbc617c3a3244bb9ea9a0e0136302b87060801ce9bbf75f725e84a38a55867f64aa32f89d2f318a3aa921357e60801d6717be2a8bf29882c967cc9402d52672c3aadf4c11295339a6bacee106077fae478dc8ed0963d9ea615c65f8c8c59f37882f6d7db5ba3cca11c98932225a9b2a2b9a43e4acf981c71d6e5952395bc46d76c1302ece2b52368504b54614d9a9029324655860063f6dd933d42230dd0b7fdf968fdfcc118c7793a5958d51066aba99684eecc980751edbd94b2ac22ba21a73e04ccb71ada80061ffdf82b04d8dbd384061f5d8ed779f3f107dfddfcbc3dcc3d04387331f4e7d72f263498c71e11de075afcc00e1f536feb6272f4da0b4bb6387a4e4635d749b5479e6949a9ab2aa1594148bfbe6a926d7f9daf6ec65d928272912a28c19e6291fc13e071bb5d41c2c8ad28b9383a2264b4b2bdd8f513b4bf005f69179f3465faec65880f4aab508a65d0d4b4780c644a1d57f1182b4df188685d7be9ec350a0440bb509174e81c260144f04f005bcc63f4b8dd7eb11ff31534e1f83e30fe5e2b2993d3a4587c751b917159c6df1763ac28d106f98c5dabe7daa363d6d5b9e830ab12ddcaa2cc3d19518eba442c8d25919de7c2634e808c070f61b3ca26a8946fd2f71327c0bc41ee80f1cb667cfccd98907342b7ac6b0eb6b854bd8814111a542b2f4d5eab3be15acabcb02f1d8e5d2626cd64a19eb026698ae5fd3fefdf03", + "rawHeaders": [ + "Date", + "Tue, 21 Apr 2026 13:54:08 GMT", + "Content-Type", + "application/json; charset=utf-8", + "Transfer-Encoding", + "chunked", + "Connection", + "keep-alive", + "content-security-policy", + "default-src 'self';base-uri 'self';font-src 'self' https: data:;form-action 'self';frame-ancestors 'self';img-src 'self' data:;object-src 'none';script-src 'self';script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests", + "cross-origin-opener-policy", + "same-origin", + "cross-origin-resource-policy", + "same-origin", + "origin-agent-cluster", + "?1", + "referrer-policy", + "no-referrer", + "strict-transport-security", + "max-age=15552000; includeSubDomains", + "x-content-type-options", + "nosniff", + "x-dns-prefetch-control", + "off", + "x-download-options", + "noopen", + "x-frame-options", + "SAMEORIGIN", + "x-permitted-cross-domain-policies", + "none", + "x-xss-protection", + "0", + "vary", + "Origin", + "Cache-Control", + "max-age=15", + "x-cache", + "MISS", + "cf-cache-status", + "DYNAMIC", + "set-cookie", + "__cf_bm=N3AmycncPQch5eUM_QlYsyjXXL7ATjK5j4VxLx4eBlk-1776779647.9206898-1.0.1.1-8jPjOMq4_A8xEn7vVAzocexAJWbrdXNtxZNUDuhBC6KBT7aysLa7cKEiUVrxx5KhZXeXJf9rgyTpenTTgPx0YlhFXbr_XmE6FKX.8Hzcr8X2ge0PIwJH09wWRu_uvYKg; HttpOnly; Secure; Path=/; Domain=api.cx.metamask.io; Expires=Tue, 21 Apr 2026 14:24:08 GMT", + "Content-Encoding", + "br", + "Server", + "cloudflare", + "CF-RAY", + "9efce0ff7989467f-LHR" + ], + "responseIsBinary": true + } +] \ No newline at end of file