@@ -35,7 +35,7 @@ export class CohortBidder {
35
35
36
36
constructor (
37
37
public accountset : Accountset ,
38
- public cohortId : number ,
38
+ public cohortFrameId : number ,
39
39
public subaccounts : { index : number ; isRebid : boolean ; address : string } [ ] ,
40
40
public options : {
41
41
minBid : bigint ;
@@ -46,7 +46,7 @@ export class CohortBidder {
46
46
tipPerTransaction ?: bigint ;
47
47
} ,
48
48
) {
49
- this . history = new CohortBidderHistory ( cohortId , subaccounts ) ;
49
+ this . history = new CohortBidderHistory ( cohortFrameId , subaccounts ) ;
50
50
this . subaccounts . forEach ( x => {
51
51
this . myAddresses . add ( x . address ) ;
52
52
} ) ;
@@ -55,17 +55,17 @@ export class CohortBidder {
55
55
public async stop ( ) : Promise < CohortBidder [ 'stats' ] > {
56
56
if ( this . isStopped ) return this . stats ;
57
57
this . isStopped = true ;
58
- console . log ( 'Stopping bidder for cohort' , this . cohortId ) ;
58
+ console . log ( 'Stopping bidder for cohort' , this . cohortFrameId ) ;
59
59
clearTimeout ( this . retryTimeout ) ;
60
60
if ( this . unsubscribe ) {
61
61
this . unsubscribe ( ) ;
62
62
}
63
63
const client = await this . client ;
64
- const [ nextCohortId , isBiddingOpen ] = await client . queryMulti < [ u64 , Bool ] > ( [
65
- client . query . miningSlot . nextCohortId as any ,
64
+ const [ nextFrameId , isBiddingOpen ] = await client . queryMulti < [ u64 , Bool ] > ( [
65
+ client . query . miningSlot . nextFrameId as any ,
66
66
client . query . miningSlot . isNextSlotBiddingOpen ,
67
67
] ) ;
68
- if ( nextCohortId . toNumber ( ) === this . cohortId && isBiddingOpen . isTrue ) {
68
+ if ( nextFrameId . toNumber ( ) === this . cohortFrameId && isBiddingOpen . isTrue ) {
69
69
console . log ( 'Bidding is still open, waiting for it to close' ) ;
70
70
await new Promise < void > ( async resolve => {
71
71
const unsub = await client . query . miningSlot . isNextSlotBiddingOpen ( isOpen => {
@@ -83,19 +83,19 @@ export class CohortBidder {
83
83
let header = await client . rpc . chain . getHeader ( ) ;
84
84
while ( true ) {
85
85
const api = await client . at ( header . hash ) ;
86
- const cohortId = await api . query . miningSlot . nextCohortId ( ) ;
87
- if ( cohortId . toNumber ( ) === this . cohortId ) {
86
+ const frameId = await api . query . miningSlot . nextFrameId ( ) ;
87
+ if ( frameId . toNumber ( ) === this . cohortFrameId ) {
88
88
break ;
89
89
}
90
90
header = await client . rpc . chain . getHeader ( header . parentHash ) ;
91
91
}
92
92
const api = await client . at ( header . hash ) ;
93
93
const tick = await api . query . ticks . currentTick ( ) . then ( x => x . toNumber ( ) ) ;
94
- const cohort = await api . query . miningSlot . nextSlotCohort ( ) ;
94
+ const cohort = await api . query . miningSlot . bidsForNextSlotCohort ( ) ;
95
95
96
96
this . history . trackChange ( cohort , header . number . toNumber ( ) , tick , true ) ;
97
97
console . log ( 'Bidder stopped' , {
98
- cohortId : this . cohortId ,
98
+ cohortId : this . cohortFrameId ,
99
99
blockNumber : header . number . toNumber ( ) ,
100
100
tick,
101
101
cohort : cohort . map ( x => ( {
@@ -108,7 +108,7 @@ export class CohortBidder {
108
108
}
109
109
110
110
public async start ( ) {
111
- console . log ( `Starting cohort ${ this . cohortId } bidder` , {
111
+ console . log ( `Starting cohort ${ this . cohortFrameId } bidder` , {
112
112
maxBid : formatArgons ( this . options . maxBid ) ,
113
113
minBid : formatArgons ( this . options . minBid ) ,
114
114
bidIncrement : formatArgons ( this . options . bidIncrement ) ,
@@ -122,9 +122,9 @@ export class CohortBidder {
122
122
this . millisPerTick ??= await client . query . ticks . genesisTicker ( ) . then ( x => x . tickDurationMillis . toNumber ( ) ) ;
123
123
124
124
this . unsubscribe = await client . queryMulti < [ Vec < ArgonPrimitivesBlockSealMiningRegistration > , u64 ] > (
125
- [ client . query . miningSlot . nextSlotCohort as any , client . query . miningSlot . nextCohortId as any ] ,
126
- async ( [ next , nextCohortId ] ) => {
127
- if ( nextCohortId . toNumber ( ) === this . cohortId ) {
125
+ [ client . query . miningSlot . bidsForNextSlotCohort as any , client . query . miningSlot . nextFrameId as any ] ,
126
+ async ( [ next , nextFrameId ] ) => {
127
+ if ( nextFrameId . toNumber ( ) === this . cohortFrameId ) {
128
128
await this . checkSeats ( next ) ;
129
129
}
130
130
} ,
@@ -159,7 +159,7 @@ export class CohortBidder {
159
159
}
160
160
console . log (
161
161
'Checking bids for cohort' ,
162
- this . cohortId ,
162
+ this . cohortFrameId ,
163
163
this . subaccounts . map ( x => x . index ) ,
164
164
) ;
165
165
@@ -192,7 +192,6 @@ export class CohortBidder {
192
192
const fakeTx = await this . accountset . createMiningBidTx ( {
193
193
subaccounts : this . subaccounts ,
194
194
bidAmount : nextBid ,
195
- sendRewardsToSeed : true ,
196
195
} ) ;
197
196
let availableBalanceForBids = await api . query . system
198
197
. account ( this . accountset . txSubmitterPair . address )
@@ -219,7 +218,7 @@ export class CohortBidder {
219
218
}
220
219
221
220
if ( nextBid - lowestBid < MIN_INCREMENT ) {
222
- console . log ( `Can't make any more bids for ${ this . cohortId } with given constraints.` , {
221
+ console . log ( `Can't make any more bids for ${ this . cohortFrameId } with given constraints.` , {
223
222
lowestCurrentBid : formatArgons ( lowestBid ) ,
224
223
nextAttemptedBid : formatArgons ( nextBid ) ,
225
224
maxBid : formatArgons ( this . options . maxBid ) ,
@@ -285,7 +284,6 @@ export class CohortBidder {
285
284
const submitter = await this . accountset . createMiningBidTx ( {
286
285
subaccounts,
287
286
bidAmount : bidPerSeat ,
288
- sendRewardsToSeed : true ,
289
287
} ) ;
290
288
const tip = this . options . tipPerTransaction ?? 0n ;
291
289
const txResult = await submitter . submit ( {
@@ -319,7 +317,7 @@ export class CohortBidder {
319
317
if ( bidError ) throw bidError ;
320
318
} catch ( err ) {
321
319
this . lastBidTime = prevLastBidTime ;
322
- console . error ( `Error bidding for cohort ${ this . cohortId } :` , err ) ;
320
+ console . error ( `Error bidding for cohort ${ this . cohortFrameId } :` , err ) ;
323
321
clearTimeout ( this . retryTimeout ) ;
324
322
this . retryTimeout = setTimeout ( ( ) => void this . checkCurrentSeats ( ) , 1000 ) ;
325
323
} finally {
@@ -334,7 +332,7 @@ export class CohortBidder {
334
332
335
333
private async checkCurrentSeats ( ) {
336
334
const client = await this . client ;
337
- const next = await client . query . miningSlot . nextSlotCohort ( ) ;
335
+ const next = await client . query . miningSlot . bidsForNextSlotCohort ( ) ;
338
336
await this . checkSeats ( next ) ;
339
337
}
340
338
}
0 commit comments