> For the complete documentation index, see [llms.txt](https://w3block.gitbook.io/w3block-eng/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://w3block.gitbook.io/w3block-eng/dev-docs/api/key-api-services/tokens/contracts.md).

# Contracts

This module helps you administer your contracts in the blockchain

Contracts are what you use to create your tokens inside the blockchain. You can create your own contracts and use them however you like.&#x20;

## Service Methods

### Creating a Draft

Before you do anything you need to create a draft for the contract. You will set all the parameters you will need to publishing the contract.

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts" method="post" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Get all contracts from your company

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts" method="get" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Get a contract's details

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/{id}" method="get" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Patch a Contract Draft

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/{id}" method="patch" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Publishing a Contract

After you have created a draft you can publish the contract. Be careful as you will not be able to change the contract details after publishing it.

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/{id}/publish" method="patch" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Estimate gas to publish a contract

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/{id}/estimate-gas" method="get" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Grant a wallet a role for your contract

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/grant-role" method="patch" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}

### Grant a wallets role in your contract

{% openapi src="<https://api.pixway.io/docs-json>" path="/{companyId}/contracts/has-role" method="patch" %}
<https://api.pixway.io/docs-json>
{% endopenapi %}
