Documentation
¶
Index ¶
- Variables
- func EncodeToken(token Token) ([]byte, error)
- func EncodeTokens(tokens Tokens) ([]byte, error)
- type Address
- type Factory
- type Gas
- type Order
- type OrderState
- type OrderStore
- type Session
- type Snapshot
- type System
- type Token
- type Tokens
- type Transaction
- type TransactionState
- type TransactionStore
- type Transfer
- type TransferPriority
- type User
- type UserService
- type WalletService
- type WalletStore
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidTrace = errors.New("invalid trace")
)
Functions ¶
func EncodeToken ¶
func EncodeTokens ¶
Types ¶
type Address ¶
type Address struct {
Destination string `json:"destination,omitempty"`
Tag string `json:"tag,omitempty"`
}
func (Address) MarshalBinary ¶
func (*Address) UnmarshalBinary ¶
type Order ¶
type Order struct {
ID uint64 `sql:"PRIMARY_KEY;" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Version int `json:"version,omitempty"`
TraceID string `sql:"size:36;" json:"trace_id,omitempty"`
State OrderState `json:"state"`
UserID string `sql:"size:36;" json:"user_id,omitempty"`
FeeAsset string `sql:"size:36;" json:"fee_asset,omitempty"`
FeeAmount decimal.Decimal `sql:"type:decimal(64,8)" json:"fee_amount,omitempty"`
GasUsage decimal.Decimal `sql:"type:decimal(64,8)" json:"gas_usage,omitempty"`
Platform string `sql:"size:255;" json:"platform,omitempty"`
Tokens Tokens `sql:"type:longtext;" json:"tokens,omitempty"`
Result Tokens `sql:"type:longtext;" json:"result,omitempty"`
Receiver *Address `sql:"size:255;" json:"receiver,omitempty"`
Transaction string `sql:"size:128;" json:"transaction,omitempty"`
}
type OrderState ¶
type OrderState int
const ( OrderStateNew OrderState = iota OrderStatePaid OrderStateProcessing OrderStateFailed OrderStateDone )
type OrderStore ¶
type Snapshot ¶
type Snapshot struct {
CreatedAt time.Time `json:"created_at,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
UserID string `json:"user_id,omitempty"`
OpponentID string `json:"opponent_id,omitempty"`
TraceID string `json:"trace_id,omitempty"`
AssetID string `json:"asset_id,omitempty"`
Source string `json:"source,omitempty"`
Amount decimal.Decimal `json:"amount,omitempty"`
Memo string `json:"memo,omitempty"`
TransactionHash string `json:"transaction_hash,omitempty"`
}
type System ¶
type System struct {
Version string
ClientID string
ClientSecret string
Gas Gas
Addresses map[string]*Address
}
System stores system information.
type Token ¶
type Token struct {
Name string `gorm:"size:255;" json:"name,omitempty"`
Symbol string `gorm:"size:255;" json:"symbol,omitempty"`
TotalSupply uint64 `json:"total_supply,omitempty"`
AssetKey string `gorm:"size:255;" json:"asset_key,omitempty"`
AssetID string `gorm:"size:36;" json:"asset_id,omitempty"`
}
func DecodeToken ¶
func (Token) MarshalBinary ¶
func (*Token) UnmarshalBinary ¶
type Tokens ¶
type Tokens []*Token
func DecodeTokens ¶
func (Tokens) MarshalBinary ¶
func (*Tokens) UnmarshalBinary ¶
type Transaction ¶
type Transaction struct {
ID uint64 `sql:"PRIMARY_KEY;" json:"id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
Version int `json:"version"`
TraceID string `sql:"size:36;" json:"trace_id,omitempty"`
Hash string `json:"hash,omitempty"`
Raw string `sql:"type:longtext;" json:"raw,omitempty"`
State TransactionState `json:"state,omitempty"`
Tokens Tokens `sql:"type:longtext;" json:"tokens,omitempty"`
Gas decimal.Decimal `sql:"type:decimal(64,8)" json:"gas,omitempty"`
}
type TransactionState ¶
type TransactionState int
const ( TransactionStateNew TransactionState = iota TransactionStatePending TransactionStateFailed TransactionStateSuccess )
type TransactionStore ¶
type TransactionStore interface {
Create(ctx context.Context, tx *Transaction) error
Update(ctx context.Context, tx *Transaction) error
Find(ctx context.Context, hash string) (*Transaction, error)
FindTrace(ctx context.Context, traceID string) ([]*Transaction, error)
}
type Transfer ¶
type Transfer struct {
ID int64 `sql:"PRIMARY_KEY" json:"id,omitempty"`
Priority TransferPriority `json:"priority"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
TraceID string `sql:"type:char(36)" json:"trace_id,omitempty"`
AssetID string `sql:"type:char(36)" json:"asset_id,omitempty"`
Amount decimal.Decimal `sql:"type:decimal(64,8)" json:"amount,omitempty"`
Memo string `sql:"size:200" json:"memo,omitempty"`
Threshold uint8 `json:"threshold,omitempty"`
Opponents pq.StringArray `sql:"type:varchar(1024)" json:"opponents,omitempty"`
}
type TransferPriority ¶
type TransferPriority int
const ( TransferPriorityHigh TransferPriority = iota TransferPriorityNormal TransferPriorityLow )
type UserService ¶
type WalletService ¶
Click to show internal directories.
Click to hide internal directories.