Simple token balance manager that persists transactions to AsyncStorage.
Tracks all consumable token transactions and their corresponding amounts.
When a transaction is added, it is appended to the persisted list.
When a transaction is removed (refund), it is removed from the list.
The balance is the sum of all amounts in the list.
consttokensManager = newIapticTokensManager(); // ... tokensManager is now tracking consumable purchases that have a tokenType defined. constbalance = tokensManager.getBalance('coin');
Simple token balance manager that persists transactions to AsyncStorage.
Tracks all consumable token transactions and their corresponding amounts. When a transaction is added, it is appended to the persisted list. When a transaction is removed (refund), it is removed from the list. The balance is the sum of all amounts in the list.
Requires
@react-native-async-storage/async-storage — install with:
npm install @react-native-async-storage/async-storage@~2.1.0See
Example