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
  1. Interacting with Contracts

Extending Contract Definitions

Contract definition can be extended, in the same sense a class can inherit from another class in Object-oriented programming, by using the extendContract function:

import {
  createContract,
  extendContract,
  snip20Def,
  Snip20Contract
} from '@stakeordie/griptape.js';

const myDef = { ... };

// The result definition contains all queries and messages from the
// `Snip20Def` plus all queries and messages from `myDef`
const extendedDef = extendContract(snip20Def, myDef);

createContractClient({
  ...
  definition: extendedDef
});

All common methods between contract definitions are overrided by the methods on the second parameters of the extendContract function.

PreviousBuilt-In DefinitionsNextContract Registry

Last updated 3 years ago

🗞️