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
All dictionaries stored in public repository. For ease of use, the dictionaries have a version and file format.
It's easy to download dictionary files with CLI. In your package.json add script:
"scripts": {
"get-dicts": "dictionaries -o {OUTPUT_DIR} -v {VERSION} -t {FILES_TYPE}"
}
VERSION
is the version of downloaded dictionaries. Find the version you need here.OUTPUT_DIR
is the directory where to put downloaded files.FILES_TYPE
is the extension of downloaded files. Accepts ts
, js
, maps
, arrays
. maps
and arrays
are
json files with different output format.dictionaries -o ./dist -v 2.0.0 -t ts # will download v2.0.0 typescript files to ./dist directory
import { getMarketKey, getMarketName, getMarketDescription, assembleMarketName, assembleSelectionName } from '@azuro-org/dictionaries'
import { getMarketKey } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
const outcomeId = 1
const marketKey = getMarketKey(outcomeId, dictionaries)
getMarketKey(outcomeId, dictionaries)
returns the string key marketId-gamePeriodId-gameTypeId[-teamPlayerId]
built from the dictionaries related to passed outcomeId
.
In the example above the result is 1-1-1
.
There are two dictionary files marketNames.js
and marketDescriptions.js
. marketKey
is used to receive market name
and description for specific outcome ID.
import dictionaries from './path-to-downloaded-dictionaries'
dictionaries.marketNames['1-1-1'] // "Full Time Result"
dictionaries.marketDescriptions['1-1-1'] // "You predict the result..."
!!! Note that there are no texts for each outcomeId
!!!
marketNames[marketKey]
and marketDescriptions[marketKey]
may return undefined
. For marketName
generation there
is other helper assembleMarketName
. It generates human readable market name based on outcome marketId
, gamePeriodId
,
gameTypeId
, teamPlayerId
.
import { getMarketKey, assembleMarketName } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
const outcomeId = 42
const marketKey = getMarketKey(outcomeId, dictionaries)
let marketName = dictionaries[marketKey] // undefined
if (!marketName) {
marketName = assembleMarketName(outcomeId, dictionaries) // "Whole game - Winner of match Goal"
}
There are additional 2 sugar helpers:
import { getMarketName } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
getMarketName(1, dictionaries) // "Full Time Result"
getMarketName(42, dictionaries) // "Whole game - Winner of match Goal"
import { getMarketDescription } from '@azuro-org/dictionaries'
import dictionaries from './path-to-downloaded-dictionaries'
getMarketDescription(1, dictionaries) // "You predict the result..."
getMarketDescription(42, dictionaries) // undefined. Note that there is no `assemblyMarketDescription` helper.
import { assembleSelectionName } from '@azuro-org/dictionaries'
import dictionaries from './dist'
const outcomeId = 1
const selectionName = assembleSelectionName(outcomeId, dictionaries) // "Yes"
const outcomeId = 4
const selectionName = assembleSelectionName(outcomeId, dictionaries) // "Team 2 (4.5)"
FAQs
Set of helpers to work with Azuro protocol
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.