Logos Kit

TypeScript client

Typed reads against a LEZ node and LWS-0 wallet actions, viem-style.

npm@logos-kit/clientv0.1.1
npm i @logos-kit/client @logos-kit/codec

@logos-kit/client is the typed layer the QML SDK is built on. You can use it directly from Node scripts, tests and tools. It has two sets of actions on one client:

  • nodeActions: reads and raw submission against a LEZ node (the sequencer's JSON-RPC).
  • walletActions: LWS-0 requests to the Logos Kit wallet (connect, read shared accounts, propose transactions, follow them).

Amounts are decimal strings (u128 never becomes a JS number): lepta for the native token (1 LGO = 10^9 lepta; show them with formatUnits(amount, 9) from @logos-kit/codec). The root entry point stays QML-safe: no native BigInt, no Intl.

Hover over the code below to see the types.

Read the chain

import { , ,  } from '@logos-kit/client'

const  = ({
  : ('https://testnet.lez.logos.co', { : 2 }),
  : 'lez:testnet',
}).()

async function () {
  const height = await .()
const height: string
const fees = await .()
const fees: FeeState
.(, .) }

The official LEZ sequencer (testnet.lez.logos.co) and a default LEZ deployment send no CORS headers, so from those http() works in Node and other non-browser runtimes, not in a web page. In a web page, use Logos Kit's relay for the testnet, https://lez-testnet.84.46.247.92.sslip.io, which does send CORS headers. In Basecamp, read through the wallet (readAccount, getWalletBalance).

Talk to the wallet

In a Basecamp module, the basecampModule transport carries LWS-0 calls to the wallet core module over logos.callModuleAsync. The QML SDK sets this up for you; this is what it does underneath:

import { , ,  } from '@logos-kit/client'
import {  } from '@logos-kit/codec'

declare const : {
  (
    : string,
    : string,
    : unknown[],
    : (: string) => void,
    ?: number,
  ): void
}

const  = ({
  : ({ : . }),
  : 'lez:testnet',
}).()

async function (: string) {
  const  = await .({ : ['lez:testnet'] })
  const from = .[0].
const from: string
// Resolves when the user approves, not when the transaction lands. // '1000' is lepta: 0.000001 LGO. const { } = await .(, (, , '1000')) const status = await .()
const status: {
    handle: string;
    chain: string;
    txHash?: string | undefined;
    lifecycle: "awaiting_approval" | "building" | "dropped" | "expired" | "finalized" | "included" | "proving" | "rejected" | "signing" | "submitted";
    outcome: "failure" | "success" | "unknown";
    outcomeSource: "node" | "none" | "own-account-invariant" | "program-event";
    block?: {
        id: string;
        timestamp?: string | undefined;
    } | undefined;
    expectedEffects?: {
        account: string;
        field: "authority" | "balance" | "data" | "nonce" | "token_balance";
        asset?: string | undefined;
        before?: string | undefined;
        after?: string | undefined;
    }[] | undefined;
    observedEffects?: {
        account: string;
        field: "authority" | "balance" | "data" | "nonce" | "token_balance";
        asset?: string | undefined;
        before?: string | undefined;
        after?: string | undefined;
    }[] | undefined;
    fee?: {
        estimatedMax?: string | undefined;
        used?: string | undefined;
        gasLimit?: string | undefined;
    } | undefined;
    proving?: {
        phase: "preparing" | "proving" | "submitting" | "waiting_for_block";
        progress?: number | undefined;
        etaSeconds?: number | undefined;
        startedAt?: string | undefined;
    } | undefined;
    error?: {
        code: number;
        message: string;
        data?: unknown;
    } | undefined;
}
return . === 'success' }

User-facing steps (connect, send, sign, faucet) open a wallet sheet through a Basecamp intent; the rest are reads. See the QML SDK for the transaction lifecycle and what outcome means.

Types

ClientConfig

Prop

Type

HttpOptions

Prop

Type

PollOptions

Used by every wait… action.

Prop

Type

NodeActions

Prop

Type

WalletActions

Prop

Type

ProgramCall (@logos-kit/codec)

What sendCall takes. Build one with the codec's helpers (nativeTransfer, the token and testimonial builders) rather than by hand.

Prop

Type

On this page