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
idStringβœ…dMessage 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)
ParameterTypeRequiredDescription
data β†’ smartAssetIdStringβœ…Recipient NFT of the message.
data β†’ uriStringβœ…Message uri. Mandatory with imprint if no content.
data β†’ imprintStringβœ…Imprint of the message. Mandatory with uri if no content.
data β†’ contentObjectβœ…Content mandatory if no uri and imprint.
data β†’ messageIdString❌dMessage identification number. If not defined, a random one is generated.
overrridesgasPrice, 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
smartAssetIdStringβœ…Recipient NFT of the message.
imprintStringβœ…Imprint of the message. Mandatory with uri if no content.
messageIdString❌dMessage identification number. If not defined, a random one is generated.
overrridesgasPrice, gasLimit, maxFeePerGas, maxPriorityPerGas❌Allows 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.