mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 02:35:08 +02:00
Tesdy for testing
This commit is contained in:
parent
3d82e3f6ee
commit
ea099d5e88
@ -55,11 +55,6 @@ contract Rocketeer is ERC721Tradable {
|
||||
// No more than max supply
|
||||
require( nextTokenId <= ROCKETEER_MAX_SUPPLY, "Maximum Rocketeer supply reached" );
|
||||
|
||||
// Every 42nd unit becomes a special edition, gas fees paid for but not owned by the minter
|
||||
if( nextTokenId % 42 == 0 ) {
|
||||
mintTo( owner() );
|
||||
}
|
||||
|
||||
mintTo( _to );
|
||||
}
|
||||
|
||||
|
@ -2,8 +2,14 @@ const functions = require( 'firebase-functions' )
|
||||
const testnetAPI = require( './modules/testnet' )
|
||||
const mainnetAPI = require( './modules/mainnet' )
|
||||
|
||||
// Runtime config
|
||||
const runtime = {
|
||||
timeoutSeconds: 540,
|
||||
memory: '4GB'
|
||||
}
|
||||
|
||||
// Testnet endpoint
|
||||
exports.testnetMetadata = functions.https.onRequest( testnetAPI )
|
||||
exports.testnetMetadata = functions.runWith( runtime ).https.onRequest( testnetAPI )
|
||||
|
||||
// Mainnet endpoint
|
||||
exports.mainnetMetadata = functions.https.onRequest( mainnetAPI )
|
||||
exports.mainnetMetadata = functions.runWith( runtime ).https.onRequest( mainnetAPI )
|
@ -40,7 +40,7 @@ app.get( '/api/collection', async ( req, res ) => res.json( {
|
||||
totalSupply: await getTotalSupply( 'mainnet' ).catch( f => 'error' ),
|
||||
description: "A testnet collection",
|
||||
external_url: web2domain,
|
||||
image: "https://rocketpool.net/images/rocket.png",
|
||||
image: "https://rocketeer.web.app/assets/draft-rocketeer.png",
|
||||
name: `Rocketeer collection`,
|
||||
seller_fee_basis_points: 0,
|
||||
fee_recipient: "0x0"
|
||||
|
@ -79,11 +79,13 @@ async function generateRocketeer( id, network='mainnet' ) {
|
||||
value: `rgb( ${ randomNumberBetween( 0, 255 ) }, ${ randomNumberBetween( 0, 255 ) }, ${ randomNumberBetween( 0, 255 ) } )`
|
||||
} )
|
||||
|
||||
// Write to demo file
|
||||
// Special editions
|
||||
const edition = { "trait_type": "edition", value: "regular" }
|
||||
if( id > 50 ) edition.value = 'genesis'
|
||||
if( id % 42 === 0 ) edition.value = 'hitchhiker'
|
||||
|
||||
|
||||
// TODO: Generate, compile and upload image
|
||||
rocketeer.image = await svgFromAttributes( rocketeer.attributes )
|
||||
// Generate, compile and upload image
|
||||
rocketeer.image = await svgFromAttributes( rocketeer.attributes, `${ network }Rocketeers/${id}.svg` )
|
||||
|
||||
// Save new Rocketeer
|
||||
await db.collection( `${ network }Rocketeers` ).doc( id ).set( rocketeer )
|
||||
|
@ -6,7 +6,10 @@ const { promises: fs } = require( 'fs' )
|
||||
const { getStorage } = require( 'firebase-admin/storage' )
|
||||
|
||||
|
||||
module.exports = async function svgFromAttributes( attributes=[] ) {
|
||||
module.exports = async function svgFromAttributes( attributes=[], path='' ) {
|
||||
|
||||
if( !path.length ) throw new Error( 'svgFromAttributes missing path' )
|
||||
if( !attributes.length ) throw new Error( 'svgFromAttributes missing attributes' )
|
||||
|
||||
const { value: primary_color } = attributes.find( ( { trait_type } ) => trait_type == "outfit color" )
|
||||
const { value: accent_color } = attributes.find( ( { trait_type } ) => trait_type == "outfit accent color" )
|
||||
@ -119,7 +122,7 @@ module.exports = async function svgFromAttributes( attributes=[] ) {
|
||||
const bucket = storage.bucket()
|
||||
|
||||
// Make file reference
|
||||
const file = bucket.file( `rocketeers/demo-${ Date.now() }.svg` )
|
||||
const file = bucket.file( path )
|
||||
|
||||
// Save file buffer
|
||||
await file.save( bakedSvg )
|
||||
|
@ -2,7 +2,9 @@ const app = require( './express' )()
|
||||
const { getTotalSupply } = require( './contract' )
|
||||
const { safelyReturnRocketeer, web2domain } = require( './rocketeer' )
|
||||
|
||||
////////////////////////////////
|
||||
// Specific Rocketeer instances
|
||||
////////////////////////////////
|
||||
app.get( '/testnetapi/rocketeer/:id', async ( req, res ) => {
|
||||
|
||||
// Parse the request
|
||||
|
Loading…
x
Reference in New Issue
Block a user