@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.
- package/README.md +27 -2
- package/dist/index.cjs +1257 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1752 -0
- package/dist/index.d.ts +1752 -0
- package/dist/index.js +1078 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -8
- package/src/generated/accounts/ammConfig.ts +197 -0
- package/src/generated/accounts/index.ts +10 -0
- package/src/generated/accounts/pool.ts +218 -0
- package/src/generated/errors/index.ts +9 -0
- package/src/generated/errors/pinaAmm.ts +64 -0
- package/src/generated/events/feesCollected.ts +64 -0
- package/src/generated/events/index.ts +13 -0
- package/src/generated/events/liquidityChanged.ts +72 -0
- package/src/generated/events/logs.ts +372 -0
- package/src/generated/events/poolCreated.ts +80 -0
- package/src/generated/events/swapped.ts +100 -0
- package/src/generated/index.ts +14 -0
- package/src/generated/instructions/collectCreatorFees.ts +119 -0
- package/src/generated/instructions/collectProtocolFees.ts +123 -0
- package/src/generated/instructions/createConfig.ts +142 -0
- package/src/generated/instructions/createPool.ts +291 -0
- package/src/generated/instructions/deposit.ts +139 -0
- package/src/generated/instructions/index.ts +19 -0
- package/src/generated/instructions/migrate.ts +155 -0
- package/src/generated/instructions/setPoolCreator.ts +90 -0
- package/src/generated/instructions/swapExactIn.ts +119 -0
- package/src/generated/instructions/swapExactOut.ts +119 -0
- package/src/generated/instructions/updateConfig.ts +105 -0
- package/src/generated/instructions/withdraw.ts +139 -0
- package/src/generated/pdas/ammConfig.ts +18 -0
- package/src/generated/pdas/index.ts +12 -0
- package/src/generated/pdas/pool.ts +20 -0
- package/src/generated/pdas/poolLpMint.ts +18 -0
- package/src/generated/pdas/poolVault.ts +19 -0
- package/src/generated/pinaPodCodecs.ts +232 -0
- package/src/generated/programs/index.ts +9 -0
- package/src/generated/programs/pinaAmm.ts +115 -0
- package/src/index.ts +11 -0
- package/CHANGELOG.md +0 -5
package/README.md
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@pina-rs/amm`
|
|
2
2
|
|
|
3
|
-
|
|
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).
|