🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@canton-network/core-provider-ledger

Package Overview
Dependencies
Maintainers
4
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@canton-network/core-provider-ledger

A Splice Provider implementation for direct ledger access.

latest
Source
npmnpm
Version
1.8.0
Version published
Weekly downloads
100K
20.27%
Maintainers
4
Weekly downloads
 
Created
Source

provider-ledger

This package provides a SpliceProvider (see https://github.com/canton-network/wallet/tree/main/core/splice-provider) implementation intended for direct Ledger usage. It is suitable for both NodeJS and browser environments, but if you are building a Canton dApp, then you likely want to use the dapp-sdk instead, which gives a DappProvider.

This provider only supports a single method, ledgerApi, which proxies request through to an underlying Ledger JSON-API client. Due to the nature of the Canton Ledger JSON-API, the only supported transport is HTTP.

usage

import { LedgerProvider } from '@canton-network/core-provider-ledger'

const provider = new LedgerProvider({
    baseUrl: 'https://ledger-api.example.com',
    accessToken: 'jwt...',
})

const version = await provider.request({
    method: 'ledgerApi',
    params: {
        resource: '/v2/version',
        requestMethod: 'get',
    },
})

types

Due to some type inference limitations, the return type of request collapses to unknown. In order to aid the compiler, you can supply an optional type argument corresponding to the operation you are using on the ledgerApi. Afterwards, the response is cleanly typed:

import { LedgerProvider, Ops } from '@canton-network/core-provider-ledger'

// ...

const party = await provider.request<Ops.PostV2Parties>({
    method: 'ledgerApi',
    params: {
        resource: '/v2/parties',
        requestMethod: 'post',
        body: {
            partyHint: 'my-party',
        },
    },
})

console.log(party.partyDetails?.party)

data

There are various ways to pass data into the request, depending on the operation. Let type inference guide you, but know there are three possibilities:


provider.request({
    method: 'ledgerApi',
    params: {
        ...,
        body?: {
            // usually for POST requests (JSON object body)
        },
        path?: {
            // `path` arguments, usually for GET requests (i.e., `/v2/parties/{party-id}`)
            "party-id": "some-party-id"
        },
        query?: {
            // `query` params, usually for GET requests (i.e., `/v2/...?param=data`)
            "param": "data"
        }
    }
})

Any particular operation may require just one, none, or multiple client data inputs.

FAQs

Package last updated on 08 Jul 2026

Did you know?

Socket

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.

Install

Related posts