Skip to main content

CurrencySavings

Creates or updates a currency savings plan that automatically transfers currency units to reach a target balance.

Request

POST /nxt?requestType=currencySavings

Parameters

NameTypeDescriptionRequired
secretPhrasestringAccount's secret passphraseYes
currencylongCurrency IDYes
unitsQNTlongAmount to add per periodYes
targetUnitsQNTlongTarget balance to reachYes
feeRateQNTPerFXTlongTransaction fee rateOptional
deadlineintTransaction deadline in minutesOptional

How It Works

  • A savings plan automatically transfers unitsQNT from the account to the savings balance at each period
  • The plan continues until targetUnitsQNT is reached
  • If targetUnitsQNT is 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

ErrorCondition
INCORRECT_CURRENCY_SAVINGS_UNITSInvalid units/target combination
NOT_ENOUGH_CURRENCYInsufficient 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"