@reflectmoney/junior 1.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.
Files changed (122) hide show
  1. package/README.md +119 -0
  2. package/dist/classes/JuniorTranche.d.ts +201 -0
  3. package/dist/classes/JuniorTranche.js +709 -0
  4. package/dist/classes/PdaClient.d.ts +20 -0
  5. package/dist/classes/PdaClient.js +68 -0
  6. package/dist/classes/index.d.ts +2 -0
  7. package/dist/classes/index.js +18 -0
  8. package/dist/constants/index.d.ts +22 -0
  9. package/dist/constants/index.js +25 -0
  10. package/dist/generated/accounts/asset.d.ts +38 -0
  11. package/dist/generated/accounts/asset.js +74 -0
  12. package/dist/generated/accounts/cooldown.d.ts +40 -0
  13. package/dist/generated/accounts/cooldown.js +79 -0
  14. package/dist/generated/accounts/index.d.ts +12 -0
  15. package/dist/generated/accounts/index.js +28 -0
  16. package/dist/generated/accounts/liquidityPool.d.ts +57 -0
  17. package/dist/generated/accounts/liquidityPool.js +81 -0
  18. package/dist/generated/accounts/settings.d.ts +41 -0
  19. package/dist/generated/accounts/settings.js +80 -0
  20. package/dist/generated/accounts/userPermissions.d.ts +34 -0
  21. package/dist/generated/accounts/userPermissions.js +70 -0
  22. package/dist/generated/errors/index.d.ts +8 -0
  23. package/dist/generated/errors/index.js +24 -0
  24. package/dist/generated/errors/rlp.d.ts +131 -0
  25. package/dist/generated/errors/rlp.js +197 -0
  26. package/dist/generated/index.d.ts +12 -0
  27. package/dist/generated/index.js +28 -0
  28. package/dist/generated/instructions/addAsset.d.ts +80 -0
  29. package/dist/generated/instructions/addAsset.js +188 -0
  30. package/dist/generated/instructions/createPermissionAccount.d.ts +67 -0
  31. package/dist/generated/instructions/createPermissionAccount.js +166 -0
  32. package/dist/generated/instructions/deposit.d.ts +115 -0
  33. package/dist/generated/instructions/deposit.js +294 -0
  34. package/dist/generated/instructions/forceRemoveAsset.d.ts +82 -0
  35. package/dist/generated/instructions/forceRemoveAsset.js +186 -0
  36. package/dist/generated/instructions/freezeFunctionality.d.ts +72 -0
  37. package/dist/generated/instructions/freezeFunctionality.js +175 -0
  38. package/dist/generated/instructions/index.d.ts +23 -0
  39. package/dist/generated/instructions/index.js +39 -0
  40. package/dist/generated/instructions/initializeLp.d.ts +99 -0
  41. package/dist/generated/instructions/initializeLp.js +230 -0
  42. package/dist/generated/instructions/initializePoolReserve.d.ts +83 -0
  43. package/dist/generated/instructions/initializePoolReserve.js +228 -0
  44. package/dist/generated/instructions/initializeRlp.d.ts +67 -0
  45. package/dist/generated/instructions/initializeRlp.js +163 -0
  46. package/dist/generated/instructions/requestWithdrawal.d.ts +99 -0
  47. package/dist/generated/instructions/requestWithdrawal.js +254 -0
  48. package/dist/generated/instructions/slash.d.ts +151 -0
  49. package/dist/generated/instructions/slash.js +212 -0
  50. package/dist/generated/instructions/swap.d.ts +119 -0
  51. package/dist/generated/instructions/swap.js +309 -0
  52. package/dist/generated/instructions/updateActionRole.d.ts +76 -0
  53. package/dist/generated/instructions/updateActionRole.js +174 -0
  54. package/dist/generated/instructions/updateDepositCap.d.ts +71 -0
  55. package/dist/generated/instructions/updateDepositCap.js +156 -0
  56. package/dist/generated/instructions/updateOracle.d.ts +66 -0
  57. package/dist/generated/instructions/updateOracle.js +151 -0
  58. package/dist/generated/instructions/updateRoleHolder.d.ts +80 -0
  59. package/dist/generated/instructions/updateRoleHolder.js +185 -0
  60. package/dist/generated/instructions/withdraw.d.ts +95 -0
  61. package/dist/generated/instructions/withdraw.js +235 -0
  62. package/dist/generated/programs/index.d.ts +8 -0
  63. package/dist/generated/programs/index.js +24 -0
  64. package/dist/generated/programs/rlp.d.ts +75 -0
  65. package/dist/generated/programs/rlp.js +233 -0
  66. package/dist/generated/shared/index.d.ts +49 -0
  67. package/dist/generated/shared/index.js +94 -0
  68. package/dist/generated/types/accessControl.d.ts +20 -0
  69. package/dist/generated/types/accessControl.js +29 -0
  70. package/dist/generated/types/accessLevel.d.ts +16 -0
  71. package/dist/generated/types/accessLevel.js +28 -0
  72. package/dist/generated/types/accessMap.d.ts +20 -0
  73. package/dist/generated/types/accessMap.js +35 -0
  74. package/dist/generated/types/action.d.ts +32 -0
  75. package/dist/generated/types/action.js +44 -0
  76. package/dist/generated/types/actionMapping.d.ts +22 -0
  77. package/dist/generated/types/actionMapping.js +31 -0
  78. package/dist/generated/types/addAssetEvent.d.ts +17 -0
  79. package/dist/generated/types/addAssetEvent.js +30 -0
  80. package/dist/generated/types/createPermissionAccountEvent.d.ts +16 -0
  81. package/dist/generated/types/createPermissionAccountEvent.js +28 -0
  82. package/dist/generated/types/depositEvent.d.ts +27 -0
  83. package/dist/generated/types/depositEvent.js +36 -0
  84. package/dist/generated/types/depositRewardEvent.d.ts +21 -0
  85. package/dist/generated/types/depositRewardEvent.js +30 -0
  86. package/dist/generated/types/forceRemoveAssetEvent.d.ts +18 -0
  87. package/dist/generated/types/forceRemoveAssetEvent.js +32 -0
  88. package/dist/generated/types/freezeProtocolActionEvent.d.ts +20 -0
  89. package/dist/generated/types/freezeProtocolActionEvent.js +29 -0
  90. package/dist/generated/types/index.d.ts +32 -0
  91. package/dist/generated/types/index.js +48 -0
  92. package/dist/generated/types/initializeLiquidityPoolEvent.d.ts +17 -0
  93. package/dist/generated/types/initializeLiquidityPoolEvent.js +30 -0
  94. package/dist/generated/types/initializeRlpEvent.d.ts +15 -0
  95. package/dist/generated/types/initializeRlpEvent.js +22 -0
  96. package/dist/generated/types/killSwitch.d.ts +15 -0
  97. package/dist/generated/types/killSwitch.js +22 -0
  98. package/dist/generated/types/levelRoles.d.ts +18 -0
  99. package/dist/generated/types/levelRoles.js +23 -0
  100. package/dist/generated/types/oracle.d.ts +25 -0
  101. package/dist/generated/types/oracle.js +56 -0
  102. package/dist/generated/types/requestWithdrawEvent.d.ts +21 -0
  103. package/dist/generated/types/requestWithdrawEvent.js +30 -0
  104. package/dist/generated/types/role.d.ts +21 -0
  105. package/dist/generated/types/role.js +33 -0
  106. package/dist/generated/types/slashEvent.d.ts +27 -0
  107. package/dist/generated/types/slashEvent.js +36 -0
  108. package/dist/generated/types/swapEvent.d.ts +23 -0
  109. package/dist/generated/types/swapEvent.js +32 -0
  110. package/dist/generated/types/update.d.ts +16 -0
  111. package/dist/generated/types/update.js +28 -0
  112. package/dist/generated/types/updateActionRoleEvent.d.ts +22 -0
  113. package/dist/generated/types/updateActionRoleEvent.js +31 -0
  114. package/dist/generated/types/updateDepositCapEvent.d.ts +21 -0
  115. package/dist/generated/types/updateDepositCapEvent.js +30 -0
  116. package/dist/generated/types/updateOracleEvent.d.ts +18 -0
  117. package/dist/generated/types/updateOracleEvent.js +32 -0
  118. package/dist/generated/types/updateRoleHolderEvent.d.ts +22 -0
  119. package/dist/generated/types/updateRoleHolderEvent.js +31 -0
  120. package/dist/index.d.ts +3 -0
  121. package/dist/index.js +19 -0
  122. package/package.json +41 -0
@@ -0,0 +1,20 @@
1
+ import { Address } from "@solana/kit";
2
+ export declare class PdaClient {
3
+ static deriveSettings(): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
4
+ static deriveUserPermissions(address: Address): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
5
+ static deriveLiquidityPool(liquidityPoolId: number): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
6
+ static deriveAsset(assetMint: Address): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
7
+ static deriveCooldown(liquidityPoolId: number, cooldownId: number | bigint): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
8
+ /**
9
+ * Anchor's standard `event_authority` PDA. The codama-generated async
10
+ * builders auto-derive this when omitted, so most callers won't need it
11
+ * directly — exposed for low-level instruction inspection.
12
+ */
13
+ static deriveEventAuthority(): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
14
+ /**
15
+ * Derive the senior tranche's ProxyState address from its branded mint.
16
+ * Uses the proxy program ID, not the RLP program ID. Used by NAV slash
17
+ * setup (audit-M06).
18
+ */
19
+ static deriveProxyState(brandedMint: Address): Promise<readonly [Address<string>, import("@solana/kit").ProgramDerivedAddressBump]>;
20
+ }
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PdaClient = void 0;
4
+ const kit_1 = require("@solana/kit");
5
+ const constants_1 = require("../constants");
6
+ const generated_1 = require("../generated");
7
+ class PdaClient {
8
+ static async deriveSettings() {
9
+ return (0, kit_1.getProgramDerivedAddress)({
10
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
11
+ seeds: [constants_1.SETTINGS_SEED],
12
+ });
13
+ }
14
+ static async deriveUserPermissions(address) {
15
+ return (0, kit_1.getProgramDerivedAddress)({
16
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
17
+ seeds: [constants_1.PERMISSIONS_SEED, (0, kit_1.getAddressEncoder)().encode(address)],
18
+ });
19
+ }
20
+ static async deriveLiquidityPool(liquidityPoolId) {
21
+ return (0, kit_1.getProgramDerivedAddress)({
22
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
23
+ seeds: [
24
+ constants_1.LIQUIDITY_POOL_SEED,
25
+ (0, kit_1.getU8Encoder)().encode(liquidityPoolId),
26
+ ],
27
+ });
28
+ }
29
+ static async deriveAsset(assetMint) {
30
+ return (0, kit_1.getProgramDerivedAddress)({
31
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
32
+ seeds: [constants_1.ASSET_SEED, (0, kit_1.getAddressEncoder)().encode(assetMint)],
33
+ });
34
+ }
35
+ static async deriveCooldown(liquidityPoolId, cooldownId) {
36
+ return (0, kit_1.getProgramDerivedAddress)({
37
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
38
+ seeds: [
39
+ constants_1.COOLDOWN_SEED,
40
+ (0, kit_1.getU8Encoder)().encode(liquidityPoolId),
41
+ (0, kit_1.getU64Encoder)().encode(cooldownId),
42
+ ],
43
+ });
44
+ }
45
+ /**
46
+ * Anchor's standard `event_authority` PDA. The codama-generated async
47
+ * builders auto-derive this when omitted, so most callers won't need it
48
+ * directly — exposed for low-level instruction inspection.
49
+ */
50
+ static async deriveEventAuthority() {
51
+ return (0, kit_1.getProgramDerivedAddress)({
52
+ programAddress: generated_1.RLP_PROGRAM_ADDRESS,
53
+ seeds: [constants_1.EVENT_AUTHORITY_SEED],
54
+ });
55
+ }
56
+ /**
57
+ * Derive the senior tranche's ProxyState address from its branded mint.
58
+ * Uses the proxy program ID, not the RLP program ID. Used by NAV slash
59
+ * setup (audit-M06).
60
+ */
61
+ static async deriveProxyState(brandedMint) {
62
+ return (0, kit_1.getProgramDerivedAddress)({
63
+ programAddress: (0, kit_1.address)(constants_1.PROXY_PROGRAM_ADDRESS),
64
+ seeds: [constants_1.PROXY_STATE_SEED, (0, kit_1.getAddressEncoder)().encode(brandedMint)],
65
+ });
66
+ }
67
+ }
68
+ exports.PdaClient = PdaClient;
@@ -0,0 +1,2 @@
1
+ export * from "./JuniorTranche";
2
+ export * from "./PdaClient";
@@ -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("./JuniorTranche"), exports);
18
+ __exportStar(require("./PdaClient"), exports);
@@ -0,0 +1,22 @@
1
+ export declare const SETTINGS_SEED = "settings";
2
+ export declare const PERMISSIONS_SEED = "permissions";
3
+ export declare const LIQUIDITY_POOL_SEED = "liquidity_pool";
4
+ export declare const ASSET_SEED = "asset";
5
+ export declare const COOLDOWN_SEED = "cooldown";
6
+ /** Anchor `#[event_cpi]` standard PDA seed (audit-E09). */
7
+ export declare const EVENT_AUTHORITY_SEED = "__event_authority";
8
+ /**
9
+ * Reflect proxy program PDA seed for ProxyState accounts. Used when deriving
10
+ * the senior tranche's ProxyState address from a branded mint.
11
+ * (audit-M06 / NAV slash dependency.)
12
+ */
13
+ export declare const PROXY_STATE_SEED = "proxy";
14
+ /** Reflect proxy program ID (mainnet/dev). */
15
+ export declare const PROXY_PROGRAM_ADDRESS: "pRoxYU64BSjv8HbhENna8a7LVCrkzzNrnvbYuTwas8C";
16
+ /** Maximum cooldown_duration allowed at initialize_lp (365 days, audit-E03). */
17
+ export declare const MAX_COOLDOWN_DURATION_SECONDS: number;
18
+ /**
19
+ * Pyth confidence-interval cap used by the program's oracle reader
20
+ * (audit-3 / audit-33). conf × this ≤ price (i.e., conf within ~2% of price).
21
+ */
22
+ export declare const MAX_ORACLE_CONFIDENCE_RATIO = 50;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MAX_ORACLE_CONFIDENCE_RATIO = exports.MAX_COOLDOWN_DURATION_SECONDS = exports.PROXY_PROGRAM_ADDRESS = exports.PROXY_STATE_SEED = exports.EVENT_AUTHORITY_SEED = exports.COOLDOWN_SEED = exports.ASSET_SEED = exports.LIQUIDITY_POOL_SEED = exports.PERMISSIONS_SEED = exports.SETTINGS_SEED = void 0;
4
+ exports.SETTINGS_SEED = "settings";
5
+ exports.PERMISSIONS_SEED = "permissions";
6
+ exports.LIQUIDITY_POOL_SEED = "liquidity_pool";
7
+ exports.ASSET_SEED = "asset";
8
+ exports.COOLDOWN_SEED = "cooldown";
9
+ /** Anchor `#[event_cpi]` standard PDA seed (audit-E09). */
10
+ exports.EVENT_AUTHORITY_SEED = "__event_authority";
11
+ /**
12
+ * Reflect proxy program PDA seed for ProxyState accounts. Used when deriving
13
+ * the senior tranche's ProxyState address from a branded mint.
14
+ * (audit-M06 / NAV slash dependency.)
15
+ */
16
+ exports.PROXY_STATE_SEED = "proxy";
17
+ /** Reflect proxy program ID (mainnet/dev). */
18
+ exports.PROXY_PROGRAM_ADDRESS = "pRoxYU64BSjv8HbhENna8a7LVCrkzzNrnvbYuTwas8C";
19
+ /** Maximum cooldown_duration allowed at initialize_lp (365 days, audit-E03). */
20
+ exports.MAX_COOLDOWN_DURATION_SECONDS = 365 * 24 * 60 * 60;
21
+ /**
22
+ * Pyth confidence-interval cap used by the program's oracle reader
23
+ * (audit-3 / audit-33). conf × this ≤ price (i.e., conf within ~2% of price).
24
+ */
25
+ exports.MAX_ORACLE_CONFIDENCE_RATIO = 50;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type ReadonlyUint8Array } from "@solana/kit";
9
+ import { type AccessLevel, type AccessLevelArgs, type Oracle, type OracleArgs } from "../types";
10
+ export declare const ASSET_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getAssetDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
12
+ export type Asset = {
13
+ discriminator: ReadonlyUint8Array;
14
+ bump: number;
15
+ index: number;
16
+ mint: Address;
17
+ oracle: Oracle;
18
+ accessLevel: AccessLevel;
19
+ };
20
+ export type AssetArgs = {
21
+ bump: number;
22
+ index: number;
23
+ mint: Address;
24
+ oracle: OracleArgs;
25
+ accessLevel: AccessLevelArgs;
26
+ };
27
+ /** Gets the encoder for {@link AssetArgs} account data. */
28
+ export declare function getAssetEncoder(): Encoder<AssetArgs>;
29
+ /** Gets the decoder for {@link Asset} account data. */
30
+ export declare function getAssetDecoder(): Decoder<Asset>;
31
+ /** Gets the codec for {@link Asset} account data. */
32
+ export declare function getAssetCodec(): Codec<AssetArgs, Asset>;
33
+ export declare function decodeAsset<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Asset, TAddress>;
34
+ export declare function decodeAsset<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Asset, TAddress>;
35
+ export declare function fetchAsset<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Asset, TAddress>>;
36
+ export declare function fetchMaybeAsset<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Asset, TAddress>>;
37
+ export declare function fetchAllAsset(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Asset>[]>;
38
+ export declare function fetchAllMaybeAsset(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Asset>[]>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ASSET_DISCRIMINATOR = void 0;
11
+ exports.getAssetDiscriminatorBytes = getAssetDiscriminatorBytes;
12
+ exports.getAssetEncoder = getAssetEncoder;
13
+ exports.getAssetDecoder = getAssetDecoder;
14
+ exports.getAssetCodec = getAssetCodec;
15
+ exports.decodeAsset = decodeAsset;
16
+ exports.fetchAsset = fetchAsset;
17
+ exports.fetchMaybeAsset = fetchMaybeAsset;
18
+ exports.fetchAllAsset = fetchAllAsset;
19
+ exports.fetchAllMaybeAsset = fetchAllMaybeAsset;
20
+ const kit_1 = require("@solana/kit");
21
+ const types_1 = require("../types");
22
+ exports.ASSET_DISCRIMINATOR = new Uint8Array([
23
+ 234, 180, 241, 252, 139, 224, 160, 8,
24
+ ]);
25
+ function getAssetDiscriminatorBytes() {
26
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.ASSET_DISCRIMINATOR);
27
+ }
28
+ /** Gets the encoder for {@link AssetArgs} account data. */
29
+ function getAssetEncoder() {
30
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
31
+ ["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
32
+ ["bump", (0, kit_1.getU8Encoder)()],
33
+ ["index", (0, kit_1.getU8Encoder)()],
34
+ ["mint", (0, kit_1.getAddressEncoder)()],
35
+ ["oracle", (0, types_1.getOracleEncoder)()],
36
+ ["accessLevel", (0, types_1.getAccessLevelEncoder)()],
37
+ ]), (value) => ({ ...value, discriminator: exports.ASSET_DISCRIMINATOR }));
38
+ }
39
+ /** Gets the decoder for {@link Asset} account data. */
40
+ function getAssetDecoder() {
41
+ return (0, kit_1.getStructDecoder)([
42
+ ["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
43
+ ["bump", (0, kit_1.getU8Decoder)()],
44
+ ["index", (0, kit_1.getU8Decoder)()],
45
+ ["mint", (0, kit_1.getAddressDecoder)()],
46
+ ["oracle", (0, types_1.getOracleDecoder)()],
47
+ ["accessLevel", (0, types_1.getAccessLevelDecoder)()],
48
+ ]);
49
+ }
50
+ /** Gets the codec for {@link Asset} account data. */
51
+ function getAssetCodec() {
52
+ return (0, kit_1.combineCodec)(getAssetEncoder(), getAssetDecoder());
53
+ }
54
+ function decodeAsset(encodedAccount) {
55
+ return (0, kit_1.decodeAccount)(encodedAccount, getAssetDecoder());
56
+ }
57
+ async function fetchAsset(rpc, address, config) {
58
+ const maybeAccount = await fetchMaybeAsset(rpc, address, config);
59
+ (0, kit_1.assertAccountExists)(maybeAccount);
60
+ return maybeAccount;
61
+ }
62
+ async function fetchMaybeAsset(rpc, address, config) {
63
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
64
+ return decodeAsset(maybeAccount);
65
+ }
66
+ async function fetchAllAsset(rpc, addresses, config) {
67
+ const maybeAccounts = await fetchAllMaybeAsset(rpc, addresses, config);
68
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
69
+ return maybeAccounts;
70
+ }
71
+ async function fetchAllMaybeAsset(rpc, addresses, config) {
72
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
73
+ return maybeAccounts.map((maybeAccount) => decodeAsset(maybeAccount));
74
+ }
@@ -0,0 +1,40 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
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
+ export declare const COOLDOWN_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
+ export declare function getCooldownDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
11
+ export type Cooldown = {
12
+ discriminator: ReadonlyUint8Array;
13
+ bump: number;
14
+ index: bigint;
15
+ authority: Address;
16
+ liquidityPoolId: number;
17
+ unlockTs: bigint;
18
+ lockedAmount: bigint;
19
+ };
20
+ export type CooldownArgs = {
21
+ bump: number;
22
+ index: number | bigint;
23
+ authority: Address;
24
+ liquidityPoolId: number;
25
+ unlockTs: number | bigint;
26
+ lockedAmount: number | bigint;
27
+ };
28
+ /** Gets the encoder for {@link CooldownArgs} account data. */
29
+ export declare function getCooldownEncoder(): FixedSizeEncoder<CooldownArgs>;
30
+ /** Gets the decoder for {@link Cooldown} account data. */
31
+ export declare function getCooldownDecoder(): FixedSizeDecoder<Cooldown>;
32
+ /** Gets the codec for {@link Cooldown} account data. */
33
+ export declare function getCooldownCodec(): FixedSizeCodec<CooldownArgs, Cooldown>;
34
+ export declare function decodeCooldown<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Cooldown, TAddress>;
35
+ export declare function decodeCooldown<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Cooldown, TAddress>;
36
+ export declare function fetchCooldown<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Cooldown, TAddress>>;
37
+ export declare function fetchMaybeCooldown<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Cooldown, TAddress>>;
38
+ export declare function fetchAllCooldown(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Cooldown>[]>;
39
+ export declare function fetchAllMaybeCooldown(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Cooldown>[]>;
40
+ export declare function getCooldownSize(): number;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.COOLDOWN_DISCRIMINATOR = void 0;
11
+ exports.getCooldownDiscriminatorBytes = getCooldownDiscriminatorBytes;
12
+ exports.getCooldownEncoder = getCooldownEncoder;
13
+ exports.getCooldownDecoder = getCooldownDecoder;
14
+ exports.getCooldownCodec = getCooldownCodec;
15
+ exports.decodeCooldown = decodeCooldown;
16
+ exports.fetchCooldown = fetchCooldown;
17
+ exports.fetchMaybeCooldown = fetchMaybeCooldown;
18
+ exports.fetchAllCooldown = fetchAllCooldown;
19
+ exports.fetchAllMaybeCooldown = fetchAllMaybeCooldown;
20
+ exports.getCooldownSize = getCooldownSize;
21
+ const kit_1 = require("@solana/kit");
22
+ exports.COOLDOWN_DISCRIMINATOR = new Uint8Array([
23
+ 50, 166, 94, 192, 234, 64, 152, 208,
24
+ ]);
25
+ function getCooldownDiscriminatorBytes() {
26
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.COOLDOWN_DISCRIMINATOR);
27
+ }
28
+ /** Gets the encoder for {@link CooldownArgs} account data. */
29
+ function getCooldownEncoder() {
30
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
31
+ ["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
32
+ ["bump", (0, kit_1.getU8Encoder)()],
33
+ ["index", (0, kit_1.getU64Encoder)()],
34
+ ["authority", (0, kit_1.getAddressEncoder)()],
35
+ ["liquidityPoolId", (0, kit_1.getU8Encoder)()],
36
+ ["unlockTs", (0, kit_1.getU64Encoder)()],
37
+ ["lockedAmount", (0, kit_1.getU64Encoder)()],
38
+ ]), (value) => ({ ...value, discriminator: exports.COOLDOWN_DISCRIMINATOR }));
39
+ }
40
+ /** Gets the decoder for {@link Cooldown} account data. */
41
+ function getCooldownDecoder() {
42
+ return (0, kit_1.getStructDecoder)([
43
+ ["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
44
+ ["bump", (0, kit_1.getU8Decoder)()],
45
+ ["index", (0, kit_1.getU64Decoder)()],
46
+ ["authority", (0, kit_1.getAddressDecoder)()],
47
+ ["liquidityPoolId", (0, kit_1.getU8Decoder)()],
48
+ ["unlockTs", (0, kit_1.getU64Decoder)()],
49
+ ["lockedAmount", (0, kit_1.getU64Decoder)()],
50
+ ]);
51
+ }
52
+ /** Gets the codec for {@link Cooldown} account data. */
53
+ function getCooldownCodec() {
54
+ return (0, kit_1.combineCodec)(getCooldownEncoder(), getCooldownDecoder());
55
+ }
56
+ function decodeCooldown(encodedAccount) {
57
+ return (0, kit_1.decodeAccount)(encodedAccount, getCooldownDecoder());
58
+ }
59
+ async function fetchCooldown(rpc, address, config) {
60
+ const maybeAccount = await fetchMaybeCooldown(rpc, address, config);
61
+ (0, kit_1.assertAccountExists)(maybeAccount);
62
+ return maybeAccount;
63
+ }
64
+ async function fetchMaybeCooldown(rpc, address, config) {
65
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
66
+ return decodeCooldown(maybeAccount);
67
+ }
68
+ async function fetchAllCooldown(rpc, addresses, config) {
69
+ const maybeAccounts = await fetchAllMaybeCooldown(rpc, addresses, config);
70
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
71
+ return maybeAccounts;
72
+ }
73
+ async function fetchAllMaybeCooldown(rpc, addresses, config) {
74
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
75
+ return maybeAccounts.map((maybeAccount) => decodeCooldown(maybeAccount));
76
+ }
77
+ function getCooldownSize() {
78
+ return 66;
79
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ export * from "./asset";
9
+ export * from "./cooldown";
10
+ export * from "./liquidityPool";
11
+ export * from "./settings";
12
+ export * from "./userPermissions";
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
+ };
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ __exportStar(require("./asset"), exports);
25
+ __exportStar(require("./cooldown"), exports);
26
+ __exportStar(require("./liquidityPool"), exports);
27
+ __exportStar(require("./settings"), exports);
28
+ __exportStar(require("./userPermissions"), exports);
@@ -0,0 +1,57 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
8
+ import { fetchEncodedAccount, fetchEncodedAccounts, type Account, type Address, type Codec, type Decoder, type EncodedAccount, type Encoder, type FetchAccountConfig, type FetchAccountsConfig, type MaybeAccount, type MaybeEncodedAccount, type Option, type OptionOrNullable, type ReadonlyUint8Array } from "@solana/kit";
9
+ export declare const LIQUIDITY_POOL_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
10
+ export declare function getLiquidityPoolDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
11
+ export type LiquidityPool = {
12
+ discriminator: ReadonlyUint8Array;
13
+ bump: number;
14
+ index: number;
15
+ lpToken: Address;
16
+ cooldowns: bigint;
17
+ cooldownDuration: bigint;
18
+ depositCap: Option<bigint>;
19
+ assetCount: number;
20
+ assets: ReadonlyUint8Array;
21
+ /**
22
+ * ProxyState account this pool's junior tranche covers.
23
+ * When set, `slash_for_nav_coverage` is enabled and pulls from this pool's
24
+ * reserve of the proxy's stablecoin_mint into the proxy's vault, capped at
25
+ * the proxy's current mark-to-market loss (principal + commission - vault_value).
26
+ */
27
+ protectedVault: Option<Address>;
28
+ };
29
+ export type LiquidityPoolArgs = {
30
+ bump: number;
31
+ index: number;
32
+ lpToken: Address;
33
+ cooldowns: number | bigint;
34
+ cooldownDuration: number | bigint;
35
+ depositCap: OptionOrNullable<number | bigint>;
36
+ assetCount: number;
37
+ assets: ReadonlyUint8Array;
38
+ /**
39
+ * ProxyState account this pool's junior tranche covers.
40
+ * When set, `slash_for_nav_coverage` is enabled and pulls from this pool's
41
+ * reserve of the proxy's stablecoin_mint into the proxy's vault, capped at
42
+ * the proxy's current mark-to-market loss (principal + commission - vault_value).
43
+ */
44
+ protectedVault: OptionOrNullable<Address>;
45
+ };
46
+ /** Gets the encoder for {@link LiquidityPoolArgs} account data. */
47
+ export declare function getLiquidityPoolEncoder(): Encoder<LiquidityPoolArgs>;
48
+ /** Gets the decoder for {@link LiquidityPool} account data. */
49
+ export declare function getLiquidityPoolDecoder(): Decoder<LiquidityPool>;
50
+ /** Gets the codec for {@link LiquidityPool} account data. */
51
+ export declare function getLiquidityPoolCodec(): Codec<LiquidityPoolArgs, LiquidityPool>;
52
+ export declare function decodeLiquidityPool<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<LiquidityPool, TAddress>;
53
+ export declare function decodeLiquidityPool<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<LiquidityPool, TAddress>;
54
+ export declare function fetchLiquidityPool<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<LiquidityPool, TAddress>>;
55
+ export declare function fetchMaybeLiquidityPool<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<LiquidityPool, TAddress>>;
56
+ export declare function fetchAllLiquidityPool(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<LiquidityPool>[]>;
57
+ export declare function fetchAllMaybeLiquidityPool(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<LiquidityPool>[]>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * This code was AUTOGENERATED using the Codama library.
4
+ * Please DO NOT EDIT THIS FILE, instead use visitors
5
+ * to add features, then rerun Codama to update it.
6
+ *
7
+ * @see https://github.com/codama-idl/codama
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.LIQUIDITY_POOL_DISCRIMINATOR = void 0;
11
+ exports.getLiquidityPoolDiscriminatorBytes = getLiquidityPoolDiscriminatorBytes;
12
+ exports.getLiquidityPoolEncoder = getLiquidityPoolEncoder;
13
+ exports.getLiquidityPoolDecoder = getLiquidityPoolDecoder;
14
+ exports.getLiquidityPoolCodec = getLiquidityPoolCodec;
15
+ exports.decodeLiquidityPool = decodeLiquidityPool;
16
+ exports.fetchLiquidityPool = fetchLiquidityPool;
17
+ exports.fetchMaybeLiquidityPool = fetchMaybeLiquidityPool;
18
+ exports.fetchAllLiquidityPool = fetchAllLiquidityPool;
19
+ exports.fetchAllMaybeLiquidityPool = fetchAllMaybeLiquidityPool;
20
+ const kit_1 = require("@solana/kit");
21
+ exports.LIQUIDITY_POOL_DISCRIMINATOR = new Uint8Array([
22
+ 66, 38, 17, 64, 188, 80, 68, 129,
23
+ ]);
24
+ function getLiquidityPoolDiscriminatorBytes() {
25
+ return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.LIQUIDITY_POOL_DISCRIMINATOR);
26
+ }
27
+ /** Gets the encoder for {@link LiquidityPoolArgs} account data. */
28
+ function getLiquidityPoolEncoder() {
29
+ return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
30
+ ["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
31
+ ["bump", (0, kit_1.getU8Encoder)()],
32
+ ["index", (0, kit_1.getU8Encoder)()],
33
+ ["lpToken", (0, kit_1.getAddressEncoder)()],
34
+ ["cooldowns", (0, kit_1.getU64Encoder)()],
35
+ ["cooldownDuration", (0, kit_1.getU64Encoder)()],
36
+ ["depositCap", (0, kit_1.getOptionEncoder)((0, kit_1.getU64Encoder)())],
37
+ ["assetCount", (0, kit_1.getU8Encoder)()],
38
+ ["assets", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 4)],
39
+ ["protectedVault", (0, kit_1.getOptionEncoder)((0, kit_1.getAddressEncoder)())],
40
+ ]), (value) => ({ ...value, discriminator: exports.LIQUIDITY_POOL_DISCRIMINATOR }));
41
+ }
42
+ /** Gets the decoder for {@link LiquidityPool} account data. */
43
+ function getLiquidityPoolDecoder() {
44
+ return (0, kit_1.getStructDecoder)([
45
+ ["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
46
+ ["bump", (0, kit_1.getU8Decoder)()],
47
+ ["index", (0, kit_1.getU8Decoder)()],
48
+ ["lpToken", (0, kit_1.getAddressDecoder)()],
49
+ ["cooldowns", (0, kit_1.getU64Decoder)()],
50
+ ["cooldownDuration", (0, kit_1.getU64Decoder)()],
51
+ ["depositCap", (0, kit_1.getOptionDecoder)((0, kit_1.getU64Decoder)())],
52
+ ["assetCount", (0, kit_1.getU8Decoder)()],
53
+ ["assets", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 4)],
54
+ ["protectedVault", (0, kit_1.getOptionDecoder)((0, kit_1.getAddressDecoder)())],
55
+ ]);
56
+ }
57
+ /** Gets the codec for {@link LiquidityPool} account data. */
58
+ function getLiquidityPoolCodec() {
59
+ return (0, kit_1.combineCodec)(getLiquidityPoolEncoder(), getLiquidityPoolDecoder());
60
+ }
61
+ function decodeLiquidityPool(encodedAccount) {
62
+ return (0, kit_1.decodeAccount)(encodedAccount, getLiquidityPoolDecoder());
63
+ }
64
+ async function fetchLiquidityPool(rpc, address, config) {
65
+ const maybeAccount = await fetchMaybeLiquidityPool(rpc, address, config);
66
+ (0, kit_1.assertAccountExists)(maybeAccount);
67
+ return maybeAccount;
68
+ }
69
+ async function fetchMaybeLiquidityPool(rpc, address, config) {
70
+ const maybeAccount = await (0, kit_1.fetchEncodedAccount)(rpc, address, config);
71
+ return decodeLiquidityPool(maybeAccount);
72
+ }
73
+ async function fetchAllLiquidityPool(rpc, addresses, config) {
74
+ const maybeAccounts = await fetchAllMaybeLiquidityPool(rpc, addresses, config);
75
+ (0, kit_1.assertAccountsExist)(maybeAccounts);
76
+ return maybeAccounts;
77
+ }
78
+ async function fetchAllMaybeLiquidityPool(rpc, addresses, config) {
79
+ const maybeAccounts = await (0, kit_1.fetchEncodedAccounts)(rpc, addresses, config);
80
+ return maybeAccounts.map((maybeAccount) => decodeLiquidityPool(maybeAccount));
81
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * This code was AUTOGENERATED using the Codama library.
3
+ * Please DO NOT EDIT THIS FILE, instead use visitors
4
+ * to add features, then rerun Codama to update it.
5
+ *
6
+ * @see https://github.com/codama-idl/codama
7
+ */
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 AccessControl, type AccessControlArgs } from "../types";
10
+ export declare const SETTINGS_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
+ export declare function getSettingsDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
12
+ export type Settings = {
13
+ discriminator: ReadonlyUint8Array;
14
+ bump: number;
15
+ liquidityPools: number;
16
+ assets: number;
17
+ accessControl: AccessControl;
18
+ swapFeeBps: number;
19
+ supremoCount: number;
20
+ };
21
+ export type SettingsArgs = {
22
+ bump: number;
23
+ liquidityPools: number;
24
+ assets: number;
25
+ accessControl: AccessControlArgs;
26
+ swapFeeBps: number;
27
+ supremoCount: number;
28
+ };
29
+ /** Gets the encoder for {@link SettingsArgs} account data. */
30
+ export declare function getSettingsEncoder(): FixedSizeEncoder<SettingsArgs>;
31
+ /** Gets the decoder for {@link Settings} account data. */
32
+ export declare function getSettingsDecoder(): FixedSizeDecoder<Settings>;
33
+ /** Gets the codec for {@link Settings} account data. */
34
+ export declare function getSettingsCodec(): FixedSizeCodec<SettingsArgs, Settings>;
35
+ export declare function decodeSettings<TAddress extends string = string>(encodedAccount: EncodedAccount<TAddress>): Account<Settings, TAddress>;
36
+ export declare function decodeSettings<TAddress extends string = string>(encodedAccount: MaybeEncodedAccount<TAddress>): MaybeAccount<Settings, TAddress>;
37
+ export declare function fetchSettings<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<Account<Settings, TAddress>>;
38
+ export declare function fetchMaybeSettings<TAddress extends string = string>(rpc: Parameters<typeof fetchEncodedAccount>[0], address: Address<TAddress>, config?: FetchAccountConfig): Promise<MaybeAccount<Settings, TAddress>>;
39
+ export declare function fetchAllSettings(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<Account<Settings>[]>;
40
+ export declare function fetchAllMaybeSettings(rpc: Parameters<typeof fetchEncodedAccounts>[0], addresses: Array<Address>, config?: FetchAccountsConfig): Promise<MaybeAccount<Settings>[]>;
41
+ export declare function getSettingsSize(): number;