@flipflop-sdk/cli-v2 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.
- package/README.md +150 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +187 -0
- package/dist/cli.js.map +1 -0
- package/dist/display-mint.d.ts +1 -0
- package/dist/display-mint.js +68 -0
- package/dist/display-mint.js.map +1 -0
- package/dist/display-token-params.d.ts +4 -0
- package/dist/display-token-params.js +38 -0
- package/dist/display-token-params.js.map +1 -0
- package/dist/display-urc.d.ts +1 -0
- package/dist/display-urc.js +40 -0
- package/dist/display-urc.js.map +1 -0
- package/dist/init.d.ts +7 -0
- package/dist/init.js +34 -0
- package/dist/init.js.map +1 -0
- package/dist/launch.d.ts +11 -0
- package/dist/launch.js +63 -0
- package/dist/launch.js.map +1 -0
- package/dist/metadata.d.ts +9 -0
- package/dist/metadata.js +39 -0
- package/dist/metadata.js.map +1 -0
- package/dist/mint.d.ts +11 -0
- package/dist/mint.js +60 -0
- package/dist/mint.js.map +1 -0
- package/dist/raydium/add-liquidity.d.ts +10 -0
- package/dist/raydium/add-liquidity.js +56 -0
- package/dist/raydium/add-liquidity.js.map +1 -0
- package/dist/raydium/burn-liquidity.d.ts +9 -0
- package/dist/raydium/burn-liquidity.js +50 -0
- package/dist/raydium/burn-liquidity.js.map +1 -0
- package/dist/raydium/buy-token.d.ts +11 -0
- package/dist/raydium/buy-token.js +56 -0
- package/dist/raydium/buy-token.js.map +1 -0
- package/dist/raydium/create-pool.d.ts +11 -0
- package/dist/raydium/create-pool.js +62 -0
- package/dist/raydium/create-pool.js.map +1 -0
- package/dist/raydium/display-lp.d.ts +7 -0
- package/dist/raydium/display-lp.js +48 -0
- package/dist/raydium/display-lp.js.map +1 -0
- package/dist/raydium/display-pool.d.ts +6 -0
- package/dist/raydium/display-pool.js +51 -0
- package/dist/raydium/display-pool.js.map +1 -0
- package/dist/raydium/estimate-slippage.d.ts +6 -0
- package/dist/raydium/estimate-slippage.js +58 -0
- package/dist/raydium/estimate-slippage.js.map +1 -0
- package/dist/raydium/estimate-volume.d.ts +6 -0
- package/dist/raydium/estimate-volume.js +58 -0
- package/dist/raydium/estimate-volume.js.map +1 -0
- package/dist/raydium/remove-liquidity.d.ts +10 -0
- package/dist/raydium/remove-liquidity.js +53 -0
- package/dist/raydium/remove-liquidity.js.map +1 -0
- package/dist/raydium/sell-token.d.ts +11 -0
- package/dist/raydium/sell-token.js +54 -0
- package/dist/raydium/sell-token.js.map +1 -0
- package/dist/refund.d.ts +8 -0
- package/dist/refund.js +50 -0
- package/dist/refund.js.map +1 -0
- package/dist/set-urc.d.ts +9 -0
- package/dist/set-urc.js +41 -0
- package/dist/set-urc.js.map +1 -0
- package/dist/system-config.d.ts +5 -0
- package/dist/system-config.js +39 -0
- package/dist/system-config.js.map +1 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +35 -0
- package/dist/utils.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.estimateSlippageCommand = void 0;
|
|
4
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const estimateSlippageCommand = async (options) => {
|
|
9
|
+
const { rpc, mint, amount, action } = options;
|
|
10
|
+
try {
|
|
11
|
+
const result = await (0, node_v2_1.estimateSlippage)({
|
|
12
|
+
rpc,
|
|
13
|
+
tokenAMint: new web3_js_1.PublicKey(mint),
|
|
14
|
+
tokenBMint: spl_token_1.NATIVE_MINT,
|
|
15
|
+
tokenAAmount: parseFloat(amount),
|
|
16
|
+
action,
|
|
17
|
+
});
|
|
18
|
+
if (!result.success || !result.data) {
|
|
19
|
+
console.error('β Error: ', result.message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Display formatted slippage estimation results
|
|
23
|
+
console.log('\nπ― Slippage Estimation Results');
|
|
24
|
+
console.log('β'.repeat(50));
|
|
25
|
+
// Basic information
|
|
26
|
+
console.log(`Action Type: ${result.data.action || action}`);
|
|
27
|
+
console.log(`Current Price: ${result.data.currentPrice}`);
|
|
28
|
+
console.log(`Token Amount: ${result.data.tokenAAmount.div(new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL)).toNumber()}`);
|
|
29
|
+
console.log(`Slippage: ${(result.data.slippage).toFixed(4)}%`);
|
|
30
|
+
// Reserve information
|
|
31
|
+
console.log('\nπ Pool Reserves');
|
|
32
|
+
console.log('β'.repeat(30));
|
|
33
|
+
console.log(`Base Reserve: ${result.data.baseReserve.div(new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL)).toNumber()} SOL`);
|
|
34
|
+
console.log(`Quote Reserve: ${result.data.quoteReserve.div(new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL)).toNumber()} Tokens`);
|
|
35
|
+
// console.log(`Constant Product (k): ${result.data.k.div(new BN("1000000000000000000")).toNumber()}`);
|
|
36
|
+
// Optional fields
|
|
37
|
+
if (result.data.requiredAmount) {
|
|
38
|
+
const actionText = result.data.action === 'buy' ? 'Required SOL' : 'Expected Receive SOL';
|
|
39
|
+
console.log(`\nπ° ${actionText}`);
|
|
40
|
+
console.log('β'.repeat(30));
|
|
41
|
+
console.log(`WSOL Amount: ${(result.data.requiredAmount.toNumber() / web3_js_1.LAMPORTS_PER_SOL)} SOL`);
|
|
42
|
+
}
|
|
43
|
+
if (result.data.actualPrice) {
|
|
44
|
+
console.log('\nπ± Actual Trading Price');
|
|
45
|
+
console.log('β'.repeat(30));
|
|
46
|
+
console.log(`Price: ${result.data.actualPrice}`);
|
|
47
|
+
// Calculate price impact
|
|
48
|
+
const priceImpact = ((result.data.actualPrice - result.data.currentPrice) / result.data.currentPrice) * 100;
|
|
49
|
+
console.log(`Price Impact: ${Math.abs(priceImpact).toFixed(4)}%`);
|
|
50
|
+
}
|
|
51
|
+
console.log('\nβ
Slippage estimation completed successfully');
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('β Error: ', error instanceof Error ? error.message : 'Unknown error');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.estimateSlippageCommand = estimateSlippageCommand;
|
|
58
|
+
//# sourceMappingURL=estimate-slippage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-slippage.js","sourceRoot":"","sources":["../../cli/src/raydium/estimate-slippage.ts"],"names":[],"mappings":";;;AAAA,8CAAuC;AACvC,mDAAyD;AAEzD,iDAAgD;AAChD,6CAA8D;AAEvD,MAAM,uBAAuB,GAAG,KAAK,EAAE,OAK7C,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAE9C,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,0BAAgB,EAAC;YACpC,GAAG;YACH,UAAU,EAAE,IAAI,mBAAS,CAAC,IAAI,CAAC;YAC/B,UAAU,EAAE,uBAAW;YACvB,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC;YAChC,MAAM;SACoB,CAA0C,CAAC;QAEvE,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YACpC,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YAC3C,OAAO;QACT,CAAC;QAED,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;QAChD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAE5B,oBAAoB;QACpB,OAAO,CAAC,GAAG,CAAC,4CAA4C,MAAM,CAAC,I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C,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE,GAAG,0BAAgB,CAAC,MAAM,CAAC,CAAC;QACjI,CAAC;QAED,IAAI,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,4CAA4C,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAEnF,yBAAyB;YACzB,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,GAAG,CAAC;YAC5G,OAAO,CAAC,GAAG,CAAC,4CAA4C,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC/F,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAEhE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACvF,CAAC;AACH,CAAC,CAAC;AA9DW,QAAA,uBAAuB,2BA8DlC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.estimateVolumeCommand = void 0;
|
|
4
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
6
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const estimateVolumeCommand = async (options) => {
|
|
9
|
+
const { rpc, mint, maxSlippage, action } = options;
|
|
10
|
+
try {
|
|
11
|
+
const result = await (0, node_v2_1.estimateVolume)({
|
|
12
|
+
rpc,
|
|
13
|
+
tokenAMint: new web3_js_1.PublicKey(mint),
|
|
14
|
+
tokenBMint: spl_token_1.NATIVE_MINT,
|
|
15
|
+
maxSlippage: parseFloat(maxSlippage), // 0-100
|
|
16
|
+
action,
|
|
17
|
+
});
|
|
18
|
+
if (!result.success || !result.data) {
|
|
19
|
+
console.error('β Error: ', result.message);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
// Display formatted volume estimation results
|
|
23
|
+
console.log('\nπ Volume Estimation Results');
|
|
24
|
+
console.log('β'.repeat(50));
|
|
25
|
+
// Basic information
|
|
26
|
+
console.log(`Action Type: ${result.data.action || action}`);
|
|
27
|
+
console.log(`Current Price: ${result.data.currentPrice}`);
|
|
28
|
+
console.log(`Actual Slippage: ${(result.data.maxSlippage).toFixed(4)}%`);
|
|
29
|
+
console.log(`Token Amount: ${result.data.tokenAAmount.div(new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL)).toNumber()}`);
|
|
30
|
+
// Reserve information
|
|
31
|
+
console.log('\nπ Pool Reserves');
|
|
32
|
+
console.log('β'.repeat(30));
|
|
33
|
+
console.log(`Base Reserve: ${(result.data.baseReserve.toNumber() / web3_js_1.LAMPORTS_PER_SOL)} SOL`);
|
|
34
|
+
console.log(`Quote Reserve: ${result.data.quoteReserve.div(new anchor_1.BN(web3_js_1.LAMPORTS_PER_SOL)).toNumber()} Tokens`);
|
|
35
|
+
// console.log(`Constant Product (k): ${result.data.k.toString()}`);
|
|
36
|
+
// Optional fields
|
|
37
|
+
if (result.data.requiredAmount) {
|
|
38
|
+
const actionText = result.data.action === 'buy' ? 'Required SOL' : 'Expected Receive SOL';
|
|
39
|
+
console.log(`\nπ° ${actionText}`);
|
|
40
|
+
console.log('β'.repeat(30));
|
|
41
|
+
console.log(`WSOL Amount: ${result.data.requiredAmount.toNumber() / web3_js_1.LAMPORTS_PER_SOL} SOL`);
|
|
42
|
+
}
|
|
43
|
+
if (result.data.actualPrice) {
|
|
44
|
+
console.log('\nπ± Actual Trading Price');
|
|
45
|
+
console.log('β'.repeat(30));
|
|
46
|
+
console.log(`Price: ${result.data.actualPrice}`);
|
|
47
|
+
// Calculate price impact
|
|
48
|
+
const priceImpact = ((result.data.actualPrice - result.data.currentPrice) / result.data.currentPrice) * 100;
|
|
49
|
+
console.log(`Price Impact: ${Math.abs(priceImpact).toFixed(4)}%`);
|
|
50
|
+
}
|
|
51
|
+
console.log('\nβ
Volume estimation completed successfully');
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
console.error('β Error: ', error instanceof Error ? error.message : 'Unknown error');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.estimateVolumeCommand = estimateVolumeCommand;
|
|
58
|
+
//# sourceMappingURL=estimate-volume.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-volume.js","sourceRoot":"","sources":["../../cli/src/raydium/estimate-volume.ts"],"names":[],"mappings":";;;AAAA,8CAAuC;AACvC,mDAAuD;AAEvD,iDAAgD;AAChD,6CAA8D;AAEvD,MAAM,qBAAqB,GAAG,KAAK,EAAE,OAK3C,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAEnD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,IAAA,wBAAc,EAAC;YAClC,GAAG;YACH,UAAU,EAAE,IAAI,mBAAS,CAAC,IAAI,CAAC;YAC/B,UAAU,EAAE,uBAAW;YACvB,WAAW,EAAE,UAAU,CAAC,WAAW,CAAC,EAAE,QAA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AO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACvF,CAAC;AACH,CAAC,CAAC;AA9DW,QAAA,qBAAqB,yBA8DhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface RemoveLiquidityOptions {
|
|
2
|
+
rpc?: string;
|
|
3
|
+
mint: string;
|
|
4
|
+
removePercentage: string;
|
|
5
|
+
slippage?: string;
|
|
6
|
+
keypairBs58?: string;
|
|
7
|
+
keypairFile?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function removeLiquidityCommand(options: RemoveLiquidityOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.removeLiquidityCommand = removeLiquidityCommand;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
7
|
+
async function removeLiquidityCommand(options) {
|
|
8
|
+
if (!options.rpc) {
|
|
9
|
+
console.error('β Error: Missing --rpc parameter');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!options.mint) {
|
|
13
|
+
console.error('β Error: Missing --mint parameter');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!options.removePercentage) {
|
|
17
|
+
console.error('β Error: Missing --remove-percentage parameter');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!options.keypairBs58 && !options.keypairFile) {
|
|
21
|
+
console.error('β Error: Missing --keypair-bs58 or --keypair-file parameter');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const payer = options.keypairFile
|
|
26
|
+
? (0, utils_1.loadKeypairFromFile)(options.keypairFile)
|
|
27
|
+
: (0, utils_1.loadKeypairFromBase58)(options.keypairBs58);
|
|
28
|
+
const result = await (0, node_v2_1.removeLiquidity)({
|
|
29
|
+
rpc: options.rpc,
|
|
30
|
+
mint: new web3_js_1.PublicKey(options.mint),
|
|
31
|
+
removePercentage: parseFloat(options.removePercentage),
|
|
32
|
+
payer,
|
|
33
|
+
slippage: options.slippage ? parseFloat(options.slippage) : 1,
|
|
34
|
+
});
|
|
35
|
+
if (!result.success || !result.data) {
|
|
36
|
+
console.error('β Error: ', result.message);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
console.log('\nβ
Liquidity Removed Successfully!');
|
|
40
|
+
console.log('β'.repeat(50));
|
|
41
|
+
console.log(`Transaction Hash: ${result.data.signature}`);
|
|
42
|
+
if (result.data.tokenAAmount) {
|
|
43
|
+
console.log(`Token A Received: ${result.data.tokenAAmount.toNumber() / web3_js_1.LAMPORTS_PER_SOL}`);
|
|
44
|
+
}
|
|
45
|
+
if (result.data.tokenBAmount) {
|
|
46
|
+
console.log(`Token B Received: ${result.data.tokenBAmount.toNumber() / web3_js_1.LAMPORTS_PER_SOL}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('β Error: ', error instanceof Error ? error.message : 'Unknown error');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=remove-liquidity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-liquidity.js","sourceRoot":"","sources":["../../cli/src/raydium/remove-liquidity.ts"],"names":[],"mappings":";;AAaA,wDAmDC;AAhED,6CAA8D;AAC9D,oCAAsE;AACtE,mDAAwD;AAWjD,KAAK,UAAU,sBAAsB,CAAC,OAA+B;IAC1E,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,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B,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QAC1D,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,0BAAgB,EAAE,CAAC,CAAC;QAC7F,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YAC7B,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,GAAG,0BAAgB,EAAE,CAAC,CAAC;QAC7F,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface SellTokenOptions {
|
|
2
|
+
rpc?: string;
|
|
3
|
+
mint: string;
|
|
4
|
+
amount: string;
|
|
5
|
+
slippage: string;
|
|
6
|
+
keypairBs58?: string;
|
|
7
|
+
keypairFile?: string;
|
|
8
|
+
lut?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function sellTokenCommand(options: SellTokenOptions): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sellTokenCommand = sellTokenCommand;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
7
|
+
async function sellTokenCommand(options) {
|
|
8
|
+
if (!options.rpc) {
|
|
9
|
+
console.error('β Error: Missing --rpc parameter');
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (!options.mint) {
|
|
13
|
+
console.error('β Error: Missing --mint parameter');
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (!options.amount) {
|
|
17
|
+
console.error('β Error: Missing --amount parameter');
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!options.slippage) {
|
|
21
|
+
options.slippage = '5';
|
|
22
|
+
}
|
|
23
|
+
if (!options.keypairBs58 && !options.keypairFile) {
|
|
24
|
+
console.error('β Error: Missing --keypair-bs58 or --keypair-file parameter');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const seller = options.keypairFile
|
|
29
|
+
? (0, utils_1.loadKeypairFromFile)(options.keypairFile)
|
|
30
|
+
: (0, utils_1.loadKeypairFromBase58)(options.keypairBs58);
|
|
31
|
+
const result = await (0, node_v2_1.sellToken)({
|
|
32
|
+
rpc: options.rpc,
|
|
33
|
+
mint: new web3_js_1.PublicKey(options.mint),
|
|
34
|
+
amount: parseFloat(options.amount),
|
|
35
|
+
slippage: parseFloat(options.slippage),
|
|
36
|
+
seller,
|
|
37
|
+
});
|
|
38
|
+
if (!result.success || !result.data) {
|
|
39
|
+
console.error('β Error: ', result.message);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
console.log('\nβ
Token Sale Successful!');
|
|
43
|
+
console.log('β'.repeat(50));
|
|
44
|
+
console.log(`Transaction Hash: ${result.data.txId}`);
|
|
45
|
+
console.log(`Mint Address: ${result.data.mintAddress.toBase58()}`);
|
|
46
|
+
console.log(`Tokens Sold: ${result.data.actualTokenAmount}`);
|
|
47
|
+
console.log(`SOL Received: ${result.data.actualSolAmount}`);
|
|
48
|
+
console.log(`Pool Address: ${result.data.poolAddress.toBase58()}`);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
console.error('β Error: ', error instanceof Error ? error.message : 'Unknown error');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=sell-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sell-token.js","sourceRoot":"","sources":["../../cli/src/raydium/sell-token.ts"],"names":[],"mappings":";;AAcA,4CAsDC;AApED,6CAA4C;AAC5C,oCAAsE;AACtE,mDAAkD;AAY3C,KAAK,UAAU,gBAAgB,CAAC,OAAyB;IAC9D,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAClD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACnD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;QACrD,OAAO;IACT,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,CAAC,QAAQ,GAAG,GAAG,CAAC;IACzB,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACjD,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAC7E,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,WAAW;YAChC,CAAC,CAAC,IAAA,2BAAmB,EAAC,OAAO,CAAC,WAAW,CAAC;YAC1C,CAAC,CAAC,IAAA,6BAAqB,EAAC,OAAO,CAAC,WAAY,CAAC,CAAC;QAEhD,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAS,EAAC;YAC7B,GAAG,EAAE,OAAO,CAAC,GAAI;YACjB,IAAI,EAAE,IAAI,mBAAS,CAAC,OAAO,CAA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object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refundCommand = refundCommand;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
7
|
+
async function refundCommand(options) {
|
|
8
|
+
try {
|
|
9
|
+
if (!options.rpc) {
|
|
10
|
+
console.error('β Error: Missing --rpc parameter');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (!options.mint) {
|
|
14
|
+
console.error('β Error: Missing --mint parameter');
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (!options.keypairBs58 && !options.keypairFile) {
|
|
18
|
+
console.error('β Error: Missing --keypair-bs58 or --keypair-file parameter');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const mintAccount = new web3_js_1.PublicKey(options.mint);
|
|
22
|
+
const owner = options.keypairFile
|
|
23
|
+
? (0, utils_1.loadKeypairFromFile)(options.keypairFile)
|
|
24
|
+
: (0, utils_1.loadKeypairFromBase58)(options.keypairBs58);
|
|
25
|
+
const result = await (0, node_v2_1.refundToken)({
|
|
26
|
+
rpc: options.rpc,
|
|
27
|
+
owner,
|
|
28
|
+
mint: mintAccount,
|
|
29
|
+
});
|
|
30
|
+
if (!result?.success || !result?.data) {
|
|
31
|
+
console.log("Owner: ", owner.publicKey.toBase58());
|
|
32
|
+
console.error('β Error: Mint operation failed', result?.message);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
console.log('Tokens refunded successfully!');
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log("=".repeat(40));
|
|
38
|
+
console.log(`Mint: ${mintAccount}`);
|
|
39
|
+
console.log(`Owner: ${owner.publicKey.toBase58()}`);
|
|
40
|
+
console.log(`Transaction Hash: ${result.data?.tx}`);
|
|
41
|
+
console.log('');
|
|
42
|
+
console.log(`Check your token balance by:\n> spl-token balance ${mintAccount} --owner ${owner.publicKey.toBase58()}`);
|
|
43
|
+
console.log("=".repeat(40));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error('β Error: Refund operation failed -', error);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=refund.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refund.js","sourceRoot":"","sources":["../cli/src/refund.ts"],"names":[],"mappings":";;AAWA,sCA+CC;AA1DD,6CAA4C;AAC5C,mCAAqE;AACrE,mDAAoD;AAS7C,KAAK,UAAU,aAAa,CAAC,OAAsB;IACxD,IAAI,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;YACjB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YACjD,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAC;YAC7E,OAAO;QACT,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,mBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW;YAC/B,CAAC,CAAC,IAAA,2BAAmB,EAAC,OAAO,CAAC,WAAW,CAAC;YAC1C,CAAC,CAAC,IAAA,6BAAqB,EAAC,OAAO,CAAC,WAAY,CAAC,CAAC;QAEhD,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAW,EAAC;YAC/B,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,KAAK;YACL,IAAI,EAAE,WAAW;SAClB,CAAC,CAAA;QAEF,IAAG,CAAC,MAAM,EAAE,OAAO,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;YACrC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnD,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,SAAS,WAAW,EAAE,CAAC,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,UAAU,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACnD,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,GAAG,CAAC,qDAAqD,WAAW,YAAY,KAAK,CAAC,SAAS,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACrH,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oCAAoC,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
|
package/dist/set-urc.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setUrcCommand = setUrcCommand;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const utils_1 = require("./utils");
|
|
6
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
7
|
+
async function setUrcCommand(options) {
|
|
8
|
+
// Validate required parameters
|
|
9
|
+
if (!options.keypairBs58 && !options.keypairFile) {
|
|
10
|
+
console.error('β Error: Missing --keypair-bs58 or --keypair-file parameter');
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
// Load keypair and create wallet (keypair-file takes priority)
|
|
15
|
+
const refAccount = options.keypairFile
|
|
16
|
+
? (0, utils_1.loadKeypairFromFile)(options.keypairFile)
|
|
17
|
+
: (0, utils_1.loadKeypairFromBase58)(options.keypairBs58);
|
|
18
|
+
const result = await (0, node_v2_1.setUrc)({
|
|
19
|
+
rpc: options.rpc,
|
|
20
|
+
urc: options.urc,
|
|
21
|
+
mint: new web3_js_1.PublicKey(options.mint),
|
|
22
|
+
refAccount,
|
|
23
|
+
});
|
|
24
|
+
if (!result.success || !result.data) {
|
|
25
|
+
console.error('β Error: ', result.message);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log('\nπ Referral Account Details');
|
|
29
|
+
console.log('β'.repeat(50));
|
|
30
|
+
console.log(`Referrer Address: ${refAccount.publicKey.toBase58()}`);
|
|
31
|
+
console.log(`Referrer Token Account: ${result.data.referrerTokenAccount.toBase58()}`);
|
|
32
|
+
console.log(`Code Hash: ${result.data.codeHash.toBase58()}`);
|
|
33
|
+
console.log(`Usage Count: ${result.data.usageCount}`);
|
|
34
|
+
const activationDate = new Date(result.data.activatedAt * 1000);
|
|
35
|
+
console.log(`Activated: ${activationDate.toLocaleString()}`);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error('β Error: ', error instanceof Error ? error.message : 'Unknown error');
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=set-urc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-urc.js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AAC,CAAC;QACtF,OAAO,CAAC,GAAG,CAAC,cAAc,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,gBAAgB,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACtD,MAAM,cAAc,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,cAAc,cAAc,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAC/D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.systemConfigCommand = systemConfigCommand;
|
|
4
|
+
const node_v2_1 = require("@flipflop-sdk/node-v2");
|
|
5
|
+
// Display mint command handler
|
|
6
|
+
async function systemConfigCommand(options) {
|
|
7
|
+
try {
|
|
8
|
+
const systemConfigAccountInfo = await (0, node_v2_1.getSystemConfig)({ rpc: options.rpc });
|
|
9
|
+
if (!systemConfigAccountInfo.success || !systemConfigAccountInfo.data) {
|
|
10
|
+
console.log(systemConfigAccountInfo.message);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
// Display formatted token information
|
|
14
|
+
console.log('\nπ Flipflop system configs:');
|
|
15
|
+
console.log('β'.repeat(50));
|
|
16
|
+
console.log(`π€ System Admin: ${systemConfigAccountInfo.data.admin.toBase58()}`);
|
|
17
|
+
console.log(`π System Config Account: ${systemConfigAccountInfo.data.systemConfigAccount.toBase58()}`);
|
|
18
|
+
console.log(`π Launch Rule Account: ${systemConfigAccountInfo.data.launchRuleAccount.toBase58()}`);
|
|
19
|
+
console.log(`π¦ Protocol Fee Account: ${systemConfigAccountInfo.data.protocolFeeAccount.toBase58()}`);
|
|
20
|
+
console.log(`π’ Token Count: ${systemConfigAccountInfo.data.count.toString()}`);
|
|
21
|
+
console.log(`π― Referral Usage Max Count: ${systemConfigAccountInfo.data.referralUsageMaxCount}`);
|
|
22
|
+
// console.log(`π° Protocol Fee Rate: ${(systemConfigAccountInfo.data.protocolFeeRate * 100).toFixed(2)}%`);
|
|
23
|
+
console.log(`πΈ Refund Fee Rate: ${(systemConfigAccountInfo.data.refundFeeRate * 100).toFixed(2)}%`);
|
|
24
|
+
console.log(`β° Referrer Reset Interval: ${systemConfigAccountInfo.data.referrerResetIntervalSeconds.toString()} seconds`);
|
|
25
|
+
console.log(`π·οΈ Update Metadata Fee: ${(systemConfigAccountInfo.data.updateMetadataFee).toFixed(2)} SOL`);
|
|
26
|
+
console.log(`π Customized Deploy Fee: ${(systemConfigAccountInfo.data.customizedDeployFee).toFixed(2)} SOL`);
|
|
27
|
+
console.log(`π§ Init Pool WSOL Percent: ${(systemConfigAccountInfo.data.initPoolBaseAmount * 100).toFixed(2)}%`);
|
|
28
|
+
console.log(`π Graduate Fee Rate: ${(systemConfigAccountInfo.data.graduateFeeRate).toFixed(2)}%`);
|
|
29
|
+
console.log(`π Min Graduate Fee: ${(systemConfigAccountInfo.data.minGraduateFee).toFixed(2)} SOL`);
|
|
30
|
+
console.log(`π Raydium CPMM Create Fee: ${(systemConfigAccountInfo.data.raydiumCpmmCreateFee).toFixed(2)} SOL`);
|
|
31
|
+
// console.log(`π Transfer Fee Basis Points: ${systemConfigAccountInfo.transferFeeBasisPoints}`);
|
|
32
|
+
console.log(`βΈοΈ Is Paused: ${systemConfigAccountInfo.data.isPause ? 'β
Yes' : 'β No'}`);
|
|
33
|
+
console.log('β'.repeat(50));
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error('β Error displaying system config information:', error instanceof Error ? error.message : 'Unknown error');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=system-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-config.js","sourceRoot":"","sources":["../cli/src/system-config.ts"],"names":[],"mappings":";;AAOA,kDAgCC;AAvCD,mDAAwD;AAMxD,+BAA+B;AACxB,KAAK,UAAU,mBAAmB,CAAC,OAA4B;IACpE,IAAI,CAAC;QACH,MAAM,uBAAuB,GAAG,MAAM,IAAA,yBAAe,EAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5E,IAAI,CAAC,uBAAuB,CAAC,OAAO,IAAI,CAAC,uBAAuB,CAAC,IAAI,EAAE,CAAC;YACtE,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;YAC7C,OAAO;QACT,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC9F,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,CAAC,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC5G,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC1G,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;QAC3G,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,C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C;QACnH,kGAAkG;QAClG,OAAO,CAAC,GAAG,CAAC,iCAAiC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACxG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;IAC3H,CAAC;AACH,CAAC"}
|
package/dist/utils.d.ts
ADDED
package/dist/utils.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
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.loadKeypairFromBase58 = exports.loadKeypairFromFile = void 0;
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
10
|
+
// Load keypair from file (supports .pri or JSON format)
|
|
11
|
+
const loadKeypairFromFile = (filePath) => {
|
|
12
|
+
try {
|
|
13
|
+
const fileContent = fs_1.default.readFileSync(filePath, 'utf8');
|
|
14
|
+
const secretKeyArray = JSON.parse(fileContent);
|
|
15
|
+
if (!Array.isArray(secretKeyArray)) {
|
|
16
|
+
throw new Error('Private key file must contain an array of numbers');
|
|
17
|
+
}
|
|
18
|
+
if (secretKeyArray.length !== 64) {
|
|
19
|
+
throw new Error('Private key array must contain exactly 64 numbers');
|
|
20
|
+
}
|
|
21
|
+
const secretKey = new Uint8Array(secretKeyArray);
|
|
22
|
+
return web3_js_1.Keypair.fromSecretKey(secretKey);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
throw new Error(`Failed to load keypair from file ${filePath}: ${error.message}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.loadKeypairFromFile = loadKeypairFromFile;
|
|
29
|
+
// Utility to load single keypair from base58 string
|
|
30
|
+
const loadKeypairFromBase58 = (base58Key) => {
|
|
31
|
+
const secretKey = bs58_1.default.decode(base58Key.trim());
|
|
32
|
+
return web3_js_1.Keypair.fromSecretKey(secretKey);
|
|
33
|
+
};
|
|
34
|
+
exports.loadKeypairFromBase58 = loadKeypairFromBase58;
|
|
35
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../cli/src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,6CAA0C;AAC1C,4CAAoB;AACpB,gDAAwB;AAExB,wDAAwD;AACjD,MAAM,mBAAmB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAC/D,IAAI,CAAC;QACH,MAAM,WAAW,GAAG,YAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACtD,MAAM,cAAc,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;QAE/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,IAAI,cAAc,CAAC,MAAM,KAAK,EAAE,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,CAAC;QAED,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,cAAc,CAAC,CAAC;QACjD,OAAO,iBAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IACpF,CAAC;AACH,CAAC,CAAC;AAlBW,QAAA,mBAAmB,uBAkB9B;AAEF,oDAAoD;AAC7C,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAW,EAAE;IAClE,MAAM,SAAS,GAAG,cAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC;IAChD,OAAO,iBAAO,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC,CAAA;AAHY,QAAA,qBAAqB,yBAGjC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flipflop-sdk/cli-v2",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "FlipFlop CLI v2 tool for common operations",
|
|
5
|
+
"main": "dist/cli.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"flipflop": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/**/*",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
|
|
15
|
+
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
|
|
16
|
+
"build": "rm -rf dist && tsc",
|
|
17
|
+
"prepublishOnly": "yarn build",
|
|
18
|
+
"install-global": "npm link"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"solana",
|
|
22
|
+
"flipflop",
|
|
23
|
+
"cli",
|
|
24
|
+
"defi",
|
|
25
|
+
"token"
|
|
26
|
+
],
|
|
27
|
+
"author": "FlipFlop",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/flipflop-fun/sdk.git"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@coral-xyz/anchor": "0.31.1",
|
|
35
|
+
"@flipflop-sdk/node-v2": "^1.0.0",
|
|
36
|
+
"@solana/spl-token": "^0.4.9",
|
|
37
|
+
"@solana/spl-token-metadata": "^0.1.6",
|
|
38
|
+
"@solana/web3.js": "^1.98.0",
|
|
39
|
+
"bn.js": "5.2.1",
|
|
40
|
+
"bs58": "^6.0.0",
|
|
41
|
+
"commander": "^14.0.0",
|
|
42
|
+
"decimal.js": "^10.4.3",
|
|
43
|
+
"punycode": "^2.3.1"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@types/big.js": "^6.2.2",
|
|
47
|
+
"@types/bn.js": "5.1.1",
|
|
48
|
+
"@types/chai": "^4.3.0",
|
|
49
|
+
"@types/mocha": "^9.0.0",
|
|
50
|
+
"chai": "^4.3.4",
|
|
51
|
+
"mocha": "^9.0.3",
|
|
52
|
+
"prettier": "^2.6.2",
|
|
53
|
+
"ts-mocha": "^10.0.0",
|
|
54
|
+
"typescript": "^5.9.2"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": ">=16.0.0"
|
|
58
|
+
}
|
|
59
|
+
}
|