Documentation ¶
Index ¶
- func GetRedeedScriptByAddress(accountKeys []AccountKeyTable, addr string) string
- type AccountKeyTable
- type AccountPublicKeyTable
- type AddedPubkeyHistoryTable
- type DB
- func (m *DB) GetAddedPubkeyHistoryTableByNoWalletMultisigAddress(accountType enum.AccountType) ([]AddedPubkeyHistoryTable, error)
- func (m *DB) GetAddedPubkeyHistoryTableByNotExported(accountType enum.AccountType) ([]AddedPubkeyHistoryTable, error)
- func (m *DB) GetAllAccountKeyByKeyStatus(accountType enum.AccountType, keyStatus enum.KeyStatus) ([]AccountKeyTable, error)
- func (m *DB) GetAllAccountKeyByMultiAddrs(accountType enum.AccountType, addrs []string) ([]AccountKeyTable, error)
- func (m *DB) GetAllAccountPubKeyTable(accountType enum.AccountType) ([]AccountPublicKeyTable, error)
- func (m *DB) GetMaxIndexOnAccountKeyTable(accountType enum.AccountType) (int64, error)
- func (m *DB) GetOneByMaxIDOnAccountKeyTable(accountType enum.AccountType) (*AccountKeyTable, error)
- func (m *DB) GetOneUnAllocatedAccountPubKeyTable(accountType enum.AccountType) (*AccountPublicKeyTable, error)
- func (m *DB) GetPaymentRequestAll() ([]PaymentRequest, error)
- func (m *DB) GetPaymentRequestByPaymentID(paymentID int64) ([]PaymentRequest, error)
- func (m *DB) GetSeedAll() ([]Seed, error)
- func (m *DB) GetSeedCount() (int64, error)
- func (m *DB) GetSeedOne() (Seed, error)
- func (m *DB) GetSentTxHashByTxTypeDone(actionType enum.ActionType) ([]string, error)
- func (m *DB) GetSentTxHashByTxTypeSent(actionType enum.ActionType) ([]string, error)
- func (m *DB) GetTxByID(actionType enum.ActionType, id int64) (*TxTable, error)
- func (m *DB) GetTxCountByUnsignedHex(actionType enum.ActionType, hex string) (int64, error)
- func (m *DB) GetTxIDBySentHash(actionType enum.ActionType, hash string) (int64, error)
- func (m *DB) GetTxInputByReceiptID(actionType enum.ActionType, receiptID int64) ([]TxInput, error)
- func (m *DB) GetTxOutputByReceiptID(actionType enum.ActionType, receiptID int64) ([]TxOutput, error)
- func (m *DB) InsertAccountKeyTable(accountType enum.AccountType, accountKeyTables []AccountKeyTable, tx *sqlx.Tx, ...) error
- func (m *DB) InsertAccountPubKeyTable(accountType enum.AccountType, accountPubKeyTables []AccountPublicKeyTable, ...) error
- func (m *DB) InsertAddedPubkeyHistoryTable(accountType enum.AccountType, ...) error
- func (m *DB) InsertPaymentRequest(paymentRequests []PaymentRequest, tx *sqlx.Tx, isCommit bool) error
- func (m *DB) InsertSeed(seed string, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) InsertTxForUnsigned(actionType enum.ActionType, txReceipt *TxTable, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) InsertTxInputForUnsigned(actionType enum.ActionType, txReceiptInputs []TxInput, tx *sqlx.Tx, ...) error
- func (m *DB) InsertTxOutputForUnsigned(actionType enum.ActionType, txReceiptOutputs []TxOutput, tx *sqlx.Tx, ...) error
- func (m *DB) ResetAnyFlagOnPaymentRequestForTestOnly(tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateAccountOnAccountPubKeyTable(accountType enum.AccountType, accountKeyTable []AccountPublicKeyTable, ...) error
- func (m *DB) UpdateIsAllocatedOnAccountPubKeyTable(accountType enum.AccountType, accountKeyTable []AccountPublicKeyTable, ...) error
- func (m *DB) UpdateIsDoneOnPaymentRequest(paymentID int64, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateIsExportedOnAddedPubkeyHistoryTable(accountType enum.AccountType, ids []int64, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateKeyStatusByWIF(accountType enum.AccountType, keyStatus enum.KeyStatus, strWIF string, ...) (int64, error)
- func (m *DB) UpdateKeyStatusByWIFs(accountType enum.AccountType, keyStatus enum.KeyStatus, wifs []string, ...) (int64, error)
- func (m *DB) UpdateMultisigAddrOnAccountKeyTableByFullPubKey(accountType enum.AccountType, accountKeyTable []AccountKeyTable, tx *sqlx.Tx, ...) error
- func (m *DB) UpdateMultisigAddrOnAddedPubkeyHistoryTable(accountType enum.AccountType, ...) error
- func (m *DB) UpdatePaymentIDOnPaymentRequest(paymentID int64, ids []int64, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateTxAfterSent(actionType enum.ActionType, txReceipt *TxTable, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateTxTypeDoneByID(actionType enum.ActionType, ID int64, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateTxTypeDoneByTxHash(actionType enum.ActionType, hash string, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateTxTypeNotifiedByID(actionType enum.ActionType, ID int64, tx *sqlx.Tx, isCommit bool) (int64, error)
- func (m *DB) UpdateTxTypeNotifiedByTxHash(actionType enum.ActionType, hash string, tx *sqlx.Tx, isCommit bool) (int64, error)
- type PaymentRequest
- type Seed
- type TxInput
- type TxOutput
- type TxTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRedeedScriptByAddress ¶
func GetRedeedScriptByAddress(accountKeys []AccountKeyTable, addr string) string
GetRedeedScriptByAddress 与えられたmultiSigアドレスから、RedeemScriptを取得する
Types ¶
type AccountKeyTable ¶
type AccountKeyTable struct { ID int64 `db:"id"` WalletAddress string `db:"wallet_address"` P2shSegwitAddress string `db:"p2sh_segwit_address"` FullPublicKey string `db:"full_public_key"` WalletMultisigAddress string `db:"wallet_multisig_address"` RedeemScript string `db:"redeem_script"` WalletImportFormat string `db:"wallet_import_format"` Account string `db:"account"` Idx uint32 `db:"idx"` KeyStatus uint8 `db:"key_status"` UpdatedAt *time.Time `db:"updated_at"` }
AccountKeyTable account_key_clientテーブル
type AccountPublicKeyTable ¶
type AccountPublicKeyTable struct { ID int64 `db:"id"` WalletAddress string `db:"wallet_address"` Account string `db:"account"` IsAllocated bool `db:"is_allocated"` UpdatedAt *time.Time `db:"updated_at"` }
AccountPublicKeyTable account_key_clientテーブル
type AddedPubkeyHistoryTable ¶
type AddedPubkeyHistoryTable struct { ID int64 `db:"id"` FullPublicKey string `db:"full_public_key"` AuthAddress1 string `db:"auth_address1"` AuthAddress2 string `db:"auth_address2"` WalletMultisigAddress string `db:"wallet_multisig_address"` RedeemScript string `db:"redeem_script"` IsExported bool `db:"is_exported"` UpdatedAt *time.Time `db:"updated_at"` }
AddedPubkeyHistoryTable added_pubkey_historyテーブル
type DB ¶
DB データベースオブジェクト 複数のDBがある場合、こちらを拡張していく
func (*DB) GetAddedPubkeyHistoryTableByNoWalletMultisigAddress ¶
func (m *DB) GetAddedPubkeyHistoryTableByNoWalletMultisigAddress(accountType enum.AccountType) ([]AddedPubkeyHistoryTable, error)
GetAddedPubkeyHistoryTableByNoWalletMultisigAddress WalletMultisigAddressが発行されていないレコードを返す
func (*DB) GetAddedPubkeyHistoryTableByNotExported ¶
func (m *DB) GetAddedPubkeyHistoryTableByNotExported(accountType enum.AccountType) ([]AddedPubkeyHistoryTable, error)
GetAddedPubkeyHistoryTableByNotExported WalletMultisigAddressが発行済かつ、exportされていないレコードを返す
func (*DB) GetAllAccountKeyByKeyStatus ¶
func (m *DB) GetAllAccountKeyByKeyStatus(accountType enum.AccountType, keyStatus enum.KeyStatus) ([]AccountKeyTable, error)
GetAllAccountKeyByKeyStatus 指定したkeyStatusのレコードをすべて返す
func (*DB) GetAllAccountKeyByMultiAddrs ¶
func (m *DB) GetAllAccountKeyByMultiAddrs(accountType enum.AccountType, addrs []string) ([]AccountKeyTable, error)
GetAllAccountKeyByMultiAddrs WIPをmultiAddressから取得する
func (*DB) GetAllAccountPubKeyTable ¶
func (m *DB) GetAllAccountPubKeyTable(accountType enum.AccountType) ([]AccountPublicKeyTable, error)
GetAllAccountPubKeyTable account_pubkey_table(client, payment, receipt...)テーブルから全レコードを取得
func (*DB) GetMaxIndexOnAccountKeyTable ¶
func (m *DB) GetMaxIndexOnAccountKeyTable(accountType enum.AccountType) (int64, error)
GetMaxIndexOnAccountKeyTable indexの最大値を返す
func (*DB) GetOneByMaxIDOnAccountKeyTable ¶
func (m *DB) GetOneByMaxIDOnAccountKeyTable(accountType enum.AccountType) (*AccountKeyTable, error)
GetOneByMaxIDOnAccountKeyTable idが最大の1レコードを返す
func (*DB) GetOneUnAllocatedAccountPubKeyTable ¶
func (m *DB) GetOneUnAllocatedAccountPubKeyTable(accountType enum.AccountType) (*AccountPublicKeyTable, error)
GetOneUnAllocatedAccountPubKeyTable account_pubkey_table(client, payment, receipt...)テーブルからis_allocated=falseの1レコードを取得
func (*DB) GetPaymentRequestAll ¶
func (m *DB) GetPaymentRequestAll() ([]PaymentRequest, error)
GetPaymentRequestAll PaymentRequestテーブル全体を返す
func (*DB) GetPaymentRequestByPaymentID ¶
func (m *DB) GetPaymentRequestByPaymentID(paymentID int64) ([]PaymentRequest, error)
GetPaymentRequestByPaymentID PaymentRequestテーブル全体を返す
func (*DB) GetSeedAll ¶
GetSeedAll seedテーブル全体を返す(しかし、1行しかない想定)
func (*DB) GetSentTxHashByTxTypeDone ¶
func (m *DB) GetSentTxHashByTxTypeDone(actionType enum.ActionType) ([]string, error)
GetSentTxHashByTxTypeDone tx_typeが`done`のステータスであるsent_hash_txの配列を返す
func (*DB) GetSentTxHashByTxTypeSent ¶
func (m *DB) GetSentTxHashByTxTypeSent(actionType enum.ActionType) ([]string, error)
GetSentTxHashByTxTypeSent tx_typeが`sent`であるsent_hash_txの配列を返す
func (*DB) GetTxCountByUnsignedHex ¶
GetTxCountByUnsignedHex unsigned_hex_txをキーとしてレコード数を取得する
func (*DB) GetTxIDBySentHash ¶
GetTxIDBySentHash sent_hash_txをキーとしてreceipt_idを取得する
func (*DB) GetTxInputByReceiptID ¶
GetTxInputByReceiptID 該当するIDのレコードを返す
func (*DB) GetTxOutputByReceiptID ¶
func (m *DB) GetTxOutputByReceiptID(actionType enum.ActionType, receiptID int64) ([]TxOutput, error)
GetTxOutputByReceiptID 該当するIDのレコードを返す
func (*DB) InsertAccountKeyTable ¶
func (m *DB) InsertAccountKeyTable(accountType enum.AccountType, accountKeyTables []AccountKeyTable, tx *sqlx.Tx, isCommit bool) error
InsertAccountKeyTable account_key_table(client, payment, receipt...)テーブルにレコードを作成する
func (*DB) InsertAccountPubKeyTable ¶
func (m *DB) InsertAccountPubKeyTable(accountType enum.AccountType, accountPubKeyTables []AccountPublicKeyTable, tx *sqlx.Tx, isCommit bool) error
InsertAccountPubKeyTable account_pubkey_table(client, payment, receipt...)テーブルにレコードを作成する
func (*DB) InsertAddedPubkeyHistoryTable ¶
func (m *DB) InsertAddedPubkeyHistoryTable(accountType enum.AccountType, addedPubkeyHistoryTables []AddedPubkeyHistoryTable, tx *sqlx.Tx, isCommit bool) error
InsertAddedPubkeyHistoryTable added_pubkey_history_table(payment, receipt...)テーブルにレコードを作成する
func (*DB) InsertPaymentRequest ¶
func (m *DB) InsertPaymentRequest(paymentRequests []PaymentRequest, tx *sqlx.Tx, isCommit bool) error
InsertPaymentRequest PaymentRequestテーブルに出金依頼レコードを作成する TODO:BulkInsertがやりたい
func (*DB) InsertSeed ¶
InsertSeed レコードをinsertする
func (*DB) InsertTxForUnsigned ¶
func (m *DB) InsertTxForUnsigned(actionType enum.ActionType, txReceipt *TxTable, tx *sqlx.Tx, isCommit bool) (int64, error)
InsertTxForUnsigned 未署名トランザクションレコードを作成する
func (*DB) InsertTxInputForUnsigned ¶
func (m *DB) InsertTxInputForUnsigned(actionType enum.ActionType, txReceiptInputs []TxInput, tx *sqlx.Tx, isCommit bool) error
InsertTxInputForUnsigned 未署名トランザクションのinputに使われたtxレコードを作成する TODO:BulkInsertがやりたい
func (*DB) InsertTxOutputForUnsigned ¶
func (m *DB) InsertTxOutputForUnsigned(actionType enum.ActionType, txReceiptOutputs []TxOutput, tx *sqlx.Tx, isCommit bool) error
InsertTxOutputForUnsigned 未署名トランザクションのoutputに使われたtxレコードを作成する TODO:BulkInsertがやりたい
func (*DB) ResetAnyFlagOnPaymentRequestForTestOnly ¶
ResetAnyFlagOnPaymentRequestForTestOnly テーブルを初期化する(テストでしか使用することはない)
func (*DB) UpdateAccountOnAccountPubKeyTable ¶
func (m *DB) UpdateAccountOnAccountPubKeyTable(accountType enum.AccountType, accountKeyTable []AccountPublicKeyTable, tx *sqlx.Tx, isCommit bool) error
UpdateAccountOnAccountPubKeyTable Accountを更新する
func (*DB) UpdateIsAllocatedOnAccountPubKeyTable ¶
func (m *DB) UpdateIsAllocatedOnAccountPubKeyTable(accountType enum.AccountType, accountKeyTable []AccountPublicKeyTable, tx *sqlx.Tx, isCommit bool) error
UpdateIsAllocatedOnAccountPubKeyTable IsAllocatedを更新する
func (*DB) UpdateIsDoneOnPaymentRequest ¶
func (m *DB) UpdateIsDoneOnPaymentRequest(paymentID int64, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateIsDoneOnPaymentRequest is_doneフィールドをtrueに更新する TODO:暫定で追加したのみ、実際の仕様に合わせて修正が必要 TODO:payment_idレコードを追加したので、is_doneフィールドはいらないかもしれない TODO:一応、通知まで終わったレコードはdoneにしておく
func (*DB) UpdateIsExportedOnAddedPubkeyHistoryTable ¶
func (m *DB) UpdateIsExportedOnAddedPubkeyHistoryTable(accountType enum.AccountType, ids []int64, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateIsExportedOnAddedPubkeyHistoryTable added_pubkey_history_table(payment, receipt...)テーブルのis_exportedを更新する
func (*DB) UpdateKeyStatusByWIF ¶
func (m *DB) UpdateKeyStatusByWIF(accountType enum.AccountType, keyStatus enum.KeyStatus, strWIF string, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateKeyStatusByWIF key_statusを更新する
func (*DB) UpdateKeyStatusByWIFs ¶
func (m *DB) UpdateKeyStatusByWIFs(accountType enum.AccountType, keyStatus enum.KeyStatus, wifs []string, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateKeyStatusByWIFs key_statusを更新する
func (*DB) UpdateMultisigAddrOnAccountKeyTableByFullPubKey ¶
func (m *DB) UpdateMultisigAddrOnAccountKeyTableByFullPubKey(accountType enum.AccountType, accountKeyTable []AccountKeyTable, tx *sqlx.Tx, isCommit bool) error
UpdateMultisigAddrOnAccountKeyTableByFullPubKey wallet_multisig_addressを更新する
func (*DB) UpdateMultisigAddrOnAddedPubkeyHistoryTable ¶
func (m *DB) UpdateMultisigAddrOnAddedPubkeyHistoryTable(accountType enum.AccountType, multiSigAddr, redeemScript, authAddr1, fullPublicKey string, tx *sqlx.Tx, isCommit bool) error
UpdateMultisigAddrOnAddedPubkeyHistoryTable added_pubkey_history_table(payment, receipt...)テーブルのmultisigアドレスを更新する
func (*DB) UpdatePaymentIDOnPaymentRequest ¶
func (m *DB) UpdatePaymentIDOnPaymentRequest(paymentID int64, ids []int64, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdatePaymentIDOnPaymentRequest 出金トランザクション作成済のレコードのpayment_idを更新する
func (*DB) UpdateTxAfterSent ¶
func (m *DB) UpdateTxAfterSent(actionType enum.ActionType, txReceipt *TxTable, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateTxAfterSent signed_hex_tx, sent_hash_txを更新する
func (*DB) UpdateTxTypeDoneByID ¶
func (m *DB) UpdateTxTypeDoneByID(actionType enum.ActionType, ID int64, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateTxTypeDoneByID 該当するIDのレコードのcurrnt_tx_typeを更新する
func (*DB) UpdateTxTypeDoneByTxHash ¶
func (m *DB) UpdateTxTypeDoneByTxHash(actionType enum.ActionType, hash string, tx *sqlx.Tx, isCommit bool) (int64, error)
UpdateTxTypeDoneByTxHash 該当するsent_hash_txのレコードのcurrnt_tx_typeを更新する
type PaymentRequest ¶
type PaymentRequest struct { ID int64 `db:"id"` PaymentID *int64 `db:"payment_id"` AddressFrom string `db:"address_from"` AccountFrom string `db:"account_from"` AddressTo string `db:"address_to"` Amount string `db:"amount"` IsDone bool `db:"is_done"` UpdatedAt *time.Time `db:"updated_at"` }
PaymentRequest payment_requestテーブル
type Seed ¶
type Seed struct { ID uint8 `db:"id"` Seed string `db:"seed"` UpdatedAt *time.Time `db:"updated_at"` }
Seed seedテーブル
type TxInput ¶
type TxInput struct { ID int64 `db:"id"` ReceiptID int64 `db:"receipt_id"` InputTxid string `db:"input_txid"` InputVout uint32 `db:"input_vout"` InputAddress string `db:"input_address"` InputAccount string `db:"input_account"` InputAmount string `db:"input_amount"` InputConfirmations int64 `db:"input_confirmations"` UpdatedAt *time.Time `db:"updated_at"` }
TxInput tx_receipt_input/tx_payment_inputテーブル
type TxOutput ¶
type TxOutput struct { ID int64 `db:"id"` ReceiptID int64 `db:"receipt_id"` OutputAddress string `db:"output_address"` OutputAccount string `db:"output_account"` OutputAmount string `db:"output_amount"` IsChange bool `db:"is_change"` UpdatedAt *time.Time `db:"updated_at"` }
TxOutput tx_receipt_output/tx_payment_outputテーブル
type TxTable ¶
type TxTable struct { ID int64 `db:"id"` UnsignedHexTx string `db:"unsigned_hex_tx"` SignedHexTx string `db:"signed_hex_tx"` SentHashTx string `db:"sent_hash_tx"` TotalInputAmount string `db:"total_input_amount"` //inputの合計 TotalOutputAmount string `db:"total_output_amount"` //outputの合計(input-feeがこの金額になるはず) Fee string `db:"fee"` TxType uint8 `db:"current_tx_type"` UnsignedUpdatedAt *time.Time `db:"unsigned_updated_at"` SignedUpdatedAt *time.Time `db:"signed_updated_at"` SentUpdatedAt *time.Time `db:"sent_updated_at"` }
TxTable tx_receipt/tx_paymentテーブル