@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,175 @@
|
|
|
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.FREEZE_FUNCTIONALITY_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getFreezeFunctionalityDiscriminatorBytes = getFreezeFunctionalityDiscriminatorBytes;
|
|
12
|
+
exports.getFreezeFunctionalityInstructionDataEncoder = getFreezeFunctionalityInstructionDataEncoder;
|
|
13
|
+
exports.getFreezeFunctionalityInstructionDataDecoder = getFreezeFunctionalityInstructionDataDecoder;
|
|
14
|
+
exports.getFreezeFunctionalityInstructionDataCodec = getFreezeFunctionalityInstructionDataCodec;
|
|
15
|
+
exports.getFreezeFunctionalityInstructionAsync = getFreezeFunctionalityInstructionAsync;
|
|
16
|
+
exports.getFreezeFunctionalityInstruction = getFreezeFunctionalityInstruction;
|
|
17
|
+
exports.parseFreezeFunctionalityInstruction = parseFreezeFunctionalityInstruction;
|
|
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.FREEZE_FUNCTIONALITY_DISCRIMINATOR = new Uint8Array([
|
|
23
|
+
65, 152, 119, 202, 25, 239, 206, 157,
|
|
24
|
+
]);
|
|
25
|
+
function getFreezeFunctionalityDiscriminatorBytes() {
|
|
26
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.FREEZE_FUNCTIONALITY_DISCRIMINATOR);
|
|
27
|
+
}
|
|
28
|
+
function getFreezeFunctionalityInstructionDataEncoder() {
|
|
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
|
+
["freeze", (0, kit_1.getBooleanEncoder)()],
|
|
33
|
+
]), (value) => ({
|
|
34
|
+
...value,
|
|
35
|
+
discriminator: exports.FREEZE_FUNCTIONALITY_DISCRIMINATOR,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
function getFreezeFunctionalityInstructionDataDecoder() {
|
|
39
|
+
return (0, kit_1.getStructDecoder)([
|
|
40
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
41
|
+
["action", (0, types_1.getActionDecoder)()],
|
|
42
|
+
["freeze", (0, kit_1.getBooleanDecoder)()],
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
function getFreezeFunctionalityInstructionDataCodec() {
|
|
46
|
+
return (0, kit_1.combineCodec)(getFreezeFunctionalityInstructionDataEncoder(), getFreezeFunctionalityInstructionDataDecoder());
|
|
47
|
+
}
|
|
48
|
+
async function getFreezeFunctionalityInstructionAsync(input, config) {
|
|
49
|
+
// Program address.
|
|
50
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
51
|
+
// Original accounts.
|
|
52
|
+
const originalAccounts = {
|
|
53
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
54
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
55
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
56
|
+
adminPermissions: {
|
|
57
|
+
value: input.adminPermissions ?? null,
|
|
58
|
+
isWritable: true,
|
|
59
|
+
},
|
|
60
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
61
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
62
|
+
};
|
|
63
|
+
const accounts = originalAccounts;
|
|
64
|
+
// Original args.
|
|
65
|
+
const args = { ...input };
|
|
66
|
+
// Resolve default values.
|
|
67
|
+
if (!accounts.settings.value) {
|
|
68
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
69
|
+
programAddress,
|
|
70
|
+
seeds: [
|
|
71
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
72
|
+
],
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
if (!accounts.systemProgram.value) {
|
|
76
|
+
accounts.systemProgram.value =
|
|
77
|
+
"11111111111111111111111111111111";
|
|
78
|
+
}
|
|
79
|
+
if (!accounts.adminPermissions.value) {
|
|
80
|
+
accounts.adminPermissions.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
81
|
+
programAddress,
|
|
82
|
+
seeds: [
|
|
83
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
84
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
85
|
+
])),
|
|
86
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.admin.value)),
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
if (!accounts.eventAuthority.value) {
|
|
91
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
92
|
+
programAddress,
|
|
93
|
+
seeds: [
|
|
94
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
95
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
96
|
+
105, 116, 121,
|
|
97
|
+
])),
|
|
98
|
+
],
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
102
|
+
return Object.freeze({
|
|
103
|
+
accounts: [
|
|
104
|
+
getAccountMeta(accounts.admin),
|
|
105
|
+
getAccountMeta(accounts.settings),
|
|
106
|
+
getAccountMeta(accounts.systemProgram),
|
|
107
|
+
getAccountMeta(accounts.adminPermissions),
|
|
108
|
+
getAccountMeta(accounts.eventAuthority),
|
|
109
|
+
getAccountMeta(accounts.program),
|
|
110
|
+
],
|
|
111
|
+
data: getFreezeFunctionalityInstructionDataEncoder().encode(args),
|
|
112
|
+
programAddress,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function getFreezeFunctionalityInstruction(input, config) {
|
|
116
|
+
// Program address.
|
|
117
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
118
|
+
// Original accounts.
|
|
119
|
+
const originalAccounts = {
|
|
120
|
+
admin: { value: input.admin ?? null, isWritable: true },
|
|
121
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
122
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
123
|
+
adminPermissions: {
|
|
124
|
+
value: input.adminPermissions ?? null,
|
|
125
|
+
isWritable: true,
|
|
126
|
+
},
|
|
127
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
128
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
129
|
+
};
|
|
130
|
+
const accounts = originalAccounts;
|
|
131
|
+
// Original args.
|
|
132
|
+
const args = { ...input };
|
|
133
|
+
// Resolve default values.
|
|
134
|
+
if (!accounts.systemProgram.value) {
|
|
135
|
+
accounts.systemProgram.value =
|
|
136
|
+
"11111111111111111111111111111111";
|
|
137
|
+
}
|
|
138
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
139
|
+
return Object.freeze({
|
|
140
|
+
accounts: [
|
|
141
|
+
getAccountMeta(accounts.admin),
|
|
142
|
+
getAccountMeta(accounts.settings),
|
|
143
|
+
getAccountMeta(accounts.systemProgram),
|
|
144
|
+
getAccountMeta(accounts.adminPermissions),
|
|
145
|
+
getAccountMeta(accounts.eventAuthority),
|
|
146
|
+
getAccountMeta(accounts.program),
|
|
147
|
+
],
|
|
148
|
+
data: getFreezeFunctionalityInstructionDataEncoder().encode(args),
|
|
149
|
+
programAddress,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function parseFreezeFunctionalityInstruction(instruction) {
|
|
153
|
+
if (instruction.accounts.length < 6) {
|
|
154
|
+
// TODO: Coded error.
|
|
155
|
+
throw new Error("Not enough accounts");
|
|
156
|
+
}
|
|
157
|
+
let accountIndex = 0;
|
|
158
|
+
const getNextAccount = () => {
|
|
159
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
160
|
+
accountIndex += 1;
|
|
161
|
+
return accountMeta;
|
|
162
|
+
};
|
|
163
|
+
return {
|
|
164
|
+
programAddress: instruction.programAddress,
|
|
165
|
+
accounts: {
|
|
166
|
+
admin: getNextAccount(),
|
|
167
|
+
settings: getNextAccount(),
|
|
168
|
+
systemProgram: getNextAccount(),
|
|
169
|
+
adminPermissions: getNextAccount(),
|
|
170
|
+
eventAuthority: getNextAccount(),
|
|
171
|
+
program: getNextAccount(),
|
|
172
|
+
},
|
|
173
|
+
data: getFreezeFunctionalityInstructionDataDecoder().decode(instruction.data),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
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
|
+
export * from "./addAsset";
|
|
9
|
+
export * from "./createPermissionAccount";
|
|
10
|
+
export * from "./deposit";
|
|
11
|
+
export * from "./forceRemoveAsset";
|
|
12
|
+
export * from "./freezeFunctionality";
|
|
13
|
+
export * from "./initializeLp";
|
|
14
|
+
export * from "./initializePoolReserve";
|
|
15
|
+
export * from "./initializeRlp";
|
|
16
|
+
export * from "./requestWithdrawal";
|
|
17
|
+
export * from "./slash";
|
|
18
|
+
export * from "./swap";
|
|
19
|
+
export * from "./updateActionRole";
|
|
20
|
+
export * from "./updateDepositCap";
|
|
21
|
+
export * from "./updateOracle";
|
|
22
|
+
export * from "./updateRoleHolder";
|
|
23
|
+
export * from "./withdraw";
|
|
@@ -0,0 +1,39 @@
|
|
|
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("./addAsset"), exports);
|
|
25
|
+
__exportStar(require("./createPermissionAccount"), exports);
|
|
26
|
+
__exportStar(require("./deposit"), exports);
|
|
27
|
+
__exportStar(require("./forceRemoveAsset"), exports);
|
|
28
|
+
__exportStar(require("./freezeFunctionality"), exports);
|
|
29
|
+
__exportStar(require("./initializeLp"), exports);
|
|
30
|
+
__exportStar(require("./initializePoolReserve"), exports);
|
|
31
|
+
__exportStar(require("./initializeRlp"), exports);
|
|
32
|
+
__exportStar(require("./requestWithdrawal"), exports);
|
|
33
|
+
__exportStar(require("./slash"), exports);
|
|
34
|
+
__exportStar(require("./swap"), exports);
|
|
35
|
+
__exportStar(require("./updateActionRole"), exports);
|
|
36
|
+
__exportStar(require("./updateDepositCap"), exports);
|
|
37
|
+
__exportStar(require("./updateOracle"), exports);
|
|
38
|
+
__exportStar(require("./updateRoleHolder"), exports);
|
|
39
|
+
__exportStar(require("./withdraw"), exports);
|
|
@@ -0,0 +1,99 @@
|
|
|
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 INITIALIZE_LP_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getInitializeLpDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
+
export type InitializeLpInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountPermissions extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountLiquidityPool extends string | AccountMeta<string> = string, TAccountLpTokenMint extends string | AccountMeta<string> = string, TAccountDeadSharesVault extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountAssociatedTokenProgram extends string | AccountMeta<string> = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", 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
|
+
TAccountPermissions extends string ? WritableAccount<TAccountPermissions> : TAccountPermissions,
|
|
15
|
+
TAccountSettings extends string ? WritableAccount<TAccountSettings> : TAccountSettings,
|
|
16
|
+
TAccountLiquidityPool extends string ? WritableAccount<TAccountLiquidityPool> : TAccountLiquidityPool,
|
|
17
|
+
TAccountLpTokenMint extends string ? WritableAccount<TAccountLpTokenMint> : TAccountLpTokenMint,
|
|
18
|
+
TAccountDeadSharesVault extends string ? WritableAccount<TAccountDeadSharesVault> : TAccountDeadSharesVault,
|
|
19
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
20
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
21
|
+
TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
|
|
22
|
+
TAccountEventAuthority extends string ? ReadonlyAccount<TAccountEventAuthority> : TAccountEventAuthority,
|
|
23
|
+
TAccountProgram extends string ? ReadonlyAccount<TAccountProgram> : TAccountProgram,
|
|
24
|
+
...TRemainingAccounts
|
|
25
|
+
]>;
|
|
26
|
+
export type InitializeLpInstructionData = {
|
|
27
|
+
discriminator: ReadonlyUint8Array;
|
|
28
|
+
cooldownDuration: bigint;
|
|
29
|
+
depositCap: Option<bigint>;
|
|
30
|
+
assets: ReadonlyUint8Array;
|
|
31
|
+
protectedVault: Option<Address>;
|
|
32
|
+
};
|
|
33
|
+
export type InitializeLpInstructionDataArgs = {
|
|
34
|
+
cooldownDuration: number | bigint;
|
|
35
|
+
depositCap: OptionOrNullable<number | bigint>;
|
|
36
|
+
assets: ReadonlyUint8Array;
|
|
37
|
+
protectedVault: OptionOrNullable<Address>;
|
|
38
|
+
};
|
|
39
|
+
export declare function getInitializeLpInstructionDataEncoder(): Encoder<InitializeLpInstructionDataArgs>;
|
|
40
|
+
export declare function getInitializeLpInstructionDataDecoder(): Decoder<InitializeLpInstructionData>;
|
|
41
|
+
export declare function getInitializeLpInstructionDataCodec(): Codec<InitializeLpInstructionDataArgs, InitializeLpInstructionData>;
|
|
42
|
+
export type InitializeLpAsyncInput<TAccountSigner extends string = string, TAccountPermissions extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountLpTokenMint extends string = string, TAccountDeadSharesVault extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
43
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
44
|
+
permissions?: Address<TAccountPermissions>;
|
|
45
|
+
settings?: Address<TAccountSettings>;
|
|
46
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
47
|
+
lpTokenMint: Address<TAccountLpTokenMint>;
|
|
48
|
+
deadSharesVault?: Address<TAccountDeadSharesVault>;
|
|
49
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
50
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
51
|
+
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
52
|
+
eventAuthority?: Address<TAccountEventAuthority>;
|
|
53
|
+
program: Address<TAccountProgram>;
|
|
54
|
+
cooldownDuration: InitializeLpInstructionDataArgs["cooldownDuration"];
|
|
55
|
+
depositCap: InitializeLpInstructionDataArgs["depositCap"];
|
|
56
|
+
assets: InitializeLpInstructionDataArgs["assets"];
|
|
57
|
+
protectedVault: InitializeLpInstructionDataArgs["protectedVault"];
|
|
58
|
+
};
|
|
59
|
+
export declare function getInitializeLpInstructionAsync<TAccountSigner extends string, TAccountPermissions extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountLpTokenMint extends string, TAccountDeadSharesVault extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: InitializeLpAsyncInput<TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountLpTokenMint, TAccountDeadSharesVault, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
60
|
+
programAddress?: TProgramAddress;
|
|
61
|
+
}): Promise<InitializeLpInstruction<TProgramAddress, TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountLpTokenMint, TAccountDeadSharesVault, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountEventAuthority, TAccountProgram>>;
|
|
62
|
+
export type InitializeLpInput<TAccountSigner extends string = string, TAccountPermissions extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountLpTokenMint extends string = string, TAccountDeadSharesVault extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string, TAccountEventAuthority extends string = string, TAccountProgram extends string = string> = {
|
|
63
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
64
|
+
permissions: Address<TAccountPermissions>;
|
|
65
|
+
settings: Address<TAccountSettings>;
|
|
66
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
67
|
+
lpTokenMint: Address<TAccountLpTokenMint>;
|
|
68
|
+
deadSharesVault: Address<TAccountDeadSharesVault>;
|
|
69
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
70
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
71
|
+
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
72
|
+
eventAuthority: Address<TAccountEventAuthority>;
|
|
73
|
+
program: Address<TAccountProgram>;
|
|
74
|
+
cooldownDuration: InitializeLpInstructionDataArgs["cooldownDuration"];
|
|
75
|
+
depositCap: InitializeLpInstructionDataArgs["depositCap"];
|
|
76
|
+
assets: InitializeLpInstructionDataArgs["assets"];
|
|
77
|
+
protectedVault: InitializeLpInstructionDataArgs["protectedVault"];
|
|
78
|
+
};
|
|
79
|
+
export declare function getInitializeLpInstruction<TAccountSigner extends string, TAccountPermissions extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountLpTokenMint extends string, TAccountDeadSharesVault extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TAccountEventAuthority extends string, TAccountProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: InitializeLpInput<TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountLpTokenMint, TAccountDeadSharesVault, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountEventAuthority, TAccountProgram>, config?: {
|
|
80
|
+
programAddress?: TProgramAddress;
|
|
81
|
+
}): InitializeLpInstruction<TProgramAddress, TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountLpTokenMint, TAccountDeadSharesVault, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram, TAccountEventAuthority, TAccountProgram>;
|
|
82
|
+
export type ParsedInitializeLpInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
83
|
+
programAddress: Address<TProgram>;
|
|
84
|
+
accounts: {
|
|
85
|
+
signer: TAccountMetas[0];
|
|
86
|
+
permissions: TAccountMetas[1];
|
|
87
|
+
settings: TAccountMetas[2];
|
|
88
|
+
liquidityPool: TAccountMetas[3];
|
|
89
|
+
lpTokenMint: TAccountMetas[4];
|
|
90
|
+
deadSharesVault: TAccountMetas[5];
|
|
91
|
+
systemProgram: TAccountMetas[6];
|
|
92
|
+
tokenProgram: TAccountMetas[7];
|
|
93
|
+
associatedTokenProgram: TAccountMetas[8];
|
|
94
|
+
eventAuthority: TAccountMetas[9];
|
|
95
|
+
program: TAccountMetas[10];
|
|
96
|
+
};
|
|
97
|
+
data: InitializeLpInstructionData;
|
|
98
|
+
};
|
|
99
|
+
export declare function parseInitializeLpInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedInitializeLpInstruction<TProgram, TAccountMetas>;
|
|
@@ -0,0 +1,230 @@
|
|
|
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.INITIALIZE_LP_DISCRIMINATOR = void 0;
|
|
11
|
+
exports.getInitializeLpDiscriminatorBytes = getInitializeLpDiscriminatorBytes;
|
|
12
|
+
exports.getInitializeLpInstructionDataEncoder = getInitializeLpInstructionDataEncoder;
|
|
13
|
+
exports.getInitializeLpInstructionDataDecoder = getInitializeLpInstructionDataDecoder;
|
|
14
|
+
exports.getInitializeLpInstructionDataCodec = getInitializeLpInstructionDataCodec;
|
|
15
|
+
exports.getInitializeLpInstructionAsync = getInitializeLpInstructionAsync;
|
|
16
|
+
exports.getInitializeLpInstruction = getInitializeLpInstruction;
|
|
17
|
+
exports.parseInitializeLpInstruction = parseInitializeLpInstruction;
|
|
18
|
+
const kit_1 = require("@solana/kit");
|
|
19
|
+
const programs_1 = require("../programs");
|
|
20
|
+
const shared_1 = require("../shared");
|
|
21
|
+
exports.INITIALIZE_LP_DISCRIMINATOR = new Uint8Array([
|
|
22
|
+
110, 252, 116, 251, 81, 191, 57, 96,
|
|
23
|
+
]);
|
|
24
|
+
function getInitializeLpDiscriminatorBytes() {
|
|
25
|
+
return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.INITIALIZE_LP_DISCRIMINATOR);
|
|
26
|
+
}
|
|
27
|
+
function getInitializeLpInstructionDataEncoder() {
|
|
28
|
+
return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([
|
|
29
|
+
["discriminator", (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)],
|
|
30
|
+
["cooldownDuration", (0, kit_1.getU64Encoder)()],
|
|
31
|
+
["depositCap", (0, kit_1.getOptionEncoder)((0, kit_1.getU64Encoder)())],
|
|
32
|
+
["assets", (0, kit_1.addEncoderSizePrefix)((0, kit_1.getBytesEncoder)(), (0, kit_1.getU32Encoder)())],
|
|
33
|
+
["protectedVault", (0, kit_1.getOptionEncoder)((0, kit_1.getAddressEncoder)())],
|
|
34
|
+
]), (value) => ({ ...value, discriminator: exports.INITIALIZE_LP_DISCRIMINATOR }));
|
|
35
|
+
}
|
|
36
|
+
function getInitializeLpInstructionDataDecoder() {
|
|
37
|
+
return (0, kit_1.getStructDecoder)([
|
|
38
|
+
["discriminator", (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
|
|
39
|
+
["cooldownDuration", (0, kit_1.getU64Decoder)()],
|
|
40
|
+
["depositCap", (0, kit_1.getOptionDecoder)((0, kit_1.getU64Decoder)())],
|
|
41
|
+
["assets", (0, kit_1.addDecoderSizePrefix)((0, kit_1.getBytesDecoder)(), (0, kit_1.getU32Decoder)())],
|
|
42
|
+
["protectedVault", (0, kit_1.getOptionDecoder)((0, kit_1.getAddressDecoder)())],
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
45
|
+
function getInitializeLpInstructionDataCodec() {
|
|
46
|
+
return (0, kit_1.combineCodec)(getInitializeLpInstructionDataEncoder(), getInitializeLpInstructionDataDecoder());
|
|
47
|
+
}
|
|
48
|
+
async function getInitializeLpInstructionAsync(input, config) {
|
|
49
|
+
// Program address.
|
|
50
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
51
|
+
// Original accounts.
|
|
52
|
+
const originalAccounts = {
|
|
53
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
54
|
+
permissions: { value: input.permissions ?? null, isWritable: true },
|
|
55
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
56
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
57
|
+
lpTokenMint: { value: input.lpTokenMint ?? null, isWritable: true },
|
|
58
|
+
deadSharesVault: { value: input.deadSharesVault ?? null, isWritable: true },
|
|
59
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
60
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
61
|
+
associatedTokenProgram: {
|
|
62
|
+
value: input.associatedTokenProgram ?? null,
|
|
63
|
+
isWritable: false,
|
|
64
|
+
},
|
|
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.permissions.value) {
|
|
73
|
+
accounts.permissions.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
74
|
+
programAddress,
|
|
75
|
+
seeds: [
|
|
76
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
77
|
+
112, 101, 114, 109, 105, 115, 115, 105, 111, 110, 115,
|
|
78
|
+
])),
|
|
79
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.signer.value)),
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
if (!accounts.settings.value) {
|
|
84
|
+
accounts.settings.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
85
|
+
programAddress,
|
|
86
|
+
seeds: [
|
|
87
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([115, 101, 116, 116, 105, 110, 103, 115])),
|
|
88
|
+
],
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
if (!accounts.deadSharesVault.value) {
|
|
92
|
+
accounts.deadSharesVault.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
93
|
+
programAddress: "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL",
|
|
94
|
+
seeds: [
|
|
95
|
+
(0, kit_1.getAddressEncoder)().encode((0, shared_1.expectAddress)(accounts.liquidityPool.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.systemProgram.value) {
|
|
106
|
+
accounts.systemProgram.value =
|
|
107
|
+
"11111111111111111111111111111111";
|
|
108
|
+
}
|
|
109
|
+
if (!accounts.tokenProgram.value) {
|
|
110
|
+
accounts.tokenProgram.value =
|
|
111
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
112
|
+
}
|
|
113
|
+
if (!accounts.associatedTokenProgram.value) {
|
|
114
|
+
accounts.associatedTokenProgram.value =
|
|
115
|
+
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
116
|
+
}
|
|
117
|
+
if (!accounts.eventAuthority.value) {
|
|
118
|
+
accounts.eventAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
|
|
119
|
+
programAddress,
|
|
120
|
+
seeds: [
|
|
121
|
+
(0, kit_1.getBytesEncoder)().encode(new Uint8Array([
|
|
122
|
+
95, 95, 101, 118, 101, 110, 116, 95, 97, 117, 116, 104, 111, 114,
|
|
123
|
+
105, 116, 121,
|
|
124
|
+
])),
|
|
125
|
+
],
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
accounts: [
|
|
131
|
+
getAccountMeta(accounts.signer),
|
|
132
|
+
getAccountMeta(accounts.permissions),
|
|
133
|
+
getAccountMeta(accounts.settings),
|
|
134
|
+
getAccountMeta(accounts.liquidityPool),
|
|
135
|
+
getAccountMeta(accounts.lpTokenMint),
|
|
136
|
+
getAccountMeta(accounts.deadSharesVault),
|
|
137
|
+
getAccountMeta(accounts.systemProgram),
|
|
138
|
+
getAccountMeta(accounts.tokenProgram),
|
|
139
|
+
getAccountMeta(accounts.associatedTokenProgram),
|
|
140
|
+
getAccountMeta(accounts.eventAuthority),
|
|
141
|
+
getAccountMeta(accounts.program),
|
|
142
|
+
],
|
|
143
|
+
data: getInitializeLpInstructionDataEncoder().encode(args),
|
|
144
|
+
programAddress,
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function getInitializeLpInstruction(input, config) {
|
|
148
|
+
// Program address.
|
|
149
|
+
const programAddress = config?.programAddress ?? programs_1.RLP_PROGRAM_ADDRESS;
|
|
150
|
+
// Original accounts.
|
|
151
|
+
const originalAccounts = {
|
|
152
|
+
signer: { value: input.signer ?? null, isWritable: true },
|
|
153
|
+
permissions: { value: input.permissions ?? null, isWritable: true },
|
|
154
|
+
settings: { value: input.settings ?? null, isWritable: true },
|
|
155
|
+
liquidityPool: { value: input.liquidityPool ?? null, isWritable: true },
|
|
156
|
+
lpTokenMint: { value: input.lpTokenMint ?? null, isWritable: true },
|
|
157
|
+
deadSharesVault: { value: input.deadSharesVault ?? null, isWritable: true },
|
|
158
|
+
systemProgram: { value: input.systemProgram ?? null, isWritable: false },
|
|
159
|
+
tokenProgram: { value: input.tokenProgram ?? null, isWritable: false },
|
|
160
|
+
associatedTokenProgram: {
|
|
161
|
+
value: input.associatedTokenProgram ?? null,
|
|
162
|
+
isWritable: false,
|
|
163
|
+
},
|
|
164
|
+
eventAuthority: { value: input.eventAuthority ?? null, isWritable: false },
|
|
165
|
+
program: { value: input.program ?? null, isWritable: false },
|
|
166
|
+
};
|
|
167
|
+
const accounts = originalAccounts;
|
|
168
|
+
// Original args.
|
|
169
|
+
const args = { ...input };
|
|
170
|
+
// Resolve default values.
|
|
171
|
+
if (!accounts.systemProgram.value) {
|
|
172
|
+
accounts.systemProgram.value =
|
|
173
|
+
"11111111111111111111111111111111";
|
|
174
|
+
}
|
|
175
|
+
if (!accounts.tokenProgram.value) {
|
|
176
|
+
accounts.tokenProgram.value =
|
|
177
|
+
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
|
|
178
|
+
}
|
|
179
|
+
if (!accounts.associatedTokenProgram.value) {
|
|
180
|
+
accounts.associatedTokenProgram.value =
|
|
181
|
+
"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";
|
|
182
|
+
}
|
|
183
|
+
const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, "programId");
|
|
184
|
+
return Object.freeze({
|
|
185
|
+
accounts: [
|
|
186
|
+
getAccountMeta(accounts.signer),
|
|
187
|
+
getAccountMeta(accounts.permissions),
|
|
188
|
+
getAccountMeta(accounts.settings),
|
|
189
|
+
getAccountMeta(accounts.liquidityPool),
|
|
190
|
+
getAccountMeta(accounts.lpTokenMint),
|
|
191
|
+
getAccountMeta(accounts.deadSharesVault),
|
|
192
|
+
getAccountMeta(accounts.systemProgram),
|
|
193
|
+
getAccountMeta(accounts.tokenProgram),
|
|
194
|
+
getAccountMeta(accounts.associatedTokenProgram),
|
|
195
|
+
getAccountMeta(accounts.eventAuthority),
|
|
196
|
+
getAccountMeta(accounts.program),
|
|
197
|
+
],
|
|
198
|
+
data: getInitializeLpInstructionDataEncoder().encode(args),
|
|
199
|
+
programAddress,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function parseInitializeLpInstruction(instruction) {
|
|
203
|
+
if (instruction.accounts.length < 11) {
|
|
204
|
+
// TODO: Coded error.
|
|
205
|
+
throw new Error("Not enough accounts");
|
|
206
|
+
}
|
|
207
|
+
let accountIndex = 0;
|
|
208
|
+
const getNextAccount = () => {
|
|
209
|
+
const accountMeta = instruction.accounts[accountIndex];
|
|
210
|
+
accountIndex += 1;
|
|
211
|
+
return accountMeta;
|
|
212
|
+
};
|
|
213
|
+
return {
|
|
214
|
+
programAddress: instruction.programAddress,
|
|
215
|
+
accounts: {
|
|
216
|
+
signer: getNextAccount(),
|
|
217
|
+
permissions: getNextAccount(),
|
|
218
|
+
settings: getNextAccount(),
|
|
219
|
+
liquidityPool: getNextAccount(),
|
|
220
|
+
lpTokenMint: getNextAccount(),
|
|
221
|
+
deadSharesVault: getNextAccount(),
|
|
222
|
+
systemProgram: getNextAccount(),
|
|
223
|
+
tokenProgram: getNextAccount(),
|
|
224
|
+
associatedTokenProgram: getNextAccount(),
|
|
225
|
+
eventAuthority: getNextAccount(),
|
|
226
|
+
program: getNextAccount(),
|
|
227
|
+
},
|
|
228
|
+
data: getInitializeLpInstructionDataDecoder().decode(instruction.data),
|
|
229
|
+
};
|
|
230
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
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 INITIALIZE_POOL_RESERVE_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
|
|
11
|
+
export declare function getInitializePoolReserveDiscriminatorBytes(): ReadonlyUint8Array<ArrayBuffer>;
|
|
12
|
+
export type InitializePoolReserveInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountSigner extends string | AccountMeta<string> = string, TAccountPermissions extends string | AccountMeta<string> = string, TAccountSettings extends string | AccountMeta<string> = string, TAccountLiquidityPool extends string | AccountMeta<string> = string, TAccountAsset extends string | AccountMeta<string> = string, TAccountAssetMint extends string | AccountMeta<string> = string, TAccountPoolAssetAccount extends string | AccountMeta<string> = string, TAccountSystemProgram extends string | AccountMeta<string> = "11111111111111111111111111111111", TAccountTokenProgram extends string | AccountMeta<string> = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", TAccountAssociatedTokenProgram extends string | AccountMeta<string> = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL", TRemainingAccounts extends readonly AccountMeta<string>[] = []> = Instruction<TProgram> & InstructionWithData<ReadonlyUint8Array> & InstructionWithAccounts<[
|
|
13
|
+
TAccountSigner extends string ? WritableSignerAccount<TAccountSigner> & AccountSignerMeta<TAccountSigner> : TAccountSigner,
|
|
14
|
+
TAccountPermissions extends string ? ReadonlyAccount<TAccountPermissions> : TAccountPermissions,
|
|
15
|
+
TAccountSettings extends string ? ReadonlyAccount<TAccountSettings> : TAccountSettings,
|
|
16
|
+
TAccountLiquidityPool extends string ? ReadonlyAccount<TAccountLiquidityPool> : TAccountLiquidityPool,
|
|
17
|
+
TAccountAsset extends string ? ReadonlyAccount<TAccountAsset> : TAccountAsset,
|
|
18
|
+
TAccountAssetMint extends string ? ReadonlyAccount<TAccountAssetMint> : TAccountAssetMint,
|
|
19
|
+
TAccountPoolAssetAccount extends string ? WritableAccount<TAccountPoolAssetAccount> : TAccountPoolAssetAccount,
|
|
20
|
+
TAccountSystemProgram extends string ? ReadonlyAccount<TAccountSystemProgram> : TAccountSystemProgram,
|
|
21
|
+
TAccountTokenProgram extends string ? ReadonlyAccount<TAccountTokenProgram> : TAccountTokenProgram,
|
|
22
|
+
TAccountAssociatedTokenProgram extends string ? ReadonlyAccount<TAccountAssociatedTokenProgram> : TAccountAssociatedTokenProgram,
|
|
23
|
+
...TRemainingAccounts
|
|
24
|
+
]>;
|
|
25
|
+
export type InitializePoolReserveInstructionData = {
|
|
26
|
+
discriminator: ReadonlyUint8Array;
|
|
27
|
+
liquidityPoolId: number;
|
|
28
|
+
};
|
|
29
|
+
export type InitializePoolReserveInstructionDataArgs = {
|
|
30
|
+
liquidityPoolId: number;
|
|
31
|
+
};
|
|
32
|
+
export declare function getInitializePoolReserveInstructionDataEncoder(): FixedSizeEncoder<InitializePoolReserveInstructionDataArgs>;
|
|
33
|
+
export declare function getInitializePoolReserveInstructionDataDecoder(): FixedSizeDecoder<InitializePoolReserveInstructionData>;
|
|
34
|
+
export declare function getInitializePoolReserveInstructionDataCodec(): FixedSizeCodec<InitializePoolReserveInstructionDataArgs, InitializePoolReserveInstructionData>;
|
|
35
|
+
export type InitializePoolReserveAsyncInput<TAccountSigner extends string = string, TAccountPermissions extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountAsset extends string = string, TAccountAssetMint extends string = string, TAccountPoolAssetAccount extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string> = {
|
|
36
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
37
|
+
permissions?: Address<TAccountPermissions>;
|
|
38
|
+
settings?: Address<TAccountSettings>;
|
|
39
|
+
liquidityPool?: Address<TAccountLiquidityPool>;
|
|
40
|
+
asset: Address<TAccountAsset>;
|
|
41
|
+
assetMint: Address<TAccountAssetMint>;
|
|
42
|
+
poolAssetAccount?: Address<TAccountPoolAssetAccount>;
|
|
43
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
44
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
45
|
+
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
46
|
+
liquidityPoolId: InitializePoolReserveInstructionDataArgs["liquidityPoolId"];
|
|
47
|
+
};
|
|
48
|
+
export declare function getInitializePoolReserveInstructionAsync<TAccountSigner extends string, TAccountPermissions extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountAsset extends string, TAccountAssetMint extends string, TAccountPoolAssetAccount extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: InitializePoolReserveAsyncInput<TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountAsset, TAccountAssetMint, TAccountPoolAssetAccount, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram>, config?: {
|
|
49
|
+
programAddress?: TProgramAddress;
|
|
50
|
+
}): Promise<InitializePoolReserveInstruction<TProgramAddress, TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountAsset, TAccountAssetMint, TAccountPoolAssetAccount, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram>>;
|
|
51
|
+
export type InitializePoolReserveInput<TAccountSigner extends string = string, TAccountPermissions extends string = string, TAccountSettings extends string = string, TAccountLiquidityPool extends string = string, TAccountAsset extends string = string, TAccountAssetMint extends string = string, TAccountPoolAssetAccount extends string = string, TAccountSystemProgram extends string = string, TAccountTokenProgram extends string = string, TAccountAssociatedTokenProgram extends string = string> = {
|
|
52
|
+
signer: TransactionSigner<TAccountSigner>;
|
|
53
|
+
permissions: Address<TAccountPermissions>;
|
|
54
|
+
settings: Address<TAccountSettings>;
|
|
55
|
+
liquidityPool: Address<TAccountLiquidityPool>;
|
|
56
|
+
asset: Address<TAccountAsset>;
|
|
57
|
+
assetMint: Address<TAccountAssetMint>;
|
|
58
|
+
poolAssetAccount: Address<TAccountPoolAssetAccount>;
|
|
59
|
+
systemProgram?: Address<TAccountSystemProgram>;
|
|
60
|
+
tokenProgram?: Address<TAccountTokenProgram>;
|
|
61
|
+
associatedTokenProgram?: Address<TAccountAssociatedTokenProgram>;
|
|
62
|
+
liquidityPoolId: InitializePoolReserveInstructionDataArgs["liquidityPoolId"];
|
|
63
|
+
};
|
|
64
|
+
export declare function getInitializePoolReserveInstruction<TAccountSigner extends string, TAccountPermissions extends string, TAccountSettings extends string, TAccountLiquidityPool extends string, TAccountAsset extends string, TAccountAssetMint extends string, TAccountPoolAssetAccount extends string, TAccountSystemProgram extends string, TAccountTokenProgram extends string, TAccountAssociatedTokenProgram extends string, TProgramAddress extends Address = typeof RLP_PROGRAM_ADDRESS>(input: InitializePoolReserveInput<TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountAsset, TAccountAssetMint, TAccountPoolAssetAccount, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram>, config?: {
|
|
65
|
+
programAddress?: TProgramAddress;
|
|
66
|
+
}): InitializePoolReserveInstruction<TProgramAddress, TAccountSigner, TAccountPermissions, TAccountSettings, TAccountLiquidityPool, TAccountAsset, TAccountAssetMint, TAccountPoolAssetAccount, TAccountSystemProgram, TAccountTokenProgram, TAccountAssociatedTokenProgram>;
|
|
67
|
+
export type ParsedInitializePoolReserveInstruction<TProgram extends string = typeof RLP_PROGRAM_ADDRESS, TAccountMetas extends readonly AccountMeta[] = readonly AccountMeta[]> = {
|
|
68
|
+
programAddress: Address<TProgram>;
|
|
69
|
+
accounts: {
|
|
70
|
+
signer: TAccountMetas[0];
|
|
71
|
+
permissions: TAccountMetas[1];
|
|
72
|
+
settings: TAccountMetas[2];
|
|
73
|
+
liquidityPool: TAccountMetas[3];
|
|
74
|
+
asset: TAccountMetas[4];
|
|
75
|
+
assetMint: TAccountMetas[5];
|
|
76
|
+
poolAssetAccount: TAccountMetas[6];
|
|
77
|
+
systemProgram: TAccountMetas[7];
|
|
78
|
+
tokenProgram: TAccountMetas[8];
|
|
79
|
+
associatedTokenProgram: TAccountMetas[9];
|
|
80
|
+
};
|
|
81
|
+
data: InitializePoolReserveInstructionData;
|
|
82
|
+
};
|
|
83
|
+
export declare function parseInitializePoolReserveInstruction<TProgram extends string, TAccountMetas extends readonly AccountMeta[]>(instruction: Instruction<TProgram> & InstructionWithAccounts<TAccountMetas> & InstructionWithData<ReadonlyUint8Array>): ParsedInitializePoolReserveInstruction<TProgram, TAccountMetas>;
|