Create

Usage

Import the Forget declaration to interact with the Publish function and the Item type to choose your storage location.

import { messages } from 'aleph-sdk-ts';
import { ItemType } from 'aleph-sdk-ts/dist/messages/message';

// Or used optimized import

import { Publish as publishForget } from 'aleph-sdk-ts/dist/messages/forget';

Then call the publishForget function, with the required parameters as follow:

(async() => {
  await publishForget({
    account: account,
    channel: 'TEST',
    hashes: ['<item_hash_here>']
  })
})()

Parameters

account - required Account

The Account to sign the message. It also needs to be the owner of the messages to forget.

hashes - required array of strings

A list of original message item hashes to forget. Multiple can be passed at once.

channel - required string

Channel of the message. Ideally, an application would decide and use one channel.

reason - optional string

Optional description of why the messages should be forgotten.

storageEngine - optional ItemType

The storage engine to use when storing the object (IPFS, inline or Aleph)

APIServer - optional string

The API server endpoint used to carry the request to the Aleph's network.

Example: Forget a Post message

import { accounts  } from 'aleph-sdk-ts';
import { Publish as publishForget } from 'aleph-sdk-ts/dist/messages/forget';

import { Publish as publishPost } from "aleph-sdk-ts/dist/messages/post/publish";
import { Get as getPost } from "aleph-sdk-ts/dist/messages/post/get";

import {ItemType} from "aleph-sdk-ts/dist/messages/message";

(async() => {
	const { account } = accounts.ethereum.NewAccount();

	const res = await publishPost({
		account: account,
		postType: 'Blog',
		channel: 'TEST',
		content: {'body': 'This will be forget'}
	})

	await publishForget({
		account: account,
		channel: 'TEST',
		hashes: [res.item_hash]
	})

	const postData = await getPost({
		types: 'Blog',
		pagination: 200,
		hashes: [res.item_hash]
	})
	console.log(postData.posts)

})()

If you run this code, the postData will be empty because the Item_content of the post doesn't exist anymore.

Last updated