# Kadena dApp Integration

CLV extension wallet will inject clover\_kadena to window object, dApp could use it to integrate with CLV extension wallet.

```
window.clover_kadena = {
  isCloverWallet: true,
  getAccount: async ()=> {...},
  sign: async (paload) => {...}
}
```

## Sample Code

Below is an example for dApp to integrate CLV extension wallet

```
signKdaTransaction = async () => {
    if (!window.clover_kadena) {
      this.console('wallet not injected!')
    }

    var mkReq = function(cmd) {
      return {
        headers: {
          "Content-Type": "application/json"
        },
        method: "POST",
        body: JSON.stringify(cmd)
      };
    };

    try {
      const account = await window.clover_kadena.getAccount()
      await new Promise((resolve) => setTimeout(resolve, 3000))
      const signCmd = {
        pactCode: `(free.hello-world.set-message ${JSON.stringify('hello test')})`,
        caps: [
          Pact.lang.mkCap("Gas capability", "description of gas cap", "coin.GAS", []).cap,
        ],
        sender: account,
        gasLimit: 10000,
        chainId: "0",
        ttl: 28800,
        envData: {}
      }

      const result = await window.clover_kadena.sign(signCmd)
      const txRes = await fetch(`https://api.testnet.chainweb.com/chainweb/0.0/testnet04/chain/0/pact/api/v1/send`, mkReq(result));
      const tx = await txRes.json();
    } catch (e) {
      console.log(e)
    }
  }
```


---

# 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.clv.org/clover-wallet/kadena-dapp-integration.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.
