Documentation
¶
Index ¶
- Constants
- Variables
- func CreateAccountAndInitFungibleTokenVaultsCode(chainId flow.ChainID, tokens []template_strings.FungibleTokenInfo) (string, 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, error)
- func FungibleSetupCode(chainId flow.ChainID, token *Token) (string, error)
- func FungibleTransferCode(chainId flow.ChainID, token *Token) (string, error)
- func GetTokenPaths(token *Token) (vaultPath string, receiverPath string, balancePath string, err error)
- func InitFungibleTokenVaultsCode(chainId flow.ChainID, tokens []template_strings.FungibleTokenInfo) (string, error)
- func NewFungibleTokenInfo(t Token) template_strings.FungibleTokenInfo
- func TokenCode(chainId flow.ChainID, token *Token, tmplStr string) (string, error)
- 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) ListFull(tType TokenType) ([]Token, error)
- func (s *GormStore) Remove(id uint64) error
- type Service
- type ServiceImpl
- func (s *ServiceImpl) AddToken(t *Token) error
- func (s *ServiceImpl) GetTokenById(id uint64) (*Token, error)
- func (s *ServiceImpl) GetTokenByName(name string) (*Token, error)
- func (s *ServiceImpl) ListTokens(tType TokenType) ([]BasicToken, error)
- func (s *ServiceImpl) ListTokensFull(tType TokenType) ([]Token, error)
- func (s *ServiceImpl) RemoveToken(id uint64) error
- func (s *ServiceImpl) TokenFromEvent(e flow.Event) (*Token, error)
- type Store
- type Token
- type TokenType
Constants ¶
View Source
const ( EventTokensDeposited = "TokensDeposited" // FungibleToken EventDeposit = "Deposit" // NonFungibleToken )
Variables ¶
View Source
var KnownAddresses = templateVariables{
"FungibleToken.cdc": knownAddresses{
flow.Emulator: "0xee82856bf20e2aa6",
flow.Testnet: "0x9a0766d93b6608b7",
flow.Mainnet: "0xf233dcee88fe0abe",
},
"NonFungibleToken.cdc": knownAddresses{
flow.Emulator: "0xf8d6e0586b0a20c7",
flow.Testnet: "0x631e88ae7f1d7c20",
flow.Mainnet: "0x1d7e57aa55817448",
},
}
Functions ¶
func CreateAccountAndInitFungibleTokenVaultsCode ¶ added in v0.11.0
func CreateAccountAndInitFungibleTokenVaultsCode(chainId flow.ChainID, tokens []template_strings.FungibleTokenInfo) (string, error)
func DepositEventTypeFromToken ¶
func DepositEventTypeFromToken(token BasicToken) string
func FungibleBalanceCode ¶
func FungibleSetupCode ¶
func FungibleTransferCode ¶
func GetTokenPaths ¶ added in v0.11.0
func InitFungibleTokenVaultsCode ¶ added in v0.11.0
func InitFungibleTokenVaultsCode(chainId flow.ChainID, tokens []template_strings.FungibleTokenInfo) (string, error)
func NewFungibleTokenInfo ¶ added in v0.11.0
func NewFungibleTokenInfo(t Token) template_strings.FungibleTokenInfo
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 (*GormStore) InsertTemp ¶
type Service ¶
type Service interface { AddToken(t *Token) error ListTokens(tType TokenType) ([]BasicToken, error) ListTokensFull(tType TokenType) ([]Token, error) GetTokenById(id uint64) (*Token, error) GetTokenByName(name string) (*Token, error) RemoveToken(id uint64) error TokenFromEvent(e flow.Event) (*Token, error) }
type ServiceImpl ¶ added in v0.10.0
type ServiceImpl struct {
// contains filtered or unexported fields
}
func (*ServiceImpl) AddToken ¶ added in v0.10.0
func (s *ServiceImpl) AddToken(t *Token) error
func (*ServiceImpl) GetTokenById ¶ added in v0.10.0
func (s *ServiceImpl) GetTokenById(id uint64) (*Token, error)
func (*ServiceImpl) GetTokenByName ¶ added in v0.10.0
func (s *ServiceImpl) GetTokenByName(name string) (*Token, error)
func (*ServiceImpl) ListTokens ¶ added in v0.10.0
func (s *ServiceImpl) ListTokens(tType TokenType) ([]BasicToken, error)
func (*ServiceImpl) ListTokensFull ¶ added in v0.11.0
func (s *ServiceImpl) ListTokensFull(tType TokenType) ([]Token, error)
func (*ServiceImpl) RemoveToken ¶ added in v0.10.0
func (s *ServiceImpl) RemoveToken(id uint64) error
func (*ServiceImpl) TokenFromEvent ¶ added in v0.10.0
func (s *ServiceImpl) TokenFromEvent(e flow.Event) (*Token, error)
type Store ¶
type Store interface { Insert(*Token) error List(TokenType) ([]BasicToken, error) ListFull(TokenType) ([]Token, 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.
func NewGormStore ¶
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"` // (deprecated) For generic fungible token transaction templates ReceiverPublicPath string `json:"receiverPublicPath,omitempty"` BalancePublicPath string `json:"balancePublicPath,omitempty"` VaultStoragePath string `json:"vaultStoragePath,omitempty"` 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 ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.