Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!DOCTYPE html>
<html>
<head>
    <title>Page Title</title>
    <style>
        html, body {
            height: 100%;
            width: 95%;
        }
        body {
            background-image: url('https://uploads-ssl.webflow.com/62624e283b503f3e68275638/65f6cd25f859eed35344f7c8_forged-items.png');
            background-size: 40%;
            background-position: right;
            background-repeat: no-repeat;
        }
    </style>
</head>
<body>
<div id='form'>
  <h2>Your Web3 Game</H2>
    <h3>Forge Items Into an NFT Collection</h3>
    <input id="inputText" type="text" placeholder="Enter a name" />
    <input id="inputText2" type="text" placeholder="Enter a symbol" />
    <input id="inputText3" type="text" placeholder="Enter an owner" />
</div>
<div id='form2'>
    <input id="key" type="text" placeholder="Enter API key" />
</div>
<div id='form3'>
    <button id="get">Mint NFTs</button>
</div>
<div id="result"></div>
<div id="time"></div>
<div id="contractAddress"></div>
</body>
</html>
              
            
!

CSS

              
                body {
    font-family: Poppins, sans-serif;
    background-color: transparent;
    color: black;
    text-align: left;
    margin-left: 30px;
    margin-right: 200px;
    font-size: 35px;
}

h2 {
    font-size: 32px;
}

h3 {
    font-size: 16px;
}
#get {
  font-family: Poppins, sans-serif;
  width: 30%;
  padding: 10px 20px;
  font-size: 18px;
  border-radius: 5px;
  border: 1px solid transparent;
  background-color: #4237ff;
  margin-top: 10px;
  color: white;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

#get:hover {
  background-color: white;
  color: #4237ff;
  border-color: #4237ff;
}

input[type="text"],
button {
  width: 40%;
  padding: 8px 20px;
  font-size: 16px;
  border-radius: 5px;
  border: 1px solid #e4e4e4;
  margin-bottom: 10px;
  margin-right: 300px
}

#contractAddress {
    margin-top: 10px;
    font-size: 20px;
}

#result {
    margin-top: 10px;
    font-size: 20px;
}

#time {
    margin-top: 10px;
    font-size: 20px;
}

              
            
!

JS

              
                import { TatumSDK, Network, Ethereum, ResponseDto } from "https://cdn.skypack.dev/@tatumio/tatum";

const button = document.getElementById("get");
const resultContainer = document.getElementById("result");
const timeContainer = document.getElementById("time");
const contractContainer = document.getElementById("contractAddress");


let collectionAddress;

button.addEventListener("click", async () => {
  
  // Get the input from the text input field
  const key = document.getElementById("key").value;
  const name = document.getElementById("inputText").value;
  const symbol = document.getElementById("inputText2").value;
  const owner = document.getElementById("inputText3").value;
  
const tatum = await TatumSDK.init<Ethereum>({ network: Network.ETHEREUM_SEPOLIA,  apiKey: {v4: key}});
  // Create NFT collection
  const tx = await tatum.nft.createNftCollection({
    name: name, 
    symbol: symbol,
    owner: "0xCAE83F10d87C0Ac550A86dA8eB4b786085135447"
  });
  
  console.log(tx.data.txId);
  
  // Display the result
  resultContainer.innerHTML = `
    <p>${tx.data.txId}</p>
  `;

  while (!collectionAddress) {
    await printTimeWithDelay(5); // Wait for 5 seconds before the next iteration
    collectionAddress = await tatum.rpc.getContractAddress(tx.data.txId);
    console.log(collectionAddress);
  }

  // Display the result
  contractContainer.innerHTML = `
    <p>${collectionAddress}</p>
  `;
});

async function printTimeWithDelay(delayInSeconds: number) {
  await new Promise(resolve => setTimeout(resolve, delayInSeconds * 1000));
}
              
            
!
999px

Console