wallet

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: ISC Imports: 31 Imported by: 0

README

Wallet

Add Relation Modules
~ ./qng --acctmode --modules=wallet --modules=account
Create Or Import a account
~ ./qng --privnet -A=./ account import (privateKey path)
or
~ ./qng --privnet -A=./ account new
Unlock account

curl -k -u test:test -k -X POST   https://127.0.0.1:18131/   -H 'content-type: application/json'   -d '{
  "method":"wallet_listAccount",
  "version":"2.0",
  "params":[],                                                                                                  "id":1
}'
~ ./cli.sh unlock 0 123456 60
or 
~
curl -k -u test:test -k -X POST   https://127.0.0.1:38131/   -H 'content-type: application/json'   -d '{
  "method":"wallet_unlock",
  "version":"2.0",
  "params":["0","123456",600],                                                                                                  "id":1
}'
lock account
~ ./cli.sh lock Rk8Jwy4QbiK84iLDLFn81NzedVwFE7UWJqfWy9hf9GTWVGr3hmJk3
or 
curl -k -u test:test -k -X POST   https://127.0.0.1:38131/   -H 'content-type: application/json'   -d '{
  "method":"wallet_lock",
  "version":"2.0",
  "params":["Rk8Jwy4QbiK84iLDLFn81NzedVwFE7UWJqfWy9hf9GTWVGr3hmJk3"],
  "id":1
}'
send to address
~ ./cli.sh sendtoaddress Rk8Jwy4QbiK84iLDLFn81NzedVwFE7UWJqfWy9hf9GTWVGr3hmJk3 "{\\\"RmN6q2ZdNaCtgpq2BE5ZaUbfQxXwRU1yTYf\\\":{\\\"amount\\\":100000000,\\\"coinid\\\":0}}" 0
or 
curl -u test:test -k -X POST   https://127.0.0.1:38131/   -H 'cache-control: no-cache'   -H 'content-type: application/json'   -H 'postman-token: 439c084c-4898-c548-cc7e-3121cfaea8f8'   -d '{
  "method":"wallet_sendToAddress",
  "version":"2.0",
  "params":["RmN6q2ZdNaCtgpq2BE5ZaUbfQxXwRU1yTYf","{\"RmN6q2ZdNaCtgpq2BE5ZaUbfQxXwRU1yTYf\":{\"amount\":100000000,\"coinid\":0}}",0],
  "id":1
}'

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQngAddrsFromPrivateKey

func GetQngAddrsFromPrivateKey(privateKeyStr string, param *params.Params) ([]types.Address, error)

Types

type PrivateWalletManagerAPI

type PrivateWalletManagerAPI struct {
	// contains filtered or unexported fields
}

PrivateWalletManagerAPI provides an API to access Qng wallet function information.

func NewPrivateWalletAPI

func NewPrivateWalletAPI(m *WalletManager) *PrivateWalletManagerAPI

func (*PrivateWalletManagerAPI) ImportRawKey

func (api *PrivateWalletManagerAPI) ImportRawKey(privkey string, password string) (common.Address, error)

ImportRawKey stores the given hex encoded ECDSA key into the key directory, encrypting it with the passphrase.

func (*PrivateWalletManagerAPI) ListAccount

func (api *PrivateWalletManagerAPI) ListAccount() (interface{}, error)

func (*PrivateWalletManagerAPI) Lock

func (api *PrivateWalletManagerAPI) Lock(addres string) error

Lock removes the private key with the given address from memory.

func (*PrivateWalletManagerAPI) SendToAddress

func (api *PrivateWalletManagerAPI) SendToAddress(fromAddress string, to string, lockTime int64) (string, error)

SendToAddress handles a sendtoaddress RPC request by creating a new transaction spending unspent transaction outputs for a wallet to another payment address. Leftover inputs not sent to the payment address or a fee for the miner are sent back to a new address in the wallet. Upon success, the TxID for the created transaction is returned.

func (*PrivateWalletManagerAPI) Unlock

func (api *PrivateWalletManagerAPI) Unlock(account, passphrase string, timeout time.Duration) error

type PublicWalletManagerAPI

type PublicWalletManagerAPI struct {
	// contains filtered or unexported fields
}

PublicWalletManagerAPI provides an API to access Qng wallet function information.

type QngKeyStore

type QngKeyStore struct {
	*keystore.KeyStore
	// contains filtered or unexported fields
}

func NewQngKeyStore

func NewQngKeyStore(ks *keystore.KeyStore) *QngKeyStore

func (*QngKeyStore) GetKey

func (ks *QngKeyStore) GetKey(addr common.Address, filename, auth string) (*keystore.Key, error)

type WalletManager

type WalletManager struct {
	service.Service
	// contains filtered or unexported fields
}

func New

func New(cfg *config.Config, evm *meer.MeerChain, _am *acct.AccountManager, _tm *tx.TxManager, _events *event.Feed) (*WalletManager, error)

func (*WalletManager) APIs

func (a *WalletManager) APIs() []api.API

func (*WalletManager) CollectUtxoToEvm

func (a *WalletManager) CollectUtxoToEvm()

func (*WalletManager) Load

func (acc *WalletManager) Load() error

func (*WalletManager) MakeAddress

func (acc *WalletManager) MakeAddress(ks *QngKeyStore, account string) (accounts.Account, error)

func (*WalletManager) Start

func (a *WalletManager) Start() error

func (*WalletManager) Stop

func (a *WalletManager) Stop() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL