Documentation ¶
Index ¶
- Constants
- Variables
- func GetCorssChainSigners(code []byte) ([]*common.Uint160, error)
- func GetSigners(code []byte) ([]*common.Uint160, error)
- func SignBySigner(txn *types.Transaction, acc *Account) ([]byte, error)
- type Account
- type AccountData
- type Client
- type ClientImpl
- func (cl *ClientImpl) CreateAccount() (*Account, error)
- func (cl *ClientImpl) DecryptPrivateKey(prikey []byte) ([]byte, error)
- func (cl *ClientImpl) EncryptPrivateKey(prikey []byte) ([]byte, error)
- func (cl *ClientImpl) GetAccount(pubKey *crypto.PublicKey) (*Account, error)
- func (cl *ClientImpl) GetAccountByCodeHash(codeHash common.Uint160) *Account
- func (cl *ClientImpl) GetAccounts() []*Account
- func (cl *ClientImpl) GetDefaultAccount() (*Account, error)
- func (cl *ClientImpl) LoadAccounts() error
- func (cl *ClientImpl) ProcessSignals()
- func (cl *ClientImpl) SaveAccount(ac *Account) error
- func (cl *ClientImpl) Sign(txn *types.Transaction) (*types.Transaction, error)
- type FileData
- type FileStore
- func (cs *FileStore) BuildDatabase(path string)
- func (cs *FileStore) DeleteAccountData(programHash string) error
- func (cs *FileStore) LoadAccountData() ([]AccountData, error)
- func (cs *FileStore) LoadStoredData(name string) ([]byte, error)
- func (cs *FileStore) SaveAccountData(programHash []byte, encryptedPrivateKey []byte) error
- func (cs *FileStore) SaveStoredData(name string, value []byte) error
- func (cs *FileStore) SetPath(path string)
Constants ¶
View Source
const ( MAINACCOUNT = "main-account" SUBACCOUNT = "sub-account" KeystoreFileName = "keystore.dat" KeystoreVersion = "1.0.0" MaxSignalQueueLen = 5 )
Variables ¶
View Source
var IDReverse, _ = hex.DecodeString("a3d0eaa466df74983b5d7c543de6904f4c9418ead5ffd6d25814234a96db37b0")
View Source
var SystemAssetID, _ = common.Uint256FromBytes(common.BytesReverse(IDReverse))
Functions ¶
func SignBySigner ¶
func SignBySigner(txn *types.Transaction, acc *Account) ([]byte, error)
Types ¶
type Account ¶
type Account struct { PrivateKey []byte PublicKey *crypto.PublicKey ProgramHash common.Uint168 Contract contract.Contract Address string }
func NewAccount ¶
type AccountData ¶
type Client ¶
type Client interface { Sign(txn *types.Transaction) error ContainsAccount(pubKey *crypto.PublicKey) bool CreateAccount() (*Account, error) DeleteAccount(programHash common.Uint168) error GetAccount(pubKey *crypto.PublicKey) (*Account, error) GetDefaultAccount() (*Account, error) GetAccountByProgramHash(programHash common.Uint168) *Account GetAccounts() []*Account }
type ClientImpl ¶
type ClientImpl struct { FileStore // contains filtered or unexported fields }
func (*ClientImpl) CreateAccount ¶
func (cl *ClientImpl) CreateAccount() (*Account, error)
CreateAccount create a new Account then save it
func (*ClientImpl) DecryptPrivateKey ¶
func (cl *ClientImpl) DecryptPrivateKey(prikey []byte) ([]byte, error)
func (*ClientImpl) EncryptPrivateKey ¶
func (cl *ClientImpl) EncryptPrivateKey(prikey []byte) ([]byte, error)
func (*ClientImpl) GetAccount ¶
func (cl *ClientImpl) GetAccount(pubKey *crypto.PublicKey) (*Account, error)
func (*ClientImpl) GetAccountByCodeHash ¶
func (cl *ClientImpl) GetAccountByCodeHash(codeHash common.Uint160) *Account
func (*ClientImpl) GetAccounts ¶
func (cl *ClientImpl) GetAccounts() []*Account
func (*ClientImpl) GetDefaultAccount ¶
func (cl *ClientImpl) GetDefaultAccount() (*Account, error)
func (*ClientImpl) LoadAccounts ¶
func (cl *ClientImpl) LoadAccounts() error
LoadAccounts loads all accounts from db to memory
func (*ClientImpl) ProcessSignals ¶
func (cl *ClientImpl) ProcessSignals()
func (*ClientImpl) SaveAccount ¶
func (cl *ClientImpl) SaveAccount(ac *Account) error
SaveAccount saves a Account to memory and db
func (*ClientImpl) Sign ¶
func (cl *ClientImpl) Sign(txn *types.Transaction) (*types.Transaction, error)
type FileData ¶
type FileData struct { Version string PasswordHash string IV string MasterKey string Account []AccountData }
type FileStore ¶
type FileStore struct { // this lock could be hold by readDB, writeDB and interrupt signals. sync.Mutex // contains filtered or unexported fields }
func (*FileStore) BuildDatabase ¶
func (*FileStore) DeleteAccountData ¶
func (*FileStore) LoadAccountData ¶
func (cs *FileStore) LoadAccountData() ([]AccountData, error)
func (*FileStore) SaveAccountData ¶
func (*FileStore) SaveStoredData ¶
Click to show internal directories.
Click to hide internal directories.