Version: 0.17.1


A TypeScript/JavaScript library for interacting with the Trustlines Protocol.


Install via Package Manager#

We publish the trustlines-clientlib to npm as a ES6 module.

$ npm i trustlines-clientlib

Build from Source#

If you want to build the library from source run

git clone
cd clientlib
yarn && yarn build

This will create three different builds:

  • ES6 module in ./lib-esm
  • CommonJS module in ./lib
  • Bundled JS injectable into browser in ./_bundles

Get started#

We assume the usage of the trustlines-clientlib ES6 module in the following.


To start using the trustlines-clientlib you first have to configure the relay server you want to connect to. You can either connect to a local develop relay server or use publicly available ones.

import { TLNetwork } from "trustlines-clientlib"
// Instance using a relay connected to Gnosis
const gnosis = new TLNetwork({
relayUrl: "",
messagingUrl: "",
identityFactoryAddress: "0x1234...",
identityImplementationAddress: "0x1234...",
gnosisSafeL2Address: "0x3E5c63644E683549055b9Be8653de26E0B4CD36E",
gnosisSafeProxyFactoryAddress: "0xa6B71E26C5e0845f74c812102Ca7114b6a896AB2",
chainId: 100,
safeRelayUrl: "",

Example Usage#

This library is a promise-based library. So every asynchronous call will return a native JavaScript promise. If an error occurs the library will throw it. The caller has to handle it appropriately.

try {
const networks = await gnosis.currencyNetwork.getAll()
} catch (error) {
console.log("Caught error:", error)

Read our Documentation for More#

Run Tests#

# All tests
yarn test
# Unit tests
yarn test:unit
# Integration tests
yarn test:integration
# end2end tests
yarn test:e2e

Note on end2end Tests#

You have to have all components of the trustlines protocol running. A convenient way to achieve this is by using our end2end setup.

Running injected web3 example#

To run the example make sure to have MetaMask installed and connected to a JSON RPC.

yarn serve

This serves the injected web3 example app on You can find the app under ./examples/injected-web3.

Change log#