Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replaced HbarLimit module with the new HbarLimitService class (#…
…3024) * fix: converted constant HBAR_RATE_LIMIT_DURATION from var into function Signed-off-by: Logan Nguyen <[email protected]> * chore: added jsdoc to private vars in hapiService module Signed-off-by: Logan Nguyen <[email protected]> * feat: initialized an instance of HbarLimitService in relay.ts Signed-off-by: Logan Nguyen <[email protected]> * feat: integrated HbarLimitService instance into HapiService class Signed-off-by: Logan Nguyen <[email protected]> * feat: integrated HbarLimitService instance into SDKClient class Signed-off-by: Logan Nguyen <[email protected]> * feat: integrated HbarLimitService instance into MetricService class Signed-off-by: Logan Nguyen <[email protected]> * fix: modified addExpense to turn ethAddress to be optional Some queries like getAccountInfo, getBalanceInfo, FileContentsQuery, etc. also add expense to remainingBalance but don't necessarily need to have an originalCaller (ethAddress). Therefore, addExpense can accept nullable ethAddress value. Only when ethAddress or ipAddress is valid, utilize spendingPlan logic. Otherwise, skip completely. Signed-off-by: Logan Nguyen <[email protected]> * feat: added getRemainingBudget() getter Signed-off-by: Logan Nguyen <[email protected]> * feat: added originalCallerAddress to IExecuteTransactionEventPayload and IExecuteQueryEventPayload Signed-off-by: Logan Nguyen <[email protected]> * feat: removed metricService instance in relay Signed-off-by: Logan Nguyen <[email protected]> * feat: replaced hbarLimitter with hbarLimitService in MetricService class Signed-off-by: Logan Nguyen <[email protected]> * fix: added estimateFileTransactionsFee to Utils Signed-off-by: Logan Nguyen <[email protected]> * feat: added txConstructorName and updated log messages for shouldLimit Signed-off-by: Logan Nguyen <[email protected]> * fix: rework logic for estimateFileTransactionsFee Signed-off-by: Logan Nguyen <[email protected]> * feat: removed hbarLimiter instance in SDKClient classes Signed-off-by: Logan Nguyen <[email protected]> * feat: deleted HbarLimit module from codease Signed-off-by: Logan Nguyen <[email protected]> * feat: reverted logic reworked on estimateFileTransactionsFee Signed-off-by: Logan Nguyen <[email protected]> * feat: added preemptive rate limit logic to createFile() method Signed-off-by: Logan Nguyen <[email protected]> * test: updated hbarLimiter.spec.ts Signed-off-by: Logan Nguyen <[email protected]> * fix: added names for child loggers for spending plan repo Signed-off-by: Logan Nguyen <[email protected]> * chore: reverted "feat: added getRemainingBudget() getter" This reverts commit fd9e119 and updated related tests Signed-off-by: Logan Nguyen <[email protected]> * fix: updated log message Signed-off-by: Logan Nguyen <[email protected]> * test: added HBAR_DAILY_LIMIT_BASIC to localTestEnv Signed-off-by: Logan Nguyen <[email protected]> * fix: converted function HBAR_RATE_LIMIT_DURATION from function into var Signed-off-by: Logan Nguyen <[email protected]> * fix: reverted "feat: removed metricService instance in relay" This reverts commit e45c321. Signed-off-by: Logan Nguyen <[email protected]> * chore: updated log message Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed failing test in hapiService Signed-off-by: Logan Nguyen <[email protected]> * fix: reverted ethAddress back to be a required param for addExpense Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed failing test in hapiService.spec.ts Signed-off-by: Logan Nguyen <[email protected]> * fix: loaded env into prcess.env for constant module Signed-off-by: Logan Nguyen <[email protected]> * chore: removed duplicating doc for estimateFileTransactionsFee Signed-off-by: Logan Nguyen <[email protected]> * chore: sort imports Signed-off-by: Victor Yanev <[email protected]> * fix: removed ipAddresses from log in hbarLimitService Signed-off-by: Logan Nguyen <[email protected]> * fix: renamed isDailyBudgetExceeded -> isTotalBudgetExceeded Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed conflicts after rebased Signed-off-by: Logan Nguyen <[email protected]> * fix: fixed acceptance test for exhausting HBAR case Signed-off-by: Logan Nguyen <[email protected]> * fix: renamed HBAR_DAILY_LIMIT_BASIC to HBAR_RATE_LIMIT_BASIC Signed-off-by: Logan Nguyen <[email protected]> * fix: overrode env vars for npm acceptancetest:hbarlimiter script Signed-off-by: Logan Nguyen <[email protected]> * fix: moved logic of adding expenses to totalBudget above hbarSpendingPlan Signed-off-by: Logan Nguyen <[email protected]> --------- Signed-off-by: Logan Nguyen <[email protected]> Signed-off-by: Victor Yanev <[email protected]> Co-authored-by: Victor Yanev <[email protected]> Signed-off-by: Logan Nguyen <[email protected]>
- Loading branch information