@picon-finance/dlmm-sdk 1.19.0 → 2.0.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 +18 -8
- package/dist/entities/admin_config.d.ts +2 -2
- package/dist/entities/admin_config.d.ts.map +1 -1
- package/dist/entities/admin_config.js +2 -2
- package/dist/entities/bin_array.d.ts +2 -2
- package/dist/entities/bin_array.d.ts.map +1 -1
- package/dist/entities/bin_array.js +5 -5
- package/dist/entities/dlmm_program.d.ts +3 -3
- package/dist/entities/dlmm_program.d.ts.map +1 -1
- package/dist/entities/dlmm_program.js +5 -5
- package/dist/entities/index.d.ts +6 -6
- package/dist/entities/index.d.ts.map +1 -1
- package/dist/entities/index.js +6 -6
- package/dist/entities/pool.d.ts +6 -6
- package/dist/entities/pool.d.ts.map +1 -1
- package/dist/entities/pool.js +11 -11
- package/dist/entities/position.d.ts +5 -5
- package/dist/entities/position.d.ts.map +1 -1
- package/dist/entities/position.js +11 -11
- package/dist/entities/position_pool.js +2 -2
- package/dist/events.d.ts +8 -67
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +35 -109
- package/dist/generated/accounts/binArray.d.ts +1 -1
- package/dist/generated/accounts/binArray.d.ts.map +1 -1
- package/dist/generated/accounts/binArray.js +1 -1
- package/dist/generated/accounts/index.d.ts +4 -4
- package/dist/generated/accounts/index.d.ts.map +1 -1
- package/dist/generated/accounts/index.js +4 -4
- package/dist/generated/accounts/pool.d.ts +1 -1
- package/dist/generated/accounts/pool.d.ts.map +1 -1
- package/dist/generated/accounts/pool.js +1 -1
- package/dist/generated/accounts/position.d.ts +1 -1
- package/dist/generated/accounts/position.d.ts.map +1 -1
- package/dist/generated/accounts/position.js +1 -1
- package/dist/generated/constants/index.d.ts +9 -0
- package/dist/generated/constants/index.d.ts.map +1 -0
- package/dist/generated/constants/index.js +8 -0
- package/dist/generated/constants/piconDlmm.d.ts +17 -0
- package/dist/generated/constants/piconDlmm.d.ts.map +1 -0
- package/dist/generated/constants/piconDlmm.js +16 -0
- package/dist/generated/errors/index.d.ts +1 -1
- package/dist/generated/errors/index.d.ts.map +1 -1
- package/dist/generated/errors/index.js +1 -1
- package/dist/generated/errors/piconDlmm.js +1 -1
- package/dist/generated/events/claimFeeEvent.d.ts +41 -0
- package/dist/generated/events/claimFeeEvent.d.ts.map +1 -0
- package/dist/generated/events/claimFeeEvent.js +51 -0
- package/dist/generated/events/closePositionEvent.d.ts +27 -0
- package/dist/generated/events/closePositionEvent.d.ts.map +1 -0
- package/dist/generated/events/closePositionEvent.js +43 -0
- package/dist/generated/events/createPoolEvent.d.ts +27 -0
- package/dist/generated/events/createPoolEvent.d.ts.map +1 -0
- package/dist/generated/events/createPoolEvent.js +43 -0
- package/dist/generated/events/depositEvent.d.ts +41 -0
- package/dist/generated/events/depositEvent.d.ts.map +1 -0
- package/dist/generated/events/depositEvent.js +51 -0
- package/dist/generated/events/index.d.ts +15 -0
- package/dist/generated/events/index.d.ts.map +1 -0
- package/dist/generated/events/index.js +14 -0
- package/dist/generated/events/openPositionEvent.d.ts +27 -0
- package/dist/generated/events/openPositionEvent.d.ts.map +1 -0
- package/dist/generated/events/openPositionEvent.js +43 -0
- package/dist/generated/events/swapEvent.d.ts +43 -0
- package/dist/generated/events/swapEvent.d.ts.map +1 -0
- package/dist/generated/events/swapEvent.js +53 -0
- package/dist/generated/events/withdrawEvent.d.ts +43 -0
- package/dist/generated/events/withdrawEvent.d.ts.map +1 -0
- package/dist/generated/events/withdrawEvent.js +53 -0
- package/dist/generated/index.d.ts +8 -6
- package/dist/generated/index.d.ts.map +1 -1
- package/dist/generated/index.js +8 -6
- package/dist/generated/instructions/acceptAdminAuthority.d.ts +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/acceptAdminAuthority.js +3 -3
- package/dist/generated/instructions/claimFee.d.ts +2 -2
- package/dist/generated/instructions/claimFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimFee.js +2 -2
- package/dist/generated/instructions/claimProtocolFee.d.ts +2 -2
- package/dist/generated/instructions/claimProtocolFee.d.ts.map +1 -1
- package/dist/generated/instructions/claimProtocolFee.js +4 -4
- package/dist/generated/instructions/closePosition.d.ts +1 -1
- package/dist/generated/instructions/closePosition.d.ts.map +1 -1
- package/dist/generated/instructions/closePosition.js +3 -3
- package/dist/generated/instructions/createAdminConfig.d.ts +1 -1
- package/dist/generated/instructions/createAdminConfig.d.ts.map +1 -1
- package/dist/generated/instructions/createAdminConfig.js +3 -3
- package/dist/generated/instructions/createBinArray.d.ts +1 -1
- package/dist/generated/instructions/createBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/createBinArray.js +3 -3
- package/dist/generated/instructions/createPool.d.ts +1 -1
- package/dist/generated/instructions/createPool.d.ts.map +1 -1
- package/dist/generated/instructions/createPool.js +4 -4
- package/dist/generated/instructions/deleteBinArray.d.ts +1 -1
- package/dist/generated/instructions/deleteBinArray.d.ts.map +1 -1
- package/dist/generated/instructions/deleteBinArray.js +4 -4
- package/dist/generated/instructions/depositByWeight.d.ts +2 -2
- package/dist/generated/instructions/depositByWeight.d.ts.map +1 -1
- package/dist/generated/instructions/depositByWeight.js +2 -2
- package/dist/generated/instructions/index.d.ts +19 -19
- package/dist/generated/instructions/index.d.ts.map +1 -1
- package/dist/generated/instructions/index.js +19 -19
- package/dist/generated/instructions/openPosition.d.ts +1 -1
- package/dist/generated/instructions/openPosition.d.ts.map +1 -1
- package/dist/generated/instructions/openPosition.js +4 -4
- package/dist/generated/instructions/resetAdminAuthority.d.ts +1 -1
- package/dist/generated/instructions/resetAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/resetAdminAuthority.js +3 -3
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts +1 -1
- package/dist/generated/instructions/setMetadataUpdateAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/setMetadataUpdateAuthority.js +3 -3
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts +2 -2
- package/dist/generated/instructions/setPoolDynamicFeeConfig.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolDynamicFeeConfig.js +4 -4
- package/dist/generated/instructions/setPoolProtocolShare.d.ts +1 -1
- package/dist/generated/instructions/setPoolProtocolShare.d.ts.map +1 -1
- package/dist/generated/instructions/setPoolProtocolShare.js +3 -3
- package/dist/generated/instructions/swapExactIn.d.ts +2 -2
- package/dist/generated/instructions/swapExactIn.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactIn.js +2 -2
- package/dist/generated/instructions/swapExactOut.d.ts +2 -2
- package/dist/generated/instructions/swapExactOut.d.ts.map +1 -1
- package/dist/generated/instructions/swapExactOut.js +2 -2
- package/dist/generated/instructions/syncPool.d.ts +2 -2
- package/dist/generated/instructions/syncPool.d.ts.map +1 -1
- package/dist/generated/instructions/syncPool.js +2 -2
- package/dist/generated/instructions/transferAdminAuthority.d.ts +1 -1
- package/dist/generated/instructions/transferAdminAuthority.d.ts.map +1 -1
- package/dist/generated/instructions/transferAdminAuthority.js +3 -3
- package/dist/generated/instructions/withdraw.d.ts +2 -2
- package/dist/generated/instructions/withdraw.d.ts.map +1 -1
- package/dist/generated/instructions/withdraw.js +2 -2
- package/dist/generated/pdas/index.d.ts +4 -4
- package/dist/generated/pdas/index.d.ts.map +1 -1
- package/dist/generated/pdas/index.js +4 -4
- package/dist/generated/programs/index.d.ts +1 -1
- package/dist/generated/programs/index.d.ts.map +1 -1
- package/dist/generated/programs/index.js +1 -1
- package/dist/generated/programs/piconDlmm.d.ts +15 -3
- package/dist/generated/programs/piconDlmm.d.ts.map +1 -1
- package/dist/generated/programs/piconDlmm.js +38 -3
- package/dist/generated/types/accountGroup.d.ts +1 -1
- package/dist/generated/types/accountGroup.d.ts.map +1 -1
- package/dist/generated/types/accountGroup.js +1 -1
- package/dist/generated/types/dynamicFeeState.d.ts +1 -1
- package/dist/generated/types/dynamicFeeState.d.ts.map +1 -1
- package/dist/generated/types/dynamicFeeState.js +1 -1
- package/dist/generated/types/index.d.ts +8 -8
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +8 -8
- package/dist/generated/types/remainingAccountsScheme.d.ts +1 -1
- package/dist/generated/types/remainingAccountsScheme.d.ts.map +1 -1
- package/dist/generated/types/remainingAccountsScheme.js +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/program_addresses.d.ts +1 -1
- package/dist/program_addresses.d.ts.map +1 -1
- package/dist/program_addresses.js +1 -1
- package/dist/utils/assert.d.ts +1 -1
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils/bin_location.js +1 -1
- package/dist/utils/constants.d.ts +1 -9
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +1 -34
- package/dist/utils/price.js +3 -3
- package/dist/utils/transfer_fee.d.ts +1 -1
- package/dist/utils/transfer_fee.d.ts.map +1 -1
- package/dist/utils/transfer_hook.d.ts +1 -1
- package/dist/utils/transfer_hook.d.ts.map +1 -1
- package/dist/utils/transfer_hook.js +1 -1
- package/package.json +6 -6
- package/src/entities/admin_config.ts +3 -3
- package/src/entities/bin_array.ts +6 -6
- package/src/entities/dlmm_program.ts +7 -7
- package/src/entities/index.ts +6 -6
- package/src/entities/pool.ts +12 -12
- package/src/entities/position.ts +13 -13
- package/src/entities/position_pool.ts +2 -2
- package/src/events.ts +66 -199
- package/src/generated/accounts/binArray.ts +6 -1
- package/src/generated/accounts/index.ts +4 -4
- package/src/generated/accounts/pool.ts +1 -1
- package/src/generated/accounts/position.ts +1 -1
- package/src/generated/constants/index.ts +9 -0
- package/src/generated/constants/piconDlmm.ts +25 -0
- package/src/generated/errors/index.ts +1 -1
- package/src/generated/errors/piconDlmm.ts +1 -1
- package/src/generated/events/claimFeeEvent.ts +123 -0
- package/src/generated/events/closePositionEvent.ts +99 -0
- package/src/generated/events/createPoolEvent.ts +101 -0
- package/src/generated/events/depositEvent.ts +123 -0
- package/src/generated/events/index.ts +15 -0
- package/src/generated/events/openPositionEvent.ts +99 -0
- package/src/generated/events/swapEvent.ts +126 -0
- package/src/generated/events/withdrawEvent.ts +129 -0
- package/src/generated/index.ts +8 -6
- package/src/generated/instructions/acceptAdminAuthority.ts +3 -3
- package/src/generated/instructions/claimFee.ts +2 -2
- package/src/generated/instructions/claimProtocolFee.ts +4 -4
- package/src/generated/instructions/closePosition.ts +11 -8
- package/src/generated/instructions/createAdminConfig.ts +3 -3
- package/src/generated/instructions/createBinArray.ts +12 -9
- package/src/generated/instructions/createPool.ts +18 -15
- package/src/generated/instructions/deleteBinArray.ts +10 -7
- package/src/generated/instructions/depositByWeight.ts +2 -2
- package/src/generated/instructions/index.ts +19 -19
- package/src/generated/instructions/openPosition.ts +12 -9
- package/src/generated/instructions/resetAdminAuthority.ts +3 -3
- package/src/generated/instructions/setMetadataUpdateAuthority.ts +3 -3
- package/src/generated/instructions/setPoolDynamicFeeConfig.ts +4 -4
- package/src/generated/instructions/setPoolProtocolShare.ts +3 -3
- package/src/generated/instructions/swapExactIn.ts +2 -2
- package/src/generated/instructions/swapExactOut.ts +2 -2
- package/src/generated/instructions/syncPool.ts +2 -2
- package/src/generated/instructions/transferAdminAuthority.ts +3 -3
- package/src/generated/instructions/withdraw.ts +2 -2
- package/src/generated/pdas/index.ts +4 -4
- package/src/generated/programs/index.ts +1 -1
- package/src/generated/programs/piconDlmm.ts +99 -3
- package/src/generated/types/accountGroup.ts +1 -1
- package/src/generated/types/dynamicFeeState.ts +1 -1
- package/src/generated/types/index.ts +8 -8
- package/src/generated/types/remainingAccountsScheme.ts +1 -1
- package/src/index.ts +9 -9
- package/src/program_addresses.ts +1 -1
- package/src/utils/assert.ts +1 -1
- package/src/utils/bin_location.ts +1 -1
- package/src/utils/constants.ts +11 -39
- package/src/utils/price.ts +3 -3
- package/src/utils/transfer_fee.ts +1 -1
- package/src/utils/transfer_hook.ts +1 -1
- package/dist/picon_dlmm.json +0 -2639
package/README.md
CHANGED
|
@@ -15,14 +15,24 @@ npm install @picon-finance/dlmm-sdk
|
|
|
15
15
|
|
|
16
16
|
## Environments
|
|
17
17
|
|
|
18
|
-
The package targets ESM (`"type": "module"`),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
The package targets ESM (`"type": "module"`) and, as of `2.0.0`, every relative import in
|
|
19
|
+
`dist/` is fully specified (explicit `.js` extensions, generated via Codama's
|
|
20
|
+
`importExtension` render option) — the published output is standards-compliant ESM, not just
|
|
21
|
+
ESM by file extension:
|
|
22
|
+
|
|
23
|
+
- **Bare `node` (≥ `20.18.0`, matching `engines.node`), no Bun and no bundler required.**
|
|
24
|
+
Verified directly against a real `node_modules`-resolved import (`import { Pool } from
|
|
25
|
+
"@picon-finance/dlmm-sdk"`, not a same-directory shortcut), including the wasm-backed quote
|
|
26
|
+
engine specifically, since it resolves through a separate `imports` subpath (`#wasm`).
|
|
27
|
+
- **[Bun](https://bun.sh) for server-side scripts, tests, tooling** — unaffected by this change,
|
|
28
|
+
continues to work as it always did.
|
|
29
|
+
- **Client-side / anything bundler-fronted (webpack, Vite, Rollup, ...): works as-is.** Earlier
|
|
30
|
+
versions required `resolve.fullySpecified: false` on `.m?js$` for webpack specifically, to
|
|
31
|
+
tolerate the extension-less imports `dist/` used to ship — no longer needed against `2.0.0`,
|
|
32
|
+
since there's nothing left for that flag to relax.
|
|
33
|
+
|
|
34
|
+
Before `2.0.0`, bare `node` (no Bun, no bundler) wasn't supported — relative imports lacked
|
|
35
|
+
extensions, which Node's ESM resolver requires.
|
|
26
36
|
|
|
27
37
|
## Usage
|
|
28
38
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSolanaRpc, type Address, type Account, type Instruction, type TransactionSigner, type FetchAccountConfig } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { type ProgramConfig } from "./types";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { type ProgramConfig } from "./types.js";
|
|
4
4
|
export declare function resolveAdminConfigAddress(programAddress: Address): Promise<Address>;
|
|
5
5
|
export declare function createAdminConfig({ deployer }: {
|
|
6
6
|
deployer: TransactionSigner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admin_config.d.ts","sourceRoot":"","sources":["../../src/entities/admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"admin_config.d.ts","sourceRoot":"","sources":["../../src/entities/admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAGf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAYhD,wBAAsB,yBAAyB,CAAC,cAAc,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAGzF;AAED,wBAAsB,iBAAiB,CACrC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE,EAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAWtB;AAED,wBAAsB,mBAAmB,CACvC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,iBAAiB,CAAA;CAAE,EAC7C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAWtB;AAED,wBAAsB,sBAAsB,CAC1C,EACE,SAAS,EACT,YAAY,GACb,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;CACvB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,wBAAsB,oBAAoB,CACxC,EAAE,gBAAgB,EAAE,EAAE;IAAE,gBAAgB,EAAE,iBAAiB,CAAA;CAAE,EAC7D,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,wBAAsB,0BAA0B,CAC9C,EACE,SAAS,EACT,uBAAuB,GACxB,EAAE;IACD,SAAS,EAAE,iBAAiB,CAAC;IAC7B,uBAAuB,EAAE,OAAO,CAAC;CAClC,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAMtB;AAED,wBAAsB,cAAc,CAClC,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,MAAM,EAAE,aAAa,GAAG,kBAAkB,GACzC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAGzC;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,MAAM,EAAE,aAAa,GAAG,kBAAkB,GACzC,OAAO,CAAC,OAAO,CAAC,CAIlB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAddressEncoder, getProgramDerivedAddress, } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { findAdminConfigPda } from "../generated";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { findAdminConfigPda } from "../generated/index.js";
|
|
4
4
|
const LOADER_V3_PROGRAM_ADDRESS = "BPFLoaderUpgradeab1e11111111111111111111111";
|
|
5
5
|
async function findProgramDataAddress(programAddress) {
|
|
6
6
|
const [programData] = await getProgramDerivedAddress({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSolanaRpc, type Address, type Account, type Instruction, type TransactionSigner, type FetchAccountConfig, type FetchAccountsConfig, type MaybeEncodedAccount } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { type ProgramConfig } from "./types";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { type ProgramConfig } from "./types.js";
|
|
4
4
|
export declare class BinArray {
|
|
5
5
|
#private;
|
|
6
6
|
private constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin_array.d.ts","sourceRoot":"","sources":["../../src/entities/bin_array.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"bin_array.d.ts","sourceRoot":"","sources":["../../src/entities/bin_array.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAKxC,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,qBAAa,QAAQ;;IAKnB,OAAO,eAQN;IAED,IAAW,OAAO,oBAAoC;IACtD,IAAW,IAAI,uBAAiC;IAChD,IAAW,IAAI,oBAA6B;IAE/B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,OAAO,CAAC,MAAM,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAQjE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aAAa,GACpB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAsB,wBAAwB,CAC5C,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,EACvD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC,CAIpB;AAED,wBAAsB,wBAAwB,CAC5C,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,SAAS,EAAE,OAAO,EAAE,EACpB,MAAM,CAAC,EAAE,mBAAmB,0CAO7B;AAED,wBAAsB,6BAA6B,CACjD,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,SAAS,EAAE,OAAO,EAAE,EACpB,MAAM,CAAC,EAAE,mBAAmB,0EAO7B;AAID,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,mBAAmB,CAAC,MAAM,CAAC,EAAE,GAC3C,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CAG/B"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { decodeAccount, assertAccountsExist, } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { isAccount } from "../utils/type_guards";
|
|
4
|
-
import { fetchInChunks } from "../utils/chunk";
|
|
5
|
-
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants";
|
|
6
|
-
import { resolveAdminConfigAddress } from "./admin_config";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { isAccount } from "../utils/type_guards.js";
|
|
4
|
+
import { fetchInChunks } from "../utils/chunk.js";
|
|
5
|
+
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants.js";
|
|
6
|
+
import { resolveAdminConfigAddress } from "./admin_config.js";
|
|
7
7
|
export class BinArray {
|
|
8
8
|
#rpc;
|
|
9
9
|
#account;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSolanaRpc, type Address, type Account, type Instruction, type TransactionSigner, type FetchAccountConfig, type FetchAccountsConfig } from "@solana/kit";
|
|
2
|
-
import type { QuoteExactInOutput, QuoteExactOutOutput } from "../quote";
|
|
3
|
-
import { Pool } from "./pool";
|
|
4
|
-
import { generated } from "
|
|
2
|
+
import type { QuoteExactInOutput, QuoteExactOutOutput } from "../quote/index.js";
|
|
3
|
+
import { Pool } from "./pool.js";
|
|
4
|
+
import { generated } from "../index.js";
|
|
5
5
|
export declare class DlmmProgram {
|
|
6
6
|
#private;
|
|
7
7
|
constructor(rpc: ReturnType<typeof createSolanaRpc>, programAddress?: Address);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dlmm_program.d.ts","sourceRoot":"","sources":["../../src/entities/dlmm_program.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"dlmm_program.d.ts","sourceRoot":"","sources":["../../src/entities/dlmm_program.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EAGzB,MAAM,aAAa,CAAC;AAOrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EACL,IAAI,EAEL,MAAM,WAAW,CAAC;AAYnB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,qBAAa,WAAW;;IAItB,YACE,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,E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
|
import { parseBase64RpcAccount, } from "@solana/kit";
|
|
2
2
|
import { getTokenDecoder, TOKEN_2022_PROGRAM_ADDRESS, } from "@solana-program/token-2022";
|
|
3
|
-
import { MAINNET_PROGRAM_ADDRESS } from "../program_addresses";
|
|
4
|
-
import { Pool, createPool, } from "./pool";
|
|
5
|
-
import { findAllPositionAddresses } from "./position";
|
|
6
|
-
import { fetchAllMaybePositionPoolsChunked } from "./position_pool";
|
|
7
|
-
import { getAdminConfig, createAdminConfig, resetAdminAuthority, isAdminConfigActive, acceptAdminAuthority, transferAdminAuthority, setMetadataUpdateAuthority, } from "./admin_config";
|
|
3
|
+
import { MAINNET_PROGRAM_ADDRESS } from "../program_addresses.js";
|
|
4
|
+
import { Pool, createPool, } from "./pool.js";
|
|
5
|
+
import { findAllPositionAddresses } from "./position.js";
|
|
6
|
+
import { fetchAllMaybePositionPoolsChunked } from "./position_pool.js";
|
|
7
|
+
import { getAdminConfig, createAdminConfig, resetAdminAuthority, isAdminConfigActive, acceptAdminAuthority, transferAdminAuthority, setMetadataUpdateAuthority, } from "./admin_config.js";
|
|
8
8
|
export class DlmmProgram {
|
|
9
9
|
#rpc;
|
|
10
10
|
#programAddress;
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./admin_config";
|
|
2
|
-
export * from "./bin_array";
|
|
3
|
-
export * from "./dlmm_program";
|
|
4
|
-
export * from "./pool";
|
|
5
|
-
export * from "./position";
|
|
6
|
-
export * from "./types";
|
|
1
|
+
export * from "./admin_config.js";
|
|
2
|
+
export * from "./bin_array.js";
|
|
3
|
+
export * from "./dlmm_program.js";
|
|
4
|
+
export * from "./pool.js";
|
|
5
|
+
export * from "./position.js";
|
|
6
|
+
export * from "./types.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entities/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
package/dist/entities/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./admin_config";
|
|
2
|
-
export * from "./bin_array";
|
|
3
|
-
export * from "./dlmm_program";
|
|
4
|
-
export * from "./pool";
|
|
5
|
-
export * from "./position";
|
|
6
|
-
export * from "./types";
|
|
1
|
+
export * from "./admin_config.js";
|
|
2
|
+
export * from "./bin_array.js";
|
|
3
|
+
export * from "./dlmm_program.js";
|
|
4
|
+
export * from "./pool.js";
|
|
5
|
+
export * from "./position.js";
|
|
6
|
+
export * from "./types.js";
|
package/dist/entities/pool.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createSolanaRpc, type Address, type Account, type Instruction, type TransactionSigner, type FetchAccountConfig, type FetchAccountsConfig } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { type FeeRates, type QuoteExactInOutput, type QuoteExactOutOutput, type TransferFee } from "../quote";
|
|
4
|
-
import { type ExtraAccount, type TransferAccounts as TransferHookAccounts } from "../utils/transfer_hook";
|
|
5
|
-
import { Position } from "./position";
|
|
6
|
-
import { BinArray } from "./bin_array";
|
|
7
|
-
import { type ProgramConfig } from "./types";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { type FeeRates, type QuoteExactInOutput, type QuoteExactOutOutput, type TransferFee } from "../quote/index.js";
|
|
4
|
+
import { type ExtraAccount, type TransferAccounts as TransferHookAccounts } from "../utils/transfer_hook.js";
|
|
5
|
+
import { Position } from "./position.js";
|
|
6
|
+
import { BinArray } from "./bin_array.js";
|
|
7
|
+
import { type ProgramConfig } from "./types.js";
|
|
8
8
|
export declare class Pool {
|
|
9
9
|
#private;
|
|
10
10
|
private constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/entities/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../src/entities/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACzB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAC;AAW3B,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,gBAAgB,IAAI,oBAAoB,EAC9C,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,QAAQ,EAKT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAA4B,MAAM,gBAAgB,CAAC;AACpE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,qBAAa,IAAI;;IAQf,OAAO,eAYN;IAED,IAAW,GAAG,u2oBAAwB;IAEtC,IAAW,cAAc,YAAmC;IAC5D,IAAW,OAAO,oBAAoC;IACtD,IAAW,IAAI,mBAAiC;IAChD,IAAW,WAAW,WAAoC;IAE1D,IAAW,UAAU,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EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;CACxB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAkBtB"}
|
package/dist/entities/pool.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { AccountRole, } from "@solana/kit";
|
|
2
2
|
import { fetchAllMint, } from "@solana-program/token-2022";
|
|
3
|
-
import { generated } from "
|
|
4
|
-
import { quoteExactIn, quoteExactOut, getPoolFeeRates, } from "../quote";
|
|
5
|
-
import { isAccount } from "../utils/type_guards";
|
|
6
|
-
import { resolveAdminConfigAddress } from "./admin_config";
|
|
7
|
-
import { processAssociatedTokenAccountPair } from "../utils/ata";
|
|
8
|
-
import { getBinArrayIndex, getBinArrayIndexSequence, generateBinArrayIndicesForSwap, generateBinArrayIndicesForSync, } from "../utils/bin_location";
|
|
9
|
-
import { resolveTransferFee } from "../utils/transfer_fee";
|
|
10
|
-
import { appendRemainingAccounts, buildTransferHookScheme, resolveTransferHookProgram, resolveTransferHookExtraAccounts, } from "../utils/transfer_hook";
|
|
11
|
-
import { MAX_BIN_ARRAYS_PER_TRAVERSAL } from "../utils/constants";
|
|
12
|
-
import { Position, openPosition, closePosition, findPositionAddress, findAllPositionAddresses, } from "./position";
|
|
13
|
-
import { BinArray, findAllBinArrayAddresses } from "./bin_array";
|
|
3
|
+
import { generated } from "../index.js";
|
|
4
|
+
import { quoteExactIn, quoteExactOut, getPoolFeeRates, } from "../quote/index.js";
|
|
5
|
+
import { isAccount } from "../utils/type_guards.js";
|
|
6
|
+
import { resolveAdminConfigAddress } from "./admin_config.js";
|
|
7
|
+
import { processAssociatedTokenAccountPair } from "../utils/ata.js";
|
|
8
|
+
import { getBinArrayIndex, getBinArrayIndexSequence, generateBinArrayIndicesForSwap, generateBinArrayIndicesForSync, } from "../utils/bin_location.js";
|
|
9
|
+
import { resolveTransferFee } from "../utils/transfer_fee.js";
|
|
10
|
+
import { appendRemainingAccounts, buildTransferHookScheme, resolveTransferHookProgram, resolveTransferHookExtraAccounts, } from "../utils/transfer_hook.js";
|
|
11
|
+
import { MAX_BIN_ARRAYS_PER_TRAVERSAL } from "../utils/constants.js";
|
|
12
|
+
import { Position, openPosition, closePosition, findPositionAddress, findAllPositionAddresses, } from "./position.js";
|
|
13
|
+
import { BinArray, findAllBinArrayAddresses } from "./bin_array.js";
|
|
14
14
|
export class Pool {
|
|
15
15
|
#programAddress;
|
|
16
16
|
#rpc;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createSolanaRpc, type Address, type Account, type Instruction, type TransactionSigner, type FetchAccountsConfig } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { type BinIdRange } from "../utils/bin_location";
|
|
4
|
-
import { Pool } from "./pool";
|
|
5
|
-
import { BinArray } from "./bin_array";
|
|
6
|
-
import { type PositionInfo, type ProgramConfig, type PositionBinInfo } from "./types";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { type BinIdRange } from "../utils/bin_location.js";
|
|
4
|
+
import { Pool } from "./pool.js";
|
|
5
|
+
import { BinArray } from "./bin_array.js";
|
|
6
|
+
import { type PositionInfo, type ProgramConfig, type PositionBinInfo } from "./types.js";
|
|
7
7
|
export declare class Position {
|
|
8
8
|
#private;
|
|
9
9
|
private constructor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/entities/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAGf,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAEzB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../src/entities/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAGf,KAAK,OAAO,EACZ,KAAK,O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C1B;CACF;AAED,wBAAsB,mBAAmB,CACvC,KAAK,EAAE;IAAE,YAAY,EAAE,OAAO,CAAA;CAAE,EAChC,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,CAAC,CAGlB;AAED,wBAAsB,wBAAwB,CAC5C,EAAE,aAAa,EAAE,EAAE;IAAE,aAAa,EAAE,OAAO,EAAE,CAAA;CAAE,EAC/C,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,OAAO,EAAE,CAAC,CAIpB;AAED,wBAAsB,YAAY,CAChC,GAAG,EAAE,UAAU,CAAC,OAAO,eAAe,CAAC,EACvC,EACE,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,UAAU,GACX,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,iBAAiB,CAAC;IAChC,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,EAAE,CAAC,CAyBxB;AAED,wBAAsB,aAAa,CACjC,EACE,KAAK,EACL,YAAY,EACZ,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,iBAAiB,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,EACD,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,WAAW,CAAC,CAWtB"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { decodeAccount, assertAccountExists, fetchEncodedAccounts, } from "@solana/kit";
|
|
2
|
-
import { generated } from "
|
|
3
|
-
import { getAmountAfterTransferFee } from "../quote";
|
|
4
|
-
import { findPositionTokenAccount, processAssociatedTokenAccountPair, } from "../utils/ata";
|
|
5
|
-
import { appendRemainingAccounts, buildTransferHookScheme, } from "../utils/transfer_hook";
|
|
6
|
-
import { getBinIndex, getBinArrayIndex, getPositionBinArrayIndices, } from "../utils/bin_location";
|
|
7
|
-
import { assertRangeWithinRange, assertPositionBelongsToPool, } from "../utils/assert";
|
|
8
|
-
import { isUndefined } from "../utils/type_guards";
|
|
9
|
-
import { chunk, fetchInChunks, } from "../utils/chunk";
|
|
10
|
-
import { resolveAdminConfigAddress } from "./admin_config";
|
|
11
|
-
import { DEFAULT_POSITIONS_PER_CLAIM, MAX_ACCOUNTS_PER_RPC_BATCH, } from "../utils/constants";
|
|
12
|
-
import { BinArray, decodeAllBinArrays, createAllBinArrays, fetchAllBinArraysChunked, } from "./bin_array";
|
|
2
|
+
import { generated } from "../index.js";
|
|
3
|
+
import { getAmountAfterTransferFee } from "../quote/index.js";
|
|
4
|
+
import { findPositionTokenAccount, processAssociatedTokenAccountPair, } from "../utils/ata.js";
|
|
5
|
+
import { appendRemainingAccounts, buildTransferHookScheme, } from "../utils/transfer_hook.js";
|
|
6
|
+
import { getBinIndex, getBinArrayIndex, getPositionBinArrayIndices, } from "../utils/bin_location.js";
|
|
7
|
+
import { assertRangeWithinRange, assertPositionBelongsToPool, } from "../utils/assert.js";
|
|
8
|
+
import { isUndefined } from "../utils/type_guards.js";
|
|
9
|
+
import { chunk, fetchInChunks, } from "../utils/chunk.js";
|
|
10
|
+
import { resolveAdminConfigAddress } from "./admin_config.js";
|
|
11
|
+
import { DEFAULT_POSITIONS_PER_CLAIM, MAX_ACCOUNTS_PER_RPC_BATCH, } from "../utils/constants.js";
|
|
12
|
+
import { BinArray, decodeAllBinArrays, createAllBinArrays, fetchAllBinArraysChunked, } from "./bin_array.js";
|
|
13
13
|
export class Position {
|
|
14
14
|
#pool;
|
|
15
15
|
#account;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAddressDecoder, parseBase64RpcAccount, } from "@solana/kit";
|
|
2
|
-
import { fetchInChunks } from "../utils/chunk";
|
|
3
|
-
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants";
|
|
2
|
+
import { fetchInChunks } from "../utils/chunk.js";
|
|
3
|
+
import { MAX_ACCOUNTS_PER_RPC_BATCH } from "../utils/constants.js";
|
|
4
4
|
export async function fetchAllMaybePositionPoolsChunked(rpc, addresses, config) {
|
|
5
5
|
return await fetchInChunks(addresses, MAX_ACCOUNTS_PER_RPC_BATCH, chunkAddresses => fetchAllMaybePositionPools(rpc, chunkAddresses, config));
|
|
6
6
|
}
|
package/dist/events.d.ts
CHANGED
|
@@ -1,71 +1,12 @@
|
|
|
1
1
|
import { type Address, type Commitment, type createSolanaRpcSubscriptions } from "@solana/kit";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export type
|
|
10
|
-
pool: Address;
|
|
11
|
-
position: Address;
|
|
12
|
-
owner: Address;
|
|
13
|
-
lowerBinId: number;
|
|
14
|
-
upperBinId: number;
|
|
15
|
-
};
|
|
16
|
-
export type ClosePositionEvent = {
|
|
17
|
-
pool: Address;
|
|
18
|
-
position: Address;
|
|
19
|
-
owner: Address;
|
|
20
|
-
lowerBinId: number;
|
|
21
|
-
upperBinId: number;
|
|
22
|
-
};
|
|
23
|
-
export type DepositEvent = {
|
|
24
|
-
pool: Address;
|
|
25
|
-
position: Address;
|
|
26
|
-
owner: Address;
|
|
27
|
-
lowerBinId: number;
|
|
28
|
-
upperBinId: number;
|
|
29
|
-
amountX: bigint;
|
|
30
|
-
amountY: bigint;
|
|
31
|
-
transferFeeX: bigint;
|
|
32
|
-
transferFeeY: bigint;
|
|
33
|
-
};
|
|
34
|
-
export type WithdrawEvent = {
|
|
35
|
-
pool: Address;
|
|
36
|
-
position: Address;
|
|
37
|
-
owner: Address;
|
|
38
|
-
lowerBinId: number;
|
|
39
|
-
upperBinId: number;
|
|
40
|
-
bpsRemoved: number;
|
|
41
|
-
amountX: bigint;
|
|
42
|
-
amountY: bigint;
|
|
43
|
-
transferFeeX: bigint;
|
|
44
|
-
transferFeeY: bigint;
|
|
45
|
-
};
|
|
46
|
-
export type ClaimFeeEvent = {
|
|
47
|
-
pool: Address;
|
|
48
|
-
position: Address;
|
|
49
|
-
owner: Address;
|
|
50
|
-
lowerBinId: number;
|
|
51
|
-
upperBinId: number;
|
|
52
|
-
amountX: bigint;
|
|
53
|
-
amountY: bigint;
|
|
54
|
-
transferFeeX: bigint;
|
|
55
|
-
transferFeeY: bigint;
|
|
56
|
-
};
|
|
57
|
-
export type SwapEvent = {
|
|
58
|
-
pool: Address;
|
|
59
|
-
xToY: boolean;
|
|
60
|
-
preBinId: number;
|
|
61
|
-
postBinId: number;
|
|
62
|
-
amountIn: bigint;
|
|
63
|
-
amountOut: bigint;
|
|
64
|
-
inputTransferFee: bigint;
|
|
65
|
-
outputTransferFee: bigint;
|
|
66
|
-
lpFee: bigint;
|
|
67
|
-
protocolFee: bigint;
|
|
68
|
-
};
|
|
2
|
+
import { type ClaimFeeEventEvent, type ClosePositionEventEvent, type CreatePoolEventEvent, type DepositEventEvent, type OpenPositionEventEvent, type SwapEventEvent, type WithdrawEventEvent } from "./generated/events/index.js";
|
|
3
|
+
export type CreatePoolEvent = CreatePoolEventEvent;
|
|
4
|
+
export type OpenPositionEvent = OpenPositionEventEvent;
|
|
5
|
+
export type ClosePositionEvent = ClosePositionEventEvent;
|
|
6
|
+
export type DepositEvent = DepositEventEvent;
|
|
7
|
+
export type WithdrawEvent = WithdrawEventEvent;
|
|
8
|
+
export type ClaimFeeEvent = ClaimFeeEventEvent;
|
|
9
|
+
export type SwapEvent = SwapEventEvent;
|
|
69
10
|
export type DlmmEvent = {
|
|
70
11
|
name: "CreatePoolEvent";
|
|
71
12
|
data: CreatePoolEvent;
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAYA,OAAO,EACL,KAAK,O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,EAAE,SAAS,MAAM,EAAE,EAAE,cAAc,GAAE,OAAoC,GAAG,SAAS,EAAE,CAwB/H;AAED,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,4BAA4B,CAAC,CAAC;AASxE,wBAAsB,OAAO,CAC3B,gBAAgB,EAAE,gBAAgB,EAClC,OAAO,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,EACnC,EACE,OAAO,EACP,cAA2C,EAC3C,UAAU,EACV,OAAO,GACR,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,UAAU,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CAAO,GACnH,OAAO,CAAC,MAAM,IAAI,CAAC,CA0BrB"}
|
package/dist/events.js
CHANGED
|
@@ -1,122 +1,48 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return getStructDecoder([
|
|
20
|
-
["pool", getAddressDecoder()],
|
|
21
|
-
["position", getAddressDecoder()],
|
|
22
|
-
["owner", getAddressDecoder()],
|
|
23
|
-
["lowerBinId", getI32Decoder()],
|
|
24
|
-
["upperBinId", getI32Decoder()],
|
|
25
|
-
]);
|
|
26
|
-
}
|
|
27
|
-
function getClosePositionEventDecoder() {
|
|
28
|
-
return getStructDecoder([
|
|
29
|
-
["pool", getAddressDecoder()],
|
|
30
|
-
["position", getAddressDecoder()],
|
|
31
|
-
["owner", getAddressDecoder()],
|
|
32
|
-
["lowerBinId", getI32Decoder()],
|
|
33
|
-
["upperBinId", getI32Decoder()],
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
function getDepositEventDecoder() {
|
|
37
|
-
return getStructDecoder([
|
|
38
|
-
["pool", getAddressDecoder()],
|
|
39
|
-
["position", getAddressDecoder()],
|
|
40
|
-
["owner", getAddressDecoder()],
|
|
41
|
-
["lowerBinId", getI32Decoder()],
|
|
42
|
-
["upperBinId", getI32Decoder()],
|
|
43
|
-
["amountX", getU64Decoder()],
|
|
44
|
-
["amountY", getU64Decoder()],
|
|
45
|
-
["transferFeeX", getU64Decoder()],
|
|
46
|
-
["transferFeeY", getU64Decoder()],
|
|
47
|
-
]);
|
|
48
|
-
}
|
|
49
|
-
function getWithdrawEventDecoder() {
|
|
50
|
-
return getStructDecoder([
|
|
51
|
-
["pool", getAddressDecoder()],
|
|
52
|
-
["position", getAddressDecoder()],
|
|
53
|
-
["owner", getAddressDecoder()],
|
|
54
|
-
["lowerBinId", getI32Decoder()],
|
|
55
|
-
["upperBinId", getI32Decoder()],
|
|
56
|
-
["bpsRemoved", getU16Decoder()],
|
|
57
|
-
["amountX", getU64Decoder()],
|
|
58
|
-
["amountY", getU64Decoder()],
|
|
59
|
-
["transferFeeX", getU64Decoder()],
|
|
60
|
-
["transferFeeY", getU64Decoder()],
|
|
61
|
-
]);
|
|
62
|
-
}
|
|
63
|
-
function getClaimFeeEventDecoder() {
|
|
64
|
-
return getStructDecoder([
|
|
65
|
-
["pool", getAddressDecoder()],
|
|
66
|
-
["position", getAddressDecoder()],
|
|
67
|
-
["owner", getAddressDecoder()],
|
|
68
|
-
["lowerBinId", getI32Decoder()],
|
|
69
|
-
["upperBinId", getI32Decoder()],
|
|
70
|
-
["amountX", getU64Decoder()],
|
|
71
|
-
["amountY", getU64Decoder()],
|
|
72
|
-
["transferFeeX", getU64Decoder()],
|
|
73
|
-
["transferFeeY", getU64Decoder()],
|
|
74
|
-
]);
|
|
75
|
-
}
|
|
76
|
-
function getSwapEventDecoder() {
|
|
77
|
-
return getStructDecoder([
|
|
78
|
-
["pool", getAddressDecoder()],
|
|
79
|
-
["xToY", getBooleanDecoder()],
|
|
80
|
-
["preBinId", getI32Decoder()],
|
|
81
|
-
["postBinId", getI32Decoder()],
|
|
82
|
-
["amountIn", getU64Decoder()],
|
|
83
|
-
["amountOut", getU64Decoder()],
|
|
84
|
-
["inputTransferFee", getU64Decoder()],
|
|
85
|
-
["outputTransferFee", getU64Decoder()],
|
|
86
|
-
["lpFee", getU64Decoder()],
|
|
87
|
-
["protocolFee", getU64Decoder()],
|
|
88
|
-
]);
|
|
89
|
-
}
|
|
90
|
-
// Discriminators are the first 8 bytes of sha256("event:<EventName>") — copied from the IDL's
|
|
91
|
-
// `events` array (`ts-sdk/src/picon_dlmm.json`), same derivation Anchor uses for accounts.
|
|
92
|
-
const DISCRIMINATORS = {
|
|
93
|
-
CreatePoolEvent: [177, 49, 12, 210, 160, 118, 167, 116],
|
|
94
|
-
OpenPositionEvent: [83, 43, 164, 147, 169, 87, 81, 172],
|
|
95
|
-
ClosePositionEvent: [198, 217, 115, 95, 191, 120, 142, 137],
|
|
96
|
-
DepositEvent: [120, 248, 61, 83, 31, 142, 107, 144],
|
|
97
|
-
WithdrawEvent: [22, 9, 133, 26, 160, 44, 71, 192],
|
|
98
|
-
ClaimFeeEvent: [173, 80, 235, 15, 116, 19, 144, 33],
|
|
99
|
-
SwapEvent: [64, 198, 205, 232, 38, 8, 113, 226],
|
|
100
|
-
};
|
|
1
|
+
// Event shapes/codecs/discriminators are generated (src/generated/events/*, via Codama's
|
|
2
|
+
// event-rendering support added in @codama/renderers-js 2.4.0 + @codama/nodes-from-anchor's
|
|
3
|
+
// eventNodeFromAnchorV01). What stays hand-written here — and always will — is the log-parsing
|
|
4
|
+
// and subscription layer: none of it is IDL-derivable. The IDL says nothing about Anchor's
|
|
5
|
+
// `emit!` writing events as `Program data: <base64>` log lines, about how to scope those lines
|
|
6
|
+
// to this program specifically when a transaction's logs interleave multiple programs' output
|
|
7
|
+
// via CPI, or about how to actually subscribe to get logs over the wire in the first place —
|
|
8
|
+
// those are runtime/RPC-client facts, not data-shape facts, and no IDL revision could add them.
|
|
9
|
+
//
|
|
10
|
+
// Re-exported here under the IDL's own single-"Event" names (SwapEvent, not the generated
|
|
11
|
+
// module's SwapEventEvent — Codama appends its own "Event" suffix on top of names that already
|
|
12
|
+
// end in one) so nothing downstream needs to change on this migration.
|
|
13
|
+
import { getBase64Encoder, } from "@solana/kit";
|
|
14
|
+
import { PICON_DLMM_PROGRAM_ADDRESS } from "./generated/index.js";
|
|
15
|
+
import { getClaimFeeEventEventDecoder, getClosePositionEventEventDecoder, getCreatePoolEventEventDecoder, getDepositEventEventDecoder, getOpenPositionEventEventDecoder, getSwapEventEventDecoder, getWithdrawEventEventDecoder, CLAIM_FEE_EVENT_EVENT_DISCRIMINATOR, CLOSE_POSITION_EVENT_EVENT_DISCRIMINATOR, CREATE_POOL_EVENT_EVENT_DISCRIMINATOR, DEPOSIT_EVENT_EVENT_DISCRIMINATOR, OPEN_POSITION_EVENT_EVENT_DISCRIMINATOR, SWAP_EVENT_EVENT_DISCRIMINATOR, WITHDRAW_EVENT_EVENT_DISCRIMINATOR, } from "./generated/events/index.js";
|
|
16
|
+
// Each generated decoder is a getHiddenPrefixDecoder wrapping its struct decoder — it expects
|
|
17
|
+
// the discriminator bytes still present at the front and verifies+strips them itself, so
|
|
18
|
+
// decodeEventBytes below feeds it the full byte range, not a pre-sliced body.
|
|
101
19
|
const DECODERS = {
|
|
102
|
-
CreatePoolEvent:
|
|
103
|
-
OpenPositionEvent:
|
|
104
|
-
ClosePositionEvent:
|
|
105
|
-
DepositEvent:
|
|
106
|
-
WithdrawEvent:
|
|
107
|
-
ClaimFeeEvent:
|
|
108
|
-
SwapEvent:
|
|
20
|
+
CreatePoolEvent: getCreatePoolEventEventDecoder(),
|
|
21
|
+
OpenPositionEvent: getOpenPositionEventEventDecoder(),
|
|
22
|
+
ClosePositionEvent: getClosePositionEventEventDecoder(),
|
|
23
|
+
DepositEvent: getDepositEventEventDecoder(),
|
|
24
|
+
WithdrawEvent: getWithdrawEventEventDecoder(),
|
|
25
|
+
ClaimFeeEvent: getClaimFeeEventEventDecoder(),
|
|
26
|
+
SwapEvent: getSwapEventEventDecoder(),
|
|
27
|
+
};
|
|
28
|
+
const DISCRIMINATORS = {
|
|
29
|
+
CreatePoolEvent: CREATE_POOL_EVENT_EVENT_DISCRIMINATOR,
|
|
30
|
+
OpenPositionEvent: OPEN_POSITION_EVENT_EVENT_DISCRIMINATOR,
|
|
31
|
+
ClosePositionEvent: CLOSE_POSITION_EVENT_EVENT_DISCRIMINATOR,
|
|
32
|
+
DepositEvent: DEPOSIT_EVENT_EVENT_DISCRIMINATOR,
|
|
33
|
+
WithdrawEvent: WITHDRAW_EVENT_EVENT_DISCRIMINATOR,
|
|
34
|
+
ClaimFeeEvent: CLAIM_FEE_EVENT_EVENT_DISCRIMINATOR,
|
|
35
|
+
SwapEvent: SWAP_EVENT_EVENT_DISCRIMINATOR,
|
|
109
36
|
};
|
|
110
37
|
const PROGRAM_DATA_PREFIX = "Program data: ";
|
|
111
38
|
// `emit!` (not `emit_cpi!`) writes each event as a `Program data: <base64>` log line — the
|
|
112
39
|
// base64 payload is [8-byte discriminator][borsh-encoded fields], same layout as an account.
|
|
113
40
|
function decodeEventBytes(bytes) {
|
|
114
41
|
const discriminator = bytes.subarray(0, 8);
|
|
115
|
-
const body = bytes.subarray(8);
|
|
116
42
|
for (const name of Object.keys(DISCRIMINATORS)) {
|
|
117
43
|
const expected = DISCRIMINATORS[name];
|
|
118
44
|
if (expected.every((byte, i) => byte === discriminator[i])) {
|
|
119
|
-
return { name, data: DECODERS[name].decode(
|
|
45
|
+
return { name, data: DECODERS[name].decode(bytes) };
|
|
120
46
|
}
|
|
121
47
|
}
|
|
122
48
|
return undefined;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @see https://github.com/codama-idl/codama
|
|
7
7
|
*/
|
|
8
8
|
import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type EncodedAccount, type FetchAccountConfig, type FetchAccountsConfig, type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
|
|
9
|
-
import { type Bin, type BinArgs } from "../types";
|
|
9
|
+
import { type Bin, type BinArgs } from "../types/index.js";
|
|
10
10
|
export declare const BIN_ARRAY_DISCRIMINATOR: ReadonlyUint8Array;
|
|
11
11
|
export declare function getBinArrayDiscriminatorBytes(): ReadonlyUint8Array;
|
|
12
12
|
export type BinArray = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binArray.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/binArray.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAcpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"binArray.d.ts","sourceRoot":"","sources":["../../../src/generated/accounts/binArray.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAKL,mBAAmB,EACnB,oBAAoB,EAcpB,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,GAAG,EACR,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAC;AA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