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)
Parameter | Type | Required | Description |
---|---|---|---|
id | String | ✅ | dMessage identification number to be checked. |
Return Payload
promise
returns boolean
.
Boolean | Description |
---|---|
true | dMessage ID available. |
false | dMessage 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 |
---|---|---|---|
data → smartAssetId | String | ✅ | Recipient digital passport of the message. |
data → uri | String | ✅ | Message uri. Mandatory with imprint if no content. |
data → imprint | String | ✅ | Imprint of the message. Mandatory with uri if no content. |
data → content | Object | ✅ | Content mandatory if no uri and imprint. |
data → messageId | 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 type | Description |
---|---|
InsufficientMessageCreditsError | The core wallet address does not have enough message credits. |
UnavailableMessageIdError | The messageId is not available. |
NoIdentityError | The core wallet address does not have an Identity URI. |
ArianeePrivacyGatewayError | Error while interacting with the Arianee Privacy Gateway. |
Get started with Arianee's recipe 🚀
✉️
Send dMessage
Open 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)
Parameter | Type | Required | Description |
---|---|---|---|
smartAssetId | String | ✅ | Recipient digital passport of the message. |
imprint | String | ✅ | Imprint of the message. Mandatory with uri if no content. |
messageId | 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. |
Return Payload
The dMessage is created and received in the recipient wallet.
Errors
Error type | Description |
---|---|
InsufficientMessageCreditsError | The core wallet address does not have enough message credits. |
UnavailableMessageIdError | The messageId is not available. |
Updated about 2 months ago