Skip to content

Commit

Permalink
refactor: simplify prediction list and bet preparation messages
Browse files Browse the repository at this point in the history
- Remove example text from list predictions and bet preparation responses
- Streamline message formatting for better readability
- Rename `betText` to `betFooter` in list predictions action
- Reduce verbosity in prepareBet response message
  • Loading branch information
nicky-ru committed Feb 1, 2025
1 parent 9339091 commit 8edade6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
12 changes: 6 additions & 6 deletions packages/plugin-depin/src/actions/listPredictions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@ export const listPredictions: Action = {

// Format predictions into a numbered list
const formattedPredictions = predictions
.map((pred) => `ID: ${pred.smartcontract_id}. ${formatPrediction(pred)}`)
.map(
(pred) =>
`ID: ${pred.smartcontract_id}. ${formatPrediction(pred)}`
)
.join("\n");

const betText = `
const betFooter = `
You can bet on them by saying
"PREPARE A BET FOR PREDICTION <number>, <amount> $SENTAI, <outcome>, <your_wallet_address>"
Example:
"PREPARE A BET FOR PREDICTION 1, 100 $SENTAI, true, 0x732d35Cc6634C0532915a3b844Bc454e4438f43e"
`;

if (callback) {
callback({
text: `🎯 Here are the active predictions:\n${formattedPredictions}\n\n${betText}`,
text: `🎯 Here are the active predictions:\n${formattedPredictions}\n\n${betFooter}`,
inReplyTo: message.id,
});
}
Expand Down
7 changes: 2 additions & 5 deletions packages/plugin-depin/src/actions/prepareBet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,23 +120,20 @@ async function extractBetParamsFromContext(

const prepareBetResponse = (approvalTxData: ApprovalParams) =>
`
🎲 Confirm your bet:
🎲
BetID: ${Math.floor(Math.random() * 900) + 100},
PredictionId: ${approvalTxData.predictionId},
Bettor: ${approvalTxData.address},
Amount: ${approvalTxData.amount} $SENTAI,
Outcome: ${approvalTxData.outcome}
Please make a transfer with your wallet to $SENTAI contract:
Please approve $SENTAI tokens to the prediction market smart contract:
💰 ${process.env.PREDICTION_TOKEN}
With the hex data:
🔐 ${approvalTxData.txData}
After approval, send the tx hash like this: "BET <bet_id> APPROVED: <tx_hash>"
Example:
"BET 123 APPROVED: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
`;

const prepareBetTemplate = (message: string) => `
Expand Down

0 comments on commit 8edade6

Please sign in to comment.