Wrappers for common functions
- Dominant language
- TypeScript
- Stars
- 4
- Forks
- 11
- PR merge metrics
- No merged PRs in 30d
Description
It would be nice to have a wrapper for common functions of ->
```ts
class Query {
static async getNonce(api: ApiPromise, address: string): Promise {
const { nonce } = await api.query.system.account(address)
return nonce.toBn()
}
static async getTokenBalance(
api: ApiPromise,
accountId: string
): Promise {
const { availableBalance } = await api.derive.balances.all(accountId)
return availableBalance.toString()
}
static getChainProperties(api: ApiPromise): ChainProperties {
const { chainSS58, chainDecimals, chainTokens } = api.registry
return {
ss58Format: correctFormat(chainSS58),
tokenDecimals: chainDecimals[0] || 12,
tokenSymbol: chainTokens[0] || 'Unit',
}
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the package entry point where a Query wrapper around ApiPromise would belong, then compare the proposed getNonce, getTokenBalance, and getChainProperties methods with existing APIs. Done means the agreed common-function wrappers are implemented with the shown return values and their behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100