Documentation ¶
Index ¶
- Variables
- func NewPaymentPendingError(seconds int) *helpers.ErrorResponse
- type AccountMergeOperationBody
- type AllowTrustOperationBody
- type AuthorizeRequest
- type BuilderRequest
- type BuilderResponse
- type ChangeTrustOperationBody
- type CreateAccountOperationBody
- type InflationOperationBody
- type ManageDataOperationBody
- type ManageOfferOperationBody
- type Operation
- type OperationBody
- type OperationType
- type PathPaymentOperationBody
- type PaymentOperationBody
- type PaymentRequest
- func (request *PaymentRequest) FromRequestSpecial(r *http.Request, destination interface{}) error
- func (request *PaymentRequest) ToComplianceSendRequest() *complianceServer.SendRequest
- func (request PaymentRequest) ToValuesSpecial(values url.Values)
- func (request *PaymentRequest) Validate(params ...interface{}) error
- type PaymentResponse
- type ReprocessRequest
- type ReprocessResponse
- type SetOptionsOperationBody
- type SetOptionsSigner
Constants ¶
This section is empty.
Variables ¶
var ( // PaymentCannotResolveDestination is an error response PaymentCannotResolveDestination = &helpers.ErrorResponse{Code: "cannot_resolve_destination", Message: "Cannot resolve federated HcNet address.", Status: http.StatusBadRequest} // PaymentCannotUseMemo is an error response PaymentCannotUseMemo = &helpers.ErrorResponse{Code: "cannot_use_memo", Message: "Memo given in request but federation returned memo fields.", Status: http.StatusBadRequest} // PaymentSourceNotExist is an error response PaymentSourceNotExist = &helpers.ErrorResponse{Code: "source_not_exist", Message: "Source account does not exist.", Status: http.StatusBadRequest} // PaymentAssetCodeNotAllowed is an error response PaymentAssetCodeNotAllowed = &helpers.ErrorResponse{Code: "asset_code_not_allowed", Message: "Given asset_code not allowed.", Status: http.StatusBadRequest} // PaymentPending is an error response PaymentPending = &helpers.ErrorResponse{Code: "pending", Message: "Transaction pending. Repeat your request after given time.", Status: http.StatusAccepted} // PaymentDenied is an error response PaymentDenied = &helpers.ErrorResponse{Code: "denied", Message: "Transaction denied by destination.", Status: http.StatusForbidden} )
Functions ¶
func NewPaymentPendingError ¶
func NewPaymentPendingError(seconds int) *helpers.ErrorResponse
NewPaymentPendingError creates a new PaymentPending error
Types ¶
type AccountMergeOperationBody ¶
AccountMergeOperationBody represents account_merge operation
func (AccountMergeOperationBody) Build ¶
func (op AccountMergeOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (AccountMergeOperationBody) Validate ¶
func (op AccountMergeOperationBody) Validate() error
Validate validates if operation body is valid.
type AllowTrustOperationBody ¶
type AllowTrustOperationBody struct { Source *string AssetCode string `json:"asset_code"` Trustor string Authorize bool }
AllowTrustOperationBody represents allow_trust operation
func (AllowTrustOperationBody) Build ¶
func (op AllowTrustOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (AllowTrustOperationBody) Validate ¶
func (op AllowTrustOperationBody) Validate() error
Validate validates if operation body is valid.
type AuthorizeRequest ¶
type AuthorizeRequest struct { AccountID string `form:"account_id" valid:"required,hcnet_accountid"` AssetCode string `form:"asset_code" valid:"required,hcnet_asset_code"` }
AuthorizeRequest represents request made to /authorize endpoint of bridge server
func (AuthorizeRequest) Validate ¶
func (r AuthorizeRequest) Validate(params ...interface{}) error
type BuilderRequest ¶
type BuilderRequest struct { Source string SequenceNumber string `json:"sequence_number"` Operations []Operation Signers []string }
BuilderRequest represents request made to /builder endpoint of bridge server
func (BuilderRequest) Process ¶
func (r BuilderRequest) Process() error
Process parses operations and creates OperationBody object for each operation
func (BuilderRequest) Validate ¶
func (r BuilderRequest) Validate() error
Validate validates if the request is correct.
type BuilderResponse ¶
type BuilderResponse struct { helpers.SuccessResponse TransactionEnvelope string `json:"transaction_envelope"` }
BuilderResponse represents response returned by /builder endpoint of bridge server
func (*BuilderResponse) Marshal ¶
func (response *BuilderResponse) Marshal() ([]byte, error)
Marshal marshals BuilderResponse
type ChangeTrustOperationBody ¶
type ChangeTrustOperationBody struct { Source *string Asset protocols.Asset // nil means max limit Limit *string }
ChangeTrustOperationBody represents change_trust operation
func (ChangeTrustOperationBody) Build ¶
func (op ChangeTrustOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (ChangeTrustOperationBody) Validate ¶
func (op ChangeTrustOperationBody) Validate() error
Validate validates if operation body is valid.
type CreateAccountOperationBody ¶
type CreateAccountOperationBody struct { Source *string Destination string StartingBalance string `json:"starting_balance"` }
CreateAccountOperationBody represents create_account operation
func (CreateAccountOperationBody) Build ¶
func (op CreateAccountOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (CreateAccountOperationBody) Validate ¶
func (op CreateAccountOperationBody) Validate() error
Validate validates if operation body is valid.
type InflationOperationBody ¶
type InflationOperationBody struct {
Source *string
}
InflationOperationBody represents inflation operation
func (InflationOperationBody) Build ¶
func (op InflationOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (InflationOperationBody) ToTransactionMutator ¶
func (op InflationOperationBody) ToTransactionMutator() b.TransactionMutator
ToTransactionMutator returns go-hcnet-base TransactionMutator
func (InflationOperationBody) Validate ¶
func (op InflationOperationBody) Validate() error
Validate validates if operation body is valid.
type ManageDataOperationBody ¶
ManageDataOperationBody represents manage_data operation
func (ManageDataOperationBody) Build ¶
func (op ManageDataOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (ManageDataOperationBody) Validate ¶
func (op ManageDataOperationBody) Validate() error
Validate validates if operation body is valid.
type ManageOfferOperationBody ¶
type ManageOfferOperationBody struct { PassiveOffer bool `json:"-"` Source *string Selling protocols.Asset Buying protocols.Asset Amount string Price string OfferID *string `json:"offer_id"` }
ManageOfferOperationBody represents manage_offer operation
func (ManageOfferOperationBody) Build ¶
func (op ManageOfferOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (ManageOfferOperationBody) Validate ¶
func (op ManageOfferOperationBody) Validate() error
Validate validates if operation body is valid.
type Operation ¶
type Operation struct { Type OperationType RawBody json.RawMessage `json:"body"` // Delay parsing until we know operation type Body OperationBody `json:"-"` // Created during processing stage }
Operation struct contains operation type and body
type OperationBody ¶
type OperationBody interface { // ToTransactionMutator() b.TransactionMutator Build() txnbuild.Operation Validate() error }
OperationBody interface is a common interface for builder operations
type OperationType ¶
type OperationType string
OperationType is the type of operation
const ( // OperationTypeCreateAccount represents create_account operation OperationTypeCreateAccount OperationType = "create_account" // OperationTypePayment represents payment operation OperationTypePayment OperationType = "payment" // OperationTypePathPayment represents path_payment operation OperationTypePathPayment OperationType = "path_payment" // OperationTypeManageOffer represents manage_offer operation OperationTypeManageOffer OperationType = "manage_offer" // OperationTypeCreatePassiveOffer represents create_passive_offer operation OperationTypeCreatePassiveOffer OperationType = "create_passive_offer" // OperationTypeSetOptions represents set_options operation OperationTypeSetOptions OperationType = "set_options" // OperationTypeChangeTrust represents change_trust operation OperationTypeChangeTrust OperationType = "change_trust" // OperationTypeAllowTrust represents allow_trust operation OperationTypeAllowTrust OperationType = "allow_trust" // OperationTypeAccountMerge represents account_merge operation OperationTypeAccountMerge OperationType = "account_merge" // OperationTypeInflation represents inflation operation OperationTypeInflation OperationType = "inflation" // OperationTypeManageData represents manage_data operation OperationTypeManageData OperationType = "manage_data" )
type PathPaymentOperationBody ¶
type PathPaymentOperationBody struct { Source *string SendMax string `json:"send_max"` SendAsset protocols.Asset `json:"send_asset"` Destination string DestinationAmount string `json:"destination_amount"` DestinationAsset protocols.Asset `json:"destination_asset"` Path []protocols.Asset }
PathPaymentOperationBody represents path_payment operation
func (PathPaymentOperationBody) Build ¶
func (op PathPaymentOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (*PathPaymentOperationBody) FromRequestSpecial ¶
func (op *PathPaymentOperationBody) FromRequestSpecial(r *http.Request, destination interface{}) error
ToValuesSpecial converts special values from http.Request to struct
func (PathPaymentOperationBody) ToValuesSpecial ¶
func (op PathPaymentOperationBody) ToValuesSpecial(values url.Values)
ToValuesSpecial adds special values (not easily convertable) to given url.Values
func (PathPaymentOperationBody) Validate ¶
func (op PathPaymentOperationBody) Validate() error
Validate validates if operation body is valid.
type PaymentOperationBody ¶
type PaymentOperationBody struct { Source *string Destination string Amount string Asset protocols.Asset }
PaymentOperationBody represents payment operation
func (PaymentOperationBody) Build ¶
func (op PaymentOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (PaymentOperationBody) Validate ¶
func (op PaymentOperationBody) Validate() error
Validate validates if operation body is valid.
type PaymentRequest ¶
type PaymentRequest struct { // Payment ID ID string `form:"id" valid:"optional"` // Source account secret Source string `form:"source" valid:"optional,hcnet_seed"` // Sender address (like alice*hcnet.org) Sender string `form:"sender" valid:"optional,hcnet_address"` // Destination address (like bob*hcnet.org) Destination string `form:"destination" valid:"optional,hcnet_destination"` // ForwardDestination ForwardDestination *protocols.ForwardDestination `form:"forward_destination" valid:"-"` // Memo type MemoType string `form:"memo_type" valid:"optional"` // Memo value Memo string `form:"memo" valid:"optional"` // Amount destination should receive Amount string `form:"amount" valid:"required,hcnet_amount"` // Code of the asset destination should receive AssetCode string `form:"asset_code" valid:"optional,hcnet_asset_code"` // Issuer of the asset destination should receive AssetIssuer string `form:"asset_issuer" valid:"optional,hcnet_accountid"` // Only for path_payment SendMax string `form:"send_max" valid:"optional,hcnet_amount"` // Only for path_payment SendAssetCode string `form:"send_asset_code" valid:"optional,hcnet_asset_code"` // Only for path_payment SendAssetIssuer string `form:"send_asset_issuer" valid:"optional,hcnet_accountid"` // path[n][asset_code] path[n][asset_issuer] Path []protocols.Asset `form:"path" valid:"optional"` // Determined whether to use compliance protocol or to send a simple payment. UseCompliance bool `form:"use_compliance" valid:"-"` // Extra memo. If set, UseCompliance value will be ignored and it will use compliance. ExtraMemo string `form:"extra_memo" valid:"-"` }
PaymentRequest represents request made to /payment endpoint of the bridge server
func (*PaymentRequest) FromRequestSpecial ¶
func (request *PaymentRequest) FromRequestSpecial(r *http.Request, destination interface{}) error
ToValuesSpecial converts special values from http.Request to struct
func (*PaymentRequest) ToComplianceSendRequest ¶
func (request *PaymentRequest) ToComplianceSendRequest() *complianceServer.SendRequest
ToComplianceSendRequest transforms PaymentRequest to complianceServer.SendRequest
func (PaymentRequest) ToValuesSpecial ¶
func (request PaymentRequest) ToValuesSpecial(values url.Values)
ToValuesSpecial adds special values (not easily convertable) to given url.Values
func (*PaymentRequest) Validate ¶
func (request *PaymentRequest) Validate(params ...interface{}) error
Validate is additional validation method to validate special fields.
type PaymentResponse ¶
type PaymentResponse struct { ID string Type string PagingToken string From string To string AssetType string AssetCode string AssetIssuer string Amount string TransactionHash string MemoType string Memo string }
PaymentResponse represents a response from the bridge server when a payment is received.
type ReprocessRequest ¶
type ReprocessRequest struct { OperationID string `form:"operation_id" valid:"required"` // Force is required for reprocessing successful payments. Please use with caution! Force bool `form:"force" valid:"-"` }
ReprocessRequest represents request made to /reprocess endpoint of bridge server
func (ReprocessRequest) Validate ¶
func (r ReprocessRequest) Validate(params ...interface{}) error
type ReprocessResponse ¶
type ReprocessResponse struct { Status string `json:"status"` Message string `json:"message,omitempty"` }
ReprocessResponse represents a response returned by /reprocess endpoint
func (ReprocessResponse) HTTPStatus ¶
func (r ReprocessResponse) HTTPStatus() int
func (ReprocessResponse) Marshal ¶
func (r ReprocessResponse) Marshal() ([]byte, error)
type SetOptionsOperationBody ¶
type SetOptionsOperationBody struct { Source *string InflationDest *string `json:"inflation_dest"` SetFlags *[]int `json:"set_flags"` ClearFlags *[]int `json:"clear_flags"` MasterWeight *uint32 `json:"master_weight"` LowThreshold *uint32 `json:"low_threshold"` MediumThreshold *uint32 `json:"medium_threshold"` HighThreshold *uint32 `json:"high_threshold"` HomeDomain *string `json:"home_domain"` Signer *SetOptionsSigner `json:"signer"` }
SetOptionsOperationBody represents set_options operation
func (SetOptionsOperationBody) Build ¶
func (op SetOptionsOperationBody) Build() txnbuild.Operation
Build returns a txnbuild.Operation
func (SetOptionsOperationBody) Validate ¶
func (op SetOptionsOperationBody) Validate() error
Validate validates if operation body is valid.
type SetOptionsSigner ¶
SetOptionsSigner is a struct that representing signer in SetOptions operation body