CurrencySavings
Creates or updates a currency savings plan that automatically transfers currency units to reach a target balance.
Request
POST /nxt?requestType=currencySavings
Parameters
| Name | Type | Description | Required |
|---|---|---|---|
secretPhrase | string | Account's secret passphrase | Yes |
currency | long | Currency ID | Yes |
unitsQNT | long | Amount to add per period | Yes |
targetUnitsQNT | long | Target balance to reach | Yes |
feeRateQNTPerFXT | long | Transaction fee rate | Optional |
deadline | int | Transaction deadline in minutes | Optional |
How It Works
- A savings plan automatically transfers
unitsQNTfrom the account to the savings balance at each period - The plan continues until
targetUnitsQNTis reached - If
targetUnitsQNTis 0, the plan is cancelled - The current savings balance and target can be viewed via GetAccountCurrencySavings
Response
{
"transaction": "1234567890123456789",
"fullHash": "abc123...",
"errorCode": 0,
"errorDescription": ""
}
Error Handling
| Error | Condition |
|---|---|
INCORRECT_CURRENCY_SAVINGS_UNITS | Invalid units/target combination |
NOT_ENOUGH_CURRENCY | Insufficient currency balance |
Example
# Set up savings plan
curl -X POST http://localhost:22024/nxt \
-d "requestType=currencySavings" \
-d "secretPhrase=your_phrase" \
-d "currency=987654321" \
-d "unitsQNT=100000000" \
-d "targetUnitsQNT=1000000000"
# Cancel savings plan (target = 0)
curl -X POST http://localhost:22024/nxt \
-d "requestType=currencySavings" \
-d "secretPhrase=your_phrase" \
-d "currency=987654321" \
-d "unitsQNT=0" \
-d "targetUnitsQNT=0"