@broxus/js-core
TypeScript icon, indicating that this package has built-in type declarations

0.14.0 • Public • Published

Broxus JavaScript Core

Introduction

This library provides MobX-based services, models and helpers to build JavaScript Applications with any popular frameworks or libraries (e.g. React, Angular, Vue, etc.)

Core

AbstractStore

Abstract class AbstractStore is a primary way to create any services or stores that provides API to manage state and data:

abstract class AbstractStore {
    setData(keyOrData: string | object | ((prevData) => nextData)): this
    setState(keyOrState: string | object | ((prevState) => nextState)): this
    toJSON(): object
}

TvmContractWrapper

Abstract class TvmContractWrapper is a primary way to create models (wrapper for contract)

abstract class TvmContractWrapper {
    address: Address
    contractState?: FullContractState
    isDeployed?: boolean
    isSyncing?: boolean
    syncedAt?: number
    async syncContractState(): Promise<FullContractState | undefined>
    abstract watch?(): Promise<Subscriber>
    abstract unwatch?(): Promise<void>
}

Models

TvmToken

Model of the TVM-based token

import { TvmToken } from '@broxus/js-core'

const token = new TvmToken(tvmWalletService.connection, {
    name: 'Wrapped EVER',
    symbol: 'WEVER',
    decimals: 9,
    address: '0:a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d',
    logoURI: 'https://raw.githubusercontent.com/broxus/flatqube-assets/master/icons/WEVER/logo.svg',
    version: 5,
    verified: true,
}, [tvmWalletService.provider])

await token.sync({ force: true, silent: true })

const userWallet = await token.wallet(ownerAddress: Address | string)

Readme

Keywords

Package Sidebar

Install

npm i @broxus/js-core

Weekly Downloads

166

Version

0.14.0

License

MIT

Unpacked Size

1.25 MB

Total Files

258

Last publish

Collaborators

  • pavel337
  • odrin
  • 30mb1
  • geronimo
  • rexagon
  • pavlovdog_