Skip to content

The Trinsic Javascript / Typescript Node SDK

The Trinsic Node/Web SDK makes it easy to interact with the Trinsic API from any backend javascript application. The most recent version of the library can be found on npm. You can find the SDKs source on Github. The @trinsic/trinsic package comes with Typescript bindings.

Installation

Install the package for Node from npmjs.com

npm i @trinsic/trinsic

Javascript

To import the Trinsic SDK:

import { TrinsicService } from "@trinsic/trinsic";

For CommonJS:

let { TrinsicService } = require("@trinsic/trinsic");

You must instantiate the trinsic service first:

const trinsic = new TrinsicService({
    /** Trinsic API endpoint. Defaults to `prod.trinsic.cloud` */
    serverEndpoint: "prod.trinsic.cloud",
    /** Trinsic API port; defaults to `443` */
    serverPort: 443,
    /** Whether TLS is enabled between SDK and Trinsic API; defaults to `true` */
    serverUseTls: true,
    /** Authentication token for SDK calls; defaults to empty string (unauthenticated) */
    authToken: "<Your auth token>"
});

Now you can use the SDK:

const newWallet = await trinsic.wallet().createWallet();
console.log(JSON.stringify(newWallet, null, 4));

You can find all the SDK methods documented here