Documentation ¶
Index ¶
- Constants
- Variables
- func Attributes2StringMaps(attributes []*sdk.DDOAttribute) map[string]string
- func ClaimCommit(claim *Claim, acct *sdk.Account) (common.Uint256, error)
- func ClaimGetStatus(claim string) *sdkcom.PreExecResult
- func ClaimRevoke(claim, commiter string, acct *sdk.Account) (common.Uint256, error)
- func DeployContract(acct *sdk.Account, sc *sdkcom.SmartContract) (common.Uint256, error)
- func DeployContractCode(acct *sdk.Account, name, code string) (common.Uint256, error)
- func GenerateClaim(d []byte) []byte
- func GetDDO(id string) *sdk.DDO
- func GetID() string
- func GetSdk(url string) *sdk.OntologySdk
- func GetSimpleStorage(key []byte) *sdkcom.PreExecResult
- func GetSmartContractEvent(txHash string) (*sdkcom.SmartContactEvent, error)
- func GetStorage(addr string, key []byte) ([]byte, error)
- func GetTxInfo(hash string) (*types.Transaction, error)
- func IdentityFormat(fl validator.FieldLevel) bool
- func PostSimpleStorage(acct *sdk.Account, key, value []byte) (common.Uint256, error)
- func PutSimpleStorage(acct *sdk.Account, key, value []byte) (common.Uint256, error)
- func RemoveSimpleStorage(acct *sdk.Account, key []byte) (common.Uint256, error)
- func StringMap2Attributes(attr map[string]string) []*sdk.DDOAttribute
- func VerifyClaim(claim, data []byte) bool
- type Claim
- type ManagedIdentity
- type ManagedWallet
- func GetManagedWalletFromDB(db kvdb.KVMethods, key string) *ManagedWallet
- func GetManagedWalletFromFile(path string) *ManagedWallet
- func NewDefaultWallet(name string, password []byte) *ManagedWallet
- func NewManagedWallet(name string, rev string, password []byte) *ManagedWallet
- func NewUpdatedManagedWallet(name string, password []byte) *ManagedWallet
- type SmartContract
- type WalletStorage
Constants ¶
const ( NotStored = iota PartStored AllStored )
wallet storage status
Variables ¶
var (
// Endpoint - ont block chain restful api endpoint
Endpoint = "http://localhost:20334"
)
var (
// FirstRevision - first or default revision
FirstRevision = "0.1.0"
)
Functions ¶
func Attributes2StringMaps ¶
func Attributes2StringMaps(attributes []*sdk.DDOAttribute) map[string]string
Attributes2StringMaps - attributes to map
func ClaimCommit ¶
ClaimCommit - Commit claim
func ClaimGetStatus ¶
func ClaimGetStatus(claim string) *sdkcom.PreExecResult
ClaimGetStatus - get claim status
func ClaimRevoke ¶
ClaimRevoke - revoke a claim
func DeployContract ¶
DeployContract - deploy contract
func DeployContractCode ¶
DeployContractCode - deploy contract code
func GetSdk ¶
func GetSdk(url string) *sdk.OntologySdk
GetSdk - get default sdk url - restful interface. If pass "" we using the default URL configurated.
func GetSimpleStorage ¶
func GetSimpleStorage(key []byte) *sdkcom.PreExecResult
GetSimpleStorage - get simple storage
func GetSmartContractEvent ¶
func GetSmartContractEvent(txHash string) (*sdkcom.SmartContactEvent, error)
GetSmartContractEvent - get smart contract event
func GetStorage ¶
GetStorage - get smartcontract storage
func GetTxInfo ¶
func GetTxInfo(hash string) (*types.Transaction, error)
GetTxInfo - get transaction infomation
func IdentityFormat ¶
func IdentityFormat(fl validator.FieldLevel) bool
IdentityFormat - validate for indentity
func PostSimpleStorage ¶
PostSimpleStorage - post simple storage
func PutSimpleStorage ¶
PutSimpleStorage - create simple storage
func RemoveSimpleStorage ¶
RemoveSimpleStorage - remove simple storage
func StringMap2Attributes ¶
func StringMap2Attributes(attr map[string]string) []*sdk.DDOAttribute
StringMap2Attributes - stringmap to attributes
Types ¶
type Claim ¶
Claim - Claim is a contract that save the document hash to record content impartially commiter is the claim issuer. Who wants to claim this issue should be first creator of claim and had the operation power. owner is the administrator of this claim. owner is who had authority to manage this claim.
type ManagedIdentity ¶
type ManagedIdentity struct { sdk.IdentityData Password []byte }
ManagedIdentity - Get Password in storage
func GetIdentityFromID ¶
func GetIdentityFromID(id string, passwd []byte) (*ManagedIdentity, error)
GetIdentityFromID - get identity struct from id include control data
func (*ManagedIdentity) Identity ¶
func (id *ManagedIdentity) Identity() (*sdk.Identity, error)
Identity - get identity from managedidentity
func (*ManagedIdentity) RegIDWithAttributes ¶
func (id *ManagedIdentity) RegIDWithAttributes(attr map[string]string, signer *sdk.Account)
RegIDWithAttributes -register id with attributes
func (*ManagedIdentity) RegisterID ¶
func (id *ManagedIdentity) RegisterID(signer *sdk.Account)
RegisterID - register id to blockchain
type ManagedWallet ¶
type ManagedWallet struct { Name string // ID/Key of wallet Revision string // revision of wallet format or something information Info string // extended information WalletStorage Password []byte Data sdk.WalletData Wallet *sdk.Wallet `json:"-"` DefAccout *sdk.Account `json:"-"` DefIdentity *sdk.Identity `json:"-"` }
ManagedWallet - managed wallet Save password and walletdata in struct. Easier saving and loading data to database or storage 1, Load the data, then using "Update" function to refresh the wallet 2, get "walletData" from wallet information. After setting password and path then "Update" also can get managedwallet 3, "NewUpdatedManagedWallet" to get a full new managedwallet. 4, "GetWallet" to get wallet from managedwallet.
func GetManagedWalletFromDB ¶
func GetManagedWalletFromDB(db kvdb.KVMethods, key string) *ManagedWallet
GetManagedWalletFromDB - load managedwallet from database
func GetManagedWalletFromFile ¶
func GetManagedWalletFromFile(path string) *ManagedWallet
GetManagedWalletFromFile - load managedwallet from wallet file
func NewDefaultWallet ¶
func NewDefaultWallet(name string, password []byte) *ManagedWallet
NewDefaultWallet - Creart new default revision and path "" Wallet
func NewManagedWallet ¶
func NewManagedWallet(name string, rev string, password []byte) *ManagedWallet
NewManagedWallet - Create a new managedwallet
func NewUpdatedManagedWallet ¶
func NewUpdatedManagedWallet(name string, password []byte) *ManagedWallet
NewUpdatedManagedWallet - Create a new managedwallet
func (*ManagedWallet) GetWallet ¶
func (mw *ManagedWallet) GetWallet() *sdk.Wallet
GetWallet - get managedwallet's wallet
func (*ManagedWallet) SetDB ¶
func (mw *ManagedWallet) SetDB(db kvdb.KVMethods) *sdk.Wallet
SetDB - store managewallet into the db
func (*ManagedWallet) SetFilePath ¶
func (mw *ManagedWallet) SetFilePath(path string, force bool) error
SetFilePath - Save wallet to wallet file(path)
func (*ManagedWallet) Update ¶
func (mw *ManagedWallet) Update() error
Update - after get walletdata from json update to *wallet and * account
func (*ManagedWallet) UpdateWalletData ¶
func (mw *ManagedWallet) UpdateWalletData()
UpdateWalletData - update walletdata from ManagedWallet.Wallet to ManagedWallet.Data
type WalletStorage ¶
WalletStorage - wallet storage information