@haven-fi/solauto-sdk 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,6 @@
|
|
1
1
|
import { AddressLookupTableInput, Signer, TransactionBuilder, WrappedInstruction } from "@metaplex-foundation/umi";
|
2
2
|
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
3
3
|
import { SolautoClient } from "../clients/solautoClient";
|
4
|
-
export declare function loadSecretKey(keypairPath: string): Uint8Array;
|
5
|
-
export declare function getSecretKey(keypairFilename?: string): Uint8Array;
|
6
4
|
export declare function currentUnixSecondsSolana(): Promise<number>;
|
7
5
|
export declare function getWrappedInstruction(signer: Signer, ix: TransactionInstruction): WrappedInstruction;
|
8
6
|
export declare function setComputeUnitLimitUmiIx(signer: Signer, maxComputeUnits: number): WrappedInstruction;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../src/utils/solanaUtils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAGnB,MAAM,0BAA0B,CAAC;AAMlC,OAAO,EAGL,SAAS,EAIT,sBAAsB,EAEvB,MAAM,iBAAiB,CAAC;AAOzB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAQzD,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,CAQhE;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,sBAAsB,GACzB,kBAAkB,CAMpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,GACtB,kBAAkB,CAOpB;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,kBAAkB,CAOpB;AAED,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,SAAS,GACd,kBAAkB,CAUpB;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,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,qBAAqB,CACzC,oBAAoB,EAAE,MAAM,EAAE,GAC7B,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAkBpC;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,kBAAkB,EACtB,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,CAAC,EAAE,MAAM,sBA4D1B;AAiBD,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,kBAAkB,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAcjB;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,aAAa,EACrB,EAAE,EAAE,kBAAkB,EACtB,YAAY,CAAC,EAAE,OAAO,EACtB,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAqDjC"}
|
@@ -3,10 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.sendSingleOptimizedTransaction = exports.getComputeUnitPriceEstimate = exports.assembleFinalTransaction = exports.getAdressLookupInputs = exports.splTokenTransferUmiIx = exports.closeTokenAccountUmiIx = exports.systemTransferUmiIx = exports.createAssociatedTokenAccountUmiIx = exports.setComputeUnitPriceUmiIx = exports.setComputeUnitLimitUmiIx = exports.getWrappedInstruction = exports.currentUnixSecondsSolana =
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
6
|
+
exports.sendSingleOptimizedTransaction = exports.getComputeUnitPriceEstimate = exports.assembleFinalTransaction = exports.getAdressLookupInputs = exports.splTokenTransferUmiIx = exports.closeTokenAccountUmiIx = exports.systemTransferUmiIx = exports.createAssociatedTokenAccountUmiIx = exports.setComputeUnitPriceUmiIx = exports.setComputeUnitLimitUmiIx = exports.getWrappedInstruction = exports.currentUnixSecondsSolana = void 0;
|
8
7
|
const bs58_1 = __importDefault(require("bs58"));
|
9
|
-
const path_1 = __importDefault(require("path"));
|
10
8
|
const umi_1 = require("@metaplex-foundation/umi");
|
11
9
|
const umi_web3js_adapters_1 = require("@metaplex-foundation/umi-web3js-adapters");
|
12
10
|
const web3_js_1 = require("@solana/web3.js");
|
@@ -15,15 +13,6 @@ const accountUtils_1 = require("./accountUtils");
|
|
15
13
|
const solautoConstants_1 = require("../constants/solautoConstants");
|
16
14
|
const generalUtils_1 = require("./generalUtils");
|
17
15
|
const marginfi_sdk_1 = require("../marginfi-sdk");
|
18
|
-
function loadSecretKey(keypairPath) {
|
19
|
-
const secretKey = JSON.parse(fs_1.default.readFileSync(keypairPath, "utf8"));
|
20
|
-
return new Uint8Array(secretKey);
|
21
|
-
}
|
22
|
-
exports.loadSecretKey = loadSecretKey;
|
23
|
-
function getSecretKey(keypairFilename = "id") {
|
24
|
-
return loadSecretKey(path_1.default.join(process.env.HOME, ".config", "solana", keypairFilename + ".json"));
|
25
|
-
}
|
26
|
-
exports.getSecretKey = getSecretKey;
|
27
16
|
async function currentUnixSecondsSolana() {
|
28
17
|
return await (0, generalUtils_1.retryWithExponentialBackoff)(async () => {
|
29
18
|
const blockTime = await solautoConstants_1.CONNECTION.getBlockTime(await solautoConstants_1.CONNECTION.getSlot());
|
package/package.json
CHANGED
package/src/utils/solanaUtils.ts
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import fs from "fs";
|
2
1
|
import bs58 from "bs58";
|
3
|
-
import path from "path";
|
4
2
|
import {
|
5
3
|
AddressLookupTableInput,
|
6
4
|
Signer,
|
@@ -23,7 +21,6 @@ import {
|
|
23
21
|
SystemProgram,
|
24
22
|
TransactionInstruction,
|
25
23
|
VersionedTransaction,
|
26
|
-
TransactionError,
|
27
24
|
} from "@solana/web3.js";
|
28
25
|
import {
|
29
26
|
createAssociatedTokenAccountIdempotentInstruction,
|
@@ -39,17 +36,6 @@ import {
|
|
39
36
|
getLendingAccountStartFlashloanInstructionDataSerializer,
|
40
37
|
} from "../marginfi-sdk";
|
41
38
|
|
42
|
-
export function loadSecretKey(keypairPath: string) {
|
43
|
-
const secretKey = JSON.parse(fs.readFileSync(keypairPath, "utf8"));
|
44
|
-
return new Uint8Array(secretKey);
|
45
|
-
}
|
46
|
-
|
47
|
-
export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
|
48
|
-
return loadSecretKey(
|
49
|
-
path.join(process.env.HOME!, ".config", "solana", keypairFilename + ".json")
|
50
|
-
);
|
51
|
-
}
|
52
|
-
|
53
39
|
export async function currentUnixSecondsSolana(): Promise<number> {
|
54
40
|
return await retryWithExponentialBackoff(async () => {
|
55
41
|
const blockTime = await CONNECTION.getBlockTime(await CONNECTION.getSlot());
|
package/tests/shared.ts
CHANGED
@@ -1,7 +1,19 @@
|
|
1
|
+
import path from "path";
|
2
|
+
import fs from "fs";
|
1
3
|
import { Signer, createSignerFromKeypair } from "@metaplex-foundation/umi";
|
2
4
|
import { Connection, clusterApiUrl } from "@solana/web3.js";
|
3
5
|
import { createUmi } from "@metaplex-foundation/umi-bundle-defaults";
|
4
|
-
|
6
|
+
|
7
|
+
export function loadSecretKey(keypairPath: string) {
|
8
|
+
const secretKey = JSON.parse(fs.readFileSync(keypairPath, "utf8"));
|
9
|
+
return new Uint8Array(secretKey);
|
10
|
+
}
|
11
|
+
|
12
|
+
export function getSecretKey(keypairFilename: string = "id"): Uint8Array {
|
13
|
+
return loadSecretKey(
|
14
|
+
path.join(process.env.HOME!, ".config", "solana", keypairFilename + ".json")
|
15
|
+
);
|
16
|
+
}
|
5
17
|
|
6
18
|
export function setupTest(keypairFilename?: string): Signer {
|
7
19
|
const umi = createUmi(
|