@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,80 @@
|
|
|
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
|
+
import { type Role, type RoleArgs, type Update, type UpdateArgs } from "../types";
|
|
11
|
+
export declare const UPDATE_ROLE_HOLDER_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
12
|
+
export declare function getUpdateRoleHolderDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
13
|
+
export type UpdateRoleHolderInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountAdmin extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountAdminPermissions extends string | AccountMeta<string> = string, TAccountUpdateAdminPermissions extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountEventAuthority extends string | AccountMeta<string> = string, TAccountProgram extends string | AccountMeta<string> = string, TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
14
|
+
TAccountAdmin extends string ? WritableSignerAccount<TAccountAdmin> & AccountSignerMeta<TAccountAdmin> : TAccountAdmin,
|
|
15
|
+
TAccountSettings extends string ? WritableAccount<TAccountSettings> : TAccountSettings,
|
|
16
|
+
TAccountAdminPermissions extends string ? WritableAccount<TAccountAdminPermissions> : TAccountAdminPermissions,
|
|
17
|
+
TAccountUpdateAdminPermissions extends string ? WritableAccount<TAccountUpdateAdminPermissions> : TAccountUpdateAdminPermissions,
|
|
18
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
19
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
20
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
21
|
+
...TRemainingAccounts
|
|
22
|
+
]>;
|
|
23
|
+
export type UpdateRoleHolderInstructionData = {
|
|
24
|
+
discriminator: ReadonlyUint8Array;
|
|
25
|
+
address: Address;
|
|
26
|
+
role: Role;
|
|
27
|
+
update: Update;
|
|
28
|
+
};
|
|
29
|
+
export type UpdateRoleHolderInstructionDataArgs = {
|
|
30
|
+
address: Address;
|
|
31
|
+
role: RoleArgs;
|
|
32
|
+
update: UpdateArgs;
|
|
33
|
+
};
|
|
34
|
+
export declare function getUpdateRoleHolderInstructionDataEncoder(): FixedSizeEncoder<UpdateRoleHolderInstructionDataArgs>;
|
|
35
|
+
export declare function getUpdateRoleHolderInstructionDataDecoder(): FixedSizeDecoder<UpdateRoleHolderInstructionData>;
|
|
36
|
+
export declare function getUpdateRoleHolderInstructionDataCodec(): FixedSizeCodec<UpdateRoleHolderInstructionDataArgs, UpdateRoleHolderInstructionData>;
|
|
37
|
+
export type UpdateRoleHolderAsyncInput<TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountAdminPermissions extends string = string, TAccountUpdateAdminPermissions extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
38
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
39
|
+
settings?: Address<TAccountSettings>;
|
|
40
|
+
adminPermissions?: Address<TAccountAdminPermissions>;
|
|
41
|
+
updateAdminPermissions: Address<TAccountUpdateAdminPermissions>;
|
|
42
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
43
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
44
|
+
program: Address<TAccountProgram>;
|
|
45
|
+
address: UpdateRoleHolderInstructionDataArgs["address"];
|
|
46
|
+
role: UpdateRoleHolderInstructionDataArgs["role"];
|
|
47
|
+
update: UpdateRoleHolderInstructionDataArgs["update"];
|
|
48
|
+
};
|
|
49
|
+
export declare function getUpdateRoleHolderInstructionAsync<TAccountAdmin extends string, TAccountSettings extends string, TAccountAdminPermissions extends string, TAccountUpdateAdminPermissions extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateRoleHolderAsyncInput<TAccountAdmin, TAccountSettings, TAccountAdminPermissions, TAccountUpdateAdminPermissions, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
50
|
+
programAddress?: TProgramAddress;
|
|
51
|
+
}): Promise<UpdateRoleHolderInstruction<TProgramAddress, TAccountAdmin, TAccountSettings, TAccountAdminPermissions, TAccountUpdateAdminPermissions, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
52
|
+
export type UpdateRoleHolderInput<TAccountAdmin extends string = string, TAccountSettings extends string = string, TAccountAdminPermissions extends string = string, TAccountUpdateAdminPermissions extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
53
|
+
admin: TransactionSigner<TAccountAdmin>;
|
|
54
|
+
settings: Address<TAccountSettings>;
|
|
55
|
+
adminPermissions: Address<TAccountAdminPermissions>;
|
|
56
|
+
updateAdminPermissions: Address<TAccountUpdateAdminPermissions>;
|
|
57
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
58
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
59
|
+
program: Address<TAccountProgram>;
|
|
60
|
+
address: UpdateRoleHolderInstructionDataArgs["address"];
|
|
61
|
+
role: UpdateRoleHolderInstructionDataArgs["role"];
|
|
62
|
+
update: UpdateRoleHolderInstructionDataArgs["update"];
|
|
63
|
+
};
|
|
64
|
+
export declare function getUpdateRoleHolderInstruction<TAccountAdmin extends string, TAccountSettings extends string, TAccountAdminPermissions extends string, TAccountUpdateAdminPermissions extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: UpdateRoleHolderInput<TAccountAdmin, TAccountSettings, TAccountAdminPermissions, TAccountUpdateAdminPermissions, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
65
|
+
programAddress?: TProgramAddress;
|
|
66
|
+
}): UpdateRoleHolderInstruction<TProgramAddress, TAccountAdmin, TAccountSettings, TAccountAdminPermissions, TAccountUpdateAdminPermissions, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>;
|
|
67
|
+
export type ParsedUpdateRoleHolderInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
68
|
+
programAddress: Address<TProgram>;
|
|
69
|
+
accounts: {
|
|
70
|
+
admin: TAccountMetas[0];
|
|
71
|
+
settings: TAccountMetas[1];
|
|
72
|
+
adminPermissions: TAccountMetas[2];
|
|
73
|
+
updateAdminPermissions: TAccountMetas[3];
|
|
74
|
+
systemProgram: TAccountMetas[4];
|
|
75
|
+
eventAuthority: TAccountMetas[5];
|
|
76
|
+
program: TAccountMetas[6];
|
|
77
|
+
};
|
|
78
|
+
data: UpdateRoleHolderInstructionData;
|
|
79
|
+
};
|
|
80
|
+
export declare function parseUpdateRoleHolderInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedUpdateRoleHolderInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,185 @@
|
|
|
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_ROLE_HOLDER_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getUpdateRoleHolderDiscriminatorBytes = getUpdateRoleHolderDiscriminatorBytes;
|
|
12
|
+
exports.getUpdateRoleHolderInstructionDataEncoder = getUpdateRoleHolderInstructionDataEncoder;
|
|
13
|
+
exports.getUpdateRoleHolderInstructionDataDecoder = getUpdateRoleHolderInstructionDataDecoder;
|
|
14
|
+
exports.getUpdateRoleHolderInstructionDataCodec = getUpdateRoleHolderInstructionDataCodec;
|
|
15
|
+
exports.getUpdateRoleHolderInstructionAsync = getUpdateRoleHolderInstructionAsync;
|
|
16
|
+
exports.getUpdateRoleHolderInstruction = getUpdateRoleHolderInstruction;
|
|
17
|
+
exports.parseUpdateRoleHolderInstruction = parseUpdateRoleHolderInstruction;
|
|
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_ROLE_HOLDER_DISCRIMINATOR = new Uint8Array([
|
|
23
|
+
96, 224, 166, 55, 4, 62, 152, 53,
|
|
24
|
+
]);
|
|
25
|
+
function getUpdateRoleHolderDiscriminatorBytes() {
|
|
26
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.UPDATE_ROLE_HOLDER_DISCRIMINATOR);
|
|
27
|
+
}
|
|
28
|
+
function getUpdateRoleHolderInstructionDataEncoder() {
|
|
29
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
30
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
31
|
+
["address", (0, kit_1.getAddressEncoder)()],
|
|
32
|
+
["role", (0, types_1.getRoleEncoder)()],
|
|
33
|
+
["update", (0, types_1.getUpdateEncoder)()],
|
|
34
|
+
]), (value) => ({ ...value, discriminator: exports.UPDATE_ROLE_HOLDER_DISCRIMINATOR }));
|
|
35
|
+
}
|
|
36
|
+
function getUpdateRoleHolderInstructionDataDecoder() {
|
|
37
|
+
return (0, kit_1.getStructDecoder)([
|
|
38
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
39
|
+
["address", (0, kit_1.getAddressDecoder)()],
|
|
40
|
+
["role", (0, types_1.getRoleDecoder)()],
|
|
41
|
+
["update", (0, types_1.getUpdateDecoder)()],
|
|
42
|
+
]);
|
|
43
|
+
}
|
|
44
|
+
function getUpdateRoleHolderInstructionDataCodec() {
|
|
45
|
+
return (0, kit_1.combineCodec)(getUpdateRoleHolderInstructionDataEncoder(), getUpdateRoleHolderInstructionDataDecoder());
|
|
46
|
+
}
|
|
47
|
+
async function getUpdateRoleHolderInstructionAsync(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
|
+
adminPermissions: {
|
|
55
|
+
value: input.adminPermissions ?? null,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
},
|
|
58
|
+
updateAdminPermissions: {
|
|
59
|
+
value: input.updateAdminPermissions ?? null,
|
|
60
|
+
isWritable: true,
|
|
61
|
+
},
|
|
62
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
63
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
64
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
65
|
+
};
|
|
66
|
+
const accounts = originalAccounts;
|
|
67
|
+
// Original args.
|
|
68
|
+
const args = { ...input };
|
|
69
|
+
// Resolve default values.
|
|
70
|
+
if (!accounts.settings.value) {
|
|
71
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
72
|
+
programAddress,
|
|
73
|
+
seeds: [
|
|
74
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
75
|
+
],
|
|
76
|
+
});
|
|
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.systemProgram.value) {
|
|
90
|
+
accounts.systemProgram.value =
|
|
91
|
+
"11111111111111111111111111111111";
|
|
92
|
+
}
|
|
93
|
+
if (!accounts.eventAuthority.value) {
|
|
94
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
95
|
+
programAddress,
|
|
96
|
+
seeds: [
|
|
97
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
98
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
99
|
+
105, 116, 121,
|
|
100
|
+
])),
|
|
101
|
+
],
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
105
|
+
return Object.freeze({
|
|
106
|
+
accounts: [
|
|
107
|
+
getAccountMeta(accounts.admin),
|
|
108
|
+
getAccountMeta(accounts.settings),
|
|
109
|
+
getAccountMeta(accounts.adminPermissions),
|
|
110
|
+
getAccountMeta(accounts.updateAdminPermissions),
|
|
111
|
+
getAccountMeta(accounts.systemProgram),
|
|
112
|
+
getAccountMeta(accounts.eventAuthority),
|
|
113
|
+
getAccountMeta(accounts.program),
|
|
114
|
+
],
|
|
115
|
+
data: getUpdateRoleHolderInstructionDataEncoder().encode(args),
|
|
116
|
+
programAddress,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
function getUpdateRoleHolderInstruction(input, config) {
|
|
120
|
+
// Program address.
|
|
121
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
122
|
+
// Original accounts.
|
|
123
|
+
const originalAccounts = {
|
|
124
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
125
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
126
|
+
adminPermissions: {
|
|
127
|
+
value: input.adminPermissions ?? null,
|
|
128
|
+
isWritable: true,
|
|
129
|
+
},
|
|
130
|
+
updateAdminPermissions: {
|
|
131
|
+
value: input.updateAdminPermissions ?? null,
|
|
132
|
+
isWritable: true,
|
|
133
|
+
},
|
|
134
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
135
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
136
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
137
|
+
};
|
|
138
|
+
const accounts = originalAccounts;
|
|
139
|
+
// Original args.
|
|
140
|
+
const args = { ...input };
|
|
141
|
+
// Resolve default values.
|
|
142
|
+
if (!accounts.systemProgram.value) {
|
|
143
|
+
accounts.systemProgram.value =
|
|
144
|
+
"11111111111111111111111111111111";
|
|
145
|
+
}
|
|
146
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
147
|
+
return Object.freeze({
|
|
148
|
+
accounts: [
|
|
149
|
+
getAccountMeta(accounts.admin),
|
|
150
|
+
getAccountMeta(accounts.settings),
|
|
151
|
+
getAccountMeta(accounts.adminPermissions),
|
|
152
|
+
getAccountMeta(accounts.updateAdminPermissions),
|
|
153
|
+
getAccountMeta(accounts.systemProgram),
|
|
154
|
+
getAccountMeta(accounts.eventAuthority),
|
|
155
|
+
getAccountMeta(accounts.program),
|
|
156
|
+
],
|
|
157
|
+
data: getUpdateRoleHolderInstructionDataEncoder().encode(args),
|
|
158
|
+
programAddress,
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
function parseUpdateRoleHolderInstruction(instruction) {
|
|
162
|
+
if (instruction.accounts.length < 7) {
|
|
163
|
+
// TODO: Coded error.
|
|
164
|
+
throw new Error("Not enough accounts");
|
|
165
|
+
}
|
|
166
|
+
let accountIndex = 0;
|
|
167
|
+
const getNextAccount = () => {
|
|
168
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
169
|
+
accountIndex += 1;
|
|
170
|
+
return accountMeta;
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
programAddress: instruction.programAddress,
|
|
174
|
+
accounts: {
|
|
175
|
+
admin: getNextAccount(),
|
|
176
|
+
settings: getNextAccount(),
|
|
177
|
+
adminPermissions: getNextAccount(),
|
|
178
|
+
updateAdminPermissions: getNextAccount(),
|
|
179
|
+
systemProgram: getNextAccount(),
|
|
180
|
+
eventAuthority: getNextAccount(),
|
|
181
|
+
program: getNextAccount(),
|
|
182
|
+
},
|
|
183
|
+
data: getUpdateRoleHolderInstructionDataDecoder().decode(instruction.data),
|
|
184
|
+
};
|
|
185
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 WITHDRAW_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getWithdrawDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
+
export type WithdrawInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountPermissions extends string | AccountMeta<string> = string, TAccountLiquidityPool extends string | AccountMeta<string> = string, TAccountLpTokenMint extends string | AccountMeta<string> = string, TAccountCooldownLpTokenAccount extends string | AccountMeta<string> = string, TAccountSignerLpTokenAccount extends string | AccountMeta<string> = string, TAccountCooldown extends string | AccountMeta<string> = string, TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", 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
|
+
TAccountSettings extends string ? WritableAccount<TAccountSettings> : TAccountSettings,
|
|
15
|
+
TAccountPermissions extends string ? ReadonlyAccount<TAccountPermissions> : TAccountPermissions,
|
|
16
|
+
TAccountLiquidityPool extends string ? WritableAccount<TAccountLiquidityPool> : TAccountLiquidityPool,
|
|
17
|
+
TAccountLpTokenMint extends string ? WritableAccount<TAccountLpTokenMint> : TAccountLpTokenMint,
|
|
18
|
+
TAccountCooldownLpTokenAccount extends string ? WritableAccount<TAccountCooldownLpTokenAccount> : TAccountCooldownLpTokenAccount,
|
|
19
|
+
TAccountSignerLpTokenAccount extends string ? WritableAccount<TAccountSignerLpTokenAccount> : TAccountSignerLpTokenAccount,
|
|
20
|
+
TAccountCooldown extends string ? WritableAccount<TAccountCooldown> : TAccountCooldown,
|
|
21
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
22
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
23
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
24
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
25
|
+
...TRemainingAccounts
|
|
26
|
+
]>;
|
|
27
|
+
export type WithdrawInstructionData = {
|
|
28
|
+
discriminator: ReadonlyUint8Array;
|
|
29
|
+
liquidityPoolId: number;
|
|
30
|
+
cooldownId: bigint;
|
|
31
|
+
};
|
|
32
|
+
export type WithdrawInstructionDataArgs = {
|
|
33
|
+
liquidityPoolId: number;
|
|
34
|
+
cooldownId: number | bigint;
|
|
35
|
+
};
|
|
36
|
+
export declare function getWithdrawInstructionDataEncoder(): FixedSizeEncoder<WithdrawInstructionDataArgs>;
|
|
37
|
+
export declare function getWithdrawInstructionDataDecoder(): FixedSizeDecoder<WithdrawInstructionData>;
|
|
38
|
+
export declare function getWithdrawInstructionDataCodec(): FixedSizeCodec<WithdrawInstructionDataArgs, WithdrawInstructionData>;
|
|
39
|
+
export type WithdrawAsyncInput<TAccountSigner extends string = string, TAccountSettings extends string = string, TAccountPermissions extends string = string, TAccountLiquidityPool extends string = string, TAccountLpTokenMint extends string = string, TAccountCooldownLpTokenAccount extends string = string, TAccountSignerLpTokenAccount extends string = string, TAccountCooldown extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
40
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
41
|
+
settings?: Address<TAccountSettings>;
|
|
42
|
+
permissions?: Address<TAccountPermissions>;
|
|
43
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
44
|
+
lpTokenMint: Address<TAccountLpTokenMint>;
|
|
45
|
+
cooldownLpTokenAccount?: Address<TAccountCooldownLpTokenAccount>;
|
|
46
|
+
signerLpTokenAccount: Address<TAccountSignerLpTokenAccount>;
|
|
47
|
+
cooldown: Address<TAccountCooldown>;
|
|
48
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
49
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
50
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
51
|
+
program: Address<TAccountProgram>;
|
|
52
|
+
liquidityPoolId: WithdrawInstructionDataArgs["liquidityPoolId"];
|
|
53
|
+
cooldownId: WithdrawInstructionDataArgs["cooldownId"];
|
|
54
|
+
};
|
|
55
|
+
export declare function getWithdrawInstructionAsync<TAccountSigner extends string, TAccountSettings extends string, TAccountPermissions extends string, TAccountLiquidityPool extends string, TAccountLpTokenMint extends string, TAccountCooldownLpTokenAccount extends string, TAccountSignerLpTokenAccount extends string, TAccountCooldown extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: WithdrawAsyncInput<TAccountSigner, TAccountSettings, TAccountPermissions, TAccountLiquidityPool, TAccountLpTokenMint, TAccountCooldownLpTokenAccount, TAccountSignerLpTokenAccount, TAccountCooldown, TAccountTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
56
|
+
programAddress?: TProgramAddress;
|
|
57
|
+
}): Promise<WithdrawInstruction<TProgramAddress, TAccountSigner, TAccountSettings, TAccountPermissions, TAccountLiquidityPool, TAccountLpTokenMint, TAccountCooldownLpTokenAccount, TAccountSignerLpTokenAccount, TAccountCooldown, TAccountTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
58
|
+
export type WithdrawInput<TAccountSigner extends string = string, TAccountSettings extends string = string, TAccountPermissions extends string = string, TAccountLiquidityPool extends string = string, TAccountLpTokenMint extends string = string, TAccountCooldownLpTokenAccount extends string = string, TAccountSignerLpTokenAccount extends string = string, TAccountCooldown extends string = string, TAccountTokenProgram extends string = string, TAccountSystemProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
59
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
60
|
+
settings: Address<TAccountSettings>;
|
|
61
|
+
permissions?: Address<TAccountPermissions>;
|
|
62
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
63
|
+
lpTokenMint: Address<TAccountLpTokenMint>;
|
|
64
|
+
cooldownLpTokenAccount: Address<TAccountCooldownLpTokenAccount>;
|
|
65
|
+
signerLpTokenAccount: Address<TAccountSignerLpTokenAccount>;
|
|
66
|
+
cooldown: Address<TAccountCooldown>;
|
|
67
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
68
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
69
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
70
|
+
program: Address<TAccountProgram>;
|
|
71
|
+
liquidityPoolId: WithdrawInstructionDataArgs["liquidityPoolId"];
|
|
72
|
+
cooldownId: WithdrawInstructionDataArgs["cooldownId"];
|
|
73
|
+
};
|
|
74
|
+
export declare function getWithdrawInstruction<TAccountSigner extends string, TAccountSettings extends string, TAccountPermissions extends string, TAccountLiquidityPool extends string, TAccountLpTokenMint extends string, TAccountCooldownLpTokenAccount extends string, TAccountSignerLpTokenAccount extends string, TAccountCooldown extends string, TAccountTokenProgram extends string, TAccountSystemProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: WithdrawInput<TAccountSigner, TAccountSettings, TAccountPermissions, TAccountLiquidityPool, TAccountLpTokenMint, TAccountCooldownLpTokenAccount, TAccountSignerLpTokenAccount, TAccountCooldown, TAccountTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
75
|
+
programAddress?: TProgramAddress;
|
|
76
|
+
}): WithdrawInstruction<TProgramAddress, TAccountSigner, TAccountSettings, TAccountPermissions, TAccountLiquidityPool, TAccountLpTokenMint, TAccountCooldownLpTokenAccount, TAccountSignerLpTokenAccount, TAccountCooldown, TAccountTokenProgram, TAccountSystemProgram, TAccountEventAuthority, TAccountProgram>;
|
|
77
|
+
export type ParsedWithdrawInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
78
|
+
programAddress: Address<TProgram>;
|
|
79
|
+
accounts: {
|
|
80
|
+
signer: TAccountMetas[0];
|
|
81
|
+
settings: TAccountMetas[1];
|
|
82
|
+
permissions?: TAccountMetas[2] | undefined;
|
|
83
|
+
liquidityPool: TAccountMetas[3];
|
|
84
|
+
lpTokenMint: TAccountMetas[4];
|
|
85
|
+
cooldownLpTokenAccount: TAccountMetas[5];
|
|
86
|
+
signerLpTokenAccount: TAccountMetas[6];
|
|
87
|
+
cooldown: TAccountMetas[7];
|
|
88
|
+
tokenProgram: TAccountMetas[8];
|
|
89
|
+
systemProgram?: TAccountMetas[9] | undefined;
|
|
90
|
+
eventAuthority: TAccountMetas[10];
|
|
91
|
+
program: TAccountMetas[11];
|
|
92
|
+
};
|
|
93
|
+
data: WithdrawInstructionData;
|
|
94
|
+
};
|
|
95
|
+
export declare function parseWithdrawInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedWithdrawInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,235 @@
|
|
|
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.WITHDRAW_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getWithdrawDiscriminatorBytes = getWithdrawDiscriminatorBytes;
|
|
12
|
+
exports.getWithdrawInstructionDataEncoder = getWithdrawInstructionDataEncoder;
|
|
13
|
+
exports.getWithdrawInstructionDataDecoder = getWithdrawInstructionDataDecoder;
|
|
14
|
+
exports.getWithdrawInstructionDataCodec = getWithdrawInstructionDataCodec;
|
|
15
|
+
exports.getWithdrawInstructionAsync = getWithdrawInstructionAsync;
|
|
16
|
+
exports.getWithdrawInstruction = getWithdrawInstruction;
|
|
17
|
+
exports.parseWithdrawInstruction = parseWithdrawInstruction;
|
|
18
|
+
const kit_1 = require("@solana/kit");
|
|
19
|
+
const programs_1 = require("../programs");
|
|
20
|
+
const shared_1 = require("../shared");
|
|
21
|
+
exports.WITHDRAW_DISCRIMINATOR = new Uint8Array([
|
|
22
|
+
183, 18, 70, 156, 148, 109, 161, 34,
|
|
23
|
+
]);
|
|
24
|
+
function getWithdrawDiscriminatorBytes() {
|
|
25
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.WITHDRAW_DISCRIMINATOR);
|
|
26
|
+
}
|
|
27
|
+
function getWithdrawInstructionDataEncoder() {
|
|
28
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
29
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
30
|
+
["liquidityPoolId", (0, kit_1.getU8Encoder)()],
|
|
31
|
+
["cooldownId", (0, kit_1.getU64Encoder)()],
|
|
32
|
+
]), (value) => ({ ...value, discriminator: exports.WITHDRAW_DISCRIMINATOR }));
|
|
33
|
+
}
|
|
34
|
+
function getWithdrawInstructionDataDecoder() {
|
|
35
|
+
return (0, kit_1.getStructDecoder)([
|
|
36
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
37
|
+
["liquidityPoolId", (0, kit_1.getU8Decoder)()],
|
|
38
|
+
["cooldownId", (0, kit_1.getU64Decoder)()],
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
function getWithdrawInstructionDataCodec() {
|
|
42
|
+
return (0, kit_1.combineCodec)(getWithdrawInstructionDataEncoder(), getWithdrawInstructionDataDecoder());
|
|
43
|
+
}
|
|
44
|
+
async function getWithdrawInstructionAsync(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
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
51
|
+
permissions: { value: input.permissions ?? null, isWritable: false },
|
|
52
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
53
|
+
lpTokenMint: { value: input.lpTokenMint ?? null, isWritable: true },
|
|
54
|
+
cooldownLpTokenAccount: {
|
|
55
|
+
value: input.cooldownLpTokenAccount ?? null,
|
|
56
|
+
isWritable: true,
|
|
57
|
+
},
|
|
58
|
+
signerLpTokenAccount: {
|
|
59
|
+
value: input.signerLpTokenAccount ?? null,
|
|
60
|
+
isWritable: true,
|
|
61
|
+
},
|
|
62
|
+
cooldown: { value: input.cooldown ?? null, isWritable: true },
|
|
63
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
64
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
65
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
66
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
67
|
+
};
|
|
68
|
+
const accounts = originalAccounts;
|
|
69
|
+
// Original args.
|
|
70
|
+
const args = { ...input };
|
|
71
|
+
// Resolve default values.
|
|
72
|
+
if (!accounts.settings.value) {
|
|
73
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
74
|
+
programAddress,
|
|
75
|
+
seeds: [
|
|
76
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
77
|
+
],
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
if (!accounts.permissions.value) {
|
|
81
|
+
accounts.permissions.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
82
|
+
programAddress,
|
|
83
|
+
seeds: [
|
|
84
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
85
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
86
|
+
])),
|
|
87
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.signer.value)),
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (!accounts.cooldownLpTokenAccount.value) {
|
|
92
|
+
accounts.cooldownLpTokenAccount.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
93
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
94
|
+
seeds: [
|
|
95
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.cooldown.value)),
|
|
96
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
97
|
+
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235,
|
|
98
|
+
121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58, 140, 245, 133,
|
|
99
|
+
126, 255, 0, 169,
|
|
100
|
+
])),
|
|
101
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.lpTokenMint.value)),
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
if (!accounts.tokenProgram.value) {
|
|
106
|
+
accounts.tokenProgram.value =
|
|
107
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
108
|
+
}
|
|
109
|
+
if (!accounts.systemProgram.value) {
|
|
110
|
+
accounts.systemProgram.value =
|
|
111
|
+
"11111111111111111111111111111111";
|
|
112
|
+
}
|
|
113
|
+
if (!accounts.eventAuthority.value) {
|
|
114
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
115
|
+
programAddress,
|
|
116
|
+
seeds: [
|
|
117
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
118
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
119
|
+
105, 116, 121,
|
|
120
|
+
])),
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
125
|
+
return Object.freeze({
|
|
126
|
+
accounts: [
|
|
127
|
+
getAccountMeta(accounts.signer),
|
|
128
|
+
getAccountMeta(accounts.settings),
|
|
129
|
+
getAccountMeta(accounts.permissions),
|
|
130
|
+
getAccountMeta(accounts.liquidityPool),
|
|
131
|
+
getAccountMeta(accounts.lpTokenMint),
|
|
132
|
+
getAccountMeta(accounts.cooldownLpTokenAccount),
|
|
133
|
+
getAccountMeta(accounts.signerLpTokenAccount),
|
|
134
|
+
getAccountMeta(accounts.cooldown),
|
|
135
|
+
getAccountMeta(accounts.tokenProgram),
|
|
136
|
+
getAccountMeta(accounts.systemProgram),
|
|
137
|
+
getAccountMeta(accounts.eventAuthority),
|
|
138
|
+
getAccountMeta(accounts.program),
|
|
139
|
+
],
|
|
140
|
+
data: getWithdrawInstructionDataEncoder().encode(args),
|
|
141
|
+
programAddress,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function getWithdrawInstruction(input, config) {
|
|
145
|
+
// Program address.
|
|
146
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
147
|
+
// Original accounts.
|
|
148
|
+
const originalAccounts = {
|
|
149
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
150
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
151
|
+
permissions: { value: input.permissions ?? null, isWritable: false },
|
|
152
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
153
|
+
lpTokenMint: { value: input.lpTokenMint ?? null, isWritable: true },
|
|
154
|
+
cooldownLpTokenAccount: {
|
|
155
|
+
value: input.cooldownLpTokenAccount ?? null,
|
|
156
|
+
isWritable: true,
|
|
157
|
+
},
|
|
158
|
+
signerLpTokenAccount: {
|
|
159
|
+
value: input.signerLpTokenAccount ?? null,
|
|
160
|
+
isWritable: true,
|
|
161
|
+
},
|
|
162
|
+
cooldown: { value: input.cooldown ?? null, isWritable: true },
|
|
163
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
164
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
165
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
166
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
167
|
+
};
|
|
168
|
+
const accounts = originalAccounts;
|
|
169
|
+
// Original args.
|
|
170
|
+
const args = { ...input };
|
|
171
|
+
// Resolve default values.
|
|
172
|
+
if (!accounts.tokenProgram.value) {
|
|
173
|
+
accounts.tokenProgram.value =
|
|
174
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
175
|
+
}
|
|
176
|
+
if (!accounts.systemProgram.value) {
|
|
177
|
+
accounts.systemProgram.value =
|
|
178
|
+
"11111111111111111111111111111111";
|
|
179
|
+
}
|
|
180
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
181
|
+
return Object.freeze({
|
|
182
|
+
accounts: [
|
|
183
|
+
getAccountMeta(accounts.signer),
|
|
184
|
+
getAccountMeta(accounts.settings),
|
|
185
|
+
getAccountMeta(accounts.permissions),
|
|
186
|
+
getAccountMeta(accounts.liquidityPool),
|
|
187
|
+
getAccountMeta(accounts.lpTokenMint),
|
|
188
|
+
getAccountMeta(accounts.cooldownLpTokenAccount),
|
|
189
|
+
getAccountMeta(accounts.signerLpTokenAccount),
|
|
190
|
+
getAccountMeta(accounts.cooldown),
|
|
191
|
+
getAccountMeta(accounts.tokenProgram),
|
|
192
|
+
getAccountMeta(accounts.systemProgram),
|
|
193
|
+
getAccountMeta(accounts.eventAuthority),
|
|
194
|
+
getAccountMeta(accounts.program),
|
|
195
|
+
],
|
|
196
|
+
data: getWithdrawInstructionDataEncoder().encode(args),
|
|
197
|
+
programAddress,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function parseWithdrawInstruction(instruction) {
|
|
201
|
+
if (instruction.accounts.length < 12) {
|
|
202
|
+
// TODO: Coded error.
|
|
203
|
+
throw new Error("Not enough accounts");
|
|
204
|
+
}
|
|
205
|
+
let accountIndex = 0;
|
|
206
|
+
const getNextAccount = () => {
|
|
207
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
208
|
+
accountIndex += 1;
|
|
209
|
+
return accountMeta;
|
|
210
|
+
};
|
|
211
|
+
const getNextOptionalAccount = () => {
|
|
212
|
+
const accountMeta = getNextAccount();
|
|
213
|
+
return accountMeta.address === programs_1.RLP_PROGRAM_ADDRESS
|
|
214
|
+
? undefined
|
|
215
|
+
: accountMeta;
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
programAddress: instruction.programAddress,
|
|
219
|
+
accounts: {
|
|
220
|
+
signer: getNextAccount(),
|
|
221
|
+
settings: getNextAccount(),
|
|
222
|
+
permissions: getNextOptionalAccount(),
|
|
223
|
+
liquidityPool: getNextAccount(),
|
|
224
|
+
lpTokenMint: getNextAccount(),
|
|
225
|
+
cooldownLpTokenAccount: getNextAccount(),
|
|
226
|
+
signerLpTokenAccount: getNextAccount(),
|
|
227
|
+
cooldown: getNextAccount(),
|
|
228
|
+
tokenProgram: getNextAccount(),
|
|
229
|
+
systemProgram: getNextOptionalAccount(),
|
|
230
|
+
eventAuthority: getNextAccount(),
|
|
231
|
+
program: getNextAccount(),
|
|
232
|
+
},
|
|
233
|
+
data: getWithdrawInstructionDataDecoder().decode(instruction.data),
|
|
234
|
+
};
|
|
235
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This code was AUTOGENERATED using the Codama library.
|
|
4
|
+
* Please DO NOT EDIT THIS FILE, instead use visitors
|
|
5
|
+
* to add features, then rerun Codama to update it.
|
|
6
|
+
*
|
|
7
|
+
* @see https://github.com/codama-idl/codama
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
__exportStar(require("./rlp"), exports);
|