blumefi 2.3.0 → 2.4.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/cli.js +56 -4
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -346,10 +346,25 @@ async function cmdChatMentions(address) {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
async function cmdChatProfile(name) {
|
|
349
|
-
if (!name) {
|
|
349
|
+
if (!name) {
|
|
350
|
+
console.error('Usage: blumefi chat profile <name> [--bio "your bio"] [--avatar <url>]')
|
|
351
|
+
console.error(' blumefi chat profile "MyAgent" --bio "I trade on XRPL EVM"')
|
|
352
|
+
console.error(' blumefi chat profile "MyAgent" --avatar https://example.com/pic.png')
|
|
353
|
+
console.error(' blumefi chat profile "MyAgent" --bio "Bio" --avatar https://arweave.net/TXID')
|
|
354
|
+
process.exit(1)
|
|
355
|
+
}
|
|
350
356
|
const bioIdx = process.argv.indexOf('--bio')
|
|
351
357
|
const bio = bioIdx !== -1 ? process.argv[bioIdx + 1] || '' : ''
|
|
352
|
-
const
|
|
358
|
+
const avatarIdx = process.argv.indexOf('--avatar')
|
|
359
|
+
const avatarUrl = avatarIdx !== -1 ? process.argv[avatarIdx + 1] || '' : ''
|
|
360
|
+
if (avatarUrl && !avatarUrl.startsWith('https://')) {
|
|
361
|
+
console.error('Error: --avatar must be an HTTPS URL')
|
|
362
|
+
process.exit(1)
|
|
363
|
+
}
|
|
364
|
+
const meta = { platform: 'blumefi-cli' }
|
|
365
|
+
if (bio) meta.bio = bio
|
|
366
|
+
if (avatarUrl) meta.avatarUrl = avatarUrl
|
|
367
|
+
const metadata = JSON.stringify(meta)
|
|
353
368
|
const chain = getChain()
|
|
354
369
|
console.log(`Setting profile on ${chain}...`)
|
|
355
370
|
const { address, explorer } = await sendContractTx({
|
|
@@ -358,6 +373,7 @@ async function cmdChatProfile(name) {
|
|
|
358
373
|
console.log(`\n Profile set for ${address}`)
|
|
359
374
|
console.log(` Name: ${name}`)
|
|
360
375
|
if (bio) console.log(` Bio: ${bio}`)
|
|
376
|
+
if (avatarUrl) console.log(` Avatar: ${avatarUrl}`)
|
|
361
377
|
console.log(` TX: ${explorer}`)
|
|
362
378
|
}
|
|
363
379
|
|
|
@@ -1042,6 +1058,40 @@ async function cmdPadTokens() {
|
|
|
1042
1058
|
}
|
|
1043
1059
|
}
|
|
1044
1060
|
|
|
1061
|
+
async function cmdPadUpdateImage(tokenAddress, imageUrl) {
|
|
1062
|
+
if (!tokenAddress || !imageUrl) {
|
|
1063
|
+
console.error('Usage: blumefi pad update-image <token_address> <image_url>')
|
|
1064
|
+
console.error(' blumefi pad update-image 0x1234... https://arweave.net/TXID')
|
|
1065
|
+
console.error(' blumefi pad update-image 0x1234... https://example.com/img.png')
|
|
1066
|
+
console.error('\nOnly the token creator can update the image.')
|
|
1067
|
+
process.exit(1)
|
|
1068
|
+
}
|
|
1069
|
+
if (!imageUrl.startsWith('https://')) {
|
|
1070
|
+
console.error('Error: Image URL must start with https://')
|
|
1071
|
+
process.exit(1)
|
|
1072
|
+
}
|
|
1073
|
+
const viem = await loadViem()
|
|
1074
|
+
const key = getPrivateKey()
|
|
1075
|
+
const account = viem.privateKeyToAccount(key)
|
|
1076
|
+
const message = `Update socials for ${tokenAddress} at ${Date.now()}`
|
|
1077
|
+
const signature = await account.signMessage({ message })
|
|
1078
|
+
console.log(`Updating token image...`)
|
|
1079
|
+
const res = await fetch(`${API}/pad/tokens/${tokenAddress}/socials`, {
|
|
1080
|
+
method: 'PUT',
|
|
1081
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1082
|
+
body: JSON.stringify({ imageURI: imageUrl, signature, message, address: account.address }),
|
|
1083
|
+
})
|
|
1084
|
+
const data = await res.json()
|
|
1085
|
+
if (!res.ok) {
|
|
1086
|
+
console.error(`\n Error: ${data.error || `API error ${res.status}`}`)
|
|
1087
|
+
process.exit(1)
|
|
1088
|
+
}
|
|
1089
|
+
console.log(`\n Token image updated!`)
|
|
1090
|
+
console.log(` Token: ${tokenAddress}`)
|
|
1091
|
+
console.log(` Image: ${imageUrl}`)
|
|
1092
|
+
console.log(` Creator: ${account.address}`)
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1045
1095
|
// ─── Balance command ─────────────────────────────────────────────────
|
|
1046
1096
|
|
|
1047
1097
|
async function cmdBalance(address) {
|
|
@@ -1201,7 +1251,7 @@ Chat:
|
|
|
1201
1251
|
chat post "<message>" Post a new message
|
|
1202
1252
|
chat reply <id> "<message>" Reply to a message
|
|
1203
1253
|
chat mentions [address] Check replies to your posts
|
|
1204
|
-
chat profile <name> [
|
|
1254
|
+
chat profile <name> [options] Set your display name and avatar
|
|
1205
1255
|
|
|
1206
1256
|
Pad (Launchpad):
|
|
1207
1257
|
pad launch <name> <symbol> [desc] Launch a token on bonding curve
|
|
@@ -1210,6 +1260,7 @@ Pad (Launchpad):
|
|
|
1210
1260
|
pad info <token> View token info and progress
|
|
1211
1261
|
pad search <query> Search tokens by name or symbol
|
|
1212
1262
|
pad tokens List recent tokens
|
|
1263
|
+
pad update-image <token> <url> Update token image (creator only)
|
|
1213
1264
|
|
|
1214
1265
|
Swap (DEX):
|
|
1215
1266
|
swap <amount> <from> <to> Swap tokens (e.g. swap 1 XRP RLUSD)
|
|
@@ -1266,7 +1317,8 @@ async function main() {
|
|
|
1266
1317
|
else if (sub === 'info' || sub === 'i') await cmdPadInfo(args[2])
|
|
1267
1318
|
else if (sub === 'search' || sub === 'find') await cmdPadSearch(args[2])
|
|
1268
1319
|
else if (sub === 'tokens' || sub === 'list') await cmdPadTokens()
|
|
1269
|
-
else
|
|
1320
|
+
else if (sub === 'update-image') await cmdPadUpdateImage(args[2], args[3])
|
|
1321
|
+
else { console.error(`Unknown: pad ${sub}. Try: launch, buy, sell, info, tokens, update-image`); process.exit(1) }
|
|
1270
1322
|
} else if (cmd === 'swap') {
|
|
1271
1323
|
if (sub === 'quote' || sub === 'q') await cmdSwapQuote(args[2], args[3], args[4])
|
|
1272
1324
|
else if (sub === 'pools' || sub === 'p') await cmdSwapPools()
|
package/package.json
CHANGED