@decent.xyz/sdk
v0.3.9
Published
### Core Resources
Downloads
1,355
Keywords
Readme
Welcome to the Decent SDK
Core Resources
Protocol Documentation: includes module descriptions, available functions for each contract, and protocol deployment addresses.
Protocol Repository: you can find community discussions about new PR's and issues in the Discussions panel of this repository.
Starter Repo: the fastest way to publish your first application using Decent is to fork this repository (NextJS, Tailwind, RainbowKit, DecentSDK).
Getting Started
npm i @decent.xyz/sdk
Example deployment of Decent's 721A contract
import { DecentSDK, edition, ipfs } from '@decent.xyz/sdk';
// wagmi is a core dependency to deploy contracts; DecentSDK get functions can be used without
import { useSigner, useNetwork } from 'wagmi';
// Define your metadata schema before deploying contract
const deployFunction = async () => {
const ipfsHash = await ipfs.createMetadata(metadata).then((res: any) => {
return res
});
Decent's defaults to storing metadata on-chain on L2's and on IPFS for Ethereum mainnet
let onChainMetadata = null;
let offChainMetadata = '';
if ( chain.id === 1 || chain.id == 5 ) {
offChainMetadata = `${ipfsHash.url}?`;
} else {
onChainMetadata = {
metadata: ipfsHash?.data?.metadata || "",
}
}
const sdk = new DecentSDK(chain.id, signer);
let nft;
try {
nft = await edition.deploy(
sdk,
collectionName,
symbol,
editionSize,
tokenPrice,
maxTokenPurchase,
creatorRoyalty,
offChainMetadata,
onChainMetadata,
);
}
}
For the artists of every industry 🤝