Skip to content

Commit

Permalink
Connect improvements (#379)
Browse files Browse the repository at this point in the history
Updates to how connect works, adding presigned client and documentation
  • Loading branch information
IndiaJonathan authored Oct 5, 2024
1 parent 911a49d commit f19e0db
Show file tree
Hide file tree
Showing 13 changed files with 459 additions and 121 deletions.
73 changes: 52 additions & 21 deletions chain-connect/README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,71 @@
## GalaChain Connect
# GalaChain Connect

Connect is a library that gives developers capabilities comparable to ethers.js for allowing users to connect to and interact with GalaChain using wallets such as Metamask.
GalaChain Connect is a library that provides developers with capabilities comparable to [ethers.js](https://docs.ethers.io/), allowing users to connect to and interact with GalaChain using wallets such as MetaMask.

# Features (WIP)
## Table of Contents

Users can connect to the application using a MetaMask wallet
- [Features](#features)
- [Installation](#installation)
- [Building](#building)
- [Running Unit Tests](#running-unit-tests)
- [Examples](#examples)
- [Local Library Testing](#local-library-testing)

application can prompt users via MetaMask to sign dtos
## Features

library is able to provide the developer with endpoint documentation for the desired channel using the GetContractAPI endpoint
- **Client-Side Signing and Calls**: Enables applications to interact with GalaChain using client-side signing via web3 wallets like MetaMask and Trust Wallet.
- **Server-Side Signing and Calls**: Supports server-side interactions with GalaChain using private keys for automated processes or backend services.
- **Unified API Interface**: Provides a consistent API for both client-side and server-side interactions with GalaChain.

library allows the application to connect to a GalaChain API (ops or gateway) and send requests with signed dtos to it.
## Installation

To install Gala Connect, run:

```bash
npm install @gala-chain/connect
```

## Building

Run `nx build chain-connect` to build the library.
Run the following command to build the library:

```bash
nx build chain-connect
```

## Running Unit Tests

To execute the unit tests via [Jest](https://jestjs.io), run:

```bash
nx test chain-connect
```

## Examples

## Running unit tests
The [Examples Documentation](docs/Examples.md) provides detailed examples on how to use GalaChain Connect, including:

Run `nx test chain-connect` to execute the unit tests via [Jest](https://jestjs.io).
- Connecting to a Web3 wallet and interacting with GalaChain on the client side.
- Performing server-side signing and interactions using a private key.

## Example client usage
## Local Library Testing

A new GalachainConnectClient can be created and connected by instantiating a new client object:
To test the library locally in another project:

> const client = new GalachainConnectClient();
> await client.connectToMetaMask();
1. Build the library:

PublicKeyClient and TokenClient can be instantiated with the GalachainConnectClient and the url as arguments:
```bash
nx build chain-connect
```

> const publicKeyClient = new PublicKeyClient(client, url)
> const tokenClient = new TokenClient(client, url);
2. Link the library:

```bash
npm link
```

## Local Library testing
3. In your project where you want to test the library, link it:

First build the library with `nx build chain-connect`
Then run `npm link`
In the project you want to test the library in run `npm link @gala-chain/connect`
```bash
npm link @gala-chain/connect
```
Loading

0 comments on commit f19e0db

Please sign in to comment.