@meteora-ag/dynamic-bonding-curve-sdk 1.1.1 → 1.1.2
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/CHANGELOG.md +47 -0
- package/README.md +30 -14
- package/dist/index.cjs +19309 -12212
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7813 -145
- package/dist/index.d.ts +7813 -145
- package/dist/index.js +10603 -3506
- package/dist/index.js.map +1 -1
- package/docs.md +1680 -207
- package/package.json +5 -2
- package/src/client.ts +23 -234
- package/src/constants.ts +0 -2
- package/src/{derive.ts → helpers/accounts.ts} +138 -81
- package/src/{build.ts → helpers/buildCurve.ts} +55 -137
- package/src/{common.ts → helpers/common.ts} +65 -137
- package/src/helpers/createProgram.ts +76 -0
- package/src/helpers/index.ts +7 -0
- package/src/helpers/token.ts +166 -0
- package/src/helpers/utils.ts +300 -0
- package/src/{checks.ts → helpers/validation.ts} +77 -68
- package/src/idl/dynamic-bonding-curve/idl.json +360 -11
- package/src/idl/dynamic-bonding-curve/idl.ts +271 -9
- package/src/index.ts +3 -1
- package/src/math/swapQuote.ts +37 -25
- package/src/services/creator.ts +241 -0
- package/src/services/index.ts +5 -0
- package/src/services/migration.ts +272 -192
- package/src/services/partner.ts +129 -309
- package/src/services/pool.ts +323 -216
- package/src/services/program.ts +75 -0
- package/src/services/state.ts +379 -0
- package/src/types.ts +94 -39
- package/tests/buildCurve.test.ts +126 -0
- package/tests/math/feeMode.test.ts +8 -18
- package/tests/math/swapQuote.test.ts +5 -15
- package/tests/utils/common.ts +19 -0
- package/tsconfig.json +7 -3
- package/src/utils.ts +0 -265
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [1.1.1-rc.9] - 2025-04-29
|
|
4
|
+
|
|
5
|
+
### Release Notes
|
|
6
|
+
|
|
7
|
+
#### Feature Changes
|
|
8
|
+
|
|
9
|
+
- feat: added 4% and 6% graduation fee options
|
|
10
|
+
- feat: creatorWithdrawSurplus and claimCreatorTradingFee functions
|
|
11
|
+
- feat: added new getter functions
|
|
12
|
+
- fix: updated the way the services are called
|
|
13
|
+
- fix: updated the way the getters are called
|
|
14
|
+
|
|
15
|
+
#### Breaking Changes
|
|
16
|
+
|
|
17
|
+
- `createConfig`, `buildCurveAndCreateConfig` and `buildCurveAndCreateConfigByMarketCap` functions now require a `creatorTradingFeePercentage` parameter.
|
|
18
|
+
- IDL includes `creatorWithdrawSurplus` and `claimCreatorTradingFee` instructions.
|
|
19
|
+
- Partner, Migration, Creator and Pool functions are now called in this manner:
|
|
20
|
+
- `client.partners.createConfig` -> `client.partner.createConfig`
|
|
21
|
+
- `client.migrations.migrateToDammV1` -> `client.migration.migrateToDammV1`
|
|
22
|
+
- `client.creators.createPoolMetadata` -> `client.creator.createPoolMetadata`
|
|
23
|
+
- `client.pools.swap` -> `client.pool.swap`
|
|
24
|
+
- Getter functions are now called in this manner:
|
|
25
|
+
- `client.getProgram().getPoolConfig` -> `client.getPoolConfig`
|
|
26
|
+
|
|
27
|
+
## [1.1.2] - 2025-04-30
|
|
28
|
+
|
|
29
|
+
### Release Notes
|
|
30
|
+
|
|
31
|
+
#### Feature Changes
|
|
32
|
+
|
|
33
|
+
- feat: refactor SDK to be more modular and optimise RPC calls
|
|
34
|
+
- feat: added `createPoolAndBuy` function
|
|
35
|
+
|
|
36
|
+
#### Breaking Changes
|
|
37
|
+
|
|
38
|
+
- Partner, Migration, Creator, Pool and State functions are now called in this manner:
|
|
39
|
+
- `client.partners.createConfig` -> `client.partner.createConfig`
|
|
40
|
+
- `client.migrations.migrateToDammV1` -> `client.migration.migrateToDammV1`
|
|
41
|
+
- `client.creators.createPoolMetadata` -> `client.creator.createPoolMetadata`
|
|
42
|
+
- `client.pools.swap` -> `client.pool.swap`
|
|
43
|
+
- `client.getPoolConfig` -> `client.state.getPoolConfig`
|
|
44
|
+
- In order to get the DBC Pool Address, or DAMM V1 Pool Address, or DAMM V2 Pool Address, use the following functions (the order matters):
|
|
45
|
+
- `deriveDbcPoolAddress`
|
|
46
|
+
- `deriveDammV1PoolAddress`
|
|
47
|
+
- `deriveDammV2PoolAddress`
|
package/README.md
CHANGED
|
@@ -9,6 +9,8 @@ This SDK provides a set of tools and methods to interact with the [Meteora Dynam
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
+
npm install @meteora-ag/dynamic-bonding-curve-sdk
|
|
13
|
+
# or
|
|
12
14
|
pnpm install @meteora-ag/dynamic-bonding-curve-sdk
|
|
13
15
|
# or
|
|
14
16
|
yarn add @meteora-ag/dynamic-bonding-curve-sdk
|
|
@@ -16,17 +18,27 @@ yarn add @meteora-ag/dynamic-bonding-curve-sdk
|
|
|
16
18
|
|
|
17
19
|
## Initialization
|
|
18
20
|
|
|
19
|
-
```
|
|
20
|
-
import { Connection } from
|
|
21
|
-
import { DynamicBondingCurveClient } from
|
|
21
|
+
```typescript
|
|
22
|
+
import { Connection } from '@solana/web3.js'
|
|
23
|
+
import { DynamicBondingCurveClient } from '@meteora-ag/dynamic-bonding-curve-sdk'
|
|
22
24
|
|
|
23
25
|
const connection = new Connection('https://api.mainnet-beta.solana.com')
|
|
24
|
-
const client = new DynamicBondingCurveClient(connection)
|
|
26
|
+
const client = new DynamicBondingCurveClient(connection, 'confirmed')
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
## Usage
|
|
28
30
|
|
|
29
|
-
Refer to the [docs](./docs.md) for
|
|
31
|
+
Refer to the [docs](./docs.md) for how to use the functions.
|
|
32
|
+
|
|
33
|
+
## Flow
|
|
34
|
+
|
|
35
|
+
The generic flow of how Dynamic Bonding Curve works is as follows:
|
|
36
|
+
|
|
37
|
+
1. The partner creates a config key for the pool.
|
|
38
|
+
2. The creator creates a pool.
|
|
39
|
+
3. The pool is tradeable on the Dynamic Bonding Curve.
|
|
40
|
+
4. Meteora's migrator service migrates the pool to either DAMM V1 or DAMM V2 based on the config key once the migration quote threshold is met.
|
|
41
|
+
5. The graduated pool is tradeable on either DAMM V1 or DAMM V2.
|
|
30
42
|
|
|
31
43
|
### Test
|
|
32
44
|
|
|
@@ -40,18 +52,22 @@ bun test
|
|
|
40
52
|
- Mainnet-beta: dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
|
|
41
53
|
- Devnet: dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
|
|
42
54
|
|
|
43
|
-
###
|
|
55
|
+
### Graduated DAMM Pool Config Keys
|
|
44
56
|
|
|
45
57
|
#### DAMM V1:
|
|
46
58
|
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
59
|
+
- MigrationFeeOption.FixedBps25 == 0: 8f848CEy8eY6PhJ3VcemtBDzPPSD4Vq7aJczLZ3o8MmX
|
|
60
|
+
- MigrationFeeOption.FixedBps30 == 1: HBxB8Lf14Yj8pqeJ8C4qDb5ryHL7xwpuykz31BLNYr7S
|
|
61
|
+
- MigrationFeeOption.FixedBps100 == 2: 7v5vBdUQHTNeqk1HnduiXcgbvCyVEZ612HLmYkQoAkik
|
|
62
|
+
- MigrationFeeOption.FixedBps200 == 3: EkvP7d5yKxovj884d2DwmBQbrHUWRLGK6bympzrkXGja
|
|
63
|
+
- MigrationFeeOption.FixedBps400 == 4: 9EZYAJrcqNWNQzP2trzZesP7XKMHA1jEomHzbRsdX8R2
|
|
64
|
+
- MigrationFeeOption.FixedBps600 == 5: 8cdKo87jZU2R12KY1BUjjRPwyjgdNjLGqSGQyrDshhud
|
|
51
65
|
|
|
52
66
|
#### DAMM V2:
|
|
53
67
|
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
68
|
+
- MigrationFeeOption.FixedBps25 == 0: 7F6dnUcRuyM2TwR8myT1dYypFXpPSxqwKNSFNkxyNESd
|
|
69
|
+
- MigrationFeeOption.FixedBps30 == 1: 2nHK1kju6XjphBLbNxpM5XRGFj7p9U8vvNzyZiha1z6k
|
|
70
|
+
- MigrationFeeOption.FixedBps100 == 2: Hv8Lmzmnju6m7kcokVKvwqz7QPmdX9XfKjJsXz8RXcjp
|
|
71
|
+
- MigrationFeeOption.FixedBps200 == 3: 2c4cYd4reUYVRAB9kUUkrq55VPyy2FNQ3FDL4o12JXmq
|
|
72
|
+
- MigrationFeeOption.FixedBps400 == 4: AkmQWebAwFvWk55wBoCr5D62C6VVDTzi84NJuD9H7cFD
|
|
73
|
+
- MigrationFeeOption.FixedBps600 == 5: DbCRBj8McvPYHJG1ukj8RE15h2dCNUdTAESG49XpQ44u
|