@exponent-labs/perena-sy-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 +18 -0
- package/build/index.js.map +1 -0
- package/build/perenaSyPda.d.ts +39 -0
- package/build/perenaSyPda.js +47 -0
- package/build/perenaSyPda.js.map +1 -0
- package/package.json +18 -0
- package/src/index.ts +1 -0
- package/src/perenaSyPda.ts +60 -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/perena-sy-pda@0.0.2...@exponent-labs/perena-sy-pda@0.0.3) (2025-03-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exponent-labs/perena-sy-pda
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.0.2](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/perena-sy-pda@0.0.1...@exponent-labs/perena-sy-pda@0.0.2) (2025-03-03)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @exponent-labs/perena-sy-pda
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./perenaSyPda";
|
package/build/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./perenaSyPda"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
export declare class PerenaSyPda {
|
|
3
|
+
programId: PublicKey;
|
|
4
|
+
constructor(programId: PublicKey);
|
|
5
|
+
private findProgramAddressSync;
|
|
6
|
+
emissionTracker({ perenaStablePool }: {
|
|
7
|
+
perenaStablePool: PublicKey;
|
|
8
|
+
}): PublicKey;
|
|
9
|
+
mintSy({ perenaStablePool }: {
|
|
10
|
+
perenaStablePool: PublicKey;
|
|
11
|
+
}): PublicKey;
|
|
12
|
+
accountAuthority({ perenaStablePool }: {
|
|
13
|
+
perenaStablePool: PublicKey;
|
|
14
|
+
}): PublicKey;
|
|
15
|
+
mintSyAuthority({ perenaStablePool }: {
|
|
16
|
+
perenaStablePool: PublicKey;
|
|
17
|
+
}): PublicKey;
|
|
18
|
+
position({ perenaStablePool, owner }: {
|
|
19
|
+
perenaStablePool: PublicKey;
|
|
20
|
+
owner: PublicKey;
|
|
21
|
+
}): PublicKey;
|
|
22
|
+
syEscrowAuthority({ perenaStablePool }: {
|
|
23
|
+
perenaStablePool: PublicKey;
|
|
24
|
+
}): PublicKey;
|
|
25
|
+
syEscrow({ perenaStablePool }: {
|
|
26
|
+
perenaStablePool: PublicKey;
|
|
27
|
+
}): PublicKey;
|
|
28
|
+
syMeta({ perenaStablePool }: {
|
|
29
|
+
perenaStablePool: PublicKey;
|
|
30
|
+
}): PublicKey;
|
|
31
|
+
accountAuthorityToken({ perenaStablePool }: {
|
|
32
|
+
perenaStablePool: PublicKey;
|
|
33
|
+
}): PublicKey;
|
|
34
|
+
underlyingEscrow({ perenaStablePool, mintUnderlying, tokenProgramUnderlying, }: {
|
|
35
|
+
perenaStablePool: PublicKey;
|
|
36
|
+
mintUnderlying: PublicKey;
|
|
37
|
+
tokenProgramUnderlying: PublicKey;
|
|
38
|
+
}): PublicKey;
|
|
39
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PerenaSyPda = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
6
|
+
class PerenaSyPda {
|
|
7
|
+
programId;
|
|
8
|
+
constructor(programId) {
|
|
9
|
+
this.programId = programId;
|
|
10
|
+
}
|
|
11
|
+
findProgramAddressSync(seeds) {
|
|
12
|
+
return web3_js_1.PublicKey.findProgramAddressSync(seeds, this.programId)[0];
|
|
13
|
+
}
|
|
14
|
+
emissionTracker({ perenaStablePool }) {
|
|
15
|
+
return this.findProgramAddressSync([Buffer.from("emission_tracker"), perenaStablePool.toBuffer()]);
|
|
16
|
+
}
|
|
17
|
+
mintSy({ perenaStablePool }) {
|
|
18
|
+
return this.findProgramAddressSync([Buffer.from("perena_standard_token"), perenaStablePool.toBuffer()]);
|
|
19
|
+
}
|
|
20
|
+
accountAuthority({ perenaStablePool }) {
|
|
21
|
+
return this.findProgramAddressSync([Buffer.from("account_authority"), perenaStablePool.toBuffer()]);
|
|
22
|
+
}
|
|
23
|
+
mintSyAuthority({ perenaStablePool }) {
|
|
24
|
+
return this.findProgramAddressSync([Buffer.from("mint_authority"), perenaStablePool.toBuffer()]);
|
|
25
|
+
}
|
|
26
|
+
position({ perenaStablePool, owner }) {
|
|
27
|
+
return this.findProgramAddressSync([Buffer.from("position"), perenaStablePool.toBuffer(), owner.toBuffer()]);
|
|
28
|
+
}
|
|
29
|
+
syEscrowAuthority({ perenaStablePool }) {
|
|
30
|
+
return this.findProgramAddressSync([Buffer.from("stake_pool_authority"), perenaStablePool.toBuffer()]);
|
|
31
|
+
}
|
|
32
|
+
syEscrow({ perenaStablePool }) {
|
|
33
|
+
return this.findProgramAddressSync([Buffer.from("sy_escrow"), perenaStablePool.toBuffer()]);
|
|
34
|
+
}
|
|
35
|
+
syMeta({ perenaStablePool }) {
|
|
36
|
+
return this.findProgramAddressSync([Buffer.from("meta"), perenaStablePool.toBuffer()]);
|
|
37
|
+
}
|
|
38
|
+
accountAuthorityToken({ perenaStablePool }) {
|
|
39
|
+
return this.findProgramAddressSync([Buffer.from("account_authority_token"), perenaStablePool.toBuffer()]);
|
|
40
|
+
}
|
|
41
|
+
underlyingEscrow({ perenaStablePool, mintUnderlying, tokenProgramUnderlying, }) {
|
|
42
|
+
const owner = this.accountAuthority({ perenaStablePool });
|
|
43
|
+
return (0, spl_token_1.getAssociatedTokenAddressSync)(mintUnderlying, owner, true, tokenProgramUnderlying);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.PerenaSyPda = PerenaSyPda;
|
|
47
|
+
//# sourceMappingURL=perenaSyPda.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perenaSyPda.js","sourceRoot":"","sources":["../src/perenaSyPda.ts"],"names":[],"mappings":";;;AAAA,6CAA2C;AAC3C,iDAAiE;AAGjE,MAAa,WAAW;IACH;IAAnB,YAAmB,SAAoB;QAApB,cAAS,G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M,CAAC,IAAI,CAAC,sBAAsB,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACxG,CAAC;IAED,QAAQ,CAAC,EAAE,gBAAgB,EAAmC;QAC5D,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IAC7F,CAAC;IAED,MAAM,CAAC,EAAE,gBAAgB,EAAmC;QAC1D,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IACxF,CAAC;IAED,qBAAqB,CAAC,EAAE,gBAAgB,EAAmC;QACzE,OAAO,IAAI,CAAC,sBAAsB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;IAC3G,CAAC;IAED,gBAAgB,CAAC,EACf,gBAAgB,EAChB,cAAc,EACd,sBAAsB,GAKvB;QACC,MAAM,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,EAAE,CAAC,CAAA;QACzD,OAAO,IAAA,yCAA6B,EAAC,cAAc,EAAE,KAAK,EAAE,IAAI,EAAE,sBAAsB,CAAC,CAAA;IAC3F,CAAC;CACF;AAvDD,kCAuDC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@exponent-labs/perena-sy-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
|
+
"@solana/spl-token": "0.4.6"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "5.4.5"
|
|
16
|
+
},
|
|
17
|
+
"gitHead": "209b8847e9a0fadb5b5ec96b9b47f0ace4a3bf9d"
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./perenaSyPda"
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js"
|
|
2
|
+
import { getAssociatedTokenAddressSync } from "@solana/spl-token"
|
|
3
|
+
import * as anchor from "@coral-xyz/anchor"
|
|
4
|
+
|
|
5
|
+
export class PerenaSyPda {
|
|
6
|
+
constructor(public programId: PublicKey) {}
|
|
7
|
+
|
|
8
|
+
private findProgramAddressSync(seeds: Buffer[]) {
|
|
9
|
+
return PublicKey.findProgramAddressSync(seeds, this.programId)[0]
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
emissionTracker({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
13
|
+
return this.findProgramAddressSync([Buffer.from("emission_tracker"), perenaStablePool.toBuffer()])
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
mintSy({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
17
|
+
return this.findProgramAddressSync([Buffer.from("perena_standard_token"), perenaStablePool.toBuffer()])
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
accountAuthority({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
21
|
+
return this.findProgramAddressSync([Buffer.from("account_authority"), perenaStablePool.toBuffer()])
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
mintSyAuthority({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
25
|
+
return this.findProgramAddressSync([Buffer.from("mint_authority"), perenaStablePool.toBuffer()])
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
position({ perenaStablePool, owner }: { perenaStablePool: PublicKey; owner: PublicKey }) {
|
|
29
|
+
return this.findProgramAddressSync([Buffer.from("position"), perenaStablePool.toBuffer(), owner.toBuffer()])
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
syEscrowAuthority({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
33
|
+
return this.findProgramAddressSync([Buffer.from("stake_pool_authority"), perenaStablePool.toBuffer()])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
syEscrow({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
37
|
+
return this.findProgramAddressSync([Buffer.from("sy_escrow"), perenaStablePool.toBuffer()])
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
syMeta({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
41
|
+
return this.findProgramAddressSync([Buffer.from("meta"), perenaStablePool.toBuffer()])
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
accountAuthorityToken({ perenaStablePool }: { perenaStablePool: PublicKey }) {
|
|
45
|
+
return this.findProgramAddressSync([Buffer.from("account_authority_token"), perenaStablePool.toBuffer()])
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
underlyingEscrow({
|
|
49
|
+
perenaStablePool,
|
|
50
|
+
mintUnderlying,
|
|
51
|
+
tokenProgramUnderlying,
|
|
52
|
+
}: {
|
|
53
|
+
perenaStablePool: PublicKey
|
|
54
|
+
mintUnderlying: PublicKey
|
|
55
|
+
tokenProgramUnderlying: PublicKey
|
|
56
|
+
}) {
|
|
57
|
+
const owner = this.accountAuthority({ perenaStablePool })
|
|
58
|
+
return getAssociatedTokenAddressSync(mintUnderlying, owner, true, tokenProgramUnderlying)
|
|
59
|
+
}
|
|
60
|
+
}
|
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": []
|
|
18
|
+
}
|