open-index/open-npm huggingface dataset:
npm package: @kcf/kda-wallet-chainweaver
Description: Chainweaver kadena wallet adapter
Latest version: 1.0.0

# @kcf/kda-wallet-chainweaver

Chainweaver kadena wallet adapter

## Usage Notes

- `isInstalled()` assumes wallet is already open in the background
- Since chainweaver doesn't provide a way to get the wallet's accounts, you must provide the `AccountsList` manually. This is typically done using an interactive dialog requesting users to paste their account/pubkey into.

## Example

```html
<!-- provide a way to collect the user's account on your site -->
<dialog id="connect-chainweaver-dialog">
  <form id="connect-chainweaver-form">
    <label>
      <p>Paste your 'k:' wallet address here:</p>
      <input id="chainweaver-address-input" type="text" />
    </label>
    <button type="submit">Connect</button>
  </form>
  <p>Press esc to close</p>
</dialog>
```

```js
import { PactCommand } from "@kadena/client";
import { isKAccount, kAccountPubkey } from "@kcf/kda-wallet-base";
import { ChainweaverWallet } from "@kcf/kda-wallet-chainweaver";

/**
 * @returns {Promise<ChainweaverWallet>}
 */
async function connectChainweaverViaDialog() {
  const dialog = document.getElementById("connect-chainweaver-dialog");
  dialog.showModal();
  const form = document.getElementById("connect-chainweaver-form");
  const kInput = document.getElementById("chainweaver-address-input");
  return new Promise((resolve, reject) => {
    dialog.onclose = () => reject(new Error("dialog closed"));

    form.onsubmit = (event) => {
      event.preventDefault();
      const account = kInput.value;
      if (!isKAccount(account)) {
        alert("only k: accounts supported");
        dialog.close();
        return;
      }
      dialog.onclose = null;
      dialog.close();
      resolve(
        ChainweaverWallet.connect({
          accounts: [{ account, pubKey: kAccountPubkey(account) }],
        })
      );
    };
  });
}

const chainweaverWallet = await connectChainweaverViaDialog();

const { account, pubKey } = chainweaverWallet.accounts[0];
const toAccount = "to-account";
const amount = 0.1;

const transferCmd = new PactCommand();
transferCmd.code = `(coin.transfer "${account}" "${toAccount}" ${amount})`;
transferCmd.setMeta(
  {
    sender: account,
    chainId: "0",
    ttl: 600,
    gasLimit: 1000,
    gasPrice: 1e-6,
  },
  "mainnet01"
);
transferCmd.addCap("coin.GAS", pubKey);
transferCmd.addCap("coin.TRANSFER", pubKey, account, toAccount, amount);

const signed = await chainweaverWallet.signCmd(transferCmd);

await fetch(
  "https://api.chainweb.com/chainweb/0.0/mainnet01/chain/0/pact/api/v1/send",
  {
    headers: { "Content-Type": "application/json" },
    method: "POST",
    body: JSON.stringify(signed),
  }
);
```
npm package: @kcf/kda-wallet-chainweaver-connect-button
Description: A ready-to-use Chainweaver connect wallet button.
Latest version: 1.0.0

# @kcf/kda-wallet-chainweaver-connect-button

A ready-to-use Chainweaver connect wallet button.

## Usage Notes

- As with all other `@kcf/kda-wallet-*` web components, the element is completely unstyled and not encapsulated in a shadow DOM to allow for easy customizability. The raw html is available in `template.js`
- This component also creates a `<dialog>` for users to enter their `k:` accounts into and appends it to `document.body`

## Attributes

| name          | description                                                                                                                                                 | required | default                                                                    |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- |
| autoresume    | when set, the component will save the current wallet connected session to localStorage and attempt to resume from it the next time the user enters the site | no       | false                                                                      |
| autoresumekey | the localStorage key to use to save autoresume data                                                                                                         | no       | `@kcf/kda-wallets-web-components-base.DEFAULT_AUTORESUME_LOCALSTORAGE_KEY` |

## Custom Events

See `@kcf/kda-wallet-web-components-base` for custom events' detail schema

| name                     | dispatched after                                      |
| ------------------------ | ----------------------------------------------------- |
| kdawallet:beginconnect   | user clicks the button                                |
| kdawallet:abandonconnect | user closes the chainweaver dialog without connecting |
| kdawallet:connected      | wallet connected                                      |
| kdawallet:disconnected   | wallet disconnected                                   |
| kdawallet:error          | error                                                 |

## Example

```html
<kda-wallet-chainweaver-connect-button
  autoresume
></kda-wallet-chainweaver-connect-button>
```

```js
const btn = document.querySelector("kda-wallet-chainweaver-connect-button");
const wallet = btn.connectedWallet;
if (wallet) {
  console.log(wallet.accounts);
}
```
npm package: @kcf/kda-wallet-connect-dialog
Description: A ready-to-use "connect wallet" dialog containing "connect wallet" buttons for each `@kcf/kda-wallet-*` wallet adapter.
Latest version: 1.0.1

# @kcf/kda-wallet-connect-dialog

A ready-to-use "connect wallet" dialog containing "connect wallet" buttons for each `@kcf/kda-wallet-*` wallet adapter.

## Usage Notes

- As with all other `@kcf/kda-wallet-*` web components, the element is completely unstyled and not encapsulated in a shadow DOM to allow for easy customizability. The raw html is available in `template.js`
- Only `@kcf/kda-wallet-*-connect-button`s should be children of this element

## Example

```html
<kda-wallet-connect-dialog>
  <kda-wallet-chainweaver-connect-button
    autoresume
  ></kda-wallet-chainweaver-connect-button>
  <kda-wallet-eckowallet-connect-button
    autoresume
    network-id="testnet04"
  ></kda-wallet-eckowallet-connect-button>
  <kda-wallet-walletconnect-connect-button
    autoresume
    network-id="testnet04"
    wc-project-id="67ce47db9e4c2585385be3581ee3cb9d"
    wc-project-name="Example Kadena Wallet Adapter App"
    wc-project-description="A simple webapp for testing kadena wallets"
    wc-project-url="http://localhost"
    wc-project-icon="https://altcoinsbox.com/wp-content/uploads/2023/01/kadena-logo-300x300.webp"
  ></kda-wallet-walletconnect-connect-button>
  <kda-wallet-zelcore-connect-button
    autoresume
  ></kda-wallet-zelcore-connect-button>
</kda-wallet-connect-dialog>
```

```js
import { defineCustomElement } from "@kcf/kda-wallet-connect-dialog";

// must be called before use
defineCustomElement();

const dialog = document.querySelector("kda-wallet-connect-dialog");
const wallet = dialog.connectedWallet;
if (wallet) {
  console.log(wallet.accounts);
}
```
npm package: @kcf/kda-wallet-eckowallet
Description: eckoWALLET browser extension kadena wallet adapter
Latest version: 1.0.0

# @kcf/kda-wallet-eckowallet

eckoWALLET browser extension kadena wallet adapter

## Usage Notes

- Requires passing in `networkId` to `connect()`, and for user's networkId setting in the browser extension to match the passed-in `networkId`
- Quicksign seems to be broken in the latest update

## Example

```js
import { PactCommand } from "@kadena/client";
import { EckoWallet } from "@kcf/kda-wallet-eckowallet";

const eckoWallet = await EckoWallet.connect({ networkId: "mainnet01" });

const { account, pubKey } = eckoWallet.accounts[0];
const toAccount = "to-account";
const amount = 0.1;

const transferCmd = new PactCommand();
transferCmd.code = `(coin.transfer "${account}" "${toAccount}" ${amount})`;
transferCmd.setMeta(
  {
    sender: account,
    chainId: "0",
    ttl: 600,
    gasLimit: 1000,
    gasPrice: 1e-6,
  },
  "mainnet01"
);
transferCmd.addCap("coin.GAS", pubKey);
transferCmd.addCap("coin.TRANSFER", pubKey, account, toAccount, amount);

const signed = await eckoWallet.signCmd(transferCmd);

await fetch(
  "https://api.chainweb.com/chainweb/0.0/mainnet01/chain/0/pact/api/v1/send",
  {
    headers: { "Content-Type": "application/json" },
    method: "POST",
    body: JSON.stringify(signed),
  }
);
```
npm package: @kcf/kda-wallet-eckowallet-connect-button
Description: A ready-to-use eckoWALLET connect wallet button.
Latest version: 1.0.0

# @kcf/kda-wallet-eckowallet-connect-button

A ready-to-use eckoWALLET connect wallet button.

## Usage Notes

- As with all other `@kcf/kda-wallet-*` web components, the element is completely unstyled and not encapsulated in a shadow DOM to allow for easy customizability. The raw html is available in `template.js`

## Attributes

| name          | description                                                                                                                                                 | required | default                                                                    |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- |
| autoresume    | when set, the component will save the current wallet connected session to localStorage and attempt to resume from it the next time the user enters the site | no       | false                                                                      |
| autoresumekey | the localStorage key to use to save autoresume data                                                                                                         | no       | `@kcf/kda-wallets-web-components-base.DEFAULT_AUTORESUME_LOCALSTORAGE_KEY` |
| network-id    | the chainweb network ID                                                                                                                                     | no       | "mainnet01"                                                                |

## Custom Events

See `@kcf/kda-wallet-web-components-base` for custom events' detail schema

| name                   | dispatched after       |
| ---------------------- | ---------------------- |
| kdawallet:beginconnect | user clicks the button |
| kdawallet:connected    | wallet connected       |
| kdawallet:disconnected | wallet disconnected    |
| kdawallet:error        | error                  |

## Example

```html
<kda-wallet-eckowallet-connect-button
  autoresume
></kda-wallet-eckowallet-connect-button>
```

```js
const btn = document.querySelector("kda-wallet-eckowallet-connect-button");
const wallet = btn.connectedWallet;
if (wallet) {
  console.log(wallet.accounts);
}
```
npm package: @kcf/kda-wallet-walletconnect
Description: WalletConnect kadena wallet adapter
Latest version: 2.0.0

# @kcf/kda-wallet-walletconnect

WalletConnect kadena wallet adapter

## Usage Notes

- Requires passing in `signClientOptions`, `networkId` and `walletConnectModalController` to `connect()`
  - `signClientOptions`: WalletConnect SignClient configuration options such as relayURL and dapp metadata
  - `walletConnectModalController`: an object that controls the opening and closing of a WalletConnect QR code modal for users to scan. [@web3modal/standalone](https://github.com/WalletConnect/web3modal/tree/V2/packages/standalone)'s `Web3Modal` class can be used here.
- A previously saved `pairingTopic` can be passed to `connect()` to resume an existing connection
- None of the WalletConnect wallets implement quicksign yet

## Example

```js
import { PactCommand } from "@kadena/client";
/**
 * https://github.com/mapbox/mapbox-gl-geocoder/issues/441
 * `events` npm package must be installed
 * else Web3Modal will throw
 * `events_1.EventEmitter is not a constructor`
 *
 */
import { Web3Modal } from "@web3modal/standalone";
import { mkChainKey, WalletConnectWallet } from "@kcf/kda-wallet-walletconnect";

const PAIRING_TOPIC_LOCAL_STORAGE_KEY = "walletConnectPairingTopic";

const WALLETCONNECT_PROJECT_ID = "67ce47db9e4c2585385be3581ee3cb9d";

const WALLETCONNECT_SIGN_CLIENT_OPTIONS = {
  projectId: WALLETCONNECT_PROJECT_ID,
  metadata: {
    name: "Example Kadena Wallet Adapter App",
    description: "A simple webapp for testing kadena wallets",
    url: "http://localhost",
    icons: [
      "https://altcoinsbox.com/wp-content/uploads/2023/01/kadena-logo-300x300.webp",
    ],
  },
};

const WEB3_MODAL = new Web3Modal({
  projectId: WALLETCONNECT_PROJECT_ID,
  walletConnectVersion: 2,
  standaloneChains: [mkChainKey("mainnet01")],
});

const walletConnectWallet = await WalletConnectWallet.connect({
  signClientOptions: WALLETCONNECT_SIGN_CLIENT_OPTIONS,
  walletConnectModalController: WEB3_MODAL,
  networkId: "mainnet01",
  pairingTopic:
    window.localStorage.getItem(PAIRING_TOPIC_LOCAL_STORAGE_KEY) ?? undefined,
});

// save pairingTopic to resume session later
window.localStorage.setItem(
  PAIRING_TOPIC_LOCAL_STORAGE_KEY,
  walletConnectWallet.pairingTopic
);

const { account, pubKey } = walletConnectWallet.accounts[0];
const toAccount = "to-account";
const amount = 0.1;

const transferCmd = new PactCommand();
transferCmd.code = `(coin.transfer "${account}" "${toAccount}" ${amount})`;
transferCmd.setMeta(
  {
    sender: account,
    chainId: "0",
    ttl: 600,
    gasLimit: 1000,
    gasPrice: 1e-6,
  },
  "mainnet01"
);
transferCmd.addCap("coin.GAS", pubKey);
transferCmd.addCap("coin.TRANSFER", pubKey, account, toAccount, amount);

const signed = await walletConnectWallet.signCmd(transferCmd);

await fetch(
  "https://api.chainweb.com/chainweb/0.0/mainnet01/chain/0/pact/api/v1/send",
  {
    headers: { "Content-Type": "application/json" },
    method: "POST",
    body: JSON.stringify(signed),
  }
);
```
npm package: @kcf/kda-wallet-web-components-base
Description: Base utils and typedefs used across the `@kcf/kda-wallet-*` web-component packages
Latest version: 1.0.0

# @kcf/kda-wallet-web-components-base

Base utils and typedefs used across the `@kcf/kda-wallet-*` web-component packages
npm package: @kcf/kda-wallet-zelcore
Description: Zelcore kadena wallet adapter
Latest version: 1.0.0

# @kcf/kda-wallet-zelcore

Zelcore kadena wallet adapter

## Usage Notes

- `isInstalled()` assumes wallet is already open in the background
- Quicksign is not implemented

## Example

```js
import { PactCommand } from "@kadena/client";
import { ZelcoreWallet } from "@kcf/kda-wallet-zelcore";

const zelcoreWallet = await ZelcoreWallet.connect();

const { account, pubKey } = zelcoreWallet.accounts[0];
const toAccount = "to-account";
const amount = 0.1;

const transferCmd = new PactCommand();
transferCmd.code = `(coin.transfer "${account}" "${toAccount}" ${amount})`;
transferCmd.setMeta(
  {
    sender: account,
    chainId: "0",
    ttl: 600,
    gasLimit: 1000,
    gasPrice: 1e-6,
  },
  "mainnet01"
);
transferCmd.addCap("coin.GAS", pubKey);
transferCmd.addCap("coin.TRANSFER", pubKey, account, toAccount, amount);

const signed = await zelcoreWallet.signCmd(transferCmd);

await fetch(
  "https://api.chainweb.com/chainweb/0.0/mainnet01/chain/0/pact/api/v1/send",
  {
    headers: { "Content-Type": "application/json" },
    method: "POST",
    body: JSON.stringify(signed),
  }
);
```
npm package: @kcf/kda-wallet-zelcore-connect-button
Description: A ready-to-use Zelcore connect wallet button.
Latest version: 1.0.0

# @kcf/kda-wallet-zelcore-connect-button

A ready-to-use Zelcore connect wallet button.

## Usage Notes

- As with all other `@kcf/kda-wallet-*` web components, the element is completely unstyled and not encapsulated in a shadow DOM to allow for easy customizability. The raw html is available in `template.js`

## Attributes

| name          | description                                                                                                                                                 | required | default                                                                    |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------------------------------------------------------------- |
| autoresume    | when set, the component will save the current wallet connected session to localStorage and attempt to resume from it the next time the user enters the site | no       | false                                                                      |
| autoresumekey | the localStorage key to use to save autoresume data                                                                                                         | no       | `@kcf/kda-wallets-web-components-base.DEFAULT_AUTORESUME_LOCALSTORAGE_KEY` |

## Custom Events

See `@kcf/kda-wallet-web-components-base` for custom events' detail schema

| name                   | dispatched after       |
| ---------------------- | ---------------------- |
| kdawallet:beginconnect | user clicks the button |
| kdawallet:connected    | wallet connected       |
| kdawallet:disconnected | wallet disconnected    |
| kdawallet:error        | error                  |

## Example

```html
<kda-wallet-zelcore-connect-button
  autoresume
></kda-wallet-zelcore-connect-button>
```

```js
const btn = document.querySelector("kda-wallet-zelcore-connect-button");
const wallet = btn.connectedWallet;
if (wallet) {
  console.log(wallet.accounts);
}
```