From 8e8573f7d465c67752b2a1b85455092dec76a2e3 Mon Sep 17 00:00:00 2001 From: Cynthia Lang <39891200+cynsupercat@users.noreply.github.com> Date: Thu, 18 Jan 2024 10:10:46 +1100 Subject: [PATCH] Remove create projects file (#45) --- src/onboarding/2-create-project.ts | 48 --------------------------- src/onboarding/3-create-collection.ts | 7 ++-- 2 files changed, 2 insertions(+), 53 deletions(-) delete mode 100644 src/onboarding/2-create-project.ts diff --git a/src/onboarding/2-create-project.ts b/src/onboarding/2-create-project.ts deleted file mode 100644 index 82544fd..0000000 --- a/src/onboarding/2-create-project.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { Wallet } from '@ethersproject/wallet'; -import { ImLogger, WinstonLogger } from '@imtbl/imlogging'; -import { CreateProjectParams, ImmutableXClient } from '@imtbl/imx-sdk'; -import { getProvider, requireEnvironmentVariable } from 'libs/utils'; - -import env from '../config/client'; -import { loggerConfig } from '../config/logging'; - -const provider = getProvider(env.ethNetwork, env.alchemyApiKey); -const log: ImLogger = new WinstonLogger(loggerConfig); - -const component = '[IMX-CREATE-PROJECT]'; - -(async (): Promise => { - log.warn(component, 'Project registration via this repository will be deprecated on the 20th of January, 2024. In the future, please use https://hub.immutable.com to create new projects.') - const privateKey = requireEnvironmentVariable('OWNER_ACCOUNT_PRIVATE_KEY'); - - const signer = new Wallet(privateKey).connect(provider); - - const user = await ImmutableXClient.build({ - ...env.client, - signer, - enableDebug: true, - }); - - log.info(component, 'Creating project...'); - - /** - * Edit your values here - */ - const params: CreateProjectParams = { - name: 'YOUR_COLLECTION_NAME', - company_name: 'YOUR_COMPANY_NAME', - contact_email: 'your-dev-hub-email@immutable.com', // https://hub.immutable.com/ - }; - - let project; - try { - project = await user.createProject(params); - } catch (error) { - throw new Error(JSON.stringify(error, null, 2)); - } - - log.info(component, `Created project with ID: ${project.id}`); -})().catch(e => { - log.error(component, e); - process.exit(1); -}); diff --git a/src/onboarding/3-create-collection.ts b/src/onboarding/3-create-collection.ts index 234eb46..48d5c07 100644 --- a/src/onboarding/3-create-collection.ts +++ b/src/onboarding/3-create-collection.ts @@ -22,6 +22,7 @@ const component = '[IMX-CREATE-COLLECTION]'; 'COLLECTION_CONTRACT_ADDRESS', ); const projectId = requireEnvironmentVariable('COLLECTION_PROJECT_ID'); + const apiKey = requireEnvironmentVariable('API_KEY'); const wallet = new Wallet(privateKey); const signer = wallet.connect(provider); @@ -50,13 +51,9 @@ const component = '[IMX-CREATE-COLLECTION]'; 'Content-type': 'application/json', 'IMX-Signature': signature, 'IMX-Timestamp': timestamp, + 'x-immutable-api-key': apiKey, }; - const apiKey = getEnv('API_KEY'); - if (apiKey) { - headers['x-immutable-api-key'] = apiKey; - } - const resp = await axios.post( `${getEnv('PUBLIC_API_URL')}/collections`, createCollectionRequest,