Documentation
¶
Index ¶
- type Asset
- type Asset2
- type SmartContract
- func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
- func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, ...) error
- func (s *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
- func (s *SmartContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]*Asset, error)
- func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface) error
- func (s *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
- func (s *SmartContract) TransferAsset(ctx contractapi.TransactionContextInterface, id string, newOwner string) error
- func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, ...) error
- type SmartContract2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
ID string `json:"ID"`
Color string `json:"color"`
Size int `json:"size"`
Owner string `json:"owner"`
AppraisedValue int `json:"appraisedValue"`
}
Asset describes basic details of what makes up a simple asset
type Asset2 ¶
type Asset2 struct {
ID string `json:"ID"`
Color string `json:"color"`
Size int `json:"size"`
Owner string `json:"owner"`
AppraisedValue int `json:"appraisedValue"`
}
Asset2 sample asset for transfer
type SmartContract ¶
type SmartContract struct {
contractapi.Contract
}
SmartContract provides functions for managing an Asset
func (*SmartContract) AssetExists ¶
func (s *SmartContract) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
AssetExists returns true when asset with given ID exists in world state
func (*SmartContract) CreateAsset ¶
func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error
CreateAsset issues a new asset to the world state with given details.
func (*SmartContract) DeleteAsset ¶
func (s *SmartContract) DeleteAsset(ctx contractapi.TransactionContextInterface, id string) error
DeleteAsset deletes an given asset from the world state.
func (*SmartContract) GetAllAssets ¶
func (s *SmartContract) GetAllAssets(ctx contractapi.TransactionContextInterface) ([]*Asset, error)
GetAllAssets returns all assets found in world state
func (*SmartContract) InitLedger ¶
func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface) error
InitLedger adds a base set of assets to the ledger
func (*SmartContract) ReadAsset ¶
func (s *SmartContract) ReadAsset(ctx contractapi.TransactionContextInterface, id string) (*Asset, error)
ReadAsset returns the asset stored in the world state with given id.
func (*SmartContract) TransferAsset ¶
func (s *SmartContract) TransferAsset(ctx contractapi.TransactionContextInterface, id string, newOwner string) error
TransferAsset updates the owner field of asset with given id in world state.
func (*SmartContract) UpdateAsset ¶
func (s *SmartContract) UpdateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error
UpdateAsset updates an existing asset in the world state with provided parameters.
type SmartContract2 ¶
type SmartContract2 struct {
contractapi.Contract
}
SmartContract2 provides functions for managing an Asset
func (*SmartContract2) AssetExists ¶
func (s *SmartContract2) AssetExists(ctx contractapi.TransactionContextInterface, id string) (bool, error)
AssetExists returns true when asset with given ID exists in world state
func (*SmartContract2) CreateAsset ¶
func (s *SmartContract2) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error
CreateAsset issues a new asset to the world state with given details.