@exponent-labs/kamino-lend-standard 0.9.3
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/build/anchor/idl.json +2889 -0
- package/build/anchor/type.d.ts +2895 -0
- package/build/anchor/type.js +3 -0
- package/build/anchor/type.js.map +1 -0
- package/build/constants.d.ts +44 -0
- package/build/constants.js +144 -0
- package/build/constants.js.map +1 -0
- package/build/index.d.ts +103 -0
- package/build/index.js +318 -0
- package/build/index.js.map +1 -0
- package/build/instructions/addEmission.d.ts +11 -0
- package/build/instructions/addEmission.js +58 -0
- package/build/instructions/addEmission.js.map +1 -0
- package/build/instructions/createStandardToken.d.ts +0 -0
- package/build/instructions/createStandardToken.js +56 -0
- package/build/instructions/createStandardToken.js.map +1 -0
- package/build/instructions/depositInstruction.d.ts +17 -0
- package/build/instructions/depositInstruction.js +119 -0
- package/build/instructions/depositInstruction.js.map +1 -0
- package/build/instructions/getPositionInstruction.d.ts +15 -0
- package/build/instructions/getPositionInstruction.js +114 -0
- package/build/instructions/getPositionInstruction.js.map +1 -0
- package/build/instructions/index.d.ts +2 -0
- package/build/instructions/index.js +19 -0
- package/build/instructions/index.js.map +1 -0
- package/build/instructions/initializeKaminoLendAccount.d.ts +18 -0
- package/build/instructions/initializeKaminoLendAccount.js +85 -0
- package/build/instructions/initializeKaminoLendAccount.js.map +1 -0
- package/build/instructions/initializePositionInstruction.d.ts +8 -0
- package/build/instructions/initializePositionInstruction.js +55 -0
- package/build/instructions/initializePositionInstruction.js.map +1 -0
- package/build/instructions/mintInstruction.d.ts +19 -0
- package/build/instructions/mintInstruction.js +132 -0
- package/build/instructions/mintInstruction.js.map +1 -0
- package/build/instructions/redeemInstruction.d.ts +21 -0
- package/build/instructions/redeemInstruction.js +129 -0
- package/build/instructions/redeemInstruction.js.map +1 -0
- package/build/instructions/withdrawInstruction.d.ts +17 -0
- package/build/instructions/withdrawInstruction.js +122 -0
- package/build/instructions/withdrawInstruction.js.map +1 -0
- package/package.json +22 -0
- package/src/anchor/idl.json +2889 -0
- package/src/anchor/type.ts +2895 -0
- package/src/constants.d.ts +44 -0
- package/src/constants.js +133 -0
- package/src/constants.ts +205 -0
- package/src/index.ts +500 -0
- package/src/instructions/addEmission.ts +39 -0
- package/src/instructions/createStandardToken.ts +57 -0
- package/src/instructions/depositInstruction.ts +130 -0
- package/src/instructions/getPositionInstruction.ts +117 -0
- package/src/instructions/index.ts +2 -0
- package/src/instructions/initializeKaminoLendAccount.ts +101 -0
- package/src/instructions/initializePositionInstruction.ts +31 -0
- package/src/instructions/mintInstruction.ts +149 -0
- package/src/instructions/redeemInstruction.ts +140 -0
- package/src/instructions/withdrawInstruction.ts +137 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { KaminoLendStandard } from "../anchor/type";
|
|
3
|
+
export declare const addEmissionInstruction: ({ kaminoLendStandardProgram, reserve, signer, feePayer, emissionMint, emissionTokenAccount, emissionTokenProgram, }: {
|
|
4
|
+
kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>;
|
|
5
|
+
reserve: anchor.web3.PublicKey;
|
|
6
|
+
signer: anchor.web3.PublicKey;
|
|
7
|
+
feePayer: anchor.web3.PublicKey;
|
|
8
|
+
emissionMint: anchor.web3.PublicKey;
|
|
9
|
+
emissionTokenAccount: anchor.web3.PublicKey;
|
|
10
|
+
emissionTokenProgram: anchor.web3.PublicKey;
|
|
11
|
+
}) => any;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.addEmissionInstruction = void 0;
|
|
37
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
38
|
+
const constants_1 = require("../constants");
|
|
39
|
+
const exponent_admin_pda_1 = require("@exponent-labs/exponent-admin-pda");
|
|
40
|
+
const addEmissionInstruction = ({ kaminoLendStandardProgram, reserve, signer, feePayer, emissionMint, emissionTokenAccount, emissionTokenProgram, }) => {
|
|
41
|
+
const exponentAdmin = new exponent_admin_pda_1.ExponentAdminPda(exponent_admin_pda_1.EXPONENT_ADMIN_PROGRAM_ID);
|
|
42
|
+
const admin = exponentAdmin.exponentAdmin();
|
|
43
|
+
const instruction = kaminoLendStandardProgram.methods
|
|
44
|
+
.addEmission()
|
|
45
|
+
.accountsStrict({
|
|
46
|
+
adminState: admin,
|
|
47
|
+
signer,
|
|
48
|
+
feePayer,
|
|
49
|
+
emissionMint,
|
|
50
|
+
meta: (0, constants_1.getMeta)(reserve, kaminoLendStandardProgram.programId),
|
|
51
|
+
emissionTokenAccount,
|
|
52
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
53
|
+
})
|
|
54
|
+
.instruction();
|
|
55
|
+
return instruction;
|
|
56
|
+
};
|
|
57
|
+
exports.addEmissionInstruction = addEmissionInstruction;
|
|
58
|
+
//# sourceMappingURL=addEmission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addEmission.js","sourceRoot":"","sources":["../../src/instructions/addEmission.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA2C;AAE3C,4CAA0D;AAC1D,0EAA+F;AAExF,MAAM,sBAAsB,GAAG,CAAC,EACrC,yBAAyB,EACzB,OAAO,EACP,MAAM,EACN,QAAQ,EACR,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,GASrB,EAAE,EAAE;IACH,MAAM,aAAa,GAAG,IAAI,qCAAgB,CAAC,8CAAyB,CAAC,CAAA;IACrE,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,EAAE,CAAA;IAC3C,MAAM,WAAW,GAAG,yBAAyB,CAAC,OAAO;SAClD,WAAW,EAAE;SACb,cAAc,CAAC;QACd,UAAU,EAAE,KAAK;QACjB,MAAM;QACN,QAAQ;QACR,YAAY;QACZ,IAAI,EAAE,IAAA,mBAAO,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC;QAC3D,oBAAoB;QACpB,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS;KACnD,CAAC;SACD,WAAW,EAAE,CAAA;IAEhB,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AAjCY,QAAA,sBAAsB,0BAiClC"}
|
|
File without changes
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// import * as anchor from "@coral-xyz/anchor"
|
|
2
|
+
// import { KaminoLendStandard } from "../anchor/type"
|
|
3
|
+
// import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from "@solana/spl-token"
|
|
4
|
+
// import {
|
|
5
|
+
// getAccountAuthority,
|
|
6
|
+
// getAccountAuthorityBaseTokenAccount,
|
|
7
|
+
// getEmissionTracker,
|
|
8
|
+
// getMeta,
|
|
9
|
+
// getMintAuthority,
|
|
10
|
+
// getStakedReceiptPool,
|
|
11
|
+
// getStakedReceiptPoolAuthority,
|
|
12
|
+
// getStandardTokenMint,
|
|
13
|
+
// } from "../constants"
|
|
14
|
+
// export const createStandardTokenInstruction = ({
|
|
15
|
+
// kaminoLendStandardProgram,
|
|
16
|
+
// reserve,
|
|
17
|
+
// signer,
|
|
18
|
+
// feePayer,
|
|
19
|
+
// baseMint,
|
|
20
|
+
// baseTokenProgram,
|
|
21
|
+
// }: {
|
|
22
|
+
// kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>
|
|
23
|
+
// reserve: anchor.web3.PublicKey
|
|
24
|
+
// signer: anchor.web3.PublicKey
|
|
25
|
+
// feePayer: anchor.web3.PublicKey
|
|
26
|
+
// baseMint: anchor.web3.PublicKey
|
|
27
|
+
// baseTokenProgram: anchor.web3.PublicKey
|
|
28
|
+
// }) => {
|
|
29
|
+
// console.log("base mint in ix gen", baseMint.toBase58())
|
|
30
|
+
// const mintAuthority = getMintAuthority(reserve, kaminoLendStandardProgram.programId)
|
|
31
|
+
// const accountAuthorityBaseToken = getAccountAuthorityBaseTokenAccount(reserve, kaminoLendStandardProgram.programId)
|
|
32
|
+
// const accountAuthority = getAccountAuthority(reserve, kaminoLendStandardProgram.programId)
|
|
33
|
+
// const standardTokenMint = getStandardTokenMint(reserve, kaminoLendStandardProgram.programId)
|
|
34
|
+
// const emissionTracker = getEmissionTracker(reserve, kaminoLendStandardProgram.programId)
|
|
35
|
+
// const instruction = kaminoLendStandardProgram.methods
|
|
36
|
+
// .createStandardToken()
|
|
37
|
+
// .accountsStrict({
|
|
38
|
+
// feePayer,
|
|
39
|
+
// reserve,
|
|
40
|
+
// signer,
|
|
41
|
+
// mintAuthority,
|
|
42
|
+
// token22Program: TOKEN_2022_PROGRAM_ID,
|
|
43
|
+
// tokenMint: standardTokenMint,
|
|
44
|
+
// meta: getMeta(reserve, kaminoLendStandardProgram.programId),
|
|
45
|
+
// systemProgram: anchor.web3.SystemProgram.programId,
|
|
46
|
+
// authorityAccount: accountAuthority,
|
|
47
|
+
// authorityPool: getStakedReceiptPoolAuthority(reserve, kaminoLendStandardProgram.programId),
|
|
48
|
+
// tokenReceiptPool: getStakedReceiptPool(reserve, kaminoLendStandardProgram.programId),
|
|
49
|
+
// accountAuthorityBaseToken,
|
|
50
|
+
// baseMint,
|
|
51
|
+
// tokenProgramBase: baseTokenProgram,
|
|
52
|
+
// })
|
|
53
|
+
// .instruction()
|
|
54
|
+
// return instruction
|
|
55
|
+
// }
|
|
56
|
+
//# sourceMappingURL=createStandardToken.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStandardToken.js","sourceRoot":"","sources":["../../src/instructions/createStandardToken.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,sDAAsD;AACtD,8EAA8E;AAC9E,WAAW;AACX,yBAAyB;AACzB,yCAAyC;AACzC,wBAAwB;AACxB,aAAa;AACb,sBAAsB;AACtB,0BAA0B;AAC1B,mCAAmC;AACnC,0BAA0B;AAC1B,wBAAwB;AAExB,mDAAmD;AACnD,+BAA+B;AAC/B,aAAa;AACb,YAAY;AACZ,cAAc;AACd,cAAc;AACd,sBAAsB;AACtB,OAAO;AACP,kEAAkE;AAClE,mCAAmC;AACnC,kCAAkC;AAClC,oCAAoC;AACpC,oCAAoC;AACpC,4CAA4C;AAC5C,UAAU;AACV,4DAA4D;AAC5D,yFAAyF;AACzF,wHAAwH;AACxH,+FAA+F;AAC/F,iGAAiG;AACjG,6FAA6F;AAC7F,0DAA0D;AAC1D,6BAA6B;AAC7B,wBAAwB;AACxB,kBAAkB;AAClB,iBAAiB;AACjB,gBAAgB;AAChB,uBAAuB;AACvB,+CAA+C;AAC/C,sCAAsC;AACtC,qEAAqE;AACrE,4DAA4D;AAC5D,4CAA4C;AAC5C,oGAAoG;AACpG,8FAA8F;AAC9F,mCAAmC;AACnC,kBAAkB;AAClB,4CAA4C;AAC5C,SAAS;AACT,qBAAqB;AAErB,uBAAuB;AACvB,IAAI"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { KaminoLendStandard } from "../anchor/type";
|
|
3
|
+
export declare const depositInstruction: ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, amount, lendingMarket, reserve, reserveFarmState, signer, feePayer, remainingAccounts, signerReceiptTokenAccount, kaminoFarm, kaminoGlobalConfig, }: {
|
|
4
|
+
kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>;
|
|
5
|
+
kaminoFarmsProgramId: anchor.web3.PublicKey;
|
|
6
|
+
kaminoLendProgramId: anchor.web3.PublicKey;
|
|
7
|
+
amount: anchor.BN;
|
|
8
|
+
lendingMarket: anchor.web3.PublicKey;
|
|
9
|
+
reserve: anchor.web3.PublicKey;
|
|
10
|
+
reserveFarmState: anchor.web3.PublicKey;
|
|
11
|
+
signer: anchor.web3.PublicKey;
|
|
12
|
+
feePayer: anchor.web3.PublicKey;
|
|
13
|
+
remainingAccounts: anchor.web3.AccountMeta[];
|
|
14
|
+
signerReceiptTokenAccount: anchor.web3.PublicKey;
|
|
15
|
+
kaminoFarm: anchor.web3.PublicKey;
|
|
16
|
+
kaminoGlobalConfig: anchor.web3.PublicKey;
|
|
17
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.depositInstruction = void 0;
|
|
37
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
38
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
39
|
+
const constants_1 = require("../constants");
|
|
40
|
+
const depositInstruction = async ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, amount, lendingMarket, reserve, reserveFarmState, signer, feePayer, remainingAccounts, signerReceiptTokenAccount, kaminoFarm, kaminoGlobalConfig, }) => {
|
|
41
|
+
const meta = (0, constants_1.getMeta)(reserve, kaminoLendStandardProgram.programId);
|
|
42
|
+
const obligation = (0, constants_1.getKaminoLendObligation)(meta, lendingMarket, kaminoLendProgramId);
|
|
43
|
+
const userState = (0, constants_1.getKaminoFarmsObligationFarm)(obligation, reserveFarmState, kaminoFarmsProgramId);
|
|
44
|
+
const standardTokenMint = (0, constants_1.getStandardTokenMint)(reserve, kaminoLendStandardProgram.programId);
|
|
45
|
+
// const refreshReserveInstruction = new TransactionInstruction({
|
|
46
|
+
// keys: [
|
|
47
|
+
// {
|
|
48
|
+
// pubkey: reserve,
|
|
49
|
+
// isWritable: true,
|
|
50
|
+
// isSigner: false,
|
|
51
|
+
// },
|
|
52
|
+
// {
|
|
53
|
+
// pubkey: lendingMarket,
|
|
54
|
+
// isWritable: false,
|
|
55
|
+
// isSigner: false,
|
|
56
|
+
// },
|
|
57
|
+
// remainingAccounts[0],
|
|
58
|
+
// { pubkey: kaminoLendProgramId, isWritable: false, isSigner: false },
|
|
59
|
+
// { pubkey: kaminoLendProgramId, isWritable: false, isSigner: false },
|
|
60
|
+
// remainingAccounts[1],
|
|
61
|
+
// ],
|
|
62
|
+
// programId: kaminoLendProgramId,
|
|
63
|
+
// data: Buffer.from([2, 218, 138, 235, 79, 201, 25, 102]),
|
|
64
|
+
// })
|
|
65
|
+
// const refreshObligationInstruction = new TransactionInstruction({
|
|
66
|
+
// keys: [
|
|
67
|
+
// { pubkey: lendingMarket, isWritable: false, isSigner: false },
|
|
68
|
+
// { pubkey: obligation, isWritable: true, isSigner: false },
|
|
69
|
+
// ],
|
|
70
|
+
// programId: kaminoLendProgramId,
|
|
71
|
+
// data: Buffer.from([33, 132, 147, 228, 151, 192, 72, 89]),
|
|
72
|
+
// })
|
|
73
|
+
// const refreshObligationFarmsForReserveInstruction = new TransactionInstruction({
|
|
74
|
+
// keys: [
|
|
75
|
+
// { pubkey: signer, isWritable: true, isSigner: false },
|
|
76
|
+
// { pubkey: obligation, isWritable: true, isSigner: false },
|
|
77
|
+
// { pubkey: lendingMarketAuthority, isWritable: true, isSigner: false },
|
|
78
|
+
// { pubkey: reserve, isWritable: true, isSigner: false },
|
|
79
|
+
// { pubkey: reserveFarmState, isWritable: true, isSigner: false },
|
|
80
|
+
// { pubkey: obligationFarm, isWritable: true, isSigner: false },
|
|
81
|
+
// { pubkey: lendingMarket, isWritable: false, isSigner: false },
|
|
82
|
+
// { pubkey: kaminoFarmsProgramId, isWritable: false, isSigner: false },
|
|
83
|
+
// { pubkey: anchor.web3.SYSVAR_RENT_PUBKEY, isWritable: false, isSigner: false },
|
|
84
|
+
// // { pubkey: TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
85
|
+
// { pubkey: anchor.web3.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
86
|
+
// ],
|
|
87
|
+
// programId: kaminoLendProgramId,
|
|
88
|
+
// // 8 byte discriminator + 0 byte for "collateral" mode
|
|
89
|
+
// data: Buffer.from([140, 144, 253, 21, 10, 74, 248, 3, 0]),
|
|
90
|
+
// })
|
|
91
|
+
const position = (0, constants_1.getPosition)(reserve, signer, kaminoLendStandardProgram.programId);
|
|
92
|
+
const kaminoFarmVaultsAuthority = (0, constants_1.getKaminoFarmsVaultAuthority)(kaminoFarm, kaminoFarmsProgramId);
|
|
93
|
+
const instruction = await kaminoLendStandardProgram.methods
|
|
94
|
+
.deposit(amount)
|
|
95
|
+
.accountsStrict({
|
|
96
|
+
feePayer,
|
|
97
|
+
meta,
|
|
98
|
+
kaminoReserve: reserve,
|
|
99
|
+
owner: signer,
|
|
100
|
+
position,
|
|
101
|
+
mintSy: standardTokenMint,
|
|
102
|
+
tokenSySigner: signerReceiptTokenAccount,
|
|
103
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
104
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
105
|
+
kaminoFarmsProgram: kaminoFarmsProgramId,
|
|
106
|
+
kaminoFarm,
|
|
107
|
+
kaminoFarmVaultsAuthority,
|
|
108
|
+
kaminoGlobalConfig,
|
|
109
|
+
// farms program id because scope prices is optional
|
|
110
|
+
kaminoScopePrices: kaminoFarmsProgramId,
|
|
111
|
+
tokenSyEscrow: (0, constants_1.getStakedReceiptPool)(reserve, kaminoLendStandardProgram.programId),
|
|
112
|
+
userState,
|
|
113
|
+
})
|
|
114
|
+
.remainingAccounts(remainingAccounts)
|
|
115
|
+
.instruction();
|
|
116
|
+
return instruction;
|
|
117
|
+
};
|
|
118
|
+
exports.depositInstruction = depositInstruction;
|
|
119
|
+
//# sourceMappingURL=depositInstruction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"depositInstruction.js","sourceRoot":"","sources":["../../src/instructions/depositInstruction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA2C;AAE3C,iDAAoD;AACpD,4CAaqB;AAEd,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,MAAM,EACN,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,EACV,kBAAkB,GAenB,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAClE,MAAM,UAAU,GAAG,IAAA,mCAAuB,EAAC,IAAI,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAA;IACpF,MAAM,SAAS,GAAG,IAAA,wCAA4B,EAAC,UAA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AE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS;QAClD,kBAAkB,EAAE,oBAAoB;QACxC,UAAU;QACV,yBAAyB;QACzB,kBAAkB;QAClB,oDAAoD;QACpD,iBAAiB,EAAE,oBAAoB;QACvC,aAAa,EAAE,IAAA,gCAAoB,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC;QACjF,SAAS;KACV,CAAC;SACD,iBAAiB,CAAC,iBAAiB,CAAC;SACpC,WAAW,EAAE,CAAA;IAEhB,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AA/GY,QAAA,kBAAkB,sBA+G9B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { KaminoLendStandard } from "../anchor/type";
|
|
3
|
+
export declare const getPositionInstruction: ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, lendingMarket, reserve, reserveFarmState, signer, feePayer, remainingAccounts, kaminoFarm, kaminoGlobalConfig, }: {
|
|
4
|
+
kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>;
|
|
5
|
+
kaminoFarmsProgramId: anchor.web3.PublicKey;
|
|
6
|
+
kaminoLendProgramId: anchor.web3.PublicKey;
|
|
7
|
+
lendingMarket: anchor.web3.PublicKey;
|
|
8
|
+
reserve: anchor.web3.PublicKey;
|
|
9
|
+
reserveFarmState: anchor.web3.PublicKey;
|
|
10
|
+
signer: anchor.web3.PublicKey;
|
|
11
|
+
feePayer: anchor.web3.PublicKey;
|
|
12
|
+
remainingAccounts: anchor.web3.AccountMeta[];
|
|
13
|
+
kaminoFarm: anchor.web3.PublicKey;
|
|
14
|
+
kaminoGlobalConfig: anchor.web3.PublicKey;
|
|
15
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.getPositionInstruction = void 0;
|
|
37
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
38
|
+
const constants_1 = require("../constants");
|
|
39
|
+
const getPositionInstruction = async ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, lendingMarket, reserve, reserveFarmState, signer, feePayer, remainingAccounts, kaminoFarm, kaminoGlobalConfig, }) => {
|
|
40
|
+
const meta = (0, constants_1.getMeta)(reserve, kaminoLendStandardProgram.programId);
|
|
41
|
+
const obligation = (0, constants_1.getKaminoLendObligation)(meta, lendingMarket, kaminoLendProgramId);
|
|
42
|
+
const userState = (0, constants_1.getKaminoFarmsObligationFarm)(obligation, reserveFarmState, kaminoFarmsProgramId);
|
|
43
|
+
const standardTokenMint = (0, constants_1.getStandardTokenMint)(reserve, kaminoLendStandardProgram.programId);
|
|
44
|
+
// const refreshReserveInstruction = new TransactionInstruction({
|
|
45
|
+
// keys: [
|
|
46
|
+
// {
|
|
47
|
+
// pubkey: reserve,
|
|
48
|
+
// isWritable: true,
|
|
49
|
+
// isSigner: false,
|
|
50
|
+
// },
|
|
51
|
+
// {
|
|
52
|
+
// pubkey: lendingMarket,
|
|
53
|
+
// isWritable: false,
|
|
54
|
+
// isSigner: false,
|
|
55
|
+
// },
|
|
56
|
+
// remainingAccounts[0],
|
|
57
|
+
// { pubkey: kaminoLendProgramId, isWritable: false, isSigner: false },
|
|
58
|
+
// { pubkey: kaminoLendProgramId, isWritable: false, isSigner: false },
|
|
59
|
+
// remainingAccounts[1],
|
|
60
|
+
// ],
|
|
61
|
+
// programId: kaminoLendProgramId,
|
|
62
|
+
// data: Buffer.from([2, 218, 138, 235, 79, 201, 25, 102]),
|
|
63
|
+
// })
|
|
64
|
+
// const refreshObligationInstruction = new TransactionInstruction({
|
|
65
|
+
// keys: [
|
|
66
|
+
// { pubkey: lendingMarket, isWritable: false, isSigner: false },
|
|
67
|
+
// { pubkey: obligation, isWritable: true, isSigner: false },
|
|
68
|
+
// ],
|
|
69
|
+
// programId: kaminoLendProgramId,
|
|
70
|
+
// data: Buffer.from([33, 132, 147, 228, 151, 192, 72, 89]),
|
|
71
|
+
// })
|
|
72
|
+
// const refreshObligationFarmsForReserveInstruction = new TransactionInstruction({
|
|
73
|
+
// keys: [
|
|
74
|
+
// { pubkey: signer, isWritable: true, isSigner: false },
|
|
75
|
+
// { pubkey: obligation, isWritable: true, isSigner: false },
|
|
76
|
+
// { pubkey: lendingMarketAuthority, isWritable: true, isSigner: false },
|
|
77
|
+
// { pubkey: reserve, isWritable: true, isSigner: false },
|
|
78
|
+
// { pubkey: reserveFarmState, isWritable: true, isSigner: false },
|
|
79
|
+
// { pubkey: obligationFarm, isWritable: true, isSigner: false },
|
|
80
|
+
// { pubkey: lendingMarket, isWritable: false, isSigner: false },
|
|
81
|
+
// { pubkey: kaminoFarmsProgramId, isWritable: false, isSigner: false },
|
|
82
|
+
// { pubkey: anchor.web3.SYSVAR_RENT_PUBKEY, isWritable: false, isSigner: false },
|
|
83
|
+
// // { pubkey: TOKEN_PROGRAM_ID, isWritable: false, isSigner: false },
|
|
84
|
+
// { pubkey: anchor.web3.SystemProgram.programId, isWritable: false, isSigner: false },
|
|
85
|
+
// ],
|
|
86
|
+
// programId: kaminoLendProgramId,
|
|
87
|
+
// // 8 byte discriminator + 0 byte for "collateral" mode
|
|
88
|
+
// data: Buffer.from([140, 144, 253, 21, 10, 74, 248, 3, 0]),
|
|
89
|
+
// })
|
|
90
|
+
const position = (0, constants_1.getPosition)(reserve, signer, kaminoLendStandardProgram.programId);
|
|
91
|
+
const kaminoFarmVaultsAuthority = (0, constants_1.getKaminoFarmsVaultAuthority)(kaminoFarm, kaminoFarmsProgramId);
|
|
92
|
+
const instruction = await kaminoLendStandardProgram.methods
|
|
93
|
+
.getPosition()
|
|
94
|
+
.accountsStrict({
|
|
95
|
+
meta,
|
|
96
|
+
kaminoReserve: reserve,
|
|
97
|
+
position,
|
|
98
|
+
mintSy: standardTokenMint,
|
|
99
|
+
kaminoFarmsProgram: kaminoFarmsProgramId,
|
|
100
|
+
kaminoFarm,
|
|
101
|
+
kaminoFarmVaultsAuthority,
|
|
102
|
+
kaminoGlobalConfig,
|
|
103
|
+
// farms program id because scope prices is optional
|
|
104
|
+
kaminoScopePrices: kaminoFarmsProgramId,
|
|
105
|
+
tokenSyEscrow: (0, constants_1.getStakedReceiptPool)(reserve, kaminoLendStandardProgram.programId),
|
|
106
|
+
userState,
|
|
107
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
108
|
+
})
|
|
109
|
+
.remainingAccounts(remainingAccounts)
|
|
110
|
+
.instruction();
|
|
111
|
+
return instruction;
|
|
112
|
+
};
|
|
113
|
+
exports.getPositionInstruction = getPositionInstruction;
|
|
114
|
+
//# sourceMappingURL=getPositionInstruction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getPositionInstruction.js","sourceRoot":"","sources":["../../src/instructions/getPositionInstruction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA2C;AAE3C,4CASqB;AAEd,MAAM,sBAAsB,GAAG,KAAK,EAAE,EAC3C,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACV,kBAAkB,GAanB,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAClE,MAAM,UAAU,GAAG,IAAA,mCAAuB,EAAC,IAAI,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAA;IACpF,MAAM,SAAS,GAAG,IAAA,wCAA4B,EAAC,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;IAClG,MAAM,iBAAiB,GAAG,IAAA,gCAAoB,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAE5F,mEAAmE;IACnE,cAAc;IACd,UAAU;IACV,2BAA2B;IAC3B,4BAA4B;IAC5B,2BAA2B;IAC3B,WAAW;IACX,UAAU;IACV,iCAAiC;IACjC,6BAA6B;IAC7B,2BAA2B;IAC3B,WAAW;IACX,8BAA8B;IAC9B,6EAA6E;IA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"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./initializeKaminoLendAccount"), exports);
|
|
18
|
+
__exportStar(require("./mintInstruction"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/instructions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gEAA6C;AAC7C,oDAAiC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { KaminoLendStandard } from "../anchor/type";
|
|
3
|
+
export declare const initializeKaminoLendAccountInstruction: ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, lendingMarket, lendingMarketAuthority, reserve, reserveFarmState, signer, feePayer, userLookupTable, baseMint, baseTokenProgram, minMintSize, minRedeemSize, }: {
|
|
4
|
+
kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>;
|
|
5
|
+
kaminoFarmsProgramId: anchor.web3.PublicKey;
|
|
6
|
+
kaminoLendProgramId: anchor.web3.PublicKey;
|
|
7
|
+
lendingMarket: anchor.web3.PublicKey;
|
|
8
|
+
lendingMarketAuthority: anchor.web3.PublicKey;
|
|
9
|
+
reserve: anchor.web3.PublicKey;
|
|
10
|
+
reserveFarmState: anchor.web3.PublicKey;
|
|
11
|
+
signer: anchor.web3.PublicKey;
|
|
12
|
+
feePayer: anchor.web3.PublicKey;
|
|
13
|
+
userLookupTable: anchor.web3.PublicKey;
|
|
14
|
+
baseMint: anchor.web3.PublicKey;
|
|
15
|
+
baseTokenProgram: anchor.web3.PublicKey;
|
|
16
|
+
minMintSize: anchor.BN;
|
|
17
|
+
minRedeemSize: anchor.BN;
|
|
18
|
+
}) => any;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.initializeKaminoLendAccountInstruction = void 0;
|
|
37
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
38
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
39
|
+
const constants_1 = require("../constants");
|
|
40
|
+
const exponent_admin_pda_1 = require("@exponent-labs/exponent-admin-pda");
|
|
41
|
+
const initializeKaminoLendAccountInstruction = ({ kaminoLendStandardProgram, kaminoFarmsProgramId, kaminoLendProgramId, lendingMarket, lendingMarketAuthority, reserve, reserveFarmState, signer, feePayer, userLookupTable, baseMint, baseTokenProgram, minMintSize, minRedeemSize, }) => {
|
|
42
|
+
const meta = (0, constants_1.getMeta)(reserve, kaminoLendStandardProgram.programId);
|
|
43
|
+
const userMetadata = (0, constants_1.getKaminoUserMetadata)(meta, kaminoLendProgramId);
|
|
44
|
+
const obligation = (0, constants_1.getKaminoLendObligation)(meta, lendingMarket, kaminoLendProgramId);
|
|
45
|
+
const obligationFarm = (0, constants_1.getKaminoFarmsObligationFarm)(obligation, reserveFarmState, kaminoFarmsProgramId);
|
|
46
|
+
const exponentAdmin = new exponent_admin_pda_1.ExponentAdminPda(exponent_admin_pda_1.EXPONENT_ADMIN_PROGRAM_ID);
|
|
47
|
+
const admin = exponentAdmin.exponentAdmin();
|
|
48
|
+
const [metadataPda] = anchor.web3.PublicKey.findProgramAddressSync([
|
|
49
|
+
Buffer.from("metadata"),
|
|
50
|
+
constants_1.METADATA_PROGRAM_ID.toBuffer(),
|
|
51
|
+
(0, constants_1.getStandardTokenMint)(reserve, kaminoLendStandardProgram.programId).toBuffer(),
|
|
52
|
+
], constants_1.METADATA_PROGRAM_ID);
|
|
53
|
+
const instruction = kaminoLendStandardProgram.methods
|
|
54
|
+
.initSy(new anchor.BN(0), new anchor.BN(0), new anchor.BN("18446744073709551615"), "Kamino PYUSD", "kPYUSD", "https://raw.githubusercontent.com/valentinmadrid/exponent-icons/refs/heads/main/lyts/kPYUSD%20-%20Main%20Market.json")
|
|
55
|
+
.accountsStrict({
|
|
56
|
+
adminState: admin,
|
|
57
|
+
feePayer,
|
|
58
|
+
lendingMarket,
|
|
59
|
+
meta,
|
|
60
|
+
reserve,
|
|
61
|
+
lendingMarketAuthority,
|
|
62
|
+
rent: anchor.web3.SYSVAR_RENT_PUBKEY,
|
|
63
|
+
signer,
|
|
64
|
+
userMetadata,
|
|
65
|
+
obligation,
|
|
66
|
+
obligationFarm,
|
|
67
|
+
reserveFarmState,
|
|
68
|
+
userLookupTable,
|
|
69
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
70
|
+
kaminoFarmsProgram: kaminoFarmsProgramId,
|
|
71
|
+
kaminoLendProgram: kaminoLendProgramId,
|
|
72
|
+
accountAuthorityBaseToken: (0, constants_1.getAccountAuthorityBaseTokenAccount)(reserve, kaminoLendStandardProgram.programId),
|
|
73
|
+
baseMint,
|
|
74
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
75
|
+
mintSy: (0, constants_1.getStandardTokenMint)(reserve, kaminoLendStandardProgram.programId),
|
|
76
|
+
tokenReceiptPool: (0, constants_1.getStakedReceiptPool)(reserve, kaminoLendStandardProgram.programId),
|
|
77
|
+
tokenProgramBase: baseTokenProgram,
|
|
78
|
+
tokenMetadataProgram: constants_1.METADATA_PROGRAM_ID,
|
|
79
|
+
metadata: metadataPda,
|
|
80
|
+
})
|
|
81
|
+
.instruction();
|
|
82
|
+
return instruction;
|
|
83
|
+
};
|
|
84
|
+
exports.initializeKaminoLendAccountInstruction = initializeKaminoLendAccountInstruction;
|
|
85
|
+
//# sourceMappingURL=initializeKaminoLendAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializeKaminoLendAccount.js","sourceRoot":"","sources":["../../src/instructions/initializeKaminoLendAccount.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA2C;AAE3C,iDAAoD;AACpD,4CASqB;AACrB,0EAA+F;AAExF,MAAM,sCAAsC,GAAG,CAAC,EACrD,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,sBAAsB,EACtB,OAAO,EACP,gBAAgB,EAChB,MAAM,EACN,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,aAAa,GAgBd,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAClE,MAAM,YAAY,GAAG,IAAA,iCAAqB,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAAA;IACrE,MAAM,UAAU,GAAG,IAAA,mCAAuB,EAAC,IAAI,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAA;IACpF,MAAM,cAAc,GAAG,IAAA,wCAA4B,EAAC,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CAAA;IACvG,MAAM,aAAa,GAAG,IAAI,qCAAgB,CAAC,8CAAyB,CAAC,CAAA;IACrE,MAAM,KAAK,GAAG,aAAa,CAAC,aAAa,EAAE,CAAA;IAE3C,MAAM,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAChE;QACE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC;QACvB,+BAAmB,CAAC,QAAQ,EAAE;QAC9B,IAAA,gCAAoB,EAAC,O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} from "../anchor/type";
|
|
3
|
+
export declare const initializePositionInstruction: ({ kaminoLendStandardProgram, reserve, signer, feePayer, }: {
|
|
4
|
+
kaminoLendStandardProgram: anchor.Program<KaminoLendStandard>;
|
|
5
|
+
reserve: anchor.web3.PublicKey;
|
|
6
|
+
signer: anchor.web3.PublicKey;
|
|
7
|
+
feePayer: anchor.web3.PublicKey;
|
|
8
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.initializePositionInstruction = void 0;
|
|
37
|
+
const anchor = __importStar(require("@coral-xyz/anchor"));
|
|
38
|
+
const constants_1 = require("../constants");
|
|
39
|
+
const initializePositionInstruction = async ({ kaminoLendStandardProgram, reserve, signer, feePayer, }) => {
|
|
40
|
+
const position = (0, constants_1.getPosition)(reserve, signer, kaminoLendStandardProgram.programId);
|
|
41
|
+
const instruction = await kaminoLendStandardProgram.methods
|
|
42
|
+
.initializePosition()
|
|
43
|
+
.accountsStrict({
|
|
44
|
+
feePayer,
|
|
45
|
+
meta: (0, constants_1.getMeta)(reserve, kaminoLendStandardProgram.programId),
|
|
46
|
+
kaminoReserve: reserve,
|
|
47
|
+
owner: signer,
|
|
48
|
+
position,
|
|
49
|
+
systemProgram: anchor.web3.SystemProgram.programId,
|
|
50
|
+
})
|
|
51
|
+
.instruction();
|
|
52
|
+
return instruction;
|
|
53
|
+
};
|
|
54
|
+
exports.initializePositionInstruction = initializePositionInstruction;
|
|
55
|
+
//# sourceMappingURL=initializePositionInstruction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializePositionInstruction.js","sourceRoot":"","sources":["../../src/instructions/initializePositionInstruction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA2C;AAE3C,4CAAmD;AAE5C,MAAM,6BAA6B,GAAG,KAAK,EAAE,EAClD,yBAAyB,EACzB,OAAO,EACP,MAAM,EACN,QAAQ,GAMT,EAAE,EAAE;IACH,MAAM,QAAQ,GAAG,IAAA,uBAAW,EAAC,OAAO,EAAE,MAAM,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAA;IAElF,MAAM,WAAW,GAAG,MAAM,yBAAyB,CAAC,OAAO;SACxD,kBAAkB,EAAE;SACpB,cAAc,CAAC;QACd,QAAQ;QACR,IAAI,EAAE,IAAA,mBAAO,EAAC,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC;QAC3D,aAAa,EAAE,OAAO;QACtB,KAAK,EAAE,MAAM;QACb,QAAQ;QACR,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,SAAS;KACnD,CAAC;SACD,WAAW,EAAE,CAAA;IAEhB,OAAO,WAAW,CAAA;AACpB,CAAC,CAAA;AA1BY,QAAA,6BAA6B,iCA0BzC"}
|