These docs are for v1.0. Click to read the latest docs for v2.4.

Wallet

To interact with the Arianee Protocol, a wallet is mandatory to store your NFTs.

Create wallet from private key

Method

ArianeeWalletBuilder.fromPrivateKey(privatekey);

ParameterTypeMandatoryDescription
privateKeyStringString representing a 64 hex digits prefixed with 0x.

Output

object returns ArianeeWallet object, an Arianee wallet object.

Example

let wallet = arianee.fromPrivateKey('0x516bd2a1d8fbff19ef39501b17176def4150589d9200df1f34e6d91f57f5f40b');

Create wallet from random key

Method

ArianeeWalletBuilder.fromRandomKey();

Output

object returns ArianeeWallet object, an Arianee wallet object.

Example

let wallet = arianee.fromRandomKey();

Create wallet from specific mnemonic

📌

Generate a BIP-039 and BIP-044 wallet from mnemonic deriving path using the wordlist. The language is English (en). The derivation path is “m/44’/60’/0’/0/0”.

Method

ArianeeWalletBuilder.fromMnemonic(mnemonic);
ParameterTypeMandatoryDescription
mnemonicStringString representing with 12-word passphrase.

Output

object returns ArianeeWallet object, an Arianee wallet object.

Example

let wallet = arianee.fromMnemonic('path return wheel crime share torch orbit aunt sponsor earth feel prepare');

Create wallet from random mnemonic

📌

Generate a BIP-039 and BIP-044 wallet from mnemonic deriving path using the wordlist. The language is English (en). The derivation path is “m/44’/60’/0’/0/0”.

Method

ArianeeWalletBuilder.fromRandomMnemonic();

Output

object returns ArianeeWallet object, an Arianee wallet object.

Example

let wallet = arianee.fromRandomMnemonic();

Read public and private keys

When your wallet is instantiated, address and private key are available.

Method

let address = wallet.address;

let privateKey = wallet.privateKey;

📌

publicKey property is deprecated.


Create instance between Arianee and external wallet

Create an instance between Arianee and external wallet such as MetaMask for example.

Methods:

import Web3 from 'web3';
import { NETWORK } from '../src';
import { Arianee } from '../src/core/arianee';

// First, create a Web3 instance with the current provider from MetaMask
const web3 = new Web3(window.ethereum);

(async function () {
  const arianee = await new Arianee().init(NETWORK.polygon, {
    blockchainProxy: {
      enable: true,
      host: 'https://api.arianee.com/report'
    }

  });
  // Next, use the fromExternalWallet method to create an ArianeeWallet instance from the MetaMask wallet
  const arianeeWallet = arianee.fromExternalWallet({
    address: web3.eth.accounts[0], 
	// The address of the connected wallet
    customSign: async (data: string) => {
  // Use Metamask's personal_sign method to sign the data with the connected wallet
      const signature = await web3.eth.personal.sign(data, web3.eth.accounts[0], '');
  // Return an object with the message, messageHash, and signature
      return { message: data, messageHash: '', signature };
    }
  });
 
  // Now you can use the ArianeeWallet instance to interact with the Arianee network
  const proof = await arianeeWallet.methods.createCertificateProofLink(123);
});

Result: The external wallet can now interact with the Arianee network. As shown in the code snippet, an Arianee NFT proof of ownership can be created.


Create read-only object

No private key generation to empower performance. This method allows to display an NFT landing page without wallet generation.

Method:

ArianeeWalletBuilder.readOnlyWallet();

Output: A read-only object is returned. This method does not create a wallet. It creates a read-only wallet object in your application, which can be used to read information.

Example:

let wallet = arianee.readOnlyWallet();