Skip to content

Commit

Permalink
[C-2857] Revert remove get blocknumber (#3802)" (#3826)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Jul 31, 2023
1 parent b2d6f1b commit 52322bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1317,8 +1317,12 @@ export const audiusBackend = ({
if (isAlbum) isPrivate = false

try {
const web3 = await audiusLibs.web3Manager.getWeb3()
const currentBlockNumber = await web3.eth.getBlockNumber()
const currentBlock = await web3.eth.getBlock(currentBlockNumber)
const playlistTracks = trackIds.map((trackId) => ({
track: trackId
track: trackId,
metadata_time: currentBlock.timestamp
}))
const response = await audiusLibs.EntityManager.createPlaylist({
...metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ function* addTrackToPlaylistAsync(action: AddTrackToPlaylistAction) {
FeatureFlags.PLAYLIST_UPDATES_POST_QA
)
const audiusBackendInstance = yield* getContext('audiusBackendInstance')
const web3 = yield* call(audiusBackendInstance.getWeb3)
const { generatePlaylistArtwork } = yield* getContext('imageUtils')

// Retrieve tracks with the the collection so we confirm with the
Expand Down Expand Up @@ -95,10 +96,16 @@ function* addTrackToPlaylistAsync(action: AddTrackToPlaylistAction) {
action.trackId,
`collection:${action.playlistId}`
)
const currentBlockNumber = yield* call([web3.eth, 'getBlockNumber'])
const currentBlock = (yield* call(
[web3.eth, 'getBlock'],
currentBlockNumber
)) as { timestamp: number }

playlist.playlist_contents = {
track_ids: playlist.playlist_contents.track_ids.concat({
track: action.trackId,
metadata_time: currentBlock?.timestamp as number,
time: 0,
uid: trackUid
})
Expand Down

0 comments on commit 52322bc

Please sign in to comment.