-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Description
Overview
-
Set Up Environment
- Install necessary packages.
- Configure Starknet provider and account.
-
Monitor LinkedIn Posts
- Use LinkedIn's API or a third-party service to detect specific posts.
- Ensure compliance with LinkedIn's terms of service.
-
Parse Commands
- Extract parameters from the LinkedIn post.
- Validate the inputs.
-
Interact with Unruggable SDK
- Use the SDK to create and launch the memecoin.
- Handle transactions and responses.
-
Respond on LinkedIn
- Post a reply with the transaction details.
- Handle errors gracefully.
Step 1: Set Up Environment
Install Packages
npm install unruggable-sdk starknet
# or
yarn add unruggable-sdk starknetConfigure Starknet Provider and Account
const { createMemecoin, launchOnEkubo } = require('unruggable-sdk');
const { Provider, Account, ec, stark } = require('starknet');
// Starknet configuration
const provider = new Provider({ sequencer: { network: 'mainnet-alpha' } });
const keyPair = ec.getKeyPair('YOUR_PRIVATE_KEY');
const account = new Account(provider, 'YOUR_ACCOUNT_ADDRESS', keyPair);
// Unruggable SDK configuration
const config = {
starknetProvider: provider,
starknetChainId: 'SN_MAIN',
};Security Note: Replace 'YOUR_PRIVATE_KEY' and 'YOUR_ACCOUNT_ADDRESS' with your actual private key and account address. Ensure your private key is securely stored and not exposed in your codebase.
Step 2: Monitor LinkedIn Posts
LinkedIn API Considerations
- LinkedIn's API has strict access controls. You'll need to apply for access to the Marketing Developer Platform.
- Alternatively, consider using a webhook or third-party service to monitor mentions.
Monitoring Mentions
Set up a service that checks for new posts mentioning @UnruggableMeme and containing the launch command.
Step 3: Parse Commands
Extract Parameters from the Post
function parseCommand(postText) {
const regex = /@UnruggableMeme launch (\S+) (\S+) (0x[a-fA-F0-9]{64}) (\d+)/;
const match = postText.match(regex);
if (!match) {
throw new Error('Invalid command format.');
}
const [, name, symbol, ownerAddress, initialSupply] = match;
return { name, symbol, ownerAddress, initialSupply };
}Validate Inputs
- Ensure
ownerAddressis a valid Starknet address. initialSupplyshould be a positive integer.
Step 4: Interact with Unruggable SDK
Create the Memecoin
async function createMemecoinToken({ name, symbol, ownerAddress, initialSupply }) {
const createResult = await createMemecoin(config, {
name,
symbol,
initialSupply,
owner: ownerAddress,
starknetAccount: account,
});
return createResult;
}Launch on Ekubo (Optional)
async function launchTokenOnEkubo(memecoinAddress) {
const launchResult = await launchOnEkubo(config, {
memecoinAddress,
currencyAddress: '0x...', // Replace with the actual currency address
startingMarketCap: '1000000',
fees: '3.5',
holdLimit: '2.5',
antiBotPeriodInSecs: 300,
starknetAccount: account,
});
return launchResult;
}Full Process Function
async function processLaunchCommand(postText) {
try {
const { name, symbol, ownerAddress, initialSupply } = parseCommand(postText);
// Create memecoin
const createResult = await createMemecoinToken({
name,
symbol,
ownerAddress,
initialSupply,
});
console.log('Memecoin Created:', createResult);
// Optionally launch on Ekubo
const launchResult = await launchTokenOnEkubo(createResult.tokenAddress);
console.log('Token Launched on Ekubo:', launchResult);
return { createResult, launchResult };
} catch (error) {
console.error('Error processing command:', error.message);
throw error;
}
}Step 5: Respond on LinkedIn
Post a Reply with Transaction Details
function generateReply(createResult, launchResult) {
return `
✅ Memecoin Created!
- **Token Address**: ${createResult.tokenAddress}
- **Creation Tx Hash**: ${createResult.transactionHash}
- **Launch Tx Hash**: ${launchResult.transactionHash}
Thank you for using Unruggable Meme!
`;
}
// Use LinkedIn's API to post the replyError Handling
- If an error occurs, reply with a friendly message explaining the issue.
- Do not expose sensitive information in error messages.
Additional Considerations
LinkedIn API Compliance
- Ensure you comply with LinkedIn's [User Agreement](https://www.linkedin.com/legal/user-agreement) and [Developer Terms](https://www.linkedin.com/legal/developer-agreement).
- Avoid actions that may be considered scraping or automation without explicit permission.
Security Best Practices
- Private Keys: Store private keys in environment variables or secure vaults.
- Input Sanitization: Always sanitize and validate user inputs.
- Error Logging: Log errors securely without exposing sensitive data.
Testing
- Testnet Usage: Before deploying on the mainnet, test your bot using Starknet's testnet.
- Dry Runs: Perform dry runs to ensure all parts of the bot work as expected.
Deployment
- Host your bot on a reliable platform (e.g., AWS, Heroku).
- Set up monitoring and logging to keep track of the bot's activity.
Example Usage
(async () => {
const postText = '@UnruggableMeme launch MyMemeCoin MMC 0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef 1000000';
try {
const { createResult, launchResult } = await processLaunchCommand(postText);
const replyMessage = generateReply(createResult, launchResult);
// Post replyMessage as a comment on the LinkedIn post
console.log('Reply Message:', replyMessage);
} catch (error) {
// Handle error (e.g., post an error message back to LinkedIn)
console.error('Failed to process command:', error.message);
}
})();Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels