@meteora-ag/zap-sdk 1.3.1 → 2.0.0-rc.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/LICENSE +21 -0
- package/README.md +31 -5
- package/dist/index.d.mts +1456 -1029
- package/dist/index.d.ts +1456 -1029
- package/dist/index.js +1190 -525
- package/dist/index.mjs +1131 -484
- package/package.json +12 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meteora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -6,6 +6,17 @@ A Typescript SDK for interacting with the Zap program on Meteora.
|
|
|
6
6
|
|
|
7
7
|
This SDK provides a set of tools and methods to interact with the Zap Program on Meteora. It enables developers to easily zap out of their positions on different AMMs on Solana.
|
|
8
8
|
|
|
9
|
+
## Disclaimer: quotes, Direct routes, and examples
|
|
10
|
+
|
|
11
|
+
Zap In is a **multi-step** flow. Intermediate **swap** transactions are Jupiter (or pool) quotes that the SDK does **not** economically validate.
|
|
12
|
+
|
|
13
|
+
- `simulateTransaction` with no `err` only means the swap will land. It does **not** mean `outAmount` is a reasonable market vs the input size.
|
|
14
|
+
- Jupiter `slippageBps` bounds fill vs **that quote / that route**, not input-vs-output fair value. See [Jupiter customer support](https://developers.jup.ag/docs/resources/support#customer-support).
|
|
15
|
+
- Direct zap-in helpers (`estimateDlmmDirectSwap`, and examples using `maxAccounts: 50`) currently call Jupiter with `onlyDirectRoutes=true` and `maxAccounts=50`. That can return a much thinner route than the Jupiter UI, which does not set those limits.
|
|
16
|
+
- The Meteora **UI** applies extra output-amount / USD / extreme-impact checks. This SDK does not. Examples are starting points for specific pools and sizes, not production-safe defaults for every token.
|
|
17
|
+
|
|
18
|
+
Before sending: compare quoted output to a reference price, reject extreme impact, simulate **wallet token deltas**, and if Direct is far worse than a multi-hop quote, pass `onlyDirectRoutes=false` / raise `maxAccounts` or skip the zap.
|
|
19
|
+
|
|
9
20
|
## Installation
|
|
10
21
|
|
|
11
22
|
```bash
|
|
@@ -18,7 +29,11 @@ yarn add @meteora-ag/zap-sdk
|
|
|
18
29
|
|
|
19
30
|
## Jupiter API Setup
|
|
20
31
|
|
|
21
|
-
All Jupiter-related functions (`getJupiterQuote`, `getJupiterSwapInstruction`, and estimate functions) support custom API configuration.
|
|
32
|
+
All Jupiter-related functions (`getJupiterQuote`, `getJupiterSwapInstruction`, `getJupAndDammV2Quotes`, and the DLMM estimate functions) support custom API configuration.
|
|
33
|
+
|
|
34
|
+
### API Version
|
|
35
|
+
|
|
36
|
+
The SDK uses Jupiter Swap API v2 (`GET /swap/v2/build`) by default. v1 api support is deprecated in this SDK.
|
|
22
37
|
|
|
23
38
|
### Getting Your Jupiter API Key
|
|
24
39
|
|
|
@@ -28,10 +43,11 @@ For detailed setup instructions, see [Jupiter's Setup Guide](https://dev.jup.ag/
|
|
|
28
43
|
|
|
29
44
|
### API Parameters
|
|
30
45
|
|
|
31
|
-
All Jupiter functions accept optional `
|
|
46
|
+
All Jupiter functions accept an optional `config: ZapConfig`:
|
|
32
47
|
|
|
33
48
|
- `jupiterApiUrl` (optional): The Jupiter API endpoint. Default: `"https://api.jup.ag"`
|
|
34
49
|
- `jupiterApiKey` (optional): Your Jupiter API key. Default: `""` (empty string)
|
|
50
|
+
- `jupiterApiVersion` (optional): `JupiterApiVersion.V2` (default) or `JupiterApiVersion.V1` (deprecated)
|
|
35
51
|
|
|
36
52
|
**Note**: While the API key parameter is optional in the function signature, Jupiter requires an API key for all requests. Using the default empty string may result in API errors.
|
|
37
53
|
|
|
@@ -42,17 +58,27 @@ import { Connection } from "@solana/web3.js";
|
|
|
42
58
|
import { Zap } from "@meteora-ag/zap-sdk";
|
|
43
59
|
|
|
44
60
|
const connection = new Connection("https://api.mainnet-beta.solana.com");
|
|
45
|
-
const jupiterApiUrl = "https://api.jup.ag";
|
|
46
|
-
const jupiterApiKey = "YOUR_API_KEY_HERE";
|
|
47
61
|
|
|
48
|
-
const zap = new Zap(connection,
|
|
62
|
+
const zap = new Zap(connection, {
|
|
63
|
+
jupiterApiUrl: "https://api.jup.ag",
|
|
64
|
+
jupiterApiKey: "YOUR_API_KEY_HERE",
|
|
65
|
+
// jupiterApiVersion: JupiterApiVersion.V1, // deprecated, defaults to V2 if unset
|
|
66
|
+
});
|
|
49
67
|
```
|
|
50
68
|
|
|
51
69
|
## Usage
|
|
52
70
|
|
|
53
71
|
Refer to the [docs](./docs.md) for how to use the functions.
|
|
54
72
|
|
|
73
|
+
The zap methods return an ordered list of instructions and the address lookup tables they use, not transactions, so you can build legacy or v0 transactions and decide how to split them. See [Building Transactions](./docs.md#building-transactions) for the instruction order, compute budget and lookup table details.
|
|
74
|
+
|
|
55
75
|
### Program Address
|
|
56
76
|
|
|
57
77
|
- Mainnet-beta: zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz
|
|
58
78
|
- Devnet: zapvX9M3uf5pvy4wRPAbQgdQsM1xmuiFnkfHKPvwMiz
|
|
79
|
+
|
|
80
|
+
## License
|
|
81
|
+
|
|
82
|
+
This SDK is released under the [MIT License](./LICENSE).
|
|
83
|
+
|
|
84
|
+
The on-chain Zap program is licensed separately and is not covered by this MIT license.
|