Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: change feed index type to index #900

Merged
merged 2 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bee-debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,8 +760,9 @@
if (stamp.usable) {
return
}
} catch (error: any) {

Check warning on line 763 in src/bee-debug.ts

View workflow job for this annotation

GitHub Actions / check (16.x)

Unexpected any. Specify a different type
const message = error?.response?.data?.message || error?.message || ''

if (!message.includes('batch not usable')) {
throw error
}
Expand Down
6 changes: 3 additions & 3 deletions src/feed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
BatchId,
BeeRequestOptions,
BytesReference,
FEED_INDEX_HEX_LENGTH,
FeedReader,
FeedWriter,
FEED_INDEX_HEX_LENGTH,
PlainBytesReference,
Reference,
Signer,
Expand All @@ -19,7 +19,7 @@
import { Bytes, bytesAtOffset, makeBytes } from '../utils/bytes'
import { EthAddress, HexEthAddress, makeHexEthAddress } from '../utils/eth'
import { keccak256Hash } from '../utils/hash'
import { bytesToHex, HexString, hexToBytes, makeHexString } from '../utils/hex'
import { HexString, bytesToHex, hexToBytes, makeHexString } from '../utils/hex'
import { makeBytesReference } from '../utils/reference'
import { assertAddress } from '../utils/type'
import { readUint64BigEndian, writeUint64BigEndian } from '../utils/uint64'
Expand Down Expand Up @@ -59,7 +59,7 @@
const feedUpdate = await fetchLatestFeedUpdate(requestOptions, owner, topic, options)

return makeHexString(feedUpdate.feedIndexNext, FEED_INDEX_HEX_LENGTH)
} catch (e: any) {

Check warning on line 62 in src/feed/index.ts

View workflow job for this annotation

GitHub Actions / check (16.x)

Unexpected any. Specify a different type
if (e?.response?.status === 404) {
return bytesToHex(makeBytes(8))
}
Expand Down Expand Up @@ -125,7 +125,7 @@
owner,
topic,
async download(options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse> {
if (!options?.index && options?.index !== 0 {
if (!options?.index && options?.index !== 0) {
return fetchLatestFeedUpdate(requestOptions, owner, topic, { ...options, type })
}

Expand Down
5 changes: 3 additions & 2 deletions src/modules/feed.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Index } from '../feed'
import { FeedType } from '../feed/type'
import { BatchId, BeeRequestOptions, Reference, ReferenceResponse, Topic } from '../types'
import { BeeError } from '../utils/error'
Expand Down Expand Up @@ -25,14 +26,14 @@ export interface FeedUpdateOptions {
/**
* Fetch specific previous Feed's update (default fetches latest update)
*/
index?: string
index?: Index
}

interface FeedUpdateHeaders {
/**
* The current feed's index
*/
feedIndex: string
feedIndex: Index

/**
* The feed's index for next update.
Expand Down
Loading