Skip to content

Commit

Permalink
feat: add null_topic and null_stamp (#958)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cafe137 authored Oct 24, 2024
1 parent 89bed32 commit 2f1072b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 10 additions & 5 deletions src/utils/expose.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import { BatchId, Topic } from '..'

export { getCollectionSize } from './collection'
export { getFolderSize } from './collection.node'

export {
Bytes,
FlexBytes,
assertBytes,
assertFlexBytes,
Bytes,
bytesAtOffset,
bytesEqual,
FlexBytes,
flexBytesAtOffset,
isBytes,
isFlexBytes,
} from './bytes'

export {
HexString,
PrefixedHexString,
assertHexString,
assertPrefixedHexString,
bytesToHex,
HexString,
hexToBytes,
intToHex,
isHexString,
makeHexString,
PrefixedHexString,
} from './hex'

export {
EthAddress,
capitalizeAddressERC55,
EthAddress,
ethToSwarmAddress,
fromLittleEndian,
isHexEthAddress,
Expand All @@ -52,3 +54,6 @@ export {
} from './stamps'

export { approximateOverheadForRedundancyLevel, getRedundancyStat, getRedundancyStats } from './redundancy'

export const NULL_STAMP: BatchId = '0000000000000000000000000000000000000000000000000000000000000000' as BatchId
export const NULL_TOPIC: Topic = '0000000000000000000000000000000000000000000000000000000000000000' as Topic
3 changes: 2 additions & 1 deletion test/integration/feed/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as chunkAPI from '../../../src/modules/chunk'
import { fetchLatestFeedUpdate } from '../../../src/modules/feed'
import type { BeeRequestOptions, BytesReference, PrivateKeyBytes, Signer, Topic } from '../../../src/types'
import { assertBytes, Bytes } from '../../../src/utils/bytes'
import { NULL_TOPIC } from '../../../src/utils/expose'
import { hexToBytes, makeHexString } from '../../../src/utils/hex'
import { beeKyOptions, getPostageBatch, testIdentity } from '../../utils'

Expand Down Expand Up @@ -44,7 +45,7 @@ describe('feed', () => {
const BEE_REQUEST_OPTIONS = beeKyOptions()
const owner = makeHexString(testIdentity.address, 40)
const signer = makePrivateKeySigner(hexToBytes(testIdentity.privateKey) as PrivateKeyBytes)
const topic = '0000000000000000000000000000000000000000000000000000000000000000' as Topic
const topic = NULL_TOPIC

it('empty feed update', async function () {
const emptyTopic = '1000000000000000000000000000000000000000000000000000000000000000' as Topic
Expand Down
3 changes: 2 additions & 1 deletion test/integration/modules/feed.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createFeedManifest, fetchLatestFeedUpdate } from '../../../src/modules/feed'
import { upload as uploadSOC } from '../../../src/modules/soc'
import type { Topic } from '../../../src/types'
import { NULL_TOPIC } from '../../../src/utils/expose'
import { HexString, hexToBytes, makeHexString } from '../../../src/utils/hex'
import { beeKyOptions, commonMatchers, getPostageBatch, testIdentity } from '../../utils'

Expand All @@ -9,7 +10,7 @@ commonMatchers()
describe('modules/feed', () => {
const BEE_REQUEST_OPTIONS = beeKyOptions()
const owner = makeHexString(testIdentity.address, 40)
const topic = '0000000000000000000000000000000000000000000000000000000000000000' as Topic
const topic = NULL_TOPIC

it('feed manifest creation', async function () {
const reference = '92442c3e08a308aeba8e2d231733ec57011a203354cad24129e7e0c37bac0cbe'
Expand Down

0 comments on commit 2f1072b

Please sign in to comment.