You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/delegation-toolkit/src/DelegationFramework/ERC20PeriodTransferEnforcer/methods/getAvailableAmount.ts
Copy file name to clipboardExpand all lines: packages/delegation-toolkit/src/DelegationFramework/MultiTokenPeriodEnforcer/methods/getAvailableAmount.ts
Copy file name to clipboardExpand all lines: packages/delegation-toolkit/src/DelegationFramework/NativeTokenPeriodTransferEnforcer/methods/getAvailableAmount.ts
Copy file name to clipboardExpand all lines: packages/delegation-toolkit/src/DelegationFramework/NativeTokenStreamingEnforcer/methods/getAvailableAmount.ts
+13-4Lines changed: 13 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ export const read = async ({
35
35
// Check if state exists (startTime != 0)
36
36
if(startTime!==0n){
37
37
// State exists, calculate available amount using the stored state
38
-
constavailableAmount=_getAvailableAmount({
38
+
constavailableAmount=getAvailableAmount({
39
39
initialAmount,
40
40
maxAmount,
41
41
amountPerSecond,
@@ -65,7 +65,7 @@ export const read = async ({
65
65
]=decodedTerms;
66
66
67
67
// Simulate using decoded terms with spent = 0
68
-
constavailableAmount=_getAvailableAmount({
68
+
constavailableAmount=getAvailableAmount({
69
69
initialAmount: decodedInitialAmount,
70
70
maxAmount: decodedMaxAmount,
71
71
amountPerSecond: decodedAmountPerSecond,
@@ -80,9 +80,18 @@ export const read = async ({
80
80
};
81
81
82
82
/**
83
-
* Replicates the internal _getAvailableAmount logic from the smart contract
83
+
* Replicates the internal _getAvailableAmount logic from the smart contract.
84
+
*
85
+
* @param allowance - The allowance object containing all parameters.
86
+
* @param allowance.initialAmount - The initial amount available.
87
+
* @param allowance.maxAmount - The maximum amount allowed.
88
+
* @param allowance.amountPerSecond - The amount streamed per second.
89
+
* @param allowance.startTime - The start time of the streaming.
90
+
* @param allowance.spent - The amount already spent.
91
+
* @param allowance.currentTimestamp - The current timestamp.
92
+
* @returns The available amount that can be spent.
0 commit comments