@voltr/vault-sdk 2.1.0 → 2.1.1
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/extensions/adaptors.d.ts +9 -0
- package/dist/extensions/adaptors.d.ts.map +1 -0
- package/dist/extensions/adaptors.js +20 -0
- package/dist/extensions/adaptors.js.map +1 -0
- package/dist/extensions/events.d.ts +2 -2
- package/dist/extensions/events.d.ts.map +1 -1
- package/dist/extensions/events.js +5 -0
- package/dist/extensions/events.js.map +1 -1
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +1 -0
- package/dist/extensions/index.js.map +1 -1
- package/dist/generated/accounts/protocol.d.ts +6 -6
- package/dist/generated/accounts/protocol.d.ts.map +1 -1
- package/dist/generated/accounts/protocol.js +2 -2
- package/dist/generated/accounts/protocol.js.map +1 -1
- package/dist/generated/accounts/vault.d.ts +6 -2
- package/dist/generated/accounts/vault.d.ts.map +1 -1
- package/dist/generated/accounts/vault.js +4 -2
- package/dist/generated/accounts/vault.js.map +1 -1
- package/dist/generated/errors/voltrVault.d.ts +5 -1
- package/dist/generated/errors/voltrVault.d.ts.map +1 -1
- package/dist/generated/errors/voltrVault.js +7 -1
- package/dist/generated/errors/voltrVault.js.map +1 -1
- package/dist/generated/instructions/harvestFee.d.ts +15 -15
- package/dist/generated/instructions/harvestFee.d.ts.map +1 -1
- package/dist/generated/instructions/harvestFee.js +21 -15
- package/dist/generated/instructions/harvestFee.js.map +1 -1
- package/dist/generated/instructions/index.d.ts +1 -0
- package/dist/generated/instructions/index.d.ts.map +1 -1
- package/dist/generated/instructions/index.js +1 -0
- package/dist/generated/instructions/index.js.map +1 -1
- package/dist/generated/instructions/initProtocol.d.ts +4 -0
- package/dist/generated/instructions/initProtocol.d.ts.map +1 -1
- package/dist/generated/instructions/initProtocol.js +2 -0
- package/dist/generated/instructions/initProtocol.js.map +1 -1
- package/dist/generated/instructions/updateVaultAdaptorPolicy.d.ts +56 -0
- package/dist/generated/instructions/updateVaultAdaptorPolicy.d.ts.map +1 -0
- package/dist/generated/instructions/updateVaultAdaptorPolicy.js +119 -0
- package/dist/generated/instructions/updateVaultAdaptorPolicy.js.map +1 -0
- package/dist/generated/programs/voltrVault.d.ts +9 -5
- package/dist/generated/programs/voltrVault.d.ts.map +1 -1
- package/dist/generated/programs/voltrVault.js +16 -4
- package/dist/generated/programs/voltrVault.js.map +1 -1
- package/dist/generated/types/index.d.ts +1 -0
- package/dist/generated/types/index.d.ts.map +1 -1
- package/dist/generated/types/index.js +1 -0
- package/dist/generated/types/index.js.map +1 -1
- package/dist/generated/types/initProtocolEvent.d.ts +2 -0
- package/dist/generated/types/initProtocolEvent.d.ts.map +1 -1
- package/dist/generated/types/initProtocolEvent.js +2 -0
- package/dist/generated/types/initProtocolEvent.js.map +1 -1
- package/dist/generated/types/protocolConfigField.d.ts +2 -1
- package/dist/generated/types/protocolConfigField.d.ts.map +1 -1
- package/dist/generated/types/protocolConfigField.js +1 -0
- package/dist/generated/types/protocolConfigField.js.map +1 -1
- package/dist/generated/types/updateVaultAdaptorPolicyEvent.d.ts +28 -0
- package/dist/generated/types/updateVaultAdaptorPolicyEvent.d.ts.map +1 -0
- package/dist/generated/types/updateVaultAdaptorPolicyEvent.js +37 -0
- package/dist/generated/types/updateVaultAdaptorPolicyEvent.js.map +1 -0
- package/package.json +1 -1
- package/src/extensions/adaptors.ts +35 -0
- package/src/extensions/events.ts +11 -0
- package/src/extensions/index.ts +1 -0
- package/src/generated/accounts/protocol.ts +8 -8
- package/src/generated/accounts/vault.ts +10 -4
- package/src/generated/errors/voltrVault.ts +8 -0
- package/src/generated/instructions/harvestFee.ts +56 -50
- package/src/generated/instructions/index.ts +1 -0
- package/src/generated/instructions/initProtocol.ts +11 -1
- package/src/generated/instructions/updateVaultAdaptorPolicy.ts +301 -0
- package/src/generated/programs/voltrVault.ts +35 -0
- package/src/generated/types/index.ts +1 -0
- package/src/generated/types/initProtocolEvent.ts +4 -0
- package/src/generated/types/protocolConfigField.ts +1 -0
- package/src/generated/types/updateVaultAdaptorPolicyEvent.ts +79 -0
|
@@ -0,0 +1,301 @@
|
|
|
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
|
+
|
|
9
|
+
import {
|
|
10
|
+
combineCodec,
|
|
11
|
+
fixDecoderSize,
|
|
12
|
+
fixEncoderSize,
|
|
13
|
+
getBytesDecoder,
|
|
14
|
+
getBytesEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
getU8Decoder,
|
|
18
|
+
getU8Encoder,
|
|
19
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
20
|
+
SolanaError,
|
|
21
|
+
transformEncoder,
|
|
22
|
+
type AccountMeta,
|
|
23
|
+
type AccountSignerMeta,
|
|
24
|
+
type Address,
|
|
25
|
+
type FixedSizeCodec,
|
|
26
|
+
type FixedSizeDecoder,
|
|
27
|
+
type FixedSizeEncoder,
|
|
28
|
+
type Instruction,
|
|
29
|
+
type InstructionWithAccounts,
|
|
30
|
+
type InstructionWithData,
|
|
31
|
+
type ReadonlyAccount,
|
|
32
|
+
type ReadonlySignerAccount,
|
|
33
|
+
type ReadonlyUint8Array,
|
|
34
|
+
type TransactionSigner,
|
|
35
|
+
type WritableAccount,
|
|
36
|
+
} from "@solana/kit";
|
|
37
|
+
import {
|
|
38
|
+
getAccountMetaFactory,
|
|
39
|
+
type ResolvedInstructionAccount,
|
|
40
|
+
} from "@solana/program-client-core";
|
|
41
|
+
import { findProtocolPda } from "../pdas";
|
|
42
|
+
import { VOLTR_VAULT_PROGRAM_ADDRESS } from "../programs";
|
|
43
|
+
|
|
44
|
+
export const UPDATE_VAULT_ADAPTOR_POLICY_DISCRIMINATOR = new Uint8Array([
|
|
45
|
+
20, 101, 232, 123, 189, 18, 133, 230,
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
export function getUpdateVaultAdaptorPolicyDiscriminatorBytes() {
|
|
49
|
+
return fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
50
|
+
UPDATE_VAULT_ADAPTOR_POLICY_DISCRIMINATOR,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type UpdateVaultAdaptorPolicyInstruction<
|
|
55
|
+
TProgram extends string = typeof VOLTR_VAULT_PROGRAM_ADDRESS,
|
|
56
|
+
TAccountAdmin extends string | AccountMeta<string> = string,
|
|
57
|
+
TAccountProtocol extends string | AccountMeta<string> = string,
|
|
58
|
+
TAccountVault extends string | AccountMeta<string> = string,
|
|
59
|
+
TRemainingAccounts extends readonly AccountMeta<string>[] = [],
|
|
60
|
+
> = Instruction<TProgram> &
|
|
61
|
+
InstructionWithData<ReadonlyUint8Array> &
|
|
62
|
+
InstructionWithAccounts<
|
|
63
|
+
[
|
|
64
|
+
TAccountAdmin extends string
|
|
65
|
+
? ReadonlySignerAccount<TAccountAdmin> &
|
|
66
|
+
AccountSignerMeta<TAccountAdmin>
|
|
67
|
+
: TAccountAdmin,
|
|
68
|
+
TAccountProtocol extends string
|
|
69
|
+
? ReadonlyAccount<TAccountProtocol>
|
|
70
|
+
: TAccountProtocol,
|
|
71
|
+
TAccountVault extends string
|
|
72
|
+
? WritableAccount<TAccountVault>
|
|
73
|
+
: TAccountVault,
|
|
74
|
+
...TRemainingAccounts,
|
|
75
|
+
]
|
|
76
|
+
>;
|
|
77
|
+
|
|
78
|
+
export type UpdateVaultAdaptorPolicyInstructionData = {
|
|
79
|
+
discriminator: ReadonlyUint8Array;
|
|
80
|
+
allowAnyAdaptor: number;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type UpdateVaultAdaptorPolicyInstructionDataArgs = {
|
|
84
|
+
allowAnyAdaptor: number;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export function getUpdateVaultAdaptorPolicyInstructionDataEncoder(): FixedSizeEncoder<UpdateVaultAdaptorPolicyInstructionDataArgs> {
|
|
88
|
+
return transformEncoder(
|
|
89
|
+
getStructEncoder([
|
|
90
|
+
["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
|
|
91
|
+
["allowAnyAdaptor", getU8Encoder()],
|
|
92
|
+
]),
|
|
93
|
+
(value) => ({
|
|
94
|
+
...value,
|
|
95
|
+
discriminator: UPDATE_VAULT_ADAPTOR_POLICY_DISCRIMINATOR,
|
|
96
|
+
}),
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getUpdateVaultAdaptorPolicyInstructionDataDecoder(): FixedSizeDecoder<UpdateVaultAdaptorPolicyInstructionData> {
|
|
101
|
+
return getStructDecoder([
|
|
102
|
+
["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
|
|
103
|
+
["allowAnyAdaptor", getU8Decoder()],
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getUpdateVaultAdaptorPolicyInstructionDataCodec(): FixedSizeCodec<
|
|
108
|
+
UpdateVaultAdaptorPolicyInstructionDataArgs,
|
|
109
|
+
UpdateVaultAdaptorPolicyInstructionData
|
|
110
|
+
> {
|
|
111
|
+
return combineCodec(
|
|
112
|
+
getUpdateVaultAdaptorPolicyInstructionDataEncoder(),
|
|
113
|
+
getUpdateVaultAdaptorPolicyInstructionDataDecoder(),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type UpdateVaultAdaptorPolicyAsyncInput<
|
|
118
|
+
TAccountAdmin extends string = string,
|
|
119
|
+
TAccountProtocol extends string = string,
|
|
120
|
+
TAccountVault extends string = string,
|
|
121
|
+
> = {
|
|
122
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
123
|
+
protocol?: Address<TAccountProtocol>;
|
|
124
|
+
vault: Address<TAccountVault>;
|
|
125
|
+
allowAnyAdaptor: UpdateVaultAdaptorPolicyInstructionDataArgs["allowAnyAdaptor"];
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export async function getUpdateVaultAdaptorPolicyInstructionAsync<
|
|
129
|
+
TAccountAdmin extends string,
|
|
130
|
+
TAccountProtocol extends string,
|
|
131
|
+
TAccountVault extends string,
|
|
132
|
+
TProgramAddress extends Address = typeof VOLTR_VAULT_PROGRAM_ADDRESS,
|
|
133
|
+
>(
|
|
134
|
+
input: UpdateVaultAdaptorPolicyAsyncInput<
|
|
135
|
+
TAccountAdmin,
|
|
136
|
+
TAccountProtocol,
|
|
137
|
+
TAccountVault
|
|
138
|
+
>,
|
|
139
|
+
config?: { programAddress?: TProgramAddress },
|
|
140
|
+
): Promise<
|
|
141
|
+
UpdateVaultAdaptorPolicyInstruction<
|
|
142
|
+
TProgramAddress,
|
|
143
|
+
TAccountAdmin,
|
|
144
|
+
TAccountProtocol,
|
|
145
|
+
TAccountVault
|
|
146
|
+
>
|
|
147
|
+
> {
|
|
148
|
+
// Program address.
|
|
149
|
+
const programAddress = config?.programAddress ?? VOLTR_VAULT_PROGRAM_ADDRESS;
|
|
150
|
+
|
|
151
|
+
// Original accounts.
|
|
152
|
+
const originalAccounts = {
|
|
153
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
154
|
+
protocol: { value: input.protocol ?? null, isWritable: false },
|
|
155
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
156
|
+
};
|
|
157
|
+
const accounts = originalAccounts as Record<
|
|
158
|
+
keyof typeof originalAccounts,
|
|
159
|
+
ResolvedInstructionAccount
|
|
160
|
+
>;
|
|
161
|
+
|
|
162
|
+
// Original args.
|
|
163
|
+
const args = { ...input };
|
|
164
|
+
|
|
165
|
+
// Resolve default values.
|
|
166
|
+
if (!accounts.protocol.value) {
|
|
167
|
+
accounts.protocol.value = await findProtocolPda();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
171
|
+
return Object.freeze({
|
|
172
|
+
accounts: [
|
|
173
|
+
getAccountMeta("admin", accounts.admin),
|
|
174
|
+
getAccountMeta("protocol", accounts.protocol),
|
|
175
|
+
getAccountMeta("vault", accounts.vault),
|
|
176
|
+
],
|
|
177
|
+
data: getUpdateVaultAdaptorPolicyInstructionDataEncoder().encode(
|
|
178
|
+
args as UpdateVaultAdaptorPolicyInstructionDataArgs,
|
|
179
|
+
),
|
|
180
|
+
programAddress,
|
|
181
|
+
} as UpdateVaultAdaptorPolicyInstruction<
|
|
182
|
+
TProgramAddress,
|
|
183
|
+
TAccountAdmin,
|
|
184
|
+
TAccountProtocol,
|
|
185
|
+
TAccountVault
|
|
186
|
+
>);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export type UpdateVaultAdaptorPolicyInput<
|
|
190
|
+
TAccountAdmin extends string = string,
|
|
191
|
+
TAccountProtocol extends string = string,
|
|
192
|
+
TAccountVault extends string = string,
|
|
193
|
+
> = {
|
|
194
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
195
|
+
protocol: Address<TAccountProtocol>;
|
|
196
|
+
vault: Address<TAccountVault>;
|
|
197
|
+
allowAnyAdaptor: UpdateVaultAdaptorPolicyInstructionDataArgs["allowAnyAdaptor"];
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export function getUpdateVaultAdaptorPolicyInstruction<
|
|
201
|
+
TAccountAdmin extends string,
|
|
202
|
+
TAccountProtocol extends string,
|
|
203
|
+
TAccountVault extends string,
|
|
204
|
+
TProgramAddress extends Address = typeof VOLTR_VAULT_PROGRAM_ADDRESS,
|
|
205
|
+
>(
|
|
206
|
+
input: UpdateVaultAdaptorPolicyInput<
|
|
207
|
+
TAccountAdmin,
|
|
208
|
+
TAccountProtocol,
|
|
209
|
+
TAccountVault
|
|
210
|
+
>,
|
|
211
|
+
config?: { programAddress?: TProgramAddress },
|
|
212
|
+
): UpdateVaultAdaptorPolicyInstruction<
|
|
213
|
+
TProgramAddress,
|
|
214
|
+
TAccountAdmin,
|
|
215
|
+
TAccountProtocol,
|
|
216
|
+
TAccountVault
|
|
217
|
+
> {
|
|
218
|
+
// Program address.
|
|
219
|
+
const programAddress = config?.programAddress ?? VOLTR_VAULT_PROGRAM_ADDRESS;
|
|
220
|
+
|
|
221
|
+
// Original accounts.
|
|
222
|
+
const originalAccounts = {
|
|
223
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
224
|
+
protocol: { value: input.protocol ?? null, isWritable: false },
|
|
225
|
+
vault: { value: input.vault ?? null, isWritable: true },
|
|
226
|
+
};
|
|
227
|
+
const accounts = originalAccounts as Record<
|
|
228
|
+
keyof typeof originalAccounts,
|
|
229
|
+
ResolvedInstructionAccount
|
|
230
|
+
>;
|
|
231
|
+
|
|
232
|
+
// Original args.
|
|
233
|
+
const args = { ...input };
|
|
234
|
+
|
|
235
|
+
const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
|
|
236
|
+
return Object.freeze({
|
|
237
|
+
accounts: [
|
|
238
|
+
getAccountMeta("admin", accounts.admin),
|
|
239
|
+
getAccountMeta("protocol", accounts.protocol),
|
|
240
|
+
getAccountMeta("vault", accounts.vault),
|
|
241
|
+
],
|
|
242
|
+
data: getUpdateVaultAdaptorPolicyInstructionDataEncoder().encode(
|
|
243
|
+
args as UpdateVaultAdaptorPolicyInstructionDataArgs,
|
|
244
|
+
),
|
|
245
|
+
programAddress,
|
|
246
|
+
} as UpdateVaultAdaptorPolicyInstruction<
|
|
247
|
+
TProgramAddress,
|
|
248
|
+
TAccountAdmin,
|
|
249
|
+
TAccountProtocol,
|
|
250
|
+
TAccountVault
|
|
251
|
+
>);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export type ParsedUpdateVaultAdaptorPolicyInstruction<
|
|
255
|
+
TProgram extends string = typeof VOLTR_VAULT_PROGRAM_ADDRESS,
|
|
256
|
+
TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[],
|
|
257
|
+
> = {
|
|
258
|
+
programAddress: Address<TProgram>;
|
|
259
|
+
accounts: {
|
|
260
|
+
admin: TAccountMetas[0];
|
|
261
|
+
protocol: TAccountMetas[1];
|
|
262
|
+
vault: TAccountMetas[2];
|
|
263
|
+
};
|
|
264
|
+
data: UpdateVaultAdaptorPolicyInstructionData;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export function parseUpdateVaultAdaptorPolicyInstruction<
|
|
268
|
+
TProgram extends string,
|
|
269
|
+
TAccountMetas extends readonly AccountMeta[],
|
|
270
|
+
>(
|
|
271
|
+
instruction: Instruction<TProgram> &
|
|
272
|
+
InstructionWithAccounts<TAccountMetas> &
|
|
273
|
+
InstructionWithData<ReadonlyUint8Array>,
|
|
274
|
+
): ParsedUpdateVaultAdaptorPolicyInstruction<TProgram, TAccountMetas> {
|
|
275
|
+
if (instruction.accounts.length < 3) {
|
|
276
|
+
throw new SolanaError(
|
|
277
|
+
SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
|
|
278
|
+
{
|
|
279
|
+
actualAccountMetas: instruction.accounts.length,
|
|
280
|
+
expectedAccountMetas: 3,
|
|
281
|
+
},
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
let accountIndex = 0;
|
|
285
|
+
const getNextAccount = () => {
|
|
286
|
+
const accountMeta = (instruction.accounts as TAccountMetas)[accountIndex]!;
|
|
287
|
+
accountIndex += 1;
|
|
288
|
+
return accountMeta;
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
programAddress: instruction.programAddress,
|
|
292
|
+
accounts: {
|
|
293
|
+
admin: getNextAccount(),
|
|
294
|
+
protocol: getNextAccount(),
|
|
295
|
+
vault: getNextAccount(),
|
|
296
|
+
},
|
|
297
|
+
data: getUpdateVaultAdaptorPolicyInstructionDataDecoder().decode(
|
|
298
|
+
instruction.data,
|
|
299
|
+
),
|
|
300
|
+
};
|
|
301
|
+
}
|
|
@@ -76,6 +76,7 @@ import {
|
|
|
76
76
|
getRemoveAdaptorInstructionAsync,
|
|
77
77
|
getRequestWithdrawVaultInstructionAsync,
|
|
78
78
|
getUpdateProtocolInstructionAsync,
|
|
79
|
+
getUpdateVaultAdaptorPolicyInstructionAsync,
|
|
79
80
|
getUpdateVaultConfigInstructionAsync,
|
|
80
81
|
getUpdateVaultProtocolFeeInstructionAsync,
|
|
81
82
|
getWithdrawStrategyInstructionAsync,
|
|
@@ -103,6 +104,7 @@ import {
|
|
|
103
104
|
parseRemoveAdaptorInstruction,
|
|
104
105
|
parseRequestWithdrawVaultInstruction,
|
|
105
106
|
parseUpdateProtocolInstruction,
|
|
107
|
+
parseUpdateVaultAdaptorPolicyInstruction,
|
|
106
108
|
parseUpdateVaultConfigInstruction,
|
|
107
109
|
parseUpdateVaultProtocolFeeInstruction,
|
|
108
110
|
parseWithdrawStrategyInstruction,
|
|
@@ -150,6 +152,7 @@ import {
|
|
|
150
152
|
type ParsedRemoveAdaptorInstruction,
|
|
151
153
|
type ParsedRequestWithdrawVaultInstruction,
|
|
152
154
|
type ParsedUpdateProtocolInstruction,
|
|
155
|
+
type ParsedUpdateVaultAdaptorPolicyInstruction,
|
|
153
156
|
type ParsedUpdateVaultConfigInstruction,
|
|
154
157
|
type ParsedUpdateVaultProtocolFeeInstruction,
|
|
155
158
|
type ParsedWithdrawStrategyInstruction,
|
|
@@ -157,6 +160,7 @@ import {
|
|
|
157
160
|
type RemoveAdaptorAsyncInput,
|
|
158
161
|
type RequestWithdrawVaultAsyncInput,
|
|
159
162
|
type UpdateProtocolAsyncInput,
|
|
163
|
+
type UpdateVaultAdaptorPolicyAsyncInput,
|
|
160
164
|
type UpdateVaultConfigAsyncInput,
|
|
161
165
|
type UpdateVaultProtocolFeeAsyncInput,
|
|
162
166
|
type WithdrawStrategyAsyncInput,
|
|
@@ -286,6 +290,7 @@ export enum VoltrVaultInstruction {
|
|
|
286
290
|
RemoveAdaptor,
|
|
287
291
|
RequestWithdrawVault,
|
|
288
292
|
UpdateProtocol,
|
|
293
|
+
UpdateVaultAdaptorPolicy,
|
|
289
294
|
UpdateVaultConfig,
|
|
290
295
|
UpdateVaultProtocolFee,
|
|
291
296
|
WithdrawStrategy,
|
|
@@ -549,6 +554,17 @@ export function identifyVoltrVaultInstruction(
|
|
|
549
554
|
) {
|
|
550
555
|
return VoltrVaultInstruction.UpdateProtocol;
|
|
551
556
|
}
|
|
557
|
+
if (
|
|
558
|
+
containsBytes(
|
|
559
|
+
data,
|
|
560
|
+
fixEncoderSize(getBytesEncoder(), 8).encode(
|
|
561
|
+
new Uint8Array([20, 101, 232, 123, 189, 18, 133, 230]),
|
|
562
|
+
),
|
|
563
|
+
0,
|
|
564
|
+
)
|
|
565
|
+
) {
|
|
566
|
+
return VoltrVaultInstruction.UpdateVaultAdaptorPolicy;
|
|
567
|
+
}
|
|
552
568
|
if (
|
|
553
569
|
containsBytes(
|
|
554
570
|
data,
|
|
@@ -671,6 +687,9 @@ export type ParsedVoltrVaultInstruction<
|
|
|
671
687
|
| ({
|
|
672
688
|
instructionType: VoltrVaultInstruction.UpdateProtocol;
|
|
673
689
|
} & ParsedUpdateProtocolInstruction<TProgram>)
|
|
690
|
+
| ({
|
|
691
|
+
instructionType: VoltrVaultInstruction.UpdateVaultAdaptorPolicy;
|
|
692
|
+
} & ParsedUpdateVaultAdaptorPolicyInstruction<TProgram>)
|
|
674
693
|
| ({
|
|
675
694
|
instructionType: VoltrVaultInstruction.UpdateVaultConfig;
|
|
676
695
|
} & ParsedUpdateVaultConfigInstruction<TProgram>)
|
|
@@ -852,6 +871,13 @@ export function parseVoltrVaultInstruction<TProgram extends string>(
|
|
|
852
871
|
...parseUpdateProtocolInstruction(instruction),
|
|
853
872
|
};
|
|
854
873
|
}
|
|
874
|
+
case VoltrVaultInstruction.UpdateVaultAdaptorPolicy: {
|
|
875
|
+
assertIsInstructionWithAccounts(instruction);
|
|
876
|
+
return {
|
|
877
|
+
instructionType: VoltrVaultInstruction.UpdateVaultAdaptorPolicy,
|
|
878
|
+
...parseUpdateVaultAdaptorPolicyInstruction(instruction),
|
|
879
|
+
};
|
|
880
|
+
}
|
|
855
881
|
case VoltrVaultInstruction.UpdateVaultConfig: {
|
|
856
882
|
assertIsInstructionWithAccounts(instruction);
|
|
857
883
|
return {
|
|
@@ -1019,6 +1045,10 @@ export type VoltrVaultPluginInstructions = {
|
|
|
1019
1045
|
input: UpdateProtocolAsyncInput,
|
|
1020
1046
|
) => ReturnType<typeof getUpdateProtocolInstructionAsync> &
|
|
1021
1047
|
SelfPlanAndSendFunctions;
|
|
1048
|
+
updateVaultAdaptorPolicy: (
|
|
1049
|
+
input: UpdateVaultAdaptorPolicyAsyncInput,
|
|
1050
|
+
) => ReturnType<typeof getUpdateVaultAdaptorPolicyInstructionAsync> &
|
|
1051
|
+
SelfPlanAndSendFunctions;
|
|
1022
1052
|
updateVaultConfig: (
|
|
1023
1053
|
input: UpdateVaultConfigAsyncInput,
|
|
1024
1054
|
) => ReturnType<typeof getUpdateVaultConfigInstructionAsync> &
|
|
@@ -1221,6 +1251,11 @@ export function voltrVaultProgram() {
|
|
|
1221
1251
|
client,
|
|
1222
1252
|
getUpdateProtocolInstructionAsync(input),
|
|
1223
1253
|
),
|
|
1254
|
+
updateVaultAdaptorPolicy: (input) =>
|
|
1255
|
+
addSelfPlanAndSendFunctions(
|
|
1256
|
+
client,
|
|
1257
|
+
getUpdateVaultAdaptorPolicyInstructionAsync(input),
|
|
1258
|
+
),
|
|
1224
1259
|
updateVaultConfig: (input) =>
|
|
1225
1260
|
addSelfPlanAndSendFunctions(
|
|
1226
1261
|
client,
|
|
@@ -33,6 +33,7 @@ export * from "./protocolFeeField";
|
|
|
33
33
|
export * from "./removeAdaptorEvent";
|
|
34
34
|
export * from "./requestWithdrawVaultEvent";
|
|
35
35
|
export * from "./updateProtocolEvent";
|
|
36
|
+
export * from "./updateVaultAdaptorPolicyEvent";
|
|
36
37
|
export * from "./updateVaultConfigEvent";
|
|
37
38
|
export * from "./updateVaultEvent";
|
|
38
39
|
export * from "./updateVaultProtocolFeeEvent";
|
|
@@ -24,12 +24,14 @@ import {
|
|
|
24
24
|
|
|
25
25
|
export type InitProtocolEvent = {
|
|
26
26
|
admin: Address;
|
|
27
|
+
treasury: Address;
|
|
27
28
|
operationalState: number;
|
|
28
29
|
initializedTs: bigint;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export type InitProtocolEventArgs = {
|
|
32
33
|
admin: Address;
|
|
34
|
+
treasury: Address;
|
|
33
35
|
operationalState: number;
|
|
34
36
|
initializedTs: number | bigint;
|
|
35
37
|
};
|
|
@@ -37,6 +39,7 @@ export type InitProtocolEventArgs = {
|
|
|
37
39
|
export function getInitProtocolEventEncoder(): FixedSizeEncoder<InitProtocolEventArgs> {
|
|
38
40
|
return getStructEncoder([
|
|
39
41
|
["admin", getAddressEncoder()],
|
|
42
|
+
["treasury", getAddressEncoder()],
|
|
40
43
|
["operationalState", getU16Encoder()],
|
|
41
44
|
["initializedTs", getU64Encoder()],
|
|
42
45
|
]);
|
|
@@ -45,6 +48,7 @@ export function getInitProtocolEventEncoder(): FixedSizeEncoder<InitProtocolEven
|
|
|
45
48
|
export function getInitProtocolEventDecoder(): FixedSizeDecoder<InitProtocolEvent> {
|
|
46
49
|
return getStructDecoder([
|
|
47
50
|
["admin", getAddressDecoder()],
|
|
51
|
+
["treasury", getAddressDecoder()],
|
|
48
52
|
["operationalState", getU16Decoder()],
|
|
49
53
|
["initializedTs", getU64Decoder()],
|
|
50
54
|
]);
|
|
@@ -0,0 +1,79 @@
|
|
|
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
|
+
|
|
9
|
+
import {
|
|
10
|
+
addDecoderSizePrefix,
|
|
11
|
+
addEncoderSizePrefix,
|
|
12
|
+
combineCodec,
|
|
13
|
+
getAddressDecoder,
|
|
14
|
+
getAddressEncoder,
|
|
15
|
+
getStructDecoder,
|
|
16
|
+
getStructEncoder,
|
|
17
|
+
getU32Decoder,
|
|
18
|
+
getU32Encoder,
|
|
19
|
+
getU64Decoder,
|
|
20
|
+
getU64Encoder,
|
|
21
|
+
getU8Decoder,
|
|
22
|
+
getU8Encoder,
|
|
23
|
+
getUtf8Decoder,
|
|
24
|
+
getUtf8Encoder,
|
|
25
|
+
type Address,
|
|
26
|
+
type Codec,
|
|
27
|
+
type Decoder,
|
|
28
|
+
type Encoder,
|
|
29
|
+
} from "@solana/kit";
|
|
30
|
+
|
|
31
|
+
export type UpdateVaultAdaptorPolicyEvent = {
|
|
32
|
+
admin: Address;
|
|
33
|
+
vault: Address;
|
|
34
|
+
field: string;
|
|
35
|
+
oldValue: number;
|
|
36
|
+
newValue: number;
|
|
37
|
+
updatedTs: bigint;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type UpdateVaultAdaptorPolicyEventArgs = {
|
|
41
|
+
admin: Address;
|
|
42
|
+
vault: Address;
|
|
43
|
+
field: string;
|
|
44
|
+
oldValue: number;
|
|
45
|
+
newValue: number;
|
|
46
|
+
updatedTs: number | bigint;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export function getUpdateVaultAdaptorPolicyEventEncoder(): Encoder<UpdateVaultAdaptorPolicyEventArgs> {
|
|
50
|
+
return getStructEncoder([
|
|
51
|
+
["admin", getAddressEncoder()],
|
|
52
|
+
["vault", getAddressEncoder()],
|
|
53
|
+
["field", addEncoderSizePrefix(getUtf8Encoder(), getU32Encoder())],
|
|
54
|
+
["oldValue", getU8Encoder()],
|
|
55
|
+
["newValue", getU8Encoder()],
|
|
56
|
+
["updatedTs", getU64Encoder()],
|
|
57
|
+
]);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getUpdateVaultAdaptorPolicyEventDecoder(): Decoder<UpdateVaultAdaptorPolicyEvent> {
|
|
61
|
+
return getStructDecoder([
|
|
62
|
+
["admin", getAddressDecoder()],
|
|
63
|
+
["vault", getAddressDecoder()],
|
|
64
|
+
["field", addDecoderSizePrefix(getUtf8Decoder(), getU32Decoder())],
|
|
65
|
+
["oldValue", getU8Decoder()],
|
|
66
|
+
["newValue", getU8Decoder()],
|
|
67
|
+
["updatedTs", getU64Decoder()],
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function getUpdateVaultAdaptorPolicyEventCodec(): Codec<
|
|
72
|
+
UpdateVaultAdaptorPolicyEventArgs,
|
|
73
|
+
UpdateVaultAdaptorPolicyEvent
|
|
74
|
+
> {
|
|
75
|
+
return combineCodec(
|
|
76
|
+
getUpdateVaultAdaptorPolicyEventEncoder(),
|
|
77
|
+
getUpdateVaultAdaptorPolicyEventDecoder(),
|
|
78
|
+
);
|
|
79
|
+
}
|