@lavarage/sdk 7.0.0 → 7.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -4
- package/dist/index.mjs.map +1 -1
- package/lending.ts +17 -3
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -3383,17 +3383,20 @@ declare function addToWithdrawalAccessList(lavarageProgram: Program<Lavarage$1>
|
|
|
3383
3383
|
computeBudgetMicroLamports?: number;
|
|
3384
3384
|
}): Promise<VersionedTransaction>;
|
|
3385
3385
|
declare function removeFromWithdrawalAccessList(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
3386
|
-
withdrawalAccessList: PublicKey;
|
|
3387
3386
|
authority: PublicKey;
|
|
3388
3387
|
nodeWallet: string;
|
|
3389
3388
|
computeBudgetMicroLamports?: number;
|
|
3390
3389
|
}): Promise<VersionedTransaction>;
|
|
3390
|
+
declare function getWithdrawalAccessList(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
3391
|
+
nodeWallet: string;
|
|
3392
|
+
}): Promise<PublicKey | undefined>;
|
|
3391
3393
|
|
|
3392
3394
|
declare const lending_addToWithdrawalAccessList: typeof addToWithdrawalAccessList;
|
|
3393
3395
|
declare const lending_createOffer: typeof createOffer;
|
|
3394
3396
|
declare const lending_depositFunds: typeof depositFunds;
|
|
3395
3397
|
declare const lending_getNodeWalletPDA: typeof getNodeWalletPDA;
|
|
3396
3398
|
declare const lending_getTradingPoolPDA: typeof getTradingPoolPDA;
|
|
3399
|
+
declare const lending_getWithdrawalAccessList: typeof getWithdrawalAccessList;
|
|
3397
3400
|
declare const lending_getWithdrawalAccessListPDA: typeof getWithdrawalAccessListPDA;
|
|
3398
3401
|
declare const lending_removeFromWithdrawalAccessList: typeof removeFromWithdrawalAccessList;
|
|
3399
3402
|
declare const lending_updateInterestRate: typeof updateInterestRate;
|
|
@@ -3404,7 +3407,7 @@ declare const lending_withdrawFunds: typeof withdrawFunds;
|
|
|
3404
3407
|
declare const lending_withdrawFundsV1: typeof withdrawFundsV1;
|
|
3405
3408
|
declare const lending_withdrawFundsV2: typeof withdrawFundsV2;
|
|
3406
3409
|
declare namespace lending {
|
|
3407
|
-
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3410
|
+
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessList as getWithdrawalAccessList, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3408
3411
|
}
|
|
3409
3412
|
|
|
3410
3413
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
package/dist/index.d.ts
CHANGED
|
@@ -3383,17 +3383,20 @@ declare function addToWithdrawalAccessList(lavarageProgram: Program<Lavarage$1>
|
|
|
3383
3383
|
computeBudgetMicroLamports?: number;
|
|
3384
3384
|
}): Promise<VersionedTransaction>;
|
|
3385
3385
|
declare function removeFromWithdrawalAccessList(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
3386
|
-
withdrawalAccessList: PublicKey;
|
|
3387
3386
|
authority: PublicKey;
|
|
3388
3387
|
nodeWallet: string;
|
|
3389
3388
|
computeBudgetMicroLamports?: number;
|
|
3390
3389
|
}): Promise<VersionedTransaction>;
|
|
3390
|
+
declare function getWithdrawalAccessList(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
|
|
3391
|
+
nodeWallet: string;
|
|
3392
|
+
}): Promise<PublicKey | undefined>;
|
|
3391
3393
|
|
|
3392
3394
|
declare const lending_addToWithdrawalAccessList: typeof addToWithdrawalAccessList;
|
|
3393
3395
|
declare const lending_createOffer: typeof createOffer;
|
|
3394
3396
|
declare const lending_depositFunds: typeof depositFunds;
|
|
3395
3397
|
declare const lending_getNodeWalletPDA: typeof getNodeWalletPDA;
|
|
3396
3398
|
declare const lending_getTradingPoolPDA: typeof getTradingPoolPDA;
|
|
3399
|
+
declare const lending_getWithdrawalAccessList: typeof getWithdrawalAccessList;
|
|
3397
3400
|
declare const lending_getWithdrawalAccessListPDA: typeof getWithdrawalAccessListPDA;
|
|
3398
3401
|
declare const lending_removeFromWithdrawalAccessList: typeof removeFromWithdrawalAccessList;
|
|
3399
3402
|
declare const lending_updateInterestRate: typeof updateInterestRate;
|
|
@@ -3404,7 +3407,7 @@ declare const lending_withdrawFunds: typeof withdrawFunds;
|
|
|
3404
3407
|
declare const lending_withdrawFundsV1: typeof withdrawFundsV1;
|
|
3405
3408
|
declare const lending_withdrawFundsV2: typeof withdrawFundsV2;
|
|
3406
3409
|
declare namespace lending {
|
|
3407
|
-
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3410
|
+
export { lending_addToWithdrawalAccessList as addToWithdrawalAccessList, lending_createOffer as createOffer, lending_depositFunds as depositFunds, lending_getNodeWalletPDA as getNodeWalletPDA, lending_getTradingPoolPDA as getTradingPoolPDA, lending_getWithdrawalAccessList as getWithdrawalAccessList, lending_getWithdrawalAccessListPDA as getWithdrawalAccessListPDA, lending_removeFromWithdrawalAccessList as removeFromWithdrawalAccessList, lending_updateInterestRate as updateInterestRate, lending_updateMaxBorrow as updateMaxBorrow, lending_updateMaxExposure as updateMaxExposure, lending_updateOffer as updateOffer, lending_withdrawFunds as withdrawFunds, lending_withdrawFundsV1 as withdrawFundsV1, lending_withdrawFundsV2 as withdrawFundsV2 };
|
|
3408
3411
|
}
|
|
3409
3412
|
|
|
3410
3413
|
declare function getPda(seed: Buffer | Buffer[], programId: PublicKey): PublicKey;
|
package/dist/index.js
CHANGED
|
@@ -1106,6 +1106,7 @@ __export(lending_exports, {
|
|
|
1106
1106
|
depositFunds: () => depositFunds,
|
|
1107
1107
|
getNodeWalletPDA: () => getNodeWalletPDA,
|
|
1108
1108
|
getTradingPoolPDA: () => getTradingPoolPDA,
|
|
1109
|
+
getWithdrawalAccessList: () => getWithdrawalAccessList,
|
|
1109
1110
|
getWithdrawalAccessListPDA: () => getWithdrawalAccessListPDA,
|
|
1110
1111
|
removeFromWithdrawalAccessList: () => removeFromWithdrawalAccessList,
|
|
1111
1112
|
updateInterestRate: () => updateInterestRate,
|
|
@@ -1250,10 +1251,12 @@ function withdrawFundsV1(lavarageProgram, params) {
|
|
|
1250
1251
|
return __async(this, null, function* () {
|
|
1251
1252
|
var _a;
|
|
1252
1253
|
const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
|
|
1253
|
-
const
|
|
1254
|
+
const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
|
|
1255
|
+
const instruction = yield lavarageProgram.methods.lpOperatorWithdrawFromNodeWallet(new import_anchor.BN(params.amount)).accountsStrict({
|
|
1254
1256
|
nodeWallet: params.nodeWallet,
|
|
1255
1257
|
funder: params.funder,
|
|
1256
|
-
systemProgram: import_web3.SystemProgram.programId
|
|
1258
|
+
systemProgram: import_web3.SystemProgram.programId,
|
|
1259
|
+
withdrawalAccessList
|
|
1257
1260
|
}).instruction();
|
|
1258
1261
|
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1259
1262
|
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
@@ -1273,14 +1276,16 @@ function withdrawFundsV2(lavarageProgram, params) {
|
|
|
1273
1276
|
const mintPubkey = new import_web3.PublicKey(params.mint);
|
|
1274
1277
|
const fromTokenAccount = params.fromTokenAccount || (0, import_spl_token.getAssociatedTokenAddressSync)(mintPubkey, params.nodeWallet, true);
|
|
1275
1278
|
const toTokenAccount = params.toTokenAccount || (0, import_spl_token.getAssociatedTokenAddressSync)(mintPubkey, params.funder);
|
|
1276
|
-
const
|
|
1279
|
+
const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
|
|
1280
|
+
const instruction = yield lavarageProgram.methods.lpOperatorWithdrawFromNodeWallet(new import_anchor.BN(params.amount)).accountsStrict({
|
|
1277
1281
|
nodeWallet: params.nodeWallet,
|
|
1278
1282
|
funder: params.funder,
|
|
1279
1283
|
systemProgram: import_web3.SystemProgram.programId,
|
|
1280
1284
|
mint: mintPubkey,
|
|
1281
1285
|
fromTokenAccount,
|
|
1282
1286
|
toTokenAccount,
|
|
1283
|
-
tokenProgram: import_spl_token.TOKEN_PROGRAM_ID
|
|
1287
|
+
tokenProgram: import_spl_token.TOKEN_PROGRAM_ID,
|
|
1288
|
+
withdrawalAccessList
|
|
1284
1289
|
}).instruction();
|
|
1285
1290
|
const computeFeeIx = import_web3.ComputeBudgetProgram.setComputeUnitPrice({
|
|
1286
1291
|
microLamports: (_a = params.computeBudgetMicroLamports) != null ? _a : 15e4
|
|
@@ -1535,6 +1540,14 @@ function removeFromWithdrawalAccessList(lavarageProgram, params) {
|
|
|
1535
1540
|
return new import_web3.VersionedTransaction(messageV0);
|
|
1536
1541
|
});
|
|
1537
1542
|
}
|
|
1543
|
+
function getWithdrawalAccessList(lavarageProgram, params) {
|
|
1544
|
+
return __async(this, null, function* () {
|
|
1545
|
+
var _a;
|
|
1546
|
+
const withdrawalAccessList = getWithdrawalAccessListPDA(lavarageProgram.programId);
|
|
1547
|
+
const withdrawalAccessListAccount = yield lavarageProgram.account.withdrawalAccessList.fetch(withdrawalAccessList);
|
|
1548
|
+
return (_a = withdrawalAccessListAccount.accessEntries.find((entry) => entry.fromPubkey.toString() === params.nodeWallet)) == null ? void 0 : _a.toPubkey;
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1538
1551
|
|
|
1539
1552
|
// idl/lavarage.ts
|
|
1540
1553
|
var IDL = {
|