@pina-rs/amm 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +27 -2
  2. package/dist/index.cjs +1257 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +1752 -0
  5. package/dist/index.d.ts +1752 -0
  6. package/dist/index.js +1078 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +57 -8
  9. package/src/generated/accounts/ammConfig.ts +197 -0
  10. package/src/generated/accounts/index.ts +10 -0
  11. package/src/generated/accounts/pool.ts +218 -0
  12. package/src/generated/errors/index.ts +9 -0
  13. package/src/generated/errors/pinaAmm.ts +64 -0
  14. package/src/generated/events/feesCollected.ts +64 -0
  15. package/src/generated/events/index.ts +13 -0
  16. package/src/generated/events/liquidityChanged.ts +72 -0
  17. package/src/generated/events/logs.ts +372 -0
  18. package/src/generated/events/poolCreated.ts +80 -0
  19. package/src/generated/events/swapped.ts +100 -0
  20. package/src/generated/index.ts +14 -0
  21. package/src/generated/instructions/collectCreatorFees.ts +119 -0
  22. package/src/generated/instructions/collectProtocolFees.ts +123 -0
  23. package/src/generated/instructions/createConfig.ts +142 -0
  24. package/src/generated/instructions/createPool.ts +291 -0
  25. package/src/generated/instructions/deposit.ts +139 -0
  26. package/src/generated/instructions/index.ts +19 -0
  27. package/src/generated/instructions/migrate.ts +155 -0
  28. package/src/generated/instructions/setPoolCreator.ts +90 -0
  29. package/src/generated/instructions/swapExactIn.ts +119 -0
  30. package/src/generated/instructions/swapExactOut.ts +119 -0
  31. package/src/generated/instructions/updateConfig.ts +105 -0
  32. package/src/generated/instructions/withdraw.ts +139 -0
  33. package/src/generated/pdas/ammConfig.ts +18 -0
  34. package/src/generated/pdas/index.ts +12 -0
  35. package/src/generated/pdas/pool.ts +20 -0
  36. package/src/generated/pdas/poolLpMint.ts +18 -0
  37. package/src/generated/pdas/poolVault.ts +19 -0
  38. package/src/generated/pinaPodCodecs.ts +232 -0
  39. package/src/generated/programs/index.ts +9 -0
  40. package/src/generated/programs/pinaAmm.ts +115 -0
  41. package/src/index.ts +11 -0
  42. package/CHANGELOG.md +0 -5
package/README.md CHANGED
@@ -1,3 +1,28 @@
1
- # @pina-rs/amm
1
+ # `@pina-rs/amm`
2
2
 
3
- Placeholder package published by monochange. The first release replaces it.
3
+ TypeScript client for the [Pina AMM](https://github.com/pina-rs/amm), a permissionless constant-product market maker on Solana, for [`@solana/kit`](https://github.com/anza-xyz/kit). Generated from the program's IDL.
4
+
5
+ ```sh
6
+ pnpm add @pina-rs/amm @solana/kit
7
+ ```
8
+
9
+ ```ts
10
+ import { fetchPool, getSwapExactInInstruction } from "@pina-rs/amm";
11
+ import { TOKEN_PROGRAM_ADDRESS } from "@solana-program/token";
12
+
13
+ const { data: pool } = await fetchPool(rpc, poolAddress);
14
+ const instruction = getSwapExactInInstruction({
15
+ trader: wallet,
16
+ pool: poolAddress,
17
+ inputToken,
18
+ outputToken,
19
+ inputVault: pool.vault0,
20
+ outputVault: pool.vault1,
21
+ inputTokenProgram: TOKEN_PROGRAM_ADDRESS,
22
+ outputTokenProgram: TOKEN_PROGRAM_ADDRESS,
23
+ amountIn: 1_000_000n,
24
+ minimumAmountOut: 990_000n,
25
+ });
26
+ ```
27
+
28
+ Full guide: [docs/typescript.md](https://github.com/pina-rs/amm/blob/main/docs/typescript.md).