---
title: Wallets Module
slug: signum/wallets-module
docTags: 
createdAt: 2022-08-30T21:23:54.000Z
---

::Image[]{src="https://api.archbee.com/api/optimize/l2AIpSUU6srSQmG1-K2bb/th9l3GRFlPNtHXKIda1u-_contract.png" size="20" width="512" height="512" position="center" showCaption="false"}

| API Reference                                                                                    | [SignumJS Wallets](https://signum-network.github.io/signumjs/modules/wallets.html)                                                                                                                                                                  |
| ------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| NPM Package                                                                                      | [@signumjs/wallets](https://www.npmjs.com/package/@signumjs/wallets)                                                                                                                                                                                |
| CDN URL[](https://cdn.jsdelivr.net/npm/@signumjs/crypto@1.0.0-rc.31/dist/signumjs.crypto.min.js) | [](https://cdn.jsdelivr.net/npm/@signumjs/contracts/dist/signumjs.contracts.min.js)<br />[https://cdn.jsdelivr.net/npm/@signumjs/wallets/dist/signumjs.wallets.min.js](https://cdn.jsdelivr.net/npm/@signumjs/wallets/dist/signumjs.wallets.min.js) |
| IIFE namespace                                                                                   | `sig$wallets`                                                                                                                                                                                                                                       |



## Installation

:::CodeblockTabs
npm

```shell
npm i @signumjs/wallets
```

yarn

```shell
yarn add @signumjs/wallets
```

\<script/>

```html
<script src='https://cdn.jsdelivr.net/npm/@signumjs/wallets/dist/signumjs.wallets.min.js'></script>

<!--  namespace is sig$contracts -->
<script >
     // ...
     // contract fetched previously
    const view = new sig$contracts.ContractDataView(contract); 
    // using named indices is better for readability
    const ContractDataIndex = {
         Owner: 1,
         Price: 2,
         // ...
    }
    const contractOwner = view.getVariableAsDecimal(ContractDataIndex.Owner)
</script>
```
:::

## Basic Usage

The wallets module offers easy-to-use abstractions to interact with wallets via one-way deep linking for mobile and desktop wallet and/or full-duplex communication with the [XT Wallet](https://www.signum.network/wallet).

The following example shows how to generate a (deep) link, that opens the Phoenix Wallet (Mobile or Desktop).&#x20;

:::CodeblockTabs
```javascript
async function createPaymentLink(args) {
    try {
        const {recipient, amount, reference} = args
        // In NodeJS the wallet will only generate the link, 
        // but running this code in the browser opens the deeplink
        // which opens the Phoenix wallet, if installed 
        const wallet = new DeeplinkableWallet()
        const recipientId = Address.create(recipient).getNumericId()

        const result = await wallet.pay({
            amount,
            message: reference,
            to: recipientId
        })
        console.info(`Your deeplink: ${result}`)
    } catch (e) {
        handleError(e);
    }
}

(async () => {
    await createPaymentLink({
        recipient: 'S-9K9L-4CB5-88Y5-F5G4Z',
        amount: 100.00,
        reference: 'Donation'
    });
})();
```

\<script/>

```javascript
async function createPaymentLink(args) {
    try {
        const {recipient, amount, reference} = args
        // In NodeJS the wallet will only generate the link, 
        // but running this code in the browser opens the deeplink
        // which opens the Phoenix wallet, if installed 
        const wallet = new sig$wallets.DeeplinkableWallet()
        const recipientId = sig$util.Address.create(recipient).getNumericId()

        const result = await wallet.pay({
            amount,
            message: reference,
            to: recipientId
        })
        console.info(`Your deeplink: ${result}`)
    } catch (e) {
        handleError(e);
    }
}

(async () => {
    await createPaymentLink({
        recipient: 'S-9K9L-4CB5-88Y5-F5G4Z',
        amount: 100.00,
        reference: 'Donation'
    });
})();
```
:::
