Skip to content

cardugarte/xplorer-lawallet-backend

 
 

Repository files navigation

La Wallet Module

This is a library intended to ease the quick development of backend modules that interact with other modules in the architecture described in lawallet.io

Installation

pnpm add @lawallet/module

Usage

The simplest usage is to declare the routes where the nostr listeners and rest routes will be and start the module:

import { Module } from '@lawallet/module';

const module = Module.build({
    nostrPath: `${import.meta.dirname}/nostr`,
    restPath: `${import.meta.dirname}/rest`,
});

module.start();

You can also provide anything you want to the context that will be available for nostr and rest handlers by extending the DefaultContext type. The following example adds a prisma client.

import { Module, DefaultContext, getWriteNDK, OutboxService } from '@lawallet/module';
import { PrismaClient } from '@prisma/client';

type Context = DefaultContext & {prisma: PrismaClient};

const context: Context = {
  outbox: new OutboxService(getWriteNDK()),
  prisma: new PrismaClient(),
};

const module = Module.build<Context>({
    context,
    nostrPath: `${import.meta.dirname}/nostr`,
    restPath: `${import.meta.dirname}/rest`,
});

module.start();

About

New wallet provider

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.4%
  • JavaScript 1.6%
  • Dockerfile 1.0%