This pull request primarily focuses on the creation of a new MainnetCheckService class in the mainnetCheckService.ts file and the subsequent integration of this service into the existing codebase. The MainnetCheckService class is designed to interact with a DynamoDB database to track and manage the number of balance checks performed on a specific address. This is done to limit the number of balance checks to a maximum of three times, after which the user is required to perform a transaction on the mainnet to reset the check count.
The main changes can be grouped into two categories:
Creation of the MainnetCheckService:
mainnetCheckService.ts: A new MainnetCheckService class was created. This class includes methods to interact with a DynamoDB database, such as getAddressStatus and updateAddressStatus, and a checkAddressValidity method to manage the balance check count for a specific address.
Integration of MainnetCheckService into the existing codebase:
server.ts: Imported the MainnetCheckService and instantiated it. The checkAddressValidity method of the MainnetCheckService was then used in the router.post('/sendToken',...) method to replace the previous balance checking mechanism. 123
utils/mainnetBalanceCheck.ts: Added a new getNonce function to fetch the current nonce for a given address from the network.
utils/pipelineChecks.ts: Modified the checkMainnetBalancePipeline function to use the MainnetCheckService for balance checking and to handle potential internal errors. 12
This pull request primarily focuses on the creation of a new
MainnetCheckService
class in themainnetCheckService.ts
file and the subsequent integration of this service into the existing codebase. TheMainnetCheckService
class is designed to interact with a DynamoDB database to track and manage the number of balance checks performed on a specific address. This is done to limit the number of balance checks to a maximum of three times, after which the user is required to perform a transaction on the mainnet to reset the check count.The main changes can be grouped into two categories:
Creation of the
MainnetCheckService
:MainnetCheckService
class was created. This class includes methods to interact with a DynamoDB database, such asgetAddressStatus
andupdateAddressStatus
, and acheckAddressValidity
method to manage the balance check count for a specific address.Integration of
MainnetCheckService
into the existing codebase:MainnetCheckService
and instantiated it. ThecheckAddressValidity
method of theMainnetCheckService
was then used in therouter.post('/sendToken',...)
method to replace the previous balance checking mechanism. 1 2 3getNonce
function to fetch the current nonce for a given address from the network.checkMainnetBalancePipeline
function to use theMainnetCheckService
for balance checking and to handle potential internal errors. 1 2