@@ -372,41 +372,40 @@ func updateOrInsertTransfers(chainID uint64, creator statementCreator, transfers
372372 }
373373
374374 dbFields := transferDBFields {
375- chainID : chainID ,
376- id : t .ID ,
377- blockHash : t .BlockHash ,
378- blockNumber : t .BlockNumber ,
379- timestamp : t .Timestamp ,
380- address : t .Address ,
381- transaction : t .Transaction ,
382- sender : t .From ,
383- receipt : t .Receipt ,
384- log : t .Log ,
385- transferType : t .Type ,
386- baseGasFees : t .BaseGasFees ,
387- multiTransactionID : t .MultiTransactionID ,
388- receiptStatus : receiptStatus ,
389- receiptType : receiptType ,
390- txHash : txHash ,
391- logIndex : logIndex ,
392- receiptBlockHash : blockHash ,
393- cumulativeGasUsed : cumulativeGasUsed ,
394- contractAddress : contractAddress ,
395- gasUsed : gasUsed ,
396- transactionIndex : transactionIndex ,
397- txType : txType ,
398- txProtected : txProtected ,
399- txGas : txGas ,
400- txGasPrice : txGasPrice ,
401- txGasTipCap : txGasTipCap ,
402- txGasFeeCap : txGasFeeCap ,
403- txValue : txValue ,
404- txNonce : txNonce ,
405- txSize : txSize ,
406- tokenAddress : tokenAddress ,
407- tokenID : tokenID ,
408- txFrom : txFrom ,
409- txTo : txTo ,
375+ chainID : chainID ,
376+ id : t .ID ,
377+ blockHash : t .BlockHash ,
378+ blockNumber : t .BlockNumber ,
379+ timestamp : t .Timestamp ,
380+ address : t .Address ,
381+ transaction : t .Transaction ,
382+ sender : t .From ,
383+ receipt : t .Receipt ,
384+ log : t .Log ,
385+ transferType : t .Type ,
386+ baseGasFees : t .BaseGasFees ,
387+ receiptStatus : receiptStatus ,
388+ receiptType : receiptType ,
389+ txHash : txHash ,
390+ logIndex : logIndex ,
391+ receiptBlockHash : blockHash ,
392+ cumulativeGasUsed : cumulativeGasUsed ,
393+ contractAddress : contractAddress ,
394+ gasUsed : gasUsed ,
395+ transactionIndex : transactionIndex ,
396+ txType : txType ,
397+ txProtected : txProtected ,
398+ txGas : txGas ,
399+ txGasPrice : txGasPrice ,
400+ txGasTipCap : txGasTipCap ,
401+ txGasFeeCap : txGasFeeCap ,
402+ txValue : txValue ,
403+ txNonce : txNonce ,
404+ txSize : txSize ,
405+ tokenAddress : tokenAddress ,
406+ tokenID : tokenID ,
407+ txFrom : txFrom ,
408+ txTo : txTo ,
410409 }
411410 txsDBFields = append (txsDBFields , dbFields )
412411 }
@@ -415,50 +414,49 @@ func updateOrInsertTransfers(chainID uint64, creator statementCreator, transfers
415414}
416415
417416type transferDBFields struct {
418- chainID uint64
419- id common.Hash
420- blockHash common.Hash
421- blockNumber * big.Int
422- timestamp uint64
423- address common.Address
424- transaction * types.Transaction
425- sender common.Address
426- receipt * types.Receipt
427- log * types.Log
428- transferType w_common.Type
429- baseGasFees string
430- multiTransactionID w_common.MultiTransactionIDType
431- receiptStatus * uint64
432- receiptType * uint8
433- txHash * common.Hash
434- logIndex * uint
435- receiptBlockHash * common.Hash
436- cumulativeGasUsed * uint64
437- contractAddress * common.Address
438- gasUsed * uint64
439- transactionIndex * uint
440- txType * uint8
441- txProtected * bool
442- txGas * uint64
443- txGasPrice * big.Int
444- txGasTipCap * big.Int
445- txGasFeeCap * big.Int
446- txValue * big.Int
447- txNonce * uint64
448- txSize * uint64
449- tokenAddress * common.Address
450- tokenID * big.Int
451- txFrom * common.Address
452- txTo * common.Address
417+ chainID uint64
418+ id common.Hash
419+ blockHash common.Hash
420+ blockNumber * big.Int
421+ timestamp uint64
422+ address common.Address
423+ transaction * types.Transaction
424+ sender common.Address
425+ receipt * types.Receipt
426+ log * types.Log
427+ transferType w_common.Type
428+ baseGasFees string
429+ receiptStatus * uint64
430+ receiptType * uint8
431+ txHash * common.Hash
432+ logIndex * uint
433+ receiptBlockHash * common.Hash
434+ cumulativeGasUsed * uint64
435+ contractAddress * common.Address
436+ gasUsed * uint64
437+ transactionIndex * uint
438+ txType * uint8
439+ txProtected * bool
440+ txGas * uint64
441+ txGasPrice * big.Int
442+ txGasTipCap * big.Int
443+ txGasFeeCap * big.Int
444+ txValue * big.Int
445+ txNonce * uint64
446+ txSize * uint64
447+ tokenAddress * common.Address
448+ tokenID * big.Int
449+ txFrom * common.Address
450+ txTo * common.Address
453451}
454452
455453func updateOrInsertTransfersDBFields (creator statementCreator , transfers []transferDBFields ) error {
456454 insert , err := creator .Prepare (`INSERT OR REPLACE INTO transfers
457- (network_id, hash, blk_hash, blk_number, timestamp, address, tx, sender, receipt, log, type, loaded, base_gas_fee, multi_transaction_id,
455+ (network_id, hash, blk_hash, blk_number, timestamp, address, tx, sender, receipt, log, type, loaded, base_gas_fee,
458456 status, receipt_type, tx_hash, log_index, block_hash, cumulative_gas_used, contract_address, gas_used, tx_index,
459457 tx_type, protected, gas_limit, gas_price_clamped64, gas_tip_cap_clamped64, gas_fee_cap_clamped64, amount_padded128hex, account_nonce, size, token_address, token_id, tx_from_address, tx_to_address)
460458 VALUES
461- (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )` )
459+ (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` )
462460 if err != nil {
463461 return err
464462 }
@@ -469,7 +467,7 @@ func updateOrInsertTransfersDBFields(creator statementCreator, transfers []trans
469467 txGasFeeCap := sqlite .BigIntToClampedInt64 (t .txGasFeeCap )
470468 txValue := sqlite .BigIntToPadded128BitsStr (t .txValue )
471469
472- _ , err = insert .Exec (t .chainID , t .id , t .blockHash , (* bigint .SQLBigInt )(t .blockNumber ), t .timestamp , t .address , & JSONBlob {t .transaction }, t .sender , & JSONBlob {t .receipt }, & JSONBlob {t .log }, t .transferType , t .baseGasFees , t . multiTransactionID ,
470+ _ , err = insert .Exec (t .chainID , t .id , t .blockHash , (* bigint .SQLBigInt )(t .blockNumber ), t .timestamp , t .address , & JSONBlob {t .transaction }, t .sender , & JSONBlob {t .receipt }, & JSONBlob {t .log }, t .transferType , t .baseGasFees ,
473471 t .receiptStatus , t .receiptType , t .txHash , t .logIndex , t .receiptBlockHash , t .cumulativeGasUsed , t .contractAddress , t .gasUsed , t .transactionIndex ,
474472 t .txType , t .txProtected , t .txGas , txGasPrice , txGasTipCap , txGasFeeCap , txValue , t .txNonce , t .txSize , t .tokenAddress , (* bigint .SQLBigIntBytes )(t .tokenID ), t .txFrom , t .txTo )
475473 if err != nil {
@@ -558,16 +556,6 @@ func markBlocksAsLoaded(chainID uint64, creator statementCreator, address common
558556 return nil
559557}
560558
561- // GetOwnedMultiTransactionID returns sql.ErrNoRows if no transaction is found for the given identity
562- func GetOwnedMultiTransactionID (tx * sql.Tx , chainID w_common.ChainID , hash common.Hash , address common.Address ) (mTID int64 , err error ) {
563- row := tx .QueryRow (`SELECT COALESCE(multi_transaction_id, 0) FROM transfers WHERE network_id = ? AND tx_hash = ? AND address = ?` , chainID , hash , address )
564- err = row .Scan (& mTID )
565- if err != nil {
566- return 0 , err
567- }
568- return mTID , nil
569- }
570-
571559func (db * Database ) GetLatestCollectibleTransfer (address common.Address , id thirdparty.CollectibleUniqueID ) (* Transfer , error ) {
572560 query := newTransfersQuery ().
573561 FilterAddress (address ).
0 commit comments