@haven-fi/solauto-sdk 1.0.250 → 1.0.251
Sign up to get free protection for your applications and to get access to all the features.
@@ -439,8 +439,8 @@ function getErrorInfo(umi, tx, error) {
|
|
439
439
|
let programError = null;
|
440
440
|
if (typeof error === "object" && error["InstructionError"]) {
|
441
441
|
const err = error["InstructionError"];
|
442
|
-
const errIx = tx.getInstructions()[Math.max(0, err[0]
|
443
|
-
const errCode = typeof err[1] === "object" ? err[1]["Custom"] : undefined;
|
442
|
+
const errIx = tx.getInstructions()[Math.max(0, err[0])];
|
443
|
+
const errCode = typeof err[1] === "object" && "Custom" in err[1] ? err[1]["Custom"] : undefined;
|
444
444
|
const errName = errCode === undefined ? err[1] : undefined;
|
445
445
|
let programName = "";
|
446
446
|
if (errIx.programId.toString() ===
|
@@ -12,7 +12,7 @@ export declare function systemTransferUmiIx(signer: Signer, destination: PublicK
|
|
12
12
|
export declare function closeTokenAccountUmiIx(signer: Signer, tokenAccount: PublicKey, authority: PublicKey): WrappedInstruction;
|
13
13
|
export declare function splTokenTransferUmiIx(signer: Signer, fromTa: PublicKey, toTa: PublicKey, authority: PublicKey, amount: bigint): WrappedInstruction;
|
14
14
|
export declare function getAddressLookupInputs(umi: Umi, lookupTableAddresses: string[]): Promise<AddressLookupTableInput[]>;
|
15
|
-
export declare function assembleFinalTransaction(signer: Signer,
|
15
|
+
export declare function assembleFinalTransaction(signer: Signer, transaction: TransactionBuilder, computeUnitPrice?: number, computeUnitLimit?: number): TransactionBuilder;
|
16
16
|
export declare function getComputeUnitPriceEstimate(umi: Umi, tx: TransactionBuilder, prioritySetting: PriorityFeeSetting): Promise<number | undefined>;
|
17
17
|
export declare function sendSingleOptimizedTransaction(umi: Umi, connection: Connection, tx: TransactionBuilder, txType?: TransactionRunType, prioritySetting?: PriorityFeeSetting, onAwaitingSign?: () => void): Promise<Uint8Array | undefined>;
|
18
18
|
//# sourceMappingURL=solanaUtils.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaUtils.d.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EACd,WAAW,EAAE,SAAS,EACtB,QAAQ,EAAE,MAAM,GACf,kBAAkB,CASpB;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,SAAS,EACvB,SAAS,EAAE,SAAS,GACnB,kBAAkB,CAKpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,EACf,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACb,kBAAkB,CAKpB;AAED,wBAAsB,sBAAsB,CAC1C,GAAG,EAAE,GAAG,EACR,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,kBAAkB,EAC/B,gBAAgB,CAAC,EAAE,MAAM,EACzB,gBAAgB,CAAC,EAAE,MAAM,sBAiE1B;AAmBD,wBAAsB,2BAA2B,CAC/C,GAAG,EAAE,GAAG,EACR,EAAE,EAAE,kBAAkB,EACtB,eAAe,EAAE,kBAAkB,GAClC,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAsB7B;AAiDD,wBAAsB,8BAA8B,CAClD,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,EAAE,EAAE,kBAAkB,EACtB,MAAM,CAAC,EAAE,kBAAkB,EAC3B,eAAe,GAAE,kBAA2C,EAC5D,cAAc,CAAC,EAAE,MAAM,IAAI,GAC1B,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CA6EjC"}
|
@@ -90,14 +90,15 @@ async function getAddressLookupInputs(umi, lookupTableAddresses) {
|
|
90
90
|
return acc;
|
91
91
|
}, new Array());
|
92
92
|
}
|
93
|
-
function assembleFinalTransaction(signer,
|
94
|
-
tx =
|
93
|
+
function assembleFinalTransaction(signer, transaction, computeUnitPrice, computeUnitLimit) {
|
94
|
+
let tx = (0, umi_1.transactionBuilder)()
|
95
95
|
.prepend(computeUnitPrice !== undefined
|
96
96
|
? setComputeUnitPriceUmiIx(signer, computeUnitPrice)
|
97
97
|
: (0, umi_1.transactionBuilder)())
|
98
98
|
.prepend(computeUnitLimit
|
99
99
|
? setComputeUnitLimitUmiIx(signer, computeUnitLimit)
|
100
|
-
: (0, umi_1.transactionBuilder)())
|
100
|
+
: (0, umi_1.transactionBuilder)())
|
101
|
+
.add(transaction);
|
101
102
|
const marginfiStartFlSerializer = (0, marginfi_sdk_1.getLendingAccountStartFlashloanInstructionDataSerializer)();
|
102
103
|
const marginfiStartFlDiscriminator = marginfiStartFlSerializer
|
103
104
|
.serialize({
|
package/package.json
CHANGED
@@ -810,8 +810,8 @@ export function getErrorInfo(umi: Umi, tx: TransactionBuilder, error: any) {
|
|
810
810
|
|
811
811
|
if (typeof error === "object" && (error as any)["InstructionError"]) {
|
812
812
|
const err = (error as any)["InstructionError"];
|
813
|
-
const errIx = tx.getInstructions()[Math.max(0, err[0]
|
814
|
-
const errCode = typeof err[1] === "object" ? err[1]["Custom"] : undefined;
|
813
|
+
const errIx = tx.getInstructions()[Math.max(0, err[0])];
|
814
|
+
const errCode = typeof err[1] === "object" && "Custom" in err[1] ? err[1]["Custom"] : undefined;
|
815
815
|
const errName = errCode === undefined ? (err[1] as string) : undefined;
|
816
816
|
let programName = "";
|
817
817
|
|
package/src/utils/solanaUtils.ts
CHANGED
@@ -183,11 +183,11 @@ export async function getAddressLookupInputs(
|
|
183
183
|
|
184
184
|
export function assembleFinalTransaction(
|
185
185
|
signer: Signer,
|
186
|
-
|
186
|
+
transaction: TransactionBuilder,
|
187
187
|
computeUnitPrice?: number,
|
188
188
|
computeUnitLimit?: number
|
189
189
|
) {
|
190
|
-
tx =
|
190
|
+
let tx = transactionBuilder()
|
191
191
|
.prepend(
|
192
192
|
computeUnitPrice !== undefined
|
193
193
|
? setComputeUnitPriceUmiIx(signer, computeUnitPrice)
|
@@ -197,7 +197,8 @@ export function assembleFinalTransaction(
|
|
197
197
|
computeUnitLimit
|
198
198
|
? setComputeUnitLimitUmiIx(signer, computeUnitLimit)
|
199
199
|
: transactionBuilder()
|
200
|
-
)
|
200
|
+
)
|
201
|
+
.add(transaction);
|
201
202
|
|
202
203
|
const marginfiStartFlSerializer =
|
203
204
|
getLendingAccountStartFlashloanInstructionDataSerializer();
|