---
updatedAt: 2025-06-09T22:43:43.000Z
agentTools:
  projectIndex: https://docs.dinari.com/llms.txt
---

# Managing Wallets

A `Wallet` represents a wallet on a blockchain. For trading activities to be tracked in Dinari, a wallet must be linked to an `Account`. The following section provides examples on how to manage wallets on an account. Please note that to manage your organization's wallet, an account id that is linked to the entity id provided in your dashboard must be used.

# Dinari-managed Wallets

> ❗️ This will only work on your organization's accounts

To create a Dinari-managed wallet, visit your dashboard and do the following:

<Image align="center" border={false} caption="1. Click on `Create Account`" src="https://files.readme.io/0f9363ac8ca6fb0424d7748b6ce901650860442b7b27ab0a491a53ee548f8355-image.png" />

<Image align="center" border={false} caption="2. On the row for the new Account created, click on `+ Connect Wallet`" src="https://files.readme.io/d88708fe256b6cef72afa87abc1146081359fc40dd6225c038f541baa8a05dc9-image.png" />

<br />

<Image align="center" border={false} caption="3. A modal will pop up. Select `Use a Managed Wallet` and click `Submit`" src="https://files.readme.io/8a7847c91b40e44e0946d3cd63201b0ceaf173e0d4c78f219da5ab80942bbf4d-image.png" />

# External Wallets

## SDK Reference

| Language                | URL                                                                                 |
| :---------------------- | :---------------------------------------------------------------------------------- |
| Javascript / Typescript | <https://github.com/dinaricrypto/dinari-api-sdk-typescript/blob/main/api.md#wallet> |
| Python                  | <https://github.com/dinaricrypto/dinari-api-sdk-python/blob/main/api.md#wallet>     |
| Go                      | <https://github.com/dinaricrypto/dinari-api-sdk-go/blob/main/api.md#wallet>         |

## SDK Examples

## Connecting a Wallet to an Account

```typescript TypeScript
import Dinari from '@dinari/api-sdk';

const client = new Dinari({
  apiKeyID: process.env['DINARI_API_KEY_ID'], // This is the default and can be omitted
  apiSecretKey: process.env['DINARI_API_SECRET_KEY'], // This is the default and can be omitted
  environment: 'sandbox', // defaults to 'production'
});

async function main() {
  const accountID = 'your-account-id';
  const walletAddress = 'your-wallet-address';

  // Step 1: Get the nonce message to sign
  const nonceResp = await client.v2.accounts.wallet.external.getNonce(accountID, {
    wallet_address: walletAddress,
  });

  // Step 2: Sign the message (replace this with actual off-chain signing)
  const signature = 'your-wallet-signature'; // Sign nonceResp.message with the wallet

  // Step 3: Connect the wallet using the signed message
  const linkedWallet = await client.v2.accounts.wallet.external.connect(accountID, {
    chain_id: 'eip155:1',
    nonce: nonceResp.nonce,
    signature,
    wallet_address: walletAddress,
  });

  console.log(linkedWallet);
}

main();
```
```python Python
import os
from dinari_api_sdk import Dinari

client = Dinari(
    api_key_id=os.environ.get("DINARI_API_KEY_ID"),  # This is the default and can be omitted
    api_secret_key=os.environ.get("DINARI_API_SECRET_KEY"),  # This is the default and can be omitted
    environment="sandbox", # defaults to "production"
)

account_id = "your-account-id"
wallet_address = "your-wallet-address"

# Step 1: Get the nonce message to sign
nonce_resp = client.v2.accounts.wallet.external.get_nonce(
    account_id=account_id,
    wallet_address=wallet_address,
)

# Step 2: Sign the message (replace this with actual off-chain signing)
signature = "your-wallet-signature"  # Sign nonce_resp.message with the wallet

# Step 3: Connect the wallet using the signed message
linked_wallet = client.v2.accounts.wallet.external.connect(
    account_id=account_id,
    chain_id="eip155:1",
    nonce=nonce_resp.nonce,
    signature=signature,
    wallet_address=wallet_address,
)
```
```go Go
package main

import (
	"context"
	"fmt"
	"log"

	dinari "github.com/dinaricrypto/dinari-api-sdk-go"
	"github.com/dinaricrypto/dinari-api-sdk-go/option"
)

func main() {
	// DINARI_API_KEY_ID and DINARI_API_SECRET_KEY are set as environment variables
	client := dinari.NewClient(
		option.WithEnvironmentSandbox(), // Defaults to production when omitted
	)

	accountID := "your-account-id"
	walletAddress := "your-wallet-address"

	// Step 1: Get the nonce message to sign
	externalWalletResp, err := client.V2.Accounts.Wallet.External.GetNonce(context.TODO(), accountID, dinari.V2AccountWalletExternalGetNonceParams{
		WalletAddress: walletAddress,
	})
	if err != nil {
		log.Fatalf("Failed to get wallet nonce: %v", err)
	}

	// Step 2: Sign the message (this part is mocked for now)
	signature := "your-wallet-signature" // You'd sign externalWalletResp.Message off-chain

	// Step 3: Connect the wallet using the signed message
	linkedWallet, err := client.V2.Accounts.Wallet.External.Connect(context.TODO(), accountID, dinari.V2AccountWalletExternalConnectParams{
		ChainID:       dinari.ChainEip155_1,
		Nonce:         externalWalletResp.Nonce,
		Signature:     signature,
		WalletAddress: walletAddress,
	})
	if err != nil {
		log.Fatalf("Failed to connect external wallet: %v", err)
	}

	fmt.Printf("Linked Wallet: %+v\n", linkedWallet)
}
```