Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update usage docs #24

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ You can install the cli app with `cargo install fedimint-clientd` or by cloning
```
CLI USAGE:
fedimint-clientd \
--fm_db_path=/absolute/path/to/dir/to/store/database \
--db-path=/absolute/path/to/dir/to/store/database \
--password="some-secure-password-that-becomes-the-bearer-token" \
--addr="127.0.0.1:8080"
--mode="default"
--mode="rest"
--invite-code="fed1-fedimint-invite-code"

ENV USAGE:
FEDIMINT_CLIENTD_DB_PATH=/absolute/path/to/dir/to/store/database
FEDIMINT_CLIENTD_PASSWORD="some-secure-password-that-becomes-the-bearer-token"
FEDIMINT_CLIENTD_ADDR="127.0.0.1:8080"
FEDIMINT_CLIENTD_MODE="default"
FEDIMINT_CLIENTD_MODE="rest"
FEDIMINT_CLIENTD_INVITE_CODE="fed1-fedimint-invite-code"
```

## Fedimint Clientd Endpoints
Expand Down
2 changes: 1 addition & 1 deletion justfile.local.just
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ mprocs:
./scripts/mprocs-nix.sh dev-fed mprocs-new.yaml

test-ts:
bun run wrappers/fedimint-ts/test.ts
bun run wrappers/fedimint-ts/tests/test.ts

test-py:
python3.11 wrappers/fedimint-py/test.py
Expand Down
36 changes: 8 additions & 28 deletions wrappers/fedimint-ts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
This is a TypeScript client that consumes the [Fedimint Http Client](https://github.com/kodylow/fedimint-http), communicating with it via HTTP and a password. It's a hacky prototype, but it works until we can get a proper TS client for Fedimint. All of the federation handling code happens in the fedimint-http-client, this just exposes a simple API for interacting with the client from TypeScript (will be mirrored in Python and Go).

## Usage

```typescript
import {FedimintClientBuilder} from "./FedimintClient";
import dotenv from "dotenv";
import { FedimintClientBuilder } from "fedimint-ts";

dotenv.config();

Expand Down Expand Up @@ -51,41 +52,20 @@ fedimintClient.ln.awaitInvoice({ operation_id }).then((response) => {
});
```

# Setup

Set the following in the fedimint-http .env environment variables:

```bash
FEDERATION_INVITE_CODE = 'fed1-some-invite-code'
SECRET_KEY = 'some-secret-key' # generate this with `openssl rand -base64 32`
FM_DB_PATH = '/absolute/path/to/fm.db' # just make this a new dir called `fm_db` in the root of the fedimint-http-client and use the absolute path to thatm it'll create the db file for you on startup
PASSWORD = 'password'
DOMAIN = 'localhost'
PORT = 5000
BASE_URL = 'http://localhost:5000'
```

Then start the fedimint-http-client server:
## Development

```bash
cargo run
```
Install dependencies with `bun install` or `npm install`.

Then you're ready to run the typescript client, which will use the same base url and password as the fedimint-http-client:
Follow these [steps to setup a `fedimint-clientd` server](https://github.com/fedimint/fedimint-clientd?tab=readme-ov-file#getting-started) and then you're ready to run the typescript client.
`fedimint-ts` will use the same base url and password as the `fedimint-clientd`:

```bash
BASE_URL = 'http://localhost:5000'
PASSWORD = 'password'
```

To install dependencies:

```bash
bun install
```

To run (this just runs an example that creates FedimintClient in typescript and creates an invoice):
Then run your code that follows the pattern of `tests/info-example.ts`.

```bash
bun run example.ts
bun run tests/info-example.ts
```
Binary file removed wrappers/fedimint-ts/bun.lockb
Binary file not shown.
4 changes: 0 additions & 4 deletions wrappers/fedimint-ts/index.ts

This file was deleted.

Loading
Loading