mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 10:35:08 +02:00
✨ draft update by address changing room
This commit is contained in:
parent
03c217b55b
commit
d10743413b
@ -85,9 +85,27 @@ async function generateNewOutfitFromId( id, network='mainnet' ) {
|
|||||||
|
|
||||||
// Generate, compile and upload image
|
// Generate, compile and upload image
|
||||||
// Path format of new rocketeers is id-outfitnumber.{svg,jpg}
|
// Path format of new rocketeers is id-outfitnumber.{svg,jpg}
|
||||||
const newOutfitSvg = await svgFromAttributes( rocketeer.attributes, `${ network }Rocketeers/${ id }-${ available_outfits + 1 }` )
|
try {
|
||||||
|
|
||||||
return newOutfitSvg
|
const newOutfitSvg = await svgFromAttributes( rocketeer.attributes, `${ network }Rocketeers/${ id }-${ available_outfits + 1 }` )
|
||||||
|
|
||||||
|
return newOutfitSvg
|
||||||
|
|
||||||
|
} catch( e ) {
|
||||||
|
|
||||||
|
// If the svg generation failed, reset the attributes to their previous value
|
||||||
|
await db.collection( `${ network }Rocketeers` ).doc( id ).set( {
|
||||||
|
attributes: [
|
||||||
|
...staticAttributes,
|
||||||
|
{ trait_type: 'available outfits', value: available_outfits, },
|
||||||
|
{ trait_type: 'last outfit change', value: last_outfit_change, display_type: "date" }
|
||||||
|
]
|
||||||
|
} ,{ merge: true } )
|
||||||
|
|
||||||
|
// Propagate error
|
||||||
|
throw e
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user