
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
@slide-web3/thirdweb-typescript-sdk
Advanced tools
The Slide version of thirdweb SDK.
Best in class Web3 SDK for Browser, Node and Mobile apps
Install the latest version of the SDK with npm
:
npm install @thirdweb-dev/sdk ethers
or with yarn
:
yarn add @thirdweb-dev/sdk ethers
The quickest way to get started is to use the SDK as read only (no transactions). This will allow you to query data from any contract with no additional setup.
// my_script.js
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
// instantiate the SDK in read-only mode (our example is running on `polygon` here)
// all major chains and testnets are supported (e.g. `mainnet`, `rinkeby`, `goerli`, 'polygon', 'mumbai', etc.)
const sdk = new ThirdwebSDK("polygon");
// access your deployed contracts
const nftDrop = sdk.getNFTDrop("0x...");
const marketplace = sdk.getMarketplace("0x...");
// Read from your contracts
const claimedNFTs = await nftDrop.getAllClaimed();
const listings = await marketplace.getActiveListings();
You can execute this code as a node script by executing:
node my_script.js
In order to execute transactions on your contract, the SDK needs to know which wallet is executing those transactions. This can be done two ways:
Here's how to provide your own private key to the SDK to perform transactions with your account from scripts or from a node.js backend:
// my_script.js
import { ThirdwebSDK } from "@thirdweb-dev/sdk";
// load your private key in a secure way (env variable, never commited to git)
const privateKey = process.env.PRIVATE_KEY;
// instantiate the SDK based on your private key, with the desired chain to connect to
const sdk = ThirdwebSDK.fromPrivateKey(privateKey, "polygon");
// deploy contracts
const deployedAddress = sdk.deployer.deployNFTCollection({
name: "My NFT Collection",
primary_sale_recipient: "0x...",
});
// access your deployed contracts
const nftCollection = sdk.getNFTCollection(deployedAddress);
// Execute transactions on your contracts from the connected wallet
const walletAddress = "0x...";
await nftCollection.mintTo(walletAddress, {
name: "Cool NFT",
description: "Minted NFT from code!",
image: fs.readFileSync("path/to/image.png"), // This can be an image url or file
});
You can execute this code as a node script by executing:
node my_script.js
For frontend applications, head over to our React Github repo which shows you how to connect to a user's wallet like Metamask, and automatically instantiate the thirdweb SDK for you.
Easiest way to get started on the frontend is using one of our templates in the thirdweb examples repo.
To build the project:
yarn install
yarn build
After building, to run the tests (requires a local hardhat node running):
yarn test:all
OR
If you have make and docker installed you can simply run
make test
FAQs
The Slide version of thirdweb SDK.
The npm package @slide-web3/thirdweb-typescript-sdk receives a total of 0 weekly downloads. As such, @slide-web3/thirdweb-typescript-sdk popularity was classified as not popular.
We found that @slide-web3/thirdweb-typescript-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 open source maintainers 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.