Developer Tools: Abstract

Abstract is an application development platform specially built for applications that are chain-agnostic (or abstracted 😉). The best place to read more about Abstract would be their documentation at:

Abstract Money Documentation

In this page we will be introducing the tools provided by Abstracted that can help you speedrun through development on Xion

Smart contracts = Modules (in Abstract lingo)

Contracts: Build and Deploy

Abstract provides tools to build a re-usable or a standalone contract. Re-usable contracts are also referred as "Modules".

Bootstrap Codebase: Abstract Module Template

The Abstract Module Template is a starting point for developing composable smart-contracts, or "Modules" on the Abstract platform. To learn more about Abstract Accounts, please see the abstract accounts documentation. To read more about modules, please see the module documentation.

Spin up a new project using:

cargo generate --git https://github.com/AbstractSDK/templates.git

Test contracts: CW-Orchestrator

cw-orchestrator is an advanced testing and deployment tool for CosmWasm smart-contracts. It’s designed to make it easy to test and deploy contracts in a variety of environments including cw-multi-test, local, testnet, and mainnet.

Read more here

If you bootstrap the codebase using the Abstract module template mentioned above you should have cw-orchestrator setu up already.

Generate Schemas: `just schema`

just is a command line tool to manage and execute project specific commands. A project bootstrapped using Abstract Module Template (above) comes with handy just commands defined. eg., just schema will generate schema files in the project (should be executed if any changes are made to messages and responses)

See /justfile in project root for all commands

Client

Abstract's JS SDK works well with both Xion's meta-accounts and EOAs.

Abstract provides templates to build and debug using regular EOAs on the Xion chain. However in production environment we highly recommend using meta-accounts to be able to leverage the true power of the chain and UX :)

Documentation:

Abstract's Javascript / Typescript SDK Documentation

The app templates repo includes a frontend folder scaffolded with React, next.js, and graz as the Cosmos wallet connector.

Example Frontend

An example frontend of a betting app deployed on XION can be found here: https://github.com/AbstractSDK/abstract.js/tree/believathon/examples/wagemos-xion-nextjs

Notes:

  • This example has a “dev mode” which uses EOAs as the executor using grazProvider. This should be used when developing the application else you will run into permissions errors.

  • The example also demonstrates a “user mode” using the XION modal. We recommend having separate AbstractProviders for developer and user routes.

Client <> Contract

  1. Codegen

    1. When your contract devs have defined the messages for your contracts, run just schema to make the schemas available for codegen.

    2. Ensure that the abstract.config.js is configured with the proper folders

    3. Run abstract generate (CLI docs here).

  2. Use the generated code (src/_generated) to interact with your app. There is already an example for use of cw20 contract. Refer the wagemos examples: https://github.com/AbstractSDK/abstract.js/tree/believathon/examples

  3. Use the autogenerated module code to interact with the contracts

Debugging

  1. Get ready to publish

    1. Add a seed phrase in the TEST_MNEMONIC in .env

      1. This can be from Keplr or another Cosmos Wallet. Add XION here or by connecting to the Abstract Console.

    2. Ensure that you have funds in the address. On testnet, new XION Meta accounts all have 1 XION so sign-in to the XION dashboard and send funds to this address.

  2. Publish your contract onchain with just publish

    1. This will create a new Abstract Account, claim the namespace (configured in your app), and publish the contracts on-chain to the contract registry.

  3. Publish your schemas with just publish-schemas <namespace> <name> <version> . This will give your contract auto-generated UIs in the Console.

Last updated

Was this helpful?