@@ -12,18 +12,18 @@ import { BitcoinRpcClient } from '../rpcclient';
1212import { Rune } from '../rune' ;
1313import { Runestone } from '../runestone' ;
1414import { script } from '../script' ;
15+ import { SpacedRune } from '../spacedrune' ;
1516import {
1617 BlockInfo ,
17- RuneBlockIndex ,
1818 RuneBalance ,
19+ RuneBlockIndex ,
1920 RuneEtching ,
2021 RuneLocation ,
2122 RuneMintCount ,
22- RuneOutput ,
2323 RuneUtxoBalance ,
2424 RunestoneStorage ,
25+ SpentRuneUtxoBalance ,
2526} from './types' ;
26- import { SpacedRune } from '../spacedrune' ;
2727
2828function isScriptPubKeyHexOpReturn ( scriptPubKeyHex : string ) {
2929 return scriptPubKeyHex && Buffer . from ( scriptPubKeyHex , 'hex' ) [ 0 ] === OP_RETURN ;
@@ -39,7 +39,7 @@ export class RuneUpdater implements RuneBlockIndex {
3939 block : BlockInfo ;
4040 etchings : RuneEtching [ ] = [ ] ;
4141 utxoBalances : RuneUtxoBalance [ ] = [ ] ;
42- spentOutputs : RuneOutput [ ] = [ ] ;
42+ spentOutputs : SpentRuneUtxoBalance [ ] = [ ] ;
4343
4444 private _minimum : Rune ;
4545 private _mintCountsByRuneLocation : Map < string , RuneMintCount > = new Map ( ) ;
@@ -446,13 +446,22 @@ export class RuneUpdater implements RuneBlockIndex {
446446 const utxoBalance =
447447 utxoBalancesByOutputLocation . get ( `${ input . txid } :${ input . vout } ` ) ??
448448 ( await this . _storage . getUtxoBalance ( input . txid , input . vout ) ) ;
449- this . spentOutputs . push ( { txid : input . txid , vout : input . vout } ) ;
450449 for ( const additionalBalance of utxoBalance ) {
451450 const runeId = additionalBalance . runeId ;
452451 const runeLocation = RuneLocation . toString ( runeId ) ;
453452 const balance = unallocated . get ( runeLocation ) ?? { runeId, amount : 0n } ;
454453 unallocated . set ( runeLocation , balance ) ;
455454 balance . amount = u128 . checkedAddThrow ( u128 ( balance . amount ) , u128 ( additionalBalance . amount ) ) ;
455+ this . spentOutputs . push ( {
456+ txid : input . txid ,
457+ vout : input . vout ,
458+ address : additionalBalance . address ,
459+ scriptPubKey : additionalBalance . scriptPubKey ,
460+ runeId : additionalBalance . runeId ,
461+ runeTicker : additionalBalance . runeTicker ,
462+ amount : additionalBalance . amount ,
463+ mempoolTxid : tx . txid ,
464+ } ) ;
456465 }
457466 }
458467
0 commit comments