@lavarage/sdk 6.8.3 → 6.8.4

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 CHANGED
@@ -2884,7 +2884,6 @@ declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<La
2884
2884
  declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
2885
2885
  tradingPool: PublicKey;
2886
2886
  poolOwner: PublicKey;
2887
- nodeWallet: string;
2888
2887
  mint?: string;
2889
2888
  interestRate: number;
2890
2889
  maxExposure: number;
package/dist/index.d.ts CHANGED
@@ -2884,7 +2884,6 @@ declare function withdrawFunds(lavarageProgram: Program<Lavarage$1> | Program<La
2884
2884
  declare function createOffer(lavarageProgram: Program<Lavarage$1> | Program<Lavarage>, params: {
2885
2885
  tradingPool: PublicKey;
2886
2886
  poolOwner: PublicKey;
2887
- nodeWallet: string;
2888
2887
  mint?: string;
2889
2888
  interestRate: number;
2890
2889
  maxExposure: number;
package/dist/index.js CHANGED
@@ -1164,7 +1164,8 @@ function createNodeWallet(lavarageProgram, params) {
1164
1164
  }
1165
1165
  return {
1166
1166
  instruction,
1167
- nodeWallet: nodeWallet instanceof import_web3.Keypair ? nodeWallet : void 0
1167
+ nodeWallet: nodeWallet instanceof import_web3.Keypair ? nodeWallet : void 0,
1168
+ nodeWalletAccount: nodeWallet instanceof import_web3.Keypair ? nodeWallet.publicKey : nodeWallet
1168
1169
  };
1169
1170
  });
1170
1171
  }
@@ -1262,28 +1263,32 @@ function withdrawFunds(lavarageProgram, params) {
1262
1263
  }
1263
1264
  function createOffer(lavarageProgram, params) {
1264
1265
  return __async(this, null, function* () {
1265
- const nodeWalletAccount = yield lavarageProgram.provider.connection.getAccountInfo(new import_web3.PublicKey(params.nodeWallet));
1266
- let nodeWalletSigner, createNodeWalletInstruction;
1266
+ const nodeWallets = yield lavarageProgram.account.nodeWallet.all();
1267
+ const nodeWalletAccount = nodeWallets.find((wallet) => wallet.account.nodeOperator.equals(new import_web3.PublicKey(params.poolOwner)));
1268
+ let nodeWalletSigner, createNodeWalletInstruction, nodeWalletPubKey;
1267
1269
  if (!nodeWalletAccount) {
1268
- const { instruction: instruction2, nodeWallet } = yield createNodeWallet(lavarageProgram, {
1270
+ const { instruction: instruction2, nodeWallet, nodeWalletAccount: nodeWalletPublicKey } = yield createNodeWallet(lavarageProgram, {
1269
1271
  operator: new import_web3.PublicKey(params.poolOwner.toBase58()),
1270
1272
  mint: params.mint,
1271
1273
  liquidationLtv: 90
1272
1274
  });
1273
1275
  nodeWalletSigner = nodeWallet;
1274
1276
  createNodeWalletInstruction = instruction2;
1277
+ nodeWalletPubKey = nodeWalletPublicKey;
1278
+ } else {
1279
+ nodeWalletPubKey = nodeWalletAccount.publicKey;
1275
1280
  }
1276
1281
  const { blockhash } = yield lavarageProgram.provider.connection.getLatestBlockhash("finalized");
1277
1282
  const instruction = yield lavarageProgram.methods.lpOperatorCreateTradingPool(new import_anchor.BN(params.interestRate)).accounts({
1278
1283
  tradingPool: params.tradingPool,
1279
1284
  operator: params.poolOwner,
1280
- nodeWallet: new import_web3.PublicKey(params.nodeWallet),
1285
+ nodeWallet: nodeWalletPubKey,
1281
1286
  mint: params.mint ? new import_web3.PublicKey(params.mint) : void 0,
1282
1287
  systemProgram: import_web3.SystemProgram.programId
1283
1288
  }).instruction();
1284
1289
  const updateMaxExposureInstruction = yield lavarageProgram.methods.lpOperatorUpdateMaxExposure(new import_anchor.BN(params.maxExposure)).accounts({
1285
1290
  tradingPool: params.tradingPool,
1286
- nodeWallet: new import_web3.PublicKey(params.nodeWallet),
1291
+ nodeWallet: nodeWalletPubKey,
1287
1292
  operator: params.poolOwner,
1288
1293
  systemProgram: import_web3.SystemProgram.programId
1289
1294
  }).instruction();