@exponent-labs/exponent-clmm-pda 0.1.8

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 ADDED
@@ -0,0 +1,4 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
@@ -0,0 +1 @@
1
+ export { ExponentCLMMPDA as ExponentCLMMPDA } from "./pda";
package/build/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExponentCLMMPDA = void 0;
4
+ var pda_1 = require("./pda");
5
+ Object.defineProperty(exports, "ExponentCLMMPDA", { enumerable: true, get: function () { return pda_1.ExponentCLMMPDA; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAA0D;AAAjD,sGAAA,eAAe,OAAmB"}
package/build/pda.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ import { web3 } from "@coral-xyz/anchor";
2
+ export declare class ExponentCLMMPDA {
3
+ programId: web3.PublicKey;
4
+ constructor(programId?: web3.PublicKey);
5
+ private findProgramAddressSync;
6
+ /** Identifier for the market is derived from the vault that uniquely has a PT token */
7
+ market({ vault, seedId }: {
8
+ vault: web3.PublicKey;
9
+ seedId: number;
10
+ }): web3.PublicKey;
11
+ /** Escrow account for holding PT liquidity for a market */
12
+ marketEscrowPt({ market }: {
13
+ market: web3.PublicKey;
14
+ }): web3.PublicKey;
15
+ /** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
16
+ marketEscrowSy({ market }: {
17
+ market: web3.PublicKey;
18
+ }): web3.PublicKey;
19
+ /** Market-owned escrow account for YT tokens. Used as an interchange between the YT core program and the end-user */
20
+ marketEscrowYt({ market }: {
21
+ market: web3.PublicKey;
22
+ }): web3.PublicKey;
23
+ /** Personal LP position */
24
+ marketLpPosition({ market, owner }: {
25
+ market: web3.PublicKey;
26
+ owner: web3.PublicKey;
27
+ }): web3.PublicKey;
28
+ }
package/build/pda.js ADDED
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ExponentCLMMPDA = void 0;
4
+ const anchor_1 = require("@coral-xyz/anchor");
5
+ const exponent_clmm_idl_1 = require("@exponent-labs/exponent-clmm-idl");
6
+ class ExponentCLMMPDA {
7
+ programId;
8
+ constructor(programId = new anchor_1.web3.PublicKey(exponent_clmm_idl_1.PROGRAM_ID)) {
9
+ this.programId = programId;
10
+ }
11
+ findProgramAddressSync(seeds) {
12
+ return anchor_1.web3.PublicKey.findProgramAddressSync(seeds, this.programId)[0];
13
+ }
14
+ /** Identifier for the market is derived from the vault that uniquely has a PT token */
15
+ market({ vault, seedId }) {
16
+ return this.findProgramAddressSync([Buffer.from("market_three"), vault.toBuffer(), Buffer.from([seedId])]);
17
+ }
18
+ /** Escrow account for holding PT liquidity for a market */
19
+ marketEscrowPt({ market }) {
20
+ return this.findProgramAddressSync([Buffer.from("escrow_pt"), market.toBuffer()]);
21
+ }
22
+ /** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
23
+ marketEscrowSy({ market }) {
24
+ return this.findProgramAddressSync([Buffer.from("escrow_sy"), market.toBuffer()]);
25
+ }
26
+ /** Market-owned escrow account for YT tokens. Used as an interchange between the YT core program and the end-user */
27
+ marketEscrowYt({ market }) {
28
+ return this.findProgramAddressSync([Buffer.from("escrow_yt"), market.toBuffer()]);
29
+ }
30
+ /** Personal LP position */
31
+ marketLpPosition({ market, owner }) {
32
+ return this.findProgramAddressSync([Buffer.from("lp_position"), market.toBuffer(), owner.toBuffer()]);
33
+ }
34
+ }
35
+ exports.ExponentCLMMPDA = ExponentCLMMPDA;
36
+ //# sourceMappingURL=pda.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pda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C,EAAE,MAAM,EAAE,KAAK,EAAqD;QACnF,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACvG,CAAC;CACF;AA/BD,0CA+BC"}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@exponent-labs/exponent-clmm-pda",
3
+ "version": "0.1.8",
4
+ "main": "build/index.js",
5
+ "types": "build/index.d.ts",
6
+ "license": "AGPL-3.0",
7
+ "scripts": {
8
+ "build": "tsc --build"
9
+ },
10
+ "dependencies": {
11
+ "@coral-xyz/anchor": "0.30.0",
12
+ "@exponent-labs/exponent-clmm-idl": "0.1.8",
13
+ "@solana/spl-token": "0.4.6"
14
+ },
15
+ "devDependencies": {
16
+ "@types/bn.js": "^5.1.0",
17
+ "typescript": "5.4.5"
18
+ },
19
+ "gitHead": "209b8847e9a0fadb5b5ec96b9b47f0ace4a3bf9d"
20
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export { ExponentCLMMPDA as ExponentCLMMPDA } from "./pda"
package/src/pda.ts ADDED
@@ -0,0 +1,36 @@
1
+ import { web3 } from "@coral-xyz/anchor"
2
+ import { PROGRAM_ID } from "@exponent-labs/exponent-clmm-idl"
3
+ import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from "@solana/spl-token"
4
+
5
+ export class ExponentCLMMPDA {
6
+ constructor(public programId: web3.PublicKey = new web3.PublicKey(PROGRAM_ID)) {}
7
+
8
+ private findProgramAddressSync(seeds: Buffer[]) {
9
+ return web3.PublicKey.findProgramAddressSync(seeds, this.programId)[0]
10
+ }
11
+
12
+ /** Identifier for the market is derived from the vault that uniquely has a PT token */
13
+ market({ vault, seedId }: { vault: web3.PublicKey; seedId: number }) {
14
+ return this.findProgramAddressSync([Buffer.from("market_three"), vault.toBuffer(), Buffer.from([seedId])])
15
+ }
16
+
17
+ /** Escrow account for holding PT liquidity for a market */
18
+ marketEscrowPt({ market }: { market: web3.PublicKey }) {
19
+ return this.findProgramAddressSync([Buffer.from("escrow_pt"), market.toBuffer()])
20
+ }
21
+
22
+ /** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
23
+ marketEscrowSy({ market }: { market: web3.PublicKey }) {
24
+ return this.findProgramAddressSync([Buffer.from("escrow_sy"), market.toBuffer()])
25
+ }
26
+
27
+ /** Market-owned escrow account for YT tokens. Used as an interchange between the YT core program and the end-user */
28
+ marketEscrowYt({ market }: { market: web3.PublicKey }) {
29
+ return this.findProgramAddressSync([Buffer.from("escrow_yt"), market.toBuffer()])
30
+ }
31
+
32
+ /** Personal LP position */
33
+ marketLpPosition({ market, owner }: { market: web3.PublicKey; owner: web3.PublicKey }) {
34
+ return this.findProgramAddressSync([Buffer.from("lp_position"), market.toBuffer(), owner.toBuffer()])
35
+ }
36
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "compilerOptions": {
3
+ "rootDir": "src",
4
+ "sourceMap": true,
5
+ "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
6
+ "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
7
+ "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
8
+ "module": "CommonJS" /* Specify what module code is generated. */,
9
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
10
+ "outDir": "./build" /* Specify an output folder for all emitted files. */,
11
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
12
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
13
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */
14
+ },
15
+ "include": ["src"],
16
+ "exclude": ["build"],
17
+ "references": [{ "path": "../exponent-clmm-idl" }]
18
+ }