@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.
- package/README.md +119 -0
- package/dist/classes/JuniorTranche.d.ts +201 -0
- package/dist/classes/JuniorTranche.js +709 -0
- package/dist/classes/PdaClient.d.ts +20 -0
- package/dist/classes/PdaClient.js +68 -0
- package/dist/classes/index.d.ts +2 -0
- package/dist/classes/index.js +18 -0
- package/dist/constants/index.d.ts +22 -0
- package/dist/constants/index.js +25 -0
- package/dist/generated/accounts/asset.d.ts +38 -0
- package/dist/generated/accounts/asset.js +74 -0
- package/dist/generated/accounts/cooldown.d.ts +40 -0
- package/dist/generated/accounts/cooldown.js +79 -0
- package/dist/generated/accounts/index.d.ts +12 -0
- package/dist/generated/accounts/index.js +28 -0
- package/dist/generated/accounts/liquidityPool.d.ts +57 -0
- package/dist/generated/accounts/liquidityPool.js +81 -0
- package/dist/generated/accounts/settings.d.ts +41 -0
- package/dist/generated/accounts/settings.js +80 -0
- package/dist/generated/accounts/userPermissions.d.ts +34 -0
- package/dist/generated/accounts/userPermissions.js +70 -0
- package/dist/generated/errors/index.d.ts +8 -0
- package/dist/generated/errors/index.js +24 -0
- package/dist/generated/errors/rlp.d.ts +131 -0
- package/dist/generated/errors/rlp.js +197 -0
- package/dist/generated/index.d.ts +12 -0
- package/dist/generated/index.js +28 -0
- package/dist/generated/instructions/addAsset.d.ts +80 -0
- package/dist/generated/instructions/addAsset.js +188 -0
- package/dist/generated/instructions/createPermissionAccount.d.ts +67 -0
- package/dist/generated/instructions/createPermissionAccount.js +166 -0
- package/dist/generated/instructions/deposit.d.ts +115 -0
- package/dist/generated/instructions/deposit.js +294 -0
- package/dist/generated/instructions/forceRemoveAsset.d.ts +82 -0
- package/dist/generated/instructions/forceRemoveAsset.js +186 -0
- package/dist/generated/instructions/freezeFunctionality.d.ts +72 -0
- package/dist/generated/instructions/freezeFunctionality.js +175 -0
- package/dist/generated/instructions/index.d.ts +23 -0
- package/dist/generated/instructions/index.js +39 -0
- package/dist/generated/instructions/initializeLp.d.ts +99 -0
- package/dist/generated/instructions/initializeLp.js +230 -0
- package/dist/generated/instructions/initializePoolReserve.d.ts +83 -0
- package/dist/generated/instructions/initializePoolReserve.js +228 -0
- package/dist/generated/instructions/initializeRlp.d.ts +67 -0
- package/dist/generated/instructions/initializeRlp.js +163 -0
- package/dist/generated/instructions/requestWithdrawal.d.ts +99 -0
- package/dist/generated/instructions/requestWithdrawal.js +254 -0
- package/dist/generated/instructions/slash.d.ts +151 -0
- package/dist/generated/instructions/slash.js +212 -0
- package/dist/generated/instructions/swap.d.ts +119 -0
- package/dist/generated/instructions/swap.js +309 -0
- package/dist/generated/instructions/updateActionRole.d.ts +76 -0
- package/dist/generated/instructions/updateActionRole.js +174 -0
- package/dist/generated/instructions/updateDepositCap.d.ts +71 -0
- package/dist/generated/instructions/updateDepositCap.js +156 -0
- package/dist/generated/instructions/updateOracle.d.ts +66 -0
- package/dist/generated/instructions/updateOracle.js +151 -0
- package/dist/generated/instructions/updateRoleHolder.d.ts +80 -0
- package/dist/generated/instructions/updateRoleHolder.js +185 -0
- package/dist/generated/instructions/withdraw.d.ts +95 -0
- package/dist/generated/instructions/withdraw.js +235 -0
- package/dist/generated/programs/index.d.ts +8 -0
- package/dist/generated/programs/index.js +24 -0
- package/dist/generated/programs/rlp.d.ts +75 -0
- package/dist/generated/programs/rlp.js +233 -0
- package/dist/generated/shared/index.d.ts +49 -0
- package/dist/generated/shared/index.js +94 -0
- package/dist/generated/types/accessControl.d.ts +20 -0
- package/dist/generated/types/accessControl.js +29 -0
- package/dist/generated/types/accessLevel.d.ts +16 -0
- package/dist/generated/types/accessLevel.js +28 -0
- package/dist/generated/types/accessMap.d.ts +20 -0
- package/dist/generated/types/accessMap.js +35 -0
- package/dist/generated/types/action.d.ts +32 -0
- package/dist/generated/types/action.js +44 -0
- package/dist/generated/types/actionMapping.d.ts +22 -0
- package/dist/generated/types/actionMapping.js +31 -0
- package/dist/generated/types/addAssetEvent.d.ts +17 -0
- package/dist/generated/types/addAssetEvent.js +30 -0
- package/dist/generated/types/createPermissionAccountEvent.d.ts +16 -0
- package/dist/generated/types/createPermissionAccountEvent.js +28 -0
- package/dist/generated/types/depositEvent.d.ts +27 -0
- package/dist/generated/types/depositEvent.js +36 -0
- package/dist/generated/types/depositRewardEvent.d.ts +21 -0
- package/dist/generated/types/depositRewardEvent.js +30 -0
- package/dist/generated/types/forceRemoveAssetEvent.d.ts +18 -0
- package/dist/generated/types/forceRemoveAssetEvent.js +32 -0
- package/dist/generated/types/freezeProtocolActionEvent.d.ts +20 -0
- package/dist/generated/types/freezeProtocolActionEvent.js +29 -0
- package/dist/generated/types/index.d.ts +32 -0
- package/dist/generated/types/index.js +48 -0
- package/dist/generated/types/initializeLiquidityPoolEvent.d.ts +17 -0
- package/dist/generated/types/initializeLiquidityPoolEvent.js +30 -0
- package/dist/generated/types/initializeRlpEvent.d.ts +15 -0
- package/dist/generated/types/initializeRlpEvent.js +22 -0
- package/dist/generated/types/killSwitch.d.ts +15 -0
- package/dist/generated/types/killSwitch.js +22 -0
- package/dist/generated/types/levelRoles.d.ts +18 -0
- package/dist/generated/types/levelRoles.js +23 -0
- package/dist/generated/types/oracle.d.ts +25 -0
- package/dist/generated/types/oracle.js +56 -0
- package/dist/generated/types/requestWithdrawEvent.d.ts +21 -0
- package/dist/generated/types/requestWithdrawEvent.js +30 -0
- package/dist/generated/types/role.d.ts +21 -0
- package/dist/generated/types/role.js +33 -0
- package/dist/generated/types/slashEvent.d.ts +27 -0
- package/dist/generated/types/slashEvent.js +36 -0
- package/dist/generated/types/swapEvent.d.ts +23 -0
- package/dist/generated/types/swapEvent.js +32 -0
- package/dist/generated/types/update.d.ts +16 -0
- package/dist/generated/types/update.js +28 -0
- package/dist/generated/types/updateActionRoleEvent.d.ts +22 -0
- package/dist/generated/types/updateActionRoleEvent.js +31 -0
- package/dist/generated/types/updateDepositCapEvent.d.ts +21 -0
- package/dist/generated/types/updateDepositCapEvent.js +30 -0
- package/dist/generated/types/updateOracleEvent.d.ts +18 -0
- package/dist/generated/types/updateOracleEvent.js +32 -0
- package/dist/generated/types/updateRoleHolderEvent.d.ts +22 -0
- package/dist/generated/types/updateRoleHolderEvent.js +31 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +19 -0
- package/package.json +41 -0
|
@@ -0,0 +1,174 @@
|
|
|
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.UPDATE_ACTION_ROLE_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getUpdateActionRoleDiscriminatorBytes = getUpdateActionRoleDiscriminatorBytes;
|
|
12
|
+
exports.getUpdateActionRoleInstructionDataEncoder = getUpdateActionRoleInstructionDataEncoder;
|
|
13
|
+
exports.getUpdateActionRoleInstructionDataDecoder = getUpdateActionRoleInstructionDataDecoder;
|
|
14
|
+
exports.getUpdateActionRoleInstructionDataCodec = getUpdateActionRoleInstructionDataCodec;
|
|
15
|
+
exports.getUpdateActionRoleInstructionAsync = getUpdateActionRoleInstructionAsync;
|
|
16
|
+
exports.getUpdateActionRoleInstruction = getUpdateActionRoleInstruction;
|
|
17
|
+
exports.parseUpdateActionRoleInstruction = parseUpdateActionRoleInstruction;
|
|
18
|
+
const kit_1 = require("@solana/kit");
|
|
19
|
+
const programs_1 = require("../programs");
|
|
20
|
+
const shared_1 = require("../shared");
|
|
21
|
+
const types_1 = require("../types");
|
|
22
|
+
exports.UPDATE_ACTION_ROLE_DISCRIMINATOR = new Uint8Array([
|
|
23
|
+
154, 250, 181, 15, 202, 36, 158, 230,
|
|
24
|
+
]);
|
|
25
|
+
function getUpdateActionRoleDiscriminatorBytes() {
|
|
26
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_ACTION_ROLE_DISCRIMINATOR);
|
|
27
|
+
}
|
|
28
|
+
function getUpdateActionRoleInstructionDataEncoder() {
|
|
29
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
30
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
31
|
+
["action", (0, types_1.getActionEncoder)()],
|
|
32
|
+
["role", (0, types_1.getRoleEncoder)()],
|
|
33
|
+
["update", (0, types_1.getUpdateEncoder)()],
|
|
34
|
+
]), (value) => ({ ...value, discriminator: exports.UPDATE_ACTION_ROLE_DISCRIMINATOR }));
|
|
35
|
+
}
|
|
36
|
+
function getUpdateActionRoleInstructionDataDecoder() {
|
|
37
|
+
return (0, kit_1.getStructDecoder)([
|
|
38
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
39
|
+
["action", (0, types_1.getActionDecoder)()],
|
|
40
|
+
["role", (0, types_1.getRoleDecoder)()],
|
|
41
|
+
["update", (0, types_1.getUpdateDecoder)()],
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
function getUpdateActionRoleInstructionDataCodec() {
|
|
45
|
+
return (0, kit_1.combineCodec)(getUpdateActionRoleInstructionDataEncoder(), getUpdateActionRoleInstructionDataDecoder());
|
|
46
|
+
}
|
|
47
|
+
async function getUpdateActionRoleInstructionAsync(input, config) {
|
|
48
|
+
// Program address.
|
|
49
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
50
|
+
// Original accounts.
|
|
51
|
+
const originalAccounts = {
|
|
52
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
53
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
54
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
55
|
+
adminPermissions: {
|
|
56
|
+
value: input.adminPermissions ?? null,
|
|
57
|
+
isWritable: true,
|
|
58
|
+
},
|
|
59
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
60
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
61
|
+
};
|
|
62
|
+
const accounts = originalAccounts;
|
|
63
|
+
// Original args.
|
|
64
|
+
const args = { ...input };
|
|
65
|
+
// Resolve default values.
|
|
66
|
+
if (!accounts.settings.value) {
|
|
67
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
68
|
+
programAddress,
|
|
69
|
+
seeds: [
|
|
70
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
71
|
+
],
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (!accounts.systemProgram.value) {
|
|
75
|
+
accounts.systemProgram.value =
|
|
76
|
+
"11111111111111111111111111111111";
|
|
77
|
+
}
|
|
78
|
+
if (!accounts.adminPermissions.value) {
|
|
79
|
+
accounts.adminPermissions.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
80
|
+
programAddress,
|
|
81
|
+
seeds: [
|
|
82
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
83
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
84
|
+
])),
|
|
85
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.admin.value)),
|
|
86
|
+
],
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (!accounts.eventAuthority.value) {
|
|
90
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
91
|
+
programAddress,
|
|
92
|
+
seeds: [
|
|
93
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
94
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
95
|
+
105, 116, 121,
|
|
96
|
+
])),
|
|
97
|
+
],
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
101
|
+
return Object.freeze({
|
|
102
|
+
accounts: [
|
|
103
|
+
getAccountMeta(accounts.admin),
|
|
104
|
+
getAccountMeta(accounts.settings),
|
|
105
|
+
getAccountMeta(accounts.systemProgram),
|
|
106
|
+
getAccountMeta(accounts.adminPermissions),
|
|
107
|
+
getAccountMeta(accounts.eventAuthority),
|
|
108
|
+
getAccountMeta(accounts.program),
|
|
109
|
+
],
|
|
110
|
+
data: getUpdateActionRoleInstructionDataEncoder().encode(args),
|
|
111
|
+
programAddress,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function getUpdateActionRoleInstruction(input, config) {
|
|
115
|
+
// Program address.
|
|
116
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
117
|
+
// Original accounts.
|
|
118
|
+
const originalAccounts = {
|
|
119
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
120
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
121
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
122
|
+
adminPermissions: {
|
|
123
|
+
value: input.adminPermissions ?? null,
|
|
124
|
+
isWritable: true,
|
|
125
|
+
},
|
|
126
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
127
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
128
|
+
};
|
|
129
|
+
const accounts = originalAccounts;
|
|
130
|
+
// Original args.
|
|
131
|
+
const args = { ...input };
|
|
132
|
+
// Resolve default values.
|
|
133
|
+
if (!accounts.systemProgram.value) {
|
|
134
|
+
accounts.systemProgram.value =
|
|
135
|
+
"11111111111111111111111111111111";
|
|
136
|
+
}
|
|
137
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
138
|
+
return Object.freeze({
|
|
139
|
+
accounts: [
|
|
140
|
+
getAccountMeta(accounts.admin),
|
|
141
|
+
getAccountMeta(accounts.settings),
|
|
142
|
+
getAccountMeta(accounts.systemProgram),
|
|
143
|
+
getAccountMeta(accounts.adminPermissions),
|
|
144
|
+
getAccountMeta(accounts.eventAuthority),
|
|
145
|
+
getAccountMeta(accounts.program),
|
|
146
|
+
],
|
|
147
|
+
data: getUpdateActionRoleInstructionDataEncoder().encode(args),
|
|
148
|
+
programAddress,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function parseUpdateActionRoleInstruction(instruction) {
|
|
152
|
+
if (instruction.accounts.length < 6) {
|
|
153
|
+
// TODO: Coded error.
|
|
154
|
+
throw new Error("Not enough accounts");
|
|
155
|
+
}
|
|
156
|
+
let accountIndex = 0;
|
|
157
|
+
const getNextAccount = () => {
|
|
158
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
159
|
+
accountIndex += 1;
|
|
160
|
+
return accountMeta;
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
programAddress: instruction.programAddress,
|
|
164
|
+
accounts: {
|
|
165
|
+
admin: getNextAccount(),
|
|
166
|
+
settings: getNextAccount(),
|
|
167
|
+
systemProgram: getNextAccount(),
|
|
168
|
+
adminPermissions: getNextAccount(),
|
|
169
|
+
eventAuthority: getNextAccount(),
|
|
170
|
+
program: getNextAccount(),
|
|
171
|
+
},
|
|
172
|
+
data: getUpdateActionRoleInstructionDataDecoder().decode(instruction.data),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
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 Codec, type Decoder, type Encoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type Option, type OptionOrNullable, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from "@solana/kit";
|
|
9
|
+
import { RLP_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const UPDATE_DEPOSIT_CAP_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getUpdateDepositCapDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
+
export type UpdateDepositCapInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountAdmin extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountLiquidityPool extends string | AccountMeta<string> = string, TAccountEventAuthority extends string | AccountMeta<string> = string, TAccountProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
|
+
TAccountAdmin extends string ? WritableAccount<TAccountAdmin> : TAccountAdmin,
|
|
15
|
+
TAccountSettings extends string ? ReadonlyAccount<TAccountSettings> : TAccountSettings,
|
|
16
|
+
TAccountLiquidityPool extends string ? WritableAccount<TAccountLiquidityPool> : TAccountLiquidityPool,
|
|
17
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
18
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
19
|
+
...TRemainingAccounts
|
|
20
|
+
]>;
|
|
21
|
+
export type UpdateDepositCapInstructionData = {
|
|
22
|
+
discriminator: ReadonlyUint8Array;
|
|
23
|
+
lockupId: bigint;
|
|
24
|
+
newCap: Option<bigint>;
|
|
25
|
+
};
|
|
26
|
+
export type UpdateDepositCapInstructionDataArgs = {
|
|
27
|
+
lockupId: number | bigint;
|
|
28
|
+
newCap: OptionOrNullable<number | bigint>;
|
|
29
|
+
};
|
|
30
|
+
export declare function getUpdateDepositCapInstructionDataEncoder(): Encoder<UpdateDepositCapInstructionDataArgs>;
|
|
31
|
+
export declare function getUpdateDepositCapInstructionDataDecoder(): Decoder<UpdateDepositCapInstructionData>;
|
|
32
|
+
export declare function getUpdateDepositCapInstructionDataCodec(): Codec<UpdateDepositCapInstructionDataArgs, UpdateDepositCapInstructionData>;
|
|
33
|
+
export type UpdateDepositCapAsyncInput<TAccountSigner extends string = string, TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
34
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
35
|
+
admin?: Address<TAccountAdmin>;
|
|
36
|
+
settings?: Address<TAccountSettings>;
|
|
37
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
38
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
39
|
+
program: Address<TAccountProgram>;
|
|
40
|
+
lockupId: UpdateDepositCapInstructionDataArgs["lockupId"];
|
|
41
|
+
newCap: UpdateDepositCapInstructionDataArgs["newCap"];
|
|
42
|
+
};
|
|
43
|
+
export declare function getUpdateDepositCapInstructionAsync<TAccountSigner extends string, TAccountAdmin extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateDepositCapAsyncInput<TAccountSigner, TAccountAdmin, TAccountSettings, TAccountLiquidityPool, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
44
|
+
programAddress?: TProgramAddress;
|
|
45
|
+
}): Promise<UpdateDepositCapInstruction<TProgramAddress, TAccountSigner, TAccountAdmin, TAccountSettings, TAccountLiquidityPool, TAccountEventAuthority, TAccountProgram>>;
|
|
46
|
+
export type UpdateDepositCapInput<TAccountSigner extends string = string, TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
47
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
48
|
+
admin: Address<TAccountAdmin>;
|
|
49
|
+
settings: Address<TAccountSettings>;
|
|
50
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
51
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
52
|
+
program: Address<TAccountProgram>;
|
|
53
|
+
lockupId: UpdateDepositCapInstructionDataArgs["lockupId"];
|
|
54
|
+
newCap: UpdateDepositCapInstructionDataArgs["newCap"];
|
|
55
|
+
};
|
|
56
|
+
export declare function getUpdateDepositCapInstruction<TAccountSigner extends string, TAccountAdmin extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateDepositCapInput<TAccountSigner, TAccountAdmin, TAccountSettings, TAccountLiquidityPool, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
57
|
+
programAddress?: TProgramAddress;
|
|
58
|
+
}): UpdateDepositCapInstruction<TProgramAddress, TAccountSigner, TAccountAdmin, TAccountSettings, TAccountLiquidityPool, TAccountEventAuthority, TAccountProgram>;
|
|
59
|
+
export type ParsedUpdateDepositCapInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
60
|
+
programAddress: Address<TProgram>;
|
|
61
|
+
accounts: {
|
|
62
|
+
signer: TAccountMetas[0];
|
|
63
|
+
admin: TAccountMetas[1];
|
|
64
|
+
settings: TAccountMetas[2];
|
|
65
|
+
liquidityPool: TAccountMetas[3];
|
|
66
|
+
eventAuthority: TAccountMetas[4];
|
|
67
|
+
program: TAccountMetas[5];
|
|
68
|
+
};
|
|
69
|
+
data: UpdateDepositCapInstructionData;
|
|
70
|
+
};
|
|
71
|
+
export declare function parseUpdateDepositCapInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateDepositCapInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,156 @@
|
|
|
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.UPDATE_DEPOSIT_CAP_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getUpdateDepositCapDiscriminatorBytes = getUpdateDepositCapDiscriminatorBytes;
|
|
12
|
+
exports.getUpdateDepositCapInstructionDataEncoder = getUpdateDepositCapInstructionDataEncoder;
|
|
13
|
+
exports.getUpdateDepositCapInstructionDataDecoder = getUpdateDepositCapInstructionDataDecoder;
|
|
14
|
+
exports.getUpdateDepositCapInstructionDataCodec = getUpdateDepositCapInstructionDataCodec;
|
|
15
|
+
exports.getUpdateDepositCapInstructionAsync = getUpdateDepositCapInstructionAsync;
|
|
16
|
+
exports.getUpdateDepositCapInstruction = getUpdateDepositCapInstruction;
|
|
17
|
+
exports.parseUpdateDepositCapInstruction = parseUpdateDepositCapInstruction;
|
|
18
|
+
const kit_1 = require("@solana/kit");
|
|
19
|
+
const programs_1 = require("../programs");
|
|
20
|
+
const shared_1 = require("../shared");
|
|
21
|
+
exports.UPDATE_DEPOSIT_CAP_DISCRIMINATOR = new Uint8Array([
|
|
22
|
+
175, 41, 137, 203, 27, 184, 245, 164,
|
|
23
|
+
]);
|
|
24
|
+
function getUpdateDepositCapDiscriminatorBytes() {
|
|
25
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_DEPOSIT_CAP_DISCRIMINATOR);
|
|
26
|
+
}
|
|
27
|
+
function getUpdateDepositCapInstructionDataEncoder() {
|
|
28
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
29
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
30
|
+
["lockupId", (0, kit_1.getU64Encoder)()],
|
|
31
|
+
["newCap", (0, kit_1.getOptionEncoder)((0, kit_1.getU64Encoder)())],
|
|
32
|
+
]), (value) => ({ ...value, discriminator: exports.UPDATE_DEPOSIT_CAP_DISCRIMINATOR }));
|
|
33
|
+
}
|
|
34
|
+
function getUpdateDepositCapInstructionDataDecoder() {
|
|
35
|
+
return (0, kit_1.getStructDecoder)([
|
|
36
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
37
|
+
["lockupId", (0, kit_1.getU64Decoder)()],
|
|
38
|
+
["newCap", (0, kit_1.getOptionDecoder)((0, kit_1.getU64Decoder)())],
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
function getUpdateDepositCapInstructionDataCodec() {
|
|
42
|
+
return (0, kit_1.combineCodec)(getUpdateDepositCapInstructionDataEncoder(), getUpdateDepositCapInstructionDataDecoder());
|
|
43
|
+
}
|
|
44
|
+
async function getUpdateDepositCapInstructionAsync(input, config) {
|
|
45
|
+
// Program address.
|
|
46
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
47
|
+
// Original accounts.
|
|
48
|
+
const originalAccounts = {
|
|
49
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
50
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
51
|
+
settings: { value: input.settings ?? null, isWritable: false },
|
|
52
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
53
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
54
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
55
|
+
};
|
|
56
|
+
const accounts = originalAccounts;
|
|
57
|
+
// Original args.
|
|
58
|
+
const args = { ...input };
|
|
59
|
+
// Resolve default values.
|
|
60
|
+
if (!accounts.admin.value) {
|
|
61
|
+
accounts.admin.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
62
|
+
programAddress,
|
|
63
|
+
seeds: [
|
|
64
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
65
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
66
|
+
])),
|
|
67
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.signer.value)),
|
|
68
|
+
],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (!accounts.settings.value) {
|
|
72
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
73
|
+
programAddress,
|
|
74
|
+
seeds: [
|
|
75
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
76
|
+
],
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
if (!accounts.eventAuthority.value) {
|
|
80
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
81
|
+
programAddress,
|
|
82
|
+
seeds: [
|
|
83
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
84
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
85
|
+
105, 116, 121,
|
|
86
|
+
])),
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
91
|
+
return Object.freeze({
|
|
92
|
+
accounts: [
|
|
93
|
+
getAccountMeta(accounts.signer),
|
|
94
|
+
getAccountMeta(accounts.admin),
|
|
95
|
+
getAccountMeta(accounts.settings),
|
|
96
|
+
getAccountMeta(accounts.liquidityPool),
|
|
97
|
+
getAccountMeta(accounts.eventAuthority),
|
|
98
|
+
getAccountMeta(accounts.program),
|
|
99
|
+
],
|
|
100
|
+
data: getUpdateDepositCapInstructionDataEncoder().encode(args),
|
|
101
|
+
programAddress,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function getUpdateDepositCapInstruction(input, config) {
|
|
105
|
+
// Program address.
|
|
106
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
107
|
+
// Original accounts.
|
|
108
|
+
const originalAccounts = {
|
|
109
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
110
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
111
|
+
settings: { value: input.settings ?? null, isWritable: false },
|
|
112
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
113
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
114
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
115
|
+
};
|
|
116
|
+
const accounts = originalAccounts;
|
|
117
|
+
// Original args.
|
|
118
|
+
const args = { ...input };
|
|
119
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
120
|
+
return Object.freeze({
|
|
121
|
+
accounts: [
|
|
122
|
+
getAccountMeta(accounts.signer),
|
|
123
|
+
getAccountMeta(accounts.admin),
|
|
124
|
+
getAccountMeta(accounts.settings),
|
|
125
|
+
getAccountMeta(accounts.liquidityPool),
|
|
126
|
+
getAccountMeta(accounts.eventAuthority),
|
|
127
|
+
getAccountMeta(accounts.program),
|
|
128
|
+
],
|
|
129
|
+
data: getUpdateDepositCapInstructionDataEncoder().encode(args),
|
|
130
|
+
programAddress,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
function parseUpdateDepositCapInstruction(instruction) {
|
|
134
|
+
if (instruction.accounts.length < 6) {
|
|
135
|
+
// TODO: Coded error.
|
|
136
|
+
throw new Error("Not enough accounts");
|
|
137
|
+
}
|
|
138
|
+
let accountIndex = 0;
|
|
139
|
+
const getNextAccount = () => {
|
|
140
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
141
|
+
accountIndex += 1;
|
|
142
|
+
return accountMeta;
|
|
143
|
+
};
|
|
144
|
+
return {
|
|
145
|
+
programAddress: instruction.programAddress,
|
|
146
|
+
accounts: {
|
|
147
|
+
signer: getNextAccount(),
|
|
148
|
+
admin: getNextAccount(),
|
|
149
|
+
settings: getNextAccount(),
|
|
150
|
+
liquidityPool: getNextAccount(),
|
|
151
|
+
eventAuthority: getNextAccount(),
|
|
152
|
+
program: getNextAccount(),
|
|
153
|
+
},
|
|
154
|
+
data: getUpdateDepositCapInstructionDataDecoder().decode(instruction.data),
|
|
155
|
+
};
|
|
156
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
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 FixedSizeCodec, type FixedSizeDecoder, type FixedSizeEncoder, type Instruction, type InstructionWithAccounts, type InstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from "@solana/kit";
|
|
9
|
+
import { RLP_PROGRAM_ADDRESS } from "../programs";
|
|
10
|
+
export declare const UPDATE_ORACLE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getUpdateOracleDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
+
export type UpdateOracleInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountAdmin extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountAsset extends string | AccountMeta<string> = string, TAccountOracle extends string | AccountMeta<string> = string, TAccountEventAuthority extends string | AccountMeta<string> = string, TAccountProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
|
+
TAccountAdmin extends string ? ReadonlyAccount<TAccountAdmin> : TAccountAdmin,
|
|
15
|
+
TAccountSettings extends string ? ReadonlyAccount<TAccountSettings> : TAccountSettings,
|
|
16
|
+
TAccountAsset extends string ? WritableAccount<TAccountAsset> : TAccountAsset,
|
|
17
|
+
TAccountOracle extends string ? ReadonlyAccount<TAccountOracle> : TAccountOracle,
|
|
18
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
19
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
20
|
+
...TRemainingAccounts
|
|
21
|
+
]>;
|
|
22
|
+
export type UpdateOracleInstructionData = {
|
|
23
|
+
discriminator: ReadonlyUint8Array;
|
|
24
|
+
};
|
|
25
|
+
export type UpdateOracleInstructionDataArgs = {};
|
|
26
|
+
export declare function getUpdateOracleInstructionDataEncoder(): FixedSizeEncoder<UpdateOracleInstructionDataArgs>;
|
|
27
|
+
export declare function getUpdateOracleInstructionDataDecoder(): FixedSizeDecoder<UpdateOracleInstructionData>;
|
|
28
|
+
export declare function getUpdateOracleInstructionDataCodec(): FixedSizeCodec<UpdateOracleInstructionDataArgs, UpdateOracleInstructionData>;
|
|
29
|
+
export type UpdateOracleAsyncInput<TAccountSigner extends string = string, TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountAsset extends string = string, TAccountOracle extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
30
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
31
|
+
admin?: Address<TAccountAdmin>;
|
|
32
|
+
settings?: Address<TAccountSettings>;
|
|
33
|
+
asset: Address<TAccountAsset>;
|
|
34
|
+
oracle: Address<TAccountOracle>;
|
|
35
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
36
|
+
program: Address<TAccountProgram>;
|
|
37
|
+
};
|
|
38
|
+
export declare function getUpdateOracleInstructionAsync<TAccountSigner extends string, TAccountAdmin extends string, TAccountSettings extends string, TAccountAsset extends string, TAccountOracle extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateOracleAsyncInput<TAccountSigner, TAccountAdmin, TAccountSettings, TAccountAsset, TAccountOracle, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
39
|
+
programAddress?: TProgramAddress;
|
|
40
|
+
}): Promise<UpdateOracleInstruction<TProgramAddress, TAccountSigner, TAccountAdmin, TAccountSettings, TAccountAsset, TAccountOracle, TAccountEventAuthority, TAccountProgram>>;
|
|
41
|
+
export type UpdateOracleInput<TAccountSigner extends string = string, TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountAsset extends string = string, TAccountOracle extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
42
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
43
|
+
admin: Address<TAccountAdmin>;
|
|
44
|
+
settings: Address<TAccountSettings>;
|
|
45
|
+
asset: Address<TAccountAsset>;
|
|
46
|
+
oracle: Address<TAccountOracle>;
|
|
47
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
48
|
+
program: Address<TAccountProgram>;
|
|
49
|
+
};
|
|
50
|
+
export declare function getUpdateOracleInstruction<TAccountSigner extends string, TAccountAdmin extends string, TAccountSettings extends string, TAccountAsset extends string, TAccountOracle extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateOracleInput<TAccountSigner, TAccountAdmin, TAccountSettings, TAccountAsset, TAccountOracle, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
51
|
+
programAddress?: TProgramAddress;
|
|
52
|
+
}): UpdateOracleInstruction<TProgramAddress, TAccountSigner, TAccountAdmin, TAccountSettings, TAccountAsset, TAccountOracle, TAccountEventAuthority, TAccountProgram>;
|
|
53
|
+
export type ParsedUpdateOracleInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
54
|
+
programAddress: Address<TProgram>;
|
|
55
|
+
accounts: {
|
|
56
|
+
signer: TAccountMetas[0];
|
|
57
|
+
admin: TAccountMetas[1];
|
|
58
|
+
settings: TAccountMetas[2];
|
|
59
|
+
asset: TAccountMetas[3];
|
|
60
|
+
oracle: TAccountMetas[4];
|
|
61
|
+
eventAuthority: TAccountMetas[5];
|
|
62
|
+
program: TAccountMetas[6];
|
|
63
|
+
};
|
|
64
|
+
data: UpdateOracleInstructionData;
|
|
65
|
+
};
|
|
66
|
+
export declare function parseUpdateOracleInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateOracleInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,151 @@
|
|
|
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.UPDATE_ORACLE_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getUpdateOracleDiscriminatorBytes = getUpdateOracleDiscriminatorBytes;
|
|
12
|
+
exports.getUpdateOracleInstructionDataEncoder = getUpdateOracleInstructionDataEncoder;
|
|
13
|
+
exports.getUpdateOracleInstructionDataDecoder = getUpdateOracleInstructionDataDecoder;
|
|
14
|
+
exports.getUpdateOracleInstructionDataCodec = getUpdateOracleInstructionDataCodec;
|
|
15
|
+
exports.getUpdateOracleInstructionAsync = getUpdateOracleInstructionAsync;
|
|
16
|
+
exports.getUpdateOracleInstruction = getUpdateOracleInstruction;
|
|
17
|
+
exports.parseUpdateOracleInstruction = parseUpdateOracleInstruction;
|
|
18
|
+
const kit_1 = require("@solana/kit");
|
|
19
|
+
const programs_1 = require("../programs");
|
|
20
|
+
const shared_1 = require("../shared");
|
|
21
|
+
exports.UPDATE_ORACLE_DISCRIMINATOR = new Uint8Array([
|
|
22
|
+
112, 41, 209, 18, 248, 226, 252, 188,
|
|
23
|
+
]);
|
|
24
|
+
function getUpdateOracleDiscriminatorBytes() {
|
|
25
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_ORACLE_DISCRIMINATOR);
|
|
26
|
+
}
|
|
27
|
+
function getUpdateOracleInstructionDataEncoder() {
|
|
28
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.UPDATE_ORACLE_DISCRIMINATOR }));
|
|
29
|
+
}
|
|
30
|
+
function getUpdateOracleInstructionDataDecoder() {
|
|
31
|
+
return (0, kit_1.getStructDecoder)([
|
|
32
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
33
|
+
]);
|
|
34
|
+
}
|
|
35
|
+
function getUpdateOracleInstructionDataCodec() {
|
|
36
|
+
return (0, kit_1.combineCodec)(getUpdateOracleInstructionDataEncoder(), getUpdateOracleInstructionDataDecoder());
|
|
37
|
+
}
|
|
38
|
+
async function getUpdateOracleInstructionAsync(input, config) {
|
|
39
|
+
// Program address.
|
|
40
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
41
|
+
// Original accounts.
|
|
42
|
+
const originalAccounts = {
|
|
43
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
44
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
45
|
+
settings: { value: input.settings ?? null, isWritable: false },
|
|
46
|
+
asset: { value: input.asset ?? null, isWritable: true },
|
|
47
|
+
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
48
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
49
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
50
|
+
};
|
|
51
|
+
const accounts = originalAccounts;
|
|
52
|
+
// Resolve default values.
|
|
53
|
+
if (!accounts.admin.value) {
|
|
54
|
+
accounts.admin.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
55
|
+
programAddress,
|
|
56
|
+
seeds: [
|
|
57
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
58
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
59
|
+
])),
|
|
60
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.signer.value)),
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (!accounts.settings.value) {
|
|
65
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
66
|
+
programAddress,
|
|
67
|
+
seeds: [
|
|
68
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
69
|
+
],
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (!accounts.eventAuthority.value) {
|
|
73
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
74
|
+
programAddress,
|
|
75
|
+
seeds: [
|
|
76
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
77
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
78
|
+
105, 116, 121,
|
|
79
|
+
])),
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
84
|
+
return Object.freeze({
|
|
85
|
+
accounts: [
|
|
86
|
+
getAccountMeta(accounts.signer),
|
|
87
|
+
getAccountMeta(accounts.admin),
|
|
88
|
+
getAccountMeta(accounts.settings),
|
|
89
|
+
getAccountMeta(accounts.asset),
|
|
90
|
+
getAccountMeta(accounts.oracle),
|
|
91
|
+
getAccountMeta(accounts.eventAuthority),
|
|
92
|
+
getAccountMeta(accounts.program),
|
|
93
|
+
],
|
|
94
|
+
data: getUpdateOracleInstructionDataEncoder().encode({}),
|
|
95
|
+
programAddress,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function getUpdateOracleInstruction(input, config) {
|
|
99
|
+
// Program address.
|
|
100
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
101
|
+
// Original accounts.
|
|
102
|
+
const originalAccounts = {
|
|
103
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
104
|
+
admin: { value: input.admin ?? null, isWritable: false },
|
|
105
|
+
settings: { value: input.settings ?? null, isWritable: false },
|
|
106
|
+
asset: { value: input.asset ?? null, isWritable: true },
|
|
107
|
+
oracle: { value: input.oracle ?? null, isWritable: false },
|
|
108
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
109
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
110
|
+
};
|
|
111
|
+
const accounts = originalAccounts;
|
|
112
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
113
|
+
return Object.freeze({
|
|
114
|
+
accounts: [
|
|
115
|
+
getAccountMeta(accounts.signer),
|
|
116
|
+
getAccountMeta(accounts.admin),
|
|
117
|
+
getAccountMeta(accounts.settings),
|
|
118
|
+
getAccountMeta(accounts.asset),
|
|
119
|
+
getAccountMeta(accounts.oracle),
|
|
120
|
+
getAccountMeta(accounts.eventAuthority),
|
|
121
|
+
getAccountMeta(accounts.program),
|
|
122
|
+
],
|
|
123
|
+
data: getUpdateOracleInstructionDataEncoder().encode({}),
|
|
124
|
+
programAddress,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function parseUpdateOracleInstruction(instruction) {
|
|
128
|
+
if (instruction.accounts.length < 7) {
|
|
129
|
+
// TODO: Coded error.
|
|
130
|
+
throw new Error("Not enough accounts");
|
|
131
|
+
}
|
|
132
|
+
let accountIndex = 0;
|
|
133
|
+
const getNextAccount = () => {
|
|
134
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
135
|
+
accountIndex += 1;
|
|
136
|
+
return accountMeta;
|
|
137
|
+
};
|
|
138
|
+
return {
|
|
139
|
+
programAddress: instruction.programAddress,
|
|
140
|
+
accounts: {
|
|
141
|
+
signer: getNextAccount(),
|
|
142
|
+
admin: getNextAccount(),
|
|
143
|
+
settings: getNextAccount(),
|
|
144
|
+
asset: getNextAccount(),
|
|
145
|
+
oracle: getNextAccount(),
|
|
146
|
+
eventAuthority: getNextAccount(),
|
|
147
|
+
program: getNextAccount(),
|
|
148
|
+
},
|
|
149
|
+
data: getUpdateOracleInstructionDataDecoder().decode(instruction.data),
|
|
150
|
+
};
|
|
151
|
+
}
|