Developer Tools: Abstract
Last updated
Last updated
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:
In this page we will be introducing the tools provided by Abstracted that can help you speedrun through development on Xion
If you’re a brand new dev, Abstract infrastructure may be overwhelming to start with, so we recommend just checking out the CosmWasm documentation and starting with the basic CosmWasm template.
Smart contracts = Modules (in Abstract lingo)
Abstract provides tools to build a re-usable or a standalone contract. Re-usable contracts are also referred as "Modules".
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:
Refer the repository for latest updates and instructions on spinning up. This documentation and the repository's updates might go out of sync.
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.
If you bootstrap the codebase using the Abstract module template mentioned above you should have cw-orchestrator setu up already.
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
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 :)
The app templates repo includes a frontend folder scaffolded with React, next.js, and graz as the Cosmos wallet connector.
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 AbstractProvider
s for developer and user routes.
Codegen
When your contract devs have defined the messages for your contracts, run just schema
to make the schemas available for codegen.
Ensure that the abstract.config.js
is configured with the proper folders
Run abstract generate
(CLI docs here).
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
Use the autogenerated module code to interact with the contracts
Get ready to publish
Add a seed phrase in the TEST_MNEMONIC
in .env
This can be from Keplr or another Cosmos Wallet. Add XION here or by connecting to the Abstract Console.
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.
Publish your contract onchain with just publish
This will create a new Abstract Account, claim the namespace (configured in your app), and publish the contracts on-chain to the contract registry.
Publish your schemas with just publish-schemas <namespace> <name> <version>
. This will give your contract auto-generated UIs in the Console.