@reflectmoney/stable.ts 1.1.6 → 1.1.8
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/dist/classes/Integration.d.ts +1 -0
- package/dist/classes/Integration.js +17 -0
- package/dist/classes/IntegrationController.d.ts +6 -0
- package/dist/classes/IntegrationController.js +6 -0
- package/dist/classes/ReflectKeeper.d.ts +14 -14
- package/dist/classes/ReflectKeeper.js +83 -97
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
class Integration {
|
|
13
|
+
load() {
|
|
14
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -41,25 +41,25 @@ export declare class ReflectKeeper {
|
|
|
41
41
|
*
|
|
42
42
|
* @param freeze - Whether to freeze (true) or unfreeze (false) the action
|
|
43
43
|
* @param action - The action to freeze/unfreeze
|
|
44
|
-
* @returns
|
|
44
|
+
* @returns TransactionInstruction
|
|
45
45
|
*/
|
|
46
|
-
freezeProtocolAction(freeze: boolean, action: Action):
|
|
46
|
+
freezeProtocolAction(freeze: boolean, action: Action): import("@solana/web3.js").TransactionInstruction;
|
|
47
47
|
/**
|
|
48
48
|
* Freezes or unfreezes a specific DEX program.
|
|
49
49
|
*
|
|
50
50
|
* @param freeze - Whether to freeze (true) or unfreeze (false) the program
|
|
51
51
|
* @param programIndex - Index of the program to freeze/unfreeze
|
|
52
|
-
* @returns
|
|
52
|
+
* @returns TransactionInstruction
|
|
53
53
|
*/
|
|
54
|
-
freezeDex(freeze: boolean, programIndex: number):
|
|
54
|
+
freezeDex(freeze: boolean, programIndex: number): import("@solana/web3.js").TransactionInstruction;
|
|
55
55
|
/**
|
|
56
56
|
* Creates a new admin account with specified permissions.
|
|
57
57
|
*
|
|
58
58
|
* @param signer - Public key of the caller (must be existing admin)
|
|
59
59
|
* @param newAdmin - Public key of the new admin to create
|
|
60
|
-
* @returns
|
|
60
|
+
* @returns TransactionInstruction
|
|
61
61
|
*/
|
|
62
|
-
createAdminAccount(signer: PublicKey, newAdmin: PublicKey, roles?: number):
|
|
62
|
+
createAdminAccount(signer: PublicKey, newAdmin: PublicKey, roles?: number): import("@solana/web3.js").TransactionInstruction;
|
|
63
63
|
/**
|
|
64
64
|
* Updates role holder permissions at the protocol level.
|
|
65
65
|
*
|
|
@@ -67,9 +67,9 @@ export declare class ReflectKeeper {
|
|
|
67
67
|
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
68
68
|
* @param affectedRole - The role being modified
|
|
69
69
|
* @param update - The type of update (Grant or Revoke)
|
|
70
|
-
* @returns
|
|
70
|
+
* @returns TransactionInstruction
|
|
71
71
|
*/
|
|
72
|
-
updateRoleHolderProtocol(signer: PublicKey, adminToUpdate: PublicKey, affectedRole: Role, update: Update):
|
|
72
|
+
updateRoleHolderProtocol(signer: PublicKey, adminToUpdate: PublicKey, affectedRole: Role, update: Update): import("@solana/web3.js").TransactionInstruction;
|
|
73
73
|
/**
|
|
74
74
|
* Updates role holder permissions for a specific strategy.
|
|
75
75
|
*
|
|
@@ -78,9 +78,9 @@ export declare class ReflectKeeper {
|
|
|
78
78
|
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
79
79
|
* @param affectedRole - The role being modified
|
|
80
80
|
* @param update - The type of update (Grant or Revoke)
|
|
81
|
-
* @returns
|
|
81
|
+
* @returns TransactionInstruction
|
|
82
82
|
*/
|
|
83
|
-
updateRoleHolderStrategy(signer: PublicKey, strategyId: number, adminToUpdate: PublicKey, affectedRole: Role, update: Update):
|
|
83
|
+
updateRoleHolderStrategy(signer: PublicKey, strategyId: number, adminToUpdate: PublicKey, affectedRole: Role, update: Update): import("@solana/web3.js").TransactionInstruction;
|
|
84
84
|
/**
|
|
85
85
|
* Updates action role permissions for a specific strategy.
|
|
86
86
|
*
|
|
@@ -89,9 +89,9 @@ export declare class ReflectKeeper {
|
|
|
89
89
|
* @param action - The action being modified
|
|
90
90
|
* @param affectedRole - The role being modified
|
|
91
91
|
* @param update - The type of update (Grant or Revoke)
|
|
92
|
-
* @returns
|
|
92
|
+
* @returns TransactionInstruction
|
|
93
93
|
*/
|
|
94
|
-
updateActionRoleStrategy(signer: PublicKey, strategyId: number, action: Action, affectedRole: Role, update: Update):
|
|
94
|
+
updateActionRoleStrategy(signer: PublicKey, strategyId: number, action: Action, affectedRole: Role, update: Update): import("@solana/web3.js").TransactionInstruction;
|
|
95
95
|
/**
|
|
96
96
|
* Updates action role permissions at the protocol level.
|
|
97
97
|
*
|
|
@@ -99,7 +99,7 @@ export declare class ReflectKeeper {
|
|
|
99
99
|
* @param action - The action being modified
|
|
100
100
|
* @param affectedRole - The role being modified
|
|
101
101
|
* @param update - The type of update (Grant or Revoke)
|
|
102
|
-
* @returns
|
|
102
|
+
* @returns TransactionInstruction
|
|
103
103
|
*/
|
|
104
|
-
updateActionRoleProtocol(signer: PublicKey, action: Action, affectedRole: Role, update: Update):
|
|
104
|
+
updateActionRoleProtocol(signer: PublicKey, action: Action, affectedRole: Role, update: Update): import("@solana/web3.js").TransactionInstruction;
|
|
105
105
|
}
|
|
@@ -64,62 +64,56 @@ class ReflectKeeper {
|
|
|
64
64
|
*
|
|
65
65
|
* @param freeze - Whether to freeze (true) or unfreeze (false) the action
|
|
66
66
|
* @param action - The action to freeze/unfreeze
|
|
67
|
-
* @returns
|
|
67
|
+
* @returns TransactionInstruction
|
|
68
68
|
*/
|
|
69
69
|
freezeProtocolAction(freeze, action) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
action
|
|
79
|
-
});
|
|
80
|
-
return ix;
|
|
70
|
+
const ix = (0, reflect_main_1.createFreezeProtocolActionInstruction)({
|
|
71
|
+
admin: this.admin,
|
|
72
|
+
main: this.main,
|
|
73
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
74
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(this.admin),
|
|
75
|
+
}, {
|
|
76
|
+
freeze,
|
|
77
|
+
action
|
|
81
78
|
});
|
|
79
|
+
return ix;
|
|
82
80
|
}
|
|
83
81
|
/**
|
|
84
82
|
* Freezes or unfreezes a specific DEX program.
|
|
85
83
|
*
|
|
86
84
|
* @param freeze - Whether to freeze (true) or unfreeze (false) the program
|
|
87
85
|
* @param programIndex - Index of the program to freeze/unfreeze
|
|
88
|
-
* @returns
|
|
86
|
+
* @returns TransactionInstruction
|
|
89
87
|
*/
|
|
90
88
|
freezeDex(freeze, programIndex) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
programIndex
|
|
100
|
-
});
|
|
101
|
-
return ix;
|
|
89
|
+
const ix = (0, reflect_main_1.createFreezeProgramInstruction)({
|
|
90
|
+
admin: this.admin,
|
|
91
|
+
main: this.main,
|
|
92
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
93
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(this.admin),
|
|
94
|
+
}, {
|
|
95
|
+
freeze,
|
|
96
|
+
programIndex
|
|
102
97
|
});
|
|
98
|
+
return ix;
|
|
103
99
|
}
|
|
104
100
|
/**
|
|
105
101
|
* Creates a new admin account with specified permissions.
|
|
106
102
|
*
|
|
107
103
|
* @param signer - Public key of the caller (must be existing admin)
|
|
108
104
|
* @param newAdmin - Public key of the new admin to create
|
|
109
|
-
* @returns
|
|
105
|
+
* @returns TransactionInstruction
|
|
110
106
|
*/
|
|
111
|
-
createAdminAccount(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return ix;
|
|
122
|
-
});
|
|
107
|
+
createAdminAccount(signer, newAdmin, roles = 18) {
|
|
108
|
+
const ix = (0, reflect_main_1.createCreateAdminAccountInstruction)({
|
|
109
|
+
caller: signer,
|
|
110
|
+
newCreds: PdaClient_1.PdaClient.derivePermissions(newAdmin),
|
|
111
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
112
|
+
}, {
|
|
113
|
+
newAdmin,
|
|
114
|
+
roles
|
|
115
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
116
|
+
return ix;
|
|
123
117
|
}
|
|
124
118
|
/**
|
|
125
119
|
* Updates role holder permissions at the protocol level.
|
|
@@ -128,24 +122,22 @@ class ReflectKeeper {
|
|
|
128
122
|
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
129
123
|
* @param affectedRole - The role being modified
|
|
130
124
|
* @param update - The type of update (Grant or Revoke)
|
|
131
|
-
* @returns
|
|
125
|
+
* @returns TransactionInstruction
|
|
132
126
|
*/
|
|
133
127
|
updateRoleHolderProtocol(signer, adminToUpdate, affectedRole, update) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
return ix;
|
|
148
|
-
});
|
|
128
|
+
const ix = (0, reflect_main_1.createUpdateRoleHolderProtocolInstruction)({
|
|
129
|
+
admin: signer,
|
|
130
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(signer),
|
|
131
|
+
main: PdaClient_1.PdaClient.deriveMain(),
|
|
132
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
133
|
+
updateAdminPermissions: PdaClient_1.PdaClient.derivePermissions(adminToUpdate),
|
|
134
|
+
// Dummy strategy account.
|
|
135
|
+
strategy: PdaClient_1.PdaClient.deriveController(0)
|
|
136
|
+
}, {
|
|
137
|
+
update,
|
|
138
|
+
accessLevel: affectedRole,
|
|
139
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
140
|
+
return ix;
|
|
149
141
|
}
|
|
150
142
|
/**
|
|
151
143
|
* Updates role holder permissions for a specific strategy.
|
|
@@ -155,23 +147,21 @@ class ReflectKeeper {
|
|
|
155
147
|
* @param adminToUpdate - Public key of the admin whose permissions are being updated
|
|
156
148
|
* @param affectedRole - The role being modified
|
|
157
149
|
* @param update - The type of update (Grant or Revoke)
|
|
158
|
-
* @returns
|
|
150
|
+
* @returns TransactionInstruction
|
|
159
151
|
*/
|
|
160
152
|
updateRoleHolderStrategy(signer, strategyId, adminToUpdate, affectedRole, update) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return ix;
|
|
174
|
-
});
|
|
153
|
+
const ix = (0, reflect_main_1.createUpdateRoleHolderStrategyInstruction)({
|
|
154
|
+
admin: signer,
|
|
155
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(signer),
|
|
156
|
+
main: PdaClient_1.PdaClient.deriveMain(),
|
|
157
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
158
|
+
updateAdminPermissions: PdaClient_1.PdaClient.derivePermissions(adminToUpdate),
|
|
159
|
+
strategy: PdaClient_1.PdaClient.deriveController(strategyId)
|
|
160
|
+
}, {
|
|
161
|
+
update,
|
|
162
|
+
role: affectedRole,
|
|
163
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
164
|
+
return ix;
|
|
175
165
|
}
|
|
176
166
|
/**
|
|
177
167
|
* Updates action role permissions for a specific strategy.
|
|
@@ -181,23 +171,21 @@ class ReflectKeeper {
|
|
|
181
171
|
* @param action - The action being modified
|
|
182
172
|
* @param affectedRole - The role being modified
|
|
183
173
|
* @param update - The type of update (Grant or Revoke)
|
|
184
|
-
* @returns
|
|
174
|
+
* @returns TransactionInstruction
|
|
185
175
|
*/
|
|
186
176
|
updateActionRoleStrategy(signer, strategyId, action, affectedRole, update) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return ix;
|
|
200
|
-
});
|
|
177
|
+
const ix = (0, reflect_main_1.createUpdateActionRoleStrategyInstruction)({
|
|
178
|
+
admin: signer,
|
|
179
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(signer),
|
|
180
|
+
main: PdaClient_1.PdaClient.deriveMain(),
|
|
181
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
182
|
+
strategy: PdaClient_1.PdaClient.deriveController(strategyId)
|
|
183
|
+
}, {
|
|
184
|
+
update,
|
|
185
|
+
role: affectedRole,
|
|
186
|
+
action
|
|
187
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
188
|
+
return ix;
|
|
201
189
|
}
|
|
202
190
|
/**
|
|
203
191
|
* Updates action role permissions at the protocol level.
|
|
@@ -206,22 +194,20 @@ class ReflectKeeper {
|
|
|
206
194
|
* @param action - The action being modified
|
|
207
195
|
* @param affectedRole - The role being modified
|
|
208
196
|
* @param update - The type of update (Grant or Revoke)
|
|
209
|
-
* @returns
|
|
197
|
+
* @returns TransactionInstruction
|
|
210
198
|
*/
|
|
211
199
|
updateActionRoleProtocol(signer, action, affectedRole, update) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
return ix;
|
|
224
|
-
});
|
|
200
|
+
const ix = (0, reflect_main_1.createUpdateActionRoleProtocolInstruction)({
|
|
201
|
+
admin: signer,
|
|
202
|
+
adminPermissions: PdaClient_1.PdaClient.derivePermissions(signer),
|
|
203
|
+
main: PdaClient_1.PdaClient.deriveMain(),
|
|
204
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
205
|
+
}, {
|
|
206
|
+
action,
|
|
207
|
+
role: affectedRole,
|
|
208
|
+
update
|
|
209
|
+
}, reflect_main_1.PROGRAM_ID);
|
|
210
|
+
return ix;
|
|
225
211
|
}
|
|
226
212
|
}
|
|
227
213
|
exports.ReflectKeeper = ReflectKeeper;
|