LAB: Create a User, Project And Collection

Transcript

Toggle full transcript
00:00

Hello and welcome back. In this lab, we're going to take the next step and create a user project and collection within ImmutableX.

00:10

This will then pave the way for us to be able to mint our first NFT on ImmutableX. The first thing we need to do is to register our user within ImmutableX.

00:20

ImmutableX has the concept of users that correspond 1 to 1 with their wallet. So all we need to do, again, we've got a helpful

00:30

command here that does a lot of the work for us. And what this does is it takes the wallet that we previously

00:40

generated and that we put in our .env file. Up the top here is the owner account and essentially passes that to the ImmutableX user registration API.

00:50

If you want to see the code behind that, you can go to src/onboarding/1-user-registration.ts And you can see the

01:00

code that actually interacts with the ImmutableX API. You can see here we create an ImmutableX client. We set up a signer on that client using the wallet from our private key

01:10

connected to our Alchemy provider. We then check whether or not that user already exists within ImmutableX.

01:20

And if it doesn't, we call the user.register() IMX API call. And then as you can see here, the user has been successfully created

01:30

in this instance. The second step is to register an email address with the ImmutableX Developer Hub.

01:40

This is necessary in order to give you the permission to be able to create a project. So in order to do this, all we need to do is click through to the ImmutableX developer hub that

01:50

will guide you through a process of signing up and answering some questions. In this case, I've already registered an account and

02:00

I'm already logged in. Feel free to pause the video at this point while you perform the registration process. Once you've registered an account, you just need to take

02:10

note of the email address that you've actually used to register because you're going to need that.

02:20

So the next step then is to create our ImmutableX project that is going to house our NFT collection. In ImmutableX, a project is an administration

02:30

grouping that is associated with your wallet. Once you create a project, then that wallet will be able to create one

02:40

or more collections within that project. Each collection is associated 1 to 1 with an IMX compatible ERC-721 smart contract that is deployed to the underlying

02:50

Ethereum blockchain. When you mint NFTs on ImmutableX, these NFTs are minted within the context of the collection that's associated with your smart

03:00

contract. To create a project, we go back to our .env file and we scroll down to the project's details section.

03:10

Now you can come up with a project name and a company name. But the key thing here is that you just need to make sure that the email address that

03:20

you've registered is headed into the project email field. So

03:30

I'm just going to fill in a project name of Makerversity Lab and a company name of Makerversity in this instance.

03:40

And then, again, we've got a helpful command that you can run here. In

03:50

this case, If you want to see the code behind this command, you can go to src/onboarding/2-create-project.ts.

04:00

It's very similar to the previous user registration one, except the API call that is being made is user.createProject() instead of the previous one.

04:10

And we can see here that it's called this API. We got 201 CREATED back and a message of created

04:20

project with ID 1579. So we can now follow this instruction here and actually copy this value here and update

04:30

our .env and you'll see that there's a line waiting for us to fill that in and then we can save that. The next step

04:40

then, is to create a collection within our project. So before we create this collection, there's some values in the

04:50

EMV file that you might want to change. So you can change the collection name. In this case, I'm just going to call it Makerveristy Lab

05:00

NFTs. And if you want, you can change the description, the icon and the image URL. I'm just going to keep those the same in this case

05:10

and save that file again to create the collection. We've got a helpful command that you can run.

05:20

So if we copy that one there and execute it, we can see that again, there's a script here that we can have a look at if we're interested in this

05:30

case. It's 3-create-collection.ts. And again, the structure of this script is very similar to the previous two, except that the API call

05:40

is user.createCollection(). We can see here that that API call has succeeded and we've

05:50

dumped out the response that that API has given us. So we can see we've actually created this collection on ImmutableX, which is very exciting.

06:00

And that takes us to the end of this lab. In this lab we've basically set up all of the behind the scenes registrations on ImmutableX that we need to do to get to the point where we can actually mint an NFT.

06:10

So we've registered a user corresponding to our wallet. We've registered our email address in the Emacs developer hub.

06:20

We've created a project on ImmutableX and then we've created a collection that corresponds to the smart contract that we deployed to

06:30

Ethereum. I'll see you in the next lab and can start actually minting some NFTs.