@gardenfi/core
TypeScript icon, indicating that this package has built-in type declarations

0.1.15 • Public • Published

@gardenfi/core

The @gardenfi/core package serves as an abstraction layer over the @catalogfi/wallets(contains different kind of bitcoin and evm wallets) and @gardenfi/orderbook packages. It provides a simple interface to perform atomic swaps.

Installation

npm install `@gardenfi/core`

For more information regarding using the library in different environments see setup.

Usage

  1. Creating an atomic swap: (should create an order with valid parameters)
  2. Interacting with created orders: (should initiate and redeem)

Setup

Node

No extra setup is required as both cjs and esm modules are supported.

Browser

Following cases only cover vite and webpack setups. For other bundlers, please refer to their respective documentation on how to add wasm and polyfills support.

Vite

Install the vite plugins:

npm install vite-plugin-wasm vite-plugin-top-level-await vite-plugin-node-polyfills --save-dev

and update your vite.config.ts as follows:

import { defineConfig } from "vite";
import wasm from "vite-plugin-wasm";
import { nodePolyfills } from "vite-plugin-node-polyfills";
import topLevelAwait from "vite-plugin-top-level-await";

export default defineConfig({
  plugins: [
    nodePolyfills(),
    wasm(),
    topLevelAwait(),
    //other plugins
  ],
  //other settings
});

Webpack

If you're using webpack with a framework like next, then in your webpack config, (if you're using NextJS, this can be found in next.config.js ) add support for wasm as shown below:

/** @type {import('next').NextConfig} */
const nextConfig = {
  //other nextConfig options
  webpack: function (config, options) {
    //other webpack config options
    config.experiments = {
      ...config.experiments,
      asyncWebAssembly: true,
    };
    return config;
  },
};
module.exports = nextConfig;

Readme

Keywords

none

Package Sidebar

Install

npm i @gardenfi/core

Weekly Downloads

202

Version

0.1.15

License

none

Unpacked Size

23.7 kB

Total Files

11

Last publish

Collaborators

  • gardenfinance
  • aymansm
  • manireddyt
  • gowtham.cat
  • rev0001