-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adds a mercury integration guide * adds transformer section * adds link to Mercury docs * Bump find-my-way from 8.2.0 to 8.2.2 in the npm_and_yarn group Bumps the npm_and_yarn group with 1 update: [find-my-way](https://github.com/delvedor/find-my-way). Updates `find-my-way` from 8.2.0 to 8.2.2 - [Release notes](https://github.com/delvedor/find-my-way/releases) - [Commits](delvedor/find-my-way@v8.2.0...v8.2.2) --- updated-dependencies: - dependency-name: find-my-way dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <[email protected]> * Feature/blockaid flags (#161) * add individual flags for blockaid scanning * fix tests * add tests * better default setting for dapp scanning * better catch default for scan-site --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Piyal Basu <[email protected]>
- Loading branch information
1 parent
c6542c0
commit 1d6f952
Showing
11 changed files
with
316 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Mercury Integration Guide | ||
|
||
Freighter's backend relies on data that is ingested and indexed by Mercury in order to serve different wallet views. | ||
|
||
Mercury is an indexer and API built on Stellar, [see docs for more info.](https://www.mercurydata.app/) | ||
It allows users to subscribe to data on the network and query indexed data using a GraphQL API. | ||
|
||
## Playground | ||
|
||
To learn more about the available queries or to construct queries, you can use [the playground.](https://api.mercurydata.app:2083/graphiql) | ||
|
||
Playground steps - | ||
|
||
1. Aquire an access token by signing up for an account on the dashboard. | ||
|
||
Testnet - https://test.mercurydata.app/ | ||
Pubnet - https://main.mercurydata.app/ | ||
|
||
Select "Get Access token" under Active Subscriptions and grab your token. | ||
|
||
2. Add your access token to the playground. | ||
|
||
You can add your token to be used in the requests the playground makes. | ||
Click on the headers tab on the left pane at the bottom and add it in the following format - | ||
|
||
``` | ||
{ | ||
Authorization: "Bearer <TOKEN>" | ||
} | ||
``` | ||
|
||
3. Query for data in subscriptions | ||
At this point you can query for any data that you have a subscription on, for example to get `changeTrust` operations for an account you could run this query - | ||
|
||
``` | ||
query Test { | ||
changeTrustByPublicKey(publicKeyText:"<PUBLIC_KEY>") { | ||
edges { | ||
node { | ||
opId | ||
... | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Subscriptions | ||
|
||
In order to query data, you must subscribe to it first. Mercury supports subscription APIs for contract events, ledger entries, ledger entry expirations, and accounts. | ||
|
||
See [full docs](https://docs.mercurydata.app/mercury-classic/subscriptions/api-definition) for more info. | ||
|
||
## Adding a new query | ||
|
||
Mercury queries can be added by adding a new key to the `query` map in the [queries file](../src/service/mercury/queries.ts). | ||
Queries are stored as template strings that represent the GraphQL query. Arguments can be passed by writing the query as a function and interpolating the arguments into the template string. | ||
|
||
Queries can be imported into anything that accepts GraphQL documents. | ||
|
||
## Usage in public facing routes | ||
|
||
The account history and account balance queries are used to serve public facing routes, we use [transformers](../src/service/mercury/helpers/transformers.ts) to process this data from Mercury in order to maintain schema compatibility with Horizon/RPC responses. | ||
Any changes to these queries should be accompanied by an update to the corresponding transformer in order align with Horizon schemas used in the transformer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.