Griptape.js
  • What is Griptape.js?
  • 🛹Getting Started
  • 🚀Bootstrapping Your App
  • 🗞️Interacting with Contracts
    • Contract Definitions
      • More on Definitions
    • Creating Contract Clients
    • Built-In Definitions
    • Extending Contract Definitions
    • Contract Registry
    • Instantiating Contracts
  • 🔑Using Viewing Keys and Permits
    • Using the viewing key manager
    • Using Keplr with Griptape
    • Managing Permits
  • 🕢Handling Events
  • ⚒️Using Utilities
  • 🔀API Reference
    • Bootstrap
    • Contracts
    • Viewing Keys
    • Permits
    • Events
    • Utilities
  • 🐝Tricks Tutorials
    • React Tutorials
      • Hello, Griptape
      • Hello, Contracts
      • Hello, Events
      • Hello, Viewing Keys
      • Hello, Permits
      • Hello, Transactions
      • Hello, Mint
    • Vue Tutorials
      • Hello, Griptape
      • Hello, Contracts
      • Hello, Events
      • Hello, Viewing Keys
      • Hello, Permits
      • Hello, Transactions
      • Hello, Mint
  • 💾Hackathon
    • Welcome Packet
    • Getting Set Up
    • Glossary
Powered by GitBook
On this page
  • Introduction
  • Installation and Setup
  • Grip an app
  • Grip an app with a config object

Getting Started

This is the first section of a step-by-step guide so you can start using Griptape in your application.

PreviousWhat is Griptape.js?NextBootstrapping Your App

Last updated 3 years ago

Introduction

Griptape is a framework for developing decentralized web applications in Secret Network. Griptape will take care mostly of what all of the applications has in common, in an opinionated and structured way. Here is a summary of some of the main features of Griptape:

  • Connect a regular web application to the blockchain

  • Interact with deployed contracts on Secret Network

  • Define architecture for your application

  • Handle Viewing Keys and Permits to access private state on a contract

  • Rapidly interact with SNIP-20 and SNIP-721 compliant contracts

Now that you understand the domain of Griptape, then let's start learning about how to use it.

Installation and Setup

Griptape.js can work along any front-end UI library out there. Therefore, the first step is to set up an application in which you can then install Griptape.js. Examples of libraries are:

Once you have a front-end application ready, install Griptape.js by running one of the following:

# Using yarn
yarn add @stakeordie/griptape.js

# or npm
npm install @stakeordie/griptape.js

Grip an app

A gripped application is a term we use to describe an application whose bootstrap process is handled by Griptape. Grip your app by adding this to your main entry point file (commonly main.js or index.js):

import {
  gripApp,
  getKeplrAccountProvider
} from '@stakeordie/griptape.js';

const restUrl = 'https://api.stakeordie.com';
const provider = getKeplrAccountProvider();
function runApp() {
  // Bootstrap your app here!
}

gripApp(restUrl, provider, runApp);
function runApp() {
  createApp(App).mount('#app');
}
function runApp() {
  ReactDOM.render(
    <React.StrictMode>
      <App />
    </React.StrictMode>,
    document.getElementById('root')
  );
}

Now you are ready! You can start developing your dApp.

Grip an app with a config object

In the same index.js file you can also add a config object that is used to set custom fees, for this you need to create a config object and inside it, add the restUrl and defaultFees object.

Then use the config as a parameter to the gripApp function.

import {
  gripApp,
  getKeplrAccountProvider
} from '@stakeordie/griptape.js';

const config = {
  restUrl: 'https://api.pulsar.griptapejs.com',
  defaultFees: {
    upload: 500000,
    init: 100000,
    exec: 200000,
    send: 100000
  }
};

const provider = getKeplrAccountProvider();
function runApp() {
  // Bootstrap your app here!
}

gripApp(config, provider, runApp);

runApp is a function able to bootstrap your front-end application, e.g. for the implementation looks like this:

Or in , like this:

🛹
Vue.js
React.js
Vue.js
React