sol-ihor-lab 1.0.3 → 1.0.4

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.
@@ -49,7 +49,6 @@ export declare class EnvironmentManager {
49
49
  static getRpcNetUrl(): string;
50
50
  static setNetUrls(main_url: string, dev_url: string, test_url?: string): void;
51
51
  static getBundlrUrl(): string;
52
- static getCheckUrl(): string;
53
52
  static getProgramID(): ProgramId;
54
53
  static setQuoteTokenInfo(token_info: TOKEN_INFO): void;
55
54
  static getQuoteTokenInfo(): TOKEN_INFO;
package/lib/cjs/index.js CHANGED
@@ -21,7 +21,6 @@ __exportStar(require("./instructions/createATA-instruction"), exports);
21
21
  __exportStar(require("./instructions/sol-transfer-instruction"), exports);
22
22
  __exportStar(require("./instructions/transfer-instruction"), exports);
23
23
  __exportStar(require("./transaction/execute-rpc"), exports);
24
- __exportStar(require("./transaction/sign-tx"), exports);
25
24
  __exportStar(require("./transaction/transaction-exectue"), exports);
26
25
  __exportStar(require("./utils/budget"), exports);
27
26
  __exportStar(require("./utils/error-helper"), exports);
@@ -10,13 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.confirmTx = exports.sendTx = void 0;
13
- const sign_tx_1 = require("./sign-tx");
14
13
  const errors_1 = require("../errors");
15
14
  function sendTx(connection, tx, option) {
16
15
  return __awaiter(this, void 0, void 0, function* () {
17
16
  try {
18
17
  tx.txn.message.recentBlockhash = (yield connection.getLatestBlockhash("finalized")).blockhash;
19
- (0, sign_tx_1.signTransaction)(tx);
20
18
  return yield connection.sendTransaction(tx.txn, option);
21
19
  }
22
20
  catch (error) {
@@ -22,7 +22,6 @@ const { compileInstToVersioned } = require('../instructions/build-instruction')
22
22
  const { getCreateAccountTransactionInst } = require('../instructions/createATA-instruction')
23
23
  const { generateBuyInst } = require('../instructions/buy-instruction')
24
24
  const { TransactionExecuter, ExectuerStatus } = require('../transaction/transaction-exectue')
25
- const { signTransaction } = require('../transaction/sign-tx')
26
25
  const { TOKEN_PROGRAM_ID, Token, TokenAmount, ONE,
27
26
  jsonInfo2PoolKeys, LiquidityPoolKeys } = require("@raydium-io/raydium-sdk");
28
27
  const { getATAAddress, xWeiAmount } = require('./get-balance')
@@ -8,7 +8,6 @@ export * from "./instructions/transfer-instruction";
8
8
  export * from "./pool/pool-manager";
9
9
  export * from "./transaction/bundle";
10
10
  export * from "./transaction/execute-rpc";
11
- export * from "./transaction/sign-tx";
12
11
  export * from "./transaction/transaction-exectue";
13
12
  export * from "./utils/budget";
14
13
  export * from "./utils/error-helper";
package/lib/esm/index.js CHANGED
@@ -8,7 +8,6 @@ export * from "./instructions/transfer-instruction";
8
8
  export * from "./pool/pool-manager";
9
9
  export * from "./transaction/bundle";
10
10
  export * from "./transaction/execute-rpc";
11
- export * from "./transaction/sign-tx";
12
11
  export * from "./transaction/transaction-exectue";
13
12
  export * from "./utils/budget";
14
13
  export * from "./utils/error-helper";
@@ -13,7 +13,6 @@ import { Bundle } from "jito-ts/dist/sdk/block-engine/types";
13
13
  import base58 from "bs58";
14
14
  import { TransactionExecuteError } from "../errors";
15
15
  import { sleep } from "../utils/util";
16
- import { signTransaction } from "./sign-tx";
17
16
  export function createAndSendBundle(connection, bundleTranasction, payer, jitoBlockEngine, jitoAuther, fee) {
18
17
  return __awaiter(this, void 0, void 0, function* () {
19
18
  const searcher = searcherClient(jitoBlockEngine, jitoAuther);
@@ -25,7 +24,6 @@ export function createAndSendBundle(connection, bundleTranasction, payer, jitoBl
25
24
  const realForBundle = [];
26
25
  for (let i = 0; i < bundleTranasction.length; i++) {
27
26
  bundleTranasction[i].txn.message.recentBlockhash = (yield connection.getLatestBlockhash("finalized")).blockhash;
28
- signTransaction(bundleTranasction[i]);
29
27
  realForBundle.push(bundleTranasction[i].txn);
30
28
  }
31
29
  let bundleTx = new Bundle(realForBundle, 5);
@@ -7,13 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import { signTransaction } from "./sign-tx";
11
10
  import { TransactionExecuteError } from "../errors";
12
11
  export function sendTx(connection, tx, option) {
13
12
  return __awaiter(this, void 0, void 0, function* () {
14
13
  try {
15
14
  tx.txn.message.recentBlockhash = (yield connection.getLatestBlockhash("finalized")).blockhash;
16
- signTransaction(tx);
17
15
  return yield connection.sendTransaction(tx.txn, option);
18
16
  }
19
17
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sol-ihor-lab",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Solana laboratory utility",
5
5
  "license": "MIT",
6
6
  "scripts": {
@@ -4,7 +4,6 @@ import {
4
4
  TransactionConfirmationStrategy
5
5
  } from "@solana/web3.js";
6
6
  import { TransactionInfo } from "../instructions/build-instruction";
7
- import { signTransaction } from "./sign-tx";
8
7
  import { TransactionExecuteError } from "../errors";
9
8
 
10
9
  export async function sendTx(
@@ -16,7 +15,6 @@ export async function sendTx(
16
15
  tx.txn.message.recentBlockhash = (
17
16
  await connection.getLatestBlockhash("finalized")
18
17
  ).blockhash;
19
- signTransaction(tx);
20
18
  return await connection.sendTransaction(tx.txn, option);
21
19
  } catch (error) {
22
20
  throw new TransactionExecuteError(`sendTx: ${error}`);
@@ -1,116 +0,0 @@
1
- import {
2
- Connection,
3
- Keypair,
4
- LAMPORTS_PER_SOL,
5
- PublicKey
6
- } from "@solana/web3.js";
7
- import { TransactionInfo } from "../instructions/build-instruction";
8
- import { searcherClient } from "jito-ts/dist/sdk/block-engine/searcher";
9
- import { Bundle } from "jito-ts/dist/sdk/block-engine/types";
10
- import base58 from "bs58";
11
- import { TransactionExecuteError } from "../errors";
12
- import { sleep } from "../utils/util";
13
- import { signTransaction } from "./sign-tx";
14
-
15
- export async function createAndSendBundle(
16
- connection: Connection,
17
- bundleTranasction: TransactionInfo[],
18
- payer: Keypair,
19
- jitoBlockEngine: string,
20
- jitoAuther: Keypair,
21
- fee: number
22
- ) {
23
- const searcher = searcherClient(jitoBlockEngine, jitoAuther);
24
-
25
- let txnConfirmResult: boolean = false;
26
- let breakCheckTransactionStatus: boolean = false;
27
-
28
- try {
29
- const blockhash = (await connection.getLatestBlockhash("finalized"))
30
- .blockhash;
31
- const realForBundle: any[] = [];
32
- for (let i = 0; i < bundleTranasction.length; i++) {
33
- bundleTranasction[i].txn.message.recentBlockhash = (
34
- await connection.getLatestBlockhash("finalized")
35
- ).blockhash;
36
- signTransaction(bundleTranasction[i]);
37
- realForBundle.push(bundleTranasction[i].txn);
38
- }
39
-
40
- let bundleTx = new Bundle(realForBundle, 5);
41
- if (payer) {
42
- const tipAccount = new PublicKey((await searcher.getTipAccounts())[0]);
43
- bundleTx.addTipTx(payer, fee * LAMPORTS_PER_SOL, tipAccount, blockhash);
44
- }
45
-
46
- searcher.onBundleResult(
47
- async (bundleResult: any) => {
48
- console.log(bundleResult);
49
-
50
- if (bundleResult.rejected) {
51
- try {
52
- if (
53
- bundleResult.rejected.simulationFailure.msg.includes(
54
- "custom program error"
55
- ) ||
56
- bundleResult.rejected.simulationFailure.msg.includes(
57
- "Error processing Instruction"
58
- )
59
- ) {
60
- breakCheckTransactionStatus = true;
61
- } else if (
62
- bundleResult.rejected.simulationFailure.msg.includes(
63
- "This transaction has already been processed"
64
- ) ||
65
- bundleResult.rejected.droppedBundle.msg.includes(
66
- "Bundle partially processed"
67
- )
68
- ) {
69
- txnConfirmResult = true;
70
- breakCheckTransactionStatus = true;
71
- }
72
- } catch (error) {}
73
- }
74
- },
75
- (error) => {
76
- breakCheckTransactionStatus = false;
77
- }
78
- );
79
-
80
- console.log("Send");
81
- await searcher.sendBundle(bundleTx);
82
- console.log("Finish send");
83
- setTimeout(() => {
84
- breakCheckTransactionStatus = true;
85
- }, 20000);
86
-
87
- const txnHash = base58.encode(
88
- realForBundle[realForBundle.length - 1].signatures[0]
89
- );
90
-
91
- console.log(txnHash);
92
- while (!breakCheckTransactionStatus) {
93
- await sleep(1000);
94
- try {
95
- const result = await connection.getSignatureStatus(txnHash, {
96
- searchTransactionHistory: true
97
- });
98
- if (result && result.value && result.value.confirmationStatus) {
99
- txnConfirmResult = true;
100
- breakCheckTransactionStatus = true;
101
- }
102
- } catch (error) {
103
- txnConfirmResult = false;
104
- breakCheckTransactionStatus = false;
105
- }
106
- }
107
-
108
- if (txnConfirmResult) {
109
- return true;
110
- } else {
111
- throw new TransactionExecuteError(`Bundle Error: failed`);
112
- }
113
- } catch (error) {
114
- throw new TransactionExecuteError(`Bundle Error: ${error}`);
115
- }
116
- }