Skip to content

Commit

Permalink
Merge pull request #308 from MoralisWeb3/streams-struct
Browse files Browse the repository at this point in the history
Update Streams API Structure
  • Loading branch information
Nazeim authored Nov 28, 2023
2 parents 33c9c60 + f4d525c commit 25bef48
Show file tree
Hide file tree
Showing 44 changed files with 201 additions and 186 deletions.
11 changes: 3 additions & 8 deletions api/data/redirects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5925,11 +5925,6 @@ export const redirects = [
destination: "/web3-data-api/evm/integrations/aws-lambda-nodejs",
permanent: true,
},
{
source: "/web3-data-api/integrations/firebase-advanced-nodejs",
destination: "/web3-data-api/evm/integrations/firebase-advanced-nodejs",
permanent: true,
},
{
source: "/web3-data-api/integrations/firebase-nodejs",
destination: "/web3-data-api/evm/integrations/firebase-nodejs",
Expand Down Expand Up @@ -6326,7 +6321,7 @@ export const redirects = [
},
{
source: "/streams-api/useful-streams-options",
destination: "/streams-api/evm/useful-streams-options",
destination: "/streams-configuration/useful-streams-options",
permanent: true,
},
{
Expand Down Expand Up @@ -6361,7 +6356,7 @@ export const redirects = [
},
{
source: "/streams-api/filter-streams",
destination: "/streams-api/evm/filter-streams",
destination: "/streams-api/evm/streams-configuration/filter-streams",
permanent: true,
},
{
Expand Down Expand Up @@ -6541,7 +6536,7 @@ export const redirects = [
},
{
source: "/streams-api/integrations/firebase",
destination: "/streams-api/evm/integrations/firebase",
destination: "/streams-api/evm/streams-configuration/firebase",
permanent: true,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ If you want to call the Moralis API from your frontend app, don't do this direct
<source src="/video/2815daf-firebase-proxy.mp4"/>
</video>

First, check out our tutorial, [Your First Dapp using Firebase](/streams-api/evm/integrations/firebase), because, in this section, we won't explain the basics, such as "how to create a project", or "how to run the Firebase emulator".

Moreover, in this tutorial, we will use three Firebase services:

- [Hosting](https://firebase.google.com/docs/hosting)
Expand Down
11 changes: 11 additions & 0 deletions docs/02-streams-api/evm/addresses/addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Addresses"
description: "learn how to monitor, list to addresses and getting native balance."
sidebar_position: 6
slug: "../webhooks"
sidebar_class_name: "sidebar-streams-configuration"
---

import DocCardList from '@theme/DocCardList';

<DocCardList />
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
title: "Get Native Balances"
slug: "get-native-balances"
slug: "../get-native-balances"
sidebar_position: 21
---

There is an option `getNativeBalances` when creating or editing a Stream. It is a list of native balances calls for specific addresses.
There is an option `getNativeBalances` when creating or editing a Stream. It is a list of native balances calls for specific addresses.

You can get Native Balances (ETH/BNB/MATIC and many more) of addresses that appear in your Webhook. They are very similar to [Triggers](/streams-api/evm/triggers).
You can get Native Balances (ETH/BNB/MATIC and many more) of addresses that appear in your Webhook. They are very similar to [Triggers](/streams-api/evm/triggers).

`getNativeBalances` trigger is currently available to use with a business plan or higher.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "Listen to all addresses"
slug: "listen-to-all-addresses"
title: "Listen to all Addresses"
slug: "../listen-to-all-addresses"
description: "Learn how to listen to all addresses, NFT contract transfers, events from new contracts specific to a contract factory, NFT contracts transfers where sender is a specific address."
sidebar_position: 5
---
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
title: "Monitor multiple addresses"
slug: "monitor-multiple-addresses"
title: "Monitor Multiple Addresses"
slug: "../monitor-multiple-addresses"
description: "Learn best practices for handling multiple addresses in your streams."
sidebar_position: 11
---

You do not have to create a separate stream for each address. Instead, you can attach multiple addresses to the same stream. The best practice is to create as few streams as possible and instead attach addresses to existing streams whenever it makes sense. You can attach any number of addresses to a stream.
You do not have to create a separate stream for each address. Instead, you can attach multiple addresses to the same stream. The best practice is to create as few streams as possible and instead attach addresses to existing streams whenever it makes sense. You can attach any number of addresses to a stream.

> If you really need more streams update to a paid plan or contact support ([email protected]) if you are already a paying client.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "🙋 FAQ"
sidebar_position: 20
title: "FAQ"
sidebar_position: 21
description: "This FAQ page helps you to get answers about our Web3 API, Streams, and product features, enhancing your API integration experience."
---

Expand Down
8 changes: 1 addition & 7 deletions docs/02-streams-api/evm/getting-started/setup-secret-key.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@ description: "Learn how to set up the Streams secret key, essential for webhook
sidebar_position: 0
---

## Introduction

Welcome to the guide on setting up the Streams secret key.

## What is a Secret Key in Streams?

The Streams `secret key` is a unique string used to identify the sender of a webhook through webhook signature verification.
The Streams `secret key` is a unique string that is used to identify the sender of a webhook through webhook signature verification.

## Updating the Secret Key

Expand Down
14 changes: 7 additions & 7 deletions docs/02-streams-api/evm/getting-started/using-node-js-sdk.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Using the SDK"
title: "Manage Streams via SDK"
slug: "../using-node-js-sdk"
description: "Learn how to use the Moralis Streams API to monitor a wallet with the SDK. Create a stream, install the SDK, attach an address, and receive webhooks with transaction details."
sidebar_position: 1
Expand All @@ -9,11 +9,11 @@ In these examples, we will learn how to create and manage a Stream.

In order to use the Moralis Streams API, you can either use the SDK (programmatically) or via our UI dashboard.

## Using the SDK

:::tip
Read the article [Setting Up Moralis: Getting Started](/web3-data-api/evm/get-your-api-key) and make sure to finish all the steps.
:::

### Step 1: Create a Stream
## Step 1: Create a Stream

In order to create a stream, Moralis provides you with a [add](/streams-api/evm/reference/create-stream) endpoint to do so.

Expand Down Expand Up @@ -77,7 +77,7 @@ print(results["id"]) # print the stream id
</TabItem>
</Tabs>

### Step 2: Update a Stream
## Step 2: Update a Stream

Now that we have the stream id from the previous step, we can update the stream with additional parameters.
In this example, we will add the `includeContractLogs` parameter to the stream and make it listen for ERC20 transfers, but you can add any other parameter you want.
Expand Down Expand Up @@ -178,7 +178,7 @@ print(results)
</Tabs>


### Step 3: Delete a Stream
## Step 3: Delete a Stream

If you want to delete a stream, you can use the [delete](/streams-api/evm/reference/delete-stream) endpoint.

Expand Down Expand Up @@ -223,7 +223,7 @@ print(results)
</TabItem>
</Tabs>

### Step 4: Add an Address to a Stream
## Step 4: Add an Address to a Stream

Now that we have a stream, we can add an address to it. You can either add individual addresses or a batch. In this example, we will add a list of addresses to the stream.

Expand Down
4 changes: 2 additions & 2 deletions docs/02-streams-api/evm/getting-started/using-webui.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Using the Admin Panel"
title: "Manage Streams via Admin Panel"
slug: "../using-webui"
description: "Learn how to create a new stream on the Admin Panel of Moralis.io. Follow the step-by-step instructions to monitor your chosen address and receive data through a webhook URL."
sidebar_position: 1
Expand Down Expand Up @@ -63,7 +63,7 @@ When a transaction occurs on the wallet it will appear on the right hand termina

![](/img/content/211853590-a71f84ab-ab8c-40ca-9d28-452ba64e1de6.webp)

4. Select the events you want to track by selecting from options `Contract Interaction`, `Native Transactions`, `Internal Transactions` under `Stream Options`. To read more on each options take a look at Streams options in our [documentation](/streams-api/evm/useful-streams-options).
4. Select the events you want to track by selecting from options `Contract Interaction`, `Native Transactions`, `Internal Transactions` under `Stream Options`. To read more on each options take a look at Streams options in our [documentation](/streams-api/evm/streams-configuration/useful-streams-options).

![](/img/content/211854294-e4507fe0-6995-4bfe-a995-a0c815b3da9d.webp)

Expand Down
10 changes: 0 additions & 10 deletions docs/02-streams-api/evm/integrations/integrations.md

This file was deleted.

4 changes: 2 additions & 2 deletions docs/02-streams-api/evm/records-and-pricing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Records and Pricing"
title: "Pricing & Records"
slug: "records-and-pricing"
sidebar_position: 4
sidebar_position: 8
description: "How Records are used in Streams API to determine usage and pricing. Records are either a transaction, log, or internal transactions in the webhook response."
---

Expand Down
2 changes: 1 addition & 1 deletion docs/02-streams-api/evm/reference/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: "Streams - API Reference"
sidebar_label: "API Reference"
slug: "/streams-api/evm/evm/reference"
sidebar_class_name: "sidebar-api-reference"
sidebar_position: 22
sidebar_position: 20
---

## History
Expand Down
11 changes: 11 additions & 0 deletions docs/02-streams-api/evm/stream-security/stream-security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Streams Security"
description: "learn how to secure Webhook and spam detection."
sidebar_position: 6
slug: "../stream-security"
sidebar_class_name: "sidebar-stream-security"
---

import DocCardList from '@theme/DocCardList';

<DocCardList />
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Webhook Security"
slug: "webhook-security"
sidebar_position: 9
title: "Security"
slug: "../webhook-security"
sidebar_position: 5
description: "Keep your webhook requests secure with our implementation that signs every request with the web3api key. The signature is included in the request headers and can be easily verified by using our provided JavaScript function or adapting it for your preferred programming language."
---

Expand Down Expand Up @@ -42,13 +42,13 @@ def verify_Signature(req, secret):
provided_signature = req.headers.get("x-signature")
if not provided_signature:
raise TypeError("Signature not provided")

data = req.data+secret.encode()
signature = Web3.keccak(text=data.decode()).hex()
if provided_signature != signature:

if provided_signature != signature:
raise ValueError("Invalid Signature")
```

</TabItem>
</Tabs>
</Tabs>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Error handling"
slug: "error-handling"
sidebar_position: 14
title: "Error Handling"
slug: "../error-handling"
sidebar_position: 5
---

Moralis guarantees 100% delivery of webhooks. Still, you can have errors in your streams for example if your server is down. Moralis will retry to send the webhook in intervals. If the webhook is not delivered after 24 hours and you still want to receive the failed webhooks after some time you can manually replay the failed webhooks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Filter Streams"
title: "Filters"
slug: "filter-streams"
sidebar_position: 12
sidebar_position: 3
description: "In some cases you might want to filter the data you receive from the webhook. You can do this by adding a filter to the stream."
---

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
title: "Firebase"
slug: "firebase"
title: "Integration with Firebase"
slug: "../firebase"
description: "Moralis Streams can be used to monitor a blockchain wallet or a smart contract. This tutorial shows how you can easily plug in the Moralis Streams extension to your Firebase project and let your dapp handle blockchain events."
sidebar_position: 5
---

Moralis Streams can be used to monitor a blockchain wallet or a smart contract. This tutorial shows how you can easily plug in the Moralis Streams extension to your Firebase project and let your dapp handle blockchain events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
title: "Parse data"
slug: "parse-data"
sidebar_position: 15
description: "Moralis makes it easy to parse data from ERC20 Transfers and Approvals, NFT Transfers and Approvals, and Smart Contract Events. Stream your smart contract events and use our code as a guide to quickly and accurately extract the data into a typed data structure."
title: "Parse Data"
slug: "../parse-data"
sidebar_position: 1
description: "Moralis makes it easy to parse data from ERC20 Transfers and Approvals, NFT Transfers and Approvals, and Smart Contract Events. Stream your smart contract events and use our code as a guide to quickly and accurately extract the data into a typed data structure."
---

Moralis makes it easy to parse data from ERC20 Transfers and Approvals, NFT Transfers and Approvals, and Smart Contract Events. Stream your smart contract events and use our code as a guide to quickly and accurately extract the data into a typed data structure.
Expand Down Expand Up @@ -90,4 +90,4 @@ const test = async () => {

test();

```
```
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Stream Management"
slug: "stream-management"
sidebar_position: 13
title: "Monitor, Update, & Pause"
slug: "../stream-management"
sidebar_position: 2
description: "Moralis Stream Management allows you to monitor, update, and pause streams with ease. Programmatically or via the web UI, you can get a list of all your streams, set settings, and update the status of a stream. Get started with Moralis Stream Management today!"
---

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: "Streams Fundamentals"
description: "learn how to handle errors, testing Webhooks, and handlinng transactions of a Webhook."
sidebar_position: 4
slug: "../streams-configuration"
sidebar_class_name: "sidebar-streams-configuration"
---

import DocCardList from '@theme/DocCardList';

<DocCardList />
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Useful Streams options"
title: "Advanced Options"
slug: "useful-streams-options"
sidebar_position: 6
description: "This page provides information about the various options available when creating a stream with Useful Streams. Learn more about the includeContractLogs, includeInternalTxs, and advanced options to customize your stream."
Expand Down Expand Up @@ -57,4 +57,4 @@ To use the advancedOptions object, you must specify a `topic0` that you want to
}
```

In this example, we are listening to the ERC20-Transfer `Transfer(address,address,uint256)`. We are also using the `filter` field to specify that we only want to include transfers where the from field is equal to the address `0x283af0b28c62c092c9727f1ee09c02ca627eb7f5` and the amount that was sent is greater than `100` (converted to wei). Finally, we are using the includeNativeTxs field to specify that we do not want to include native transactions in the stream.
In this example, we are listening to the ERC20-Transfer `Transfer(address,address,uint256)`. We are also using the `filter` field to specify that we only want to include transfers where the from field is equal to the address `0x283af0b28c62c092c9727f1ee09c02ca627eb7f5` and the amount that was sent is greater than `100` (converted to wei). Finally, we are using the includeNativeTxs field to specify that we do not want to include native transactions in the stream.
Loading

1 comment on commit 25bef48

@vercel
Copy link

@vercel vercel bot commented on 25bef48 Nov 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.