> For the complete documentation index, see [llms.txt](https://publicdocs.gitbook.io/onto-web-wallet-help-center/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://publicdocs.gitbook.io/onto-web-wallet-help-center/developers/onto-wallet-plugin-integration.md).

# ONTO Wallet Plugin Integration

This doc describes the integration process for using the ONTO provider with the Web3 JS SDK and invoking the Ontology dAPI.

The chains that are currently supported:

* Ethereum
* Ontology
* BNB Smart Chain (BSC)
* OKXChain (OKC)
* Polygon
* Huobi ECO Chain
* Arbitrum
* IoTex
* Avalanche-C
* Harmony

The dAPI has been implemented for Ethereum and other homogeneous chains using the [EIP-1193 API protocol](https://eips.ethereum.org/EIPS/eip-1193). However, there are some differences to be noted.

1. There are certain APIs that Metamask supports but are not supported by ONTO right now.
2. There are differences in the way certain errors are handled.
3. Legacy APIs are not supported.

Also, the dAPI methods that are currently available via the provider are limited and listed [below](/onto-web-wallet-help-center/developers/onto-wallet-plugin-integration.md#available-dapi-methods).

## Resources

Name: ONTO Wallet&#x20;

Resource kit: [https://www.onto.app/ONTO Media Kits.zip](https://www.onto.app/ONTO%20Media%20Kits.zip)

## Ethereum and Other Homogeneous Chains

```javascript
import Web3 from "web3";

// Initialize web3 object by passing window.onto as the provider
const web3 = new Web3(window.onto);

// Request connection
web3.eth.requestAccounts().then((res) => {
  console.log(res[0]);
});

// Listen for accountsChanged and other events
window.onto.on("accountsChanged", (e) => {
  console.log(e.accounts[0]);
});
```

## Ontology dAPI

```javascript
import { client, provider } from "@ont-dev/ontology-dapi";

// Initialization
client.registerClient({
  extension: provider.ExtensionType.Onto, // or 'onto'
});
```

Refer to [these docs](https://github.com/ontio/ontology-dapi) for more API method details.

## Available dAPI Methods

Currently available dAPI methods are limited to the ones listed below. Refer to the [dAPI docs](https://github.com/backslash47/OEPs/blob/oep-dapp-api/OEP-6/OEP-6.mediawiki) for details on each method.

|                              Method name                              |
| :-------------------------------------------------------------------: |
|                            asset.getAccount                           |
|                           asset.getPublicKey                          |
|                           network.getNetwork                          |
|                           network.getBalance                          |
|                            network.getBlock                           |
|                         network.getTransaction                        |
|                          network.getNodeCount                         |
|                         network.getBlockHeight                        |
|                         network.getMerkleProof                        |
|                           network.getStorage                          |
|                          network.getAllowance                         |
|                         network.getUnboundOng                         |
|                          network.getContract                          |
|                       network.getSmartCodeEvent                       |
|                     network.getBlockHeightByTxHash                    |
|                          network.getBlockHash                         |
|                      network.getBlockTxsByHeight                      |
|                          network.getGasPrice                          |
|                          network.getGrantOng                          |
|                       network.getMempoolTxCount                       |
|                       network.getMempoolTxState                       |
|                           network.getVersion                          |
|     smartContract.invoke (doesn't support `requireIdentity:true`)     |
|   smartContract.invokeWasm (doesn't support `requireIdentity:true`)   |
|   smartContract.invokeRead (doesn't support `requireIdentity:true`)   |
| smartContract.invokeWasmRead (doesn't support `requireIdentity:true`) |
|                          provider.getProvider                         |
