@lavarage/sdk 6.6.0 → 6.7.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/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -20
- package/dist/index.mjs.map +1 -1
- package/evm.ts +9 -11
- package/index.ts +2 -10
- package/package.json +1 -1
package/evm.ts
CHANGED
|
@@ -154,7 +154,7 @@ export async function getPositionsEvm(
|
|
|
154
154
|
collateralAmount,
|
|
155
155
|
initialMargin,
|
|
156
156
|
} = event.args as unknown as any;
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
return {
|
|
159
159
|
trader: buyer,
|
|
160
160
|
tokenCollateral,
|
|
@@ -162,6 +162,7 @@ export async function getPositionsEvm(
|
|
|
162
162
|
openingPositionSize,
|
|
163
163
|
collateralAmount,
|
|
164
164
|
initialMargin,
|
|
165
|
+
transactionHash: event.transactionHash,
|
|
165
166
|
};
|
|
166
167
|
});
|
|
167
168
|
}
|
|
@@ -188,20 +189,16 @@ export async function getClosedPositionsEvm(
|
|
|
188
189
|
const events = await contract.queryFilter(filter, fromBlock);
|
|
189
190
|
|
|
190
191
|
return events.map((event: any) => {
|
|
191
|
-
const {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
loanId,
|
|
195
|
-
closingPositionSize,
|
|
196
|
-
profit
|
|
197
|
-
} = event.args as unknown as any;
|
|
198
|
-
|
|
192
|
+
const { buyer, tokenCollateral, loanId, closingPositionSize, profit } =
|
|
193
|
+
event.args as unknown as any;
|
|
194
|
+
|
|
199
195
|
return {
|
|
200
196
|
trader: buyer,
|
|
201
197
|
tokenCollateral,
|
|
202
198
|
loanId,
|
|
203
199
|
closingPositionSize,
|
|
204
200
|
profit,
|
|
201
|
+
transactionHash: event.transactionHash,
|
|
205
202
|
};
|
|
206
203
|
});
|
|
207
204
|
}
|
|
@@ -235,13 +232,14 @@ export async function getLiquidatedPositionsEvm(
|
|
|
235
232
|
closingPositionSize,
|
|
236
233
|
liquidatorRepaidAmount,
|
|
237
234
|
} = event.args as unknown as any;
|
|
238
|
-
|
|
235
|
+
|
|
239
236
|
return {
|
|
240
237
|
trader: borrower,
|
|
241
238
|
tokenCollateral,
|
|
242
239
|
loanId,
|
|
243
240
|
closingPositionSize,
|
|
244
241
|
liquidatorRepaidAmount,
|
|
242
|
+
transactionHash: event.transactionHash,
|
|
245
243
|
};
|
|
246
244
|
});
|
|
247
245
|
}
|
|
@@ -347,4 +345,4 @@ export async function getOffersEvm(
|
|
|
347
345
|
}
|
|
348
346
|
|
|
349
347
|
return activeCollaterals;
|
|
350
|
-
}
|
|
348
|
+
}
|
package/index.ts
CHANGED
|
@@ -190,6 +190,7 @@ export const openTradeV1 = async (
|
|
|
190
190
|
marginSOL: BN,
|
|
191
191
|
leverage: number,
|
|
192
192
|
randomSeed: Keypair,
|
|
193
|
+
tokenProgram: PublicKey,
|
|
193
194
|
partnerFeeRecipient?: PublicKey,
|
|
194
195
|
partnerFeeMarkup?: number
|
|
195
196
|
) => {
|
|
@@ -208,11 +209,6 @@ export const openTradeV1 = async (
|
|
|
208
209
|
randomSeed.publicKey
|
|
209
210
|
);
|
|
210
211
|
|
|
211
|
-
const mintAccount = await lavarageProgram.provider.connection.getAccountInfo(
|
|
212
|
-
offer.account.collateralType
|
|
213
|
-
);
|
|
214
|
-
const tokenProgram = mintAccount?.owner;
|
|
215
|
-
|
|
216
212
|
const fromTokenAccount = await getTokenAccountOrCreateIfNotExists(
|
|
217
213
|
lavarageProgram,
|
|
218
214
|
lavarageProgram.provider.publicKey!,
|
|
@@ -383,6 +379,7 @@ export const openTradeV2 = async (
|
|
|
383
379
|
leverage: number,
|
|
384
380
|
randomSeed: Keypair,
|
|
385
381
|
quoteToken: PublicKey,
|
|
382
|
+
tokenProgram: PublicKey,
|
|
386
383
|
partnerFeeRecipient?: PublicKey,
|
|
387
384
|
partnerFeeMarkup?: number
|
|
388
385
|
) => {
|
|
@@ -401,11 +398,6 @@ export const openTradeV2 = async (
|
|
|
401
398
|
randomSeed.publicKey
|
|
402
399
|
);
|
|
403
400
|
|
|
404
|
-
const mintAccount = await lavarageProgram.provider.connection.getAccountInfo(
|
|
405
|
-
offer.account.collateralType
|
|
406
|
-
);
|
|
407
|
-
const tokenProgram = mintAccount?.owner;
|
|
408
|
-
|
|
409
401
|
const quoteMintAccount =
|
|
410
402
|
await lavarageProgram.provider.connection.getAccountInfo(quoteToken);
|
|
411
403
|
const quoteTokenProgram = quoteMintAccount?.owner;
|