@@ -24,6 +24,7 @@ import {
2424 RuneUtxoBalance ,
2525 RunestoneStorage ,
2626} from './types' ;
27+ import { SpacedRune } from '../spacedrune' ;
2728
2829function isScriptPubKeyHexOpReturn ( scriptPubKeyHex : string ) {
2930 return scriptPubKeyHex && Buffer . from ( scriptPubKeyHex , 'hex' ) [ 0 ] === OP_RETURN ;
@@ -330,6 +331,7 @@ export class RuneUpdater implements RuneBlockIndex {
330331 if (
331332 rune . value < this . _minimum . value ||
332333 rune . reserved ||
334+ this . etchings . find ( ( etching ) => etching . rune === rune . toString ( ) ) ||
333335 ( await this . _storage . getRuneLocation ( rune . toString ( ) ) ) !== null ||
334336 ! ( await this . txCommitsToRune ( tx , rune ) )
335337 ) {
@@ -507,26 +509,12 @@ export class RuneUpdater implements RuneBlockIndex {
507509 const { divisibility, terms, premine, spacers, symbol } = artifact . etching . unwrap ( ) ;
508510 this . etchings . push ( {
509511 valid : true ,
510- rune : rune . toString ( ) ,
512+ rune : new SpacedRune ( rune , Number ( spacers . map ( Number ) . unwrapOr ( 0 ) ) ) . toString ( ) ,
511513 runeId,
512514 txid,
513515 ...( divisibility . isSome ( ) ? { divisibility : divisibility . map ( Number ) . unwrap ( ) } : { } ) ,
514516 ...( premine . isSome ( ) ? { premine : premine . unwrap ( ) } : { } ) ,
515517 ...( symbol . isSome ( ) ? { symbol : symbol . unwrap ( ) } : { } ) ,
516- ...( spacers . isSome ( )
517- ? {
518- spacers : ( ( ) => {
519- const spacersNumber = Number ( spacers . unwrap ( ) ) ;
520- const spacersArray : number [ ] = [ ] ;
521- for ( const [ i ] of new Array ( 32 ) . entries ( ) ) {
522- if ( ( spacersNumber & ( 1 << i ) ) !== 0 ) {
523- spacersArray . push ( i ) ;
524- }
525- }
526- return spacersArray ;
527- } ) ( ) ,
528- }
529- : { } ) ,
530518 ...( terms . isSome ( )
531519 ? {
532520 terms : ( ( ) => {
0 commit comments