@exponent-labs/fragmetric-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 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/fragmetric-pda@0.0.2...@exponent-labs/fragmetric-pda@0.0.3) (2025-03-03)
7
+
8
+ **Note:** Version bump only for package @exponent-labs/fragmetric-pda
9
+
10
+
11
+
12
+
13
+
14
+ ## [0.0.2](https://github.com/exponent-finance/exponent-core/compare/@exponent-labs/fragmetric-pda@0.0.1...@exponent-labs/fragmetric-pda@0.0.2) (2025-03-03)
15
+
16
+ **Note:** Version bump only for package @exponent-labs/fragmetric-pda
@@ -0,0 +1,13 @@
1
+ import { web3 } from "@coral-xyz/anchor";
2
+ export declare const FRAGMETRIC_PROGRAM_ID: web3.PublicKey;
3
+ export declare class FragmetricPda {
4
+ programId: web3.PublicKey;
5
+ constructor(programId?: web3.PublicKey);
6
+ rewardAccount(receiptTokenMint: web3.PublicKey): web3.PublicKey;
7
+ fundAccount(receiptTokenMint: web3.PublicKey): web3.PublicKey;
8
+ fundReserveAccount(receiptTokenMint: web3.PublicKey): web3.PublicKey;
9
+ userFundAccount(receiptTokenMint: web3.PublicKey, user: web3.PublicKey): web3.PublicKey;
10
+ userRewardAccount(receiptTokenMint: web3.PublicKey, user: web3.PublicKey): web3.PublicKey;
11
+ fundWrapAccount(receiptTokenMint: web3.PublicKey): web3.PublicKey;
12
+ eventAuthority(): web3.PublicKey;
13
+ }
package/build/index.js ADDED
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FragmetricPda = exports.FRAGMETRIC_PROGRAM_ID = void 0;
4
+ const anchor_1 = require("@coral-xyz/anchor");
5
+ exports.FRAGMETRIC_PROGRAM_ID = new anchor_1.web3.PublicKey("fragnAis7Bp6FTsMoa6YcH8UffhEw43Ph79qAiK3iF3");
6
+ class FragmetricPda {
7
+ programId;
8
+ constructor(programId = exports.FRAGMETRIC_PROGRAM_ID) {
9
+ this.programId = programId;
10
+ }
11
+ rewardAccount(receiptTokenMint) {
12
+ return getRewardAccount(receiptTokenMint, this.programId);
13
+ }
14
+ fundAccount(receiptTokenMint) {
15
+ return getFundAccount(receiptTokenMint, this.programId);
16
+ }
17
+ fundReserveAccount(receiptTokenMint) {
18
+ return getFundReserveAccount(receiptTokenMint, this.programId);
19
+ }
20
+ userFundAccount(receiptTokenMint, user) {
21
+ return getUserFundAccount(receiptTokenMint, user, this.programId);
22
+ }
23
+ userRewardAccount(receiptTokenMint, user) {
24
+ return getUserRewardAccount(receiptTokenMint, user, this.programId);
25
+ }
26
+ fundWrapAccount(receiptTokenMint) {
27
+ return getFundWrapAccount(receiptTokenMint, this.programId);
28
+ }
29
+ eventAuthority() {
30
+ return getEventAuthority(this.programId);
31
+ }
32
+ }
33
+ exports.FragmetricPda = FragmetricPda;
34
+ const getRewardAccount = (receiptTokenMint, programId) => {
35
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([114, 101, 119, 97, 114, 100]), receiptTokenMint.toBuffer()], programId)[0];
36
+ };
37
+ const getFundAccount = (receiptTokenMint, programId) => {
38
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([102, 117, 110, 100]), receiptTokenMint.toBuffer()], programId)[0];
39
+ };
40
+ const getUserFundAccount = (receiptTokenMint, user, programId) => {
41
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([117, 115, 101, 114, 95, 102, 117, 110, 100]), receiptTokenMint.toBuffer(), user.toBuffer()], programId)[0];
42
+ };
43
+ const getUserRewardAccount = (receiptTokenMint, user, programId) => {
44
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([117, 115, 101, 114, 95, 114, 101, 119, 97, 114, 100]), receiptTokenMint.toBuffer(), user.toBuffer()], programId)[0];
45
+ };
46
+ const getFundReserveAccount = (receiptTokenMint, programId) => {
47
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([102, 117, 110, 100, 95, 114, 101, 115, 101, 114, 118, 101]), receiptTokenMint.toBuffer()], programId)[0];
48
+ };
49
+ const getEventAuthority = (programId) => {
50
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])], programId)[0];
51
+ };
52
+ const getFundWrapAccount = (receiptTokenMint, programId) => {
53
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([102, 117, 110, 100, 95, 119, 114, 97, 112]), receiptTokenMint.toBuffer()], programId)[0];
54
+ };
55
+ const getFundTreasuryAccount = (receiptTokenMint, programId) => {
56
+ return anchor_1.web3.PublicKey.findProgramAddressSync([Buffer.from([102, 117, 110, 100, 95, 116, 114, 101, 97, 115, 117, 114, 121]), receiptTokenMint.toBuffer()], programId)[0];
57
+ };
58
+ const getFundWithdrawalBatchAccount = (receiptTokenMint, batchId, programId) => {
59
+ return anchor_1.web3.PublicKey.findProgramAddressSync([
60
+ Buffer.from([119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 98, 97, 116, 99, 104]),
61
+ receiptTokenMint.toBuffer(),
62
+ anchor_1.web3.PublicKey.default.toBuffer(),
63
+ Buffer.from(batchId.toArrayLike(Buffer, "le", 8)),
64
+ ], programId)[0];
65
+ };
66
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,8CAA4C;AAE/B,QAAA,qBAAqB,GAAG,IAAI,aAAI,CAAC,SAAS,CAAC,6CAA6C,CAAC,CAAA;AAEtG,MAAa,aAAa;IACL;IAAnB,YAAmB,YAAY,6BAAqB;QAA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AAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,QAAQ,EAAE,CAAC,EAC3G,SAAS,CACV,CAAC,CAAC,CAAC,CAAA;AACN,CAAC,CAAA;AAED,MAAM,6BAA6B,GAAG,CAAC,gBAAgC,EAAE,OAAW,EAAE,SAAyB,EAAE,EAAE;IACjH,OAAO,aAAI,CAAC,SAAS,CAAC,sBAAsB,CAC1C;QACE,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QACvF,gBAAgB,CAAC,QAAQ,EAAE;QAC3B,aAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE;QACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;KAClD,EACD,SAAS,CACV,CAAC,CAAC,CAAC,CAAA;AACN,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@exponent-labs/fragmetric-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
+ "devDependencies": {
11
+ "typescript": "5.4.5"
12
+ },
13
+ "gitHead": "209b8847e9a0fadb5b5ec96b9b47f0ace4a3bf9d"
14
+ }
package/src/index.ts ADDED
@@ -0,0 +1,103 @@
1
+ import { web3, BN } from "@coral-xyz/anchor"
2
+
3
+ export const FRAGMETRIC_PROGRAM_ID = new web3.PublicKey("fragnAis7Bp6FTsMoa6YcH8UffhEw43Ph79qAiK3iF3")
4
+
5
+ export class FragmetricPda {
6
+ constructor(public programId = FRAGMETRIC_PROGRAM_ID) {}
7
+
8
+ rewardAccount(receiptTokenMint: web3.PublicKey) {
9
+ return getRewardAccount(receiptTokenMint, this.programId)
10
+ }
11
+
12
+ fundAccount(receiptTokenMint: web3.PublicKey) {
13
+ return getFundAccount(receiptTokenMint, this.programId)
14
+ }
15
+
16
+ fundReserveAccount(receiptTokenMint: web3.PublicKey) {
17
+ return getFundReserveAccount(receiptTokenMint, this.programId)
18
+ }
19
+
20
+ userFundAccount(receiptTokenMint: web3.PublicKey, user: web3.PublicKey) {
21
+ return getUserFundAccount(receiptTokenMint, user, this.programId)
22
+ }
23
+
24
+ userRewardAccount(receiptTokenMint: web3.PublicKey, user: web3.PublicKey) {
25
+ return getUserRewardAccount(receiptTokenMint, user, this.programId)
26
+ }
27
+
28
+ fundWrapAccount(receiptTokenMint: web3.PublicKey) {
29
+ return getFundWrapAccount(receiptTokenMint, this.programId)
30
+ }
31
+
32
+ eventAuthority() {
33
+ return getEventAuthority(this.programId)
34
+ }
35
+ }
36
+
37
+ const getRewardAccount = (receiptTokenMint: web3.PublicKey, programId: web3.PublicKey) => {
38
+ return web3.PublicKey.findProgramAddressSync(
39
+ [Buffer.from([114, 101, 119, 97, 114, 100]), receiptTokenMint.toBuffer()],
40
+ programId,
41
+ )[0]
42
+ }
43
+
44
+ const getFundAccount = (receiptTokenMint: web3.PublicKey, programId: web3.PublicKey) => {
45
+ return web3.PublicKey.findProgramAddressSync(
46
+ [Buffer.from([102, 117, 110, 100]), receiptTokenMint.toBuffer()],
47
+ programId,
48
+ )[0]
49
+ }
50
+
51
+ const getUserFundAccount = (receiptTokenMint: web3.PublicKey, user: web3.PublicKey, programId: web3.PublicKey) => {
52
+ return web3.PublicKey.findProgramAddressSync(
53
+ [Buffer.from([117, 115, 101, 114, 95, 102, 117, 110, 100]), receiptTokenMint.toBuffer(), user.toBuffer()],
54
+ programId,
55
+ )[0]
56
+ }
57
+
58
+ const getUserRewardAccount = (receiptTokenMint: web3.PublicKey, user: web3.PublicKey, programId: web3.PublicKey) => {
59
+ return web3.PublicKey.findProgramAddressSync(
60
+ [Buffer.from([117, 115, 101, 114, 95, 114, 101, 119, 97, 114, 100]), receiptTokenMint.toBuffer(), user.toBuffer()],
61
+ programId,
62
+ )[0]
63
+ }
64
+
65
+ const getFundReserveAccount = (receiptTokenMint: web3.PublicKey, programId: web3.PublicKey) => {
66
+ return web3.PublicKey.findProgramAddressSync(
67
+ [Buffer.from([102, 117, 110, 100, 95, 114, 101, 115, 101, 114, 118, 101]), receiptTokenMint.toBuffer()],
68
+ programId,
69
+ )[0]
70
+ }
71
+
72
+ const getEventAuthority = (programId: web3.PublicKey) => {
73
+ return web3.PublicKey.findProgramAddressSync(
74
+ [Buffer.from([95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121])],
75
+ programId,
76
+ )[0]
77
+ }
78
+
79
+ const getFundWrapAccount = (receiptTokenMint: web3.PublicKey, programId: web3.PublicKey) => {
80
+ return web3.PublicKey.findProgramAddressSync(
81
+ [Buffer.from([102, 117, 110, 100, 95, 119, 114, 97, 112]), receiptTokenMint.toBuffer()],
82
+ programId,
83
+ )[0]
84
+ }
85
+
86
+ const getFundTreasuryAccount = (receiptTokenMint: web3.PublicKey, programId: web3.PublicKey) => {
87
+ return web3.PublicKey.findProgramAddressSync(
88
+ [Buffer.from([102, 117, 110, 100, 95, 116, 114, 101, 97, 115, 117, 114, 121]), receiptTokenMint.toBuffer()],
89
+ programId,
90
+ )[0]
91
+ }
92
+
93
+ const getFundWithdrawalBatchAccount = (receiptTokenMint: web3.PublicKey, batchId: BN, programId: web3.PublicKey) => {
94
+ return web3.PublicKey.findProgramAddressSync(
95
+ [
96
+ Buffer.from([119, 105, 116, 104, 100, 114, 97, 119, 97, 108, 95, 98, 97, 116, 99, 104]),
97
+ receiptTokenMint.toBuffer(),
98
+ web3.PublicKey.default.toBuffer(),
99
+ Buffer.from(batchId.toArrayLike(Buffer, "le", 8)),
100
+ ],
101
+ programId,
102
+ )[0]
103
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "files": ["src/index.ts"],
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "sourceMap": true,
6
+ "incremental": true /* Save .tsbuildinfo files to allow for incremental compilation of projects. */,
7
+ "composite": true /* Enable constraints that allow a TypeScript project to be used with project references. */,
8
+ "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
9
+ "module": "CommonJS" /* Specify what module code is generated. */,
10
+ "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
11
+ "outDir": "./build" /* Specify an output folder for all emitted files. */,
12
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
13
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
14
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */,
15
+ "resolveJsonModule": true
16
+ }
17
+ }