Documentation ¶
Index ¶
- Constants
- Variables
- func BearerPredicateFromPubKey(receiverPubKey wallet.PubKey) wallet.Predicate
- func DecodeHexOrEmpty(input string) ([]byte, error)
- func FeeCreditRecordIDFromPublicKey(shardPart, pubKey []byte) types.UnitID
- func ParsePredicateClause(clause string, keyNr uint64, am account.Manager) ([]byte, error)
- type AccountDcResult
- type AttrWithInvariantPredicateInputs
- type AttrWithSubTypeCreationInputs
- type CreateFungibleTokenTypeAttributes
- type CreateNonFungibleTokenTypeAttributes
- type Icon
- type Kind
- type MintAttr
- type MintNonFungibleTokenAttributes
- type Observability
- type PredicateInput
- type RpcClient
- type SubmissionResult
- type TokenID
- type TokenTypeID
- type TokenUnit
- type TokenUnitType
- type Wallet
- func (w *Wallet) AddFeeCredit(ctx context.Context, cmd fees.AddFeeCmd) (*fees.AddFeeCmdResponse, error)
- func (w *Wallet) CollectDust(ctx context.Context, accountNumber uint64, allowedTokenTypes []TokenTypeID, ...) ([]*AccountDcResult, error)
- func (w *Wallet) GetAccountManager() account.Manager
- func (w *Wallet) GetFeeCredit(ctx context.Context, cmd fees.GetFeeCreditCmd) (*api.FeeCreditBill, error)
- func (w *Wallet) GetFeeCreditBill(ctx context.Context, unitID []byte) (*api.FeeCreditBill, error)
- func (w *Wallet) GetRoundNumber(ctx context.Context) (uint64, error)
- func (w *Wallet) GetToken(ctx context.Context, tokenID TokenID) (*TokenUnit, error)
- func (w *Wallet) GetTokenType(ctx context.Context, typeId TokenTypeID) (*TokenUnitType, error)
- func (w *Wallet) ListTokenTypes(ctx context.Context, accountNumber uint64, kind Kind) ([]*TokenUnitType, error)
- func (w *Wallet) ListTokens(ctx context.Context, kind Kind, accountNumber uint64) (map[uint64][]*TokenUnit, error)
- func (w *Wallet) LockToken(ctx context.Context, accountNumber uint64, tokenID []byte, ...) (*SubmissionResult, error)
- func (w *Wallet) NewFungibleToken(ctx context.Context, accNr uint64, typeId TokenTypeID, amount uint64, ...) (*SubmissionResult, error)
- func (w *Wallet) NewFungibleType(ctx context.Context, accNr uint64, attrs CreateFungibleTokenTypeAttributes, ...) (*SubmissionResult, error)
- func (w *Wallet) NewNFT(ctx context.Context, accNr uint64, attrs MintNonFungibleTokenAttributes, ...) (*SubmissionResult, error)
- func (w *Wallet) NewNonFungibleType(ctx context.Context, accNr uint64, attrs CreateNonFungibleTokenTypeAttributes, ...) (*SubmissionResult, error)
- func (w *Wallet) ReclaimFeeCredit(ctx context.Context, cmd fees.ReclaimFeeCmd) (*fees.ReclaimFeeCmdResponse, error)
- func (w *Wallet) SendFungible(ctx context.Context, accountNumber uint64, typeId TokenTypeID, ...) (*SubmissionResult, error)
- func (w *Wallet) Shutdown()
- func (w *Wallet) TransferNFT(ctx context.Context, accountNumber uint64, tokenID TokenID, ...) (*SubmissionResult, error)
- func (w *Wallet) UnlockToken(ctx context.Context, accountNumber uint64, tokenID []byte, ...) (*SubmissionResult, error)
- func (w *Wallet) UpdateNFTData(ctx context.Context, accountNumber uint64, tokenID []byte, data []byte, ...) (*SubmissionResult, error)
Constants ¶
View Source
const (
AllAccounts uint64 = 0
)
Variables ¶
View Source
var ( ErrNoFeeCredit = errors.New("no fee credit in token wallet") ErrInsufficientFeeCredit = errors.New("insufficient fee credit balance for transaction(s)") )
View Source
var (
NoParent = TokenTypeID(make([]byte, crypto.SHA256.Size()))
)
Functions ¶
func DecodeHexOrEmpty ¶
Types ¶
type AccountDcResult ¶ added in v0.4.0
type AccountDcResult struct { AccountNumber uint64 SubmissionResults []*SubmissionResult }
AccountDcResult dust collection results for single account.
type AttrWithInvariantPredicateInputs ¶
type AttrWithInvariantPredicateInputs interface { types.SigBytesProvider SetInvariantPredicateSignatures([][]byte) }
type AttrWithSubTypeCreationInputs ¶
type AttrWithSubTypeCreationInputs interface { types.SigBytesProvider SetSubTypeCreationPredicateSignatures([][]byte) }
type CreateFungibleTokenTypeAttributes ¶
type CreateFungibleTokenTypeAttributes struct { Symbol string Name string Icon *Icon DecimalPlaces uint32 ParentTypeId TokenTypeID SubTypeCreationPredicate wallet.Predicate TokenCreationPredicate wallet.Predicate InvariantPredicate wallet.Predicate }
func (*CreateFungibleTokenTypeAttributes) ToCBOR ¶ added in v0.4.0
func (c *CreateFungibleTokenTypeAttributes) ToCBOR() *tokens.CreateFungibleTokenTypeAttributes
type CreateNonFungibleTokenTypeAttributes ¶
type CreateNonFungibleTokenTypeAttributes struct { Symbol string Name string Icon *Icon ParentTypeId TokenTypeID SubTypeCreationPredicate wallet.Predicate TokenCreationPredicate wallet.Predicate InvariantPredicate wallet.Predicate DataUpdatePredicate wallet.Predicate }
func (*CreateNonFungibleTokenTypeAttributes) ToCBOR ¶ added in v0.4.0
func (c *CreateNonFungibleTokenTypeAttributes) ToCBOR() *tokens.CreateNonFungibleTokenTypeAttributes
type MintAttr ¶
type MintAttr interface { types.SigBytesProvider SetBearer([]byte) SetTokenCreationPredicateSignatures([][]byte) }
type MintNonFungibleTokenAttributes ¶
type MintNonFungibleTokenAttributes struct { Name string NftType TokenTypeID Uri string Data []byte Bearer wallet.Predicate DataUpdatePredicate wallet.Predicate }
func (*MintNonFungibleTokenAttributes) ToCBOR ¶ added in v0.4.0
func (a *MintNonFungibleTokenAttributes) ToCBOR() *tokens.MintNonFungibleTokenAttributes
type Observability ¶
type Observability interface {
TracerProvider() trace.TracerProvider
}
type PredicateInput ¶
type PredicateInput struct { // first priority Argument types.PredicateBytes // if Argument empty, check AccountNumber AccountNumber uint64 }
func ParsePredicates ¶
type RpcClient ¶ added in v0.4.0
type RpcClient interface { // tokens functions GetToken(ctx context.Context, id TokenID) (*TokenUnit, error) GetTokens(ctx context.Context, kind Kind, ownerID []byte) ([]*TokenUnit, error) GetTokenTypes(ctx context.Context, kind Kind, creator wallet.PubKey) ([]*TokenUnitType, error) GetTypeHierarchy(ctx context.Context, id TokenTypeID) ([]*TokenUnitType, error) // common functions GetRoundNumber(ctx context.Context) (uint64, error) GetFeeCreditRecord(ctx context.Context, unitID types.UnitID, includeStateProof bool) (*api.FeeCreditBill, error) GetUnitsByOwnerID(ctx context.Context, ownerID types.Bytes) ([]types.UnitID, error) SendTransaction(ctx context.Context, tx *types.TransactionOrder) ([]byte, error) GetTransactionProof(ctx context.Context, txHash types.Bytes) (*types.TransactionRecord, *types.TxProof, error) GetBlock(ctx context.Context, roundNumber uint64) (*types.Block, error) }
type SubmissionResult ¶
type SubmissionResult struct { TokenTypeID TokenTypeID TokenID TokenID FeeSum uint64 }
SubmissionResult dust collection result for single token type.
type TokenTypeID ¶ added in v0.4.0
type TokenUnit ¶ added in v0.4.0
type TokenUnit struct { // common ID TokenID `json:"id"` Symbol string `json:"symbol"` TypeID TokenTypeID `json:"typeId"` TypeName string `json:"typeName"` Owner types.Bytes `json:"owner"` Locked uint64 `json:"locked"` // fungible only Amount uint64 `json:"amount,omitempty,string"` Decimals uint32 `json:"decimals,omitempty"` Burned bool `json:"burned,omitempty"` // nft only NftName string `json:"nftName,omitempty"` NftURI string `json:"nftUri,omitempty"` NftData []byte `json:"nftData,omitempty"` NftDataUpdatePredicate wallet.Predicate `json:"nftDataUpdatePredicate,omitempty"` // meta Kind Kind `json:"kind"` TxHash wallet.TxHash `json:"txHash"` }
type TokenUnitType ¶ added in v0.4.0
type TokenUnitType struct { // common ID TokenTypeID `json:"id"` ParentTypeID TokenTypeID `json:"parentTypeId"` Symbol string `json:"symbol"` Name string `json:"name,omitempty"` Icon *tokens.Icon `json:"icon,omitempty"` SubTypeCreationPredicate wallet.Predicate `json:"subTypeCreationPredicate,omitempty"` TokenCreationPredicate wallet.Predicate `json:"tokenCreationPredicate,omitempty"` InvariantPredicate wallet.Predicate `json:"invariantPredicate,omitempty"` // fungible only DecimalPlaces uint32 `json:"decimalPlaces,omitempty"` // nft only NftDataUpdatePredicate wallet.Predicate `json:"nftDataUpdatePredicate,omitempty"` // meta Kind Kind `json:"kind"` TxHash wallet.TxHash `json:"txHash"` }
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) AddFeeCredit ¶
func (*Wallet) CollectDust ¶
func (w *Wallet) CollectDust(ctx context.Context, accountNumber uint64, allowedTokenTypes []TokenTypeID, invariantPredicateArgs []*PredicateInput) ([]*AccountDcResult, error)
func (*Wallet) GetAccountManager ¶
func (*Wallet) GetFeeCredit ¶
func (w *Wallet) GetFeeCredit(ctx context.Context, cmd fees.GetFeeCreditCmd) (*api.FeeCreditBill, error)
GetFeeCredit returns fee credit bill for given account, can return nil if fee credit bill has not been created yet.
func (*Wallet) GetFeeCreditBill ¶
GetFeeCreditBill returns fee credit bill for given unitID can return nil if fee credit bill has not been created yet.
func (*Wallet) GetRoundNumber ¶
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 Kind, accountNumber uint64) (map[uint64][]*TokenUnit, error)
ListTokens specify accountNumber=0 to list tokens from all accounts
func (*Wallet) LockToken ¶
func (w *Wallet) LockToken(ctx context.Context, accountNumber uint64, tokenID []byte, ib []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) NewFungibleToken ¶
func (w *Wallet) NewFungibleToken(ctx context.Context, accNr uint64, typeId TokenTypeID, amount uint64, bearerPredicate wallet.Predicate, mintPredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) NewFungibleType ¶
func (w *Wallet) NewFungibleType(ctx context.Context, accNr uint64, attrs CreateFungibleTokenTypeAttributes, typeId TokenTypeID, subtypePredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) NewNFT ¶
func (w *Wallet) NewNFT(ctx context.Context, accNr uint64, attrs MintNonFungibleTokenAttributes, tokenID TokenID, mintPredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) NewNonFungibleType ¶
func (w *Wallet) NewNonFungibleType(ctx context.Context, accNr uint64, attrs CreateNonFungibleTokenTypeAttributes, typeId TokenTypeID, subtypePredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) ReclaimFeeCredit ¶
func (w *Wallet) ReclaimFeeCredit(ctx context.Context, cmd fees.ReclaimFeeCmd) (*fees.ReclaimFeeCmdResponse, error)
func (*Wallet) SendFungible ¶
func (w *Wallet) SendFungible(ctx context.Context, accountNumber uint64, typeId TokenTypeID, targetAmount uint64, receiverPubKey []byte, invariantPredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) TransferNFT ¶
func (w *Wallet) TransferNFT(ctx context.Context, accountNumber uint64, tokenID TokenID, receiverPubKey wallet.PubKey, invariantPredicateArgs []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) UnlockToken ¶
func (w *Wallet) UnlockToken(ctx context.Context, accountNumber uint64, tokenID []byte, ib []*PredicateInput) (*SubmissionResult, error)
func (*Wallet) UpdateNFTData ¶
func (w *Wallet) UpdateNFTData(ctx context.Context, accountNumber uint64, tokenID []byte, data []byte, updatePredicateArgs []*PredicateInput) (*SubmissionResult, error)
Click to show internal directories.
Click to hide internal directories.