@moltium/world-core 0.1.21 → 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
@@ -1264,6 +1340,10 @@ declare class WorldA2AClient {
1264
1340
  * Get all agent URLs in the pool
1265
1341
  */
1266
1342
  getAgentUrls(): string[];
1343
+ /**
1344
+ * Extract base URL (protocol://host:port) from a full URL
1345
+ */
1346
+ private extractBaseUrl;
1267
1347
  }
1268
1348
 
1269
1349
  /**
@@ -1287,6 +1367,10 @@ declare class MessageRouter {
1287
1367
  * Broadcast a message from one agent to all other agents in the world
1288
1368
  */
1289
1369
  routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
1370
+ /**
1371
+ * Truncate long messages for logging
1372
+ */
1373
+ private truncate;
1290
1374
  }
1291
1375
 
1292
1376
  /**
@@ -1328,10 +1412,14 @@ declare class World {
1328
1412
  * Stop the world simulation
1329
1413
  */
1330
1414
  stop(): Promise<void>;
1415
+ /**
1416
+ * Get the blockchain client (for server endpoints)
1417
+ */
1418
+ getBlockchainClient(): BlockchainClient | null;
1331
1419
  /**
1332
1420
  * Admit an agent to the world
1333
1421
  */
1334
- admitAgent(card: any, walletAddress?: string): Promise<void>;
1422
+ admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
1335
1423
  /**
1336
1424
  * Remove an agent from the world
1337
1425
  */
@@ -1444,71 +1532,6 @@ declare class AgentEvaluator {
1444
1532
  private meetsProtocolVersion;
1445
1533
  }
1446
1534
 
1447
- /**
1448
- * ============================================================================
1449
- * BLOCKCHAIN CLIENT
1450
- * ============================================================================
1451
- *
1452
- * Handles all blockchain interactions for the World SDK:
1453
- * - Agent registry validation
1454
- * - Membership NFT minting
1455
- * - Entry fee collection
1456
- * - World token operations
1457
- */
1458
- declare class BlockchainClient {
1459
- private config;
1460
- private provider;
1461
- private wallet;
1462
- private agentRegistry?;
1463
- private membershipContract?;
1464
- private worldToken?;
1465
- constructor(config: BlockchainConfig);
1466
- /**
1467
- * Initialize contract connections
1468
- */
1469
- init(): Promise<void>;
1470
- /**
1471
- * Validate agent on-chain
1472
- * @param walletAddress Agent's wallet address
1473
- * @returns True if agent is registered and valid
1474
- */
1475
- validateAgent(walletAddress: string): Promise<boolean>;
1476
- /**
1477
- * Mint membership NFT for an agent
1478
- * @param agentWallet Agent's wallet address
1479
- * @returns Transaction hash
1480
- */
1481
- mintMembership(agentWallet: string): Promise<string>;
1482
- /**
1483
- * Check if agent has membership
1484
- * @param agentWallet Agent's wallet address
1485
- * @returns True if agent has membership
1486
- */
1487
- hasMembership(agentWallet: string): Promise<boolean>;
1488
- /**
1489
- * Revoke membership NFT
1490
- * @param agentWallet Agent's wallet address
1491
- * @returns Transaction hash
1492
- */
1493
- revokeMembership(agentWallet: string): Promise<string>;
1494
- /**
1495
- * Get total number of members
1496
- */
1497
- getTotalMembers(): Promise<number>;
1498
- /**
1499
- * Withdraw collected entry fees (world owner only)
1500
- */
1501
- withdrawFees(): Promise<string>;
1502
- /**
1503
- * Get world owner's wallet address
1504
- */
1505
- getWalletAddress(): string;
1506
- /**
1507
- * Get entry fee in MON
1508
- */
1509
- getEntryFee(): Promise<string>;
1510
- }
1511
-
1512
1535
  /**
1513
1536
  * ============================================================================
1514
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
@@ -1264,6 +1340,10 @@ declare class WorldA2AClient {
1264
1340
  * Get all agent URLs in the pool
1265
1341
  */
1266
1342
  getAgentUrls(): string[];
1343
+ /**
1344
+ * Extract base URL (protocol://host:port) from a full URL
1345
+ */
1346
+ private extractBaseUrl;
1267
1347
  }
1268
1348
 
1269
1349
  /**
@@ -1287,6 +1367,10 @@ declare class MessageRouter {
1287
1367
  * Broadcast a message from one agent to all other agents in the world
1288
1368
  */
1289
1369
  routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
1370
+ /**
1371
+ * Truncate long messages for logging
1372
+ */
1373
+ private truncate;
1290
1374
  }
1291
1375
 
1292
1376
  /**
@@ -1328,10 +1412,14 @@ declare class World {
1328
1412
  * Stop the world simulation
1329
1413
  */
1330
1414
  stop(): Promise<void>;
1415
+ /**
1416
+ * Get the blockchain client (for server endpoints)
1417
+ */
1418
+ getBlockchainClient(): BlockchainClient | null;
1331
1419
  /**
1332
1420
  * Admit an agent to the world
1333
1421
  */
1334
- admitAgent(card: any, walletAddress?: string): Promise<void>;
1422
+ admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
1335
1423
  /**
1336
1424
  * Remove an agent from the world
1337
1425
  */
@@ -1444,71 +1532,6 @@ declare class AgentEvaluator {
1444
1532
  private meetsProtocolVersion;
1445
1533
  }
1446
1534
 
1447
- /**
1448
- * ============================================================================
1449
- * BLOCKCHAIN CLIENT
1450
- * ============================================================================
1451
- *
1452
- * Handles all blockchain interactions for the World SDK:
1453
- * - Agent registry validation
1454
- * - Membership NFT minting
1455
- * - Entry fee collection
1456
- * - World token operations
1457
- */
1458
- declare class BlockchainClient {
1459
- private config;
1460
- private provider;
1461
- private wallet;
1462
- private agentRegistry?;
1463
- private membershipContract?;
1464
- private worldToken?;
1465
- constructor(config: BlockchainConfig);
1466
- /**
1467
- * Initialize contract connections
1468
- */
1469
- init(): Promise<void>;
1470
- /**
1471
- * Validate agent on-chain
1472
- * @param walletAddress Agent's wallet address
1473
- * @returns True if agent is registered and valid
1474
- */
1475
- validateAgent(walletAddress: string): Promise<boolean>;
1476
- /**
1477
- * Mint membership NFT for an agent
1478
- * @param agentWallet Agent's wallet address
1479
- * @returns Transaction hash
1480
- */
1481
- mintMembership(agentWallet: string): Promise<string>;
1482
- /**
1483
- * Check if agent has membership
1484
- * @param agentWallet Agent's wallet address
1485
- * @returns True if agent has membership
1486
- */
1487
- hasMembership(agentWallet: string): Promise<boolean>;
1488
- /**
1489
- * Revoke membership NFT
1490
- * @param agentWallet Agent's wallet address
1491
- * @returns Transaction hash
1492
- */
1493
- revokeMembership(agentWallet: string): Promise<string>;
1494
- /**
1495
- * Get total number of members
1496
- */
1497
- getTotalMembers(): Promise<number>;
1498
- /**
1499
- * Withdraw collected entry fees (world owner only)
1500
- */
1501
- withdrawFees(): Promise<string>;
1502
- /**
1503
- * Get world owner's wallet address
1504
- */
1505
- getWalletAddress(): string;
1506
- /**
1507
- * Get entry fee in MON
1508
- */
1509
- getEntryFee(): Promise<string>;
1510
- }
1511
-
1512
1535
  /**
1513
1536
  * ============================================================================
1514
1537
  * ACTION PROCESSOR