@@ -224,95 +224,65 @@ The Solana program consists of several key components:
224224
225225## API Reference
226226
227- ### Frontend Components API
228-
229- #### NotificationContext
230- ``` javascript
231- // Import
232- import { useNotifications } from ' ./components/notifications/NotificationContext' ;
233-
234- // Usage
235- const {
236- notifications,
237- notifySuccess,
238- notifyError,
239- markAsRead,
240- removeNotification
241- } = useNotifications ();
242-
243- // Methods
244- notifySuccess (title, message, options);
245- notifyError (title, message, options);
246- markAsRead (notificationId);
247- removeNotification (notificationId);
248- ```
249-
250- #### OfferCreation
251- ``` javascript
252- // Import
253- import OfferCreation from ' ./components/OfferCreation' ;
254-
255- // Props
256- < OfferCreation
257- onSubmit= {handleSubmit}
258- initialValues= {initialValues}
259- isLoading= {isLoading}
260- / >
261- ```
262-
263- #### UserProfile
264- ``` javascript
265- // Import
266- import UserProfile from ' ./components/UserProfile' ;
267-
268- // Props
269- < UserProfile
270- userId= {userId}
271- isCurrentUser= {isCurrentUser}
272- / >
273- ```
274-
275- ### Smart Contract API
276-
277- #### Creating an Offer
278- ``` javascript
279- // Import
280- import { createOffer } from ' ./api/solana' ;
281-
282- // Usage
283- const result = await createOffer ({
284- assetType: ' SOL' ,
285- amount: 1.5 ,
286- price: 100 ,
287- paymentMethods: [' USDC' , ' Bank Transfer' ],
288- terms: ' Payment must be completed within 30 minutes'
227+ ### 📚 Comprehensive API Documentation
228+
229+ We provide extensive API documentation for developers integrating with SVMP2P:
230+
231+ #### ** [ Complete API Documentation Hub] ( api/README.md ) **
232+ Central hub for all API documentation with version information and navigation.
233+
234+ #### Core API References
235+ - ** [ Smart Contract API] ( api/smart-contracts.md ) ** - Complete instruction reference with parameters, behaviors, and examples
236+ - ** [ Account Structures] ( api/account-structures.md ) ** - Detailed account specifications and TypeScript interfaces
237+ - ** [ Wallet Operations] ( api/wallet-operations.md ) ** - Wallet connection, transaction signing, and security patterns
238+ - ** [ Error Codes] ( api/error-codes.md ) ** - Complete error reference with recovery strategies
239+ - ** [ Events] ( api/events.md ) ** - Smart contract event monitoring and handling
240+ - ** [ Transaction Flows] ( api/transaction-flows.md ) ** - End-to-end implementation examples
241+
242+ #### Developer Resources
243+ - ** [ Code Examples] ( api/examples/ ) ** - Ready-to-use TypeScript examples
244+ - ** [ API Changelog] ( api/CHANGELOG.md ) ** - Version history and migration guides
245+ - ** Program ID** : ` FKkTQLgBE9vDZqgXKWrXZfAv5HgCQdsjDZDzPfJosPt9 `
246+ - ** Current API Version** : 1.0.0
247+
248+ ### Legacy Documentation
249+ - ** [ Basic Smart Contract API] ( smart-contract-api.md ) ** - Basic API overview (see comprehensive docs above)
250+ - ** [ Frontend Components] ( frontend-components.md ) ** - UI component documentation
251+ - ** [ Enhanced Reward System] ( enhanced-reward-system.md ) ** - Reward system details
252+
253+ ### Quick Start Examples
254+
255+ #### Creating an Offer (TypeScript)
256+ ``` typescript
257+ import { Program , BN } from ' @coral-xyz/anchor' ;
258+ import { createAndListOffer } from ' ./api/examples/basic-trading/create-offer' ;
259+
260+ const result = await createAndListOffer (program , seller , {
261+ amount: new BN (1 * LAMPORTS_PER_SOL ), // 1 SOL
262+ fiatAmount: new BN (50000 ), // $500.00 in cents
263+ currency: ' USD' ,
264+ paymentMethod: ' Bank transfer - Chase Bank'
289265});
290266```
291267
292- #### Accepting an Offer
293- ``` javascript
294- // Import
295- import { acceptOffer } from ' ./api/solana' ;
268+ #### Wallet Connection
269+ ``` typescript
270+ import { useWallet } from ' @solana/wallet-adapter-react' ;
296271
297- // Usage
298- const result = await acceptOffer ({
299- offerId: ' offer123' ,
300- buyerWallet: ' buyer_wallet_address'
301- });
302- ```
272+ const { connect, connected, publicKey } = useWallet ();
303273
304- #### Completing a Trade
305- ``` javascript
306- // Import
307- import { completeTrade } from ' ./api/solana' ;
308-
309- // Usage
310- const result = await completeTrade ({
311- tradeId: ' trade123' ,
312- feedback: ' Smooth transaction, great trader!'
313- });
274+ const handleConnect = async () => {
275+ try {
276+ await connect ();
277+ console .log (' Connected:' , publicKey ?.toString ());
278+ } catch (error ) {
279+ console .error (' Connection failed:' , error );
280+ }
281+ };
314282```
315283
284+ For complete examples and advanced patterns, see the [ examples directory] ( api/examples/ ) .
285+
316286## Troubleshooting
317287
318288### Common Issues
0 commit comments