Links
Comment on page

Blockchain

Functions that let you query the chain state and submit transactions. All the following functions can utilize Vault+ to sign and submit transactions.
The wallet module within Vault+ generates and stores an encrypted BIP32 mnemonic, which is used to generate SR25519 key pairs that are also encrypted and stored in Vault+.
This key pair is used to sign data (e.g. Schemas and Credentials), encrypt private data, and send transactions to the Seneca blockchain. None of the mnemonic data or the private key ever leave the wallet module.

Schemas

Functions that interact with the on-chain schema data store.

async createSchema(schema: Schema)

Publicly register (store) a schema on the Seneca blockchain. Sufficient native Seneca tokens are needed in your Vault+ wallet address with ID 0 to execute the blockchain call.
Return Type: Promise<EventCreateSchemaResponseData<object>>
const response = await createSchema(schema: Schema);
console.log(response)
`{
txHash: '0x8e62b3334a44bad68303e2e26001cda858e81ddf3d88256aa72758d8ea45fd14',
signature: '0x0445174baf49b4bd9114756b11d80512d17ca8474c563934ea1fda3492d1a87e7cba5dd8ba12ceaf6061a94e51a8299cf0070a2c5261f6165cc71d942938648c'
}`
Returned Object Fields->
txHash: Hash of the transaction in the call of which the schema is created.
signature: The signature of the created schema.
The schema parameter must adhere to the Schema data type specifications otherwise the function will throw an error.

async getSchema(signature: string)

Retrieve a schema with the given signature from the blockchain. The signature is used as the key that maps schemas on-chain.
Return Type: Promise<Schema>
const schema = await getSchema(schemaId);
The schemaId (signature) parameter can be found on the Mantis marketplace of whichever schema you would like to query.

async getAllSchemas()

Retrieve all schemas from the Seneca Blockchain.
Return Type: Promise<Array<Schema>>
const schemas = await getAllSchemas();

Credentials

Functions that interact with the on-chain credential data store. Sufficient native Seneca tokens are needed in your Vault+ wallet address with ID 0 to execute the blockchain call.

async createCredential(credential : Credential)

Publicly register (store) a credential on the Seneca blockchain.
Return Type: Promise<EventCreateCredentialResponseData<object>>
const response = await createCredential(credential: Credential);
console.log(response)
`{
txHash: '0xf3d88256aa72758d8ea45fd148e62b3334a44bad68303e2e26001cda858e81dd',
signature: '0xbcae0bd37fb77c83397ef649a5fd5527aa52ae00168b39d3d4bdb038f42f48095a32b724a1d4855dfe70eaedec888bf7644e63f6972a4120fa8a55ce2640518c'
}`
Returned Object Fields->
txHash: Hash of the transaction of the call in which the credential is created.
signature: The signature of the credential created (this signature is generate on the vault using the wallet key and then sent to the chain).
The credential parameter must adhere to the Credential data type specifications otherwise the function will throw an error.

async getCredential(signature: string)

Retrieve a credential with the given signature from the Seneca blockchain. The signature is used as the key that maps credentials on-chain.
Return Type: Promise<Credential>
const credential = await getCredential(signature);

async getAllCredentials()

Retrieve all credentials from the Seneca blockchain.
Return Type: Promise<Array<Credential>>
const credentials = await getAllCredentials();

Tokens

Functions that interact with the native token of Seneca blockchain accounts.

async getBalance(address: string)

Read the current native token balance of a Seneca blockchain account. address is the SS58-format address of the account whose balance is being read.
Return Type: number
const balance = await getBalance("5GHJvRMyqSGnMSWoLgE9WSufoZZ6dBowdkDV4dvYApBykd9Z");

async sendTokens(receiver: string, amount: number, senderID: number)

Send amount number of tokens to the receiver address on the Seneca blockchain from the wallet address with ID equal to senderID. Token balance of at least amount value required in the wallet address. Vault+ by default creates a single address with ID equal to 0.
Return Type: Promise<EventSendTokenResponseData>
const response = await sendToken("5GHJvRMyqSGnMSWoLgE9WSufoZZ6dBowdkDV4dvYApBykd9Z", 12000000, 0);
console.log(response)
`{
txHash: '0x8e62b3334a44bad68303e2e26001cda858e81ddf3d88256aa72758d8ea45fd14',
}`
Returned Object Fields->
txHash: Hash of the transaction in the call of which the token transfer executes.