@hamsterbox/swap
TypeScript icon, indicating that this package has built-in type declarations

0.0.7 • Public • Published

HamsterSwap SDK

Trustless peer-to-peer (P2P) protocol for swapping digital collectibles and assets. Supports both on-chain and off-chain.

Features

  • 🌈 Authentication with HamsterBox server.
  • 📦 Swap collectibles and assets.
  • 📦 Collectibles and assets managment.

🖥 Environment Support

  • Modern browsers and Internet Explorer 11 (with polyfills)
  • Server-side Rendering
  • Electron
IE / Edge
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
Electron
Electron
IE11, Edge last 2 versions last 2 versions last 2 versions last 2 versions

📦 Install

npm install @hamsterbox/swap
yarn add @hamsterbox/swap

🔨 Usage

There is three main flow usage of SDK

  1. Login
  import { initHamsterSwap, Network } from "@hamsterbox/swap";
  import { useWallet } from "@solana/wallet-adapter-react";

  const wallet = useWallet();

  const hamsterSwapSdk = initHamsterSwap({
    walletProvider: wallet,
    network: Network.devnet || Network.mainnet,
  });
  1. Login
  import { SIGN_MESSAGE, useHamsterSwap } from "@hamsterbox/swap";

  const solanaWallet = useSolana();

  /** Need initilize first before using sdk. */
  const hamsterSwapSdk = useHamsterSwap();

 /** Sign message to get signature. */
  const signature = await signMessage(SIGN_MESSAGE);

  /** Call function to sign message in wallet and login firebase hamsterbox server. */
  const user = await authService.signInWithWallet(
    wallet?.publicKey?.toString(),
    signature
  );

# Notes

This library is still in beta development. Significant changes may happen anytime.

# Contact

If you have any inquiries please send emails to dev@cavies.xyz.

## License
 
The MIT License (MIT)

Copyright (c) 2022 CaviesLabs.

Package Sidebar

Install

npm i @hamsterbox/swap

Weekly Downloads

1

Version

0.0.7

License

MIT

Unpacked Size

424 kB

Total Files

138

Last publish

Collaborators

  • stephencavies