Documentation ¶
Index ¶
- Constants
- Variables
- func ExportKeystore(name string, password []byte) ([]byte, error)
- func GenerateKey(len uint16) []byte
- func HandleSignal(handler func())
- func ImportKeystore(name string, password []byte, privateKey []byte) error
- type Address
- type CrossChainOutput
- type DataStore
- type DataStoreImpl
- func (store *DataStoreImpl) AddAddress(programHash *Uint168, redeemScript []byte, addrType int) error
- func (store *DataStoreImpl) AddAddressUTXO(programHash *Uint168, utxo *UTXO) error
- func (store *DataStoreImpl) CurrentHeight(height uint32) uint32
- func (store *DataStoreImpl) DeleteAddress(programHash *Uint168) error
- func (store *DataStoreImpl) DeleteUTXO(op *OutPoint) error
- func (store *DataStoreImpl) GetAddressInfo(programHash *Uint168) (*Address, error)
- func (store *DataStoreImpl) GetAddressUTXOs(programHash *Uint168) ([]*UTXO, error)
- func (store *DataStoreImpl) GetAddresses() ([]*Address, error)
- func (store *DataStoreImpl) ResetDataStore() error
- type DataSync
- type DataSyncImpl
- type Keystore
- type KeystoreFile
- func (store *KeystoreFile) GetIV() ([]byte, error)
- func (store *KeystoreFile) GetMasterKeyEncrypted() ([]byte, error)
- func (store *KeystoreFile) GetPasswordHash() ([]byte, error)
- func (store *KeystoreFile) GetPrivetKeyEncrypted() ([]byte, error)
- func (store *KeystoreFile) LoadFromFile() error
- func (store *KeystoreFile) SaveToFile() error
- func (store *KeystoreFile) SetIV(iv []byte)
- func (store *KeystoreFile) SetMasterKeyEncrypted(masterKeyEncrypted []byte)
- func (store *KeystoreFile) SetPasswordHash(passwordHash []byte)
- func (store *KeystoreFile) SetPrivateKeyEncrypted(privateKeyEncrypted []byte)
- type KeystoreImpl
- func (store *KeystoreImpl) Address() string
- func (store *KeystoreImpl) ChangePassword(oldPassword, newPassword []byte) error
- func (store *KeystoreImpl) GetPrivateKey() []byte
- func (store *KeystoreImpl) GetProgramHash() *Uint168
- func (store *KeystoreImpl) GetPublicKey() *crypto.PublicKey
- func (store *KeystoreImpl) GetRedeemScript() []byte
- func (store *KeystoreImpl) Sign(txn *Transaction) ([]byte, error)
- type SignalMap
- type SortableUTXOs
- type Transfer
- type UTXO
- type Wallet
- type WalletImpl
- func (wallet *WalletImpl) AddMultiSignAccount(M uint, publicKeys ...*crypto.PublicKey) (*Uint168, error)
- func (wallet *WalletImpl) AddStandardAccount(publicKey *crypto.PublicKey) (*Uint168, error)
- func (wallet *WalletImpl) CreateCrossChainTransaction(fromAddress, toAddress, crossChainAddress string, amount, fee *Fixed64) (*Transaction, error)
- func (wallet *WalletImpl) CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, outputs ...*Transfer) (*Transaction, error)
- func (wallet *WalletImpl) CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error)
- func (wallet *WalletImpl) CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, outputs ...*Transfer) (*Transaction, error)
- func (wallet *WalletImpl) CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error)
- func (wallet *WalletImpl) Open(name string, password []byte) error
- func (wallet *WalletImpl) Reset() error
- func (wallet *WalletImpl) Sign(name string, password []byte, txn *Transaction) (*Transaction, error)
Constants ¶
View Source
const ( TypeMaster = 0 TypeStand = 1 << 1 TypeMulti = 1 << 2 )
View Source
const ( DriverName = "sqlite3" DBName = "./wallet.db" QueryHeightCode = 0 ResetHeightCode = math.MaxUint32 )
View Source
const ( CreateInfoTable = `CREATE TABLE IF NOT EXISTS Info ( Name VARCHAR(20) NOT NULL PRIMARY KEY, Value BLOB );` CreateAddressesTable = `` /* 198-byte string literal not displayed */ CreateUTXOsTable = `` /* 221-byte string literal not displayed */ )
View Source
const ( OldWalletFile = "wallet.dat" DefaultKeystoreFile = "keystore.dat" )
View Source
const (
DESTROY_ADDRESS = "0000000000000000000000000000000000"
)
View Source
const (
KeystoreVersion = "1.0"
)
View Source
const MaxSignalQueueLen = 5
Variables ¶
View Source
var SystemAssetId = getSystemAssetId()
Functions ¶
func GenerateKey ¶
func HandleSignal ¶
func HandleSignal(handler func())
Types ¶
type CrossChainOutput ¶
type DataStore ¶
type DataStore interface { sync.Locker DataSync CurrentHeight(height uint32) uint32 AddAddress(programHash *Uint168, redeemScript []byte, addrType int) error DeleteAddress(programHash *Uint168) error GetAddressInfo(programHash *Uint168) (*Address, error) GetAddresses() ([]*Address, error) AddAddressUTXO(programHash *Uint168, utxo *UTXO) error DeleteUTXO(input *OutPoint) error GetAddressUTXOs(programHash *Uint168) ([]*UTXO, error) ResetDataStore() error }
func OpenDataStore ¶
type DataStoreImpl ¶
func (*DataStoreImpl) AddAddress ¶
func (store *DataStoreImpl) AddAddress(programHash *Uint168, redeemScript []byte, addrType int) error
func (*DataStoreImpl) AddAddressUTXO ¶
func (store *DataStoreImpl) AddAddressUTXO(programHash *Uint168, utxo *UTXO) error
func (*DataStoreImpl) CurrentHeight ¶
func (store *DataStoreImpl) CurrentHeight(height uint32) uint32
func (*DataStoreImpl) DeleteAddress ¶
func (store *DataStoreImpl) DeleteAddress(programHash *Uint168) error
func (*DataStoreImpl) DeleteUTXO ¶
func (store *DataStoreImpl) DeleteUTXO(op *OutPoint) error
func (*DataStoreImpl) GetAddressInfo ¶
func (store *DataStoreImpl) GetAddressInfo(programHash *Uint168) (*Address, error)
func (*DataStoreImpl) GetAddressUTXOs ¶
func (store *DataStoreImpl) GetAddressUTXOs(programHash *Uint168) ([]*UTXO, error)
func (*DataStoreImpl) GetAddresses ¶
func (store *DataStoreImpl) GetAddresses() ([]*Address, error)
func (*DataStoreImpl) ResetDataStore ¶
func (store *DataStoreImpl) ResetDataStore() error
type DataSyncImpl ¶
type DataSyncImpl struct { DataStore // contains filtered or unexported fields }
func (*DataSyncImpl) SyncChainData ¶
func (sync *DataSyncImpl) SyncChainData()
type Keystore ¶
type KeystoreFile ¶
type KeystoreFile struct { sync.Mutex Version string IV string PasswordHash string MasterKeyEncrypted string PrivateKeyEncrypted string // contains filtered or unexported fields }
func CreateKeystoreFile ¶
func CreateKeystoreFile(name string) (*KeystoreFile, error)
func OpenFromOldVersion ¶
func OpenFromOldVersion() (*KeystoreFile, error)
func OpenKeystoreFile ¶
func OpenKeystoreFile(name string) (*KeystoreFile, error)
func (*KeystoreFile) GetIV ¶
func (store *KeystoreFile) GetIV() ([]byte, error)
func (*KeystoreFile) GetMasterKeyEncrypted ¶
func (store *KeystoreFile) GetMasterKeyEncrypted() ([]byte, error)
func (*KeystoreFile) GetPasswordHash ¶
func (store *KeystoreFile) GetPasswordHash() ([]byte, error)
func (*KeystoreFile) GetPrivetKeyEncrypted ¶
func (store *KeystoreFile) GetPrivetKeyEncrypted() ([]byte, error)
func (*KeystoreFile) LoadFromFile ¶
func (store *KeystoreFile) LoadFromFile() error
func (*KeystoreFile) SaveToFile ¶
func (store *KeystoreFile) SaveToFile() error
func (*KeystoreFile) SetIV ¶
func (store *KeystoreFile) SetIV(iv []byte)
func (*KeystoreFile) SetMasterKeyEncrypted ¶
func (store *KeystoreFile) SetMasterKeyEncrypted(masterKeyEncrypted []byte)
func (*KeystoreFile) SetPasswordHash ¶
func (store *KeystoreFile) SetPasswordHash(passwordHash []byte)
func (*KeystoreFile) SetPrivateKeyEncrypted ¶
func (store *KeystoreFile) SetPrivateKeyEncrypted(privateKeyEncrypted []byte)
type KeystoreImpl ¶
type KeystoreImpl struct { sync.Mutex *KeystoreFile // contains filtered or unexported fields }
func (*KeystoreImpl) Address ¶
func (store *KeystoreImpl) Address() string
func (*KeystoreImpl) ChangePassword ¶
func (store *KeystoreImpl) ChangePassword(oldPassword, newPassword []byte) error
func (*KeystoreImpl) GetPrivateKey ¶
func (store *KeystoreImpl) GetPrivateKey() []byte
func (*KeystoreImpl) GetProgramHash ¶
func (store *KeystoreImpl) GetProgramHash() *Uint168
func (*KeystoreImpl) GetPublicKey ¶
func (store *KeystoreImpl) GetPublicKey() *crypto.PublicKey
func (*KeystoreImpl) GetRedeemScript ¶
func (store *KeystoreImpl) GetRedeemScript() []byte
func (*KeystoreImpl) Sign ¶
func (store *KeystoreImpl) Sign(txn *Transaction) ([]byte, error)
type SortableUTXOs ¶
type SortableUTXOs []*UTXO
func (SortableUTXOs) Len ¶
func (utxos SortableUTXOs) Len() int
func (SortableUTXOs) Less ¶
func (utxos SortableUTXOs) Less(i, j int) bool
func (SortableUTXOs) Swap ¶
func (utxos SortableUTXOs) Swap(i, j int)
type Wallet ¶
type Wallet interface { DataStore Open(name string, password []byte) error ChangePassword(oldPassword, newPassword []byte) error AddStandardAccount(publicKey *crypto.PublicKey) (*Uint168, error) AddMultiSignAccount(M uint, publicKey ...*crypto.PublicKey) (*Uint168, error) CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error) CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error) CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, output ...*Transfer) (*Transaction, error) CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, output ...*Transfer) (*Transaction, error) CreateCrossChainTransaction(fromAddress, toAddress, crossChainAddress string, amount, fee *Fixed64) (*Transaction, error) Sign(name string, password []byte, transaction *Transaction) (*Transaction, error) Reset() error }
type WalletImpl ¶
func GetWallet ¶
func GetWallet() (*WalletImpl, error)
func (*WalletImpl) AddMultiSignAccount ¶
func (wallet *WalletImpl) AddMultiSignAccount(M uint, publicKeys ...*crypto.PublicKey) (*Uint168, error)
func (*WalletImpl) AddStandardAccount ¶
func (wallet *WalletImpl) AddStandardAccount(publicKey *crypto.PublicKey) (*Uint168, error)
func (*WalletImpl) CreateCrossChainTransaction ¶
func (wallet *WalletImpl) CreateCrossChainTransaction(fromAddress, toAddress, crossChainAddress string, amount, fee *Fixed64) (*Transaction, error)
func (*WalletImpl) CreateLockedMultiOutputTransaction ¶
func (wallet *WalletImpl) CreateLockedMultiOutputTransaction(fromAddress string, fee *Fixed64, lockedUntil uint32, outputs ...*Transfer) (*Transaction, error)
func (*WalletImpl) CreateLockedTransaction ¶
func (wallet *WalletImpl) CreateLockedTransaction(fromAddress, toAddress string, amount, fee *Fixed64, lockedUntil uint32) (*Transaction, error)
func (*WalletImpl) CreateMultiOutputTransaction ¶
func (wallet *WalletImpl) CreateMultiOutputTransaction(fromAddress string, fee *Fixed64, outputs ...*Transfer) (*Transaction, error)
func (*WalletImpl) CreateTransaction ¶
func (wallet *WalletImpl) CreateTransaction(fromAddress, toAddress string, amount, fee *Fixed64) (*Transaction, error)
func (*WalletImpl) Reset ¶
func (wallet *WalletImpl) Reset() error
Click to show internal directories.
Click to hide internal directories.