1.0.0 • Published 9 months ago

reclaim-solxpass v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

reclaim-solxpass

Reclaim SolXPass Logo

npm version License: MIT TypeScript

A powerful and easy-to-use TypeScript SDK for interacting with the Reclaim Solana program. Simplify your blockchain development with reclaim-solxpass!

🚀 Features

  • Full TypeScript support
  • Comprehensive set of methods to interact with the Reclaim Solana program
  • Built-in type definitions for all program accounts and instructions
  • Easy integration with existing Solana projects

📦 Installation

Install reclaim-solxpass using npm:

npm install reclaim-solxpass

🛠️ Usage

Here's a quick example to get you started:

import { Connection, Keypair } from '@solana/web3.js';
import { AnchorProvider, Wallet } from '@project-serum/anchor';
import { ReclaimSDK } from 'reclaim-solxpass';

async function main() {
  // Set up connection and provider
  const connection = new Connection('https://api.devnet.solana.com', 'confirmed');
  const wallet = new Wallet(Keypair.generate());
  const provider = new AnchorProvider(connection, wallet, {});

  // Instantiate the SDK
  const reclaimSDK = new ReclaimSDK(provider);

  // Example: Initialize EpochConfig
  const createKey = Keypair.generate().publicKey;
  const txHash = await reclaimSDK.initializeEpochConfig(
    createKey,
    wallet.publicKey,
    86400 // 1 day in seconds
  );
  console.log('EpochConfig initialized. Transaction hash:', txHash);

  // Fetch and display EpochConfig
  const [epochConfigPDA] = await reclaimSDK.findProgramAddress([
    Buffer.from('epoch_config'),
    createKey.toBuffer(),
  ]);
  const epochConfig = await reclaimSDK.getEpochConfig(epochConfigPDA);
  console.log('EpochConfig:', epochConfig);
}

main().catch(console.error);

📘 API Reference

ReclaimSDK

The main class for interacting with the Reclaim Solana program.

Constructor

constructor(provider: anchor.Provider)

Methods

  • initializeEpochConfig(createKey: PublicKey, deployer: PublicKey, epochDurationSeconds: number): Promise<string>
  • changeEpochIndexEpochConfig(epochConfigPDA: PublicKey, deployer: PublicKey, newEpochIndex: number): Promise<string>
  • addEpoch(epochConfigPDA: PublicKey, rentPayer: PublicKey, deployer: PublicKey, witnesses: Witness[], minimumWitnessesForClaim: number): Promise<string>
  • createGroup(creator: PublicKey, provider: string): Promise<string>
  • verifyProof(epochPDA: PublicKey, epochConfigPDA: PublicKey, signedClaim: SignedClaim): Promise<string>
  • createDapp(groupPDA: PublicKey, createKey: PublicKey, creator: PublicKey, groupRoot: number): Promise<string>
  • getEpochConfig(epochConfigPDA: PublicKey): Promise<EpochConfig>
  • getEpoch(epochPDA: PublicKey): Promise<Epoch>
  • getGroup(groupPDA: PublicKey): Promise<Group>
  • getDapp(dappPDA: PublicKey): Promise<Dapp>

For detailed information on each method and its parameters, please refer to the source code and inline documentation.

🤝 Contributing

We welcome contributions to reclaim-solxpass! Please see our Contributing Guide for more details.

📄 License

reclaim-solxpass is MIT licensed.

🙋‍♀️ Support

If you have any questions or run into any issues, please open an issue in our GitHub repository.


Made with ❤️ by Saksham-Tomer