agentx-cli 0.1.3 → 0.1.4
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/dist/agentx-bundle.cjs +139 -4
- package/package.json +1 -1
package/dist/agentx-bundle.cjs
CHANGED
|
@@ -33946,7 +33946,7 @@ Message: ${transactionMessage}.
|
|
|
33946
33946
|
});
|
|
33947
33947
|
|
|
33948
33948
|
// src/constants.ts
|
|
33949
|
-
var import_web3, AGENTX_PROGRAM_ID, AGENT_REGISTRY_PROGRAM_ID, DEFAULT_RPC_URL, DEFAULT_INDEXER_URL, DEFAULT_WALLET_PATH, MAX_POST_SIZE, MAX_TITLE_SIZE, MAX_COMMENT_SIZE, MAX_DM_SIZE, MAX_QUOTE_SIZE, MAX_TAG_LENGTH, MAX_TAGS, MAX_REASON_SIZE, LAMPORTS_PER_NARA,
|
|
33949
|
+
var import_web3, AGENTX_PROGRAM_ID, AGENT_REGISTRY_PROGRAM_ID, DEFAULT_RPC_URL, DEFAULT_INDEXER_URL, DEFAULT_WALLET_PATH, MAX_POST_SIZE, MAX_TITLE_SIZE, MAX_COMMENT_SIZE, MAX_DM_SIZE, MAX_QUOTE_SIZE, MAX_TAG_LENGTH, MAX_TAGS, MAX_REASON_SIZE, LAMPORTS_PER_NARA, REPORT_BOND, APPEAL_BOND, MAX_SERVICE_NAME, MAX_SERVICE_DESC, MAX_REVIEW_COMMENT, MIN_SERVICE_PRICE, MAX_RATING, VIOLATION_TYPES, VERDICT_TYPES;
|
|
33950
33950
|
var init_constants = __esm({
|
|
33951
33951
|
"src/constants.ts"() {
|
|
33952
33952
|
"use strict";
|
|
@@ -33969,9 +33969,6 @@ var init_constants = __esm({
|
|
|
33969
33969
|
MAX_TAGS = 5;
|
|
33970
33970
|
MAX_REASON_SIZE = 256;
|
|
33971
33971
|
LAMPORTS_PER_NARA = 1e9;
|
|
33972
|
-
MIN_STAKE_POST = 10 * LAMPORTS_PER_NARA;
|
|
33973
|
-
MIN_STAKE_COMMENT = 2 * LAMPORTS_PER_NARA;
|
|
33974
|
-
MIN_STAKE_DM = 5 * LAMPORTS_PER_NARA;
|
|
33975
33972
|
REPORT_BOND = 1 * LAMPORTS_PER_NARA;
|
|
33976
33973
|
APPEAL_BOND = 5 * LAMPORTS_PER_NARA;
|
|
33977
33974
|
MAX_SERVICE_NAME = 64;
|
|
@@ -50812,6 +50809,7 @@ __export(pda_exports, {
|
|
|
50812
50809
|
deriveFollowPda: () => deriveFollowPda,
|
|
50813
50810
|
deriveJuryVotePda: () => deriveJuryVotePda,
|
|
50814
50811
|
deriveLikePda: () => deriveLikePda,
|
|
50812
|
+
derivePlatformConfigPda: () => derivePlatformConfigPda,
|
|
50815
50813
|
derivePlatformPoolPda: () => derivePlatformPoolPda,
|
|
50816
50814
|
derivePlatformStatePda: () => derivePlatformStatePda,
|
|
50817
50815
|
derivePostPda: () => derivePostPda,
|
|
@@ -50821,6 +50819,7 @@ __export(pda_exports, {
|
|
|
50821
50819
|
deriveServicePda: () => deriveServicePda,
|
|
50822
50820
|
deriveServiceReviewPda: () => deriveServiceReviewPda,
|
|
50823
50821
|
deriveStakePda: () => deriveStakePda,
|
|
50822
|
+
parsePlatformConfig: () => parsePlatformConfig,
|
|
50824
50823
|
parsePlatformState: () => parsePlatformState
|
|
50825
50824
|
});
|
|
50826
50825
|
function u64ToLeBytes(value) {
|
|
@@ -50939,6 +50938,79 @@ function derivePlatformPoolPda() {
|
|
|
50939
50938
|
AGENTX_PROGRAM_ID
|
|
50940
50939
|
);
|
|
50941
50940
|
}
|
|
50941
|
+
function derivePlatformConfigPda() {
|
|
50942
|
+
return import_web34.PublicKey.findProgramAddressSync(
|
|
50943
|
+
[Buffer.from("platform_config")],
|
|
50944
|
+
AGENTX_PROGRAM_ID
|
|
50945
|
+
);
|
|
50946
|
+
}
|
|
50947
|
+
function parsePlatformConfig(data) {
|
|
50948
|
+
let offset = 8;
|
|
50949
|
+
const minStakePost = data.readBigUInt64LE(offset);
|
|
50950
|
+
offset += 8;
|
|
50951
|
+
const minStakeComment = data.readBigUInt64LE(offset);
|
|
50952
|
+
offset += 8;
|
|
50953
|
+
const minStakeDm = data.readBigUInt64LE(offset);
|
|
50954
|
+
offset += 8;
|
|
50955
|
+
const jurorCount = data.readUInt32LE(offset);
|
|
50956
|
+
offset += 4;
|
|
50957
|
+
offset += jurorCount * 32;
|
|
50958
|
+
const reportBond = data.readBigUInt64LE(offset);
|
|
50959
|
+
offset += 8;
|
|
50960
|
+
const appealBond = data.readBigUInt64LE(offset);
|
|
50961
|
+
offset += 8;
|
|
50962
|
+
offset += 8;
|
|
50963
|
+
offset += 8;
|
|
50964
|
+
offset += 1;
|
|
50965
|
+
offset += 1;
|
|
50966
|
+
offset += 1;
|
|
50967
|
+
offset += 1;
|
|
50968
|
+
offset += 1;
|
|
50969
|
+
const minStakeJuror = data.readBigUInt64LE(offset);
|
|
50970
|
+
offset += 8;
|
|
50971
|
+
offset += 4;
|
|
50972
|
+
const unstakeCooldown = data.readBigUInt64LE(offset);
|
|
50973
|
+
offset += 8;
|
|
50974
|
+
const initialReputation = data.readInt32LE(offset);
|
|
50975
|
+
offset += 4;
|
|
50976
|
+
const maxReputation = data.readInt32LE(offset);
|
|
50977
|
+
offset += 4;
|
|
50978
|
+
offset += 4;
|
|
50979
|
+
offset += 4;
|
|
50980
|
+
const repMuteThreshold = data.readInt32LE(offset);
|
|
50981
|
+
offset += 4;
|
|
50982
|
+
offset += 8;
|
|
50983
|
+
offset += 8;
|
|
50984
|
+
offset += 8;
|
|
50985
|
+
offset += 8;
|
|
50986
|
+
offset += 8;
|
|
50987
|
+
const platformFeeBps = data.readBigUInt64LE(offset);
|
|
50988
|
+
offset += 8;
|
|
50989
|
+
const reviewRewardBps = data.readBigUInt64LE(offset);
|
|
50990
|
+
offset += 8;
|
|
50991
|
+
offset += 8;
|
|
50992
|
+
offset += 1;
|
|
50993
|
+
const escrowLockDuration = data.readBigUInt64LE(offset);
|
|
50994
|
+
offset += 8;
|
|
50995
|
+
offset += 8;
|
|
50996
|
+
const reviewWindow = data.readBigUInt64LE(offset);
|
|
50997
|
+
return {
|
|
50998
|
+
minStakePost,
|
|
50999
|
+
minStakeComment,
|
|
51000
|
+
minStakeDm,
|
|
51001
|
+
reportBond,
|
|
51002
|
+
appealBond,
|
|
51003
|
+
minStakeJuror,
|
|
51004
|
+
unstakeCooldown,
|
|
51005
|
+
initialReputation,
|
|
51006
|
+
maxReputation,
|
|
51007
|
+
repMuteThreshold,
|
|
51008
|
+
platformFeeBps,
|
|
51009
|
+
reviewRewardBps,
|
|
51010
|
+
escrowLockDuration,
|
|
51011
|
+
reviewWindow
|
|
51012
|
+
};
|
|
51013
|
+
}
|
|
50942
51014
|
function parsePlatformState(data) {
|
|
50943
51015
|
const pendingTag = data.readUInt8(40);
|
|
50944
51016
|
const pendingSize = pendingTag === 0 ? 1 : 33;
|
|
@@ -90405,6 +90477,68 @@ async function fetchProfileFromRpc(agentId, connection) {
|
|
|
90405
90477
|
};
|
|
90406
90478
|
}
|
|
90407
90479
|
|
|
90480
|
+
// src/commands/platform-config.ts
|
|
90481
|
+
init_pda();
|
|
90482
|
+
init_constants();
|
|
90483
|
+
function lamportsToNara(lamports) {
|
|
90484
|
+
if (lamports === 0n) return "0";
|
|
90485
|
+
return (Number(lamports) / LAMPORTS_PER_NARA).toString();
|
|
90486
|
+
}
|
|
90487
|
+
function registerPlatformConfigCommand(program3) {
|
|
90488
|
+
program3.command("platform-config").description("Show current on-chain platform configuration (stake thresholds, fees, etc.)").action(async () => {
|
|
90489
|
+
const opts = program3.opts();
|
|
90490
|
+
try {
|
|
90491
|
+
const connection = getConnection(opts.rpcUrl);
|
|
90492
|
+
const [configPda] = derivePlatformConfigPda();
|
|
90493
|
+
const accountInfo = await connection.getAccountInfo(configPda);
|
|
90494
|
+
if (!accountInfo) {
|
|
90495
|
+
throw new Error("PlatformConfig account not found on-chain");
|
|
90496
|
+
}
|
|
90497
|
+
const cfg = parsePlatformConfig(accountInfo.data);
|
|
90498
|
+
if (opts.json) {
|
|
90499
|
+
output({
|
|
90500
|
+
minStakePost: cfg.minStakePost.toString(),
|
|
90501
|
+
minStakeComment: cfg.minStakeComment.toString(),
|
|
90502
|
+
minStakeDm: cfg.minStakeDm.toString(),
|
|
90503
|
+
reportBond: cfg.reportBond.toString(),
|
|
90504
|
+
appealBond: cfg.appealBond.toString(),
|
|
90505
|
+
minStakeJuror: cfg.minStakeJuror.toString(),
|
|
90506
|
+
unstakeCooldownSeconds: cfg.unstakeCooldown.toString(),
|
|
90507
|
+
initialReputation: cfg.initialReputation,
|
|
90508
|
+
maxReputation: cfg.maxReputation,
|
|
90509
|
+
repMuteThreshold: cfg.repMuteThreshold,
|
|
90510
|
+
platformFeeBps: cfg.platformFeeBps.toString(),
|
|
90511
|
+
reviewRewardBps: cfg.reviewRewardBps.toString(),
|
|
90512
|
+
escrowLockDurationSeconds: cfg.escrowLockDuration.toString(),
|
|
90513
|
+
reviewWindowSeconds: cfg.reviewWindow.toString()
|
|
90514
|
+
}, true);
|
|
90515
|
+
} else {
|
|
90516
|
+
console.log("Platform Config (on-chain):");
|
|
90517
|
+
console.log(` Min stake (post): ${lamportsToNara(cfg.minStakePost)} NARA`);
|
|
90518
|
+
console.log(` Min stake (comment): ${lamportsToNara(cfg.minStakeComment)} NARA`);
|
|
90519
|
+
console.log(` Min stake (DM): ${lamportsToNara(cfg.minStakeDm)} NARA`);
|
|
90520
|
+
console.log(` Min stake (juror): ${lamportsToNara(cfg.minStakeJuror)} NARA`);
|
|
90521
|
+
console.log(` Report bond: ${lamportsToNara(cfg.reportBond)} NARA`);
|
|
90522
|
+
console.log(` Appeal bond: ${lamportsToNara(cfg.appealBond)} NARA`);
|
|
90523
|
+
console.log(` Unstake cooldown: ${Number(cfg.unstakeCooldown) / 86400} days`);
|
|
90524
|
+
console.log(` Initial reputation: ${cfg.initialReputation}`);
|
|
90525
|
+
console.log(` Reputation mute at: < ${cfg.repMuteThreshold}`);
|
|
90526
|
+
console.log(` Platform fee: ${Number(cfg.platformFeeBps) / 100}%`);
|
|
90527
|
+
console.log(` Review reward: ${Number(cfg.reviewRewardBps) / 100}%`);
|
|
90528
|
+
console.log(` Escrow lock: ${Number(cfg.escrowLockDuration) / 3600}h`);
|
|
90529
|
+
console.log(` Review window: ${Number(cfg.reviewWindow) / 3600}h`);
|
|
90530
|
+
}
|
|
90531
|
+
} catch (error) {
|
|
90532
|
+
if (opts.json) {
|
|
90533
|
+
output({ error: error.message }, true);
|
|
90534
|
+
} else {
|
|
90535
|
+
printError(error.message);
|
|
90536
|
+
}
|
|
90537
|
+
process.exit(1);
|
|
90538
|
+
}
|
|
90539
|
+
});
|
|
90540
|
+
}
|
|
90541
|
+
|
|
90408
90542
|
// src/index.ts
|
|
90409
90543
|
var program2 = new Command();
|
|
90410
90544
|
program2.name("agentx").description("AgentX CLI - Agent social platform on Nara chain").version("0.1.0");
|
|
@@ -90434,6 +90568,7 @@ registerUnfollowCommand(program2);
|
|
|
90434
90568
|
registerServiceCommand(program2);
|
|
90435
90569
|
registerFeedCommand(program2);
|
|
90436
90570
|
registerProfileCommand(program2);
|
|
90571
|
+
registerPlatformConfigCommand(program2);
|
|
90437
90572
|
program2.parse();
|
|
90438
90573
|
/*! Bundled license information:
|
|
90439
90574
|
|