Write a script that uses the Scaf framework to build the package and deploy it.
Step 1 - Create a Sui Move Package
From the main directory you can create a new package by running:
so in this case, we created a new package by running
If the sui CLI is not installed yet, you will need to install it for
building the application. To install the SUI CLI.
Step 2 - Account Seed
Smart contracts on the Sui blockchain are deployed by accounts that are
characterized by a seed phrase. You should create a .env file on your local
directory.
Add the following on the .env file:
The SCHEMA is either Ed25519Keypair’, ‘Secp256k1Keypair’, or ‘Secp256r1Keypair’.
Step 3 - Write a Deployment Script
We will use JavaScript to build and deploy the Sui smart contract we wrote
in Step 1.
The first step is to load the seed phrase and create an “account” object
And then we can build and publish the package in one step:
We would like to deploy the new application in a local network which we can
spin in a very simple way by adding the following at the begging of our script:
So all the whole script will look like:
You can find it under ./scripts/lesson_2.js and you can run it. Then click on
the suiexplorer.com/address/ URL that will open a webpage with the
deployment transaction we just executed.