Jupiter SDK
[!WARNING] This is not an official package by the Jupiter team. It is an independent, community-maintained project.
Codama-generated SDKs for on-chain Jupiter programs. Each product ships three client flavors:
| Flavor | Import / crate | Stack |
|---|---|---|
| kit | jupiter-sdk/<product>/kit |
@solana/kit |
| web3js | jupiter-sdk/<product>/web3js |
@solana/web3.js v2 (3.0.0-rc.x) |
| rust | jupiter-program-sdk with feature <product> |
Solana program / CPI client |
Setup
Usage
Examples below use offerbook. Swap the product name for any other generated product (e.g. prediction).
Kit (@solana/kit)
import {
getCreateUserInstructionAsync,
OFFERBOOK_PROGRAM_ADDRESS,
} from "jupiter-sdk/offerbook/kit";
import type { Address, TransactionSigner } from "@solana/kit";
const instruction = await getCreateUserInstructionAsync({
signer, // TransactionSigner
config: configAddress as Address,
});
console.log(OFFERBOOK_PROGRAM_ADDRESS, instruction);
Web3.js (@solana/web3.js)
import { createCreateUserInstruction, OFFERBOOK_PROGRAM_ID } from "jupiter-sdk/offerbook/web3js";
import { Address } from "@solana/web3.js";
const instruction = await createCreateUserInstruction({
signer: signerAddress,
config: configAddress,
systemProgram: new Address("11111111111111111111111111111111"),
});
console.log(OFFERBOOK_PROGRAM_ID, instruction);
Rust
[]
= { = "0.0.0", = ["offerbook"] }
use CreateUserBuilder;
use Address;
let instruction = new
.signer
.signer_user
.config
.instruction;
Enable a product with its Cargo feature (offerbook, prediction, …). The umbrella crate re-exports each client as jupiter_program_sdk::<product>.
Development