Skip to content

Commit

Permalink
Merge pull request #5 from LIT-Protocol/network-specific-autotopup
Browse files Browse the repository at this point in the history
feat(lit-task-auto-top-up):  Update worker to support 1-task-per-network on a single mongodb backend task tracking instance
  • Loading branch information
MaximusHaximus authored Jul 11, 2024
2 parents 498f526 + 58861f6 commit c6427d7
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 80 deletions.
9 changes: 7 additions & 2 deletions bin/validateJSONRecipients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import { recipientDetailSchema } from 'lit-task-auto-top-up';
// eslint-disable-next-line import/no-extraneous-dependencies
import { z } from 'zod';

import recipientList from '../worker/recipient_list.json' assert { type: 'json' };
// TODO: Delete this file and reference once PR #5 is merged and the existing worker has been updated to use the new habanero-specific path
import deprecatedHabaneroRecipientList from '../worker/recipient_list.json' assert { type: 'json' };
import habanberoRecipientList from '../worker/recipient_list_habanero.json' assert { type: 'json' };
import manzanoRecipientList from '../worker/recipient_list_manzano.json' assert { type: 'json' };

z.array(recipientDetailSchema).parse(recipientList);
z.array(recipientDetailSchema).parse(deprecatedHabaneroRecipientList);
z.array(recipientDetailSchema).parse(habanberoRecipientList);
z.array(recipientDetailSchema).parse(manzanoRecipientList);
2 changes: 1 addition & 1 deletion packages/lit-task-auto-top-up/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
"dependencies": {
"@hokify/agenda": "^6.3.0",
"@lit-protocol/contracts-sdk": "^4.1.1",
"@lit-protocol/contracts-sdk": "^6.1.0",
"awaity": "^1.0.0",
"bs58": "^5.0.0",
"consola": "^3.2.3",
Expand Down
108 changes: 35 additions & 73 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions worker/recipient_list.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[
{
"recipientAddress": "0x9f32f6555a117ac137775973C6856bC52c249C80",
"daysUntilExpires": 5,
"requestsPerSecond": 5
"daysUntilExpires": 20,
"requestsPerSecond": 20
},
{
"recipientAddress": "0xB34f1F28F25485b074c623D3711F4b5ea91d9CFb",
Expand All @@ -25,4 +25,3 @@
"requestsPerSecond": 10000
}
]

27 changes: 27 additions & 0 deletions worker/recipient_list_habanero.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"recipientAddress": "0x9f32f6555a117ac137775973C6856bC52c249C80",
"daysUntilExpires": 20,
"requestsPerSecond": 20
},
{
"recipientAddress": "0xB34f1F28F25485b074c623D3711F4b5ea91d9CFb",
"daysUntilExpires": 15,
"requestsPerSecond": 15
},
{
"recipientAddress": "0x1F62583538CDB2CB3656Ed43A46693F92DDa6302",
"daysUntilExpires": 30,
"requestsPerSecond": 10000
},
{
"recipientAddress": "0x4447D4d650cE9E63E21D2AA799e8016dEBf1e272",
"daysUntilExpires": 30,
"requestsPerSecond": 10000
},
{
"recipientAddress": "0x4b271D43c38D91f3791E97f31942A22e124DF441",
"daysUntilExpires": 30,
"requestsPerSecond": 10000
}
]
7 changes: 7 additions & 0 deletions worker/recipient_list_manzano.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{
"recipientAddress": "0x9f32f6555a117ac137775973C6856bC52c249C80",
"daysUntilExpires": 20,
"requestsPerSecond": 20
}
]
2 changes: 1 addition & 1 deletion worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const taskClient = createTaskClient({ config: taskClientConfig });

const autoTopUpTaskConfig = getAutoTopUpTaskConfig();
const autoTopUpTaskHandler = new AutoTopUpTaskHandler({ config: autoTopUpTaskConfig });
const AUTO_TOP_UP_TASK_NAME = `daily ${autoTopUpTaskName}`;
const AUTO_TOP_UP_TASK_NAME = `daily ${autoTopUpTaskName} - ${autoTopUpTaskConfig.envConfig.LIT_NETWORK}`;

async function gogo() {
taskClient.start().then(async () => {
Expand Down

0 comments on commit c6427d7

Please sign in to comment.