Trustless peer-to-peer (P2P) protocol for swapping digital collectibles and assets. Supports both on-chain and off-chain.
- 🌈 Authentication with HamsterBox server.
- 📦 Swap collectibles and assets.
- 📦 Collectibles and assets managment.
IE / Edge |
Firefox |
Chrome |
Safari |
Electron |
---|---|---|---|---|
IE11, Edge | last 2 versions | last 2 versions | last 2 versions | last 2 versions |
npm install @hamsterbox/swap
yarn add @hamsterbox/swap
There is three main flow usage of SDK
- 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,
});
- 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
);
This library is still in beta development. Significant changes may happen anytime.
If you have any inquiries please send emails to [email protected].
The MIT License (MIT)
Copyright (c) 2022 CaviesLabs.