wallet

package
v1.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CancelErr  = "Cannot cancel another signers transaction"
	ApproveErr = "already approved this message"
)

Variables

View Source
var (
	ParamErr = NewError(1001, "parameter mismatch")
	AuthErr  = NewError(1002, "password verification failed")
)
View Source
var HandlePermMap = map[string]app.Permission{
	"/status":                                  app.PermRead,
	"/login":                                   app.PermWrite,
	"/logout":                                  app.PermWrite,
	"/chain/decode":                            app.PermRead,
	"/chain/encode":                            app.PermRead,
	"/node/add":                                app.PermWrite,
	"/node/update":                             app.PermWrite,
	"/node/delete":                             app.PermWrite,
	"/node/use_node":                           app.PermWrite,
	"/node/list":                               app.PermRead,
	"/node/best":                               app.PermRead,
	"/wallet/create":                           app.PermWrite,
	"/wallet/list":                             app.PermRead,
	"/balance":                                 app.PermRead,
	"/transfer":                                app.PermWrite,
	"/tx_history":                              app.PermRead,
	"/send":                                    app.PermWrite,
	"/sign_msg":                                app.PermSign,
	"/sign":                                    app.PermSign,
	"/sign_send":                               app.PermSign,
	"/miner/withdraw":                          app.PermWrite,
	"/miner/change_owner":                      app.PermWrite,
	"/miner/change_worker":                     app.PermWrite,
	"/miner/confirm_change_worker":             app.PermWrite,
	"/miner/change_control":                    app.PermWrite,
	"/miner/control_list":                      app.PermRead,
	"/miner/change_beneficiary":                app.PermWrite,
	"/miner/confirm_change_beneficiary":        app.PermWrite,
	"/msig/list":                               app.PermRead,
	"/msig/add":                                app.PermWrite,
	"/msig/update":                             app.PermWrite,
	"/msig/inspect":                            app.PermRead,
	"/msig/create":                             app.PermWrite,
	"/msig/approve":                            app.PermWrite,
	"/msig/cancel":                             app.PermWrite,
	"/msig/transfer_propose":                   app.PermWrite,
	"/msig/transfer_approve":                   app.PermWrite,
	"/msig/transfer_cancel":                    app.PermWrite,
	"/msig/add_signer_propose":                 app.PermWrite,
	"/msig/add_signer_approve":                 app.PermWrite,
	"/msig/add_signer_cancel":                  app.PermWrite,
	"/msig/swap_propose":                       app.PermWrite,
	"/msig/swap_approve":                       app.PermWrite,
	"/msig/swap_cancel":                        app.PermWrite,
	"/msig/lock_propose":                       app.PermWrite,
	"/msig/lock_approve":                       app.PermWrite,
	"/msig/lock_cancel":                        app.PermWrite,
	"/msig/threshold_propose":                  app.PermWrite,
	"/msig/threshold_approve":                  app.PermWrite,
	"/msig/threshold_cancel":                   app.PermWrite,
	"/msig/change_owner_propose":               app.PermWrite,
	"/msig/change_owner_approve":               app.PermWrite,
	"/msig/withdraw_propose":                   app.PermWrite,
	"/msig/withdraw_approve":                   app.PermWrite,
	"/msig/change_worker_propose":              app.PermWrite,
	"/msig/change_worker_approve":              app.PermWrite,
	"/msig/confirm_change_worker_propose":      app.PermWrite,
	"/msig/confirm_change_worker_approve":      app.PermWrite,
	"/msig/set_control_propose":                app.PermWrite,
	"/msig/set_control_approve":                app.PermWrite,
	"/msig/change_beneficiary_propose":         app.PermWrite,
	"/msig/change_beneficiary_approve":         app.PermWrite,
	"/msig/confirm_change_beneficiary_propose": app.PermWrite,
	"/msig/confirm_change_beneficiary_approve": app.PermWrite,
}

Functions

func Cors

func Cors() gin.HandlerFunc

func DecodeParams

func DecodeParams(method abi.MethodNum, params []byte) ([]byte, error)

func EncodeParams

func EncodeParams(method abi.MethodNum, params string) ([]byte, error)

func NewError

func NewError(code int, msg string) *client.Response

func Recovery

func Recovery() gin.HandlerFunc

func ReturnError

func ReturnError(c *gin.Context, res *client.Response)

func ReturnOk

func ReturnOk(c *gin.Context, data interface{})

func VerifyPermission

func VerifyPermission(requestUrl string, allows []app.Permission) bool

Types

type Children

type Children struct {
	Name      string `json:"name"`
	Path      string `json:"path"`
	Hidden    bool   `json:"hidden"`
	Component string `json:"component"`
	Meta      Meta   `json:"meta"`
}

type LoggerWriter

type LoggerWriter struct {
	gin.ResponseWriter
	// contains filtered or unexported fields
}

func (LoggerWriter) Write

func (l LoggerWriter) Write(p []byte) (int, error)

type Meta

type Meta struct {
	Title   string `json:"title"`
	Icon    string `json:"icon"`
	NoCache bool   `json:"noCache"`
}

type RouterResponse

type RouterResponse struct {
	Code    int       `json:"code"`
	Message string    `json:"message"`
	Data    []Routers `json:"data"`
}

type Routers

type Routers struct {
	Name       string     `json:"name,omitempty"`
	Path       string     `json:"path"`
	Hidden     bool       `json:"hidden"`
	Redirect   string     `json:"redirect,omitempty"`
	Component  string     `json:"component"`
	AlwaysShow bool       `json:"alwaysShow,omitempty"`
	Meta       Meta       `json:"meta"`
	Children   []Children `json:"children"`
}

type Wallet

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

func NewWallet

func NewWallet(offline bool, masterPassword string, db datastore.WalletDB, close <-chan struct{}) (*Wallet, error)

func (*Wallet) Balance

func (w *Wallet) Balance(c *gin.Context)

func (*Wallet) ChangeBeneficiary

func (w *Wallet) ChangeBeneficiary(c *gin.Context)

ChangeBeneficiary Post

func (*Wallet) ChangeControl

func (w *Wallet) ChangeControl(c *gin.Context)

ChangeControl Post

func (*Wallet) ChangeOwner

func (w *Wallet) ChangeOwner(c *gin.Context)

ChangeOwner Post

func (*Wallet) ChangeWorker

func (w *Wallet) ChangeWorker(c *gin.Context)

ChangeWorker Post

func (*Wallet) ConfirmChangeBeneficiary

func (w *Wallet) ConfirmChangeBeneficiary(c *gin.Context)

ConfirmChangeBeneficiary Post

func (*Wallet) ConfirmChangeWorker

func (w *Wallet) ConfirmChangeWorker(c *gin.Context)

ConfirmChangeWorker Post

func (*Wallet) ControlList

func (w *Wallet) ControlList(c *gin.Context)

ControlList Get

func (*Wallet) Decode

func (w *Wallet) Decode(c *gin.Context)

func (*Wallet) Encode

func (w *Wallet) Encode(c *gin.Context)

func (*Wallet) GetRouters

func (w *Wallet) GetRouters(c *gin.Context)

func (*Wallet) IfOfflineWallet

func (w *Wallet) IfOfflineWallet() gin.HandlerFunc

func (*Wallet) JWT

func (w *Wallet) JWT() gin.HandlerFunc

func (*Wallet) Login

func (w *Wallet) Login(c *gin.Context)

Login : Post

func (*Wallet) Logout

func (w *Wallet) Logout(c *gin.Context)

Logout Post

func (*Wallet) MsigAdd

func (w *Wallet) MsigAdd(c *gin.Context)

MsigAdd Post

func (*Wallet) MsigAddApprove

func (w *Wallet) MsigAddApprove(c *gin.Context)

MsigAddApprove Post

func (*Wallet) MsigAddCancel

func (w *Wallet) MsigAddCancel(c *gin.Context)

MsigAddCancel Post

func (*Wallet) MsigAddPropose

func (w *Wallet) MsigAddPropose(c *gin.Context)

MsigAddPropose Post

func (*Wallet) MsigApprove

func (w *Wallet) MsigApprove(c *gin.Context)

MsigApprove Post

func (*Wallet) MsigCancel

func (w *Wallet) MsigCancel(c *gin.Context)

MsigCancel Post

func (*Wallet) MsigChangeBeneficiaryApprove

func (w *Wallet) MsigChangeBeneficiaryApprove(c *gin.Context)

MsigChangeBeneficiaryApprove Post

func (*Wallet) MsigChangeBeneficiaryPropose

func (w *Wallet) MsigChangeBeneficiaryPropose(c *gin.Context)

MsigChangeBeneficiaryPropose Post

func (*Wallet) MsigChangeOwnerApprove

func (w *Wallet) MsigChangeOwnerApprove(c *gin.Context)

MsigChangeOwnerApprove Post

func (*Wallet) MsigChangeOwnerPropose

func (w *Wallet) MsigChangeOwnerPropose(c *gin.Context)

MsigChangeOwnerPropose Post

func (*Wallet) MsigChangeWorkerApprove

func (w *Wallet) MsigChangeWorkerApprove(c *gin.Context)

MsigChangeWorkerApprove Post

func (*Wallet) MsigChangeWorkerPropose

func (w *Wallet) MsigChangeWorkerPropose(c *gin.Context)

MsigChangeWorkerPropose Post

func (*Wallet) MsigConfirmChangeBeneficiaryApprove

func (w *Wallet) MsigConfirmChangeBeneficiaryApprove(c *gin.Context)

MsigConfirmChangeBeneficiaryApprove Post

func (*Wallet) MsigConfirmChangeBeneficiaryPropose

func (w *Wallet) MsigConfirmChangeBeneficiaryPropose(c *gin.Context)

MsigConfirmChangeBeneficiaryPropose Post

func (*Wallet) MsigConfirmChangeWorkerApprove

func (w *Wallet) MsigConfirmChangeWorkerApprove(c *gin.Context)

MsigConfirmChangeWorkerApprove Post

func (*Wallet) MsigConfirmChangeWorkerPropose

func (w *Wallet) MsigConfirmChangeWorkerPropose(c *gin.Context)

MsigConfirmChangeWorkerPropose Post

func (*Wallet) MsigCreate

func (w *Wallet) MsigCreate(c *gin.Context)

MsigCreate Post

func (*Wallet) MsigInspect

func (w *Wallet) MsigInspect(c *gin.Context)

MsigInspect Get

func (*Wallet) MsigLockApprove

func (w *Wallet) MsigLockApprove(c *gin.Context)

MsigLockApprove Post

func (*Wallet) MsigLockCancel

func (w *Wallet) MsigLockCancel(c *gin.Context)

MsigLockCancel Post

func (*Wallet) MsigLockPropose

func (w *Wallet) MsigLockPropose(c *gin.Context)

MsigLockPropose Post

func (*Wallet) MsigSetControlApprove

func (w *Wallet) MsigSetControlApprove(c *gin.Context)

MsigSetControlApprove Post

func (*Wallet) MsigSetControlPropose

func (w *Wallet) MsigSetControlPropose(c *gin.Context)

MsigSetControlPropose Post

func (*Wallet) MsigSwapApprove

func (w *Wallet) MsigSwapApprove(c *gin.Context)

MsigSwapApprove Post

func (*Wallet) MsigSwapCancel

func (w *Wallet) MsigSwapCancel(c *gin.Context)

MsigSwapCancel Post

func (*Wallet) MsigSwapPropose

func (w *Wallet) MsigSwapPropose(c *gin.Context)

MsigSwapPropose Post

func (*Wallet) MsigThresholdApprove

func (w *Wallet) MsigThresholdApprove(c *gin.Context)

MsigThresholdApprove Post

func (*Wallet) MsigThresholdCancel

func (w *Wallet) MsigThresholdCancel(c *gin.Context)

MsigThresholdCancel Post

func (*Wallet) MsigThresholdPropose

func (w *Wallet) MsigThresholdPropose(c *gin.Context)

MsigThresholdPropose Post

func (*Wallet) MsigTransferApprove

func (w *Wallet) MsigTransferApprove(c *gin.Context)

MsigTransferApprove Post

func (*Wallet) MsigTransferCancel

func (w *Wallet) MsigTransferCancel(c *gin.Context)

MsigTransferCancel Post

func (*Wallet) MsigTransferPropose

func (w *Wallet) MsigTransferPropose(c *gin.Context)

MsigTransferPropose Post

func (*Wallet) MsigUpdate

func (w *Wallet) MsigUpdate(c *gin.Context)

MsigUpdate Post

func (*Wallet) MsigWalletList

func (w *Wallet) MsigWalletList(c *gin.Context)

MsigWalletList Get

func (*Wallet) MsigWithdrawApprove

func (w *Wallet) MsigWithdrawApprove(c *gin.Context)

MsigWithdrawApprove Post

func (*Wallet) MsigWithdrawPropose

func (w *Wallet) MsigWithdrawPropose(c *gin.Context)

MsigWithdrawPropose Post

func (*Wallet) MustHaveNode

func (w *Wallet) MustHaveNode() gin.HandlerFunc

func (*Wallet) MustUnlock

func (w *Wallet) MustUnlock() gin.HandlerFunc

func (*Wallet) NewRouter

func (w *Wallet) NewRouter() *gin.Engine

func (*Wallet) NodeAdd

func (w *Wallet) NodeAdd(c *gin.Context)

NodeAdd Post

func (*Wallet) NodeBest

func (w *Wallet) NodeBest(c *gin.Context)

NodeBest Get

func (*Wallet) NodeDelete

func (w *Wallet) NodeDelete(c *gin.Context)

func (*Wallet) NodeList

func (w *Wallet) NodeList(c *gin.Context)

NodeList Get

func (*Wallet) NodeUpdate

func (w *Wallet) NodeUpdate(c *gin.Context)

NodeUpdate Post

func (*Wallet) Send

func (w *Wallet) Send(c *gin.Context)

Send Post

func (*Wallet) Sign

func (w *Wallet) Sign(c *gin.Context)

Sign Post

func (*Wallet) SignAndSend

func (w *Wallet) SignAndSend(c *gin.Context)

SignAndSend Post

func (*Wallet) SignMsg

func (w *Wallet) SignMsg(c *gin.Context)

SignMsg Post

func (*Wallet) Status

func (w *Wallet) Status(c *gin.Context)

Status Get

func (*Wallet) TraceLogger

func (w *Wallet) TraceLogger() gin.HandlerFunc

func (*Wallet) Transfer

func (w *Wallet) Transfer(c *gin.Context)

Transfer Post

func (*Wallet) TxHistory

func (w *Wallet) TxHistory(c *gin.Context)

TxHistory Get

func (*Wallet) UseNode

func (w *Wallet) UseNode(c *gin.Context)

func (*Wallet) WalletCreate

func (w *Wallet) WalletCreate(c *gin.Context)

WalletCreate Post

func (*Wallet) WalletList

func (w *Wallet) WalletList(c *gin.Context)

WalletList Get

func (*Wallet) Withdraw

func (w *Wallet) Withdraw(c *gin.Context)

Withdraw Post

Jump to

Keyboard shortcuts

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