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
  • createContract(ContractSpecification)
  • extendedContract(ContractDefinition, ContractDefinition)
  • refContract(T)
  • instantiateContract(ContractInstantiationRequest)
  1. API Reference

Contracts

PreviousBootstrapNextViewing Keys

Last updated 3 years ago

createContract()

Arguments:

  • {} : a contract specification object.

Returns: {T}: a Contract Client

Description: This function, iterates over all the queries and messages to which it inserts an object as the first parameter of type Context, which stores vital data of the contract such as viewing key, permit and the address of the wallet.

extendedContract(, )

Arguments:

  • {}: a contract definition.

  • {}: a contract definition to extends.

Returns: {object}: extended contract.

Description: This function receives two objects, one the definition of our contract and the other the definition of a contract to be extended. It then calculates their messages and queries common keys using the calculateCommonKeys function.

Then bind base definition with extended definition, overriding the common message and queries keys with the keys of the contract to extend.

refContract(T)

Arguments: {T}: a contract id or address.

Returns: {object}: contract

Description: This function analyzes the contractRegistry list, if it contains the id called id or the address called atbased on the received argument, if it finds a contract, it returns the complete object, if it's no the case it returns the following message: "No contract has been found with ID or address".

Arguments:

Returns: {T}: a Contract Client

Description: This function receives a contract request object that contains: id, definition, codeId, label and initMsg.

Then, using the instantiate function reviews if there is an available client, if this is the case it creates an instance of the contract with the codeId, label and initMsg, from which it obtains the atvalue of a contract.

If there is no available customer, throw the message "No signing client available". Finally, all this is correct, the function calls the function createContract, with the contract specification created before.

instantiateContract()

{}: a contract instantiation.

🔀
ContractSpecification
ContractSpecification
ContractDefinition
ContractDefinition
ContractDefinition
ContractDefinition
ContractInstantiationRequest
ContractInstantiationRequest