-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Robby Uitbeijerse
authored
Nov 15, 2023
1 parent
d9a81c6
commit 996d4cc
Showing
2 changed files
with
135 additions
and
0 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,132 @@ | ||
# Reporting | ||
|
||
Throughout time you'll run transactions to move on-chain assets for the [Profiles](/service/profiles/creating-profiles) you create. As for all blockchains - for each transaction, gas needs to be spend in order to fulfil a transaction. In order to provide you with insights into the data, we provide a couple of simple methods that allow you to pull in this data. | ||
|
||
#### Game report | ||
|
||
A report per game will get you a complete overview for your game, for every chain you support. This could come in handy if your game is targetting two chains to reach a wider target audience. | ||
|
||
**Note:** chain information is environment specific, meaning that you won't find both testnet and mainnet information within the same response. | ||
|
||
```typescript | ||
const report = await beam.reporting.getTotalGameUsage(); | ||
|
||
// { | ||
// "chains": [ | ||
// { | ||
// "policies": [ | ||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "chainId": 13337, | ||
// "policy": { | ||
// "id": "string", | ||
// "name": "string", | ||
// "model": "ContractFunctions", | ||
// "chainId": 0 | ||
// }, | ||
// "periods": [ | ||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "start": 0, | ||
// "end": 0 | ||
// } | ||
// ] | ||
// } | ||
// ], | ||
// "summary": { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "chainId": 13337 | ||
// } | ||
// } | ||
// ] | ||
// } | ||
``` | ||
|
||
#### Chain report | ||
|
||
For most developers, retrieving a report for the specific chain they're building on will suffice. The `getTotalGameUsageByChain` method allows you to do just that, provided that you passed a supported `chainId` to the method. | ||
|
||
If you're developing on Beam (chain), you will be able to retrieve your games gas expensees by passing the following chain id's: | ||
|
||
- **13337** - testnet | ||
- **4327** - mainnet | ||
|
||
```typescript | ||
const report = await beam.reporting.getTotalGameUsageByChain(13337); | ||
|
||
// { | ||
// "policies": [ | ||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "chainId": 13337, | ||
// "policy": { | ||
// "id": "string", | ||
// "name": "string", | ||
// "model": "ContractFunctions", | ||
// "chainId": 0 | ||
// }, | ||
// "periods": [ | ||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "start": 0, | ||
// "end": 0 | ||
// } | ||
// ] | ||
// } | ||
// ], | ||
// "summary": { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "chainId": 13337 | ||
// } | ||
// } | ||
``` | ||
|
||
#### Policy report | ||
|
||
For more granular reporting per policy, you're able to retrieve the information for one specific policy by providing the policyId. | ||
|
||
```typescript | ||
const report = await beam.reporting.getPolicyUsage("clozl24n600003b6ysfapkqq1"); | ||
|
||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "chainId": 13337, | ||
// "policy": { | ||
// "id": "string", | ||
// "name": "string", | ||
// "model": "ContractFunctions", | ||
// "chainId": 0 | ||
// }, | ||
// "periods": [ | ||
// { | ||
// "totalTransactionFeeInUSD": "string", | ||
// "totalTransactionFee": "string", | ||
// "averageTransactionFee": "string", | ||
// "transactionCount": 0, | ||
// "start": 0, | ||
// "end": 0 | ||
// } | ||
// ] | ||
// } | ||
``` |
996d4cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
beam-docs – ./
docs.onbeam.com
beam-docs-git-main-merit-circle.vercel.app
beam-docs-merit-circle.vercel.app