TypeScript SDK
TypeScript SDK for POW Cards integration
Installation
Install the POW Cards TypeScript SDK:
Usage with React and Solana Wallet Adapter
The most common use case is integrating POW Cards with React and the Solana Wallet Adapter. Here’s a complete example:
Using the Hook
Implement the wallet connection and sign-in flow in your component:
SDK Reference
ClaimsApi
The main class for interacting with the POW Cards API.
Methods
initializeClaimProcess
Initializes the claim process by generating a sign-in message.
Parameters:
publicKey
: Solana wallet public key (string)
Returns:
domain
: Domain requesting the signaturenonce
: Random nonce for the requestissuedAt
: Timestamp of the requestmessage
: Complete message to be signed
verifySignatureAndCreatePass
Verifies the signature and creates a wallet pass.
Parameters:
message
: The signed message from initializeClaimProcesssignature
: Base58 encoded signaturepublicKey
: Solana wallet public keywalletType
: Type of wallet used for signing (optional, defaults to “Generic”)
Returns:
downloadUrl
: URL to download the created pass
Supported Wallet Types
The SDK automatically detects the wallet type using the Solana wallet adapter. Supported wallet types include:
Generic
(default)Phantom
Solflare
Coinbase Wallet
MathWallet
SafePal
Clover
Coin98
HyperPay
Krystal
ONTO
TokenPocket
Trust
Error Handling
The SDK includes TypeScript types for all error responses. Common error scenarios:
Error types include:
- 400: Invalid request parameters
- 401: Verification failed
- 429: Rate limit exceeded
- 500: Internal server error
For more details on the available endpoints and responses, see the API Reference.