repo_id
stringclasses
279 values
file_path
stringlengths
43
179
content
stringlengths
1
4.18M
__index_level_0__
int64
0
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/increaseLiquidity.test.ts
import { describe, it, beforeAll } from "vitest"; import { increaseLiquidityInstructions } from "../src/increaseLiquidity"; import { rpc, signer, sendTransaction } from "./utils/mockRpc"; import { setupMint, setupAta } from "./utils/token"; import { fetchPosition, getPositionAddress } from "@orca-so/whirlpools-client";...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/swap.test.ts
import { describe } from "vitest"; describe.skip("Swap", () => { // TODO: <- });
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/utils/program.ts
import { fetchAllMaybeTickArray, fetchWhirlpool, getFeeTierAddress, getInitializeConfigInstruction, getInitializeFeeTierInstruction, getInitializePoolV2Instruction, getInitializeTickArrayInstruction, getOpenPositionInstruction, getOpenPositionWithTokenExtensionsInstruction, getPositionAddress, get...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/utils/mockRpc.ts
import type { Address, IInstruction, VariableSizeDecoder, } from "@solana/web3.js"; import { appendTransactionMessageInstructions, assertIsAddress, createSolanaRpcFromTransport, createTransactionMessage, getAddressDecoder, getAddressEncoder, getBase58Decoder, getBase64Decoder, getBase64EncodedWi...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/utils/keypair.ts
import type { KeyPairSigner } from "@solana/web3.js"; import { generateKeyPairSigner } from "@solana/web3.js"; import { orderMints } from "../../src/token"; const keypairs = await Promise.all( Array(100) .fill(0) .map(() => generateKeyPairSigner()), ); const orderedKeypairs = [...keypairs].sort((a, b) => o...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/utils/token.ts
import { getCreateAccountInstruction, getTransferSolInstruction, } from "@solana-program/system"; import { getMintSize, getInitializeMint2Instruction, TOKEN_PROGRAM_ADDRESS, getCreateAssociatedTokenIdempotentInstruction, findAssociatedTokenPda, getMintToInstruction, getSyncNativeInstruction, } from "@...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/tests/utils/tokenExtensions.ts
import type { ExtensionArgs } from "@solana-program/token-2022"; import { findAssociatedTokenPda, TOKEN_2022_PROGRAM_ADDRESS, getCreateAssociatedTokenIdempotentInstruction, getMintToInstruction, getMintSize, getInitializeMint2Instruction, getInitializeTransferFeeConfigInstruction, getSetTransferFeeInstr...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/pool.ts
import type { Whirlpool } from "@orca-so/whirlpools-client"; import { getFeeTierAddress, getWhirlpoolAddress, fetchWhirlpoolsConfig, fetchFeeTier, fetchMaybeWhirlpool, fetchAllMaybeWhirlpool, fetchAllFeeTierWithFilter, feeTierWhirlpoolsConfigFilter, } from "@orca-so/whirlpools-client"; import type { R...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/createPool.ts
import { getFeeTierAddress, getInitializePoolV2Instruction, getInitializeTickArrayInstruction, getTickArrayAddress, getTickArraySize, getTokenBadgeAddress, getWhirlpoolAddress, getWhirlpoolSize, } from "@orca-so/whirlpools-client"; import type { Address, GetAccountInfoApi, GetMultipleAccountsApi, ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/position.ts
import type { Position, PositionBundle } from "@orca-so/whirlpools-client"; import { fetchAllMaybePosition, fetchAllMaybePositionBundle, fetchAllPosition, fetchAllPositionWithFilter, getBundledPositionAddress, getPositionAddress, getPositionBundleAddress, positionWhirlpoolFilter, } from "@orca-so/whirlp...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/harvest.ts
import type { CollectFeesQuote, CollectRewardsQuote, } from "@orca-so/whirlpools-core"; import { collectFeesQuote, collectRewardsQuote, getTickArrayStartTickIndex, getTickIndexInArray, } from "@orca-so/whirlpools-core"; import type { Rpc, GetAccountInfoApi, Address, IInstruction, TransactionSigner...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/decreaseLiquidity.ts
import type { Whirlpool } from "@orca-so/whirlpools-client"; import { fetchAllTickArray, fetchPosition, fetchWhirlpool, getClosePositionInstruction, getClosePositionWithTokenExtensionsInstruction, getCollectFeesV2Instruction, getCollectRewardV2Instruction, getDecreaseLiquidityV2Instruction, getPositio...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/swap.ts
import type { Account, Address, GetAccountInfoApi, GetEpochInfoApi, GetMinimumBalanceForRentExemptionApi, GetMultipleAccountsApi, IInstruction, Rpc, TransactionSigner, } from "@solana/web3.js"; import { AccountRole, lamports } from "@solana/web3.js"; import { FUNDER, SLIPPAGE_TOLERANCE_BPS } from "./c...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/index.ts
export * from "./config"; export * from "./createPool"; export * from "./decreaseLiquidity"; export * from "./harvest"; export * from "./increaseLiquidity"; export * from "./pool"; export * from "./position"; export * from "./swap";
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/config.ts
import { getWhirlpoolsConfigExtensionAddress } from "@orca-so/whirlpools-client"; import type { Address, TransactionSigner } from "@solana/web3.js"; import { address, createNoopSigner, isAddress } from "@solana/web3.js"; /** * The default (null) address. */ export const DEFAULT_ADDRESS = address("1111111111111111111...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/increaseLiquidity.ts
import type { Whirlpool } from "@orca-so/whirlpools-client"; import { fetchAllMaybeTickArray, fetchPosition, fetchWhirlpool, getIncreaseLiquidityV2Instruction, getInitializeTickArrayInstruction, getOpenPositionWithTokenExtensionsInstruction, getPositionAddress, getTickArrayAddress, getTickArraySize, }...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/token.ts
import { fetchAllMaybeToken, fetchAllMint, findAssociatedTokenPda, getCloseAccountInstruction, getCreateAssociatedTokenInstruction, getInitializeAccount3Instruction, getSyncNativeInstruction, TOKEN_PROGRAM_ADDRESS, } from "@solana-program/token"; import type { Account, Address, GetAccountInfoApi, ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool
solana_public_repos/orca-so/whirlpools/ts-sdk/whirlpool/src/sysvar.ts
import type { SysvarRent } from "@solana/sysvars"; /** * The overhead storage size for accounts. */ const ACCOUNT_STORAGE_OVERHEAD = 128; /** * Calculates the minimum balance required for rent exemption for a given account size. * * @param {Rpc} rpc - The Solana RPC client to fetch sysvar rent data. * @param {n...
0
solana_public_repos/orca-so/whirlpools/ts-sdk
solana_public_repos/orca-so/whirlpools/ts-sdk/client/codama.js
import { createFromRoot } from "codama"; import { renderVisitor } from "@codama/renderers-js"; import { rootNodeFromAnchor } from "@codama/nodes-from-anchor"; import { readFileSync } from "fs"; const idl = JSON.parse(readFileSync("../../target/idl/whirlpool.json", "utf8")); const node = rootNodeFromAnchor(idl); const ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk
solana_public_repos/orca-so/whirlpools/ts-sdk/client/README.md
# Orca Whirlpools Client SDK ## Overview This package provides developers with low-level functionalities for interacting with the Whirlpool Program on Solana. It serves as a foundational tool that allows developers to manage and integrate detailed operations into their Typescript projects, particularly those related t...
0
solana_public_repos/orca-so/whirlpools/ts-sdk
solana_public_repos/orca-so/whirlpools/ts-sdk/client/package.json
{ "name": "@orca-so/whirlpools-client", "version": "0.0.1", "description": "Typescript client to interact with Orca's on-chain Whirlpool program.", "type": "module", "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { "import": { "types": "./dist...
0
solana_public_repos/orca-so/whirlpools/ts-sdk
solana_public_repos/orca-so/whirlpools/ts-sdk/client/typedoc.json
{ "entryPoints": ["./src/index.ts"] }
0
solana_public_repos/orca-so/whirlpools/ts-sdk
solana_public_repos/orca-so/whirlpools/ts-sdk/client/tsconfig.json
{ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./dist" }, "include": ["./src/**/*.ts"] }
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client
solana_public_repos/orca-so/whirlpools/ts-sdk/client/tests/pda.test.ts
import { address } from "@solana/web3.js"; import assert from "assert"; import { getFeeTierAddress } from "../src/pda/feeTier"; import { getOracleAddress } from "../src/pda/oracle"; import { getPositionAddress } from "../src/pda/position"; import { getBundledPositionAddress, getPositionBundleAddress, } from "../src...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client
solana_public_repos/orca-so/whirlpools/ts-sdk/client/tests/gpa.test.ts
import { describe, it, beforeEach, afterEach, vi } from "vitest"; import assert from "assert"; import type { FeeTierArgs } from "../src/generated/accounts/feeTier"; import { getFeeTierEncoder } from "../src/generated/accounts/feeTier"; import type { Address, GetProgramAccountsMemcmpFilter, ReadonlyUint8Array, } f...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/index.ts
export * from "./generated"; export * from "./gpa"; export * from "./pda";
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/whirlpoolsConfig.ts
import type { GetProgramAccountsMemcmpFilter, Address, Account, GetProgramAccountsApi, Rpc, } from "@solana/web3.js"; import { getBase58Decoder, getAddressEncoder, getU16Encoder, } from "@solana/web3.js"; import type { WhirlpoolsConfig } from "../generated/accounts/whirlpoolsConfig"; import { WHIRLPOO...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/positionBundle.ts
import type { Account, Address, GetProgramAccountsApi, GetProgramAccountsMemcmpFilter, Rpc, } from "@solana/web3.js"; import { getAddressEncoder, getBase58Decoder } from "@solana/web3.js"; import type { PositionBundle } from "../generated/accounts/positionBundle"; import { POSITION_BUNDLE_DISCRIMINATOR, g...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/tickArray.ts
import type { Account, Address, GetProgramAccountsApi, GetProgramAccountsMemcmpFilter, Rpc, } from "@solana/web3.js"; import { getAddressEncoder, getBase58Decoder, getI32Encoder, } from "@solana/web3.js"; import type { TickArray } from "../generated/accounts/tickArray"; import { TICK_ARRAY_DISCRIMINAT...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/whirlpool.ts
import type { Account, Address, GetProgramAccountsApi, GetProgramAccountsMemcmpFilter, Rpc, } from "@solana/web3.js"; import { getAddressEncoder, getBase58Decoder, getU16Encoder, } from "@solana/web3.js"; import type { Whirlpool } from "../generated/accounts/whirlpool"; import { WHIRLPOOL_DISCRIMINATO...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/feeTier.ts
import type { Account, Address, GetProgramAccountsApi, GetProgramAccountsMemcmpFilter, Rpc, } from "@solana/web3.js"; import { getAddressEncoder, getBase58Decoder, getU16Encoder, } from "@solana/web3.js"; import type { FeeTier } from "../generated/accounts/feeTier"; import { FEE_TIER_DISCRIMINATOR, ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/position.ts
import type { GetProgramAccountsMemcmpFilter, Account, GetProgramAccountsApi, Rpc, Address, } from "@solana/web3.js"; import { getBase58Decoder, getAddressEncoder, getI32Encoder, } from "@solana/web3.js"; import type { Position } from "../generated/accounts/position"; import { POSITION_DISCRIMINATOR, ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/utils.ts
import type { Account, Address, GetProgramAccountsApi, GetProgramAccountsMemcmpFilter, Rpc, VariableSizeDecoder, } from "@solana/web3.js"; import { getBase64Encoder } from "@solana/web3.js"; export async function fetchDecodedProgramAccounts<T extends object>( rpc: Rpc<GetProgramAccountsApi>, programAdd...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/tokenBadge.ts
import type { GetProgramAccountsMemcmpFilter, Address, Account, GetProgramAccountsApi, Rpc, } from "@solana/web3.js"; import { getBase58Decoder, getAddressEncoder } from "@solana/web3.js"; import type { TokenBadge } from "../generated/accounts/tokenBadge"; import { TOKEN_BADGE_DISCRIMINATOR, getTokenBadge...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/index.ts
export * from "./feeTier"; export * from "./position"; export * from "./positionBundle"; export * from "./tickArray"; export * from "./tokenBadge"; export * from "./whirlpool"; export * from "./whirlpoolsConfig"; export * from "./whirlpoolsConfigExtension";
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/gpa/whirlpoolsConfigExtension.ts
import type { GetProgramAccountsMemcmpFilter, Address, Account, GetProgramAccountsApi, Rpc, } from "@solana/web3.js"; import { getBase58Decoder, getAddressEncoder } from "@solana/web3.js"; import type { WhirlpoolsConfigExtension } from "../generated/accounts/whirlpoolsConfigExtension"; import { WHIRLPOOLS_C...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/positionBundle.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getPositionBundleAddress( positionBundleMint: Address, ): Promise<Pr...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/tickArray.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getTickArrayAddress( whirlpool: Address, startTickIndex: number, )...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/whirlpool.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress, getU16Encoder, } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getWhirlpoolAddress( whirlpoolsConfig: Address...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/oracle.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getOracleAddress( whirlpool: Address, ): Promise<ProgramDerivedAddre...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/feeTier.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress, getU16Encoder, } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getFeeTierAddress( whirlpoolsConfig: Address, ...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/position.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getPositionAddress( positionMint: Address, ): Promise<ProgramDerived...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/tokenBadge.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getTokenBadgeAddress( whirlpoolsConfig: Address, tokenMint: Addres...
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/index.ts
export * from "./feeTier"; export * from "./oracle"; export * from "./position"; export * from "./positionBundle"; export * from "./tickArray"; export * from "./tokenBadge"; export * from "./whirlpool"; export * from "./whirlpoolsConfigExtension";
0
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src
solana_public_repos/orca-so/whirlpools/ts-sdk/client/src/pda/whirlpoolsConfigExtension.ts
import type { Address, ProgramDerivedAddress } from "@solana/web3.js"; import { getAddressEncoder, getProgramDerivedAddress } from "@solana/web3.js"; import { WHIRLPOOL_PROGRAM_ADDRESS } from "../generated/programs/whirlpool"; export async function getWhirlpoolsConfigExtensionAddress( configAddress: Address, ): Prom...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/core/Cargo.toml
[package] name = "orca_whirlpools_core" version = "0.1.0" description = "Orca's core rust package." include = ["src/*"] documentation = "https://orca-so.github.io/whirlpools/" homepage = "https://orca.so" repository = "https://github.com/orca-so/whirlpools" license = "Apache-2.0" keywords = ["solana", "crypto", "defi",...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/core/README.md
# Orca Whirlpools Core SDK This package provides developers with advanced functionalities for interacting with the Whirlpool Program on Solana. The Core SDK offers convenient methods for math calculations, quotes, and other utilities, making it easier to manage complex liquidity and swap operations within Rust project...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/core/package.json
{ "name": "@orca-so/whirlpools-rust-core", "version": "0.0.1", "scripts": { "build": "cargo build -p orca_whirlpools_core", "test": "cargo test -p orca_whirlpools_core --lib", "format": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt", "lint": "cargo clippy && cargo fmt --check", ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/lib.rs
// FIXME: disable std for non-test builds to decrease wasm binary size. // There is currently something in tsify that prevents this: // https://github.com/madonoharu/tsify/issues/56 // #![cfg_attr(not(test), no_std)] #![allow(clippy::useless_conversion)] mod constants; mod math; mod quote; mod types; pub use constant...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/swap.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct ExactInSwapQuote { pub token_in: u64, pub token_est_out: u64, pub token_min_out: u64, pub trade_fee: ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/u128.rs
// While `wasm_expose` doesn't automatically convert rust `u128` to js `bigint`, we have // to proxy it through an opaque type that we define here. This is a workaround until // `wasm_bindgen` supports `u128` abi conversion natively. #[cfg(not(feature = "wasm"))] pub type U128 = u128; #[cfg(feature = "wasm")] use cor...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/token.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct TransferFee { pub fee_bps: u16, pub max_fee: u64, } impl TransferFee { pub fn new(fee_bps: u16) -> Self {...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/tick_array.rs
use crate::types::TickArrayFacade; #[cfg(not(feature = "wasm"))] #[derive(Debug, Clone, PartialEq, Eq)] pub enum TickArrays { One(TickArrayFacade), Two(TickArrayFacade, TickArrayFacade), Three(TickArrayFacade, TickArrayFacade, TickArrayFacade), Four( TickArrayFacade, TickArrayFacade, ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/liquidity.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct DecreaseLiquidityQuote { pub liquidity_delta: u128, pub token_est_a: u64, pub token_est_b: u64, pub t...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/fees.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct CollectFeesQuote { pub fee_owed_a: u64, pub fee_owed_b: u64, }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/mod.rs
mod fees; mod liquidity; mod pool; mod position; mod rewards; mod swap; mod tick; mod tick_array; mod token; mod u128; #[cfg(feature = "wasm")] mod u64; pub use fees::*; pub use liquidity::*; pub use pool::*; pub use position::*; pub use rewards::*; pub use swap::*; pub use tick::*; pub use tick_array::*; pub use tok...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/pool.rs
#![allow(non_snake_case)] use crate::NUM_REWARDS; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct WhirlpoolFacade { pub tick_spacing: u16, pub fee_rate: u16, pub protocol_fee_rate...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/u64.rs
use serde::Serializer; // Serialize a u64 as a u128. This is so that we can use u64 value in rust // but serialize as a bigint in wasm. pub fn u64_serialize<S>(value: &u64, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { serializer.serialize_u128(*value as u128) }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/position.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::NUM_REWARDS; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct PositionRatio { pub ratio_a: u16, pub ratio_b: u16, } #[derive(Copy, Clone, Debug, P...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/rewards.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::NUM_REWARDS; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct CollectRewardsQuote { pub rewards: [CollectRewardQuote; NUM_REWARDS], } #[derive(Copy, C...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/types/tick.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use serde_big_array::BigArray; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::TICK_ARRAY_SIZE; #[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] #[cfg_attr(feature = "wasm", wasm_expose)] pub struct TickRange { pub tick_lower_i...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/quote/swap.rs
use crate::{ sqrt_price_to_tick_index, tick_index_to_sqrt_price, try_apply_swap_fee, try_apply_transfer_fee, try_get_amount_delta_a, try_get_amount_delta_b, try_get_max_amount_with_slippage_tolerance, try_get_min_amount_with_slippage_tolerance, try_get_next_sqrt_price_from_a, try_get_next_sqrt_price_fro...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/quote/liquidity.rs
#[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use ethnum::U256; use crate::{ order_tick_indexes, position_status, tick_index_to_sqrt_price, try_apply_transfer_fee, try_get_max_amount_with_slippage_tolerance, try_get_min_amount_with_slippage_tolerance, try_reverse_apply_transfer_fee, Co...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/quote/fees.rs
use ethnum::U256; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::{ try_apply_transfer_fee, CollectFeesQuote, CoreError, PositionFacade, TickFacade, TransferFee, WhirlpoolFacade, AMOUNT_EXCEEDS_MAX_U64, ARITHMETIC_OVERFLOW, }; /// Calculate fees owed for a position /// /// # Para...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/quote/mod.rs
mod fees; mod liquidity; mod rewards; mod swap; pub use fees::*; pub use liquidity::*; pub use rewards::*; pub use swap::*;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/quote/rewards.rs
use ethnum::U256; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::{ try_apply_transfer_fee, CollectRewardQuote, CollectRewardsQuote, CoreError, PositionFacade, TickFacade, TransferFee, WhirlpoolFacade, AMOUNT_EXCEEDS_MAX_U64, ARITHMETIC_OVERFLOW, NUM_REWARDS, }; /// Calculate...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/swap.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; /// The denominator of the fee rate value. #[cfg_attr(feature = "wasm", wasm_expose)] pub const FEE_RATE_DENOMINATOR: u32 = 1_000_000; // TODO: WASM export (which doesn't work with u128 yet) /// The minimum sqrt price for a ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/error.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; pub type CoreError = &'static str; #[cfg_attr(feature = "wasm", wasm_expose)] pub const TICK_ARRAY_NOT_EVENLY_SPACED: CoreError = "Tick array not evenly spaced"; #[cfg_attr(feature = "wasm", wasm_expose)] pub const TICK_INDE...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/token.rs
pub const BPS_DENOMINATOR: u16 = 10000;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/bundle.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; /// The maximum number of positions in a position bundle. #[cfg_attr(feature = "wasm", wasm_expose)] pub const POSITION_BUNDLE_SIZE: usize = 256;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/mod.rs
mod bundle; mod error; mod pool; mod swap; mod tick; mod token; pub use bundle::*; pub use error::*; pub use pool::*; pub use swap::*; pub use tick::*; pub use token::*;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/pool.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; /// The number of reward tokens in a pool. #[cfg_attr(feature = "wasm", wasm_expose)] pub const NUM_REWARDS: usize = 3;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/constants/tick.rs
#![allow(non_snake_case)] #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; /// The number of ticks in a tick array. #[cfg_attr(feature = "wasm", wasm_expose)] pub const TICK_ARRAY_SIZE: usize = 88; /// Pools with tick spacing above this threshold are considered full range only. /// This means the pr...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/token.rs
use crate::{ CoreError, TransferFee, AMOUNT_EXCEEDS_MAX_U64, ARITHMETIC_OVERFLOW, BPS_DENOMINATOR, FEE_RATE_DENOMINATOR, INVALID_SLIPPAGE_TOLERANCE, INVALID_TRANSFER_FEE, MAX_SQRT_PRICE, MIN_SQRT_PRICE, SQRT_PRICE_OUT_OF_BOUNDS, U128, }; use ethnum::U256; #[cfg(feature = "wasm")] use orca_whirlpools_macros...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/tick_array.rs
use crate::{ CoreError, TickArrayFacade, TickFacade, INVALID_TICK_INDEX, MAX_TICK_INDEX, MIN_TICK_INDEX, TICK_ARRAY_NOT_EVENLY_SPACED, TICK_ARRAY_SIZE, TICK_INDEX_OUT_OF_BOUNDS, TICK_SEQUENCE_EMPTY, }; use super::{ get_initializable_tick_index, get_next_initializable_tick_index, get_prev_initializable_...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/bundle.rs
#[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use ethnum::U256; use crate::POSITION_BUNDLE_SIZE; const POSITION_BUNDLE_BYTES: usize = POSITION_BUNDLE_SIZE / 8; /// Get the first unoccupied position in a bundle /// /// # Arguments /// * `bundle` - The bundle to check /// /// # Returns /// * `u32`...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/mod.rs
mod bundle; mod position; mod tick; mod tick_array; mod token; #[cfg(feature = "floats")] mod price; pub use bundle::*; pub use position::*; pub use tick::*; pub use tick_array::*; pub use token::*; #[cfg(feature = "floats")] pub use price::*;
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/price.rs
#[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use libm::{floor, pow, sqrt}; use crate::U128; use super::{invert_tick_index, sqrt_price_to_tick_index, tick_index_to_sqrt_price}; const Q64_RESOLUTION: f64 = 18446744073709551616.0; /// Convert a price into a sqrt priceX64 /// IMPORTANT: floating p...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/position.rs
use crate::{PositionRatio, PositionStatus, BPS_DENOMINATOR, U128}; use ethnum::U256; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use super::{order_tick_indexes, tick_index_to_sqrt_price}; /// Check if a position is in range. /// When a position is in range it is earning fees and rewards /// ///...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src
solana_public_repos/orca-so/whirlpools/rust-sdk/core/src/math/tick.rs
use ethnum::U256; #[cfg(feature = "wasm")] use orca_whirlpools_macros::wasm_expose; use crate::{ CoreError, TickRange, FULL_RANGE_ONLY_TICK_SPACING_THRESHOLD, MAX_TICK_INDEX, MIN_TICK_INDEX, TICK_ARRAY_SIZE, TICK_INDEX_NOT_IN_ARRAY, U128, }; const LOG_B_2_X32: i128 = 59543866431248i128; const BIT_PRECISION: ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/index.test.ts
import assert from "assert"; import { execSync } from "child_process"; import { readdirSync } from "fs"; import { describe, it } from "vitest"; const clientConfigs = readdirSync("./client"); const coreConfigs = readdirSync("./core"); const whirlpoolConfigs = readdirSync("./whirlpool"); function exec(command: string) ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/README.md
# Rust SDK Integration tests This directory contains integration tests for the Rust SDK. This project contains various sub-projects to test different build configurations of the SDK.
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/package.json
{ "name": "@orca-so/whirlpools-rust-integration", "version": "0.0.1", "type": "module", "scripts": { "build": "tsc --noEmit", "test": "vitest run index.test.ts" }, "devDependencies": { "@orca-so/whirlpools-rust": "*", "@orca-so/whirlpools-rust-client": "*", "@orca-so/whirlpools-rust-core...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/tsconfig.json
{ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "./dist" }, "include": ["index.test.ts"] }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/ethnum_1.3/Cargo.toml
[package] name = "orca_whirlpools_core_integration_ethnum_v1_3" edition = "2021" [lib] path = "../../lib.rs" [dependencies] ethnum = { version = "~1.3" } orca_whirlpools_core = { path = "../../../core" }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/ethnum_1.4/Cargo.toml
[package] name = "orca_whirlpools_core_integration_ethnum_v1_4" edition = "2021" [lib] path = "../../lib.rs" [dependencies] ethnum = { version = "~1.4" } orca_whirlpools_core = { path = "../../../core" }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/ethnum_1.5/Cargo.toml
[package] name = "orca_whirlpools_core_integration_ethnum_v1_5" edition = "2021" [lib] path = "../../lib.rs" [dependencies] ethnum = { version = "~1.5" } orca_whirlpools_core = { path = "../../../core" }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/ethnum_1.2/Cargo.toml
[package] name = "orca_whirlpools_core_integration_ethnum_v1_2" edition = "2021" [lib] path = "../../lib.rs" [dependencies] ethnum = { version = "~1.2" } orca_whirlpools_core = { path = "../../../core" }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/libm_0.1/Cargo.toml
[package] name = "orca_whirlpools_core_integration_libm_v0_1" edition = "2021" [lib] path = "../../lib.rs" [dependencies] libm = { version = "~0.1" } orca_whirlpools_core = { path = "../../../core", features = ["floats"] }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/ethnum_1.1/Cargo.toml
[package] name = "orca_whirlpools_core_integration_ethnum_v1_1" edition = "2021" [lib] path = "../../lib.rs" [dependencies] ethnum = { version = "~1.1" } orca_whirlpools_core = { path = "../../../core" }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/core/libm_0.2/Cargo.toml
[package] name = "orca_whirlpools_core_integration_libm_v0_2" edition = "2021" [lib] path = "../../lib.rs" [dependencies] libm = { version = "~0.2" } orca_whirlpools_core = { path = "../../../core", features = ["floats"] }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/whirlpool
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/whirlpool/solana v1.18/Cargo.toml
[package] name = "orca_whirlpools_integration_solana_v1_18" edition = "2021" [lib] path = "../../lib.rs" [dependencies] solana-program = { version = "~1.18" } solana-sdk = { version = "~1.18" } solana-client = { version = "~1.18" } solana-account-decoder = { version = "~1.18" } orca_whirlpools = { path = "../../../wh...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client/solana_v1.17/Cargo.toml
[package] name = "orca_whirlpools_client_integration_solana_v1_17" edition = "2021" [lib] path = "../../lib.rs" [dependencies] solana-program = { version = "~1.17" } solana-sdk = { version = "~1.17" } solana-client = { version = "~1.17" } solana-account-decoder = { version = "~1.17" } orca_whirlpools_client = { path ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client/solana_v1.18/Cargo.toml
[package] name = "orca_whirlpools_client_integration_solana_v1_18" edition = "2021" [lib] path = "../../lib.rs" [dependencies] solana-program = { version = "~1.18" } solana-sdk = { version = "~1.18" } solana-client = { version = "~1.18" } solana-account-decoder = { version = "~1.18" } orca_whirlpools_client = { path ...
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client/anchor_v0.29/Cargo.toml
[package] name = "orca_whirlpools_client_integration_anchor_v0_29" edition = "2021" [lib] path = "../../lib.rs" [dependencies] anchor-lang = { version = "~0.29" } orca_whirlpools_client = { path = "../../../client", features = ["anchor"] }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client
solana_public_repos/orca-so/whirlpools/rust-sdk/integration/client/anchor_v0.30/Cargo.toml
[package] name = "orca_whirlpools_client_integration_anchor_v0_30" edition = "2021" [lib] path = "../../lib.rs" [dependencies] anchor-lang = { version = "~0.30" } orca_whirlpools_client = { path = "../../../client", features = ["anchor"] }
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/macros/Cargo.toml
[package] name = "orca_whirlpools_macros" version = "0.1.0" description = "Orca's rust wasm macros package." include = ["src/*"] documentation = "https://orca-so.github.io/whirlpools/" homepage = "https://orca.so" repository = "https://github.com/orca-so/whirlpools" license = "Apache-2.0" keywords = ["solana", "crypto"...
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/macros/README.md
# Orca Whirlpools Rust Macros
0
solana_public_repos/orca-so/whirlpools/rust-sdk
solana_public_repos/orca-so/whirlpools/rust-sdk/macros/package.json
{ "name": "@orca-so/whirlpools-rust-macros", "version": "0.0.1", "scripts": { "build": "cargo build", "test": "cargo test --lib", "format": "cargo clippy --fix --allow-dirty --allow-staged && cargo fmt", "lint": "cargo clippy && cargo fmt --check", "clean": "cargo clean" } }
0
solana_public_repos/orca-so/whirlpools/rust-sdk/macros
solana_public_repos/orca-so/whirlpools/rust-sdk/macros/src/wasm_struct.rs
use proc_macro2::TokenStream; use quote::quote; use syn::{parse::Nothing, parse_quote, ItemStruct, Result, Type}; pub fn wasm_struct_impl(item: ItemStruct, _attr: Nothing) -> Result<TokenStream> { let mut item = item; // Add attributes to u64 fields for field in &mut item.fields { if let Type::Pat...
0