Documentation ¶
Index ¶
- Constants
- Variables
- type AttrWithInvariantPredicateInputs
- type AttrWithSubTypeCreationInputs
- type BlockListener
- type Db
- type MintAttr
- type PredicateInput
- type Proof
- type PublicKey
- type TokenID
- type TokenKind
- type TokenTxContext
- type TokenTypeID
- type TokenTypeInfo
- type TokenUnit
- type TokenUnitType
- type TokenWithOwner
- type Wallet
- func (w *Wallet) GetAccountManager() wallet.AccountManager
- func (w *Wallet) GetTokenType(ctx context.Context, typeId TokenTypeID) (*TokenUnitType, error)
- func (w *Wallet) ListTokenTypes(ctx context.Context, kind TokenKind) ([]*TokenUnitType, error)
- func (w *Wallet) ListTokens(ctx context.Context, kind TokenKind, accountNumber int) (map[uint64][]*TokenUnit, error)
- func (w *Wallet) NewFungibleToken(ctx context.Context, accNr uint64, attrs *tokens.MintFungibleTokenAttributes, ...) (TokenID, error)
- func (w *Wallet) NewFungibleType(ctx context.Context, attrs *tokens.CreateFungibleTokenTypeAttributes, ...) (TokenID, error)
- func (w *Wallet) NewNFT(ctx context.Context, accNr uint64, ...) (TokenID, error)
- func (w *Wallet) NewNonFungibleType(ctx context.Context, attrs *tokens.CreateNonFungibleTokenTypeAttributes, ...) (TokenID, error)
- func (w *Wallet) ProcessBlock(b *block.Block) error
- func (w *Wallet) SendFungible(ctx context.Context, accountNumber uint64, typeId TokenTypeID, ...) error
- func (w *Wallet) Shutdown()
- func (w *Wallet) Sync(ctx context.Context) error
- func (w *Wallet) TransferNFT(ctx context.Context, accountNumber uint64, tokenId TokenID, ...) error
- func (w *Wallet) UpdateNFTData(ctx context.Context, accountNumber uint64, tokenId []byte, data []byte, ...) error
Constants ¶
View Source
const ( AllAccounts int = -1 FungibleTokenType = TokenType | Fungible NonFungibleTokenType = TokenType | NonFungible FungibleToken = Token | Fungible NonFungibleToken = Token | NonFungible )
Variables ¶
View Source
var ( ErrInvalidBlockSystemID = goerrors.New("invalid system identifier") ErrAttributesMissing = goerrors.New("attributes missing") ErrInvalidURILength = fmt.Errorf("URI exceeds the maximum allowed size of %v bytes", uriMaxSize) ErrInvalidDataLength = fmt.Errorf("data exceeds the maximum allowed size of %v bytes", dataMaxSize) )
Functions ¶
This section is empty.
Types ¶
type BlockListener ¶
func (BlockListener) ProcessBlock ¶
func (l BlockListener) ProcessBlock(b *block.Block) error
type Db ¶
type Db interface { Do() TokenTxContext WithTransaction(func(tx TokenTxContext) error) error Close() DeleteDb() }
type PredicateInput ¶
type Proof ¶
type Proof struct { BlockNumber uint64 `json:"blockNumber"` Tx *txsystem.Transaction `json:"tx"` Proof *block.BlockProof `json:"proof"` }
type TokenKind ¶
type TokenKind uint
TokenKind enum Only insert new values to the end of the enum NB! remember to update stringer method
type TokenTxContext ¶
type TokenTxContext interface { GetBlockNumber() (uint64, error) SetBlockNumber(blockNumber uint64) error AddTokenType(token *TokenUnitType) error GetTokenType(typeId TokenTypeID) (*TokenUnitType, error) GetTokenTypes() ([]*TokenUnitType, error) // SetToken accountNumber == 0 is the one for "always true" predicates // keys with accountIndex from the money wallet have tokens here under accountNumber which is accountIndex+1 SetToken(accountNumber uint64, token *TokenUnit) error RemoveToken(accountNumber uint64, id TokenID) error GetToken(accountNumber uint64, tokenId TokenID) (*TokenUnit, error) GetTokens(accountNumber uint64) ([]*TokenUnit, error) }
type TokenTypeID ¶
type TokenTypeID []byte
type TokenTypeInfo ¶
type TokenTypeInfo interface { GetSymbol() string GetTypeId() TokenTypeID }
type TokenUnit ¶
type TokenUnit struct { ID TokenID `json:"id"` Kind TokenKind `json:"kind"` Symbol string `json:"symbol"` TypeID TokenTypeID `json:"typeId"` Amount uint64 `json:"amount"` // fungible only URI string `json:"uri,omitempty"` // nft only Backlink []byte `json:"backlink"` Proof *Proof `json:"proof"` }
func (*TokenUnit) GetTypeId ¶
func (t *TokenUnit) GetTypeId() TokenTypeID
func (*TokenUnit) IsFungible ¶
type TokenUnitType ¶
type TokenUnitType struct { ID TokenTypeID `json:"id"` ParentTypeID TokenTypeID `json:"typeId"` Kind TokenKind `json:"kind"` Symbol string `json:"symbol"` DecimalPlaces uint32 `json:"decimalPlaces"` Proof *Proof `json:"proof"` }
func (*TokenUnitType) GetSymbol ¶
func (tp *TokenUnitType) GetSymbol() string
func (*TokenUnitType) GetTypeId ¶
func (tp *TokenUnitType) GetTypeId() TokenTypeID
type TokenWithOwner ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) GetAccountManager ¶
func (w *Wallet) GetAccountManager() wallet.AccountManager
func (*Wallet) GetTokenType ¶
func (w *Wallet) GetTokenType(ctx context.Context, typeId TokenTypeID) (*TokenUnitType, error)
GetTokenType returns non-nil TokenUnitType or error if not found or other issues
func (*Wallet) ListTokenTypes ¶
func (*Wallet) ListTokens ¶
func (w *Wallet) ListTokens(ctx context.Context, kind TokenKind, accountNumber int) (map[uint64][]*TokenUnit, error)
ListTokens specify accountNumber=-1 to list tokens from all accounts
func (*Wallet) NewFungibleToken ¶
func (w *Wallet) NewFungibleToken(ctx context.Context, accNr uint64, attrs *tokens.MintFungibleTokenAttributes, mintPredicateArgs []*PredicateInput) (TokenID, error)
func (*Wallet) NewFungibleType ¶
func (w *Wallet) NewFungibleType(ctx context.Context, attrs *tokens.CreateFungibleTokenTypeAttributes, typeId TokenTypeID, subtypePredicateArgs []*PredicateInput) (TokenID, error)
func (*Wallet) NewNFT ¶
func (w *Wallet) NewNFT(ctx context.Context, accNr uint64, attrs *tokens.MintNonFungibleTokenAttributes, tokenId TokenID, mintPredicateArgs []*PredicateInput) (TokenID, error)
func (*Wallet) NewNonFungibleType ¶
func (w *Wallet) NewNonFungibleType(ctx context.Context, attrs *tokens.CreateNonFungibleTokenTypeAttributes, typeId TokenTypeID, subtypePredicateArgs []*PredicateInput) (TokenID, error)
func (*Wallet) SendFungible ¶
func (w *Wallet) SendFungible(ctx context.Context, accountNumber uint64, typeId TokenTypeID, targetAmount uint64, receiverPubKey []byte, invariantPredicateArgs []*PredicateInput) error
func (*Wallet) TransferNFT ¶
func (*Wallet) UpdateNFTData ¶
Click to show internal directories.
Click to hide internal directories.