diff --git a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go index 37b5f6a..4f2ef9f 100644 --- a/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go +++ b/src/github.com/stellar/gateway/compliance/handlers/request_handler_send.go @@ -119,11 +119,19 @@ func (rh *RequestHandler) HandlerSend(c web.C, w http.ResponseWriter, r *http.Re mutators := []interface{}{ b.Destination{destinationObject.AccountID}, - b.CreditAmount{ + } + + if request.AssetCode == "" { + mutators = append(mutators, b.NativeAmount{ + request.Amount, + }) + + } else { + mutators = append(mutators, b.CreditAmount{ request.AssetCode, request.AssetIssuer, request.Amount, - }, + }) } if payWithMutator != nil { diff --git a/src/github.com/stellar/gateway/protocols/compliance/send.go b/src/github.com/stellar/gateway/protocols/compliance/send.go index edc4340..f2316dc 100644 --- a/src/github.com/stellar/gateway/protocols/compliance/send.go +++ b/src/github.com/stellar/gateway/protocols/compliance/send.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/stellar/gateway/protocols" - "github.com/stellar/go/keypair" proto "github.com/stellar/go/protocols/compliance" ) @@ -24,9 +23,9 @@ type SendRequest struct { // Amount destination should receive Amount string `name:"amount" required:""` // Code of the asset destination should receive - AssetCode string `name:"asset_code" required:""` + AssetCode string `name:"asset_code"` // Issuer of the asset destination should receive - AssetIssuer string `name:"asset_issuer" required:""` + AssetIssuer string `name:"asset_issuer"` // Only for path_payment SendMax string `name:"send_max"` // Only for path_payment @@ -74,11 +73,12 @@ func (request *SendRequest) Validate() error { return protocols.NewInvalidParameterError("destination", request.Destination, "Not a valid stellar address.") } - _, err = keypair.Parse(request.AssetIssuer) - if !protocols.IsValidAccountID(request.AssetIssuer) { - return protocols.NewInvalidParameterError("asset_issuer", request.AssetIssuer, "Asset issuer must be a public key (starting with `G`).") - } + if request.AssetCode != "" { + if !protocols.IsValidAccountID(request.AssetIssuer) { + return protocols.NewInvalidParameterError("asset_issuer", request.AssetIssuer, "Asset issuer must be a public key (starting with `G`).") + } + } return nil }