Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 13befc4

Browse files
committed
Update JSON API for Super Economy
1 parent b01f6bc commit 13befc4

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

api/jsonapi.go

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3473,6 +3473,8 @@ func (i *jsonAPIHandler) GETEstimateFee(w http.ResponseWriter, r *http.Request)
34733473
feeLevel = wallet.NORMAL
34743474
case "ECONOMIC":
34753475
feeLevel = wallet.ECONOMIC
3476+
case "SUPER_ECONOMIC":
3477+
feeLevel = wallet.SUPER_ECONOMIC
34763478
default:
34773479
ErrorResponse(w, http.StatusBadRequest, "Unknown feeLevel")
34783480
return
@@ -3516,25 +3518,28 @@ func (i *jsonAPIHandler) GETEstimateFee(w http.ResponseWriter, r *http.Request)
35163518
func (i *jsonAPIHandler) GETFees(w http.ResponseWriter, r *http.Request) {
35173519
_, coinType := path.Split(r.URL.Path)
35183520
type fees struct {
3519-
Priority *repo.CurrencyValue `json:"priority"`
3520-
Normal *repo.CurrencyValue `json:"normal"`
3521-
Economic *repo.CurrencyValue `json:"economic"`
3521+
Priority *repo.CurrencyValue `json:"priority"`
3522+
Normal *repo.CurrencyValue `json:"normal"`
3523+
Economic *repo.CurrencyValue `json:"economic"`
3524+
SuperEconomic *repo.CurrencyValue `json:"superEconomic"`
35223525
}
35233526
if coinType == "fees" {
35243527
ret := make(map[string]interface{})
35253528
for ct, wal := range i.node.Multiwallet {
35263529
priority := wal.GetFeePerByte(wallet.PRIOIRTY)
35273530
normal := wal.GetFeePerByte(wallet.NORMAL)
35283531
economic := wal.GetFeePerByte(wallet.ECONOMIC)
3532+
superEconomic := wal.GetFeePerByte(wallet.SUPER_ECONOMIC)
35293533
defn, err := i.node.LookupCurrency(wal.CurrencyCode())
35303534
if err != nil {
35313535
ErrorResponse(w, http.StatusInternalServerError, err.Error())
35323536
return
35333537
}
35343538
ret[ct.CurrencyCode()] = fees{
3535-
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
3536-
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
3537-
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
3539+
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
3540+
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
3541+
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
3542+
SuperEconomic: &repo.CurrencyValue{Currency: defn, Amount: &superEconomic},
35383543
}
35393544
}
35403545
out, err := json.MarshalIndent(ret, "", " ")
@@ -3553,15 +3558,17 @@ func (i *jsonAPIHandler) GETFees(w http.ResponseWriter, r *http.Request) {
35533558
priority := wal.GetFeePerByte(wallet.PRIOIRTY)
35543559
normal := wal.GetFeePerByte(wallet.NORMAL)
35553560
economic := wal.GetFeePerByte(wallet.ECONOMIC)
3561+
superEconomic := wal.GetFeePerByte(wallet.SUPER_ECONOMIC)
35563562
defn, err := i.node.LookupCurrency(wal.CurrencyCode())
35573563
if err != nil {
35583564
ErrorResponse(w, http.StatusInternalServerError, err.Error())
35593565
return
35603566
}
35613567
f := fees{
3562-
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
3563-
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
3564-
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
3568+
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
3569+
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
3570+
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
3571+
SuperEconomic: &repo.CurrencyValue{Currency: defn, Amount: &superEconomic},
35653572
}
35663573
out, err := json.MarshalIndent(f, "", " ")
35673574
if err != nil {

0 commit comments

Comments
 (0)