Documentation
¶
Index ¶
- Variables
- func DecodeTransactionAction(privateKey ed25519.PrivateKey, message []byte) ([]byte, error)
- type Asset
- type AssetService
- type AssetStore
- type Member
- type MemoData
- type Message
- type MessageStore
- type Notifier
- type Output
- type RawTransaction
- type System
- type Transfer
- type WalletService
- type WalletStore
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAssetNotExist = errors.New("asset not exist")
)
Functions ¶
func DecodeTransactionAction ¶
func DecodeTransactionAction(privateKey ed25519.PrivateKey, message []byte) ([]byte, error)
Types ¶
type Asset ¶ added in v0.0.3
type Asset struct {
ID string `sql:"size:36;PRIMARY_KEY" json:"id,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Name string `sql:"size:64" json:"name,omitempty"`
Symbol string `sql:"size:32" json:"symbol,omitempty"`
DisplaySymbol string `sql:"size:32" json:"display_symbol,omitempty"`
Logo string `sql:"size:256" json:"logo,omitempty"`
ChainID string `sql:"size:36" json:"chain_id,omitempty"`
Price decimal.Decimal `sql:"type:decimal(24,8)" json:"price_usd,omitempty"`
}
type AssetService ¶ added in v0.0.3
type AssetService interface {
Find(ctx context.Context, id string) (*Asset, error)
ListAll(ctx context.Context) ([]*Asset, error)
}
AssetService provides access to assets information in the remote system like mixin network.
type AssetStore ¶ added in v0.0.3
type AssetStore interface {
Save(ctx context.Context, asset *Asset, columns ...string) error
Find(ctx context.Context, id string) (*Asset, error)
ListAll(ctx context.Context) ([]*Asset, error)
ListPrices(ctx context.Context, ids ...string) (number.Values, error)
}
AssetStore defines operations for working with assets on db.
type MemoData ¶ added in v0.0.4
type MemoData struct {
Member string `json:"member,omitempty"`
Type int `json:"type,omitempty"`
UserID string `json:"user_id,omitempty"`
FollowID string `json:"follow_id,omitempty"`
Data []byte `json:"data,omitempty"`
}
TODO Deprecated, remove in the future version
type Message ¶ added in v0.0.3
type Message struct {
ID int64 `sql:"PRIMARY_KEY" json:"id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
MessageID string `sql:"size:36" json:"message_id,omitempty"`
UserID string `sql:"size:36" json:"user_id,omitempty"`
Raw types.JSONText `sql:"type:TEXT" json:"raw,omitempty"`
}
func BuildMessage ¶ added in v0.0.3
func BuildMessage(req *mixin.MessageRequest) *Message
type MessageStore ¶ added in v0.0.3
type Output ¶
type Output struct {
ID int64 `sql:"PRIMARY_KEY" json:"id,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
UpdatedAt time.Time `json:"updated_at,omitempty"`
Version int64 `sql:"NOT NULL" json:"version,omitempty"`
Sender string `sql:"type:char(36)" json:"sender,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:"type:char(200)" json:"memo,omitempty"`
MemoData MemoData `sql:"type:TEXT" json:"memo_data,omitempty"`
State string `sql:"size:24" json:"state,omitempty"`
// SpentBy represent the associated transfer trace id
SpentBy string `sql:"type:char(36);NOT NULL" json:"spent_by,omitempty"`
// UTXO json Data
Data types.JSONText `sql:"type:TEXT" json:"data,omitempty"`
// Raw Mixin UTXO
UTXO *mixin.MultisigUTXO `sql:"-" json:"-,omitempty"`
}
Output represent Mixin Network multisig Outputs
type RawTransaction ¶
type System ¶
type System struct {
Admins []string
ClientID string
Members []*Member
Threshold uint8
VoteAsset string
VoteAmount decimal.Decimal
PrivateKey ed25519.PrivateKey
SignKey ed25519.PrivateKey
Version string
}
System stores system information.
type Transfer ¶
type Transfer struct {
ID int64 `sql:"PRIMARY_KEY" json:"id,omitempty"`
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"`
Handled types.BitBool `sql:"type:bit(1)" json:"handled,omitempty"`
Passed types.BitBool `sql:"type:bit(1)" json:"passed,omitempty"`
Threshold uint8 `json:"threshold,omitempty"`
Opponents pq.StringArray `sql:"type:varchar(1024)" json:"opponents,omitempty"`
}
type WalletService ¶
type WalletService interface {
// Pull fetch NEW Output updates
Pull(ctx context.Context, offset time.Time, limit int) ([]*Output, error)
// Spend spend multiple Output
Spend(ctx context.Context, outputs []*Output, transfer *Transfer) (*RawTransaction, error)
// ReqTransfer generate payment code for multisig transfer
ReqTransfer(ctx context.Context, transfer *Transfer) (string, error)
}
type WalletStore ¶
type WalletStore interface {
// Save batch update multiple Output
Save(ctx context.Context, outputs []*Output) error
// List return a list of Output by order
List(ctx context.Context, fromID int64, limit int) ([]*Output, error)
// ListUnspent list unspent Output
ListUnspent(ctx context.Context, assetID string, limit int) ([]*Output, error)
ListSpentBy(ctx context.Context, assetID string, spentBy string) ([]*Output, error)
// Transfers
CreateTransfers(ctx context.Context, transfers []*Transfer) error
UpdateTransfer(ctx context.Context, transfer *Transfer) error
ListPendingTransfers(ctx context.Context) ([]*Transfer, error)
ListNotPassedTransfers(ctx context.Context) ([]*Transfer, error)
Spent(ctx context.Context, outputs []*Output, transfer *Transfer) error
// mixin net transaction
CreateRawTransaction(ctx context.Context, tx *RawTransaction) error
ListPendingRawTransactions(ctx context.Context, limit int) ([]*RawTransaction, error)
ExpireRawTransaction(ctx context.Context, tx *RawTransaction) error
}
Click to show internal directories.
Click to hide internal directories.