Documentation
¶
Index ¶
- Constants
- func AsCadence(a *Argument) (cadence.Value, error)
- func DepositEventTypeFromToken(token BasicToken) string
- func DepositNameFromTokenType(tokenType string) string
- func EventType(address, tokenName, eventName string) string
- func FungibleBalanceCode(chainId flow.ChainID, token *Token) string
- func FungibleSetupCode(chainId flow.ChainID, token *Token) string
- func FungibleTransferCode(chainId flow.ChainID, token *Token) string
- func MustDecodeArgs(aa []Argument) []cadence.Value
- func TokenCode(chainId flow.ChainID, token *Token, tmplStr string) string
- type Argument
- type BasicToken
- type GormStore
- func (s *GormStore) GetById(id uint64) (*Token, error)
- func (s *GormStore) GetByName(name string) (*Token, error)
- func (s *GormStore) Insert(q *Token) error
- func (s *GormStore) InsertTemp(token *Token)
- func (s *GormStore) List(tType TokenType) (*[]BasicToken, error)
- func (s *GormStore) Remove(id uint64) error
- type Raw
- type Service
- func (s *Service) AddToken(t *Token) error
- func (s *Service) GetTokenById(id uint64) (*Token, error)
- func (s *Service) GetTokenByName(name string) (*Token, error)
- func (s *Service) ListTokens(tType TokenType) (*[]BasicToken, error)
- func (s *Service) RemoveToken(id uint64) error
- func (s *Service) TokenFromEvent(e flow.Event) (*Token, error)
- type Store
- type Token
- type TokenType
- type TransactionBuilder
Constants ¶
View Source
const ( EventTokensDeposited = "TokensDeposited" // FungibleToken EventDeposit = "Deposit" // NonFungibleToken )
Variables ¶
This section is empty.
Functions ¶
func DepositEventTypeFromToken ¶
func DepositEventTypeFromToken(token BasicToken) string
func FungibleBalanceCode ¶
func FungibleSetupCode ¶
func FungibleTransferCode ¶
func MustDecodeArgs ¶
Types ¶
type BasicToken ¶
type BasicToken struct { ID uint64 `json:"id,omitempty"` Name string `json:"name"` Address string `json:"address"` Type TokenType `json:"type"` }
BasicToken is a simplifed representation of a Token used in listings
type GormStore ¶
type GormStore struct {
// contains filtered or unexported fields
}
func NewGormStore ¶
func (*GormStore) InsertTemp ¶
type Raw ¶
type Raw struct { Code string `json:"code" gorm:"-"` Arguments []Argument `json:"arguments" gorm:"-"` }
TODO: should this actually be called Transaction or something similar?
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ListTokens ¶
func (s *Service) ListTokens(tType TokenType) (*[]BasicToken, error)
func (*Service) RemoveToken ¶
func (*Service) TokenFromEvent ¶
type Store ¶
type Store interface { Insert(*Token) error List(TokenType) (*[]BasicToken, error) GetById(id uint64) (*Token, error) GetByName(name string) (*Token, error) Remove(id uint64) error // Insert a token that is available only for this instances runtime (in-memory) // Used when enabling a token via environment variables InsertTemp(*Token) }
Store manages data regarding templates.
type Token ¶
type Token struct { ID uint64 `json:"id,omitempty"` Name string `json:"name" gorm:"uniqueIndex;not null"` // Declaration name NameLowerCase string `json:"nameLowerCase,omitempty"` // For generic fungible token transaction templates Address string `json:"address" gorm:"not null"` Setup string `json:"setup,omitempty"` // Setup cadence code Transfer string `json:"transfer,omitempty"` // Transfer cadence code Balance string `json:"balance,omitempty"` // Balance cadence code Type TokenType `json:"type"` }
func (Token) BasicToken ¶
func (token Token) BasicToken() BasicToken
type TokenType ¶
type TokenType int
func TypeFromText ¶
func (TokenType) MarshalText ¶
func (*TokenType) UnmarshalText ¶
type TransactionBuilder ¶
type TransactionBuilder struct {
Tx *flow.Transaction
}
func NewBuilderFromRaw ¶
func NewBuilderFromRaw(raw Raw) (*TransactionBuilder, error)
func NewBuilderFromTx ¶
func NewBuilderFromTx(tx *flow.Transaction) *TransactionBuilder
func (*TransactionBuilder) AddArgument ¶
func (b *TransactionBuilder) AddArgument(a Argument) error
func (*TransactionBuilder) GetArgument ¶
func (b *TransactionBuilder) GetArgument(index int) (cadence.Value, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.