Documentation ¶
Index ¶
- Variables
- type AssetDefinition
- type Balance
- type BaseTx
- type BuildGenesisArgs
- type BuildGenesisReply
- type CreateAssetTx
- type CreateFixedCapAssetArgs
- type CreateNFTAssetArgs
- type CreateVariableCapAssetArgs
- type ExportAVAXArgs
- type ExportKeyArgs
- type ExportKeyReply
- type ExportTx
- type Factory
- type FormattedAssetID
- type FormattedTx
- type Fx
- type FxOperation
- type Genesis
- type GenesisAsset
- type GetAllBalancesReply
- type GetAssetDescriptionArgs
- type GetAssetDescriptionReply
- type GetBalanceArgs
- type GetBalanceReply
- type GetTxStatusReply
- type GetUTXOsArgs
- type GetUTXOsReply
- type Holder
- type ImportAVAXArgs
- type ImportKeyArgs
- type ImportKeyReply
- type ImportTx
- func (t *ImportTx) AssetIDs() ids.Set
- func (t *ImportTx) ConsumedAssetIDs() ids.Set
- func (t *ImportTx) ExecuteWithSideEffects(vm *VM, batch database.Batch) error
- func (t *ImportTx) InputUTXOs() []*avax.UTXOID
- func (t *ImportTx) NumCredentials() int
- func (t *ImportTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
- func (t *ImportTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, ...) error
- type Index
- type InitialState
- type MintArgs
- type MintNFTArgs
- type Operation
- type OperationTx
- func (t *OperationTx) AssetIDs() ids.Set
- func (t *OperationTx) ConsumedAssetIDs() ids.Set
- func (t *OperationTx) InputUTXOs() []*avax.UTXOID
- func (t *OperationTx) NumCredentials() int
- func (t *OperationTx) Operations() []*Operation
- func (t *OperationTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
- func (t *OperationTx) SyntacticVerify(ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, ...) error
- func (t *OperationTx) UTXOs() []*avax.UTXO
- type Owners
- type SendArgs
- type SendNFTArgs
- type Service
- func (service *Service) CreateAddress(r *http.Request, args *api.UserPass, reply *api.JsonAddress) error
- func (service *Service) CreateFixedCapAsset(r *http.Request, args *CreateFixedCapAssetArgs, reply *FormattedAssetID) error
- func (service *Service) CreateNFTAsset(r *http.Request, args *CreateNFTAssetArgs, reply *FormattedAssetID) error
- func (service *Service) CreateVariableCapAsset(r *http.Request, args *CreateVariableCapAssetArgs, reply *FormattedAssetID) error
- func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, reply *api.JsonTxID) error
- func (service *Service) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
- func (service *Service) GetAllBalances(r *http.Request, args *api.JsonAddress, reply *GetAllBalancesReply) error
- func (service *Service) GetAssetDescription(_ *http.Request, args *GetAssetDescriptionArgs, ...) error
- func (service *Service) GetBalance(r *http.Request, args *GetBalanceArgs, reply *GetBalanceReply) error
- func (service *Service) GetTx(r *http.Request, args *api.JsonTxID, reply *FormattedTx) error
- func (service *Service) GetTxStatus(r *http.Request, args *api.JsonTxID, reply *GetTxStatusReply) error
- func (service *Service) GetUTXOs(r *http.Request, args *GetUTXOsArgs, reply *GetUTXOsReply) error
- func (service *Service) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, reply *api.JsonTxID) error
- func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JsonAddress) error
- func (service *Service) IssueTx(r *http.Request, args *FormattedTx, reply *api.JsonTxID) error
- func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JsonAddresses) error
- func (service *Service) Mint(r *http.Request, args *MintArgs, reply *api.JsonTxID) error
- func (service *Service) MintNFT(r *http.Request, args *MintNFTArgs, reply *api.JsonTxID) error
- func (service *Service) Send(r *http.Request, args *SendArgs, reply *api.JsonTxID) error
- func (service *Service) SendNFT(r *http.Request, args *SendNFTArgs, reply *api.JsonTxID) error
- type StaticService
- type Tx
- func (t *Tx) Credentials() []verify.Verifiable
- func (t *Tx) SemanticVerify(vm *VM, tx UnsignedTx) error
- func (t *Tx) SignNFTFx(c codec.Codec, signers [][]*crypto.PrivateKeySECP256K1R) error
- func (t *Tx) SignSECP256K1Fx(c codec.Codec, signers [][]*crypto.PrivateKeySECP256K1R) error
- func (t *Tx) SyntacticVerify(ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, ...) error
- type TxState
- type UniqueTx
- func (tx *UniqueTx) Accept() error
- func (tx *UniqueTx) Bytes() []byte
- func (tx *UniqueTx) Dependencies() []snowstorm.Tx
- func (tx *UniqueTx) Evict()
- func (tx *UniqueTx) ID() ids.ID
- func (tx *UniqueTx) InputIDs() ids.Set
- func (tx *UniqueTx) InputUTXOs() []*avax.UTXOID
- func (tx *UniqueTx) Reject() error
- func (tx *UniqueTx) SemanticVerify() error
- func (tx *UniqueTx) Status() choices.Status
- func (tx *UniqueTx) SyntacticVerify() error
- func (tx *UniqueTx) UTXOs() []*avax.UTXO
- func (tx *UniqueTx) Verify() error
- type UnsignedTx
- type VM
- func (vm *VM) Bootstrapped() error
- func (vm *VM) Bootstrapping() error
- func (vm *VM) Clock() *timer.Clock
- func (vm *VM) Codec() codec.Codec
- func (vm *VM) CreateHandlers() map[string]*common.HTTPHandler
- func (vm *VM) CreateStaticHandlers() map[string]*common.HTTPHandler
- func (vm *VM) FlushTxs()
- func (vm *VM) FormatAddress(chainID ids.ID, addr ids.ShortID) (string, error)
- func (vm *VM) FormatLocalAddress(addr ids.ShortID) (string, error)
- func (vm *VM) GetAtomicUTXOs(chainID ids.ID, addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, ...) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
- func (vm *VM) GetTx(txID ids.ID) (snowstorm.Tx, error)
- func (vm *VM) GetUTXOs(addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, limit int) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
- func (vm *VM) Initialize(ctx *snow.Context, db database.Database, genesisBytes []byte, ...) error
- func (vm *VM) IssueTx(b []byte) (ids.ID, error)
- func (vm *VM) LoadUser(username string, password string) ([]*avax.UTXO, *secp256k1fx.Keychain, error)
- func (vm *VM) Logger() logging.Logger
- func (vm *VM) Mint(utxos []*avax.UTXO, kc *secp256k1fx.Keychain, amounts map[[32]byte]uint64, ...) ([]*Operation, [][]*crypto.PrivateKeySECP256K1R, error)
- func (vm *VM) MintNFT(utxos []*avax.UTXO, kc *secp256k1fx.Keychain, assetID ids.ID, payload []byte, ...) ([]*Operation, [][]*crypto.PrivateKeySECP256K1R, error)
- func (vm *VM) ParseAddress(addrStr string) (ids.ID, ids.ShortID, error)
- func (vm *VM) ParseLocalAddress(addrStr string) (ids.ShortID, error)
- func (vm *VM) ParseTx(b []byte) (snowstorm.Tx, error)
- func (vm *VM) PendingTxs() []snowstorm.Tx
- func (vm *VM) Shutdown() error
- func (vm *VM) Spend(utxos []*avax.UTXO, kc *secp256k1fx.Keychain, amounts map[[32]byte]uint64) (map[[32]byte]uint64, []*avax.TransferableInput, ...)
- func (vm *VM) SpendAll(utxos []*avax.UTXO, kc *secp256k1fx.Keychain) (map[[32]byte]uint64, []*avax.TransferableInput, ...)
- func (vm *VM) SpendNFT(utxos []*avax.UTXO, kc *secp256k1fx.Keychain, assetID ids.ID, groupID uint32, ...) ([]*Operation, [][]*crypto.PrivateKeySECP256K1R, error)
Constants ¶
This section is empty.
Variables ¶
var (
ID = ids.NewID([32]byte{'a', 'v', 'm'})
)
ID that this VM uses when labeled
Functions ¶
This section is empty.
Types ¶
type AssetDefinition ¶
type AssetDefinition struct { Name string `json:"name"` Symbol string `json:"symbol"` Denomination cjson.Uint8 `json:"denomination"` InitialState map[string][]interface{} `json:"initialState"` }
AssetDefinition ...
type BaseTx ¶
BaseTx is the basis of all transactions.
func (*BaseTx) ExecuteWithSideEffects ¶
ExecuteWithSideEffects writes the batch with any additional side effects
func (*BaseTx) SemanticVerify ¶
func (t *BaseTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
SemanticVerify that this transaction is valid to be spent.
type BuildGenesisArgs ¶
type BuildGenesisArgs struct {
GenesisData map[string]AssetDefinition `json:"genesisData"`
}
BuildGenesisArgs are arguments for BuildGenesis
type BuildGenesisReply ¶
type BuildGenesisReply struct {
Bytes formatting.CB58 `json:"bytes"`
}
BuildGenesisReply is the reply from BuildGenesis
type CreateAssetTx ¶
type CreateAssetTx struct { BaseTx `serialize:"true"` Name string `serialize:"true" json:"name"` Symbol string `serialize:"true" json:"symbol"` Denomination byte `serialize:"true" json:"denomination"` States []*InitialState `serialize:"true" json:"initialStates"` }
CreateAssetTx is a transaction that creates a new asset.
func (*CreateAssetTx) InitialStates ¶
func (t *CreateAssetTx) InitialStates() []*InitialState
InitialStates track which virtual machines, and the initial state of these machines, this asset uses. The returned array should not be modified.
func (*CreateAssetTx) SyntacticVerify ¶
func (t *CreateAssetTx) SyntacticVerify( ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, numFxs int, ) error
SyntacticVerify that this transaction is well-formed.
func (*CreateAssetTx) UTXOs ¶
func (t *CreateAssetTx) UTXOs() []*avax.UTXO
UTXOs returns the UTXOs transaction is producing.
type CreateFixedCapAssetArgs ¶
type CreateFixedCapAssetArgs struct { api.UserPass Name string `json:"name"` Symbol string `json:"symbol"` Denomination byte `json:"denomination"` InitialHolders []*Holder `json:"initialHolders"` }
CreateFixedCapAssetArgs are arguments for passing into CreateFixedCapAsset requests
type CreateNFTAssetArgs ¶ added in v0.6.1
type CreateNFTAssetArgs struct { api.UserPass Name string `json:"name"` Symbol string `json:"symbol"` MinterSets []Owners `json:"minterSets"` }
CreateNFTAssetArgs are arguments for passing into CreateNFTAsset requests
type CreateVariableCapAssetArgs ¶
type CreateVariableCapAssetArgs struct { api.UserPass Name string `json:"name"` Symbol string `json:"symbol"` Denomination byte `json:"denomination"` MinterSets []Owners `json:"minterSets"` }
CreateVariableCapAssetArgs are arguments for passing into CreateVariableCapAsset requests
type ExportAVAXArgs ¶ added in v0.6.1
type ExportAVAXArgs struct { api.UserPass // User providing exported AVAX // Amount of nAVAX to send Amount json.Uint64 `json:"amount"` // ID of the address that will receive the AVAX. This address includes the // chainID, which is used to determine what the destination chain is. To string `json:"to"` }
ExportAVAXArgs are arguments for passing into ExportAVA requests
type ExportKeyArgs ¶
ExportKeyArgs are arguments for ExportKey
type ExportKeyReply ¶
type ExportKeyReply struct { // The decrypted PrivateKey for the Address provided in the arguments PrivateKey string `json:"privateKey"` }
ExportKeyReply is the response for ExportKey
type ExportTx ¶
type ExportTx struct { BaseTx `serialize:"true"` // Which chain to send the funds to DestinationChain ids.ID `serialize:"true" json:"destinationChain"` // The outputs this transaction is sending to the other chain ExportedOuts []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"` }
ExportTx is a transaction that exports an asset to another blockchain.
func (*ExportTx) ExecuteWithSideEffects ¶
ExecuteWithSideEffects writes the batch with any additional side effects
func (*ExportTx) SemanticVerify ¶
func (t *ExportTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
SemanticVerify that this transaction is valid to be spent.
type FormattedAssetID ¶ added in v0.6.1
FormattedAssetID defines a JSON formatted struct containing an assetID as a string
type FormattedTx ¶ added in v0.6.1
type FormattedTx struct {
Tx formatting.CB58 `json:"tx"`
}
FormattedTx defines a JSON formatted struct containing a Tx in CB58 format
type Fx ¶
type Fx interface { // Initialize this feature extension to be running under this VM. Should // return an error if the VM is incompatible. Initialize(vm interface{}) error // Notify this Fx that the VM is in bootstrapping Bootstrapping() error // Notify this Fx that the VM is bootstrapped Bootstrapped() error // VerifyTransfer verifies that the specified transaction can spend the // provided utxo with no restrictions on the destination. If the transaction // can't spend the output based on the input and credential, a non-nil error // should be returned. VerifyTransfer(tx, in, cred, utxo interface{}) error // VerifyOperation verifies that the specified transaction can spend the // provided utxos conditioned on the result being restricted to the provided // outputs. If the transaction can't spend the output based on the input and // credential, a non-nil error should be returned. VerifyOperation(tx, op, cred interface{}, utxos []interface{}) error }
Fx is the interface a feature extension must implement to support the AVM.
type FxOperation ¶
type FxOperation interface { verify.Verifiable Outs() []verify.State }
FxOperation ...
type Genesis ¶
type Genesis struct {
Txs []*GenesisAsset `serialize:"true"`
}
Genesis ...
func (*Genesis) IsSortedAndUnique ¶
IsSortedAndUnique ...
type GenesisAsset ¶
type GenesisAsset struct { Alias string `serialize:"true"` CreateAssetTx `serialize:"true"` }
GenesisAsset ...
type GetAllBalancesReply ¶ added in v0.5.0
type GetAllBalancesReply struct {
Balances []Balance `json:"balances"`
}
GetAllBalancesReply is the response from a call to GetAllBalances
type GetAssetDescriptionArgs ¶
type GetAssetDescriptionArgs struct {
AssetID string `json:"assetID"`
}
GetAssetDescriptionArgs are arguments for passing into GetAssetDescription requests
type GetAssetDescriptionReply ¶
type GetAssetDescriptionReply struct { FormattedAssetID Name string `json:"name"` Symbol string `json:"symbol"` Denomination json.Uint8 `json:"denomination"` }
GetAssetDescriptionReply defines the GetAssetDescription replies returned from the API
type GetBalanceArgs ¶
GetBalanceArgs are arguments for passing into GetBalance requests
type GetBalanceReply ¶
type GetBalanceReply struct { Balance json.Uint64 `json:"balance"` UTXOIDs []avax.UTXOID `json:"utxoIDs"` }
GetBalanceReply defines the GetBalance replies returned from the API
type GetTxStatusReply ¶
GetTxStatusReply defines the GetTxStatus replies returned from the API
type GetUTXOsArgs ¶
type GetUTXOsArgs struct { Addresses []string `json:"addresses"` Limit json.Uint32 `json:"limit"` StartIndex Index `json:"startIndex"` }
GetUTXOsArgs are arguments for passing into GetUTXOs. Gets the UTXOs that reference at least one address in [Addresses]. Returns at most [limit] addresses. If [limit] == 0 or > [maxUTXOsToFetch], fetches up to [maxUTXOsToFetch]. [StartIndex] defines where to start fetching UTXOs (for pagination.) UTXOs fetched are from addresses equal to or greater than [StartIndex.Address] For address [StartIndex.Address], only UTXOs with IDs greater than [StartIndex.UTXO] will be returned. If [StartIndex] is omitted, gets all UTXOs. If GetUTXOs is called multiple times, with our without [StartIndex], it is not guaranteed that returned UTXOs are unique. That is, the same UTXO may appear in the response of multiple calls.
type GetUTXOsReply ¶
type GetUTXOsReply struct { // The UTXOs UTXOs []formatting.CB58 `json:"utxos"` // The last UTXO that was returned, and the address it corresponds to. // Used for pagination. To get the rest of the UTXOs, call GetUTXOs // again and set [StartIndex] to this value. EndIndex Index `json:"endIndex"` }
GetUTXOsReply defines the GetUTXOs replies returned from the API
type ImportAVAXArgs ¶ added in v0.6.1
type ImportAVAXArgs struct { // User that controls To api.UserPass // Chain the funds are coming from SourceChain string `json:"sourceChain"` // Address receiving the imported AVAX To string `json:"to"` }
ImportAVAXArgs are arguments for passing into ImportAVAX requests
type ImportKeyArgs ¶
ImportKeyArgs are arguments for ImportKey
type ImportKeyReply ¶
type ImportKeyReply struct { // The address controlled by the PrivateKey provided in the arguments Address string `json:"address"` }
ImportKeyReply is the response for ImportKey
type ImportTx ¶
type ImportTx struct { BaseTx `serialize:"true"` // Which chain to consume the funds from SourceChain ids.ID `serialize:"true" json:"sourceChain"` // The inputs to this transaction ImportedIns []*avax.TransferableInput `serialize:"true" json:"importedInputs"` }
ImportTx is a transaction that imports an asset from another blockchain.
func (*ImportTx) ConsumedAssetIDs ¶ added in v0.5.7
ConsumedAssetIDs returns the IDs of the assets this transaction consumes
func (*ImportTx) ExecuteWithSideEffects ¶
ExecuteWithSideEffects writes the batch with any additional side effects
func (*ImportTx) InputUTXOs ¶
InputUTXOs track which UTXOs this transaction is consuming.
func (*ImportTx) NumCredentials ¶
NumCredentials returns the number of expected credentials
func (*ImportTx) SemanticVerify ¶
func (t *ImportTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
SemanticVerify that this transaction is well-formed.
type Index ¶ added in v0.6.1
type Index struct { Address string `json:"address"` // The address as a string UTXO string `json:"utxo"` // The UTXO ID as a string }
Index is an address and an associated UTXO. Marks a starting or stopping point when fetching UTXOs. Used for pagination.
type InitialState ¶
type InitialState struct { FxID uint32 `serialize:"true" json:"fxID"` Outs []verify.State `serialize:"true" json:"outputs"` }
InitialState ...
type MintArgs ¶ added in v0.6.1
type MintArgs struct { api.UserPass Amount json.Uint64 `json:"amount"` AssetID string `json:"assetID"` To string `json:"to"` }
MintArgs are arguments for passing into Mint requests
type MintNFTArgs ¶ added in v0.6.1
type MintNFTArgs struct { api.UserPass AssetID string `json:"assetID"` Payload formatting.CB58 `json:"payload"` To string `json:"to"` }
MintNFTArgs are arguments for passing into MintNFT requests
type Operation ¶
type Operation struct { avax.Asset `serialize:"true"` UTXOIDs []*avax.UTXOID `serialize:"true" json:"inputIDs"` Op FxOperation `serialize:"true" json:"operation"` }
Operation ...
type OperationTx ¶
type OperationTx struct { BaseTx `serialize:"true"` Ops []*Operation `serialize:"true" json:"operations"` }
OperationTx is a transaction with no credentials.
func (*OperationTx) AssetIDs ¶
func (t *OperationTx) AssetIDs() ids.Set
AssetIDs returns the IDs of the assets this transaction depends on
func (*OperationTx) ConsumedAssetIDs ¶ added in v0.5.7
func (t *OperationTx) ConsumedAssetIDs() ids.Set
ConsumedAssetIDs returns the IDs of the assets this transaction consumes
func (*OperationTx) InputUTXOs ¶
func (t *OperationTx) InputUTXOs() []*avax.UTXOID
InputUTXOs track which UTXOs this transaction is consuming.
func (*OperationTx) NumCredentials ¶
func (t *OperationTx) NumCredentials() int
NumCredentials returns the number of expected credentials
func (*OperationTx) Operations ¶
func (t *OperationTx) Operations() []*Operation
Operations track which ops this transaction is performing. The returned array should not be modified.
func (*OperationTx) SemanticVerify ¶
func (t *OperationTx) SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error
SemanticVerify that this transaction is well-formed.
func (*OperationTx) SyntacticVerify ¶
func (t *OperationTx) SyntacticVerify( ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, numFxs int, ) error
SyntacticVerify that this transaction is well-formed.
func (*OperationTx) UTXOs ¶
func (t *OperationTx) UTXOs() []*avax.UTXO
UTXOs returns the UTXOs transaction is producing.
type SendArgs ¶
type SendArgs struct { // Username and password of user sending the funds api.UserPass // The amount of funds to send Amount json.Uint64 `json:"amount"` // ID of the asset being sent AssetID string `json:"assetID"` // Address of the recipient To string `json:"to"` // Memo field Memo string `json:"memo"` }
SendArgs are arguments for passing into Send requests
type SendNFTArgs ¶ added in v0.6.1
type SendNFTArgs struct { api.UserPass AssetID string `json:"assetID"` GroupID json.Uint32 `json:"groupID"` To string `json:"to"` }
SendNFTArgs are arguments for passing into SendNFT requests
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service defines the base service for the asset vm
func (*Service) CreateAddress ¶
func (service *Service) CreateAddress(r *http.Request, args *api.UserPass, reply *api.JsonAddress) error
CreateAddress creates an address for the user [args.Username]
func (*Service) CreateFixedCapAsset ¶
func (service *Service) CreateFixedCapAsset(r *http.Request, args *CreateFixedCapAssetArgs, reply *FormattedAssetID) error
CreateFixedCapAsset returns ID of the newly created asset
func (*Service) CreateNFTAsset ¶ added in v0.6.1
func (service *Service) CreateNFTAsset(r *http.Request, args *CreateNFTAssetArgs, reply *FormattedAssetID) error
CreateNFTAsset returns ID of the newly created asset
func (*Service) CreateVariableCapAsset ¶
func (service *Service) CreateVariableCapAsset(r *http.Request, args *CreateVariableCapAssetArgs, reply *FormattedAssetID) error
CreateVariableCapAsset returns ID of the newly created asset
func (*Service) ExportAVAX ¶ added in v0.6.1
func (service *Service) ExportAVAX(_ *http.Request, args *ExportAVAXArgs, reply *api.JsonTxID) error
ExportAVAX sends AVAX from this chain to the P-Chain. After this tx is accepted, the AVAX must be imported to the P-chain with an importTx. Returns the ID of the newly created atomic transaction
func (*Service) ExportKey ¶
func (service *Service) ExportKey(r *http.Request, args *ExportKeyArgs, reply *ExportKeyReply) error
ExportKey returns a private key from the provided user
func (*Service) GetAllBalances ¶ added in v0.5.0
func (service *Service) GetAllBalances(r *http.Request, args *api.JsonAddress, reply *GetAllBalancesReply) error
GetAllBalances returns a map where:
Key: ID of an asset such that [args.Address] has a non-zero balance of the asset Value: The balance of the asset held by the address
Note that balances include assets that the address only _partially_ owns (ie is one of several addresses specified in a multi-sig)
func (*Service) GetAssetDescription ¶
func (service *Service) GetAssetDescription(_ *http.Request, args *GetAssetDescriptionArgs, reply *GetAssetDescriptionReply) error
GetAssetDescription creates an empty account with the name passed in
func (*Service) GetBalance ¶
func (service *Service) GetBalance(r *http.Request, args *GetBalanceArgs, reply *GetBalanceReply) error
GetBalance returns the amount of an asset that an address at least partially owns
func (*Service) GetTxStatus ¶
func (service *Service) GetTxStatus(r *http.Request, args *api.JsonTxID, reply *GetTxStatusReply) error
GetTxStatus returns the status of the specified transaction
func (*Service) GetUTXOs ¶
func (service *Service) GetUTXOs(r *http.Request, args *GetUTXOsArgs, reply *GetUTXOsReply) error
GetUTXOs gets all utxos for passed in addresses
func (*Service) ImportAVAX ¶ added in v0.6.1
func (service *Service) ImportAVAX(_ *http.Request, args *ImportAVAXArgs, reply *api.JsonTxID) error
ImportAVAX imports AVAX to this chain from the P-Chain. The AVAX must have already been exported from the P-Chain. Returns the ID of the newly created atomic transaction
func (*Service) ImportKey ¶
func (service *Service) ImportKey(r *http.Request, args *ImportKeyArgs, reply *api.JsonAddress) error
ImportKey adds a private key to the provided user
func (*Service) ListAddresses ¶ added in v0.5.0
func (service *Service) ListAddresses(_ *http.Request, args *api.UserPass, response *api.JsonAddresses) error
ListAddresses returns all of the addresses controlled by user [args.Username]
func (*Service) MintNFT ¶ added in v0.6.1
MintNFT issues a MintNFT transaction and returns the ID of the newly created transaction
type StaticService ¶
type StaticService struct{}
StaticService defines the base service for the asset vm
func (*StaticService) BuildGenesis ¶
func (ss *StaticService) BuildGenesis(_ *http.Request, args *BuildGenesisArgs, reply *BuildGenesisReply) error
BuildGenesis returns the UTXOs such that at least one address in [args.Addresses] is referenced in the UTXO.
type Tx ¶
type Tx struct { UnsignedTx `serialize:"true" json:"unsignedTx"` Creds []verify.Verifiable `serialize:"true" json:"credentials"` // The credentials of this transaction }
Tx is the core operation that can be performed. The tx uses the UTXO model. Specifically, a txs inputs will consume previous txs outputs. A tx will be valid if the inputs have the authority to consume the outputs they are attempting to consume and the inputs consume sufficient state to produce the outputs.
func (*Tx) Credentials ¶
func (t *Tx) Credentials() []verify.Verifiable
Credentials describes the authorization that allows the Inputs to consume the specified UTXOs. The returned array should not be modified.
func (*Tx) SemanticVerify ¶
func (t *Tx) SemanticVerify(vm *VM, tx UnsignedTx) error
SemanticVerify verifies that this transaction is well-formed.
func (*Tx) SignSECP256K1Fx ¶ added in v0.6.1
SignSECP256K1Fx ...
type UniqueTx ¶
type UniqueTx struct { *TxState // contains filtered or unexported fields }
UniqueTx provides a de-duplication service for txs. This only provides a performance boost
func (*UniqueTx) Accept ¶
Accept is called when the transaction was finalized as accepted by consensus
func (*UniqueTx) Dependencies ¶
Dependencies returns the set of transactions this transaction builds on
func (*UniqueTx) Evict ¶
func (tx *UniqueTx) Evict()
Evict is called when this UniqueTx will no longer be returned from a cache lookup
func (*UniqueTx) InputUTXOs ¶
InputUTXOs returns the utxos that will be consumed on tx acceptance
func (*UniqueTx) Reject ¶
Reject is called when the transaction was finalized as rejected by consensus
func (*UniqueTx) SemanticVerify ¶
SemanticVerify the validity of this transaction
func (*UniqueTx) SyntacticVerify ¶
SyntacticVerify verifies that this transaction is well formed
type UnsignedTx ¶
type UnsignedTx interface { Initialize(unsignedBytes, bytes []byte) ID() ids.ID UnsignedBytes() []byte Bytes() []byte ConsumedAssetIDs() ids.Set AssetIDs() ids.Set NumCredentials() int InputUTXOs() []*avax.UTXOID UTXOs() []*avax.UTXO SyntacticVerify(ctx *snow.Context, c codec.Codec, txFeeAssetID ids.ID, txFee uint64, numFxs int) error SemanticVerify(vm *VM, tx UnsignedTx, creds []verify.Verifiable) error ExecuteWithSideEffects(vm *VM, batch database.Batch) error }
UnsignedTx ...
type VM ¶
VM implements the avalanche.DAGVM interface
func (*VM) Bootstrapped ¶ added in v0.5.3
Bootstrapped is called by the consensus engine when it is done bootstrapping this chain
func (*VM) Bootstrapping ¶ added in v0.5.3
Bootstrapping is called by the consensus engine when it starts bootstrapping this chain
func (*VM) CreateHandlers ¶
func (vm *VM) CreateHandlers() map[string]*common.HTTPHandler
CreateHandlers implements the avalanche.DAGVM interface
func (*VM) CreateStaticHandlers ¶
func (vm *VM) CreateStaticHandlers() map[string]*common.HTTPHandler
CreateStaticHandlers implements the avalanche.DAGVM interface
func (*VM) FormatAddress ¶ added in v0.6.1
FormatAddress takes in a chainID and a raw address and produces the formatted address
func (*VM) FormatLocalAddress ¶ added in v0.6.1
FormatLocalAddress takes in a raw address and produces the formatted address
func (*VM) GetAtomicUTXOs ¶
func (vm *VM) GetAtomicUTXOs( chainID ids.ID, addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, limit int, ) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
GetAtomicUTXOs returns imported/exports UTXOs such that at least one of the addresses in [addrs] is referenced. Returns at most [limit] UTXOs. If [limit] <= 0 or [limit] > maxUTXOsToFetch, it is set to [maxUTXOsToFetch]. Returns: * The fetched of UTXOs * true if all there are no more UTXOs in this range to fetch * The address associated with the last UTXO fetched * The ID of the last UTXO fetched
func (*VM) GetUTXOs ¶
func (vm *VM) GetUTXOs( addrs ids.ShortSet, startAddr ids.ShortID, startUTXOID ids.ID, limit int, ) ([]*avax.UTXO, ids.ShortID, ids.ID, error)
GetUTXOs returns UTXOs such that at least one of the addresses in [addrs] is referenced. Returns at most [limit] UTXOs. If [limit] <= 0 or [limit] > maxUTXOsToFetch, it is set to [maxUTXOsToFetch]. Only returns UTXOs associated with addresses >= [startAddr]. For address [startAddr], only returns UTXOs whose IDs are greater than [startUTXOID]. Returns: * The fetched of UTXOs * The address associated with the last UTXO fetched * The ID of the last UTXO fetched
func (*VM) Initialize ¶
func (vm *VM) Initialize( ctx *snow.Context, db database.Database, genesisBytes []byte, toEngine chan<- common.Message, fxs []*common.Fx, ) error
Initialize implements the avalanche.DAGVM interface
func (*VM) IssueTx ¶
IssueTx attempts to send a transaction to consensus. If onDecide is specified, the function will be called when the transaction is either accepted or rejected with the appropriate status. This function will go out of scope when the transaction is removed from memory.
func (*VM) LoadUser ¶ added in v0.6.1
func (vm *VM) LoadUser( username string, password string, ) ( []*avax.UTXO, *secp256k1fx.Keychain, error, )
LoadUser ...
func (*VM) Mint ¶ added in v0.6.1
func (vm *VM) Mint( utxos []*avax.UTXO, kc *secp256k1fx.Keychain, amounts map[[32]byte]uint64, to ids.ShortID, ) ( []*Operation, [][]*crypto.PrivateKeySECP256K1R, error, )
Mint ...
func (*VM) MintNFT ¶ added in v0.6.1
func (vm *VM) MintNFT( utxos []*avax.UTXO, kc *secp256k1fx.Keychain, assetID ids.ID, payload []byte, to ids.ShortID, ) ( []*Operation, [][]*crypto.PrivateKeySECP256K1R, error, )
MintNFT ...
func (*VM) ParseAddress ¶ added in v0.6.1
ParseAddress takes in an address and produces the ID of the chain it's for the ID of the address
func (*VM) ParseLocalAddress ¶ added in v0.6.1
ParseLocalAddress takes in an address for this chain and produces the ID
func (*VM) PendingTxs ¶
PendingTxs implements the avalanche.DAGVM interface
func (*VM) Spend ¶ added in v0.6.1
func (vm *VM) Spend( utxos []*avax.UTXO, kc *secp256k1fx.Keychain, amounts map[[32]byte]uint64, ) ( map[[32]byte]uint64, []*avax.TransferableInput, [][]*crypto.PrivateKeySECP256K1R, error, )
Spend ...
func (*VM) SpendAll ¶ added in v0.6.1
func (vm *VM) SpendAll( utxos []*avax.UTXO, kc *secp256k1fx.Keychain, ) ( map[[32]byte]uint64, []*avax.TransferableInput, [][]*crypto.PrivateKeySECP256K1R, error, )
SpendAll ...