NotCentralised
  • Introduction
  • Technical Overview
  • Workflows
    • Files
    • Credentials
    • Tokens
    • Deals
    • Service Bus
  • SDK
    • Initialise
    • Register and Generate Keys
    • Files
    • Credentials
    • Tokens
    • Deals
    • Service Bus
  • Contracts
    • Wallet
    • Vault
    • Deal
    • Oracle
    • Service Bus
  • Circuits
    • DataVerifier
    • HashApprover
    • HashMinCommitment
    • HashReceiver
    • HashSender
Powered by GitBook
On this page
  1. SDK

Service Bus

The guide walks you through the process from importing necessary libraries to adding and retrieving event values.

Firstly, import the required libraries:

import { NotVault, ServiceBus } from '@notcentralised/notvault-sdk';

Instructions

  1. Instantiate the NotVault and ServiceBus classes:

const vault = new NotVault();
const servicebus = new ServiceBus(vault);

The NotVault instance is required to initialize the ServiceBus class, which manages events in the confidential service bus.

  1. Define the Key and Confidential Value:

const key = BigInt(1);
const confidentialValue = BigInt(2);

The key and confidentialValue are BigInt values. You may replace 1 and 2 with any integers of your choice.

  1. Add an event value:

await servicebus.setValue(key, confidentialValue);

You can add an event value to the confidential service bus by calling the setValue() method. It requires two parameters: the key and the confidential value.

  1. Get an event value:

const retrievedConfidentialValue : BigInt = await servicebus.getValue("... Wallet Address ...", key);

You can retrieve the event value from the confidential service bus using the getValue() method. It requires two parameters: the wallet address and the key. It will return the confidential value associated with the given key.

PreviousDealsNextContracts

Last updated 1 year ago