# 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:

{% embed url="<https://docs.abstract.money>" %}
Abstract Money Documentation
{% endembed %}

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

{% hint style="success" %}
If you’re a brand new dev, Abstract infrastructure may be overwhelming to start with, so we recommend just checking out the [CosmWasm documentation](https://docs.cosmwasm.com/core) and starting with the basic [CosmWasm template](https://github.com/AbstractSDK/cw-template).
{% endhint %}

{% hint style="info" %}
**Smart contracts = Modules** (in Abstract lingo)
{% endhint %}

## 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](https://docs.abstract.money/3_framework/3_architecture.html). To read more about modules, please see the [module documentation](https://docs.abstract.money/3_framework/6_module_types.html).

Spin up a new project using:

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

{% hint style="warning" %}
Refer the [repository](https://github.com/AbstractSDK/templates) for latest updates and instructions on spinning up. This documentation and the repository's updates might go out of sync.
{% endhint %}

### 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](https://orchestrator.abstract.money/)

If you bootstrap the codebase using the Abstract module template mentioned above you should have cw-orchestrator setup 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:

{% embed url="<https://js.abstract.money/>" %} Abstract's Javascript / Typescript SDK Documentation {% endembed %}

The [app templates repo](https://github.com/AbstractSDK/templates) 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 `AbstractProvider`s 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](https://js.abstract.money/cli/introduction)).
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](https://explorer.burnt.com/wallet/suggest) or by connecting to the [Abstract Console](https://believathon.console.abstract.money/).
   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](https://testnet.dashboard.burnt.com) 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](https://believathon.console.abstract.money/modules).
3. Publish your schemas with `just publish-schemas <namespace> <name> <version>` . This will give your contract auto-generated UIs in the Console.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.burnt.com/xion/developers/references/developer-tools-abstract.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
