new TransactionHelper(chainId)
constructor
Parameters:
Name | Type | Description |
---|---|---|
chainId |
string | chain id |
Methods
-
afterAirdropPayFailure(brandedTokenAddress, airdropAddress, spenderAddress, estimatedPayAmount, estimatedAirdropAmount, airdropBugdetAddress)
-
After airdrop pay function, this is called after the pay is failed
Parameters:
Name Type Description brandedTokenAddress
string branded token address airdropAddress
string airdrop contract address spenderAddress
string spender address estimatedPayAmount
BigNumber estimated pay amount in weis estimatedAirdropAmount
BigNumber estimated airdrop amount airdropBugdetAddress
string airdrop budget holder address Returns:
- Type
- promise.<result>
-
afterAirdropPaySuccess(brandedTokenAddress, airdropAddress, spenderAddress, estimatedPayAmount, estimatedAirdropAmount, beneficiaryAddress, actualBeneficiaryAmount, commissionBeneficiaryAddress, actualCommissionBeneficiaryAmount, actualAirdropAmount, airdropBugdetAddress)
-
After airdrop pay function, this is called after the pay is successfull
Parameters:
Name Type Description brandedTokenAddress
string branded token address airdropAddress
string airdrop contract address spenderAddress
string spender address estimatedPayAmount
BigNumber estimated pay amount in weis estimatedAirdropAmount
BigNumber estimated airdrop amount beneficiaryAddress
string beneficiary address actualBeneficiaryAmount
BigNumber actual beneficiary amount in weis commissionBeneficiaryAddress
string commission beneficiary address actualCommissionBeneficiaryAmount
BigNumber actual commission beneficiary amount actualAirdropAmount
BigNumber actual airdrop amount airdropBugdetAddress
string airdrop budget holder address Returns:
- Type
- promise.<result>
-
afterPayFailure(brandedTokenAddress, spenderAddress, estimatedPayAmount)
-
After pay function, this is called after the pay is failed
Parameters:
Name Type Description brandedTokenAddress
string branded token address spenderAddress
string spender address estimatedPayAmount
BigNumber estimated pay amount in weis Returns:
- Type
- promise.<result>
-
afterPaySuccess(brandedTokenAddress, spenderAddress, estimatedPayAmount, beneficiaryAddress, actualBeneficiaryAmount, commissionBeneficiaryAddress, actualCommissionBeneficiaryAmount)
-
After pay function, this is called after the pay is successfull
Parameters:
Name Type Description brandedTokenAddress
string branded token address spenderAddress
string spender address estimatedPayAmount
BigNumber estimated pay amount in weis beneficiaryAddress
string beneficiary address actualBeneficiaryAmount
BigNumber actual beneficiary amount in weis commissionBeneficiaryAddress
string commission beneficiary address actualCommissionBeneficiaryAmount
BigNumber actual commission beneficiary amount Returns:
- Type
- promise.<result>
-
beforeAirdropPay(brandedTokenAddress, airdropAddress, spenderAddress, totalTransferAmount, airdropBalanceToUse, airdropBugdetAddress)
-
Before airdrop pay function, this is called before the pay is called
Parameters:
Name Type Description brandedTokenAddress
string branded token address airdropAddress
string airdrop contract address spenderAddress
string spender address totalTransferAmount
BigNumber estimated pay amount in weis airdropBalanceToUse
BigNumber estimated airdrop amount airdropBugdetAddress
string airdrop budget holder address Returns:
- Type
- promise.<array.<result>>
-
beforePay(brandedTokenAddress, spenderAddress, estimatedPayAmount)
-
Before pay function, this is called before the pay is called
Parameters:
Name Type Description brandedTokenAddress
string branded token address spenderAddress
string spender address estimatedPayAmount
BigNumber estimated pay amount in weis Returns:
- Type
- promise.<result>
-
clearUserDetailCache(airdropContractAddress, owner)
-
Clear user detail cache for the user addressess
Parameters:
Name Type Description airdropContractAddress
string airdrop contract address owner
string Account address Returns:
- Type
- promise.<result>
-
creditAirdropBalance(airdropContractAddress, owner, bigAmount)
-
Credit airdrop balance in db and clear cache It decreases airdrop_used_amount for user in user_airdrop_details table Clears the cache
Parameters:
Name Type Description airdropContractAddress
string airdrop contract address owner
string Account address bigAmount
BigNumber amount to be credited Returns:
- Type
- promise.<result>
-
creditBalance(brandedTokenAddress, owner, bigAmount)
-
Credit balance in cache
Parameters:
Name Type Description brandedTokenAddress
string branded token address owner
string Account address bigAmount
BigNumber amount to be credited Returns:
- Type
- promise.<result>
-
debitAirdropBalance(airdropContractAddress, owner, bigAmount)
-
Debit airdrop balance in db and clear cache It increases airdrop_used_amount for user in user_airdrop_details table Clears the cache
Parameters:
Name Type Description airdropContractAddress
string airdrop contract address owner
string Account address bigAmount
BigNumber amount to be debited Returns:
- Type
- promise.<result>
-
debitBalance(brandedTokenAddress, owner, bigAmount)
-
Debit balance in cache
Parameters:
Name Type Description brandedTokenAddress
string branded token address owner
string Account address bigAmount
BigNumber amount to be debited Returns:
- Type
- promise.<result>
-
getActualAmountsFromDecodedEvents(decodedEvent, eventName)
-
Get actual beneficiary amount, actual commission amount and actual airdrop amount from decoded events
Parameters:
Name Type Description decodedEvent
Object Decoded event from receipt eventName
string Event name Returns:
- Type
- result
-
getActualAmountsFromReceipt(transactionReceipt, addressToNameMap, eventName)
-
Get actual beneficiary amount, actual commission amount and actual airdrop amount from transaction receipt
Parameters:
Name Type Description transactionReceipt
Object transaction receipt addressToNameMap
Object address to name map object eventName
string Event name Returns:
- Type
- result
-
isAllResponseSuccessful(results)
-
Check if all response is success
Parameters:
Name Type Description results
array response array Returns:
- Type
- boolean
-
updateAirdropBalance(airdropContractAddress, owner, toCreditBigAmount)
-
Update airdrop balance
Parameters:
Name Type Description airdropContractAddress
string airdrop contract address owner
string Account address toCreditBigAmount
BigNumber to credit amount - this can be negative also Returns:
- Type
- promise.<result>
-
updateBalance(brandedTokenAddress, owner, toCreditBigAmount)
-
Update balance to cache
Parameters:
Name Type Description brandedTokenAddress
string branded token address owner
string Account address toCreditBigAmount
BigNumber to credit amount - this can be negative also Returns:
- Type
- promise.<result>