modules

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Empty is the empty string
	Empty string = ""
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressAliasMap added in v0.3.1

type AddressAliasMap = map[string]string

type Alias added in v0.3.0

type Alias struct {
	Source string `json:"source"`
}

type Authenticator added in v0.3.1

type Authenticator struct {
	Secret string `json:"-" mapstructure:"-"`
	Expire int    `json:"expire" mapstructure:"expire"`
	Code   uint32 `json:"code" mapstructure:"code"`
}

type ContractConfig added in v0.3.0

type ContractConfig struct {
	Address        string              `json:"address,omitempty" hcl:"address,omitempty" mapstructure:"address,omitempty"`       // 合约地址
	FuncSigns      map[string]FuncSign `json:"func_sign" hcl:"func_sign" mapstructure:"func_sign"`                               // 函数签名
	NativeTransfer bool                `json:"native_transfer" mapstructure:"native_transfer"`                                   // 原生转账
	ChainIds       []uint64            `json:"chain_ids,omitempty" hcl:"chain_ids,omitempty" mapstructure:"chain_ids,omitempty"` // 配置ChainID允许
}

func (*ContractConfig) IsChainIdAllowed added in v0.3.0

func (c *ContractConfig) IsChainIdAllowed(chainId uint64) bool

func (*ContractConfig) IsContractAllowed added in v0.3.0

func (c *ContractConfig) IsContractAllowed(contract string, chainId uint64) bool

func (*ContractConfig) IsFuncSignAllowed added in v0.3.0

func (c *ContractConfig) IsFuncSignAllowed(funcSign string) *FuncSign

type EthWalletBackend

type EthWalletBackend struct {
	*framework.Backend
	// contains filtered or unexported fields
}

type Extra added in v0.3.1

type Extra struct {
	IsLock bool     `json:"is_lock" mapstructure:"is_lock"`
	Tags   []string `json:"tags" mapstructure:"tags"`
}

func (*Extra) Decode added in v0.3.1

func (w *Extra) Decode(m map[string]any) error

type FuncSign added in v0.3.0

type FuncSign struct {
	Sign     string `json:"sign,omitempty" hcl:"sign,omitempty" mapstructure:"sign,omitempty"` // 函数签名
	MaxValue string `json:"max_value" hcl:"max_value" mapstructure:"max_value"`                // 最大值
}

func (*FuncSign) IsFuncSignAllowed added in v0.3.0

func (s *FuncSign) IsFuncSignAllowed(sign string) bool

func (*FuncSign) IsMaxValueAllowed added in v0.3.0

func (s *FuncSign) IsMaxValueAllowed(value *big.Int) bool

type Policy added in v0.3.0

type Policy struct {
	ChainIds             []uint64                  `json:"chain_ids" hcl:"chain_ids" mapstructure:"chain_ids"`                                        // 配置ChainID允许
	EnableCreateContract bool                      `json:"enable_create_contract" hcl:"enable_create_contract" mapstructure:"enable_create_contract"` // 是否允许创建合约
	Contract             map[string]ContractConfig `json:"contract" hcl:"contract" mapstructure:"contract"`                                           // 操作合约白名单
}

func (*Policy) IsChainIdAllowed added in v0.3.0

func (p *Policy) IsChainIdAllowed(chainId uint64) bool

func (*Policy) IsContractAllowed added in v0.3.0

func (p *Policy) IsContractAllowed(contract string, chainId uint64) *ContractConfig

func (*Policy) IsTxAllowed added in v0.3.0

func (p *Policy) IsTxAllowed(tx *types.Transaction, chainId uint64) (bool, error)

type SocialID added in v0.3.1

type SocialID struct {
	User        string         `json:"user" mapstructure:"user"`                                       // User is the user id of the discord / twitter / telegram user
	Password    string         `json:"password,omitempty" mapstructure:"password,omitempty"`           // Password is the password of the discord / twitter / telegram user
	Mobile      string         `json:"mobile,omitempty" mapstructure:"mobile,omitempty"`               // Mobile is the mobile of the discord / twitter / telegram user
	TwoFASecret string         `json:"two_fa_secret,omitempty" mapstructure:"two_fa_secret,omitempty"` // TwoFASecret is the two-factor authentication secret of the discord / twitter / telegram user
	GAuth       *Authenticator `json:"g_auth,omitempty" mapstructure:"g_auth,omitempty"`               // GAuth is the Google authenticator of the discord / twitter / telegram user
	UpdateTime  int64          `json:"update_time" mapstructure:"update_time"`                         // UpdateTime is the update time of the socialId
	NameSpaces  []string       `json:"namespaces,omitempty" mapstructure:"namespaces,omitempty"`       // NameSpaces is the namespaces of the socialId
	App         string         `json:"app" mapstructure:"app,omitempty"`                               // App is the app of the socialId
}

SocialID is a struct that contains the information of a discord / twitter / telegram user

type Wallet added in v0.3.0

type Wallet struct {
	PublicKey  string `json:"public_key,omitempty" mapstructure:"public_key,omitempty"` // PublicKey is the public key of the wallet
	Address    string `json:"address" mapstructure:"address"`
	UpdateTime int64  `json:"update_time" mapstructure:"update_time,omitempty"` // key pair update time
}

Wallet is an Ethereum Wallet

type WalletExtra added in v0.3.1

type WalletExtra struct {
	Wallet     `mapstructure:",squash"`
	Mnemonic   string `json:"mnemonic" mapstructure:"mnemonic,omitempty"`       // Mnemonic is the mnemonic of the wallet
	PrivateKey string `json:"private_key" mapstructure:"private_key,omitempty"` // PrivateKey is the private key of the wallet
	//PublicKey    string          `json:"public_key,omitempty"`    // PublicKey is the public key of the wallet
	AddressAlias AddressAliasMap `json:"address_alias,omitempty" mapstructure:"address_alias,omitempty"` // Address is the address of the wallet
	NameSpaces   []string        `json:"namespaces,omitempty" mapstructure:"namespaces,omitempty"`       // 用于项目区分
	CryptoType   string          `json:"crypto_type,omitempty" mapstructure:"crypto_type,omitempty"`     // 加密曲线区分
	Extra        Extra           `json:"extra" mapstructure:"extra,omitempty"`                           // 用于标签
}

WalletExtra is an Ethereum Wallet

func (*WalletExtra) GetAddress added in v0.3.1

func (w *WalletExtra) GetAddress(chain string) string

func (*WalletExtra) SignEthTx added in v0.3.1

func (w *WalletExtra) SignEthTx(unsignTx *types.Transaction) (*types.Transaction, error)

Jump to

Keyboard shortcuts

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