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:

- Click on
Create Account

- On the row for the new Account created, click on
+ Connect Wallet

- A modal will pop up. Select
Use a Managed Wallet
and clickSubmit
External Wallets
SDK Reference
SDK Examples
Connecting a Wallet to an Account
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();
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,
)
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)
}
Updated 16 days ago