Cookbook Community Meetup - 12pm ET / 5pm GMT every week on Wednesdays

Language
Docs

Documentation

Contributors: Luke Cassady-Dorion, Tom Wilson
Last Updated:

Warp (SmartWeave) SDK Intro

Warp is a popular SmartWeave Protocol SDK. With Warp and Irys your SmartWeave deployments and interactions can be extremely fast.

Introduction

This guide is a short introduction to the Warp SDK and some of its API methods, if you want to learn more about SmartWeave Contracts in general visit Core Concepts: SmartWeave.

TIP

You can find the Warp SDK on githubopen in new window. For a deeper dive on Warp SmartWeave visit Warp Websiteopen in new window

To use the SDK on the server, you will need access to a wallet.json file, to use the SDK in the browser you will need to connect to an arweave supported wallet.

Install

To install warp in your project you can use npm or yarn or other npm clients.

npm install warp-contracts
yarn add warp-contracts

Import

When using Warp with your project there are several ways to import the sdk depending on your project setup.

import { WarpFactory } from "warp-contracts";
import { WarpFactory } from "warp-contracts/mjs";
const { WarpFactory } = require("warp-contracts");

Connecting to an environment

There are several environments that you may want to interact with, you can connect to those environments using the forXXXX helpers.

const warp = WarpFactory.forMainnet();
const warp = WarpFactory.forTestnet();
const warp = WarpFactory.forLocal();
const warp = WarpFactory.custom(
	arweave, // arweave-js
	cacheOptions, // { ...defaultCacheOptions, inMemory: true}
	environment, // 'local', 'testnet', 'mainnet'
);

WARNING

When using local environment, you will need to have arLocal running on port 1984.

Summary

This intro guide is to help you get setup with Warp, the following guides will show you how to deploy SmartWeave contracts using the Warp SDK, how to interact with those contracts and finally, how to evolve SmartWeave contracts.