@exponent-labs/exponent-pda 0.0.3
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 +16 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +6 -0
- package/build/index.js.map +1 -0
- package/build/pda.d.ts +63 -0
- package/build/pda.js +76 -0
- package/build/pda.js.map +1 -0
- package/package.json +20 -0
- package/src/index.ts +1 -0
- package/src/pda.ts +85 -0
- package/tsconfig.json +18 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
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.
|
|
5
|
+
|
|
6
|
+
## [0.0.3](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/exponent-pda@0.0.2...@exponent-labs/exponent-pda@0.0.3) (2025-03-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exponent-labs/exponent-pda
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.0.2](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/exponent-pda@0.0.1...@exponent-labs/exponent-pda@0.0.2) (2025-03-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @exponent-labs/exponent-pda
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExponentPDA } from "./pda";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExponentPDA = void 0;
|
|
4
|
+
var pda_1 = require("./pda");
|
|
5
|
+
Object.defineProperty(exports, "ExponentPDA", { enumerable: true, get: function () { return pda_1.ExponentPDA; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAAmC;AAA1B,kGAAA,WAAW,OAAA"}
|
package/build/pda.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { web3 } from "@coral-xyz/anchor";
|
|
2
|
+
export declare class ExponentPDA {
|
|
3
|
+
programId: web3.PublicKey;
|
|
4
|
+
constructor(programId?: web3.PublicKey);
|
|
5
|
+
private findProgramAddressSync;
|
|
6
|
+
mintPt({ vault }: {
|
|
7
|
+
vault: web3.PublicKey;
|
|
8
|
+
}): web3.PublicKey;
|
|
9
|
+
mintYt({ vault }: {
|
|
10
|
+
vault: web3.PublicKey;
|
|
11
|
+
}): web3.PublicKey;
|
|
12
|
+
escrowYt({ vault }: {
|
|
13
|
+
vault: web3.PublicKey;
|
|
14
|
+
}): web3.PublicKey;
|
|
15
|
+
escrowSy({ mintSy, vault }: {
|
|
16
|
+
vault: web3.PublicKey;
|
|
17
|
+
mintSy: web3.PublicKey;
|
|
18
|
+
}): web3.PublicKey;
|
|
19
|
+
emissionTracker({ vault }: {
|
|
20
|
+
vault: web3.PublicKey;
|
|
21
|
+
}): web3.PublicKey;
|
|
22
|
+
yieldPosition({ vault, owner }: {
|
|
23
|
+
vault: web3.PublicKey;
|
|
24
|
+
owner: web3.PublicKey;
|
|
25
|
+
}): web3.PublicKey;
|
|
26
|
+
/** Authority for vault signing CPI calls */
|
|
27
|
+
vaultSigner({ vault }: {
|
|
28
|
+
vault: web3.PublicKey;
|
|
29
|
+
}): web3.PublicKey;
|
|
30
|
+
/** Authority for vault signing CPI calls */
|
|
31
|
+
vaultYieldPosition({ vault }: {
|
|
32
|
+
vault: web3.PublicKey;
|
|
33
|
+
}): web3.PublicKey;
|
|
34
|
+
/** Identifier for the market is derived from the vault that uniquely has a PT token */
|
|
35
|
+
market({ vault }: {
|
|
36
|
+
vault: web3.PublicKey;
|
|
37
|
+
}): web3.PublicKey;
|
|
38
|
+
/** Identifier for market rewarder is derived from the Market */
|
|
39
|
+
marketRewarder({ market }: {
|
|
40
|
+
market: web3.PublicKey;
|
|
41
|
+
}): web3.PublicKey;
|
|
42
|
+
/** LP token mint for the market */
|
|
43
|
+
mintLp({ market }: {
|
|
44
|
+
market: web3.PublicKey;
|
|
45
|
+
}): web3.PublicKey;
|
|
46
|
+
/** Escrow account for holding deposited LP tokens */
|
|
47
|
+
marketEscrowLp({ market }: {
|
|
48
|
+
market: web3.PublicKey;
|
|
49
|
+
}): web3.PublicKey;
|
|
50
|
+
/** Escrow account for holding PT liquidity for a market */
|
|
51
|
+
marketEscrowPt({ market }: {
|
|
52
|
+
market: web3.PublicKey;
|
|
53
|
+
}): web3.PublicKey;
|
|
54
|
+
/** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
|
|
55
|
+
marketEscrowSy({ market }: {
|
|
56
|
+
market: web3.PublicKey;
|
|
57
|
+
}): web3.PublicKey;
|
|
58
|
+
/** Personal LP position */
|
|
59
|
+
marketLpPosition({ market, owner }: {
|
|
60
|
+
market: web3.PublicKey;
|
|
61
|
+
owner: web3.PublicKey;
|
|
62
|
+
}): web3.PublicKey;
|
|
63
|
+
}
|
package/build/pda.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExponentPDA = void 0;
|
|
4
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
+
const exponent_idl_1 = require("@exponent-labs/exponent-idl");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
class ExponentPDA {
|
|
8
|
+
programId;
|
|
9
|
+
constructor(programId = new anchor_1.web3.PublicKey(exponent_idl_1.PROGRAM_ID)) {
|
|
10
|
+
this.programId = programId;
|
|
11
|
+
}
|
|
12
|
+
findProgramAddressSync(seeds) {
|
|
13
|
+
return anchor_1.web3.PublicKey.findProgramAddressSync(seeds, this.programId)[0];
|
|
14
|
+
}
|
|
15
|
+
mintPt({ vault }) {
|
|
16
|
+
return this.findProgramAddressSync([Buffer.from("mint_pt"), vault.toBuffer()]);
|
|
17
|
+
}
|
|
18
|
+
mintYt({ vault }) {
|
|
19
|
+
return this.findProgramAddressSync([Buffer.from("mint_yt"), vault.toBuffer()]);
|
|
20
|
+
}
|
|
21
|
+
escrowYt({ vault }) {
|
|
22
|
+
return this.findProgramAddressSync([Buffer.from("escrow_yt"), vault.toBuffer()]);
|
|
23
|
+
}
|
|
24
|
+
escrowSy({ mintSy, vault }) {
|
|
25
|
+
const vaultAuthority = this.vaultSigner({ vault });
|
|
26
|
+
return (0, spl_token_1.getAssociatedTokenAddressSync)(mintSy, vaultAuthority, true, spl_token_1.TOKEN_PROGRAM_ID);
|
|
27
|
+
}
|
|
28
|
+
emissionTracker({ vault }) {
|
|
29
|
+
return this.findProgramAddressSync([Buffer.from("emission_tracker"), vault.toBuffer()]);
|
|
30
|
+
}
|
|
31
|
+
yieldPosition({ vault, owner }) {
|
|
32
|
+
return this.findProgramAddressSync([Buffer.from("yield_position"), vault.toBuffer(), owner.toBuffer()]);
|
|
33
|
+
}
|
|
34
|
+
/** Authority for vault signing CPI calls */
|
|
35
|
+
vaultSigner({ vault }) {
|
|
36
|
+
return this.findProgramAddressSync([Buffer.from("authority"), vault.toBuffer()]);
|
|
37
|
+
}
|
|
38
|
+
/** Authority for vault signing CPI calls */
|
|
39
|
+
vaultYieldPosition({ vault }) {
|
|
40
|
+
return this.findProgramAddressSync([
|
|
41
|
+
Buffer.from("yield_position"),
|
|
42
|
+
vault.toBuffer(),
|
|
43
|
+
this.vaultSigner({ vault }).toBuffer(),
|
|
44
|
+
]);
|
|
45
|
+
}
|
|
46
|
+
/** Identifier for the market is derived from the vault that uniquely has a PT token */
|
|
47
|
+
market({ vault }) {
|
|
48
|
+
return this.findProgramAddressSync([Buffer.from("market"), vault.toBuffer()]);
|
|
49
|
+
}
|
|
50
|
+
/** Identifier for market rewarder is derived from the Market */
|
|
51
|
+
marketRewarder({ market }) {
|
|
52
|
+
return this.findProgramAddressSync([Buffer.from("market_rewarder"), market.toBuffer()]);
|
|
53
|
+
}
|
|
54
|
+
/** LP token mint for the market */
|
|
55
|
+
mintLp({ market }) {
|
|
56
|
+
return this.findProgramAddressSync([Buffer.from("mint_lp"), market.toBuffer()]);
|
|
57
|
+
}
|
|
58
|
+
/** Escrow account for holding deposited LP tokens */
|
|
59
|
+
marketEscrowLp({ market }) {
|
|
60
|
+
return this.findProgramAddressSync([Buffer.from("escrow_lp"), market.toBuffer()]);
|
|
61
|
+
}
|
|
62
|
+
/** Escrow account for holding PT liquidity for a market */
|
|
63
|
+
marketEscrowPt({ market }) {
|
|
64
|
+
return this.findProgramAddressSync([Buffer.from("escrow_pt"), market.toBuffer()]);
|
|
65
|
+
}
|
|
66
|
+
/** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
|
|
67
|
+
marketEscrowSy({ market }) {
|
|
68
|
+
return this.findProgramAddressSync([Buffer.from("escrow_sy"), market.toBuffer()]);
|
|
69
|
+
}
|
|
70
|
+
/** Personal LP position */
|
|
71
|
+
marketLpPosition({ market, owner }) {
|
|
72
|
+
return this.findProgramAddressSync([Buffer.from("lp_position"), market.toBuffer(), owner.toBuffer()]);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.ExponentPDA = ExponentPDA;
|
|
76
|
+
//# sourceMappingURL=pda.js.map
|
package/build/pda.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pda.js","sourceRoot":"","sources":["../src/pda.ts"],"names":[],"mappings":";;;AAAA,8CAAwC;AACxC,8DAAwD;AACxD,iDAAmF;AAEnF,MAAa,WAAW;IACH;IAAnB,YAAmB,YAA4B,IAAI,aAAI,CAAC,SAAS,CAAC,yBAAU,CAAC;QAA1D,cAAS,GAAT,SAAS,CAAiD;IAAG,CAAC;IAEzE,sBAAsB,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C,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACnF,CAAC;IAED,2DAA2D;IAC3D,cAAc,CAAC,EAAE,MAAM,EAA8B;QACnD,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACnF,CAAC;IAED,iHAAiH;IACjH,cAAc,CAAC,EAAE,MAAM,EAA8B;QACnD,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACnF,CAAC;IAED,2BAA2B;IAC3B,gBAAgB,CAAC,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;AAhFD,kCAgFC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@exponent-labs/exponent-pda",
|
|
3
|
+
"version": "0.0.3",
|
|
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-idl": "^0.0.3",
|
|
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 { ExponentPDA } from "./pda"
|
package/src/pda.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { web3 } from "@coral-xyz/anchor"
|
|
2
|
+
import { PROGRAM_ID } from "@exponent-labs/exponent-idl"
|
|
3
|
+
import { TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from "@solana/spl-token"
|
|
4
|
+
|
|
5
|
+
export class ExponentPDA {
|
|
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
|
+
mintPt({ vault }: { vault: web3.PublicKey }) {
|
|
13
|
+
return this.findProgramAddressSync([Buffer.from("mint_pt"), vault.toBuffer()])
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mintYt({ vault }: { vault: web3.PublicKey }) {
|
|
17
|
+
return this.findProgramAddressSync([Buffer.from("mint_yt"), vault.toBuffer()])
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
escrowYt({ vault }: { vault: web3.PublicKey }) {
|
|
21
|
+
return this.findProgramAddressSync([Buffer.from("escrow_yt"), vault.toBuffer()])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
escrowSy({ mintSy, vault }: { vault: web3.PublicKey; mintSy: web3.PublicKey }) {
|
|
25
|
+
const vaultAuthority = this.vaultSigner({ vault })
|
|
26
|
+
return getAssociatedTokenAddressSync(mintSy, vaultAuthority, true, TOKEN_PROGRAM_ID)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
emissionTracker({ vault }: { vault: web3.PublicKey }) {
|
|
30
|
+
return this.findProgramAddressSync([Buffer.from("emission_tracker"), vault.toBuffer()])
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
yieldPosition({ vault, owner }: { vault: web3.PublicKey; owner: web3.PublicKey }) {
|
|
34
|
+
return this.findProgramAddressSync([Buffer.from("yield_position"), vault.toBuffer(), owner.toBuffer()])
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Authority for vault signing CPI calls */
|
|
38
|
+
vaultSigner({ vault }: { vault: web3.PublicKey }) {
|
|
39
|
+
return this.findProgramAddressSync([Buffer.from("authority"), vault.toBuffer()])
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Authority for vault signing CPI calls */
|
|
43
|
+
vaultYieldPosition({ vault }: { vault: web3.PublicKey }) {
|
|
44
|
+
return this.findProgramAddressSync([
|
|
45
|
+
Buffer.from("yield_position"),
|
|
46
|
+
vault.toBuffer(),
|
|
47
|
+
this.vaultSigner({ vault }).toBuffer(),
|
|
48
|
+
])
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** Identifier for the market is derived from the vault that uniquely has a PT token */
|
|
52
|
+
market({ vault }: { vault: web3.PublicKey }) {
|
|
53
|
+
return this.findProgramAddressSync([Buffer.from("market"), vault.toBuffer()])
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Identifier for market rewarder is derived from the Market */
|
|
57
|
+
marketRewarder({ market }: { market: web3.PublicKey }) {
|
|
58
|
+
return this.findProgramAddressSync([Buffer.from("market_rewarder"), market.toBuffer()])
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** LP token mint for the market */
|
|
62
|
+
mintLp({ market }: { market: web3.PublicKey }) {
|
|
63
|
+
return this.findProgramAddressSync([Buffer.from("mint_lp"), market.toBuffer()])
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Escrow account for holding deposited LP tokens */
|
|
67
|
+
marketEscrowLp({ market }: { market: web3.PublicKey }) {
|
|
68
|
+
return this.findProgramAddressSync([Buffer.from("escrow_lp"), market.toBuffer()])
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Escrow account for holding PT liquidity for a market */
|
|
72
|
+
marketEscrowPt({ market }: { market: web3.PublicKey }) {
|
|
73
|
+
return this.findProgramAddressSync([Buffer.from("escrow_pt"), market.toBuffer()])
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Market-owned escrow account for SY tokens. Used as an interchange between the SY program and the end-user */
|
|
77
|
+
marketEscrowSy({ market }: { market: web3.PublicKey }) {
|
|
78
|
+
return this.findProgramAddressSync([Buffer.from("escrow_sy"), market.toBuffer()])
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Personal LP position */
|
|
82
|
+
marketLpPosition({ market, owner }: { market: web3.PublicKey; owner: web3.PublicKey }) {
|
|
83
|
+
return this.findProgramAddressSync([Buffer.from("lp_position"), market.toBuffer(), owner.toBuffer()])
|
|
84
|
+
}
|
|
85
|
+
}
|
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-idl" }]
|
|
18
|
+
}
|