Documentation
¶
Index ¶
- type AccountAddedHandler
- type AccountToken
- type Balance
- type ChainEventHandler
- type Details
- type GormStore
- func (s *GormStore) AccountTokens(address string, tokenType templates.TokenType) (att []AccountToken, err error)
- func (s *GormStore) InsertAccountToken(at *AccountToken) error
- func (s *GormStore) InsertTokenTransfer(t *TokenTransfer) error
- func (s *GormStore) TokenDeposit(address, transactionId string, token *templates.Token) (t *TokenTransfer, err error)
- func (s *GormStore) TokenDeposits(address string, token *templates.Token) (tt []*TokenTransfer, err error)
- func (s *GormStore) TokenWithdrawal(address, transactionId string, token *templates.Token) (t *TokenTransfer, err error)
- func (s *GormStore) TokenWithdrawals(address string, token *templates.Token) (tt []*TokenTransfer, err error)
- type Service
- func (s *Service) AccountTokens(address string, tType templates.TokenType) ([]AccountToken, error)
- func (s *Service) CreateWithdrawal(ctx context.Context, runSync bool, sender string, request WithdrawalRequest) (*jobs.Job, *transactions.Transaction, error)
- func (s *Service) DeployTokenContractForAccount(ctx context.Context, runSync bool, tokenName, address string) error
- func (s *Service) Details(ctx context.Context, tokenName, address string) (*Details, error)
- func (s *Service) GetDeposit(address, tokenName, transactionId string) (*TokenDeposit, error)
- func (s *Service) GetTransfer(queryType, address, tokenName, transactionId string) (*TokenTransfer, error)
- func (s *Service) GetWithdrawal(address, tokenName, transactionId string) (*TokenWithdrawal, error)
- func (s *Service) ListDeposits(address, tokenName string) ([]*TokenDeposit, error)
- func (s *Service) ListTransfers(queryType, address, tokenName string) ([]*TokenTransfer, error)
- func (s *Service) ListWithdrawals(address, tokenName string) ([]*TokenWithdrawal, error)
- func (s *Service) RegisterDeposit(token *templates.Token, transactionId flow.Identifier, ...) error
- func (s *Service) Setup(ctx context.Context, sync bool, tokenName, address string) (*jobs.Job, *transactions.Transaction, error)
- type Store
- type TokenDeposit
- type TokenTransfer
- type TokenTransferBase
- type TokenWithdrawal
- type WithdrawalRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountAddedHandler ¶
func (*AccountAddedHandler) Handle ¶
func (h *AccountAddedHandler) Handle(payload accounts.AccountAddedPayload)
type AccountToken ¶
type AccountToken struct { ID uint64 `json:"-" gorm:"column:id;primaryKey"` AccountAddress string `json:"-" gorm:"column:account_address;uniqueIndex:addressname;index;not null"` Account accounts.Account `json:"-" gorm:"foreignKey:AccountAddress;references:Address;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` TokenName string `json:"name" gorm:"column:token_name;uniqueIndex:addressname;index;not null"` TokenAddress string `json:"address" gorm:"column:token_address;uniqueIndex:addressname;index;not null"` TokenType templates.TokenType `json:"-" gorm:"column:token_type"` CreatedAt time.Time `json:"-" gorm:"column:created_at"` UpdatedAt time.Time `json:"-" gorm:"column:updated_at"` DeletedAt gorm.DeletedAt `json:"-" gorm:"column:deleted_at;index"` }
AccountToken represents a token that is enabled on an account.
func (AccountToken) TableName ¶ added in v0.6.0
func (AccountToken) TableName() string
type Balance ¶
func (*Balance) MarshalJSON ¶
type ChainEventHandler ¶
type ChainEventHandler struct { AccountService *accounts.Service ChainListener *chain_events.Listener TemplateService *templates.Service TokenService *Service }
func (*ChainEventHandler) Handle ¶
func (h *ChainEventHandler) Handle(event flow.Event)
type GormStore ¶
type GormStore struct {
// contains filtered or unexported fields
}
func NewGormStore ¶
func (*GormStore) AccountTokens ¶
func (*GormStore) InsertAccountToken ¶
func (s *GormStore) InsertAccountToken(at *AccountToken) error
func (*GormStore) InsertTokenTransfer ¶
func (s *GormStore) InsertTokenTransfer(t *TokenTransfer) error
func (*GormStore) TokenDeposit ¶
func (*GormStore) TokenDeposits ¶
func (*GormStore) TokenWithdrawal ¶
func (*GormStore) TokenWithdrawals ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) AccountTokens ¶
func (*Service) CreateWithdrawal ¶
func (s *Service) CreateWithdrawal(ctx context.Context, runSync bool, sender string, request WithdrawalRequest) (*jobs.Job, *transactions.Transaction, error)
func (*Service) DeployTokenContractForAccount ¶
func (s *Service) DeployTokenContractForAccount(ctx context.Context, runSync bool, tokenName, address string) error
DeployTokenContractForAccount is mainly used for testing purposes.
func (*Service) Details ¶
Details is used to get the accounts balance (or similar for NFTs) for a token.
func (*Service) GetDeposit ¶
func (s *Service) GetDeposit(address, tokenName, transactionId string) (*TokenDeposit, error)
func (*Service) GetTransfer ¶
func (s *Service) GetTransfer(queryType, address, tokenName, transactionId string) (*TokenTransfer, error)
func (*Service) GetWithdrawal ¶
func (s *Service) GetWithdrawal(address, tokenName, transactionId string) (*TokenWithdrawal, error)
func (*Service) ListDeposits ¶
func (s *Service) ListDeposits(address, tokenName string) ([]*TokenDeposit, error)
func (*Service) ListTransfers ¶
func (s *Service) ListTransfers(queryType, address, tokenName string) ([]*TokenTransfer, error)
func (*Service) ListWithdrawals ¶
func (s *Service) ListWithdrawals(address, tokenName string) ([]*TokenWithdrawal, error)
type Store ¶
type Store interface { // List an accounts enabled tokens AccountTokens(address string, tokenType templates.TokenType) ([]AccountToken, error) // Enable a token for an account InsertAccountToken(at *AccountToken) error InsertTokenTransfer(*TokenTransfer) error TokenWithdrawals(address string, token *templates.Token) ([]*TokenTransfer, error) TokenWithdrawal(address, transactionId string, token *templates.Token) (*TokenTransfer, error) TokenDeposits(address string, token *templates.Token) ([]*TokenTransfer, error) TokenDeposit(address, transactionId string, token *templates.Token) (*TokenTransfer, error) }
Store manages data regarding tokens.
type TokenDeposit ¶
type TokenDeposit struct { TokenTransferBase SenderAddress string `json:"sender"` }
TokenDeposit is used for JSON interfacing
type TokenTransfer ¶
type TokenTransfer struct { ID uint64 `gorm:"column:id;primaryKey"` TransactionId string `gorm:"column:transaction_id"` // TODO (latenssi): should propably be unique over this column Transaction transactions.Transaction `gorm:"foreignKey:TransactionId;references:TransactionId;constraint:OnUpdate:CASCADE,OnDelete:CASCADE;"` RecipientAddress string `gorm:"column:recipient_address;index"` SenderAddress string `gorm:"column:sender_address;index"` FtAmount string `gorm:"column:ft_amount"` NftID uint64 `gorm:"column:nft_id"` TokenName string `gorm:"column:token_name"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;index"` }
TokenTransfer is used for database interfacing
func (*TokenTransfer) Deposit ¶
func (t *TokenTransfer) Deposit() TokenDeposit
func (TokenTransfer) TableName ¶ added in v0.6.0
func (TokenTransfer) TableName() string
func (*TokenTransfer) Withdrawal ¶
func (t *TokenTransfer) Withdrawal() TokenWithdrawal
type TokenTransferBase ¶
type TokenTransferBase struct { TransactionId string `json:"transactionId"` FtAmount string `json:"amount"` NftID uint64 `json:"nftId"` TokenName string `json:"token"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
TokenTransferBase is used for JSON interfacing
type TokenWithdrawal ¶
type TokenWithdrawal struct { TokenTransferBase RecipientAddress string `json:"recipient"` }
TokenWithdrawal is used for JSON interfacing
Click to show internal directories.
Click to hide internal directories.