Options
All
  • Public
  • Public/Protected
  • All
Menu

@senswap/sen-js

Index

Type aliases

AccountData

AccountData: { amount: bigint; close_authority: string; close_authority_option: number; delegate: string; delegate_option: number; delegated_amount: bigint; is_native: bigint; is_native_option: number; mint: string; owner: string; state: number }

Type declaration

  • amount: bigint
  • close_authority: string
  • close_authority_option: number
  • delegate: string
  • delegate_option: number
  • delegated_amount: bigint
  • is_native: bigint
  • is_native_option: number
  • mint: string
  • owner: string
  • state: number

DebtData

DebtData: { debt: bigint; farm: string; is_initialized: boolean; owner: string; shares: bigint }

Type declaration

  • debt: bigint
  • farm: string
  • is_initialized: boolean
  • owner: string
  • shares: bigint

FarmData

FarmData: { compensation: bigint; genesis_timestamp: bigint; mint_reward: string; mint_stake: string; owner: string; period: bigint; reward: bigint; state: number; total_shares: bigint; treasury_reward: string; treasury_stake: string }

Type declaration

  • compensation: bigint
  • genesis_timestamp: bigint
  • mint_reward: string
  • mint_stake: string
  • owner: string
  • period: bigint
  • reward: bigint
  • state: number
  • total_shares: bigint
  • treasury_reward: string
  • treasury_stake: string

FarmingAccountChangeInfo

FarmingAccountChangeInfo: { address: string; data: Buffer; type: "farm" | "debt" }

Type declaration

  • address: string
  • data: Buffer
  • type: "farm" | "debt"

IDOAccountChangeInfo

IDOAccountChangeInfo: { address: string; data: Buffer; type: "ido" | "ticket" }

Type declaration

  • address: string
  • data: Buffer
  • type: "ido" | "ticket"

IDOData

IDOData: { enddate: bigint; is_initialized: boolean; middledate: bigint; owner: string; raised_mint_treasury: string; redeemdate: bigint; sold_mint_treasury: string; startdate: bigint; total_raised: bigint; total_sold: bigint }

Type declaration

  • enddate: bigint
  • is_initialized: boolean
  • middledate: bigint
  • owner: string
  • raised_mint_treasury: string
  • redeemdate: bigint
  • sold_mint_treasury: string
  • startdate: bigint
  • total_raised: bigint
  • total_sold: bigint

MintData

MintData: { decimals: number; freeze_authority: string; freeze_authority_option: number; is_initialized: boolean; mint_authority: string; mint_authority_option: number; supply: bigint }

Type declaration

  • decimals: number
  • freeze_authority: string
  • freeze_authority_option: number
  • is_initialized: boolean
  • mint_authority: string
  • mint_authority_option: number
  • supply: bigint

MultisigData

MultisigData: { is_initialized: boolean; m: number; n: number; signers: string[] }

Type declaration

  • is_initialized: boolean
  • m: number
  • n: number
  • signers: string[]

OrderData

OrderData: { ask_amount: bigint; bid_amount: bigint; created_at: bigint; locked_time: bigint; owner: string; retailer: string; state: number; updated_at: bigint }

Type declaration

  • ask_amount: bigint
  • bid_amount: bigint
  • created_at: bigint
  • locked_time: bigint
  • owner: string
  • retailer: string
  • state: number
  • updated_at: bigint

PoolData

PoolData: { fee_ratio: bigint; mint_a: string; mint_b: string; mint_lpt: string; owner: string; reserve_a: bigint; reserve_b: bigint; state: number; tax_ratio: bigint; taxman: string; treasury_a: string; treasury_b: string }

Type declaration

  • fee_ratio: bigint
  • mint_a: string
  • mint_b: string
  • mint_lpt: string
  • owner: string
  • reserve_a: bigint
  • reserve_b: bigint
  • state: number
  • tax_ratio: bigint
  • taxman: string
  • treasury_a: string
  • treasury_b: string

PurchasingAccountChangeInfo

PurchasingAccountChangeInfo: { address: string; data: Buffer; type: "retailer" | "order" }

Type declaration

  • address: string
  • data: Buffer
  • type: "retailer" | "order"

RetailerData

RetailerData: { mint_ask: string; mint_bid: string; owner: string; state: number; treasury_ask: string; treasury_bid: string }

Type declaration

  • mint_ask: string
  • mint_bid: string
  • owner: string
  • state: number
  • treasury_ask: string
  • treasury_bid: string

RoutingAddress

RoutingAddress: { dstAddress: string; poolAddress: string; srcAddress: string }

Type declaration

  • dstAddress: string
  • poolAddress: string
  • srcAddress: string

SPLTAccountChangeInfo

SPLTAccountChangeInfo: { address: string; data: Buffer; type: "account" | "mint" | "multisig" }

Type declaration

  • address: string
  • data: Buffer
  • type: "account" | "mint" | "multisig"

SignedMessage

SignedMessage: { address: string; message: string; signature: string }

Type declaration

  • address: string
  • message: string
  • signature: string

StakeAccountChangeInfo

StakeAccountChangeInfo: { address: string; data: Buffer; type: "farm" | "debt" }

Type declaration

  • address: string
  • data: Buffer
  • type: "farm" | "debt"

StakeDebtData

StakeDebtData: { created_at: bigint; farm: string; is_initialized: boolean; owner: string; reward_per_share: bigint; shares: bigint; updated_at: bigint }

Type declaration

  • created_at: bigint
  • farm: string
  • is_initialized: boolean
  • owner: string
  • reward_per_share: bigint
  • shares: bigint
  • updated_at: bigint

StakeFarmData

StakeFarmData: { mint_reward: string; mint_stake: string; owner: string; period: bigint; reward_per_share: bigint; scope: bigint; state: number; treasury_reward: string; treasury_stake: string }

Type declaration

  • mint_reward: string
  • mint_stake: string
  • owner: string
  • period: bigint
  • reward_per_share: bigint
  • scope: bigint
  • state: number
  • treasury_reward: string
  • treasury_stake: string

SwapAccountChangeInfo

SwapAccountChangeInfo: { address: string; data: Buffer; type: "pool" }

Type declaration

  • address: string
  • data: Buffer
  • type: "pool"

TicketData

TicketData: { amount: bigint; ido: string; is_initialized: boolean; owner: string }

Type declaration

  • amount: bigint
  • ido: string
  • is_initialized: boolean
  • owner: string

Variables

Const DEFAULT_EMPTY_ADDRESS

DEFAULT_EMPTY_ADDRESS: string = '11111111111111111111111111111111'

Const DEFAULT_FARMING_PROGRAM_ADDRESS

DEFAULT_FARMING_PROGRAM_ADDRESS: string = 'CpEsjrLhBkcuApn5uEE2tZCwxyCQKmT6S4YgT9zuLW2J'

Const DEFAULT_IDO_PROGRAM_ADDRESS

DEFAULT_IDO_PROGRAM_ADDRESS: string = 'EMBveEDLbHnRqQ6QpkAkNSP4guEvimkB7b8zQQgVgXxU'

Const DEFAULT_NODEURL

DEFAULT_NODEURL: string = 'https://api.devnet.solana.com'

Const DEFAULT_PURCHASING_PROGRAM_ADDRESS

DEFAULT_PURCHASING_PROGRAM_ADDRESS: string = 'FHeonxeZFH76K57KGRWgsmE97tiupcHDjvWNKMQDmdVd'

Const DEFAULT_SPLATA_PROGRAM_ADDRESS

DEFAULT_SPLATA_PROGRAM_ADDRESS: string = 'ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL'

Const DEFAULT_SPLT_PROGRAM_ADDRESS

DEFAULT_SPLT_PROGRAM_ADDRESS: string = 'TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'

Const DEFAULT_STAKE_PROGRAM_ADDRESS

DEFAULT_STAKE_PROGRAM_ADDRESS: string = '2RAgVcafj2UPcGS47NRqZ2GQwhHyFFtCpfn9Y6bHkDcQ'

Const DEFAULT_SWAP_PROGRAM_ADDRESS

DEFAULT_SWAP_PROGRAM_ADDRESS: string = '4erFSLP7oBFSVC1t35jdxmbfxEhYCKfoM6XdG2BLR3UF'

Const DEFAULT_WSOL

DEFAULT_WSOL: string = 'So11111111111111111111111111111111111111112'

Const account

account: { createAccount: () => Keypair; createStrictAccount: (programId: PublicKey) => Promise<Keypair>; deriveAssociatedAddress: (walletAddress: string, mintAddress: string, spltPromgramAddress?: string, splataProgramAddress?: string) => Promise<string>; fromAddress: (address: string) => PublicKey; fromKeystore: (keystore: Keystore, password: string) => null | Keypair; fromSecretKey: (secretKey: string) => null | Keypair; isAddress: (address: undefined | string) => address is string; isAssociatedAddress: (address: string) => boolean; signMessage: (message: string, secretKey: string) => { address: string; message: string; signature: string }; verifySignature: (address: string, signature: string, message?: null | string) => string | boolean } = ...

Type declaration

  • createAccount: () => Keypair
      • (): Keypair
      • Create a new account

        Returns Keypair

  • createStrictAccount: (programId: PublicKey) => Promise<Keypair>
      • (programId: PublicKey): Promise<Keypair>
      • Try to find an keypair that can derive a program address with seed being itself

        Parameters

        • programId: PublicKey

        Returns Promise<Keypair>

        a randomly available keypair

  • deriveAssociatedAddress: (walletAddress: string, mintAddress: string, spltPromgramAddress?: string, splataProgramAddress?: string) => Promise<string>
      • (walletAddress: string, mintAddress: string, spltPromgramAddress?: string, splataProgramAddress?: string): Promise<string>
      • Derive the associated address of a wallet and a mint

        Parameters

        • walletAddress: string
        • mintAddress: string
        • spltPromgramAddress: string = ...
        • splataProgramAddress: string = ...

        Returns Promise<string>

        Base58 address

  • fromAddress: (address: string) => PublicKey
      • (address: string): PublicKey
      • Generate public key corresponding to the address

        Parameters

        • address: string

          Base58 string

        Returns PublicKey

        corresponding public key

  • fromKeystore: (keystore: Keystore, password: string) => null | Keypair
      • (keystore: Keystore, password: string): null | Keypair
      • Generate account by keystore

        Parameters

        Returns null | Keypair

  • fromSecretKey: (secretKey: string) => null | Keypair
      • (secretKey: string): null | Keypair
      • Generate account by secret key

        Parameters

        • secretKey: string

        Returns null | Keypair

        Keypair

  • isAddress: (address: undefined | string) => address is string
      • (address: undefined | string): address is string
      • Validate an address

        Parameters

        • address: undefined | string

          Base58 string

        Returns address is string

        true/false

  • isAssociatedAddress: (address: string) => boolean
      • (address: string): boolean
      • Validate an associated address

        Parameters

        • address: string

          Base58 string

        Returns boolean

        true/false

  • signMessage: (message: string, secretKey: string) => { address: string; message: string; signature: string }
      • (message: string, secretKey: string): { address: string; message: string; signature: string }
      • Sign a message by a secret key

        Parameters

        • message: string
        • secretKey: string

        Returns { address: string; message: string; signature: string }

        • address: string
        • message: string
        • signature: string
  • verifySignature: (address: string, signature: string, message?: null | string) => string | boolean
      • (address: string, signature: string, message?: null | string): string | boolean
      • Verify a signature by provided address and message If message is null, the return is the message Else the return is true/false

        Parameters

        • address: string
        • signature: string
        • message: null | string = null

        Returns string | boolean

        string/boolean

Const keystore

keystore: { decrypt: (ks: Keystore, pwd: string) => null | string; encrypt: (secretKey: string, pwd: string) => null | Keystore; gen: (pwd: string) => null | Keystore } = ...

Type declaration

  • decrypt: (ks: Keystore, pwd: string) => null | string
      • (ks: Keystore, pwd: string): null | string
      • Parameters

        Returns null | string

  • encrypt: (secretKey: string, pwd: string) => null | Keystore
      • (secretKey: string, pwd: string): null | Keystore
      • Parameters

        • secretKey: string
        • pwd: string

        Returns null | Keystore

  • gen: (pwd: string) => null | Keystore

Const schema

schema: { ACCOUNT_SCHEMA: { key: string; type: string }[]; ACCOUNT_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }; DEBT_SCHEMA: { key: string; type: string }[]; FARM_SCHEMA: { key: string; type: string }[]; FARM_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }; IDO_SCHEMA: { key: string; type: string }[]; MINT_SCHEMA: { key: string; type: string }[]; MULTISIG_SCHEMA: { key: string; type: string }[]; ORDER_SCHEMA: { key: string; type: string }[]; POOL_SCHEMA: { key: string; type: string }[]; POOL_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }; RETAILER_SCHEMA: { key: string; type: string }[]; STAKE_DEBT_SCHEMA: { key: string; type: string }[]; STAKE_FARM_SCHEMA: { key: string; type: string }[]; STAKE_FARM_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }; TICKET_SCHEMA: { key: string; type: string }[] } = ...

Type declaration

  • ACCOUNT_SCHEMA: { key: string; type: string }[]
  • ACCOUNT_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }
    • get Frozen(): number
    • get Initialized(): number
    • get Uninitialized(): number
  • DEBT_SCHEMA: { key: string; type: string }[]
  • FARM_SCHEMA: { key: string; type: string }[]
  • FARM_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }
    • get Frozen(): number
    • get Initialized(): number
    • get Uninitialized(): number
  • IDO_SCHEMA: { key: string; type: string }[]
  • MINT_SCHEMA: { key: string; type: string }[]
  • MULTISIG_SCHEMA: { key: string; type: string }[]
  • ORDER_SCHEMA: { key: string; type: string }[]
  • POOL_SCHEMA: { key: string; type: string }[]
  • POOL_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }
    • get Frozen(): number
    • get Initialized(): number
    • get Uninitialized(): number
  • RETAILER_SCHEMA: { key: string; type: string }[]
  • STAKE_DEBT_SCHEMA: { key: string; type: string }[]
  • STAKE_FARM_SCHEMA: { key: string; type: string }[]
  • STAKE_FARM_STATE: { get Frozen(): number; get Initialized(): number; get Uninitialized(): number }
    • get Frozen(): number
    • get Initialized(): number
    • get Uninitialized(): number
  • TICKET_SCHEMA: { key: string; type: string }[]

Const utils

utils: { BASIC_TX_FEE: number; LAMPORTS_PER_SOL: number; decimalize: (a: string | number, decimals: number) => bigint; div: (a: string | number | bigint, b: string | number | bigint) => number; parseCGK: (ticket?: string) => Promise<{ address: any; icon: any; name: any; price: any; priceChange: any; rank: any; symbol: any; totalVolume: any }>; undecimalize: (a: bigint, decimals: number) => string; wrappedGetMultipleAccountsInfo: (connection: Connection, publicKeys: PublicKey[], commitment?: Commitment) => Promise<(null | AccountInfo<Buffer | ParsedAccountData>)[]> } = ...

Type declaration

  • BASIC_TX_FEE: number
  • LAMPORTS_PER_SOL: number
  • decimalize: (a: string | number, decimals: number) => bigint
      • (a: string | number, decimals: number): bigint
      • Add decimals to the number

        Parameters

        • a: string | number
        • decimals: number

        Returns bigint

  • div: (a: string | number | bigint, b: string | number | bigint) => number
      • (a: string | number | bigint, b: string | number | bigint): number
      • Divide two numbers

        Parameters

        • a: string | number | bigint
        • b: string | number | bigint

        Returns number

  • parseCGK: (ticket?: string) => Promise<{ address: any; icon: any; name: any; price: any; priceChange: any; rank: any; symbol: any; totalVolume: any }>
      • (ticket?: string): Promise<{ address: any; icon: any; name: any; price: any; priceChange: any; rank: any; symbol: any; totalVolume: any }>
      • Parse Coingecko

        Parameters

        • ticket: string = ''

          Coingecko ticket of the coin/token

        Returns Promise<{ address: any; icon: any; name: any; price: any; priceChange: any; rank: any; symbol: any; totalVolume: any }>

        icon, symcol, name, address, rank, price, priceChange (24h), totalVolume

  • undecimalize: (a: bigint, decimals: number) => string
      • (a: bigint, decimals: number): string
      • Remove decimals from the number

        Parameters

        • a: bigint
        • decimals: number

        Returns string

  • wrappedGetMultipleAccountsInfo: (connection: Connection, publicKeys: PublicKey[], commitment?: Commitment) => Promise<(null | AccountInfo<Buffer | ParsedAccountData>)[]>
      • (connection: Connection, publicKeys: PublicKey[], commitment?: Commitment): Promise<(null | AccountInfo<Buffer | ParsedAccountData>)[]>
      • Get multiple account info with 100 limit

        Parameters

        • connection: Connection
        • publicKeys: PublicKey[]
        • Optional commitment: Commitment

        Returns Promise<(null | AccountInfo<Buffer | ParsedAccountData>)[]>

Generated using TypeDoc