Documentation ¶
Overview ¶
Ontolog sdk in golang. Using for operation with dna
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
- func (this *AccountData) Clone() *AccountData
- func (this *AccountData) GetAccount(passwd []byte) (*Account, error)
- func (this *AccountData) GetKeyPair() *keypair.ProtectedKey
- func (this *AccountData) GetScrypt() *keypair.ScryptParam
- func (this *AccountData) SetKeyPair(keyinfo *keypair.ProtectedKey)
- func (this *AccountData) SetScript(scrypt *keypair.ScryptParam)
- type Auth
- func (this *Auth) AssignFuncsToRole(gasPrice, gasLimit uint64, contractAddress common.Address, signer *Account, ...) (common.Uint256, error)
- func (this *Auth) AssignOntIDsToRole(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (this *Auth) Delegate(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (this *Auth) NewAssignFuncsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *Auth) NewAssignOntIDsToRoleTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *Auth) NewDelegateTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *Auth) NewTransferTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, newAdminId []byte, ...) (*types.MutableTransaction, error)
- func (this *Auth) NewVerifyTokenTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, caller []byte, ...) (*types.MutableTransaction, error)
- func (this *Auth) NewWithdrawTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *Auth) Transfer(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (this *Auth) VerifyToken(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (this *Auth) Withdraw(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- type Controller
- type ControllerData
- func (this *ControllerData) Clone() *ControllerData
- func (this *ControllerData) GetController(passwd []byte) (*Controller, error)
- func (this *ControllerData) GetKeyPair() *keypair.ProtectedKey
- func (this *ControllerData) GetScrypt() *keypair.ScryptParam
- func (this *ControllerData) SetKeyPair(keyinfo *keypair.ProtectedKey)
- type DDO
- type DDOAttribute
- type DDOOwner
- type DNASdk
- func (this *DNASdk) CreateWallet(walletFile string) (*Wallet, error)
- func (this *DNASdk) GetAdddrByPubKey(pubKey keypair.PublicKey) string
- func (this *DNASdk) GetMultiAddr(pubkeys []keypair.PublicKey, m int) (string, error)
- func (this *DNASdk) GetMutableTx(rawTx string) (*types.MutableTransaction, error)
- func (this *DNASdk) GetTxData(tx *types.MutableTransaction) (string, error)
- func (this *DNASdk) MultiSignToTransaction(tx *types.MutableTransaction, m uint16, pubKeys []keypair.PublicKey, ...) error
- func (this *DNASdk) NewInvokeTransaction(gasPrice, gasLimit uint64, invokeCode []byte) *types.MutableTransaction
- func (this *DNASdk) OpenWallet(walletFile string) (*Wallet, error)
- func (this *DNASdk) SignToTransaction(tx *types.MutableTransaction, signer Signer) error
- type GlobalParam
- func (this *GlobalParam) AcceptAdmin(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
- func (this *GlobalParam) CreateSnapshot(gasPrice, gasLimit uint64, signer *Account) (common.Uint256, error)
- func (this *GlobalParam) GetGlobalParams(params []string) (map[string]string, error)
- func (this *GlobalParam) NewAcceptAdminTransaction(gasPrice, gasLimit uint64, admin common.Address) (*types.MutableTransaction, error)
- func (this *GlobalParam) NewCreateSnapshotTransaction(gasPrice, gasLimit uint64) (*types.MutableTransaction, error)
- func (this *GlobalParam) NewSetGlobalParamsTransaction(gasPrice, gasLimit uint64, params map[string]string) (*types.MutableTransaction, error)
- func (this *GlobalParam) NewSetOperatorTransaction(gasPrice, gasLimit uint64, operator common.Address) (*types.MutableTransaction, error)
- func (this *GlobalParam) NewTransferAdminTransaction(gasPrice, gasLimit uint64, newAdmin common.Address) (*types.MutableTransaction, error)
- func (this *GlobalParam) SetGlobalParams(gasPrice, gasLimit uint64, signer *Account, params map[string]string) (common.Uint256, error)
- func (this *GlobalParam) SetOperator(gasPrice, gasLimit uint64, signer *Account, operator common.Address) (common.Uint256, error)
- func (this *GlobalParam) TransferAdmin(gasPrice, gasLimit uint64, signer *Account, newAdmin common.Address) (common.Uint256, error)
- type Identity
- func (this *Identity) AddControllerData(controllerData *ControllerData) error
- func (this *Identity) ControllerCount() int
- func (this *Identity) DeleteControllerData(id string) error
- func (this *Identity) GetControllerById(id string, passwd []byte) (*Controller, error)
- func (this *Identity) GetControllerByIndex(index int, passwd []byte) (*Controller, error)
- func (this *Identity) GetControllerByPubKey(pubKey string, passwd []byte) (*Controller, error)
- func (this *Identity) GetControllerDataById(id string) (*ControllerData, error)
- func (this *Identity) GetControllerDataByIndex(index int) (*ControllerData, error)
- func (this *Identity) GetControllerDataByPubKey(pubKey string) (*ControllerData, error)
- func (this *Identity) NewController(id string, keyType keypair.KeyType, curveCode byte, ...) (*Controller, error)
- func (this *Identity) NewDefaultSettingController(id string, passwd []byte) (*Controller, error)
- func (this *Identity) ToIdentityData() *IdentityData
- type IdentityData
- type NativeContract
- func (this *NativeContract) InvokeNativeContract(gasPrice, gasLimit uint64, singer *Account, version byte, ...) (common.Uint256, error)
- func (this *NativeContract) NewNativeInvokeTransaction(gasPrice, gasLimit uint64, version byte, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *NativeContract) PreExecInvokeNativeContract(contractAddress common.Address, version byte, method string, ...) (*sdkcom.PreExecResult, error)
- type NeoVMContract
- func (this *NeoVMContract) DeployNeoVMSmartContract(gasPrice, gasLimit uint64, singer *Account, needStorage bool, ...) (common.Uint256, error)
- func (this *NeoVMContract) InvokeNeoVMContract(gasPrice, gasLimit uint64, signer *Account, contractAddress common.Address, ...) (common.Uint256, error)
- func (this *NeoVMContract) NewDeployNeoVMCodeTransaction(gasPrice, gasLimit uint64, contract *sdkcom.SmartContract) *types.MutableTransaction
- func (this *NeoVMContract) NewNeoVMInvokeTransaction(gasPrice, gasLimit uint64, contractAddress common.Address, ...) (*types.MutableTransaction, error)
- func (this *NeoVMContract) PreExecInvokeNeoVMContract(contractAddress common.Address, params []interface{}) (*sdkcom.PreExecResult, error)
- type Ong
- func (this *Ong) Allowance(from, to common.Address) (uint64, error)
- func (this *Ong) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (this *Ong) BalanceOf(address common.Address) (uint64, error)
- func (this *Ong) Decimals() (byte, error)
- func (this *Ong) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
- func (this *Ong) Name() (string, error)
- func (this *Ong) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ong) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
- func (this *Ong) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ong) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ong) NewWithdrawONGTransaction(gasPrice, gasLimit uint64, address common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ong) Symbol() (string, error)
- func (this *Ong) TotalSupply() (uint64, error)
- func (this *Ong) Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (this *Ong) TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, ...) (common.Uint256, error)
- func (this *Ong) UnboundONG(address common.Address) (uint64, error)
- func (this *Ong) WithdrawONG(gasPrice, gasLimit uint64, address *Account, amount uint64) (common.Uint256, error)
- type Ont
- func (this *Ont) Allowance(from, to common.Address) (uint64, error)
- func (this *Ont) Approve(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (this *Ont) BalanceOf(address common.Address) (uint64, error)
- func (this *Ont) Decimals() (byte, error)
- func (this *Ont) MultiTransfer(gasPrice, gasLimit uint64, states []*ont.State, signer *Account) (common.Uint256, error)
- func (this *Ont) Name() (string, error)
- func (this *Ont) NewApproveTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ont) NewMultiTransferTransaction(gasPrice, gasLimit uint64, states []*ont.State) (*types.MutableTransaction, error)
- func (this *Ont) NewTransferFromTransaction(gasPrice, gasLimit uint64, sender, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ont) NewTransferTransaction(gasPrice, gasLimit uint64, from, to common.Address, amount uint64) (*types.MutableTransaction, error)
- func (this *Ont) Symbol() (string, error)
- func (this *Ont) TotalSupply() (uint64, error)
- func (this *Ont) Transfer(gasPrice, gasLimit uint64, from *Account, to common.Address, amount uint64) (common.Uint256, error)
- func (this *Ont) TransferFrom(gasPrice, gasLimit uint64, sender *Account, from, to common.Address, ...) (common.Uint256, error)
- type OntId
- func (this *OntId) AddAttributes(gasPrice, gasLimit uint64, signer *Account, ontId string, ...) (common.Uint256, error)
- func (this *OntId) AddKey(gasPrice, gasLimit uint64, ontId string, signer *Account, ...) (common.Uint256, error)
- func (this *OntId) ChangeRecovery(gasPrice, gasLimit uint64, signer *Account, ontId string, ...) (common.Uint256, error)
- func (this *OntId) GetAttributes(ontId string) ([]*DDOAttribute, error)
- func (this *OntId) GetDDO(ontId string) (*DDO, error)
- func (this *OntId) GetKeyState(ontId string, keyIndex int) (string, error)
- func (this *OntId) GetPublicKeys(ontId string) ([]*DDOOwner, error)
- func (this *OntId) NewAddAttributesTransaction(gasPrice, gasLimit uint64, ontId string, attributes []*DDOAttribute, ...) (*types.MutableTransaction, error)
- func (this *OntId) NewAddKeyTransaction(gasPrice, gasLimit uint64, ontId string, newPubKey, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (this *OntId) NewChangeRecoveryTransaction(gasPrice, gasLimit uint64, ontId string, ...) (*types.MutableTransaction, error)
- func (this *OntId) NewRegIDWithAttributesTransaction(gasPrice, gasLimit uint64, ontId string, pubKey keypair.PublicKey, ...) (*types.MutableTransaction, error)
- func (this *OntId) NewRegIDWithPublicKeyTransaction(gasPrice, gasLimit uint64, ontId string, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (this *OntId) NewRemoveAttributeTransaction(gasPrice, gasLimit uint64, ontId string, key []byte, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
- func (this *OntId) NewRevokeKeyTransaction(gasPrice, gasLimit uint64, ontId string, ...) (*types.MutableTransaction, error)
- func (this *OntId) NewSetRecoveryTransaction(gasPrice, gasLimit uint64, ontId string, recovery common.Address, ...) (*types.MutableTransaction, error)
- func (this *OntId) RegIDWithAttributes(gasPrice, gasLimit uint64, signer *Account, ontId string, ...) (common.Uint256, error)
- func (this *OntId) RegIDWithPublicKey(gasPrice, gasLimit uint64, signer *Account, ontId string, ...) (common.Uint256, error)
- func (this *OntId) RemoveAttribute(gasPrice, gasLimit uint64, signer *Account, ontId string, removeKey []byte, ...) (common.Uint256, error)
- func (this *OntId) RevokeKey(gasPrice, gasLimit uint64, ontId string, signer *Account, ...) (common.Uint256, error)
- func (this *OntId) SetRecovery(gasPrice, gasLimit uint64, signer *Account, ontId string, ...) (common.Uint256, error)
- func (this *OntId) VerifySignature(ontId string, keyIndex int, controller *Controller) (bool, error)
- type Signer
- type Wallet
- func (this *Wallet) AddAccountData(accountData *AccountData) error
- func (this *Wallet) AddIdentity(identity *Identity) error
- func (this *Wallet) ChangeAccountPassword(address string, oldPassword, newPassword []byte) error
- func (this *Wallet) DeleteAccount(address string) error
- func (this *Wallet) DeleteIdentity(id string) error
- func (this *Wallet) ExportAccounts(path string, accountDatas []*AccountData, passwds [][]byte, ...) (*Wallet, error)
- func (this *Wallet) GetAccountByAddress(address string, passwd []byte) (*Account, error)
- func (this *Wallet) GetAccountByIndex(index int, passwd []byte) (*Account, error)
- func (this *Wallet) GetAccountByLabel(label string, passwd []byte) (*Account, error)
- func (this *Wallet) GetAccountCount() int
- func (this *Wallet) GetAccountDataByAddress(address string) (*AccountData, error)
- func (this *Wallet) GetAccountDataByIndex(index int) (*AccountData, error)
- func (this *Wallet) GetAccountDataByLabel(label string) (*AccountData, error)
- func (this *Wallet) GetDefaultAccount(passwd []byte) (*Account, error)
- func (this *Wallet) GetDefaultAccountData() (*AccountData, error)
- func (this *Wallet) GetDefaultIdentity() (*Identity, error)
- func (this *Wallet) GetIdentityById(id string) (*Identity, error)
- func (this *Wallet) GetIdentityByIndex(index int) (*Identity, error)
- func (this *Wallet) GetIdentityByLabel(label string) (*Identity, error)
- func (this *Wallet) GetIdentityCount() int
- func (this *Wallet) ImportAccounts(accountDatas []*AccountData, passwds [][]byte) error
- func (this *Wallet) NewAccount(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, ...) (*Account, error)
- func (this *Wallet) NewAccountFromWIF(wif, passwd []byte) (*Account, error)
- func (this *Wallet) NewDefaultSettingAccount(passwd []byte) (*Account, error)
- func (this *Wallet) NewDefaultSettingIdentity(passwd []byte) (*Identity, error)
- func (this *Wallet) NewIdentity(keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, ...) (*Identity, error)
- func (this *Wallet) Save() error
- func (this *Wallet) SetDefaultAccount(address string) error
- func (this *Wallet) SetDefaultIdentity(id string) error
- func (this *Wallet) SetIdentityLabel(id, newLabel string) error
- func (this *Wallet) SetLabel(address, newLabel string) error
- func (this *Wallet) SetSigScheme(address string, sigScheme s.SignatureScheme) error
- type WalletData
Constants ¶
View Source
const ( SCHEME = "did" METHOD = "ont" VER = 0x41 )
View Source
const ( KEY_STATUS_REVOKE = "revoked" KEY_STSTUS_IN_USE = "in use" )
Variables ¶
View Source
var (
ONT_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0100000000000000000000000000000000000000")
ONG_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0200000000000000000000000000000000000000")
ONT_ID_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0300000000000000000000000000000000000000")
GLOABL_PARAMS_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0400000000000000000000000000000000000000")
AUTH_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0600000000000000000000000000000000000000")
GOVERNANCE_CONTRACT_ADDRESS, _ = utils.AddressFromHexString("0700000000000000000000000000000000000000")
)
View Source
var ( ONT_CONTRACT_VERSION = byte(0) ONG_CONTRACT_VERSION = byte(0) ONT_ID_CONTRACT_VERSION = byte(0) GLOBAL_PARAMS_CONTRACT_VERSION = byte(0) AUTH_CONTRACT_VERSION = byte(0) GOVERNANCE_CONTRACT_VERSION = byte(0) )
View Source
var DEFAULT_WALLET_NAME = "MyWallet"
View Source
var DEFAULT_WALLET_VERSION = "1.1"
View Source
var ERR_ACCOUNT_NOT_FOUND = errors.New("account not found")
View Source
var ERR_CONTROLLER_NOT_FOUND = errors.New("controller not found")
View Source
var ERR_IDENTITY_NOT_FOUND = errors.New("identity not found")
Functions ¶
func CheckSigScheme ¶
func CheckSigScheme(keyType keypair.KeyType, sigScheme s.SignatureScheme) bool
func GenerateID ¶
func GetCurveName ¶
func GetKeyTypeString ¶
func ScryptEqual ¶
func ScryptEqual(s1, s2 *keypair.ScryptParam) bool
Types ¶
type Account ¶
type Account struct { PrivateKey keypair.PrivateKey PublicKey keypair.PublicKey Address common.Address SigScheme s.SignatureScheme }
crypto object
func NewAccount ¶
func NewAccount(sigscheme ...s.SignatureScheme) *Account
func (*Account) GetPrivateKey ¶
func (this *Account) GetPrivateKey() keypair.PrivateKey
func (*Account) GetPublicKey ¶
func (*Account) GetSigScheme ¶
func (this *Account) GetSigScheme() s.SignatureScheme
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)
func (*AccountData) Clone ¶
func (this *AccountData) Clone() *AccountData
func (*AccountData) GetAccount ¶
func (this *AccountData) GetAccount(passwd []byte) (*Account, error)
func (*AccountData) GetKeyPair ¶
func (this *AccountData) GetKeyPair() *keypair.ProtectedKey
func (*AccountData) GetScrypt ¶
func (this *AccountData) GetScrypt() *keypair.ScryptParam
func (*AccountData) SetKeyPair ¶
func (this *AccountData) SetKeyPair(keyinfo *keypair.ProtectedKey)
func (*AccountData) SetScript ¶
func (this *AccountData) SetScript(scrypt *keypair.ScryptParam)
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) AssignFuncsToRole ¶
func (*Auth) AssignOntIDsToRole ¶
func (*Auth) NewAssignFuncsToRoleTransaction ¶
func (*Auth) NewAssignOntIDsToRoleTransaction ¶
func (*Auth) NewDelegateTransaction ¶
func (*Auth) NewTransferTransaction ¶
func (*Auth) NewVerifyTokenTransaction ¶
func (*Auth) NewWithdrawTransaction ¶
func (*Auth) VerifyToken ¶
type Controller ¶
type Controller struct { ID string PrivateKey keypair.PrivateKey PublicKey keypair.PublicKey SigScheme s.SignatureScheme }
func (*Controller) GetPrivateKey ¶
func (this *Controller) GetPrivateKey() keypair.PrivateKey
func (*Controller) GetPublicKey ¶
func (this *Controller) GetPublicKey() keypair.PublicKey
func (*Controller) GetSigScheme ¶
func (this *Controller) GetSigScheme() s.SignatureScheme
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 }
func NewControllerData ¶
func NewControllerData(id string, keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte, scrypts ...*keypair.ScryptParam) (*ControllerData, error)
func NewControllerDataFromProtectedKey ¶
func NewControllerDataFromProtectedKey(id, pubKey string, protectedKey *keypair.ProtectedKey, SigSch string, scrypts ...*keypair.ScryptParam) *ControllerData
func (*ControllerData) Clone ¶
func (this *ControllerData) Clone() *ControllerData
func (*ControllerData) GetController ¶
func (this *ControllerData) GetController(passwd []byte) (*Controller, error)
func (*ControllerData) GetKeyPair ¶
func (this *ControllerData) GetKeyPair() *keypair.ProtectedKey
func (*ControllerData) GetScrypt ¶
func (this *ControllerData) GetScrypt() *keypair.ScryptParam
func (*ControllerData) SetKeyPair ¶
func (this *ControllerData) SetKeyPair(keyinfo *keypair.ProtectedKey)
type DDO ¶
type DDO struct { OntId string Owners []*DDOOwner Attributes []*DDOAttribute Recovery string }
type DDOAttribute ¶
type DDOOwner ¶
type DNASdk ¶
type DNASdk struct { client.ClientMgr Native *NativeContract NeoVM *NeoVMContract }
DNASdk is the main struct for user
func (*DNASdk) CreateWallet ¶
CreateWallet return a new wallet
func (*DNASdk) GetAdddrByPubKey ¶
func (*DNASdk) GetMultiAddr ¶
func (*DNASdk) GetMutableTx ¶
func (this *DNASdk) GetMutableTx(rawTx string) (*types.MutableTransaction, error)
func (*DNASdk) GetTxData ¶
func (this *DNASdk) GetTxData(tx *types.MutableTransaction) (string, error)
func (*DNASdk) MultiSignToTransaction ¶
func (*DNASdk) NewInvokeTransaction ¶
func (this *DNASdk) NewInvokeTransaction(gasPrice, gasLimit uint64, invokeCode []byte) *types.MutableTransaction
NewInvokeTransaction return smart contract invoke transaction
func (*DNASdk) OpenWallet ¶
OpenWallet return a wallet instance
func (*DNASdk) SignToTransaction ¶
func (this *DNASdk) SignToTransaction(tx *types.MutableTransaction, signer Signer) error
type GlobalParam ¶
type GlobalParam struct {
// contains filtered or unexported fields
}
func (*GlobalParam) AcceptAdmin ¶
func (*GlobalParam) CreateSnapshot ¶
func (*GlobalParam) GetGlobalParams ¶
func (this *GlobalParam) GetGlobalParams(params []string) (map[string]string, error)
func (*GlobalParam) NewAcceptAdminTransaction ¶
func (this *GlobalParam) NewAcceptAdminTransaction(gasPrice, gasLimit uint64, admin common.Address) (*types.MutableTransaction, error)
func (*GlobalParam) NewCreateSnapshotTransaction ¶
func (this *GlobalParam) NewCreateSnapshotTransaction(gasPrice, gasLimit uint64) (*types.MutableTransaction, error)
func (*GlobalParam) NewSetGlobalParamsTransaction ¶
func (this *GlobalParam) NewSetGlobalParamsTransaction(gasPrice, gasLimit uint64, params map[string]string) (*types.MutableTransaction, error)
func (*GlobalParam) NewSetOperatorTransaction ¶
func (this *GlobalParam) NewSetOperatorTransaction(gasPrice, gasLimit uint64, operator common.Address) (*types.MutableTransaction, error)
func (*GlobalParam) NewTransferAdminTransaction ¶
func (this *GlobalParam) NewTransferAdminTransaction(gasPrice, gasLimit uint64, newAdmin common.Address) (*types.MutableTransaction, error)
func (*GlobalParam) SetGlobalParams ¶
func (*GlobalParam) SetOperator ¶
func (*GlobalParam) TransferAdmin ¶
type Identity ¶
type Identity struct { ID string Label string Lock bool IsDefault bool Extra interface{} // contains filtered or unexported fields }
func NewIdentity ¶
func NewIdentity(scrypt *keypair.ScryptParam) (*Identity, error)
func NewIdentityFromIdentityData ¶
func NewIdentityFromIdentityData(identityData *IdentityData) (*Identity, error)
func (*Identity) AddControllerData ¶
func (this *Identity) AddControllerData(controllerData *ControllerData) error
func (*Identity) ControllerCount ¶
func (*Identity) DeleteControllerData ¶
func (*Identity) GetControllerById ¶
func (this *Identity) GetControllerById(id string, passwd []byte) (*Controller, error)
func (*Identity) GetControllerByIndex ¶
func (this *Identity) GetControllerByIndex(index int, passwd []byte) (*Controller, error)
func (*Identity) GetControllerByPubKey ¶
func (this *Identity) GetControllerByPubKey(pubKey string, passwd []byte) (*Controller, error)
func (*Identity) GetControllerDataById ¶
func (this *Identity) GetControllerDataById(id string) (*ControllerData, error)
func (*Identity) GetControllerDataByIndex ¶
func (this *Identity) GetControllerDataByIndex(index int) (*ControllerData, error)
func (*Identity) GetControllerDataByPubKey ¶
func (this *Identity) GetControllerDataByPubKey(pubKey string) (*ControllerData, error)
func (*Identity) NewController ¶
func (this *Identity) NewController(id string, keyType keypair.KeyType, curveCode byte, sigScheme s.SignatureScheme, passwd []byte) (*Controller, error)
func (*Identity) NewDefaultSettingController ¶
func (this *Identity) NewDefaultSettingController(id string, passwd []byte) (*Controller, error)
func (*Identity) ToIdentityData ¶
func (this *Identity) ToIdentityData() *IdentityData
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 }
type NativeContract ¶
type NativeContract struct { Ont *Ont Ong *Ong OntId *OntId GlobalParams *GlobalParam Auth *Auth // contains filtered or unexported fields }
func (*NativeContract) InvokeNativeContract ¶
func (*NativeContract) NewNativeInvokeTransaction ¶
func (this *NativeContract) NewNativeInvokeTransaction( gasPrice, gasLimit uint64, version byte, contractAddress common.Address, method string, params []interface{}, ) (*types.MutableTransaction, error)
func (*NativeContract) PreExecInvokeNativeContract ¶
func (this *NativeContract) PreExecInvokeNativeContract( contractAddress common.Address, version byte, method string, params []interface{}, ) (*sdkcom.PreExecResult, error)
type NeoVMContract ¶
type NeoVMContract struct {
// contains filtered or unexported fields
}
func (*NeoVMContract) DeployNeoVMSmartContract ¶
func (this *NeoVMContract) DeployNeoVMSmartContract( gasPrice, gasLimit uint64, singer *Account, needStorage bool, code, name, version, author, email, desc string) (common.Uint256, error)
DeploySmartContract Deploy smart contract to dna
func (*NeoVMContract) InvokeNeoVMContract ¶
func (*NeoVMContract) NewDeployNeoVMCodeTransaction ¶
func (this *NeoVMContract) NewDeployNeoVMCodeTransaction(gasPrice, gasLimit uint64, contract *sdkcom.SmartContract) *types.MutableTransaction
func (*NeoVMContract) NewNeoVMInvokeTransaction ¶
func (this *NeoVMContract) NewNeoVMInvokeTransaction( gasPrice, gasLimit uint64, contractAddress common.Address, params []interface{}, ) (*types.MutableTransaction, error)
func (*NeoVMContract) PreExecInvokeNeoVMContract ¶
func (this *NeoVMContract) PreExecInvokeNeoVMContract( contractAddress common.Address, params []interface{}) (*sdkcom.PreExecResult, error)
type Ong ¶
type Ong struct {
// contains filtered or unexported fields
}
func (*Ong) MultiTransfer ¶
func (*Ong) NewApproveTransaction ¶
func (*Ong) NewMultiTransferTransaction ¶
func (*Ong) NewTransferFromTransaction ¶
func (*Ong) NewTransferTransaction ¶
func (*Ong) NewWithdrawONGTransaction ¶
func (*Ong) TotalSupply ¶
func (*Ong) TransferFrom ¶
type Ont ¶
type Ont struct {
// contains filtered or unexported fields
}
func (*Ont) MultiTransfer ¶
func (*Ont) NewApproveTransaction ¶
func (*Ont) NewMultiTransferTransaction ¶
func (*Ont) NewTransferFromTransaction ¶
func (*Ont) NewTransferTransaction ¶
func (*Ont) TotalSupply ¶
type OntId ¶
type OntId struct {
// contains filtered or unexported fields
}
func (*OntId) AddAttributes ¶
func (this *OntId) AddAttributes(gasPrice, gasLimit uint64, signer *Account, ontId string, attributes []*DDOAttribute, controller *Controller) (common.Uint256, error)
func (*OntId) ChangeRecovery ¶
func (*OntId) GetAttributes ¶
func (this *OntId) GetAttributes(ontId string) ([]*DDOAttribute, error)
func (*OntId) GetKeyState ¶
func (*OntId) NewAddAttributesTransaction ¶
func (this *OntId) NewAddAttributesTransaction(gasPrice, gasLimit uint64, ontId string, attributes []*DDOAttribute, pubKey keypair.PublicKey) (*types.MutableTransaction, error)
func (*OntId) NewAddKeyTransaction ¶
func (*OntId) NewChangeRecoveryTransaction ¶
func (*OntId) NewRegIDWithAttributesTransaction ¶
func (this *OntId) NewRegIDWithAttributesTransaction(gasPrice, gasLimit uint64, ontId string, pubKey keypair.PublicKey, attributes []*DDOAttribute) (*types.MutableTransaction, error)
func (*OntId) NewRegIDWithPublicKeyTransaction ¶
func (*OntId) NewRemoveAttributeTransaction ¶
func (*OntId) NewRevokeKeyTransaction ¶
func (*OntId) NewSetRecoveryTransaction ¶
func (*OntId) RegIDWithAttributes ¶
func (this *OntId) RegIDWithAttributes(gasPrice, gasLimit uint64, signer *Account, ontId string, controller *Controller, attributes []*DDOAttribute) (common.Uint256, error)
func (*OntId) RegIDWithPublicKey ¶
func (*OntId) RemoveAttribute ¶
func (*OntId) SetRecovery ¶
func (*OntId) VerifySignature ¶
type Signer ¶
type Signer interface { Sign(data []byte) ([]byte, error) GetPublicKey() keypair.PublicKey GetPrivateKey() keypair.PrivateKey GetSigScheme() s.SignatureScheme }
type Wallet ¶
type Wallet struct { Name string Version string Scrypt *keypair.ScryptParam Extra string // contains filtered or unexported fields }
func OpenWallet ¶
func (*Wallet) AddAccountData ¶
func (this *Wallet) AddAccountData(accountData *AccountData) error
func (*Wallet) AddIdentity ¶
func (*Wallet) ChangeAccountPassword ¶
func (*Wallet) DeleteAccount ¶
func (*Wallet) DeleteIdentity ¶
func (*Wallet) ExportAccounts ¶
func (this *Wallet) ExportAccounts(path string, accountDatas []*AccountData, passwds [][]byte, newScrypts ...*keypair.ScryptParam) (*Wallet, error)
func (*Wallet) GetAccountByAddress ¶
func (*Wallet) GetAccountByIndex ¶
Index start from 1
func (*Wallet) GetAccountByLabel ¶
func (*Wallet) GetAccountCount ¶
func (*Wallet) GetAccountDataByAddress ¶
func (this *Wallet) GetAccountDataByAddress(address string) (*AccountData, error)
func (*Wallet) GetAccountDataByIndex ¶
func (this *Wallet) GetAccountDataByIndex(index int) (*AccountData, error)
Index start from 1
func (*Wallet) GetAccountDataByLabel ¶
func (this *Wallet) GetAccountDataByLabel(label string) (*AccountData, error)
func (*Wallet) GetDefaultAccount ¶
func (*Wallet) GetDefaultAccountData ¶
func (this *Wallet) GetDefaultAccountData() (*AccountData, error)
func (*Wallet) GetDefaultIdentity ¶
func (*Wallet) GetIdentityByIndex ¶
Index start from 1
func (*Wallet) GetIdentityByLabel ¶
func (*Wallet) GetIdentityCount ¶
func (*Wallet) ImportAccounts ¶
func (this *Wallet) ImportAccounts(accountDatas []*AccountData, passwds [][]byte) error
func (*Wallet) NewAccount ¶
func (*Wallet) NewAccountFromWIF ¶
func (*Wallet) NewDefaultSettingAccount ¶
func (*Wallet) NewDefaultSettingIdentity ¶
func (*Wallet) NewIdentity ¶
func (*Wallet) SetDefaultAccount ¶
func (*Wallet) SetDefaultIdentity ¶
func (*Wallet) SetIdentityLabel ¶
func (*Wallet) SetSigScheme ¶
func (this *Wallet) SetSigScheme(address string, sigScheme s.SignatureScheme) error
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"` }
func NewWalletData ¶
func NewWalletData() *WalletData
func (*WalletData) Clone ¶
func (this *WalletData) Clone() *WalletData
func (*WalletData) Load ¶
func (this *WalletData) Load(path string) error
func (*WalletData) Save ¶
func (this *WalletData) Save(path string) error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
* Copyright (C) 2018 The dna Authors * This file is part of The dna library.
|
* Copyright (C) 2018 The dna Authors * This file is part of The dna library. |
* Copyright (C) 2018 The dna Authors * This file is part of The dna library.
|
* Copyright (C) 2018 The dna Authors * This file is part of The dna library. |
* Copyright (C) 2018 The dna Authors * This file is part of The dna library.
|
* Copyright (C) 2018 The dna Authors * This file is part of The dna library. |
Click to show internal directories.
Click to hide internal directories.