# walletconnect-extension

> Tatum JS SDK extension - Wallet Connect provider

Latest version **1.0.6** (published 2023-10-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install walletconnect-extension
pnpm add walletconnect-extension
yarn add walletconnect-extension
bun add walletconnect-extension
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.6 |
| Published | 2023-10-04 |
| First published | 2023-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 40.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Exzender |
| Maintainers | kutuk |
| Keywords | Tatum, SDK, Blockchain, Extension |

## Links

- npm: https://www.npmjs.com/package/walletconnect-extension
- Repository: https://github.com/exzender/walletconnect-tatum-extension
- Homepage: https://github.com/exzender/walletconnect-tatum-extension#readme
- Issues: https://github.com/exzender/walletconnect-tatum-extension/issues
- npm.io page: https://npm.io/package/walletconnect-extension

## Dependencies (3)

- [@tatumio/tatum](https://npm.io/package/@tatumio/tatum.md) ^4.0.7
- [@walletconnect/modal](https://npm.io/package/@walletconnect/modal.md) ^2.6.2
- [@walletconnect/sign-client](https://npm.io/package/@walletconnect/sign-client.md) ^2.10.1

## Recent versions

- 1.0.6 (latest) — 2023-10-04
- 1.0.5 — 2023-09-28
- 1.0.4 — 2023-09-28
- 1.0.3 — 2023-09-28

## README

# ⚙️️ WalletConnect Extension for use with Tatum SDK

The WalletConnect Extension adds WalletConnect v2 support to Tatum SDK.
Current version supports only EVM networks, supported by Tatum SDK.

## Base for the project

🔗 TatumSDK - https://github.com/tatumio/tatum-js <br />
🔗 TatumSDK extensions - https://github.com/tatumio/ecosystem-addons <br />
🔗 WalletConnect - https://github.com/WalletConnect

## 🛠️ How to Use

Install the app's dependencies:

```bash
npm install @tatumio/tatum
npm install walletconnect-extension
```

## Working with WalletConnect provider

WalletConnect requires provider initialization. \
Each add/dApp using WalletConnect should have PROJECT_ID, which can be obtained [here](https://cloud.walletconnect.com/)

Initialization object also could have metadata and other parameters.

```ts
const wcInitOpts = {
    projectId: PROJECT_ID,
    // optional parameters
    // relayUrl: '<YOUR RELAY URL>',
    metadata: {
        name: 'Test Tatum Dapp',
        description: 'Test Tatum Dapp',
        url: '#',
        icons: ['https://walletconnect.com/walletconnect-logo.png']
    }
}
```
Initialization of Tatum SDK with WalletConnect extension:

```ts
import { TatumSDK, Network } from "@tatumio/tatum"
import { WalletConnectExtension } from "walletconnect-extension" 

const tatum = await TatumSDK.init<Ethereum>({
    network: Network.ETHEREUM,
    configureWalletProviders: [
        {type: WalletConnectExtension, config: wcInitOpts}]

})
```
Now provider can connect:
```ts
const wcAccount: string = await tatum.walletProvider.use(WalletConnectExtension).getWallet()
console.log(wcAccount)
```
To be able to respond to WalletConnect events watch for events from emitter. \
Only `wcSessionDelete` event implemented - appears when the user disconnects session from its wallet.
```ts
tatum.walletProvider.use(WalletConnectExtension).emitter.on('wcSessionDelete', (() => console.log('disconnected')))
```

### Implemented functions

```ts
getWallet()  // connect & return connected address
disconnect() // close current connection
signAndBroadcast()  // set already prepared transaction (= customPayload)
signPersonal()   // sign text message
transferNative() // sign & transfer coin native for active chain
transferErc20()  // sign & transfer ERC20 token
approveErc20()   // approve spending of ERC20 token to provided contract address
createFungibleToken() // create custom ERC20 token
```

### To pack this extension locally, execute the following steps:

```bash
yarn install
yarn build
yarn pack
```

Keep a record of the output path for the .tgz file. You'll refer to it when updating the `package.json` of your test application.

## Contacts

[LinkedIn](https://www.linkedin.com/in/aleksandr-s-terekhov/)

---
_Source: https://npm.io/package/walletconnect-extension · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
