X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=api%2Fquery.go;h=fba82b859bc54f0bf3750e40e8a7705e6175a517;hb=3f53de9ec5cce160d620d98bf5b5b706e0ded743;hp=abbda524979609941983a1069b66cc43201b14dd;hpb=e2294cec495077e4d76d8ff22ad4cae63c4eb2d2;p=bytom%2Fvapor.git diff --git a/api/query.go b/api/query.go index abbda524..fba82b85 100644 --- a/api/query.go +++ b/api/query.go @@ -11,7 +11,7 @@ import ( "github.com/vapor/asset" "github.com/vapor/blockchain/query" "github.com/vapor/blockchain/signers" - "github.com/vapor/blockchain/txbuilder" + "github.com/vapor/common/arithmetic" "github.com/vapor/consensus" "github.com/vapor/crypto/ed25519" "github.com/vapor/crypto/ed25519/chainkd" @@ -279,12 +279,11 @@ func (a *API) decodeRawTransaction(ctx context.Context, ins struct { tx.Outputs = append(tx.Outputs, a.wallet.BuildAnnotatedOutput(&ins.Tx, i)) } - tx.Fee = txbuilder.CalculateTxFee(&ins.Tx) + tx.Fee, _ = arithmetic.CalculateTxFee(&ins.Tx) return NewSuccessResponse(tx) } -// POST /list-unspent-outputs -func (a *API) listUnspentOutputs(ctx context.Context, filter struct { +type ListUtxosReq struct { AccountID string `json:"account_id"` AccountAlias string `json:"account_alias"` ID string `json:"id"` @@ -292,7 +291,10 @@ func (a *API) listUnspentOutputs(ctx context.Context, filter struct { SmartContract bool `json:"smart_contract"` From uint `json:"from"` Count uint `json:"count"` -}) Response { +} + +// POST /list-unspent-outputs +func (a *API) listUnspentOutputs(ctx context.Context, filter ListUtxosReq) Response { accountID := filter.AccountID if filter.AccountAlias != "" { acc, err := a.wallet.AccountMgr.FindByAlias(filter.AccountAlias) @@ -327,7 +329,7 @@ func (a *API) listUnspentOutputs(ctx context.Context, filter struct { // return gasRate func (a *API) gasRate() Response { - gasrate := map[string]int64{"gas_rate": consensus.VMGasRate} + gasrate := map[string]int64{"gas_rate": consensus.ActiveNetParams.VMGasRate} return NewSuccessResponse(gasrate) }