@sip-protocol/react
v0.1.0
Published
React hooks for Shielded Intents Protocol
Maintainers
Readme
@sip-protocol/react
React hooks for Shielded Intents Protocol.
Installation
npm install @sip-protocol/react @sip-protocol/sdk
# or
pnpm add @sip-protocol/react @sip-protocol/sdkQuick Start
Wrap your app with SIPProvider:
import { SIPProvider } from '@sip-protocol/react'
function App() {
return (
<SIPProvider config={{ network: 'testnet' }}>
<YourApp />
</SIPProvider>
)
}Use hooks in your components:
import { useSIP } from '@sip-protocol/react'
function MyComponent() {
const sip = useSIP()
const handleCreateIntent = async () => {
const intent = await sip.createShieldedIntent({
from: { chain: 'ethereum', token: 'ETH', amount: '1.0' },
to: { chain: 'solana', token: 'SOL' },
privacyLevel: 'shielded'
})
}
return <button onClick={handleCreateIntent}>Create Private Swap</button>
}Available Hooks
useSIP()
Access the SIP client instance directly.
const sip = useSIP()useStealthAddress() (stub)
Generate and manage stealth addresses. Full implementation coming soon.
const { generate, parse, isValid } = useStealthAddress()usePrivateSwap() (stub)
Execute private swaps with shielded intents. Full implementation coming soon.
const { execute, status, error } = usePrivateSwap()useViewingKey() (stub)
Generate and manage viewing keys for compliance. Full implementation coming soon.
const { generate, decrypt, share } = useViewingKey()Configuration
The SIPProvider accepts the same configuration as the core SDK:
<SIPProvider
config={{
network: 'mainnet',
mode: 'production',
defaultPrivacy: PrivacyLevel.SHIELDED,
proofProvider: new MockProofProvider(),
intentsAdapter: {
jwtToken: process.env.NEAR_INTENTS_JWT
}
}}
>
<App />
</SIPProvider>See @sip-protocol/sdk for full configuration options.
Development Status
This package is under active development:
- [x] Provider setup
- [x]
useSIP()hook - [ ]
useStealthAddress()implementation - [ ]
usePrivateSwap()implementation - [ ]
useViewingKey()implementation - [ ] Additional utility hooks
Documentation
License
MIT
