@jet-lab/margin
Advanced tools
Comparing version 0.1.35 to 0.1.36
@@ -394,9 +394,3 @@ "use strict"; | ||
} | ||
try { | ||
return await (0, utils_1.sendAll)(marginAccount.provider, [(0, utils_1.chunks)(11, refreshInstructions), instructionsInstructions]); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await (0, utils_1.sendAll)(marginAccount.provider, [(0, utils_1.chunks)(11, refreshInstructions), instructionsInstructions]); | ||
} | ||
@@ -480,9 +474,3 @@ async withGetOrCreateLoanPosition(instructions, marginAccount) { | ||
// } | ||
try { | ||
await (0, utils_1.sendAll)(marginAccount.provider, [(0, utils_1.chunks)(11, refreshInstructions), instructions]); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await (0, utils_1.sendAll)(marginAccount.provider, [(0, utils_1.chunks)(11, refreshInstructions), instructions]); | ||
} | ||
@@ -588,2 +576,3 @@ async withMarginRepay({ instructions, marginAccount, depositPosition, loanPosition, amount }) { | ||
}); | ||
await this.withMarginRefreshPositionPrice({ instructions, marginAccount }); | ||
return loanNoteAccount; | ||
@@ -638,9 +627,3 @@ } | ||
} | ||
try { | ||
await marginAccount.provider.sendAndConfirm(new web3_js_1.Transaction().add(...instructions)); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await (0, utils_1.sendAll)(marginAccount.provider, [instructions]); | ||
await marginAccount.refresh(); | ||
@@ -647,0 +630,0 @@ } |
@@ -510,3 +510,4 @@ "use strict"; | ||
let sourceAddress; | ||
if (source instanceof web3_js_1.PublicKey || typeof source === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof source === "string" || (typeof source === "object" && "_bn" in source)) { | ||
sourceAddress = (0, anchor_1.translateAddress)(source); | ||
@@ -531,3 +532,4 @@ } | ||
let destinationAddress; | ||
if (destination instanceof web3_js_1.PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = (0, anchor_1.translateAddress)(destination); | ||
@@ -553,3 +555,4 @@ } | ||
let destinationAddress; | ||
if (destination instanceof web3_js_1.PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = (0, anchor_1.translateAddress)(destination); | ||
@@ -556,0 +559,0 @@ } |
@@ -57,3 +57,3 @@ "use strict"; | ||
// preserve stacktrace | ||
console.log(err); | ||
console.log(err, JSON.stringify(err.logs)); | ||
throw err; | ||
@@ -60,0 +60,0 @@ } |
@@ -391,9 +391,3 @@ import { BN, translateAddress } from "@project-serum/anchor"; | ||
} | ||
try { | ||
return await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructionsInstructions]); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructionsInstructions]); | ||
} | ||
@@ -477,9 +471,3 @@ async withGetOrCreateLoanPosition(instructions, marginAccount) { | ||
// } | ||
try { | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructions]); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructions]); | ||
} | ||
@@ -585,2 +573,3 @@ async withMarginRepay({ instructions, marginAccount, depositPosition, loanPosition, amount }) { | ||
}); | ||
await this.withMarginRefreshPositionPrice({ instructions, marginAccount }); | ||
return loanNoteAccount; | ||
@@ -635,9 +624,3 @@ } | ||
} | ||
try { | ||
await marginAccount.provider.sendAndConfirm(new Transaction().add(...instructions)); | ||
} | ||
catch (err) { | ||
console.log(err); | ||
throw err; | ||
} | ||
await sendAll(marginAccount.provider, [instructions]); | ||
await marginAccount.refresh(); | ||
@@ -644,0 +627,0 @@ } |
@@ -507,3 +507,4 @@ import { BN, translateAddress } from "@project-serum/anchor"; | ||
let sourceAddress; | ||
if (source instanceof PublicKey || typeof source === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof source === "string" || (typeof source === "object" && "_bn" in source)) { | ||
sourceAddress = translateAddress(source); | ||
@@ -528,3 +529,4 @@ } | ||
let destinationAddress; | ||
if (destination instanceof PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = translateAddress(destination); | ||
@@ -550,3 +552,4 @@ } | ||
let destinationAddress; | ||
if (destination instanceof PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = translateAddress(destination); | ||
@@ -553,0 +556,0 @@ } |
@@ -54,3 +54,3 @@ import { sendAndConfirmRawTransaction, Transaction } from "@solana/web3.js"; | ||
// preserve stacktrace | ||
console.log(err); | ||
console.log(err, JSON.stringify(err.logs)); | ||
throw err; | ||
@@ -57,0 +57,0 @@ } |
{ | ||
"name": "@jet-lab/margin", | ||
"version": "0.1.35", | ||
"version": "0.1.36", | ||
"description": "Library for interacting with the Jet margin on-chain programs", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -561,8 +561,3 @@ import { Address, BN, translateAddress } from "@project-serum/anchor" | ||
try { | ||
return await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructionsInstructions]) | ||
} catch (err) { | ||
console.log(err) | ||
throw err | ||
} | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructionsInstructions]) | ||
} | ||
@@ -681,8 +676,3 @@ | ||
try { | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructions]) | ||
} catch (err) { | ||
console.log(err) | ||
throw err | ||
} | ||
await sendAll(marginAccount.provider, [chunks(11, refreshInstructions), instructions]) | ||
} | ||
@@ -836,2 +826,3 @@ | ||
}) | ||
await this.withMarginRefreshPositionPrice({ instructions, marginAccount }) | ||
return loanNoteAccount | ||
@@ -900,9 +891,3 @@ } | ||
try { | ||
await marginAccount.provider.sendAndConfirm(new Transaction().add(...instructions)) | ||
} catch (err) { | ||
console.log(err) | ||
throw err | ||
} | ||
await sendAll(marginAccount.provider, [instructions]) | ||
await marginAccount.refresh() | ||
@@ -909,0 +894,0 @@ } |
@@ -654,3 +654,4 @@ import { BN, Address, translateAddress, AnchorProvider, Provider } from "@project-serum/anchor" | ||
let sourceAddress: PublicKey | undefined | ||
if (source instanceof PublicKey || typeof source === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof source === "string" || (typeof source === "object" && "_bn" in source)) { | ||
sourceAddress = translateAddress(source) | ||
@@ -687,3 +688,4 @@ } | ||
let destinationAddress: PublicKey | undefined | ||
if (destination instanceof PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = translateAddress(destination) | ||
@@ -725,3 +727,4 @@ } | ||
let destinationAddress: PublicKey | undefined | ||
if (destination instanceof PublicKey || typeof destination === "string") { | ||
// Is destination a PublicKey or string | ||
if (typeof destination === "string" || (typeof destination === "object" && "_bn" in destination)) { | ||
destinationAddress = translateAddress(destination) | ||
@@ -728,0 +731,0 @@ } |
@@ -66,3 +66,3 @@ import { AnchorProvider } from "@project-serum/anchor" | ||
// preserve stacktrace | ||
console.log(err) | ||
console.log(err, JSON.stringify(err.logs)) | ||
throw err | ||
@@ -69,0 +69,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2123838
40360