@moltium/world-core 0.1.22 → 0.1.23

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/index.d.cts CHANGED
@@ -1157,6 +1157,82 @@ declare const logger: winston.Logger;
1157
1157
  */
1158
1158
  declare function createLogger(moduleName: string): winston.Logger;
1159
1159
 
1160
+ /**
1161
+ * ============================================================================
1162
+ * BLOCKCHAIN CLIENT
1163
+ * ============================================================================
1164
+ *
1165
+ * Handles all blockchain interactions for the World SDK:
1166
+ * - Agent registry validation
1167
+ * - Membership NFT minting
1168
+ * - Entry fee collection
1169
+ * - World token operations
1170
+ */
1171
+ declare class BlockchainClient {
1172
+ private config;
1173
+ private provider;
1174
+ private wallet;
1175
+ private agentRegistry?;
1176
+ private membershipContract?;
1177
+ private worldToken?;
1178
+ constructor(config: BlockchainConfig);
1179
+ /**
1180
+ * Initialize contract connections
1181
+ */
1182
+ init(): Promise<void>;
1183
+ /**
1184
+ * Validate agent on-chain
1185
+ * @param walletAddress Agent's wallet address
1186
+ * @returns True if agent is registered and valid
1187
+ */
1188
+ validateAgent(walletAddress: string): Promise<boolean>;
1189
+ /**
1190
+ * Mint membership NFT for an agent
1191
+ * @param agentWallet Agent's wallet address
1192
+ * @returns Transaction hash
1193
+ */
1194
+ mintMembership(agentWallet: string): Promise<string>;
1195
+ /**
1196
+ * Check if agent has membership
1197
+ * @param agentWallet Agent's wallet address
1198
+ * @returns True if agent has membership
1199
+ */
1200
+ hasMembership(agentWallet: string): Promise<boolean>;
1201
+ /**
1202
+ * Revoke membership NFT
1203
+ * @param agentWallet Agent's wallet address
1204
+ * @returns Transaction hash
1205
+ */
1206
+ revokeMembership(agentWallet: string): Promise<string>;
1207
+ /**
1208
+ * Get total number of members
1209
+ */
1210
+ getTotalMembers(): Promise<number>;
1211
+ /**
1212
+ * Withdraw collected entry fees (world owner only)
1213
+ */
1214
+ withdrawFees(): Promise<string>;
1215
+ /**
1216
+ * Get world owner's wallet address
1217
+ */
1218
+ getWalletAddress(): string;
1219
+ /**
1220
+ * Get entry fee in MON (formatted)
1221
+ */
1222
+ getEntryFee(): Promise<string>;
1223
+ /**
1224
+ * Get entry fee in wei (raw BigInt string)
1225
+ */
1226
+ getEntryFeeWei(): Promise<string>;
1227
+ private usedPayments;
1228
+ /**
1229
+ * Verify a payment transaction from an agent.
1230
+ * Checks: tx confirmed, correct sender, correct recipient (world wallet), sufficient amount.
1231
+ * Prevents replay attacks by tracking used tx hashes.
1232
+ */
1233
+ verifyPayment(txHash: string, expectedSender: string, expectedAmountWei: string): Promise<boolean>;
1234
+ }
1235
+
1160
1236
  /**
1161
1237
  * ============================================================================
1162
1238
  * WORLD ACTION DEFINITIONS
@@ -1291,6 +1367,10 @@ declare class MessageRouter {
1291
1367
  * Broadcast a message from one agent to all other agents in the world
1292
1368
  */
1293
1369
  routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
1370
+ /**
1371
+ * Truncate long messages for logging
1372
+ */
1373
+ private truncate;
1294
1374
  }
1295
1375
 
1296
1376
  /**
@@ -1332,10 +1412,14 @@ declare class World {
1332
1412
  * Stop the world simulation
1333
1413
  */
1334
1414
  stop(): Promise<void>;
1415
+ /**
1416
+ * Get the blockchain client (for server endpoints)
1417
+ */
1418
+ getBlockchainClient(): BlockchainClient | null;
1335
1419
  /**
1336
1420
  * Admit an agent to the world
1337
1421
  */
1338
- admitAgent(card: any, walletAddress?: string): Promise<void>;
1422
+ admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
1339
1423
  /**
1340
1424
  * Remove an agent from the world
1341
1425
  */
@@ -1448,71 +1532,6 @@ declare class AgentEvaluator {
1448
1532
  private meetsProtocolVersion;
1449
1533
  }
1450
1534
 
1451
- /**
1452
- * ============================================================================
1453
- * BLOCKCHAIN CLIENT
1454
- * ============================================================================
1455
- *
1456
- * Handles all blockchain interactions for the World SDK:
1457
- * - Agent registry validation
1458
- * - Membership NFT minting
1459
- * - Entry fee collection
1460
- * - World token operations
1461
- */
1462
- declare class BlockchainClient {
1463
- private config;
1464
- private provider;
1465
- private wallet;
1466
- private agentRegistry?;
1467
- private membershipContract?;
1468
- private worldToken?;
1469
- constructor(config: BlockchainConfig);
1470
- /**
1471
- * Initialize contract connections
1472
- */
1473
- init(): Promise<void>;
1474
- /**
1475
- * Validate agent on-chain
1476
- * @param walletAddress Agent's wallet address
1477
- * @returns True if agent is registered and valid
1478
- */
1479
- validateAgent(walletAddress: string): Promise<boolean>;
1480
- /**
1481
- * Mint membership NFT for an agent
1482
- * @param agentWallet Agent's wallet address
1483
- * @returns Transaction hash
1484
- */
1485
- mintMembership(agentWallet: string): Promise<string>;
1486
- /**
1487
- * Check if agent has membership
1488
- * @param agentWallet Agent's wallet address
1489
- * @returns True if agent has membership
1490
- */
1491
- hasMembership(agentWallet: string): Promise<boolean>;
1492
- /**
1493
- * Revoke membership NFT
1494
- * @param agentWallet Agent's wallet address
1495
- * @returns Transaction hash
1496
- */
1497
- revokeMembership(agentWallet: string): Promise<string>;
1498
- /**
1499
- * Get total number of members
1500
- */
1501
- getTotalMembers(): Promise<number>;
1502
- /**
1503
- * Withdraw collected entry fees (world owner only)
1504
- */
1505
- withdrawFees(): Promise<string>;
1506
- /**
1507
- * Get world owner's wallet address
1508
- */
1509
- getWalletAddress(): string;
1510
- /**
1511
- * Get entry fee in MON
1512
- */
1513
- getEntryFee(): Promise<string>;
1514
- }
1515
-
1516
1535
  /**
1517
1536
  * ============================================================================
1518
1537
  * ACTION PROCESSOR
package/dist/index.d.ts CHANGED
@@ -1157,6 +1157,82 @@ declare const logger: winston.Logger;
1157
1157
  */
1158
1158
  declare function createLogger(moduleName: string): winston.Logger;
1159
1159
 
1160
+ /**
1161
+ * ============================================================================
1162
+ * BLOCKCHAIN CLIENT
1163
+ * ============================================================================
1164
+ *
1165
+ * Handles all blockchain interactions for the World SDK:
1166
+ * - Agent registry validation
1167
+ * - Membership NFT minting
1168
+ * - Entry fee collection
1169
+ * - World token operations
1170
+ */
1171
+ declare class BlockchainClient {
1172
+ private config;
1173
+ private provider;
1174
+ private wallet;
1175
+ private agentRegistry?;
1176
+ private membershipContract?;
1177
+ private worldToken?;
1178
+ constructor(config: BlockchainConfig);
1179
+ /**
1180
+ * Initialize contract connections
1181
+ */
1182
+ init(): Promise<void>;
1183
+ /**
1184
+ * Validate agent on-chain
1185
+ * @param walletAddress Agent's wallet address
1186
+ * @returns True if agent is registered and valid
1187
+ */
1188
+ validateAgent(walletAddress: string): Promise<boolean>;
1189
+ /**
1190
+ * Mint membership NFT for an agent
1191
+ * @param agentWallet Agent's wallet address
1192
+ * @returns Transaction hash
1193
+ */
1194
+ mintMembership(agentWallet: string): Promise<string>;
1195
+ /**
1196
+ * Check if agent has membership
1197
+ * @param agentWallet Agent's wallet address
1198
+ * @returns True if agent has membership
1199
+ */
1200
+ hasMembership(agentWallet: string): Promise<boolean>;
1201
+ /**
1202
+ * Revoke membership NFT
1203
+ * @param agentWallet Agent's wallet address
1204
+ * @returns Transaction hash
1205
+ */
1206
+ revokeMembership(agentWallet: string): Promise<string>;
1207
+ /**
1208
+ * Get total number of members
1209
+ */
1210
+ getTotalMembers(): Promise<number>;
1211
+ /**
1212
+ * Withdraw collected entry fees (world owner only)
1213
+ */
1214
+ withdrawFees(): Promise<string>;
1215
+ /**
1216
+ * Get world owner's wallet address
1217
+ */
1218
+ getWalletAddress(): string;
1219
+ /**
1220
+ * Get entry fee in MON (formatted)
1221
+ */
1222
+ getEntryFee(): Promise<string>;
1223
+ /**
1224
+ * Get entry fee in wei (raw BigInt string)
1225
+ */
1226
+ getEntryFeeWei(): Promise<string>;
1227
+ private usedPayments;
1228
+ /**
1229
+ * Verify a payment transaction from an agent.
1230
+ * Checks: tx confirmed, correct sender, correct recipient (world wallet), sufficient amount.
1231
+ * Prevents replay attacks by tracking used tx hashes.
1232
+ */
1233
+ verifyPayment(txHash: string, expectedSender: string, expectedAmountWei: string): Promise<boolean>;
1234
+ }
1235
+
1160
1236
  /**
1161
1237
  * ============================================================================
1162
1238
  * WORLD ACTION DEFINITIONS
@@ -1291,6 +1367,10 @@ declare class MessageRouter {
1291
1367
  * Broadcast a message from one agent to all other agents in the world
1292
1368
  */
1293
1369
  routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
1370
+ /**
1371
+ * Truncate long messages for logging
1372
+ */
1373
+ private truncate;
1294
1374
  }
1295
1375
 
1296
1376
  /**
@@ -1332,10 +1412,14 @@ declare class World {
1332
1412
  * Stop the world simulation
1333
1413
  */
1334
1414
  stop(): Promise<void>;
1415
+ /**
1416
+ * Get the blockchain client (for server endpoints)
1417
+ */
1418
+ getBlockchainClient(): BlockchainClient | null;
1335
1419
  /**
1336
1420
  * Admit an agent to the world
1337
1421
  */
1338
- admitAgent(card: any, walletAddress?: string): Promise<void>;
1422
+ admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
1339
1423
  /**
1340
1424
  * Remove an agent from the world
1341
1425
  */
@@ -1448,71 +1532,6 @@ declare class AgentEvaluator {
1448
1532
  private meetsProtocolVersion;
1449
1533
  }
1450
1534
 
1451
- /**
1452
- * ============================================================================
1453
- * BLOCKCHAIN CLIENT
1454
- * ============================================================================
1455
- *
1456
- * Handles all blockchain interactions for the World SDK:
1457
- * - Agent registry validation
1458
- * - Membership NFT minting
1459
- * - Entry fee collection
1460
- * - World token operations
1461
- */
1462
- declare class BlockchainClient {
1463
- private config;
1464
- private provider;
1465
- private wallet;
1466
- private agentRegistry?;
1467
- private membershipContract?;
1468
- private worldToken?;
1469
- constructor(config: BlockchainConfig);
1470
- /**
1471
- * Initialize contract connections
1472
- */
1473
- init(): Promise<void>;
1474
- /**
1475
- * Validate agent on-chain
1476
- * @param walletAddress Agent's wallet address
1477
- * @returns True if agent is registered and valid
1478
- */
1479
- validateAgent(walletAddress: string): Promise<boolean>;
1480
- /**
1481
- * Mint membership NFT for an agent
1482
- * @param agentWallet Agent's wallet address
1483
- * @returns Transaction hash
1484
- */
1485
- mintMembership(agentWallet: string): Promise<string>;
1486
- /**
1487
- * Check if agent has membership
1488
- * @param agentWallet Agent's wallet address
1489
- * @returns True if agent has membership
1490
- */
1491
- hasMembership(agentWallet: string): Promise<boolean>;
1492
- /**
1493
- * Revoke membership NFT
1494
- * @param agentWallet Agent's wallet address
1495
- * @returns Transaction hash
1496
- */
1497
- revokeMembership(agentWallet: string): Promise<string>;
1498
- /**
1499
- * Get total number of members
1500
- */
1501
- getTotalMembers(): Promise<number>;
1502
- /**
1503
- * Withdraw collected entry fees (world owner only)
1504
- */
1505
- withdrawFees(): Promise<string>;
1506
- /**
1507
- * Get world owner's wallet address
1508
- */
1509
- getWalletAddress(): string;
1510
- /**
1511
- * Get entry fee in MON
1512
- */
1513
- getEntryFee(): Promise<string>;
1514
- }
1515
-
1516
1535
  /**
1517
1536
  * ============================================================================
1518
1537
  * ACTION PROCESSOR