Aleph SDK help you to fetch every kind of messages with many parameters
Messages can be fetched over the SDK by using their Get function.
Each message type required different parameters to be fetched. Refer to their dedicated pages for more details.
Let's say we want to get some Post messages.
So, first, we need to import the Post declaration to access the Get function.
import { post } from'aleph-sdk-ts/dist/messages';
A basic get can be performed like this:
(async() => {constfetched=awaitpost.Get({ types:'test',// Message type of the post you want. pagination:10,// Message per pages you want. page:1,// Requested page. APIServer:'https://api2.aleph.im'// Target API server to use. })})()
(async() => {constfetched=awaitaggregate.Get({ addresses:account.address,// Accounts address that own the aggregates. APIServer:'https://api2.aleph.im'// Target API server to use. })})()
Let's say we want to get file content.
So, first, we need to import the Store declaration to access the Get function.
import { store } from'aleph-sdk-ts/dist/messages';
A basic get can be performed like this:
(async() => {constfetched=awaitstore.Get({ fileHash:"QmQkv43jguT5HLC8TPbYJi2iEmr4MgLgu4nmBoR4zjYb3L",// hash of the file. APIServer:DEFAULT_API_V2,// Target API server to use. });})()
The return value of the call
<Buffer 5468697320697320 6a 75737420612074657374 2e>newTextDecoder().decode(fetched) ="This is just a test";