mirror of
https://github.com/stronk-dev/RandomChad.git
synced 2025-07-05 02:35:08 +02:00
Fix namifuy and desc
This commit is contained in:
parent
1ddb83171d
commit
908a55fe35
@ -23,7 +23,7 @@ contract Rocketeer is ERC721Tradable {
|
||||
{
|
||||
|
||||
// Birth the genesis Rocketeers
|
||||
for( uint i=0; i < 50; i++ ) {
|
||||
for( uint i=0; i < 10; i++ ) {
|
||||
spawnRocketeer( owner() );
|
||||
}
|
||||
|
||||
|
@ -42,6 +42,15 @@ exports.pickRandomAttributes = ( attributes ) => {
|
||||
|
||||
}
|
||||
|
||||
const nameColor = require('color-namer')
|
||||
exports.getColorName = ( rgb ) => {
|
||||
try {
|
||||
return nameColor( rgb ).basic[0].name
|
||||
} catch( e ) {
|
||||
return rgb
|
||||
}
|
||||
}
|
||||
|
||||
// ///////////////////////////////
|
||||
// Attribute sources
|
||||
// ///////////////////////////////
|
||||
|
@ -1,9 +1,9 @@
|
||||
const name = require( 'random-name' )
|
||||
const { db } = require( './firebase' )
|
||||
const { getTotalSupply } = require( './contract' )
|
||||
const { pickRandomArrayEntry, pickRandomAttributes, randomNumberBetween, globalAttributes, heavenlyBodies, web2domain, lorem } = require( './helpers' )
|
||||
const { pickRandomArrayEntry, pickRandomAttributes, randomNumberBetween, globalAttributes, heavenlyBodies, web2domain, lorem, getColorName } = require( './helpers' )
|
||||
const svgFromAttributes = require( './svg-generator' )
|
||||
const nameColor = require('color-namer')
|
||||
|
||||
|
||||
// ///////////////////////////////
|
||||
// Caching
|
||||
@ -53,7 +53,7 @@ async function generateRocketeer( id, network='mainnet' ) {
|
||||
// The base object of a new Rocketeer
|
||||
const rocketeer = {
|
||||
name: `${ name.first() } ${ name.middle() } ${ name.last() } of ${ id % 42 == 0 ? 'the Towel' : pickRandomArrayEntry( heavenlyBodies ) }`,
|
||||
description: lorem,
|
||||
description: '',
|
||||
image: ``,
|
||||
external_url: `https://viewer.rocketeer.fans/?rocketeer=${ id }` + ( network == 'mainnet' ? '' : '&testnet=true' ),
|
||||
attributes: []
|
||||
@ -101,11 +101,14 @@ async function generateRocketeer( id, network='mainnet' ) {
|
||||
if( !attribute.trait_type.includes( 'color' ) ) return attribute
|
||||
return {
|
||||
...attribute,
|
||||
value: nameColor( attribute.value )
|
||||
value: getColorName( attribute.value )
|
||||
}
|
||||
|
||||
} )
|
||||
|
||||
// Create description
|
||||
rocketeer.description = `${ rocketeer.name } is a proud member of the ${ rocketeer.attributes.find( ( { trait_type } ) => trait_type == 'patch' ).value } guild.`
|
||||
|
||||
// Save new Rocketeer
|
||||
await db.collection( `${ network }Rocketeers` ).doc( id ).set( rocketeer )
|
||||
|
||||
|
@ -77,7 +77,7 @@ module.exports = {
|
||||
// return new HDWalletProvider(MNEMONIC, rinkebyNodeUrl);
|
||||
return new LedgerWalletProvider( ledgerOptions, rinkebyNodeUrl );
|
||||
},
|
||||
gas: 5000000,
|
||||
gas: 29999944, // very very high
|
||||
network_id: 4,
|
||||
},
|
||||
live: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user