Skip to content

Commit

Permalink
[C-2857] Remove get blocknumber (#3802)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers committed Jul 26, 2023
1 parent 8b8954a commit 7534c5a
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1317,12 +1317,8 @@ 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,
metadata_time: currentBlock.timestamp
track: trackId
}))
const response = await audiusLibs.EntityManager.createPlaylist({
...metadata,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ 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 @@ -96,16 +95,10 @@ 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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const Artwork = (props: ArtworkProps) => {

useEffect(() => {
// If there's a gradient, this is a smart collection. Just immediately call back
if (image || gradient || imageOverride) callback()
if (image || gradient || imageOverride || image === '') callback()
}, [image, callback, gradient, imageOverride])

const handleEditArtwork = useCallback(() => {
Expand Down

0 comments on commit 7534c5a

Please sign in to comment.