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

Commit

Permalink
Merge 5c0e3af into b01f6bc
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmabc committed May 4, 2020
2 parents b01f6bc + 5c0e3af commit f4b8d61
Show file tree
Hide file tree
Showing 15 changed files with 132 additions and 102 deletions.
25 changes: 16 additions & 9 deletions api/jsonapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -3473,6 +3473,8 @@ func (i *jsonAPIHandler) GETEstimateFee(w http.ResponseWriter, r *http.Request)
feeLevel = wallet.NORMAL
case "ECONOMIC":
feeLevel = wallet.ECONOMIC
case "SUPER_ECONOMIC":
feeLevel = wallet.SUPER_ECONOMIC
default:
ErrorResponse(w, http.StatusBadRequest, "Unknown feeLevel")
return
Expand Down Expand Up @@ -3516,25 +3518,28 @@ func (i *jsonAPIHandler) GETEstimateFee(w http.ResponseWriter, r *http.Request)
func (i *jsonAPIHandler) GETFees(w http.ResponseWriter, r *http.Request) {
_, coinType := path.Split(r.URL.Path)
type fees struct {
Priority *repo.CurrencyValue `json:"priority"`
Normal *repo.CurrencyValue `json:"normal"`
Economic *repo.CurrencyValue `json:"economic"`
Priority *repo.CurrencyValue `json:"priority"`
Normal *repo.CurrencyValue `json:"normal"`
Economic *repo.CurrencyValue `json:"economic"`
SuperEconomic *repo.CurrencyValue `json:"superEconomic"`
}
if coinType == "fees" {
ret := make(map[string]interface{})
for ct, wal := range i.node.Multiwallet {
priority := wal.GetFeePerByte(wallet.PRIOIRTY)
normal := wal.GetFeePerByte(wallet.NORMAL)
economic := wal.GetFeePerByte(wallet.ECONOMIC)
superEconomic := wal.GetFeePerByte(wallet.SUPER_ECONOMIC)
defn, err := i.node.LookupCurrency(wal.CurrencyCode())
if err != nil {
ErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
ret[ct.CurrencyCode()] = fees{
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
SuperEconomic: &repo.CurrencyValue{Currency: defn, Amount: &superEconomic},
}
}
out, err := json.MarshalIndent(ret, "", " ")
Expand All @@ -3553,15 +3558,17 @@ func (i *jsonAPIHandler) GETFees(w http.ResponseWriter, r *http.Request) {
priority := wal.GetFeePerByte(wallet.PRIOIRTY)
normal := wal.GetFeePerByte(wallet.NORMAL)
economic := wal.GetFeePerByte(wallet.ECONOMIC)
superEconomic := wal.GetFeePerByte(wallet.SUPER_ECONOMIC)
defn, err := i.node.LookupCurrency(wal.CurrencyCode())
if err != nil {
ErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
f := fees{
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
Priority: &repo.CurrencyValue{Currency: defn, Amount: &priority},
Normal: &repo.CurrencyValue{Currency: defn, Amount: &normal},
Economic: &repo.CurrencyValue{Currency: defn, Amount: &economic},
SuperEconomic: &repo.CurrencyValue{Currency: defn, Amount: &superEconomic},
}
out, err := json.MarshalIndent(f, "", " ")
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion core/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func processOfflineDirectOrder(n *OpenBazaarNode, wal wallet.Wallet, contract *p
if !ok {
return "", "", *big.NewInt(0), errors.New("invalid payment amount")
}
fpb := wal.GetFeePerByte(wallet.NORMAL)
fpb := wal.GetFeePerByte(wallet.SUPER_ECONOMIC)
f := new(big.Int).Mul(&fpb, big.NewInt(int64(EscrowReleaseSize)))
t := new(big.Int).Div(total, big.NewInt(4))

Expand Down
2 changes: 2 additions & 0 deletions core/spend.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ func (n *OpenBazaarNode) Spend(args *SpendRequest) (*SpendResponse, error) {
feeLevel = wallet.NORMAL
case "ECONOMIC":
feeLevel = wallet.ECONOMIC
case "SUPER_ECONOMIC":
feeLevel = wallet.SUPER_ECONOMIC
default:
feeLevel = wallet.NORMAL
}
Expand Down
21 changes: 11 additions & 10 deletions schema/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,17 @@ type WalletsConfig struct {
}

type CoinConfig struct {
Type string `json:"Type"`
APIPool []string `json:"API"`
APITestnetPool []string `json:"APITestnet"`
MaxFee uint64 `json:"MaxFee"`
FeeAPI string `json:"FeeAPI"`
HighFeeDefault uint64 `json:"HighFeeDefault"`
MediumFeeDefault uint64 `json:"MediumFeeDefault"`
LowFeeDefault uint64 `json:"LowFeeDefault"`
TrustedPeer string `json:"TrustedPeer"`
WalletOptions map[string]interface{} `json:"WalletOptions"`
Type string `json:"Type"`
APIPool []string `json:"API"`
APITestnetPool []string `json:"APITestnet"`
MaxFee uint64 `json:"MaxFee"`
FeeAPI string `json:"FeeAPI"`
SuperLowFeeDefault uint64 `json:"SuperLowFeeDefault"`
HighFeeDefault uint64 `json:"HighFeeDefault"`
MediumFeeDefault uint64 `json:"MediumFeeDefault"`
LowFeeDefault uint64 `json:"LowFeeDefault"`
TrustedPeer string `json:"TrustedPeer"`
WalletOptions map[string]interface{} `json:"WalletOptions"`
}

type DataSharing struct {
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/OpenBazaar/multiwallet/bitcoin/wallet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 49 additions & 43 deletions vendor/github.com/OpenBazaar/multiwallet/config/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 14 additions & 10 deletions vendor/github.com/OpenBazaar/multiwallet/util/fees.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/OpenBazaar/multiwallet/zcash/wallet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions vendor/github.com/OpenBazaar/spvwallet/config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 14 additions & 9 deletions vendor/github.com/OpenBazaar/spvwallet/fees.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions vendor/github.com/OpenBazaar/spvwallet/wallet.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f4b8d61

Please sign in to comment.