service

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UserPayment

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

UserPayment ユーザーの支払先アドレスと金額

type Wallet

type Wallet struct {
	//BTC  *btc.Bitcoin
	BTC  api.Bitcoiner
	DB   *model.DB
	GCS  map[enum.ActionType]*gcp.Storage
	Env  enum.EnvironmentType
	Type enum.WalletType
	Seed string
}

Wallet 基底オブジェクト

func InitialSettings

func InitialSettings(confPath string) (*Wallet, error)

InitialSettings 実行前に必要なすべての設定をこちらで行う TODO:hotwalletとColdwalletで設定が異なるので要調整

func (*Wallet) AddMultisigAddressByAuthorization

func (w *Wallet) AddMultisigAddressByAuthorization(accountType enum.AccountType, addressType enum.AddressType) error

AddMultisigAddressByAuthorization account_key_authorizationテーブルのwallet_addressを認証者として、 added_pubkey_history_paymentテーブル内のwalletアドレスのmultisigアドレスを生成する TODO:第4パラメータに、address_typeを追加する。Bitcoinの場合は、p2sh-segwit とする

func (*Wallet) CreateUnsignedTransactionForPayment

func (w *Wallet) CreateUnsignedTransactionForPayment(adjustmentFee float64) (string, string, error)

CreateUnsignedTransactionForPayment 支払いのための未署名トランザクションを作成する

func (*Wallet) DetectReceivedCoin

func (w *Wallet) DetectReceivedCoin(adjustmentFee float64) (string, string, error)

DetectReceivedCoin Wallet内アカウントに入金があれば、そこから、未署名のトランザクションを返す

func (*Wallet) Done

func (w *Wallet) Done()

Done 終了時に必要な処理

func (*Wallet) ExportAccountKey

func (w *Wallet) ExportAccountKey(accountType enum.AccountType, keyStatus enum.KeyStatus) (string, error)

ExportAccountKey AccountKeyテーブルをcsvとして出力する TODO:watch only walletにセットするアドレスは、clientの場合は、wallet_address, receipt/paymentの場合、`wallet_multisig_address`

func (*Wallet) ExportAddedPubkeyHistory

func (w *Wallet) ExportAddedPubkeyHistory(accountType enum.AccountType) (string, error)

ExportAddedPubkeyHistory AddedPubkeyHistoryテーブルをcsvとして出力する coldwallet2から使用

func (*Wallet) GenerateAccountKey

func (w *Wallet) GenerateAccountKey(accountType enum.AccountType, coinType enum.CoinType, seed []byte, count uint32) ([]key.WalletKey, error)

GenerateAccountKey AccountType属性のアカウントKeyを生成する TODO:AccountTypeAuthorizationのときは、レコードがある場合は追加できないようにしたほうがいい??

func (*Wallet) GenerateSeed

func (w *Wallet) GenerateSeed() ([]byte, error)

GenerateSeed seedを生成する

func (*Wallet) ImportMultisigAddrForColdWallet1

func (w *Wallet) ImportMultisigAddrForColdWallet1(fileName string, accountType enum.AccountType) error

ImportMultisigAddrForColdWallet1 coldwallet2でexportされたmultisigアドレス情報をimportする for Cold Wallet1

func (*Wallet) ImportPrivateKey

func (w *Wallet) ImportPrivateKey(accountType enum.AccountType) error

ImportPrivateKey 指定したAccountTypeに属するテーブルのis_imported_priv_keyがfalseのWIFをImportPrivKeyRescanする https://en.bitcoin.it/wiki/How_to_import_private_keys getaddressesbyaccount "" で内容を確認可能??

func (*Wallet) ImportPublicKeyForColdWallet2

func (w *Wallet) ImportPublicKeyForColdWallet2(fileName string, accountType enum.AccountType) error

ImportPublicKeyForColdWallet2 csvファイルからpublicアドレスをimportする for Cold Wallet2

func (*Wallet) ImportPublicKeyForWatchWallet

func (w *Wallet) ImportPublicKeyForWatchWallet(fileName string, accountType enum.AccountType, isRescan bool) error

ImportPublicKeyForWatchWallet csvファイルからpublicアドレスをimportする for WatchOnyWallet

func (*Wallet) SendFromFile

func (w *Wallet) SendFromFile(filePath string) (string, error)

SendFromFile 渡されたファイルから署名済transactionを読み取り、送信を行う

func (*Wallet) SendToAccount

func (w *Wallet) SendToAccount(from, to enum.AccountType, amount btcutil.Amount) (string, string, error)

SendToAccount 内部アカウント間での送金 amountが0のとき、全額送金する TODO:実行後、`listtransactions`methodで確認できるかも(未チェック)

func (*Wallet) SignatureFromFile

func (w *Wallet) SignatureFromFile(filePath string) (string, bool, string, error)

SignatureFromFile 渡されたファイルからtransactionを読み取り、署名を行う TODO:いずれにせよ、入金と出金で署名もMultisigかどうかで変わってくる

func (*Wallet) UpdateStatus

func (w *Wallet) UpdateStatus() error

UpdateStatus tx_paymentテーブル/tx_receiptテーブルのcurrent_tx_typeが3(送信済)のものを監視し、statusをupdateする

Jump to

Keyboard shortcuts

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