Create & Manage Message

Methods related to dMessage management.

Get available dMessage ID

Method

creator.getAvailableMessageId()

Return Payload

promise returns number corresponding to the messageId.


Check if a dMessage ID is available

Method

creator.isMessageIdAvailable(id)
ParameterTypeRequiredDescription
idStringdMessage identification number to be checked.

Return Payload

promise returns boolean.

BooleanDescription
truedMessage ID available.
falsedMessage ID already used.

Create dMessage

Create and send a dMessage and store its content on the Arianee Privacy Gateway.

⚠️

  • Your wallet must own at least 1 message credit. The credit is spent when the message is read.
  • The dMessage requires to have an identity URI.

Method

creator.createAndStoreMessage(data, overrideTransaction?:NonPayableOverrides)

Parameter

Type

Required

Description

datasmartAssetId

String

Recipient digital passport of the message.

datauri

String

Message uri. Mandatory with imprint if no content.

dataimprint

String

Imprint of the message. Mandatory with uri if no content.

datacontent

Object

Content mandatory if no uri and imprint.
For more information on compliant fields, see Message Schema.

datamessageId

String

dMessage identification number. If not defined, a random one is generated.

overrrides

gasPrice, gasLimit, maxFeePerGas, maxPriorityPerGas

Allows you to override the gas/gasprice part to be able to move transactions through more quickly if needed.

const core = Core.fromRandom();
const creator = new Creator({
  creatorAddress: '', // address that will be rewarded for creator action
  core: core,
});
const isConnected = await creator.connect('polygon');
if (isConnected) {
  await creator.buyCredit(CreditType.message, 1);
  await creator.messages.createAndStoreMessage({
    smartAssetId: 12343,
    messageId: 1232143,
    content: {},
  }); /

Return Payload

The dMessage is created and received in the recipient wallet.

Errors

Error typeDescription
InsufficientMessageCreditsErrorThe core wallet address does not have enough message credits.
UnavailableMessageIdErrorThe messageId is not available.
NoIdentityErrorThe core wallet address does not have an Identity URI.
ArianeePrivacyGatewayErrorError while interacting with the Arianee Privacy Gateway.

Get started with Arianee's recipe 🚀


Create dMessage without storing content

Method for test purposes.

⚠️

Your wallet must own at least 1 message credit. The credit is spent when the message is read.

Method

creator.createMessage(CreateAndStoreEventParameters, overrideTransaction?:NonPayableOverrides)
ParameterTypeRequiredDescription
smartAssetIdStringRecipient digital passport of the message.
imprintStringImprint of the message. Mandatory with uri if no content.
messageIdStringdMessage identification number. If not defined, a random one is generated.
overrridesgasPrice, gasLimit, maxFeePerGas, maxPriorityPerGasAllows you to override the gas/gasprice part to be able to move transactions through more quickly if needed.

Return Payload

The dMessage is created and received in the recipient wallet.

Errors

Error typeDescription
InsufficientMessageCreditsErrorThe core wallet address does not have enough message credits.
UnavailableMessageIdErrorThe messageId is not available.