garageincswap
v0.0.39
Published
The complete SilentSwap SDK that includes both the core SDK and React hooks.
Readme
SilentSwap
The complete SilentSwap SDK that includes both the core SDK and React hooks.
Installation
npm install silentswap
# or
yarn add silentswap
# or
bun add silentswapUsage
Core SDK (Universal)
import {
createSilentSwapClient,
createSignInMessage,
createEip712DocForOrder
} from 'silentswap';
// Create a client
const client = createSilentSwapClient({
baseUrl: 'https://api.silentswap.com'
});
// Use authentication utilities
const signInMessage = createSignInMessage(
'0x742d35Cc6f1E2c3E3c5c5c5c5c5c5c5c5c5c5c5c5c5c5c5c',
'123456',
'silentswap.com'
);React Hooks (React only)
import {
useSilentClient,
useSilentOrders,
useAuth
} from 'silentswap';
function MyComponent() {
const { client } = useSilentClient({
config: { baseUrl: 'https://api.silentswap.com' }
});
const { isLoading, getQuote } = useSilentOrders({ client });
const { createSignInMessage } = useAuth();
// Use the hooks...
}What's Included
This package re-exports everything from:
@silentswap/sdk- Core SDK with client, utilities, and types@silentswap/react- React hooks for SilentSwap integration
API Reference
For detailed API documentation, see:
Peer Dependencies
react(optional) - Required only if using React hooks
