Skip to content

Commit 154e750

Browse files
committed
feat(n8n): automatically claim rewards when a wallet is connected
1 parent 674ee8c commit 154e750

File tree

1 file changed

+51
-57
lines changed

1 file changed

+51
-57
lines changed

n8n/workflows.json

Lines changed: 51 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -15242,6 +15242,17 @@
1524215242
]
1524315243
]
1524415244
},
15245+
"Respond to Webhook2": {
15246+
"main": [
15247+
[
15248+
{
15249+
"index": 0,
15250+
"node": "Postgres11",
15251+
"type": "main"
15252+
}
15253+
]
15254+
]
15255+
},
1524515256
"Save Account ID and Private Key": {
1524615257
"main": [
1524715258
[
@@ -15510,13 +15521,6 @@
1551015521
"node": "Postgres28",
1551115522
"type": "main"
1551215523
}
15513-
],
15514-
[
15515-
{
15516-
"index": 0,
15517-
"node": "Postgres11",
15518-
"type": "main"
15519-
}
1552015524
]
1552115525
]
1552215526
},
@@ -16299,31 +16303,6 @@
1629916303
},
1630016304
"outputKey": "getRewardAmount",
1630116305
"renameOutput": true
16302-
},
16303-
{
16304-
"conditions": {
16305-
"combinator": "and",
16306-
"conditions": [
16307-
{
16308-
"id": "05512e6a-84db-432b-a3d9-1fef6bbf6c04",
16309-
"leftValue": "={{ $('Webhook').item.json.body.method }}",
16310-
"operator": {
16311-
"name": "filter.operator.equals",
16312-
"operation": "equals",
16313-
"type": "string"
16314-
},
16315-
"rightValue": "claimRewards"
16316-
}
16317-
],
16318-
"options": {
16319-
"caseSensitive": true,
16320-
"leftValue": "",
16321-
"typeValidation": "strict",
16322-
"version": 2
16323-
}
16324-
},
16325-
"outputKey": "claimRewards",
16326-
"renameOutput": true
1632716306
}
1632816307
]
1632916308
}
@@ -19404,14 +19383,14 @@
1940419383
"values": [
1940519384
{
1940619385
"column": "id",
19407-
"value": "={{ $json.authToken.user.id }}"
19386+
"value": "={{ $('Parse Auth Token').item.json.authToken.user.id }}"
1940819387
}
1940919388
]
1941019389
}
1941119390
},
1941219391
"position": [
19413-
2520,
19414-
5600
19392+
3960,
19393+
-540
1941519394
],
1941619395
"type": "n8n-nodes-base.postgres",
1941719396
"typeVersion": 2.6
@@ -19445,8 +19424,8 @@
1944519424
}
1944619425
},
1944719426
"position": [
19448-
2720,
19449-
5600
19427+
4160,
19428+
-540
1945019429
],
1945119430
"type": "n8n-nodes-base.if",
1945219431
"typeVersion": 2.2
@@ -19469,8 +19448,8 @@
1946919448
}
1947019449
},
1947119450
"position": [
19472-
2940,
19473-
5680
19451+
4380,
19452+
-460
1947419453
],
1947519454
"type": "n8n-nodes-base.set",
1947619455
"typeVersion": 3.4
@@ -19493,8 +19472,8 @@
1949319472
"query": "select \n\tstring_agg(amount, ',') as amounts\nfrom (\n\tselect rh.id, rh.amount\n\tfrom \"default\".reward_history rh \n\tjoin \"default\".usage_history uh on uh.id = rh.related_item_id and rh.related_item_type = 'usage-caller'\n\twhere uh.caller_username = $1\n\t\tand rh.tx_hash is null\n\t\tand rh.amount != '0'\n\t\t\n\tunion all\n\t\n\tselect rh.id, rh.amount\n\tfrom \"default\".reward_history rh \n\tjoin \"default\".warning w on w.id = rh.related_item_id and rh.related_item_type = 'bug'\n\twhere w.username = $1\n\t\tand rh.tx_hash is null\n\t\tand rh.amount != '0'\n)"
1949419473
},
1949519474
"position": [
19496-
3140,
19497-
5520
19475+
4580,
19476+
-620
1949819477
],
1949919478
"type": "n8n-nodes-base.postgres",
1950019479
"typeVersion": 2.6
@@ -19515,8 +19494,8 @@
1951519494
"query": "select \n\t(select value from environment.variables where type = 'BUG_REWARD_AMOUNT') as bug_reward_amount,\n\t(select value from environment.variables where type = 'USAGE_REWARD_AMOUNT') as usage_reward_amount,\n\t(select value from environment.variables where type = 'REWARD_ACCOUNT_ID') as reward_account_id,\n\t(select value from environment.variables where type = 'REWARD_ACCOUNT_PRIVATE_KEY') as reward_account_private_key,\n\t(select value from environment.variables where type = 'MAX_USAGE_REWARD_AMOUNT') as max_usage_reward_amount,\n (select value from environment.variables where type = 'TELEGRAM_MONITORING_CHAT_ID') as telegram_monitoring_chat_id,\n\t(select value from environment.variables where type = 'TELEGRAM_MONITORING_TOPIC_ID') as telegram_monitoring_topic_id"
1951619495
},
1951719496
"position": [
19518-
2940,
19519-
5520
19497+
4380,
19498+
-620
1952019499
],
1952119500
"type": "n8n-nodes-base.postgres",
1952219501
"typeVersion": 2.6
@@ -19532,8 +19511,8 @@
1953219511
"senderId": "={{ $('GetVariables').item.json.reward_account_id }}"
1953319512
},
1953419513
"position": [
19535-
3800,
19536-
5520
19514+
5240,
19515+
-620
1953719516
],
1953819517
"type": "@dapplets/n8n-nodes-near-protocol.transfer",
1953919518
"typeVersion": 1
@@ -19546,8 +19525,8 @@
1954619525
"mode": "runOnceForEachItem"
1954719526
},
1954819527
"position": [
19549-
3360,
19550-
5520
19528+
4800,
19529+
-620
1955119530
],
1955219531
"type": "n8n-nodes-base.code",
1955319532
"typeVersion": 2
@@ -19570,8 +19549,8 @@
1957019549
}
1957119550
},
1957219551
"position": [
19573-
4040,
19574-
5680
19552+
5480,
19553+
-460
1957519554
],
1957619555
"type": "n8n-nodes-base.set",
1957719556
"typeVersion": 3.4
@@ -19593,8 +19572,8 @@
1959319572
"query": "update \"default\".reward_history\nset tx_hash = $2, recipient_account_id = $3\nwhere id in (\n\tselect rh.id\n\tfrom \"default\".reward_history rh \n\tjoin \"default\".usage_history uh on uh.id = rh.related_item_id and rh.related_item_type = 'usage-caller'\n\twhere uh.caller_username = $1\n\t\tand rh.tx_hash is null\n\t\tand rh.amount != '0'\n\t\t\n\tunion all\n\t\n\tselect rh.id\n\tfrom \"default\".reward_history rh \n\tjoin \"default\".warning w on w.id = rh.related_item_id and rh.related_item_type = 'bug'\n\twhere w.username = $1\n\t\tand rh.tx_hash is null\n\t\tand rh.amount != '0'\n)"
1959419573
},
1959519574
"position": [
19596-
4040,
19597-
5520
19575+
5480,
19576+
-620
1959819577
],
1959919578
"type": "n8n-nodes-base.postgres",
1960019579
"typeVersion": 2.6
@@ -19627,8 +19606,8 @@
1962719606
}
1962819607
},
1962919608
"position": [
19630-
3580,
19631-
5520
19609+
5020,
19610+
-620
1963219611
],
1963319612
"type": "n8n-nodes-base.if",
1963419613
"typeVersion": 2.2
@@ -19651,8 +19630,8 @@
1965119630
}
1965219631
},
1965319632
"position": [
19654-
3800,
19655-
5720
19633+
5240,
19634+
-420
1965619635
],
1965719636
"type": "n8n-nodes-base.set",
1965819637
"typeVersion": 3.4
@@ -19709,6 +19688,21 @@
1970919688
],
1971019689
"type": "n8n-nodes-base.merge",
1971119690
"typeVersion": 3.1
19691+
},
19692+
{
19693+
"id": "b9bbf6fd-e5bb-4d1c-b44b-564d2522814b",
19694+
"name": "Sticky Note",
19695+
"parameters": {
19696+
"content": "Claim Rewards",
19697+
"height": 480,
19698+
"width": 1730
19699+
},
19700+
"position": [
19701+
3940,
19702+
-660
19703+
],
19704+
"type": "n8n-nodes-base.stickyNote",
19705+
"typeVersion": 1
1971219706
}
1971319707
],
1971419708
"pinData": {
@@ -19720,8 +19714,8 @@
1972019714
"tags": [
1972119715
],
1972219716
"triggerCount": 1,
19723-
"updatedAt": "2025-05-15T16:19:08.000Z",
19724-
"versionId": "8382ffdc-a1b5-46d9-a642-ea8e0246be06"
19717+
"updatedAt": "2025-05-16T11:40:04.000Z",
19718+
"versionId": "d83b53bb-6b8d-4a7e-ab9a-cc2c880a9555"
1972519719
},
1972619720
{
1972719721
"active": true,

0 commit comments

Comments
 (0)