Companion Packages
These packages are commonly installed alongside spaps-sdk or the Python client.
| Package | Role |
|---|---|
spaps-types | Shared TypeScript contracts, runtime guards, and schema helpers |
spaps-wallet-utils | Browser wallet detection, connect/switch/sign helpers, and validators |
spaps-issue-reporting-react | React provider/components/hooks for issue-reporting UI flows |
spaps-types
Install:
npm install spaps-typesWhat it provides:
- Shared contract types for auth, payments, entitlements, issue reporting, and secure messages.
- Runtime guard helpers such as
isAdminRole,isValidPermission,isValidSeverity, andisValidChainType. - Zod-backed secure-message schema helpers (
createSecureMessageRequestSchema,secureMessageSchema,secureMessageMetadataSchema). - Docs manifest contracts from
packages/types/src/docs.ts(DocsManifest,DocsManifestEndpoint, and related types).
import { isAdminRole, isValidPermission } from 'spaps-types'
console.log(isAdminRole('admin'))
console.log(isValidPermission('manage_products'))spaps-wallet-utils
Install:
npm install spaps-wallet-utilsSource-backed API surface (packages/wallet-utils/src/index.ts):
- Detection:
detectWallet,hasMetaMask,hasPhantom - EVM helpers:
connectMetaMask,getMetaMaskChainId,switchChain,signEVMTransaction,getChainName - Solana helpers:
connectPhantom,disconnectPhantom,signSolanaTransaction - Utilities:
formatAmount,formatAddress,isValidEVMAddress,isValidSolanaAddress,isValidHex - Errors:
WalletConnectionError,UserRejectedError
import { connectMetaMask, switchChain, signEVMTransaction } from 'spaps-wallet-utils'
const from = await connectMetaMask()
await switchChain(8453) // Base
const txHash = await signEVMTransaction(
{
chain: 'evm',
chain_id: 8453,
to: '0xdef0000000000000000000000000000000000456',
value: '1000000000000000',
data: '0x'
},
from
)
console.log(txHash)signSolanaTransaction currently throws a not-implemented error in V1 ("Solana signing not yet implemented in V1").
spaps-issue-reporting-react
Install:
npm install spaps-issue-reporting-react react react-dom @tanstack/react-queryIssueReportingProvider accepts a client that exposes an issueReporting surface with:
getStatuslistgetcreateupdatereply- optional
createVoiceToken
Core exports include:
IssueReportingProviderIssueReportingPageConfigFloatingIssueReportButtonReportableSection- hooks:
useIssueReporting,useIssueReportingStatus,useIssueReportingHistory,useIssueReportingMutations,useReportMode
import {
FloatingIssueReportButton,
IssueReportingPageConfig,
IssueReportingProvider
} from 'spaps-issue-reporting-react'
;<IssueReportingProvider
client={spaps}
isEligible={true}
principalId="user_123"
defaultScope="mine"
inputModes={['text', 'voice']}
>
<IssueReportingPageConfig createMode="surface_preferred" />
<FloatingIssueReportButton />
</IssueReportingProvider>For backend model and support pipeline behavior, see Issue reporting and support.
Validation And Tests
Package-level checks:
# types
cd packages/types && npm run build && npm run typecheck && npm run test:types
# wallet utils
cd packages/wallet-utils && npm run build && npm test
# issue reporting react
cd packages/issue-reporting-react && npm run build && npm testKey evidence tests referenced in this docs update:
packages/types/test/index.test-d.tspackages/wallet-utils/test/wallet.test.tspackages/issue-reporting-react/test/issue-reporting-react.test.tsx