cmd

package
v0.0.0-...-8433207 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Copyright 2019 icodezjb

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var (
	Commit    = "unknown-commit"
	BuildTime = "unknown-buildtime"

	Version = "0.2.0"
)

Functions

func Must

func Must(err error)

func VersionFunc

func VersionFunc() string

VersionFunc holds the textual version string.

Types

type Config

type Config struct {
	ChainID        *big.Int `json:"chainID"`
	ChainName      string   `json:"chainName"`
	URL            string   `json:"url"`
	OtherChainID   *big.Int `json:"otherChainID"`
	OtherChainName string   `json:"otherChainName"`
	OtherURL       string   `json:"otherURL"`
	Account        string   `json:"account"`
	Contract       string   `json:"contract"`
	KeyStore       string   `json:"keystoreDir"`
	Password       string   `json:"password"`
	Chain          *chain   `json:"-"`
	// contains filtered or unexported fields
}

func (*Config) Connect

func (c *Config) Connect(otherContract string) error

func (*Config) ParseConfig

func (c *Config) ParseConfig(cfgPath string) error

func (*Config) Unlock

func (c *Config) Unlock(privateKey string) error

func (*Config) ValidateAddress

func (c *Config) ValidateAddress(address string) error

type ContractDetails

type ContractDetails struct {
	Sender    common.Address
	Receiver  common.Address
	Amount    *big.Int
	Hashlock  [32]byte
	Timelock  *big.Int
	Withdrawn bool
	Refunded  bool
	Preimage  [32]byte
}

type Handler

type Handler struct {
	ConfigPath string
	Config     *Config
}

func (*Handler) AuditContract

func (h *Handler) AuditContract(ctx context.Context, result interface{}, contractId common.Hash) error

func (*Handler) DeployContract

func (h *Handler) DeployContract(ctx context.Context) error

func (*Handler) GetContractId

func (h *Handler) GetContractId(ctx context.Context, txID common.Hash) (*HtlcLogHTLCNew, error)

func (*Handler) NewContract

func (h *Handler) NewContract(ctx context.Context, participant common.Address, amount int64, hashLock [32]byte, timeLock *big.Int) (*types.Transaction, error)

func (*Handler) Redeem

func (h *Handler) Redeem(ctx context.Context, contractId common.Hash, secret common.Hash) (*types.Transaction, error)

func (*Handler) Refund

func (h *Handler) Refund(ctx context.Context, contractId common.Hash) (*types.Transaction, error)

func (*Handler) StatContract

func (h *Handler) StatContract(ctx context.Context) error

type HtlcLogHTLCNew

type HtlcLogHTLCNew struct {
	ContractId [32]byte
	Sender     common.Address
	Receiver   common.Address
	Amount     *big.Int
	Hashlock   [32]byte
	Timelock   *big.Int
}

type SecretHashPair

type SecretHashPair struct {
	Secret [32]byte
	Hash   [32]byte
}

func NewSecretHashPair

func NewSecretHashPair() *SecretHashPair

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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