> For the complete documentation index, see [llms.txt](https://leather.gitbook.io/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://leather.gitbook.io/developers/overview/introduction.md).

# Introduction

Learn about the Leather API

The Leather browser extension adds a provider object to every web page. Your app calls wallet methods through it.

```typescript
if (window.LeatherProvider) {
  const response = await window.LeatherProvider.request('getAddresses');
  console.log(response.result.addresses);
}
```

## Provider object

The extension defines `window.LeatherProvider`. Check for it before you call a method.

`request(method, params)` sends a JSON-RPC 2.0 request to the extension. It returns a promise that resolves with the response object, with the method output in `result`. It rejects with the response object when that object contains `error`. When you omit `params`, the provider sends `{}`.

The extension also defines `window.StacksProvider` and `window.HiroWalletProvider` with the same object, for older apps. The source marks `StacksProvider` as deprecated. Use `LeatherProvider`.

Source: [`init-inpage-provider.ts`](https://github.com/leather-io/mono/blob/1e05e52d5cd8a8ccfad9d56b5ae86de9f7baf631/packages/provider/src/init-inpage-provider.ts#L57-L124) in leather-io/mono at `1e05e52d5cd8a8ccfad9d56b5ae86de9f7baf631`.

## Methods

| Method                                                        | Purpose                                                                                                                    |
| ------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| [`getAddresses`](/developers/methods/getaddresses.md)         | Request the Bitcoin addresses (Native SegWit and Taproot) and Stacks addresses for the active account of the user's wallet |
| [`open`](/developers/methods/open.md)                         | Programmatically open Leather                                                                                              |
| [`openSwap`](/developers/methods/openswap.md)                 | Open the Leather swap screen with a trading pair preselected.                                                              |
| [`supportedMethods`](/developers/methods/supportedmethods.md) | List the methods Leather supports, with a documentation link for each.                                                     |

### Bitcoin methods

| Method                                                            | Purpose                                                                                                               |
| ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| [`signMessage`](/developers/bitcoin-methods/signmessage.md)       | Request the signature of an arbitrary message with the first Bitcoin address (Native SegWit or Taproot) of an account |
| [`sendTransfer`](/developers/bitcoin-methods/sendtransfer.md)     | Request the signature and broadcast of a Bitcoin transaction                                                          |
| [`signPsbt`](/developers/bitcoin-methods/signpsbt.md)             | Request the signature and broadcast of a Partially Signed Bitcoin Transaction (PSBT)                                  |
| [`btc_addAccount`](/developers/bitcoin-methods/btc_addaccount.md) | Ask the user to verify a Bitcoin multisig address derived from a wsh() descriptor.                                    |

### Stacks methods

| Method                                                                                 | Purpose                                                                                                              |
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| [`stx_getAddresses`](/developers/stacks-methods/stx_getaddresses.md)                   | Request the Bitcoin and Stacks addresses for the active account of the user's wallet, using the SIP-030 method name. |
| [`stx_transferStx`](/developers/stacks-methods/stx_transferstx.md)                     | Request a transfer of STX tokens to a specified recipient.                                                           |
| [`stx_transferSip10Ft`](/developers/stacks-methods/stx_transfersip10ft.md)             | Request a transfer of a SIP-010 fungible token to a specified recipient.                                             |
| [`stx_transferSip9Nft`](/developers/stacks-methods/stx_transfersip9nft.md)             | Request a transfer of a SIP-009 non-fungible token to a specified recipient.                                         |
| [`stx_signTransaction`](/developers/stacks-methods/stx_signtransaction.md)             | Request the signature of a Stacks transaction                                                                        |
| [`stx_signMessage`](/developers/stacks-methods/stx_signmessage.md)                     | Request the signature of an arbitrary message with the Stacks address of an account                                  |
| [`stx_signStructuredMessage`](/developers/stacks-methods/stx_signstructuredmessage.md) | Request the signature of a structured message using the Stacks address of an account.                                |
| [`stx_callContract`](/developers/stacks-methods/stx_callcontract.md)                   | Wrapper method for `stx_signTransaction` that calls a Stacks contract                                                |
| [`stx_deployContract`](/developers/stacks-methods/stx_deploycontract.md)               | Deploy a Clarity smart contract on the Stacks blockchain.                                                            |
| [`stx_addAccount`](/developers/stacks-methods/stx_addaccount.md)                       | Ask the user to verify a Stacks multisig address derived from public keys and a threshold.                           |

[Stacks libraries](/developers/stacks-methods/stacks-libraries.md) covers calling contracts and transferring assets with the Stacks libraries.

## Resources

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Get support</strong></td><td>Where can I find support for integrating Leather into my app?</td><td><a href="/developers/resources/get-support.md">Get support</a></td></tr><tr><td><strong>Contributions</strong></td><td>How can I contribute to Leather?</td><td><a href="/developers/resources/contributions.md">Contributions</a></td></tr><tr><td><strong>Bug bounty</strong></td><td>The route for reporting a Leather vulnerability.</td><td><a href="/developers/resources/bug-bounty.md">Bug bounty</a></td></tr></tbody></table>
