@@ -3,6 +3,7 @@ import { BufferComposer, ComposableBuffer } from '../../buffer/buffer_composer'
3
3
import { Script } from '../../tx'
4
4
import { CScript } from '../../tx_composer'
5
5
import { SmartBuffer } from 'smart-buffer'
6
+ import { readBigNumberUInt64 , writeBigNumberUInt64 } from '../../buffer/buffer_bignumber'
6
7
7
8
// Disabling no-return-assign makes the code cleaner with the setter and getter */
8
9
/* eslint-disable no-return-assign */
@@ -39,14 +40,14 @@ export class CPoolSwap extends ComposableBuffer<PoolSwap> {
39
40
ComposableBuffer . varUInt ( ( ) => ps . toTokenId , v => ps . toTokenId = v ) ,
40
41
{
41
42
fromBuffer ( buffer : SmartBuffer ) {
42
- const integer = new BigNumber ( buffer . readBigUInt64LE ( ) . toString ( ) )
43
- const fraction = new BigNumber ( buffer . readBigUInt64LE ( ) . toString ( ) )
43
+ const integer = readBigNumberUInt64 ( buffer )
44
+ const fraction = readBigNumberUInt64 ( buffer )
44
45
ps . maxPrice = { integer, fraction }
45
46
} ,
46
47
toBuffer ( buffer : SmartBuffer ) {
47
48
const { integer, fraction } = ps . maxPrice
48
- buffer . writeBigUInt64LE ( BigInt ( integer . toString ( 10 ) ) )
49
- buffer . writeBigUInt64LE ( BigInt ( fraction . toString ( 10 ) ) )
49
+ writeBigNumberUInt64 ( integer , buffer )
50
+ writeBigNumberUInt64 ( fraction , buffer )
50
51
}
51
52
}
52
53
]
0 commit comments