Security News
Research
Supply Chain Attack on Rspack npm Packages Injects Cryptojacking Malware
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
@1o1art/sdk
Advanced tools
1o1.art is a no-code NFT creator platform that empowers artists and businesses to create, manage and upgrade NFT smart contracts. This is the developer sdk, that can be used in conjuntion with the app, to manage, mint, and update your NFTs. You can build your own platform on top of 1o1, using the sdk.
Let's discover 1o1.art sdk in less than 5 minutes.
Get started by installing the sdk client.
mkdir 1o1-first-project
cd 1o1-first-project/
npm install @1o1art/sdk
# install dotenv for convenience
npm install dotenv
Let's write down a few environment variables, for this example we're
using the default hardhat private key and an infura rpc url that we setup
for this example. Be sure to replace PRIV_KEY=
with your own private key
without the 0x prefix.
touch .env
# Add the following to your environment variables
#Add your private key
PRIV_KEY=ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
# Any RPC URL node can be used for a supported network. Replace this with your own key/endpoint
RPC_URL=https://polygon-mumbai.infura.io/v3/0552fa11cf9f4c78afaf923bb1c9389e
#Mantle Testnet Example
# 1O1_RPC_URL=https://rpc.testnet.mantle.xyz
Go here to grab some testnet matic from a faucet: https://mumbaifaucet.com/
// add index.ts inside the 1o1-first-project/ directory
import { ClientFactory, lib, NftTokenBuilder } from "@1o1art/sdk";
import * as dotenv from "dotenv";
dotenv.config();
// Remember to add your own private key
const PRIV_KEY = process.env.PRIV_KEY;
const RPC_URL = process.env.RPC_URL;
if (!PRIV_KEY) throw "missing private key";
if (!RPC_URL) throw "missing rpc url";
const main = async () => {
const client = await ClientFactory.makeClient(PRIV_KEY, RPC_URL);
console.log("made client");
const nftContractBuilder = client.createNftContractBuilder();
// Get the components you'd like to add to your blank smart contract
// basic will load the bare minimum to make a contract, delegatable
// will provide a delegatable ERC721 token
const contractFacets = await client.getPresetFacets("delegatable");
console.log(`retrieved facets ${contractFacets.length}`);
console.log("deploying contract");
// Create the contract and set a contract image
const contractAddr = await nftContractBuilder
.setFacets(contractFacets)
.setImage(
"ipfs://QmNoDT3M1FfF7d3Pd9DkBfzz8NxHueeudWBPe9owt1PnRM",
"offchain"
)
.setMetadata({
name: "My NFT",
description: "This is my NFT",
symbol: "API",
})
.deploy();
console.log("deployed contract");
// Prepare to create a token
const nftTokenBuilder = new NftTokenBuilder(
nftContractBuilder.signer,
contractAddr
);
// This can be any address you'd like to mint to
const mintToAddress = nftContractBuilder.signer.address;
const tokenID = await nftTokenBuilder
.setImage(
"ipfs://QmNoDT3M1FfF7d3Pd9DkBfzz8NxHueeudWBPe9owt1PnRM",
"offchain"
)
.setAnimation(
"ipfs://QmTwnLtm7TkmaYJFrYFvsupedP3n51vu6czmVKiED5GyAX",
"offchain"
)
.setDesc("This is my NFT")
.setName("My NFT")
.setAttributes({ key: "value", otherKey: "value" })
.mint(mintToAddress);
// get access to the recently launch NFT Contract
const { nftContract } = await client.getNftContractData(contractAddr);
// Use the contract to get the tokenURI aka the token Metadata
const tokenURIBase64Encoded = await nftContract.tokenURI(tokenID);
// get the token Metadata for the minted token
let tokenMetadata: lib.token.TokenMetadata = JSON.parse(
lib.utils.convertTokenUriData(tokenURIBase64Encoded)
) as lib.token.TokenMetadata;
console.log("Minted NFT - Token ID: ", tokenID);
console.log("Minted NFT - Contract Addr: ", contractAddr);
console.log(
`Minted NFT - Token Metadata: ${JSON.stringify(tokenMetadata, null, 2)}`
);
};
try {
main();
} catch (e) {
console.log(e);
console.log("Remember to replace the private key with your own");
}
Run the typescript example via
npx ts-node index.ts
JS Example
// add index.ts inside the 1o1-first-project/ directory
const { ClientFactory, lib, NftTokenBuilder } = require("@1o1art/sdk");
const dotenv = require("dotenv");
dotenv.config();
// Remember to add your own private key
const PRIV_KEY = process.env.PRIV_KEY;
const RPC_URL = process.env.RPC_URL;
if (!PRIV_KEY) throw "missing private key";
if (!RPC_URL) throw "missing rpc url";
const main = async () => {
const client = await ClientFactory.makeClient(PRIV_KEY, RPC_URL);
console.log("made client");
const nftContractBuilder = client.createNftContractBuilder();
// Get the components you'd like to add to your blank smart contract
// basic will load the bare minimum to make a contract, delegatable
// will provide a delegatable ERC721 token
const contractFacets = await client.getPresetFacets("delegatable");
console.log(`retrieved facets ${contractFacets.length}`);
console.log("deploying contract");
// Create the contract and set a contract image
const contractAddr = await nftContractBuilder
.setFacets(contractFacets)
.setImage(
"ipfs://QmNoDT3M1FfF7d3Pd9DkBfzz8NxHueeudWBPe9owt1PnRM",
"offchain"
)
.setMetadata({
name: "My NFT",
description: "This is my NFT",
symbol: "API",
})
.deploy();
console.log("deployed contract");
// Prepare to create a token
const nftTokenBuilder = new NftTokenBuilder(
nftContractBuilder.signer,
contractAddr
);
// This can be any address you'd like to mint to
const mintToAddress = nftContractBuilder.signer.address;
const tokenID = await nftTokenBuilder
.setImage(
"ipfs://QmNoDT3M1FfF7d3Pd9DkBfzz8NxHueeudWBPe9owt1PnRM",
"offchain"
)
.setAnimation(
"ipfs://QmTwnLtm7TkmaYJFrYFvsupedP3n51vu6czmVKiED5GyAX",
"offchain"
)
.setDesc("This is my NFT")
.setName("My NFT")
.setAttributes({ key: "value", otherKey: "value" })
.mint(mintToAddress);
// get access to the recently launch NFT Contract
const { nftContract } = await client.getNftContractData(contractAddr);
// Use the contract to get the tokenURI aka the token Metadata
const tokenURIBase64Encoded = await nftContract.tokenURI(tokenID);
// get the token Metadata for the minted token
let tokenMetadata: lib.token.TokenMetadata = JSON.parse(
lib.utils.convertTokenUriData(tokenURIBase64Encoded)
) as lib.token.TokenMetadata;
console.log("Minted NFT - Token ID: ", tokenID);
console.log("Minted NFT - Contract Addr: ", contractAddr);
console.log(
`Minted NFT - Token Metadata: ${JSON.stringify(tokenMetadata, null, 2)}`
);
};
try {
main();
} catch (e) {
console.log(e);
console.log("Remember to replace the private key with your own")
}
Run the javascript example via
node index.js
Checkout our docs page to learn more about how 1o1 works. https://docs.1o1.art
FAQs
1of1 creation on-chain NFTs with delegation cli preview
The npm package @1o1art/sdk receives a total of 0 weekly downloads. As such, @1o1art/sdk popularity was classified as not popular.
We found that @1o1art/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.
Security News
Sonar’s acquisition of Tidelift highlights a growing industry shift toward sustainable open source funding, addressing maintainer burnout and critical software dependencies.