Transfer items

📘

Permissions Required

This feature requires the ITEMS_WRITE permission and your application to be the creator of the item.

Transfer an item

The code below shows how to transfer an item from a connected HandCash wallet:

const { HandCashConnect } = require('@handcash/handcash-connect');
const handCashConnect = new HandCashConnect({ 
   appId: '<app-id>', 
   appSecret: '<secret>',
}); 

const account = handCashConnect.getAccountFromAuthToken(token);

// Sending to other HandCash user via handle
const result = await account.items.transfer({
  destinationsWithOrigins: [
    {
      destination: 'satoshi',
      origins: ['27c02c976adbf0acb212b850ce0c0b1b796de0a646c93304f94f2dc3249cad25_33']
    }
  ]
});

// Sending to an external wallet via address
const result = await account.items.transfer({
  destinationsWithOrigins: [
    {
      destination: 'satoshi',
      origins: ['18jMjdXWXYFNU2waM8wCepTiUzuiQ8gZHt']
    }
  ]
});

console.log(result.transactionId);
e8ff31dd1c927e4ede8680ae6aca4a5bc807d5d1dc1989e9206b912fd7cc6fda