Neucron Javascript SDK
  • Authentication
  • Wallet
  • Transaction
    • Pay
    • Smart Contract
    • Digital Signature
    • Data Integrity
  • Team
  • Assetyzer
  • Paymail
Powered by GitBook
On this page

Wallet

Introduction

Welcome to the Neucron SDK Wallet Module documentation. This module provides functionalities for managing wallets, accessing wallet information, and interacting with wallet-related features. Before using this module, make sure you have successfully authenticated with the Neucron SDK.

Getting Started

To use the Neucron SDK Wallet Module, follow these steps:

  1. Install the Neucron SDK:

    npm install neucron-sdk
  2. Import the SDK into your project:

    import NeucronSDK from "./src/neucron-sdk.js";
    
    const neucron = new NeucronSDK();
    await neucron.authentication.login({ email: "your-email@example.com", password: "your-password" });
  3. Access the Wallet Module:

    const walletModule = neucron.wallet;

Create Wallet

Create a new wallet with a specified name. If no walletId is provided, the default walletId will be used.

const walletCreation1 = await walletModule.createWallet({ walletName: 'Hello World-2' });
console.log(walletCreation1);

Create a wallet for a specific app by providing an appId. If no walletId is provided, the default walletId will be used.

const walletCreation2 = await walletModule.createWallet({
  walletName: 'for app Hello 00 9090 World-2',
  appId: 'd4622df9-d5ef-45e3-8d65-4837c45333ba'
});
console.log(walletCreation2);

Set Default Wallet

Set a wallet as the default wallet using its walletId. If no walletId is provided, the default walletId will be used.

const defaultWallet = await walletModule.setDefaultWallet({ walletId: '7c1e8e9b-46dd-404d-9d0f-600c291b052d' });
console.log(defaultWallet);

Get Wallet History

Retrieve the transaction history of a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const walletHistory1 = await walletModule.getWalletHistory({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(walletHistory1);

const walletHistory2 = await walletModule.getWalletHistory({});
console.log(walletHistory2);

Get Wallet Keys

Retrieve the keys associated with a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const walletKeys1 = await walletModule.getWalletKeys({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(walletKeys1);

const walletKeys2 = await walletModule.getWalletKeys({});
console.log(walletKeys2);

Get Wallet Balance

Retrieve the balance of a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const walletBalance1 = await walletModule.getWalletBalance({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(walletBalance1);

const walletBalance2 = await walletModule.getWalletBalance({});
console.log(walletBalance2);

Get All Wallets

Retrieve information about all wallets associated with the authenticated user.

const allWallets = await walletModule.getAllWallet();
console.log(allWallets);

Get All UTXOs

Retrieve all unspent transaction outputs (UTXOs) associated with a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const allUtxos1 = await walletModule.getAllUtxos({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(allUtxos1);

const allUtxos2 = await walletModule.getAllUtxos({});
console.log(allUtxos2);

Get XPub Keys

Retrieve the extended public (XPub) keys associated with a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const xPubKeys1 = await walletModule.getXPubKeys({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(xPubKeys1);

const xPubKeys2 = await walletModule.getXPubKeys({});
console.log(xPubKeys2);

Get Mnemonic

Retrieve the mnemonic associated with a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const mnemonic1 = await walletModule.getMnemonic({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(mnemonic1);

const mnemonic2 = await walletModule.getMnemonic({});
console.log(mnemonic2);

Get Addresses by Wallet ID

Retrieve all addresses associated with a specific wallet using its walletId. If no walletId is provided, the default walletId will be used.

const addresses1 = await walletModule.getAddressesByWalletId({ walletId: 'ab8b7cd9-1482-4604-aabe-2a63d4e2fd73' });
console.log(addresses1);

const addresses2 = await walletModule.getAddressesByWalletId({});
console.log(addresses2);

Feel free to further customize this documentation based on your actual API responses and any additional features or considerations for using the Neucron SDK Wallet Module.

PreviousAuthenticationNextPay

Last updated 1 year ago