Skip to main content

Crate lichen_client_sdk

Crate lichen_client_sdk 

Source
Expand description

§Lichen Rust SDK

Official Rust SDK for interacting with Lichen blockchain.

§Features

  • Type-safe RPC client - Interact with validators via JSON-RPC
  • Transaction building - Create and sign transactions
  • Keypair management - Native PQ keypair generation and signing
  • Async/await - Built on Tokio for async operations
  • PQ-native wire format - Matches the core PqSignature transaction model

§Quick Start

use lichen_client_sdk::{Client, Keypair};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Connect to validator
    let client = Client::new("http://localhost:8899");
     
    // Generate keypair
    let keypair = Keypair::new();
     
    // Get balance
    let balance = client.get_balance(&keypair.pubkey()).await?;
    println!("Balance: {} LICN", balance.licn());
     
    Ok(())
}

Re-exports§

pub use bountyboard::ApproveWorkParams;
pub use bountyboard::BountyBoardBountyInfo;
pub use bountyboard::BountyBoardClient;
pub use bountyboard::BountyBoardPlatformStats;
pub use bountyboard::BountyBoardStats;
pub use bountyboard::CreateBountyParams;
pub use bountyboard::SubmitWorkParams;
pub use bountyboard::BOUNTY_STATUS_CANCELLED;
pub use bountyboard::BOUNTY_STATUS_COMPLETED;
pub use bountyboard::BOUNTY_STATUS_OPEN;
pub use client::Client;
pub use client::ClientBuilder;
pub use client::ReadonlyContractResult;
pub use error::Error;
pub use error::Result;
pub use keypair::Keypair;
pub use lichenid::estimate_lichenid_name_registration_cost;
pub use lichenid::AddSkillParams;
pub use lichenid::ApproveRecoveryParams;
pub use lichenid::AttestSkillParams;
pub use lichenid::BidNameAuctionParams;
pub use lichenid::CreateNameAuctionParams;
pub use lichenid::ExecuteRecoveryParams;
pub use lichenid::FinalizeNameAuctionParams;
pub use lichenid::LichenIdAchievement;
pub use lichenid::LichenIdAgentConfig;
pub use lichenid::LichenIdAgentDirectory;
pub use lichenid::LichenIdAgentDirectoryEntry;
pub use lichenid::LichenIdAgentDirectoryOptions;
pub use lichenid::LichenIdAvailability;
pub use lichenid::LichenIdClient;
pub use lichenid::LichenIdContributions;
pub use lichenid::LichenIdDelegateRecord;
pub use lichenid::LichenIdGivenVouch;
pub use lichenid::LichenIdIdentitySummary;
pub use lichenid::LichenIdNameAuction;
pub use lichenid::LichenIdNameResolution;
pub use lichenid::LichenIdProfile;
pub use lichenid::LichenIdReceivedVouch;
pub use lichenid::LichenIdReputation;
pub use lichenid::LichenIdReputationSummary;
pub use lichenid::LichenIdSkill;
pub use lichenid::LichenIdStats;
pub use lichenid::LichenIdVouches;
pub use lichenid::RegisterIdentityParams;
pub use lichenid::RegisterNameParams;
pub use lichenid::RevokeAttestationParams;
pub use lichenid::SetAvailabilityAsParams;
pub use lichenid::SetAvailabilityParams;
pub use lichenid::SetDelegateParams;
pub use lichenid::SetEndpointAsParams;
pub use lichenid::SetEndpointParams;
pub use lichenid::SetMetadataAsParams;
pub use lichenid::SetMetadataParams;
pub use lichenid::SetRateAsParams;
pub use lichenid::SetRateParams;
pub use lichenid::SetRecoveryGuardiansParams;
pub use lichenid::UpdateAgentTypeAsParams;
pub use lichenid::LICHENID_DELEGATE_PERM_AGENT_TYPE;
pub use lichenid::LICHENID_DELEGATE_PERM_NAMING;
pub use lichenid::LICHENID_DELEGATE_PERM_PROFILE;
pub use lichenid::LICHENID_DELEGATE_PERM_SKILLS;
pub use lichenswap::AddLiquidityParams;
pub use lichenswap::CreatePoolParams;
pub use lichenswap::LichenSwapClient;
pub use lichenswap::LichenSwapPoolInfo;
pub use lichenswap::LichenSwapProtocolFees;
pub use lichenswap::LichenSwapStats;
pub use lichenswap::LichenSwapSwapStats;
pub use lichenswap::LichenSwapTwapCumulatives;
pub use lichenswap::LichenSwapVolumeTotals;
pub use lichenswap::SwapParams;
pub use lichenswap::SwapWithDeadlineParams;
pub use restrictions::BridgeAsset;
pub use restrictions::BridgeChain;
pub use restrictions::BridgeRouteRestrictionParams;
pub use restrictions::BridgeRouteRestrictionStatus;
pub use restrictions::CodeHashRestrictionParams;
pub use restrictions::CodeHashRestrictionStatus;
pub use restrictions::ContractLifecycleRestrictionStatus;
pub use restrictions::ContractRestrictionParams;
pub use restrictions::EffectiveRestrictionRecord;
pub use restrictions::ExtendRestrictionParams;
pub use restrictions::GetRestrictionResponse;
pub use restrictions::LiftRestrictionParams;
pub use restrictions::MovementRestrictionParams;
pub use restrictions::MovementRestrictionStatus;
pub use restrictions::RestrictAccountAssetParams;
pub use restrictions::RestrictAccountParams;
pub use restrictions::RestrictCommonParams;
pub use restrictions::RestrictionAddress;
pub use restrictions::RestrictionAsset;
pub use restrictions::RestrictionBuilderBaseParams;
pub use restrictions::RestrictionBuilderInstruction;
pub use restrictions::RestrictionGovernanceClient;
pub use restrictions::RestrictionLiftReasonInput;
pub use restrictions::RestrictionListParams;
pub use restrictions::RestrictionListResponse;
pub use restrictions::RestrictionModeDetails;
pub use restrictions::RestrictionModeInput;
pub use restrictions::RestrictionReasonInput;
pub use restrictions::RestrictionRecord;
pub use restrictions::RestrictionStringOrU64;
pub use restrictions::RestrictionTargetDetails;
pub use restrictions::RestrictionTargetInput;
pub use restrictions::RestrictionTargetStatus;
pub use restrictions::ResumeBridgeRouteParams;
pub use restrictions::ResumeContractParams;
pub use restrictions::SetFrozenAssetAmountParams;
pub use restrictions::TransferRestrictionParams;
pub use restrictions::TransferRestrictionStatus;
pub use restrictions::UnbanCodeHashParams;
pub use restrictions::UnrestrictAccountAssetParams;
pub use restrictions::UnrestrictAccountParams;
pub use restrictions::UnsignedRestrictionGovernanceTx;
pub use sporepay::CreateStreamParams;
pub use sporepay::CreateStreamWithCliffParams;
pub use sporepay::SporePayClient;
pub use sporepay::SporePayStats;
pub use sporepay::SporePayStream;
pub use sporepay::SporePayStreamInfo;
pub use sporepay::TransferStreamParams;
pub use sporepay::WithdrawFromStreamParams;
pub use sporevault::SporeVaultClient;
pub use sporevault::SporeVaultStats;
pub use sporevault::SporeVaultStrategyInfo;
pub use sporevault::SporeVaultUserPosition;
pub use sporevault::SporeVaultVaultStats;
pub use thalllend::LiquidateParams;
pub use thalllend::ThallLendAccountInfo;
pub use thalllend::ThallLendClient;
pub use thalllend::ThallLendInterestRate;
pub use thalllend::ThallLendProtocolStats;
pub use thalllend::ThallLendStats;
pub use transaction::TransactionBuilder;
pub use types::Balance;
pub use types::Block;
pub use types::NetworkInfo;

Modules§

bountyboard
client
RPC client for Lichen
error
Error types for the SDK
keypair
Keypair and public key management
lichenid
lichenswap
restrictions
Restriction-governance RPC helpers.
sporepay
sporevault
thalllend
transaction
Transaction building and signing
types
Common types used in the SDK

Structs§

Account
Account structure with balance separation
Hash
32-byte hash (SHA-256)
Instruction
Single instruction in a transaction
Message
Transaction message (before signing)
PqPublicKey
PqSignature
Pubkey
Versioned 32-byte address digest.
Transaction
Re-export transaction from core Signed transaction

Enums§

ContractInstruction
Smart contract instruction types

Constants§

BASE_FEE
Base transaction fee (0.001 LICN = 1,000,000 spores) At $0.10/LICN: $0.0001 per tx | At $1.00/LICN: $0.001 per tx Solana ~$0.00025/tx — Lichen is 2.5x cheaper at $0.10/LICN
CONTRACT_PROGRAM_ID
Smart contract program ID (all ones)
SYSTEM_PROGRAM_ID
System program ID (all zeros)
VERSION
SDK version

Type Aliases§

Address