JSPM

@eversdk/net

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q48868F
  • License MIT

Collection of network providers for TVM Blockchains

Package Exports

  • @eversdk/net
  • @eversdk/net/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@eversdk/net) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@eversdk/smc

TON

Collection of network providers for TVM Blockchains.

How to install

yarn add @eversdk/net or npm i @eversdk/net

Simple usage

CloudProvider provides methods with type wrappers, such as sendExternalMessage:

import { Builder } from '@eversdk/ton'
import { CloudProvider } from '@eversdk/net'

async function main () {
    // usage of https://www.evercloud.dev
    const provider = new CloudProvider({
        endpoint: 'https://mainnet.evercloud.dev/.../graphql'
    })

    const c = new Builder().cell()
    await provider.sendExternalMessageCell(c)
}

main()

For extended usage of CloudProvider (evercloud graphql), use graphql code generation with the-guild and @apollo/client.

import { CloudProvider } from '@eversdk/net'
import { graphql } from './codegen/generated'

// ./codegen/generated –> path to the-guild codegen result

const getBalance = apollo.graphql(`
    query getBalance($address: String!) {
        blockchain {
            account (address: $address) {
                info { balance(format: DEC) }
            }
        }
    }
`)

async function main () {
    const provider = new CloudProvider({
        endpoint: 'https://mainnet.evercloud.dev/.../graphql'
    })

    const address = '0:0000000000000000000000000000000000000000000000000000000000000000'

    const result = await provider.client.query({
        query: getBalance,
        variables: { address }
    })

    // fully typed result based on the graphql schema
    console.log(result.data.blockchain?.account?.info?.balance)
}

main()

External dependencies

  • "@apollo/client": "3.7.14"
  • "@eversdk/ton": "0.1.0"
  • "graphql": "16.6.0"

License

MIT