@moltium/world-core 0.1.22 → 0.1.24
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/{CardFetcher-4ENWKI6E.js → CardFetcher-IMUPYNEQ.js} +2 -2
- package/dist/CardFetcher-ZD4YSGJE.cjs +9 -0
- package/dist/{CardFetcher-UCJGPZ7X.cjs.map → CardFetcher-ZD4YSGJE.cjs.map} +1 -1
- package/dist/{chunk-DHQFXIEW.cjs → chunk-WI7EASJJ.cjs} +30 -6
- package/dist/chunk-WI7EASJJ.cjs.map +1 -0
- package/dist/{chunk-DWXNX5V3.js → chunk-Y563WZWH.js} +30 -6
- package/dist/chunk-Y563WZWH.js.map +1 -0
- package/dist/index.cjs +280 -54
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -66
- package/dist/index.d.ts +95 -66
- package/dist/index.js +241 -15
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/CardFetcher-UCJGPZ7X.cjs +0 -9
- package/dist/chunk-DHQFXIEW.cjs.map +0 -1
- package/dist/chunk-DWXNX5V3.js.map +0 -1
- /package/dist/{CardFetcher-4ENWKI6E.js.map → CardFetcher-IMUPYNEQ.js.map} +0 -0
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
|
|
@@ -1283,6 +1359,16 @@ declare class MessageRouter {
|
|
|
1283
1359
|
private a2aClient;
|
|
1284
1360
|
private getAgents;
|
|
1285
1361
|
constructor(a2aClient: WorldA2AClient, getAgents: () => AgentProfile[]);
|
|
1362
|
+
/**
|
|
1363
|
+
* Extract base URL (protocol://host:port) from a full URL for comparison.
|
|
1364
|
+
* Agent cards use full URLs (e.g. http://localhost:3001/a2a/jsonrpc)
|
|
1365
|
+
* while agents send base URLs (e.g. http://localhost:3001).
|
|
1366
|
+
*/
|
|
1367
|
+
private extractBaseUrl;
|
|
1368
|
+
/**
|
|
1369
|
+
* Find an agent by URL, normalizing both sides to base URL for comparison
|
|
1370
|
+
*/
|
|
1371
|
+
private findAgent;
|
|
1286
1372
|
/**
|
|
1287
1373
|
* Route a message from one agent to another
|
|
1288
1374
|
*/
|
|
@@ -1291,6 +1377,10 @@ declare class MessageRouter {
|
|
|
1291
1377
|
* Broadcast a message from one agent to all other agents in the world
|
|
1292
1378
|
*/
|
|
1293
1379
|
routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
|
|
1380
|
+
/**
|
|
1381
|
+
* Truncate long messages for logging
|
|
1382
|
+
*/
|
|
1383
|
+
private truncate;
|
|
1294
1384
|
}
|
|
1295
1385
|
|
|
1296
1386
|
/**
|
|
@@ -1332,10 +1422,14 @@ declare class World {
|
|
|
1332
1422
|
* Stop the world simulation
|
|
1333
1423
|
*/
|
|
1334
1424
|
stop(): Promise<void>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Get the blockchain client (for server endpoints)
|
|
1427
|
+
*/
|
|
1428
|
+
getBlockchainClient(): BlockchainClient | null;
|
|
1335
1429
|
/**
|
|
1336
1430
|
* Admit an agent to the world
|
|
1337
1431
|
*/
|
|
1338
|
-
admitAgent(card: any, walletAddress?: string): Promise<void>;
|
|
1432
|
+
admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
|
|
1339
1433
|
/**
|
|
1340
1434
|
* Remove an agent from the world
|
|
1341
1435
|
*/
|
|
@@ -1448,71 +1542,6 @@ declare class AgentEvaluator {
|
|
|
1448
1542
|
private meetsProtocolVersion;
|
|
1449
1543
|
}
|
|
1450
1544
|
|
|
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
1545
|
/**
|
|
1517
1546
|
* ============================================================================
|
|
1518
1547
|
* 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
|
|
@@ -1283,6 +1359,16 @@ declare class MessageRouter {
|
|
|
1283
1359
|
private a2aClient;
|
|
1284
1360
|
private getAgents;
|
|
1285
1361
|
constructor(a2aClient: WorldA2AClient, getAgents: () => AgentProfile[]);
|
|
1362
|
+
/**
|
|
1363
|
+
* Extract base URL (protocol://host:port) from a full URL for comparison.
|
|
1364
|
+
* Agent cards use full URLs (e.g. http://localhost:3001/a2a/jsonrpc)
|
|
1365
|
+
* while agents send base URLs (e.g. http://localhost:3001).
|
|
1366
|
+
*/
|
|
1367
|
+
private extractBaseUrl;
|
|
1368
|
+
/**
|
|
1369
|
+
* Find an agent by URL, normalizing both sides to base URL for comparison
|
|
1370
|
+
*/
|
|
1371
|
+
private findAgent;
|
|
1286
1372
|
/**
|
|
1287
1373
|
* Route a message from one agent to another
|
|
1288
1374
|
*/
|
|
@@ -1291,6 +1377,10 @@ declare class MessageRouter {
|
|
|
1291
1377
|
* Broadcast a message from one agent to all other agents in the world
|
|
1292
1378
|
*/
|
|
1293
1379
|
routeToAll(fromAgentUrl: string, message: string): Promise<Map<string, A2AMessageResponse>>;
|
|
1380
|
+
/**
|
|
1381
|
+
* Truncate long messages for logging
|
|
1382
|
+
*/
|
|
1383
|
+
private truncate;
|
|
1294
1384
|
}
|
|
1295
1385
|
|
|
1296
1386
|
/**
|
|
@@ -1332,10 +1422,14 @@ declare class World {
|
|
|
1332
1422
|
* Stop the world simulation
|
|
1333
1423
|
*/
|
|
1334
1424
|
stop(): Promise<void>;
|
|
1425
|
+
/**
|
|
1426
|
+
* Get the blockchain client (for server endpoints)
|
|
1427
|
+
*/
|
|
1428
|
+
getBlockchainClient(): BlockchainClient | null;
|
|
1335
1429
|
/**
|
|
1336
1430
|
* Admit an agent to the world
|
|
1337
1431
|
*/
|
|
1338
|
-
admitAgent(card: any, walletAddress?: string): Promise<void>;
|
|
1432
|
+
admitAgent(card: any, walletAddress?: string, paymentTxHash?: string): Promise<void>;
|
|
1339
1433
|
/**
|
|
1340
1434
|
* Remove an agent from the world
|
|
1341
1435
|
*/
|
|
@@ -1448,71 +1542,6 @@ declare class AgentEvaluator {
|
|
|
1448
1542
|
private meetsProtocolVersion;
|
|
1449
1543
|
}
|
|
1450
1544
|
|
|
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
1545
|
/**
|
|
1517
1546
|
* ============================================================================
|
|
1518
1547
|
* ACTION PROCESSOR
|