Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@azuro-org/toolkit
Advanced tools
This package provides helpers to develop an app using Azuro Protocol.
npm i --save @azuro-org/toolkit
aggregateOutcomesByMarkets.ts
This helper function allows you to aggregate outcomes that are obtained from conditions by markets. This function takes an array of conditions and groups outcomes by their market key. It then sorts the outcomes within each market group and returns an array of market objects, each containing an array of outcomes.
Here is an example of how you can use it:
query Game($id: String!) {
game(id: $id) {
liquidityPool {
address
}
conditions {
conditionId
coreAddress
outcomes {
outcomeId
}
}
}
}
type Conditions = {
conditionId: string
coreAddress: string
outcomes: {
outcomeId: string
}
}
aggregateOutcomesByMarkets({
lpAddress: game.liquidityPool.lpAddress,
conditions: game.conditions,
dictionaries, // ** check the note below
})
The result will be of type
type Outcome = {
selectionName: string
conditionId: string
outcomeId: string
lpAddress: string
coreAddress: string
}
type OutcomesByMarkets = {
marketName: string
outcomes: Outcome[][]
}[]
*
returned outcomes
are wrapped with additional array Outcome[][]
**
dictionaries
contain a set of texts for each outcome ID used in Azuro. These texts can be used to display outcomes
in a user-friendly way and provide more context about what the outcome represents. Dictionaries are an important
component of Azuro's infrastructure as they allow for standardized and consistent outcomes across all markets and events.
Read more about dictionaries.
You can pass additional data in outcomes if required, the helper will add it to outcomes in the result:
query Game($id: String!) {
game(id: $id) {
liquidityPool {
address
}
conditions {
conditionId
coreAddress
outcomes {
outcomeId
odds
}
}
}
}
type MyOutcome = {
outcomeId: string
odds: string
}
aggregateOutcomesByMarkets<MyOutcome>({
lpAddress: game.liquidityPool.lpAddress,
conditions: game.conditions,
dictionaries, // ** check the note below
})
The result will be of type
type Outcome = {
selectionName: string
conditionId: string
outcomeId: string
lpAddress: string
coreAddress: string
odds: string
}
type OutcomesByMarkets = {
marketName: string
outcomes: Outcome[][]
}[]
FAQs
Set of helpers to work with Azuro protocol
The npm package @azuro-org/toolkit receives a total of 232 weekly downloads. As such, @azuro-org/toolkit popularity was classified as not popular.
We found that @azuro-org/toolkit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.