@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,75 @@
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 { type Address, type Instruction, type InstructionWithData, type ReadonlyUint8Array } from "@solana/kit";
9
+ import { type ParsedAddAssetInstruction, type ParsedCreatePermissionAccountInstruction, type ParsedDepositInstruction, type ParsedForceRemoveAssetInstruction, type ParsedFreezeFunctionalityInstruction, type ParsedInitializeLpInstruction, type ParsedInitializePoolReserveInstruction, type ParsedInitializeRlpInstruction, type ParsedRequestWithdrawalInstruction, type ParsedSlashInstruction, type ParsedSwapInstruction, type ParsedUpdateActionRoleInstruction, type ParsedUpdateDepositCapInstruction, type ParsedUpdateOracleInstruction, type ParsedUpdateRoleHolderInstruction, type ParsedWithdrawInstruction } from "../instructions";
10
+ export declare const RLP_PROGRAM_ADDRESS: Address<"RLptfFmhKtGLrJ9fD4o8VCHGWZZLSRrpaTKzJXdCCWz">;
11
+ export declare enum RlpAccount {
12
+ Asset = 0,
13
+ Cooldown = 1,
14
+ LiquidityPool = 2,
15
+ Settings = 3,
16
+ UserPermissions = 4
17
+ }
18
+ export declare function identifyRlpAccount(account: {
19
+ data: ReadonlyUint8Array;
20
+ } | ReadonlyUint8Array): RlpAccount;
21
+ export declare enum RlpInstruction {
22
+ AddAsset = 0,
23
+ CreatePermissionAccount = 1,
24
+ Deposit = 2,
25
+ ForceRemoveAsset = 3,
26
+ FreezeFunctionality = 4,
27
+ InitializeLp = 5,
28
+ InitializePoolReserve = 6,
29
+ InitializeRlp = 7,
30
+ RequestWithdrawal = 8,
31
+ Slash = 9,
32
+ Swap = 10,
33
+ UpdateActionRole = 11,
34
+ UpdateDepositCap = 12,
35
+ UpdateOracle = 13,
36
+ UpdateRoleHolder = 14,
37
+ Withdraw = 15
38
+ }
39
+ export declare function identifyRlpInstruction(instruction: {
40
+ data: ReadonlyUint8Array;
41
+ } | ReadonlyUint8Array): RlpInstruction;
42
+ export type ParsedRlpInstruction<TProgram extends string = "RLptfFmhKtGLrJ9fD4o8VCHGWZZLSRrpaTKzJXdCCWz"> = ({
43
+ instructionType: RlpInstruction.AddAsset;
44
+ } & ParsedAddAssetInstruction<TProgram>) | ({
45
+ instructionType: RlpInstruction.CreatePermissionAccount;
46
+ } & ParsedCreatePermissionAccountInstruction<TProgram>) | ({
47
+ instructionType: RlpInstruction.Deposit;
48
+ } & ParsedDepositInstruction<TProgram>) | ({
49
+ instructionType: RlpInstruction.ForceRemoveAsset;
50
+ } & ParsedForceRemoveAssetInstruction<TProgram>) | ({
51
+ instructionType: RlpInstruction.FreezeFunctionality;
52
+ } & ParsedFreezeFunctionalityInstruction<TProgram>) | ({
53
+ instructionType: RlpInstruction.InitializeLp;
54
+ } & ParsedInitializeLpInstruction<TProgram>) | ({
55
+ instructionType: RlpInstruction.InitializePoolReserve;
56
+ } & ParsedInitializePoolReserveInstruction<TProgram>) | ({
57
+ instructionType: RlpInstruction.InitializeRlp;
58
+ } & ParsedInitializeRlpInstruction<TProgram>) | ({
59
+ instructionType: RlpInstruction.RequestWithdrawal;
60
+ } & ParsedRequestWithdrawalInstruction<TProgram>) | ({
61
+ instructionType: RlpInstruction.Slash;
62
+ } & ParsedSlashInstruction<TProgram>) | ({
63
+ instructionType: RlpInstruction.Swap;
64
+ } & ParsedSwapInstruction<TProgram>) | ({
65
+ instructionType: RlpInstruction.UpdateActionRole;
66
+ } & ParsedUpdateActionRoleInstruction<TProgram>) | ({
67
+ instructionType: RlpInstruction.UpdateDepositCap;
68
+ } & ParsedUpdateDepositCapInstruction<TProgram>) | ({
69
+ instructionType: RlpInstruction.UpdateOracle;
70
+ } & ParsedUpdateOracleInstruction<TProgram>) | ({
71
+ instructionType: RlpInstruction.UpdateRoleHolder;
72
+ } & ParsedUpdateRoleHolderInstruction<TProgram>) | ({
73
+ instructionType: RlpInstruction.Withdraw;
74
+ } & ParsedWithdrawInstruction<TProgram>);
75
+ export declare function parseRlpInstruction<TProgram extends string>(instruction: Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array>): ParsedRlpInstruction<TProgram>;
@@ -0,0 +1,233 @@
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.RlpInstruction = exports.RlpAccount = exports.RLP_PROGRAM_ADDRESS = void 0;
11
+ exports.identifyRlpAccount = identifyRlpAccount;
12
+ exports.identifyRlpInstruction = identifyRlpInstruction;
13
+ exports.parseRlpInstruction = parseRlpInstruction;
14
+ const kit_1 = require("@solana/kit");
15
+ const instructions_1 = require("../instructions");
16
+ exports.RLP_PROGRAM_ADDRESS = "RLptfFmhKtGLrJ9fD4o8VCHGWZZLSRrpaTKzJXdCCWz";
17
+ var RlpAccount;
18
+ (function (RlpAccount) {
19
+ RlpAccount[RlpAccount["Asset"] = 0] = "Asset";
20
+ RlpAccount[RlpAccount["Cooldown"] = 1] = "Cooldown";
21
+ RlpAccount[RlpAccount["LiquidityPool"] = 2] = "LiquidityPool";
22
+ RlpAccount[RlpAccount["Settings"] = 3] = "Settings";
23
+ RlpAccount[RlpAccount["UserPermissions"] = 4] = "UserPermissions";
24
+ })(RlpAccount || (exports.RlpAccount = RlpAccount = {}));
25
+ function identifyRlpAccount(account) {
26
+ const data = "data" in account ? account.data : account;
27
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([234, 180, 241, 252, 139, 224, 160, 8])), 0)) {
28
+ return RlpAccount.Asset;
29
+ }
30
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([50, 166, 94, 192, 234, 64, 152, 208])), 0)) {
31
+ return RlpAccount.Cooldown;
32
+ }
33
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([66, 38, 17, 64, 188, 80, 68, 129])), 0)) {
34
+ return RlpAccount.LiquidityPool;
35
+ }
36
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([223, 179, 163, 190, 177, 224, 67, 173])), 0)) {
37
+ return RlpAccount.Settings;
38
+ }
39
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([195, 173, 80, 32, 40, 216, 78, 110])), 0)) {
40
+ return RlpAccount.UserPermissions;
41
+ }
42
+ throw new Error("The provided account could not be identified as a rlp account.");
43
+ }
44
+ var RlpInstruction;
45
+ (function (RlpInstruction) {
46
+ RlpInstruction[RlpInstruction["AddAsset"] = 0] = "AddAsset";
47
+ RlpInstruction[RlpInstruction["CreatePermissionAccount"] = 1] = "CreatePermissionAccount";
48
+ RlpInstruction[RlpInstruction["Deposit"] = 2] = "Deposit";
49
+ RlpInstruction[RlpInstruction["ForceRemoveAsset"] = 3] = "ForceRemoveAsset";
50
+ RlpInstruction[RlpInstruction["FreezeFunctionality"] = 4] = "FreezeFunctionality";
51
+ RlpInstruction[RlpInstruction["InitializeLp"] = 5] = "InitializeLp";
52
+ RlpInstruction[RlpInstruction["InitializePoolReserve"] = 6] = "InitializePoolReserve";
53
+ RlpInstruction[RlpInstruction["InitializeRlp"] = 7] = "InitializeRlp";
54
+ RlpInstruction[RlpInstruction["RequestWithdrawal"] = 8] = "RequestWithdrawal";
55
+ RlpInstruction[RlpInstruction["Slash"] = 9] = "Slash";
56
+ RlpInstruction[RlpInstruction["Swap"] = 10] = "Swap";
57
+ RlpInstruction[RlpInstruction["UpdateActionRole"] = 11] = "UpdateActionRole";
58
+ RlpInstruction[RlpInstruction["UpdateDepositCap"] = 12] = "UpdateDepositCap";
59
+ RlpInstruction[RlpInstruction["UpdateOracle"] = 13] = "UpdateOracle";
60
+ RlpInstruction[RlpInstruction["UpdateRoleHolder"] = 14] = "UpdateRoleHolder";
61
+ RlpInstruction[RlpInstruction["Withdraw"] = 15] = "Withdraw";
62
+ })(RlpInstruction || (exports.RlpInstruction = RlpInstruction = {}));
63
+ function identifyRlpInstruction(instruction) {
64
+ const data = "data" in instruction ? instruction.data : instruction;
65
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([81, 53, 134, 142, 243, 73, 42, 179])), 0)) {
66
+ return RlpInstruction.AddAsset;
67
+ }
68
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([168, 123, 227, 158, 114, 102, 13, 95])), 0)) {
69
+ return RlpInstruction.CreatePermissionAccount;
70
+ }
71
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([242, 35, 198, 137, 82, 225, 242, 182])), 0)) {
72
+ return RlpInstruction.Deposit;
73
+ }
74
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([26, 47, 174, 160, 163, 115, 100, 180])), 0)) {
75
+ return RlpInstruction.ForceRemoveAsset;
76
+ }
77
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([65, 152, 119, 202, 25, 239, 206, 157])), 0)) {
78
+ return RlpInstruction.FreezeFunctionality;
79
+ }
80
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([110, 252, 116, 251, 81, 191, 57, 96])), 0)) {
81
+ return RlpInstruction.InitializeLp;
82
+ }
83
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([151, 225, 119, 195, 196, 190, 98, 18])), 0)) {
84
+ return RlpInstruction.InitializePoolReserve;
85
+ }
86
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([122, 110, 49, 121, 142, 92, 82, 100])), 0)) {
87
+ return RlpInstruction.InitializeRlp;
88
+ }
89
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([251, 85, 121, 205, 56, 201, 12, 177])), 0)) {
90
+ return RlpInstruction.RequestWithdrawal;
91
+ }
92
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([204, 141, 18, 161, 8, 177, 92, 142])), 0)) {
93
+ return RlpInstruction.Slash;
94
+ }
95
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([248, 198, 158, 145, 225, 117, 135, 200])), 0)) {
96
+ return RlpInstruction.Swap;
97
+ }
98
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([154, 250, 181, 15, 202, 36, 158, 230])), 0)) {
99
+ return RlpInstruction.UpdateActionRole;
100
+ }
101
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([175, 41, 137, 203, 27, 184, 245, 164])), 0)) {
102
+ return RlpInstruction.UpdateDepositCap;
103
+ }
104
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([112, 41, 209, 18, 248, 226, 252, 188])), 0)) {
105
+ return RlpInstruction.UpdateOracle;
106
+ }
107
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([96, 224, 166, 55, 4, 62, 152, 53])), 0)) {
108
+ return RlpInstruction.UpdateRoleHolder;
109
+ }
110
+ if ((0, kit_1.containsBytes)(data, (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(new Uint8Array([183, 18, 70, 156, 148, 109, 161, 34])), 0)) {
111
+ return RlpInstruction.Withdraw;
112
+ }
113
+ throw new Error("The provided instruction could not be identified as a rlp instruction.");
114
+ }
115
+ function parseRlpInstruction(instruction) {
116
+ const instructionType = identifyRlpInstruction(instruction);
117
+ switch (instructionType) {
118
+ case RlpInstruction.AddAsset: {
119
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
120
+ return {
121
+ instructionType: RlpInstruction.AddAsset,
122
+ ...(0, instructions_1.parseAddAssetInstruction)(instruction),
123
+ };
124
+ }
125
+ case RlpInstruction.CreatePermissionAccount: {
126
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
127
+ return {
128
+ instructionType: RlpInstruction.CreatePermissionAccount,
129
+ ...(0, instructions_1.parseCreatePermissionAccountInstruction)(instruction),
130
+ };
131
+ }
132
+ case RlpInstruction.Deposit: {
133
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
134
+ return {
135
+ instructionType: RlpInstruction.Deposit,
136
+ ...(0, instructions_1.parseDepositInstruction)(instruction),
137
+ };
138
+ }
139
+ case RlpInstruction.ForceRemoveAsset: {
140
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
141
+ return {
142
+ instructionType: RlpInstruction.ForceRemoveAsset,
143
+ ...(0, instructions_1.parseForceRemoveAssetInstruction)(instruction),
144
+ };
145
+ }
146
+ case RlpInstruction.FreezeFunctionality: {
147
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
148
+ return {
149
+ instructionType: RlpInstruction.FreezeFunctionality,
150
+ ...(0, instructions_1.parseFreezeFunctionalityInstruction)(instruction),
151
+ };
152
+ }
153
+ case RlpInstruction.InitializeLp: {
154
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
155
+ return {
156
+ instructionType: RlpInstruction.InitializeLp,
157
+ ...(0, instructions_1.parseInitializeLpInstruction)(instruction),
158
+ };
159
+ }
160
+ case RlpInstruction.InitializePoolReserve: {
161
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
162
+ return {
163
+ instructionType: RlpInstruction.InitializePoolReserve,
164
+ ...(0, instructions_1.parseInitializePoolReserveInstruction)(instruction),
165
+ };
166
+ }
167
+ case RlpInstruction.InitializeRlp: {
168
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
169
+ return {
170
+ instructionType: RlpInstruction.InitializeRlp,
171
+ ...(0, instructions_1.parseInitializeRlpInstruction)(instruction),
172
+ };
173
+ }
174
+ case RlpInstruction.RequestWithdrawal: {
175
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
176
+ return {
177
+ instructionType: RlpInstruction.RequestWithdrawal,
178
+ ...(0, instructions_1.parseRequestWithdrawalInstruction)(instruction),
179
+ };
180
+ }
181
+ case RlpInstruction.Slash: {
182
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
183
+ return {
184
+ instructionType: RlpInstruction.Slash,
185
+ ...(0, instructions_1.parseSlashInstruction)(instruction),
186
+ };
187
+ }
188
+ case RlpInstruction.Swap: {
189
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
190
+ return {
191
+ instructionType: RlpInstruction.Swap,
192
+ ...(0, instructions_1.parseSwapInstruction)(instruction),
193
+ };
194
+ }
195
+ case RlpInstruction.UpdateActionRole: {
196
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
197
+ return {
198
+ instructionType: RlpInstruction.UpdateActionRole,
199
+ ...(0, instructions_1.parseUpdateActionRoleInstruction)(instruction),
200
+ };
201
+ }
202
+ case RlpInstruction.UpdateDepositCap: {
203
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
204
+ return {
205
+ instructionType: RlpInstruction.UpdateDepositCap,
206
+ ...(0, instructions_1.parseUpdateDepositCapInstruction)(instruction),
207
+ };
208
+ }
209
+ case RlpInstruction.UpdateOracle: {
210
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
211
+ return {
212
+ instructionType: RlpInstruction.UpdateOracle,
213
+ ...(0, instructions_1.parseUpdateOracleInstruction)(instruction),
214
+ };
215
+ }
216
+ case RlpInstruction.UpdateRoleHolder: {
217
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
218
+ return {
219
+ instructionType: RlpInstruction.UpdateRoleHolder,
220
+ ...(0, instructions_1.parseUpdateRoleHolderInstruction)(instruction),
221
+ };
222
+ }
223
+ case RlpInstruction.Withdraw: {
224
+ (0, kit_1.assertIsInstructionWithAccounts)(instruction);
225
+ return {
226
+ instructionType: RlpInstruction.Withdraw,
227
+ ...(0, instructions_1.parseWithdrawInstruction)(instruction),
228
+ };
229
+ }
230
+ default:
231
+ throw new Error(`Unrecognized instruction type: ${instructionType}`);
232
+ }
233
+ }
@@ -0,0 +1,49 @@
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 { type AccountMeta, type AccountSignerMeta, type Address, type ProgramDerivedAddress, type TransactionSigner } from "@solana/kit";
9
+ /**
10
+ * Asserts that the given value is not null or undefined.
11
+ * @internal
12
+ */
13
+ export declare function expectSome<T>(value: T | null | undefined): T;
14
+ /**
15
+ * Asserts that the given value is a PublicKey.
16
+ * @internal
17
+ */
18
+ export declare function expectAddress<T extends string = string>(value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined): Address<T>;
19
+ /**
20
+ * Asserts that the given value is a PDA.
21
+ * @internal
22
+ */
23
+ export declare function expectProgramDerivedAddress<T extends string = string>(value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined): ProgramDerivedAddress<T>;
24
+ /**
25
+ * Asserts that the given value is a TransactionSigner.
26
+ * @internal
27
+ */
28
+ export declare function expectTransactionSigner<T extends string = string>(value: Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null | undefined): TransactionSigner<T>;
29
+ /**
30
+ * Defines an instruction account to resolve.
31
+ * @internal
32
+ */
33
+ export type ResolvedAccount<T extends string = string, U extends Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null = Address<T> | ProgramDerivedAddress<T> | TransactionSigner<T> | null> = {
34
+ isWritable: boolean;
35
+ value: U;
36
+ };
37
+ /**
38
+ * Defines an instruction that stores additional bytes on-chain.
39
+ * @internal
40
+ */
41
+ export type InstructionWithByteDelta = {
42
+ byteDelta: number;
43
+ };
44
+ /**
45
+ * Get account metas and signers from resolved accounts.
46
+ * @internal
47
+ */
48
+ export declare function getAccountMetaFactory(programAddress: Address, optionalAccountStrategy: "omitted" | "programId"): (account: ResolvedAccount) => AccountMeta | AccountSignerMeta | undefined;
49
+ export declare function isTransactionSigner<TAddress extends string = string>(value: Address<TAddress> | ProgramDerivedAddress<TAddress> | TransactionSigner<TAddress>): value is TransactionSigner<TAddress>;
@@ -0,0 +1,94 @@
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.expectSome = expectSome;
11
+ exports.expectAddress = expectAddress;
12
+ exports.expectProgramDerivedAddress = expectProgramDerivedAddress;
13
+ exports.expectTransactionSigner = expectTransactionSigner;
14
+ exports.getAccountMetaFactory = getAccountMetaFactory;
15
+ exports.isTransactionSigner = isTransactionSigner;
16
+ const kit_1 = require("@solana/kit");
17
+ /**
18
+ * Asserts that the given value is not null or undefined.
19
+ * @internal
20
+ */
21
+ function expectSome(value) {
22
+ if (value === null || value === undefined) {
23
+ throw new Error("Expected a value but received null or undefined.");
24
+ }
25
+ return value;
26
+ }
27
+ /**
28
+ * Asserts that the given value is a PublicKey.
29
+ * @internal
30
+ */
31
+ function expectAddress(value) {
32
+ if (!value) {
33
+ throw new Error("Expected a Address.");
34
+ }
35
+ if (typeof value === "object" && "address" in value) {
36
+ return value.address;
37
+ }
38
+ if (Array.isArray(value)) {
39
+ return value[0];
40
+ }
41
+ return value;
42
+ }
43
+ /**
44
+ * Asserts that the given value is a PDA.
45
+ * @internal
46
+ */
47
+ function expectProgramDerivedAddress(value) {
48
+ if (!value || !Array.isArray(value) || !(0, kit_1.isProgramDerivedAddress)(value)) {
49
+ throw new Error("Expected a ProgramDerivedAddress.");
50
+ }
51
+ return value;
52
+ }
53
+ /**
54
+ * Asserts that the given value is a TransactionSigner.
55
+ * @internal
56
+ */
57
+ function expectTransactionSigner(value) {
58
+ if (!value || !isTransactionSigner(value)) {
59
+ throw new Error("Expected a TransactionSigner.");
60
+ }
61
+ return value;
62
+ }
63
+ /**
64
+ * Get account metas and signers from resolved accounts.
65
+ * @internal
66
+ */
67
+ function getAccountMetaFactory(programAddress, optionalAccountStrategy) {
68
+ return (account) => {
69
+ if (!account.value) {
70
+ if (optionalAccountStrategy === "omitted")
71
+ return;
72
+ return Object.freeze({
73
+ address: programAddress,
74
+ role: kit_1.AccountRole.READONLY,
75
+ });
76
+ }
77
+ const writableRole = account.isWritable
78
+ ? kit_1.AccountRole.WRITABLE
79
+ : kit_1.AccountRole.READONLY;
80
+ return Object.freeze({
81
+ address: expectAddress(account.value),
82
+ role: isTransactionSigner(account.value)
83
+ ? (0, kit_1.upgradeRoleToSigner)(writableRole)
84
+ : writableRole,
85
+ ...(isTransactionSigner(account.value) ? { signer: account.value } : {}),
86
+ });
87
+ };
88
+ }
89
+ function isTransactionSigner(value) {
90
+ return (!!value &&
91
+ typeof value === "object" &&
92
+ "address" in value &&
93
+ (0, kit_1.isTransactionSigner)(value));
94
+ }
@@ -0,0 +1,20 @@
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 { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
9
+ import { type AccessMap, type AccessMapArgs, type KillSwitch, type KillSwitchArgs } from ".";
10
+ export type AccessControl = {
11
+ accessMap: AccessMap;
12
+ killswitch: KillSwitch;
13
+ };
14
+ export type AccessControlArgs = {
15
+ accessMap: AccessMapArgs;
16
+ killswitch: KillSwitchArgs;
17
+ };
18
+ export declare function getAccessControlEncoder(): FixedSizeEncoder<AccessControlArgs>;
19
+ export declare function getAccessControlDecoder(): FixedSizeDecoder<AccessControl>;
20
+ export declare function getAccessControlCodec(): FixedSizeCodec<AccessControlArgs, AccessControl>;
@@ -0,0 +1,29 @@
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.getAccessControlEncoder = getAccessControlEncoder;
11
+ exports.getAccessControlDecoder = getAccessControlDecoder;
12
+ exports.getAccessControlCodec = getAccessControlCodec;
13
+ const kit_1 = require("@solana/kit");
14
+ const _1 = require(".");
15
+ function getAccessControlEncoder() {
16
+ return (0, kit_1.getStructEncoder)([
17
+ ["accessMap", (0, _1.getAccessMapEncoder)()],
18
+ ["killswitch", (0, _1.getKillSwitchEncoder)()],
19
+ ]);
20
+ }
21
+ function getAccessControlDecoder() {
22
+ return (0, kit_1.getStructDecoder)([
23
+ ["accessMap", (0, _1.getAccessMapDecoder)()],
24
+ ["killswitch", (0, _1.getKillSwitchDecoder)()],
25
+ ]);
26
+ }
27
+ function getAccessControlCodec() {
28
+ return (0, kit_1.combineCodec)(getAccessControlEncoder(), getAccessControlDecoder());
29
+ }
@@ -0,0 +1,16 @@
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 { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
9
+ export declare enum AccessLevel {
10
+ Public = 0,
11
+ Private = 1
12
+ }
13
+ export type AccessLevelArgs = AccessLevel;
14
+ export declare function getAccessLevelEncoder(): FixedSizeEncoder<AccessLevelArgs>;
15
+ export declare function getAccessLevelDecoder(): FixedSizeDecoder<AccessLevel>;
16
+ export declare function getAccessLevelCodec(): FixedSizeCodec<AccessLevelArgs, AccessLevel>;
@@ -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
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AccessLevel = void 0;
11
+ exports.getAccessLevelEncoder = getAccessLevelEncoder;
12
+ exports.getAccessLevelDecoder = getAccessLevelDecoder;
13
+ exports.getAccessLevelCodec = getAccessLevelCodec;
14
+ const kit_1 = require("@solana/kit");
15
+ var AccessLevel;
16
+ (function (AccessLevel) {
17
+ AccessLevel[AccessLevel["Public"] = 0] = "Public";
18
+ AccessLevel[AccessLevel["Private"] = 1] = "Private";
19
+ })(AccessLevel || (exports.AccessLevel = AccessLevel = {}));
20
+ function getAccessLevelEncoder() {
21
+ return (0, kit_1.getEnumEncoder)(AccessLevel);
22
+ }
23
+ function getAccessLevelDecoder() {
24
+ return (0, kit_1.getEnumDecoder)(AccessLevel);
25
+ }
26
+ function getAccessLevelCodec() {
27
+ return (0, kit_1.combineCodec)(getAccessLevelEncoder(), getAccessLevelDecoder());
28
+ }
@@ -0,0 +1,20 @@
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 { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
9
+ import { type ActionMapping, type ActionMappingArgs } from ".";
10
+ export type AccessMap = {
11
+ actionPermissions: Array<ActionMapping>;
12
+ mappingCount: number;
13
+ };
14
+ export type AccessMapArgs = {
15
+ actionPermissions: Array<ActionMappingArgs>;
16
+ mappingCount: number;
17
+ };
18
+ export declare function getAccessMapEncoder(): FixedSizeEncoder<AccessMapArgs>;
19
+ export declare function getAccessMapDecoder(): FixedSizeDecoder<AccessMap>;
20
+ export declare function getAccessMapCodec(): FixedSizeCodec<AccessMapArgs, AccessMap>;
@@ -0,0 +1,35 @@
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.getAccessMapEncoder = getAccessMapEncoder;
11
+ exports.getAccessMapDecoder = getAccessMapDecoder;
12
+ exports.getAccessMapCodec = getAccessMapCodec;
13
+ const kit_1 = require("@solana/kit");
14
+ const _1 = require(".");
15
+ function getAccessMapEncoder() {
16
+ return (0, kit_1.getStructEncoder)([
17
+ [
18
+ "actionPermissions",
19
+ (0, kit_1.getArrayEncoder)((0, _1.getActionMappingEncoder)(), { size: 18 }),
20
+ ],
21
+ ["mappingCount", (0, kit_1.getU8Encoder)()],
22
+ ]);
23
+ }
24
+ function getAccessMapDecoder() {
25
+ return (0, kit_1.getStructDecoder)([
26
+ [
27
+ "actionPermissions",
28
+ (0, kit_1.getArrayDecoder)((0, _1.getActionMappingDecoder)(), { size: 18 }),
29
+ ],
30
+ ["mappingCount", (0, kit_1.getU8Decoder)()],
31
+ ]);
32
+ }
33
+ function getAccessMapCodec() {
34
+ return (0, kit_1.combineCodec)(getAccessMapEncoder(), getAccessMapDecoder());
35
+ }
@@ -0,0 +1,32 @@
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 { type FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder } from "@solana/kit";
9
+ export declare enum Action {
10
+ Deposit = 0,
11
+ Withdraw = 1,
12
+ Slash = 2,
13
+ Swap = 3,
14
+ FreezeDeposit = 4,
15
+ FreezeWithdraw = 5,
16
+ FreezeSlash = 6,
17
+ FreezeSwap = 7,
18
+ InitializeLiquidityPool = 8,
19
+ AddAsset = 9,
20
+ UpdateDepositCap = 10,
21
+ DepositRewards = 11,
22
+ Management = 12,
23
+ SuspendDeposits = 13,
24
+ UpdateRole = 14,
25
+ UpdateAction = 15,
26
+ UpdateOracle = 16,
27
+ RemovePoolAsset = 17
28
+ }
29
+ export type ActionArgs = Action;
30
+ export declare function getActionEncoder(): FixedSizeEncoder<ActionArgs>;
31
+ export declare function getActionDecoder(): FixedSizeDecoder<Action>;
32
+ export declare function getActionCodec(): FixedSizeCodec<ActionArgs, Action>;