1.0.10 โ€ข Published 9 months ago

@discosea/kitchen v1.0.10

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

๐Ÿณ @discosea/kitchen

Composable token instructions for Solana. Build and use on-chain "recipes" that combine multiple SPL tokens into unified index tokens โ€” and split them back. Built for use with DeFi apps, games, and meme projects.

As seen on cookthecoins.com


๐Ÿ“ฆ Installation

npm install @discosea/kitchen

๐Ÿงฐ Exports

  • createRecipe(feePayerPubkey, cookedData)
  • useRecipe(feePayerPubkey, cookedData, tokenAccounts, option)
  • findCookPDA(concatenatedData, salt)

๐Ÿฅ˜ createRecipe

Creates a TransactionInstruction to define a new on-chain recipe.

import { createRecipe } from "@discosea/kitchen";
import { PublicKey } from "@solana/web3.js";

const cookedData = {
  pda: "RecipePDA",
  seeds: [
    { mint: "MintAddress1", amount_u64: "1000000" },
    { mint: "MintAddress2", amount_u64: "2000000" },
  ],
  salt: "unique-salt-string",
  metadataCid: "QmYourIPFSCid",
  name: "My Token Index",
  symbol: "MTI",
};

const ix = await createRecipe(new PublicKey("FEE_PAYER_PUBKEY"), cookedData);

๐Ÿณ useRecipe

Returns a TransactionInstruction for cook (mint) or uncook (burn).

import { useRecipe } from "@discosea/kitchen";

const cookedData = {
  pda: "RecipePDA",
  seeds: [
    { mint: "MintAddress1", amount_u64: "1000000" },
    { mint: "MintAddress2", amount_u64: "2000000" },
  ],
  seedSalt: "unique-salt-string",
  qty_requested: "2.5",
};

const tokenAccounts = [
  "PDA_Seed1",
  "USER_Seed1",
  "PDA_Seed2",
  "USER_Seed2",
  "PDA_IndexToken",
  "USER_IndexToken",
];

const ix = await useRecipe(
  new PublicKey("FEE_PAYER_PUBKEY"),
  cookedData,
  tokenAccounts,
  0x02 // 0x02 = cook, 0x03 = uncook
);

๐Ÿงช findCookPDA

Deterministically derive a PDA for a recipe.

import { findCookPDA } from "@discosea/kitchen";

const concatenated = Buffer.concat([
  Buffer.from("Seed1"),
  Buffer.from("Seed2"),
]);

const { pda, bump, sha256Hash } = findCookPDA(concatenated, "salt");

๐Ÿ› ๏ธ Notes

  • Seed amounts must be passed as raw amount_u64 (base units, not UI format)
  • qty_requested is a UI float (e.g. "2.5") and converted internally
  • PDA and metadata CID must be precomputed externally

๐Ÿงพ License

MIT ยฉ DiscoSea

1.0.33

7 months ago

1.0.32

7 months ago

1.0.31

7 months ago

1.0.30

7 months ago

1.0.29

7 months ago

1.0.28

7 months ago

1.0.27

7 months ago

1.0.26

7 months ago

1.0.25

7 months ago

1.0.24

7 months ago

1.0.23

9 months ago

1.0.22

9 months ago

1.0.21

9 months ago

1.0.20

9 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

9 months ago

1.0.15

9 months ago

1.0.14

9 months ago

1.0.13

9 months ago

1.0.12

9 months ago

1.0.11

9 months ago

1.0.10

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago