Documentation ¶
Index ¶
- Constants
- Variables
- func CheckKeyTypeCurve(keyType keypair.KeyType, curveCode byte) bool
- func CheckSigScheme(keyType keypair.KeyType, sigScheme s.SignatureScheme) bool
- func CreateID(nonce []byte) (string, error)
- func GenerateID() (string, error)
- func GetCurveName(pubKey []byte) string
- func GetKeyTypeString(keyType keypair.KeyType) string
- func ScryptEqual(s1, s2 *keypair.ScryptParam) bool
- func VerifyID(id string) bool
- type Account
- type AccountData
- type Auth
- func (nc *Auth) AssignFuncsToRole(gasPrice, gasLimit uint64, contractAddress common.Address, signer *Account, ...) (common.Uint256, error)
- func (nc *Auth) AssignOntIDsToRole(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (nc *Auth) Delegate(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (nc *Auth) NewAssignFuncsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *Auth) NewAssignOntIDsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *Auth) NewDelegateTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *Auth) NewTransferTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, newAdminID []byte, ...) (*types.MutableTransaction, error)
- func (nc *Auth) NewVerifyTokenTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, caller []byte, ...) (*types.MutableTransaction, error)
- func (nc *Auth) NewWithdrawTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *Auth) Transfer(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (nc *Auth) VerifyToken(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (nc *Auth) Withdraw(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- type Controller
- type ControllerData
- func (c *ControllerData) Clone() *ControllerData
- func (c *ControllerData) GetController(passwd []byte) (*Controller, error)
- func (c *ControllerData) GetKeyPair() *keypair.ProtectedKey
- func (c *ControllerData) GetScrypt() *keypair.ScryptParam
- func (c *ControllerData) SetKeyPair(keyinfo *keypair.ProtectedKey)
- type DDO
- type DDOAttribute
- type DDOOwner
- type GlobalParam
- func (nc *GlobalParam) AcceptAdmin(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
- func (nc *GlobalParam) CreateSnapshot(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
- func (nc *GlobalParam) GetGlobalParams(params []string) (map[string]string, error)
- func (nc *GlobalParam) NewAcceptAdminTransaction(gasPrice, gasLimit uint64, admin common.Address) (*types.MutableTransaction, error)
- func (nc *GlobalParam) NewCreateSnapshotTransaction(gasPrice, gasLimit uint64) (*types.MutableTransaction, error)
- func (nc *GlobalParam) NewSetGlobalParamsTransaction(gasPrice, gasLimit uint64, params map[string]string) (*types.MutableTransaction, error)
- func (nc *GlobalParam) NewSetOperatorTransaction(gasPrice, gasLimit uint64, operator common.Address) (*types.MutableTransaction, error)
- func (nc *GlobalParam) NewTransferAdminTransaction(gasPrice, gasLimit uint64, newAdmin common.Address) (*types.MutableTransaction, error)
- func (nc *GlobalParam) SetGlobalParams(gasPrice, gasLimit uint64, signer *Account, params map[string]string) (common.Uint256, error)
- func (nc *GlobalParam) SetOperator(gasPrice, gasLimit uint64, signer *Account, operator common.Address) (common.Uint256, error)
- func (nc *GlobalParam) TransferAdmin(gasPrice, gasLimit uint64, signer *Account, newAdmin common.Address) (common.Uint256, error)
- type Identity
- func (i *Identity) AddControllerData(controllerData *ControllerData) error
- func (i *Identity) ControllerCount() int
- func (i *Identity) DeleteControllerData(id string) error
- func (i *Identity) GetControllerByID(id string, passwd []byte) (*Controller, error)
- func (i *Identity) GetControllerByIndex(index int, passwd []byte) (*Controller, error)
- func (i *Identity) GetControllerByPubKey(pubKey string, passwd []byte) (*Controller, error)
- func (i *Identity) GetControllerDataByID(id string) (*ControllerData, error)
- func (i *Identity) GetControllerDataByIndex(index int) (*ControllerData, error)
- func (i *Identity) GetControllerDataByPubKey(pubKey string) (*ControllerData, error)
- func (i *Identity) NewController(id string, keyType keypair.KeyType, curveCode byte, ...) (*Controller, error)
- func (i *Identity) NewDefaultSettingController(id string, passwd []byte) (*Controller, error)
- func (i *Identity) ToIdentityData() *IdentityData
- type IdentityData
- type NativeContract
- func (nc *NativeContract) InvokeNativeContract(gasPrice, gasLimit uint64, singer *Account, version byte, ...) (common.Uint256, error)
- func (nc *NativeContract) NewNativeInvokeTransaction(gasPrice, gasLimit uint64, version byte, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *NativeContract) PreExecInvokeNativeContract(contractAddress common.Address, version byte, method string, ...) (*sdkcom.PreExecResult, error)
- type NeoVMContract
- func (nc *NeoVMContract) DeployNeoVMSmartContract(gasPrice, gasLimit uint64, singer *Account, needStorage bool, ...) (common.Uint256, error)
- func (nc *NeoVMContract) InvokeNeoVMContract(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (nc *NeoVMContract) NewDeployNeoVMCodeTransaction(gasPrice, gasLimit uint64, contract *sdkcom.SmartContract) *types.MutableTransaction
- func (nc *NeoVMContract) NewNeoVMInvokeTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (nc *NeoVMContract) PreExecInvokeNeoVMContract(contractAddress common.Address, params []interface{}) (*sdkcom.PreExecResult, error)
- type Ong
- func (o *Ong) Allowance(from, to common.Address) (uint64, error)
- func (o *Ong) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (o *Ong) BalanceOf(address common.Address) (uint64, error)
- func (o *Ong) Decimals() (byte, error)
- func (o *Ong) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
- func (o *Ong) Name() (string, error)
- func (o *Ong) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ong) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
- func (o *Ong) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ong) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ong) NewWithdrawONGTransaction(gasPrice, gasLimit uint64, address common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ong) Symbol() (string, error)
- func (o *Ong) TotalSupply() (uint64, error)
- func (o *Ong) Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (o *Ong) TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, ...) (common.Uint256, error)
- func (o *Ong) UnboundONG(address common.Address) (uint64, error)
- func (o *Ong) WithdrawONG(gasPrice, gasLimit uint64, address *Account, amount uint64) (common.Uint256, error)
- type Ont
- func (o *Ont) Allowance(from, to common.Address) (uint64, error)
- func (o *Ont) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (o *Ont) BalanceOf(address common.Address) (uint64, error)
- func (o *Ont) Decimals() (byte, error)
- func (o *Ont) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
- func (o *Ont) Name() (string, error)
- func (o *Ont) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ont) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
- func (o *Ont) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ont) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (o *Ont) Symbol() (string, error)
- func (o *Ont) TotalSupply() (uint64, error)
- func (o *Ont) Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (o *Ont) TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, ...) (common.Uint256, error)
- type OntID
- func (nc *OntID) AddAttributes(gasPrice, gasLimit uint64, signer *Account, OntID string, ...) (common.Uint256, error)
- func (nc *OntID) AddKey(gasPrice, gasLimit uint64, OntID string, signer *Account, ...) (common.Uint256, error)
- func (nc *OntID) ChangeRecovery(gasPrice, gasLimit uint64, signer *Account, OntID string, ...) (common.Uint256, error)
- func (nc *OntID) GetAttributes(OntID string) ([]*DDOAttribute, error)
- func (nc *OntID) GetDDO(OntID string) (*DDO, error)
- func (nc *OntID) GetKeyState(OntID string, keyIndex int) (string, error)
- func (nc *OntID) GetPublicKeys(OntID string) ([]*DDOOwner, error)
- func (nc *OntID) NewAddAttributesTransaction(gasPrice, gasLimit uint64, OntID string, attributes []*DDOAttribute, ...) (*types.MutableTransaction, error)
- func (nc *OntID) NewAddKeyTransaction(gasPrice, gasLimit uint64, OntID string, newPubKey, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (nc *OntID) NewChangeRecoveryTransaction(gasPrice, gasLimit uint64, OntID string, ...) (*types.MutableTransaction, error)
- func (nc *OntID) NewRegIDWithAttributesTransaction(gasPrice, gasLimit uint64, OntID string, pubKey keypair.PublicKey, ...) (*types.MutableTransaction, error)
- func (nc *OntID) NewRegIDWithPublicKeyTransaction(gasPrice, gasLimit uint64, OntID string, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (nc *OntID) NewRemoveAttributeTransaction(gasPrice, gasLimit uint64, OntID string, key []byte, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (nc *OntID) NewRevokeKeyTransaction(gasPrice, gasLimit uint64, OntID string, ...) (*types.MutableTransaction, error)
- func (nc *OntID) NewSetRecoveryTransaction(gasPrice, gasLimit uint64, OntID string, recovery common.Address, ...) (*types.MutableTransaction, error)
- func (nc *OntID) RegIDWithAttributes(gasPrice, gasLimit uint64, signer *Account, OntID string, ...) (common.Uint256, error)
- func (nc *OntID) RegIDWithPublicKey(gasPrice, gasLimit uint64, signer *Account, OntID string, ...) (common.Uint256, error)
- func (nc *OntID) RemoveAttribute(gasPrice, gasLimit uint64, signer *Account, OntID string, removeKey []byte, ...) (common.Uint256, error)
- func (nc *OntID) RevokeKey(gasPrice, gasLimit uint64, OntID string, signer *Account, ...) (common.Uint256, error)
- func (nc *OntID) SetRecovery(gasPrice, gasLimit uint64, signer *Account, OntID string, ...) (common.Uint256, error)
- func (nc *OntID) VerifySignature(OntID string, keyIndex int, controller *Controller) (bool, error)
- type OntologySdk
- func (sdk *OntologySdk) CreateWallet(walletFile string) (*Wallet, error)
- func (sdk *OntologySdk) GetAdddrByPubKey(pubKey keypair.PublicKey) string
- func (sdk *OntologySdk) GetMultiAddr(pubkeys []keypair.PublicKey, m int) (string, error)
- func (sdk *OntologySdk) MultiSignToTransaction(tx *types.MutableTransaction, m uint16, pubKeys []keypair.PublicKey, ...) error
- func (sdk *OntologySdk) NewInvokeTransaction(gasPrice, gasLimit uint64, invokeCode []byte) *types.MutableTransaction
- func (sdk *OntologySdk) OpenWallet(walletFile string) (*Wallet, error)
- func (sdk *OntologySdk) SignToTransaction(tx *types.MutableTransaction, signer Signer) error
- type Signer
- type Wallet
- func (w *Wallet) AddAccountData(accountData *AccountData) error
- func (w *Wallet) AddIdentity(identity *Identity) error
- func (w *Wallet) ChangeAccountPassword(address string, oldPassword, newPassword []byte) error
- func (w *Wallet) DeleteAccount(address string) error
- func (w *Wallet) DeleteIdentity(id string) error
- func (w *Wallet) ExportAccounts(path string, accountDatas []*AccountData, passwds [][]byte, ...) (*Wallet, error)
- func (w *Wallet) GetAccountByAddress(address string, passwd []byte) (*Account, error)
- func (w *Wallet) GetAccountByIndex(index int, passwd []byte) (*Account, error)
- func (w *Wallet) GetAccountByLabel(label string, passwd []byte) (*Account, error)
- func (w *Wallet) GetAccountCount() int
- func (w *Wallet) GetAccountDataByAddress(address string) (*AccountData, error)
- func (w *Wallet) GetAccountDataByIndex(index int) (*AccountData, error)
- func (w *Wallet) GetAccountDataByLabel(label string) (*AccountData, error)
- func (w *Wallet) GetDefaultAccount(passwd []byte) (*Account, error)
- func (w *Wallet) GetDefaultAccountData() (*AccountData, error)
- func (w *Wallet) GetDefaultIdentity() (*Identity, error)
- func (w *Wallet) GetIdentityByID(id string) (*Identity, error)
- func (w *Wallet) GetIdentityByIndex(index int) (*Identity, error)
- func (w *Wallet) GetIdentityByLabel(label string) (*Identity, error)
- func (w *Wallet) GetIdentityCount() int
- func (w *Wallet) GetWalletData() WalletData
- func (w *Wallet) ImportAccounts(accountDatas []*AccountData, passwds [][]byte) error
- func (w *Wallet) NewAccount(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, ...) (*Account, error)
- func (w *Wallet) NewAccountFromWIF(wif, passwd []byte) (*Account, error)
- func (w *Wallet) NewDefaultSettingAccount(passwd []byte) (*Account, error)
- func (w *Wallet) NewDefaultSettingIdentity(passwd []byte) (*Identity, error)
- func (w *Wallet) NewIdentity(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, ...) (*Identity, error)
- func (w *Wallet) Save() error
- func (w *Wallet) SetDefaultAccount(address string) error
- func (w *Wallet) SetDefaultIdentity(id string) error
- func (w *Wallet) SetIdentityLabel(id, newLabel string) error
- func (w *Wallet) SetLabel(address, newLabel string) error
- func (w *Wallet) SetSigScheme(address string, sigScheme s.SignatureScheme) error
- type WalletData
Constants ¶
const ( // SCHEME - did scheme SCHEME = "did" // METHOD - did method METHOD = "ont" // VER - did version VER = 0x41 )
const ( // KeyStatusRevoke - KeyStatusRevoke = "revoked" // KyeStatusInUse - KyeStatusInUse = "in use" )
Variables ¶
var (
// OntContractAddress -
OntContractAddress, _ = utils.AddressFromHexString("0100000000000000000000000000000000000000")
// OngContractAddress -
OngContractAddress, _ = utils.AddressFromHexString("0200000000000000000000000000000000000000")
// OntIDContractAddress -
OntIDContractAddress, _ = utils.AddressFromHexString("0300000000000000000000000000000000000000")
// GlobalParamsContractAddress -
GlobalParamsContractAddress, _ = utils.AddressFromHexString("0400000000000000000000000000000000000000")
// AuthContractAddress -
AuthContractAddress, _ = utils.AddressFromHexString("0600000000000000000000000000000000000000")
// GovernanceContractAddress -
GovernanceContractAddress, _ = utils.AddressFromHexString("0700000000000000000000000000000000000000")
)
var ( // OntContractVersion - OntContractVersion = byte(0) // OngContractVersion - OngContractVersion = byte(0) // OntIDContractVersion - OntIDContractVersion = byte(0) // GlobalParamsContractVersion - GlobalParamsContractVersion = byte(0) // AuthContractVersion - AuthContractVersion = byte(0) // GovernanceContractVersion - GovernanceContractVersion = byte(0) )
var DefaultWalletName = "MyWallet"
DefaultWalletName -
var DefaultWalletVersion = "1.1"
DefaultWalletVersion -
var ErrAccountNotFound = errors.New("account not found")
ErrAccountNotFound -
var ErrControllerNotFound = errors.New("controller not found")
ErrControllerNotFound -
var ErrIdentityNotFound = errors.New("identity not found")
ErrIdentityNotFound -
Functions ¶
func CheckKeyTypeCurve ¶
CheckKeyTypeCurve -
func CheckSigScheme ¶
func CheckSigScheme(keyType keypair.KeyType, sigScheme s.SignatureScheme) bool
CheckSigScheme -
Types ¶
type Account ¶
type Account struct { PrivateKey keypair.PrivateKey PublicKey keypair.PublicKey Address common.Address SigScheme s.SignatureScheme }
Account - crypto object
func (*Account) GetPrivateKey ¶
func (a *Account) GetPrivateKey() keypair.PrivateKey
GetPrivateKey -
type AccountData ¶
type AccountData struct { keypair.ProtectedKey Label string `json:"label"` PubKey string `json:"publicKey"` SigSch string `json:"signatureScheme"` IsDefault bool `json:"isDefault"` Lock bool `json:"lock"` // contains filtered or unexported fields }
AccountData - for wallet read and save, no crypto object included
func NewAccountData ¶
func NewAccountData(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte, scrypts ...*keypair.ScryptParam) (*AccountData, error)
NewAccountData -
func (*AccountData) GetAccount ¶
func (a *AccountData) GetAccount(passwd []byte) (*Account, error)
GetAccount -
func (*AccountData) GetKeyPair ¶
func (a *AccountData) GetKeyPair() *keypair.ProtectedKey
GetKeyPair -
func (*AccountData) SetKeyPair ¶
func (a *AccountData) SetKeyPair(keyinfo *keypair.ProtectedKey)
SetKeyPair -
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth -
func (*Auth) AssignFuncsToRole ¶
func (nc *Auth) AssignFuncsToRole(gasPrice, gasLimit uint64, contractAddress common.Address, signer *Account, adminID, role []byte, funcNames []string, keyIndex int) (common.Uint256, error)
AssignFuncsToRole -
func (*Auth) AssignOntIDsToRole ¶
func (nc *Auth) AssignOntIDsToRole(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, admOntID, role []byte, persons [][]byte, keyIndex int) (common.Uint256, error)
AssignOntIDsToRole -
func (*Auth) Delegate ¶
func (nc *Auth) Delegate(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, from, to, role []byte, period, level, keyIndex int) (common.Uint256, error)
Delegate -
func (*Auth) NewAssignFuncsToRoleTransaction ¶
func (nc *Auth) NewAssignFuncsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, adminID, role []byte, funcNames []string, keyIndex int) (*types.MutableTransaction, error)
NewAssignFuncsToRoleTransaction -
func (*Auth) NewAssignOntIDsToRoleTransaction ¶
func (nc *Auth) NewAssignOntIDsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, admOntID, role []byte, persons [][]byte, keyIndex int) (*types.MutableTransaction, error)
NewAssignOntIDsToRoleTransaction -
func (*Auth) NewDelegateTransaction ¶
func (nc *Auth) NewDelegateTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, from, to, role []byte, period, level, keyIndex int) (*types.MutableTransaction, error)
NewDelegateTransaction -
func (*Auth) NewTransferTransaction ¶
func (nc *Auth) NewTransferTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, newAdminID []byte, keyIndex int) (*types.MutableTransaction, error)
NewTransferTransaction -
func (*Auth) NewVerifyTokenTransaction ¶
func (nc *Auth) NewVerifyTokenTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, caller []byte, funcName string, keyIndex int) (*types.MutableTransaction, error)
NewVerifyTokenTransaction -
func (*Auth) NewWithdrawTransaction ¶
func (nc *Auth) NewWithdrawTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, initiator, delegate, role []byte, keyIndex int) (*types.MutableTransaction, error)
NewWithdrawTransaction -
func (*Auth) Transfer ¶
func (nc *Auth) Transfer(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, newAdminID []byte, keyIndex int) (common.Uint256, error)
Transfer -
type Controller ¶
type Controller struct { ID string PrivateKey keypair.PrivateKey PublicKey keypair.PublicKey SigScheme s.SignatureScheme }
Controller -
func (*Controller) GetPrivateKey ¶
func (c *Controller) GetPrivateKey() keypair.PrivateKey
GetPrivateKey -
func (*Controller) GetPublicKey ¶
func (c *Controller) GetPublicKey() keypair.PublicKey
GetPublicKey -
func (*Controller) GetSigScheme ¶
func (c *Controller) GetSigScheme() s.SignatureScheme
GetSigScheme -
type ControllerData ¶
type ControllerData struct { ID string `json:"id"` Public string `json:"publicKey,omitemtpy"` SigSch string `json:"signatureScheme"` keypair.ProtectedKey // contains filtered or unexported fields }
ControllerData -
func NewControllerData ¶
func NewControllerData(id string, keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte, scrypts ...*keypair.ScryptParam) (*ControllerData, error)
NewControllerData -
func NewControllerDataFromProtectedKey ¶
func NewControllerDataFromProtectedKey(id, pubKey string, protectedKey *keypair.ProtectedKey, SigSch string, scrypts ...*keypair.ScryptParam) *ControllerData
NewControllerDataFromProtectedKey -
func (*ControllerData) GetController ¶
func (c *ControllerData) GetController(passwd []byte) (*Controller, error)
GetController -
func (*ControllerData) GetKeyPair ¶
func (c *ControllerData) GetKeyPair() *keypair.ProtectedKey
GetKeyPair -
func (*ControllerData) GetScrypt ¶
func (c *ControllerData) GetScrypt() *keypair.ScryptParam
GetScrypt -
func (*ControllerData) SetKeyPair ¶
func (c *ControllerData) SetKeyPair(keyinfo *keypair.ProtectedKey)
SetKeyPair -
type DDO ¶
type DDO struct { OntID string Owners []*DDOOwner Attributes []*DDOAttribute Recovery string }
DDO -
type DDOAttribute ¶
DDOAttribute -
type DDOOwner ¶
type DDOOwner struct { PubKeyID string Type string Curve string Value string // contains filtered or unexported fields }
DDOOwner -
type GlobalParam ¶
type GlobalParam struct {
// contains filtered or unexported fields
}
GlobalParam -
func (*GlobalParam) AcceptAdmin ¶
func (nc *GlobalParam) AcceptAdmin(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
AcceptAdmin -
func (*GlobalParam) CreateSnapshot ¶
func (nc *GlobalParam) CreateSnapshot(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
CreateSnapshot -
func (*GlobalParam) GetGlobalParams ¶
func (nc *GlobalParam) GetGlobalParams(params []string) (map[string]string, error)
GetGlobalParams -
func (*GlobalParam) NewAcceptAdminTransaction ¶
func (nc *GlobalParam) NewAcceptAdminTransaction(gasPrice, gasLimit uint64, admin common.Address) (*types.MutableTransaction, error)
NewAcceptAdminTransaction -
func (*GlobalParam) NewCreateSnapshotTransaction ¶
func (nc *GlobalParam) NewCreateSnapshotTransaction(gasPrice, gasLimit uint64) (*types.MutableTransaction, error)
NewCreateSnapshotTransaction -
func (*GlobalParam) NewSetGlobalParamsTransaction ¶
func (nc *GlobalParam) NewSetGlobalParamsTransaction(gasPrice, gasLimit uint64, params map[string]string) (*types.MutableTransaction, error)
NewSetGlobalParamsTransaction -
func (*GlobalParam) NewSetOperatorTransaction ¶
func (nc *GlobalParam) NewSetOperatorTransaction(gasPrice, gasLimit uint64, operator common.Address) (*types.MutableTransaction, error)
NewSetOperatorTransaction -
func (*GlobalParam) NewTransferAdminTransaction ¶
func (nc *GlobalParam) NewTransferAdminTransaction(gasPrice, gasLimit uint64, newAdmin common.Address) (*types.MutableTransaction, error)
NewTransferAdminTransaction -
func (*GlobalParam) SetGlobalParams ¶
func (nc *GlobalParam) SetGlobalParams(gasPrice, gasLimit uint64, signer *Account, params map[string]string) (common.Uint256, error)
SetGlobalParams -
func (*GlobalParam) SetOperator ¶
func (nc *GlobalParam) SetOperator(gasPrice, gasLimit uint64, signer *Account, operator common.Address) (common.Uint256, error)
SetOperator -
func (*GlobalParam) TransferAdmin ¶
func (nc *GlobalParam) TransferAdmin(gasPrice, gasLimit uint64, signer *Account, newAdmin common.Address) (common.Uint256, error)
TransferAdmin -
type Identity ¶
type Identity struct { ID string Label string Lock bool IsDefault bool Extra interface{} // contains filtered or unexported fields }
Identity -
func GetDefaultIdentityFromID ¶
GetDefaultIdentityFromID - generate identity from id string
func NewIdentity ¶
func NewIdentity(scrypt *keypair.ScryptParam) (*Identity, error)
NewIdentity - new identity with scrypt
func NewIdentityFromIdentityData ¶
func NewIdentityFromIdentityData(identityData *IdentityData) (*Identity, error)
NewIdentityFromIdentityData -
func (*Identity) AddControllerData ¶
func (i *Identity) AddControllerData(controllerData *ControllerData) error
AddControllerData -
func (*Identity) DeleteControllerData ¶
DeleteControllerData -
func (*Identity) GetControllerByID ¶
func (i *Identity) GetControllerByID(id string, passwd []byte) (*Controller, error)
GetControllerByID -
func (*Identity) GetControllerByIndex ¶
func (i *Identity) GetControllerByIndex(index int, passwd []byte) (*Controller, error)
GetControllerByIndex -
func (*Identity) GetControllerByPubKey ¶
func (i *Identity) GetControllerByPubKey(pubKey string, passwd []byte) (*Controller, error)
GetControllerByPubKey -
func (*Identity) GetControllerDataByID ¶
func (i *Identity) GetControllerDataByID(id string) (*ControllerData, error)
GetControllerDataByID -
func (*Identity) GetControllerDataByIndex ¶
func (i *Identity) GetControllerDataByIndex(index int) (*ControllerData, error)
GetControllerDataByIndex -
func (*Identity) GetControllerDataByPubKey ¶
func (i *Identity) GetControllerDataByPubKey(pubKey string) (*ControllerData, error)
GetControllerDataByPubKey -
func (*Identity) NewController ¶
func (i *Identity) NewController(id string, keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte) (*Controller, error)
NewController -
func (*Identity) NewDefaultSettingController ¶
func (i *Identity) NewDefaultSettingController(id string, passwd []byte) (*Controller, error)
NewDefaultSettingController -
func (*Identity) ToIdentityData ¶
func (i *Identity) ToIdentityData() *IdentityData
ToIdentityData -
type IdentityData ¶
type IdentityData struct { ID string `json:"ontid"` Label string `json:"label,omitempty"` Lock bool `json:"lock"` IsDefault bool `json:"isDefault"` Control []*ControllerData `json:"controls,omitempty"` Extra interface{} `json:"extra,omitempty"` // contains filtered or unexported fields }
IdentityData -
type NativeContract ¶
type NativeContract struct { Ont *Ont Ong *Ong OntID *OntID GlobalParams *GlobalParam Auth *Auth // contains filtered or unexported fields }
NativeContract -
func (*NativeContract) InvokeNativeContract ¶
func (nc *NativeContract) InvokeNativeContract( gasPrice, gasLimit uint64, singer *Account, version byte, contractAddress common.Address, method string, params []interface{}, ) (common.Uint256, error)
InvokeNativeContract -
func (*NativeContract) NewNativeInvokeTransaction ¶
func (nc *NativeContract) NewNativeInvokeTransaction( gasPrice, gasLimit uint64, version byte, contractAddress common.Address, method string, params []interface{}, ) (*types.MutableTransaction, error)
NewNativeInvokeTransaction -
func (*NativeContract) PreExecInvokeNativeContract ¶
func (nc *NativeContract) PreExecInvokeNativeContract( contractAddress common.Address, version byte, method string, params []interface{}, ) (*sdkcom.PreExecResult, error)
PreExecInvokeNativeContract -
type NeoVMContract ¶
type NeoVMContract struct {
// contains filtered or unexported fields
}
NeoVMContract -
func (*NeoVMContract) DeployNeoVMSmartContract ¶
func (nc *NeoVMContract) DeployNeoVMSmartContract( gasPrice, gasLimit uint64, singer *Account, needStorage bool, code, name, version, author, email, desc string) (common.Uint256, error)
DeployNeoVMSmartContract - Deploy smart contract to ontology
func (*NeoVMContract) InvokeNeoVMContract ¶
func (nc *NeoVMContract) InvokeNeoVMContract( gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, params []interface{}) (common.Uint256, error)
InvokeNeoVMContract -
func (*NeoVMContract) NewDeployNeoVMCodeTransaction ¶
func (nc *NeoVMContract) NewDeployNeoVMCodeTransaction(gasPrice, gasLimit uint64, contract *sdkcom.SmartContract) *types.MutableTransaction
NewDeployNeoVMCodeTransaction -
func (*NeoVMContract) NewNeoVMInvokeTransaction ¶
func (nc *NeoVMContract) NewNeoVMInvokeTransaction( gasPrice, gasLimit uint64, contractAddress common.Address, params []interface{}, ) (*types.MutableTransaction, error)
NewNeoVMInvokeTransaction -
func (*NeoVMContract) PreExecInvokeNeoVMContract ¶
func (nc *NeoVMContract) PreExecInvokeNeoVMContract( contractAddress common.Address, params []interface{}) (*sdkcom.PreExecResult, error)
PreExecInvokeNeoVMContract -
type Ong ¶
type Ong struct {
// contains filtered or unexported fields
}
Ong -
func (*Ong) Approve ¶
func (o *Ong) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
Approve -
func (*Ong) MultiTransfer ¶
func (o *Ong) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
MultiTransfer -
func (*Ong) NewApproveTransaction ¶
func (o *Ong) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewApproveTransaction -
func (*Ong) NewMultiTransferTransaction ¶
func (o *Ong) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
NewMultiTransferTransaction -
func (*Ong) NewTransferFromTransaction ¶
func (o *Ong) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewTransferFromTransaction -
func (*Ong) NewTransferTransaction ¶
func (o *Ong) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewTransferTransaction -
func (*Ong) NewWithdrawONGTransaction ¶
func (o *Ong) NewWithdrawONGTransaction(gasPrice, gasLimit uint64, address common.Address, amount uint64) (*types.MutableTransaction, error)
NewWithdrawONGTransaction -
func (*Ong) Transfer ¶
func (o *Ong) Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
Transfer -
func (*Ong) TransferFrom ¶
func (o *Ong) TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, amount uint64) (common.Uint256, error)
TransferFrom -
func (*Ong) UnboundONG ¶
UnboundONG -
type Ont ¶
type Ont struct {
// contains filtered or unexported fields
}
Ont -
func (*Ont) Approve ¶
func (o *Ont) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
Approve -
func (*Ont) MultiTransfer ¶
func (o *Ont) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
MultiTransfer -
func (*Ont) NewApproveTransaction ¶
func (o *Ont) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewApproveTransaction -
func (*Ont) NewMultiTransferTransaction ¶
func (o *Ont) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
NewMultiTransferTransaction -
func (*Ont) NewTransferFromTransaction ¶
func (o *Ont) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewTransferFromTransaction -
func (*Ont) NewTransferTransaction ¶
func (o *Ont) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
NewTransferTransaction -
type OntID ¶
type OntID struct {
// contains filtered or unexported fields
}
OntID -
func (*OntID) AddAttributes ¶
func (nc *OntID) AddAttributes(gasPrice, gasLimit uint64, signer *Account, OntID string, attributes []*DDOAttribute, controller *Controller) (common.Uint256, error)
AddAttributes -
func (*OntID) AddKey ¶
func (nc *OntID) AddKey(gasPrice, gasLimit uint64, OntID string, signer *Account, newPubKey keypair.PublicKey, controller *Controller) (common.Uint256, error)
AddKey -
func (*OntID) ChangeRecovery ¶
func (nc *OntID) ChangeRecovery(gasPrice, gasLimit uint64, signer *Account, OntID string, newRecovery, oldRecovery common.Address, controller *Controller) (common.Uint256, error)
ChangeRecovery -
func (*OntID) GetAttributes ¶
func (nc *OntID) GetAttributes(OntID string) ([]*DDOAttribute, error)
GetAttributes -
func (*OntID) GetKeyState ¶
GetKeyState -
func (*OntID) GetPublicKeys ¶
GetPublicKeys -
func (*OntID) NewAddAttributesTransaction ¶
func (nc *OntID) NewAddAttributesTransaction(gasPrice, gasLimit uint64, OntID string, attributes []*DDOAttribute, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewAddAttributesTransaction -
func (*OntID) NewAddKeyTransaction ¶
func (nc *OntID) NewAddKeyTransaction(gasPrice, gasLimit uint64, OntID string, newPubKey, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewAddKeyTransaction -
func (*OntID) NewChangeRecoveryTransaction ¶
func (nc *OntID) NewChangeRecoveryTransaction(gasPrice, gasLimit uint64, OntID string, newRecovery, oldRecovery common.Address) (*types.MutableTransaction, error)
NewChangeRecoveryTransaction -
func (*OntID) NewRegIDWithAttributesTransaction ¶
func (nc *OntID) NewRegIDWithAttributesTransaction(gasPrice, gasLimit uint64, OntID string, pubKey keypair.PublicKey, attributes []*DDOAttribute) (*types.MutableTransaction, error)
NewRegIDWithAttributesTransaction -
func (*OntID) NewRegIDWithPublicKeyTransaction ¶
func (nc *OntID) NewRegIDWithPublicKeyTransaction(gasPrice, gasLimit uint64, OntID string, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewRegIDWithPublicKeyTransaction -
func (*OntID) NewRemoveAttributeTransaction ¶
func (nc *OntID) NewRemoveAttributeTransaction(gasPrice, gasLimit uint64, OntID string, key []byte, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewRemoveAttributeTransaction -
func (*OntID) NewRevokeKeyTransaction ¶
func (nc *OntID) NewRevokeKeyTransaction(gasPrice, gasLimit uint64, OntID string, removedPubKey, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewRevokeKeyTransaction -
func (*OntID) NewSetRecoveryTransaction ¶
func (nc *OntID) NewSetRecoveryTransaction(gasPrice, gasLimit uint64, OntID string, recovery common.Address, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
NewSetRecoveryTransaction -
func (*OntID) RegIDWithAttributes ¶
func (nc *OntID) RegIDWithAttributes(gasPrice, gasLimit uint64, signer *Account, OntID string, controller *Controller, attributes []*DDOAttribute) (common.Uint256, error)
RegIDWithAttributes -
func (*OntID) RegIDWithPublicKey ¶
func (nc *OntID) RegIDWithPublicKey(gasPrice, gasLimit uint64, signer *Account, OntID string, controller *Controller) (common.Uint256, error)
RegIDWithPublicKey -
func (*OntID) RemoveAttribute ¶
func (nc *OntID) RemoveAttribute(gasPrice, gasLimit uint64, signer *Account, OntID string, removeKey []byte, controller *Controller) (common.Uint256, error)
RemoveAttribute -
func (*OntID) RevokeKey ¶
func (nc *OntID) RevokeKey(gasPrice, gasLimit uint64, OntID string, signer *Account, removedPubKey keypair.PublicKey, controller *Controller) (common.Uint256, error)
RevokeKey -
func (*OntID) SetRecovery ¶
func (nc *OntID) SetRecovery(gasPrice, gasLimit uint64, signer *Account, OntID string, recovery common.Address, controller *Controller) (common.Uint256, error)
SetRecovery -
func (*OntID) VerifySignature ¶
VerifySignature -
type OntologySdk ¶
type OntologySdk struct { client.ClientMgr Native *NativeContract NeoVM *NeoVMContract }
OntologySdk is the main struct for user
func (*OntologySdk) CreateWallet ¶
func (sdk *OntologySdk) CreateWallet(walletFile string) (*Wallet, error)
CreateWallet return a new wallet
func (*OntologySdk) GetAdddrByPubKey ¶
func (sdk *OntologySdk) GetAdddrByPubKey(pubKey keypair.PublicKey) string
GetAdddrByPubKey -
func (*OntologySdk) GetMultiAddr ¶
GetMultiAddr -
func (*OntologySdk) MultiSignToTransaction ¶
func (sdk *OntologySdk) MultiSignToTransaction(tx *types.MutableTransaction, m uint16, pubKeys []keypair.PublicKey, signer Signer) error
MultiSignToTransaction -
func (*OntologySdk) NewInvokeTransaction ¶
func (sdk *OntologySdk) NewInvokeTransaction(gasPrice, gasLimit uint64, invokeCode []byte) *types.MutableTransaction
NewInvokeTransaction return smart contract invoke transaction
func (*OntologySdk) OpenWallet ¶
func (sdk *OntologySdk) OpenWallet(walletFile string) (*Wallet, error)
OpenWallet return a wallet instance
func (*OntologySdk) SignToTransaction ¶
func (sdk *OntologySdk) SignToTransaction(tx *types.MutableTransaction, signer Signer) error
SignToTransaction -
type Signer ¶
type Signer interface { Sign(data []byte) ([]byte, error) GetPublicKey() keypair.PublicKey GetPrivateKey() keypair.PrivateKey GetSigScheme() s.SignatureScheme }
Signer -
type Wallet ¶
type Wallet struct { Name string Version string Scrypt *keypair.ScryptParam Extra string // contains filtered or unexported fields }
Wallet -
func LoadWalletFromData ¶
func LoadWalletFromData(wd WalletData, path string) (*Wallet, error)
LoadWalletFromData - Load walletData to wallet
func OpenWallet ¶
OpenWallet - open wallet from file on path. Create it if not existed.
func (*Wallet) AddAccountData ¶
func (w *Wallet) AddAccountData(accountData *AccountData) error
AddAccountData -
func (*Wallet) ChangeAccountPassword ¶
ChangeAccountPassword -
func (*Wallet) ExportAccounts ¶
func (w *Wallet) ExportAccounts(path string, accountDatas []*AccountData, passwds [][]byte, newScrypts ...*keypair.ScryptParam) (*Wallet, error)
ExportAccounts -
func (*Wallet) GetAccountByAddress ¶
GetAccountByAddress -
func (*Wallet) GetAccountByIndex ¶
GetAccountByIndex - Index start from 1
func (*Wallet) GetAccountByLabel ¶
GetAccountByLabel -
func (*Wallet) GetAccountDataByAddress ¶
func (w *Wallet) GetAccountDataByAddress(address string) (*AccountData, error)
GetAccountDataByAddress -
func (*Wallet) GetAccountDataByIndex ¶
func (w *Wallet) GetAccountDataByIndex(index int) (*AccountData, error)
GetAccountDataByIndex - Index start from 1
func (*Wallet) GetAccountDataByLabel ¶
func (w *Wallet) GetAccountDataByLabel(label string) (*AccountData, error)
GetAccountDataByLabel -
func (*Wallet) GetDefaultAccount ¶
GetDefaultAccount -
func (*Wallet) GetDefaultAccountData ¶
func (w *Wallet) GetDefaultAccountData() (*AccountData, error)
GetDefaultAccountData -
func (*Wallet) GetDefaultIdentity ¶
GetDefaultIdentity -
func (*Wallet) GetIdentityByID ¶
GetIdentityByID -
func (*Wallet) GetIdentityByIndex ¶
GetIdentityByIndex - Index start from 1
func (*Wallet) GetIdentityByLabel ¶
GetIdentityByLabel -
func (*Wallet) GetWalletData ¶
func (w *Wallet) GetWalletData() WalletData
GetWalletData - get walletdata from wallets
func (*Wallet) ImportAccounts ¶
func (w *Wallet) ImportAccounts(accountDatas []*AccountData, passwds [][]byte) error
ImportAccounts -
func (*Wallet) NewAccount ¶
func (w *Wallet) NewAccount(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte) (*Account, error)
NewAccount -
func (*Wallet) NewAccountFromWIF ¶
NewAccountFromWIF -
func (*Wallet) NewDefaultSettingAccount ¶
NewDefaultSettingAccount -
func (*Wallet) NewDefaultSettingIdentity ¶
NewDefaultSettingIdentity -
func (*Wallet) NewIdentity ¶
func (w *Wallet) NewIdentity(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte) (*Identity, error)
NewIdentity -
func (*Wallet) SetDefaultAccount ¶
SetDefaultAccount -
func (*Wallet) SetDefaultIdentity ¶
SetDefaultIdentity -
func (*Wallet) SetIdentityLabel ¶
SetIdentityLabel -
func (*Wallet) SetSigScheme ¶
func (w *Wallet) SetSigScheme(address string, sigScheme s.SignatureScheme) error
SetSigScheme -
type WalletData ¶
type WalletData struct { Name string `json:"name"` Version string `json:"version"` Scrypt *keypair.ScryptParam `json:"scrypt"` Identities []*IdentityData `json:"identities,omitempty"` Accounts []*AccountData `json:"accounts,omitempty"` Extra string `json:"extra,omitempty"` }
WalletData -