@wangwuww/neo-market-cli 0.1.0-alpha.2 → 0.1.0-alpha.3
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/README.md +7 -1
- package/SKILL.md +32 -39
- package/artifacts/contracts/AgentRegistry.sol/AgentRegistry.dbg.json +1 -1
- package/artifacts/contracts/AgentRegistry.sol/AgentRegistry.json +2 -2
- package/artifacts/contracts/ArbitrationMultisig.sol/ArbitrationMultisig.dbg.json +1 -1
- package/artifacts/contracts/ArbitrationMultisig.sol/ArbitrationMultisig.json +2 -2
- package/artifacts/contracts/ArbitrationMultisig.sol/ITokenEscrowExecute.dbg.json +1 -1
- package/artifacts/contracts/FeeManager.sol/FeeManager.dbg.json +1 -1
- package/artifacts/contracts/FeeManager.sol/FeeManager.json +108 -5
- package/artifacts/contracts/Marketplace.sol/IModuleRegistry.dbg.json +1 -1
- package/artifacts/contracts/Marketplace.sol/ITokenEscrowMinimal.dbg.json +1 -1
- package/artifacts/contracts/Marketplace.sol/ITokenEscrowMinimal.json +5 -0
- package/artifacts/contracts/Marketplace.sol/Marketplace.dbg.json +1 -1
- package/artifacts/contracts/Marketplace.sol/Marketplace.json +12 -2
- package/artifacts/contracts/ModuleKeys.sol/ModuleKeys.dbg.json +1 -1
- package/artifacts/contracts/ModuleKeys.sol/ModuleKeys.json +2 -2
- package/artifacts/contracts/ModuleRegistry.sol/ModuleRegistry.dbg.json +1 -1
- package/artifacts/contracts/ModuleRegistry.sol/ModuleRegistry.json +2 -2
- package/artifacts/contracts/NeoBadge.sol/NeoBadge.dbg.json +4 -0
- package/artifacts/contracts/NeoBadge.sol/NeoBadge.json +392 -0
- package/artifacts/contracts/Reputation.sol/Reputation.dbg.json +1 -1
- package/artifacts/contracts/Reputation.sol/Reputation.json +2 -2
- package/artifacts/contracts/TokenEscrow.sol/IArbitration.dbg.json +1 -1
- package/artifacts/contracts/TokenEscrow.sol/IERC20Minimal.dbg.json +1 -1
- package/artifacts/contracts/TokenEscrow.sol/IFeeManager.dbg.json +1 -1
- package/artifacts/contracts/TokenEscrow.sol/IFeeManager.json +10 -4
- package/artifacts/contracts/TokenEscrow.sol/IModuleRegistry.dbg.json +1 -1
- package/artifacts/contracts/TokenEscrow.sol/TokenEscrow.dbg.json +1 -1
- package/artifacts/contracts/TokenEscrow.sol/TokenEscrow.json +161 -36
- package/artifacts/contracts/USDCMock.sol/USDCMock.dbg.json +1 -1
- package/artifacts/contracts/USDCMock.sol/USDCMock.json +2 -2
- package/artifacts/contracts/interfaces/IAgentRegistry.sol/IAgentRegistry.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IArbitration.sol/IArbitration.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IEscrow.sol/IEscrow.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IFeeManager.sol/IFeeManager.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IMarketplace.sol/IMarketplace.dbg.json +1 -1
- package/artifacts/contracts/interfaces/IMarketplace.sol/IMarketplace.json +10 -0
- package/artifacts/contracts/interfaces/INeoBadge.sol/INeoBadge.dbg.json +4 -0
- package/artifacts/contracts/interfaces/INeoBadge.sol/INeoBadge.json +40 -0
- package/artifacts/contracts/interfaces/IReputation.sol/IReputation.dbg.json +1 -1
- package/artifacts/contracts/interfaces/ISignatures.sol/ISignatures.dbg.json +1 -1
- package/artifacts/contracts/interfaces/ITokenEscrow.sol/ITokenEscrow.dbg.json +1 -1
- package/deployed_addresses.json +10 -7
- package/dist/cli.js +180 -2
- package/package.json +2 -2
- package/dist/artifacts/build-info/263a967f7f3cd59c812a49b3d7012981.json +0 -1
- package/dist/artifacts/build-info/4a4ba527b0f3c1846c84e3e500a6db58.json +0 -1
- package/dist/artifacts/build-info/4e7053f3332c81b7a9916619c1b87388.json +0 -1
- package/dist/artifacts/build-info/50367a8838c4b3b556df951a374f59c7.json +0 -1
- package/dist/artifacts/build-info/61ca0f28829f90b00df26748203acea3.json +0 -1
- package/dist/artifacts/build-info/63fca17ade81ae3db2e066ca74f790d1.json +0 -1
- package/dist/artifacts/build-info/85f6bdb1a79bcf0154bb1562fa8e221e.json +0 -1
- package/dist/artifacts/contracts/AgentRegistry.sol/AgentRegistry.dbg.json +0 -4
- package/dist/artifacts/contracts/AgentRegistry.sol/AgentRegistry.json +0 -400
- package/dist/artifacts/contracts/ArbitrationMultisig.sol/ArbitrationMultisig.dbg.json +0 -4
- package/dist/artifacts/contracts/ArbitrationMultisig.sol/ArbitrationMultisig.json +0 -243
- package/dist/artifacts/contracts/ArbitrationMultisig.sol/ITokenEscrowExecute.dbg.json +0 -4
- package/dist/artifacts/contracts/ArbitrationMultisig.sol/ITokenEscrowExecute.json +0 -24
- package/dist/artifacts/contracts/FeeManager.sol/FeeManager.dbg.json +0 -4
- package/dist/artifacts/contracts/FeeManager.sol/FeeManager.json +0 -53
- package/dist/artifacts/contracts/Marketplace.sol/IModuleRegistry.dbg.json +0 -4
- package/dist/artifacts/contracts/Marketplace.sol/IModuleRegistry.json +0 -30
- package/dist/artifacts/contracts/Marketplace.sol/ITokenEscrowMinimal.dbg.json +0 -4
- package/dist/artifacts/contracts/Marketplace.sol/ITokenEscrowMinimal.json +0 -120
- package/dist/artifacts/contracts/Marketplace.sol/Marketplace.dbg.json +0 -4
- package/dist/artifacts/contracts/Marketplace.sol/Marketplace.json +0 -746
- package/dist/artifacts/contracts/ModuleKeys.sol/ModuleKeys.dbg.json +0 -4
- package/dist/artifacts/contracts/ModuleKeys.sol/ModuleKeys.json +0 -10
- package/dist/artifacts/contracts/ModuleRegistry.sol/ModuleRegistry.dbg.json +0 -4
- package/dist/artifacts/contracts/ModuleRegistry.sol/ModuleRegistry.json +0 -169
- package/dist/artifacts/contracts/Reputation.sol/Reputation.dbg.json +0 -4
- package/dist/artifacts/contracts/Reputation.sol/Reputation.json +0 -265
- package/dist/artifacts/contracts/TokenEscrow.sol/IArbitration.dbg.json +0 -4
- package/dist/artifacts/contracts/TokenEscrow.sol/IArbitration.json +0 -59
- package/dist/artifacts/contracts/TokenEscrow.sol/IERC20Minimal.dbg.json +0 -4
- package/dist/artifacts/contracts/TokenEscrow.sol/IERC20Minimal.json +0 -64
- package/dist/artifacts/contracts/TokenEscrow.sol/IFeeManager.dbg.json +0 -4
- package/dist/artifacts/contracts/TokenEscrow.sol/IFeeManager.json +0 -37
- package/dist/artifacts/contracts/TokenEscrow.sol/IModuleRegistry.dbg.json +0 -4
- package/dist/artifacts/contracts/TokenEscrow.sol/IModuleRegistry.json +0 -30
- package/dist/artifacts/contracts/TokenEscrow.sol/TokenEscrow.dbg.json +0 -4
- package/dist/artifacts/contracts/TokenEscrow.sol/TokenEscrow.json +0 -1091
- package/dist/artifacts/contracts/USDCMock.sol/USDCMock.dbg.json +0 -4
- package/dist/artifacts/contracts/USDCMock.sol/USDCMock.json +0 -251
- package/dist/artifacts/contracts/interfaces/IAgentRegistry.sol/IAgentRegistry.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IAgentRegistry.sol/IAgentRegistry.json +0 -203
- package/dist/artifacts/contracts/interfaces/IArbitration.sol/IArbitration.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IArbitration.sol/IArbitration.json +0 -127
- package/dist/artifacts/contracts/interfaces/IEscrow.sol/IEscrow.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IEscrow.sol/IEscrow.json +0 -431
- package/dist/artifacts/contracts/interfaces/IFeeManager.sol/IFeeManager.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IFeeManager.sol/IFeeManager.json +0 -87
- package/dist/artifacts/contracts/interfaces/IMarketplace.sol/IMarketplace.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IMarketplace.sol/IMarketplace.json +0 -427
- package/dist/artifacts/contracts/interfaces/IReputation.sol/IReputation.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/IReputation.sol/IReputation.json +0 -151
- package/dist/artifacts/contracts/interfaces/ISignatures.sol/ISignatures.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/ISignatures.sol/ISignatures.json +0 -414
- package/dist/artifacts/contracts/interfaces/ITokenEscrow.sol/ITokenEscrow.dbg.json +0 -4
- package/dist/artifacts/contracts/interfaces/ITokenEscrow.sol/ITokenEscrow.json +0 -245
|
@@ -244,8 +244,8 @@
|
|
|
244
244
|
"type": "function"
|
|
245
245
|
}
|
|
246
246
|
],
|
|
247
|
-
"bytecode": "
|
|
248
|
-
"deployedBytecode": "
|
|
247
|
+
"bytecode": "0x60808060405234610016576105eb908161001c8239f35b600080fdfe60806040818152600436101561001457600080fd5b600091823560e01c90816306fdde03146103cc57508063095ea7b31461035c57806318160ddd1461034057806323b872dd14610243578063313ce5671461022857806340c10f19146101a657806370a082311461016f57806395d89b411461010b578063a9059cbb146100db5763dd62ed3e1461009057600080fd5b346100d757806003193601126100d757806020926100ac610468565b6100b4610483565b6001600160a01b0391821683526002865283832091168252845220549051908152f35b5080fd5b50346100d757806003193601126100d7576020906101046100fa610468565b60243590336104ff565b5160018152f35b50346100d757816003193601126100d75780519080820182811067ffffffffffffffff82111761015b576101579350815260048252635553444360e01b6020830152519182918261041f565b0390f35b634e487b7160e01b84526041600452602484fd5b50346100d75760203660031901126100d75760209181906001600160a01b03610196610468565b1681526001845220549051908152f35b50346100d757806003193601126100d757817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e3610468565b6001600160a01b031693602435906101fc861515610499565b6102078286546104cf565b85558585526001835280852061021e8382546104cf565b905551908152a380f35b50346100d757816003193601126100d7576020905160068152f35b50346100d75760603660031901126100d75761025d610468565b90610266610483565b6044359060018060a01b03841693848652602094600286528487203388528652848720548481106103105794809697610104968660001982036102ae575b50505050506104ff565b6102b7916104f2565b83825260028a528282203383528a528282205582815260028952818120338252895220549086519182527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925883393a338858180866102a4565b855162461bcd60e51b8152600481018890526009602482015268414c4c4f57414e434560b81b6044820152606490fd5b50346100d757816003193601126100d757602091549051908152f35b50346100d757806003193601126100d75760209181610379610468565b91602435918291338152600287528181209460018060a01b0316948582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b9190503461041b578260031936011261041b5780820182811067ffffffffffffffff82111761015b576101579350815260088252672aa9a21021b7b4b760c11b6020830152519182918261041f565b8280fd5b6020808252825181830181905290939260005b82811061045457505060409293506000838284010152601f8019910116010190565b818101860151848201604001528501610432565b600435906001600160a01b038216820361047e57565b600080fd5b602435906001600160a01b038216820361047e57565b156104a057565b60405162461bcd60e51b81526020600482015260076024820152665a45524f5f544f60c81b6044820152606490fd5b919082018092116104dc57565b634e487b7160e01b600052601160045260246000fd5b919082039182116104dc57565b6001600160a01b03918216929190610518841515610499565b169060008281526001602052604081205491808310610586576040602092610561837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef966104f2565b86825260018552828220558681522061057b8282546104cf565b9055604051908152a3565b60405162461bcd60e51b815260206004820152600760248201526642414c414e434560c81b6044820152606490fdfea26469706673582212204aaad8f296acff6904837805156f6480cb8d7c1a90d7e42ff1a8c64814238edc64736f6c63430008140033",
|
|
248
|
+
"deployedBytecode": "0x60806040818152600436101561001457600080fd5b600091823560e01c90816306fdde03146103cc57508063095ea7b31461035c57806318160ddd1461034057806323b872dd14610243578063313ce5671461022857806340c10f19146101a657806370a082311461016f57806395d89b411461010b578063a9059cbb146100db5763dd62ed3e1461009057600080fd5b346100d757806003193601126100d757806020926100ac610468565b6100b4610483565b6001600160a01b0391821683526002865283832091168252845220549051908152f35b5080fd5b50346100d757806003193601126100d7576020906101046100fa610468565b60243590336104ff565b5160018152f35b50346100d757816003193601126100d75780519080820182811067ffffffffffffffff82111761015b576101579350815260048252635553444360e01b6020830152519182918261041f565b0390f35b634e487b7160e01b84526041600452602484fd5b50346100d75760203660031901126100d75760209181906001600160a01b03610196610468565b1681526001845220549051908152f35b50346100d757806003193601126100d757817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60206101e3610468565b6001600160a01b031693602435906101fc861515610499565b6102078286546104cf565b85558585526001835280852061021e8382546104cf565b905551908152a380f35b50346100d757816003193601126100d7576020905160068152f35b50346100d75760603660031901126100d75761025d610468565b90610266610483565b6044359060018060a01b03841693848652602094600286528487203388528652848720548481106103105794809697610104968660001982036102ae575b50505050506104ff565b6102b7916104f2565b83825260028a528282203383528a528282205582815260028952818120338252895220549086519182527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925883393a338858180866102a4565b855162461bcd60e51b8152600481018890526009602482015268414c4c4f57414e434560b81b6044820152606490fd5b50346100d757816003193601126100d757602091549051908152f35b50346100d757806003193601126100d75760209181610379610468565b91602435918291338152600287528181209460018060a01b0316948582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b9190503461041b578260031936011261041b5780820182811067ffffffffffffffff82111761015b576101579350815260088252672aa9a21021b7b4b760c11b6020830152519182918261041f565b8280fd5b6020808252825181830181905290939260005b82811061045457505060409293506000838284010152601f8019910116010190565b818101860151848201604001528501610432565b600435906001600160a01b038216820361047e57565b600080fd5b602435906001600160a01b038216820361047e57565b156104a057565b60405162461bcd60e51b81526020600482015260076024820152665a45524f5f544f60c81b6044820152606490fd5b919082018092116104dc57565b634e487b7160e01b600052601160045260246000fd5b919082039182116104dc57565b6001600160a01b03918216929190610518841515610499565b169060008281526001602052604081205491808310610586576040602092610561837fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef966104f2565b86825260018552828220558681522061057b8282546104cf565b9055604051908152a3565b60405162461bcd60e51b815260206004820152600760248201526642414c414e434560c81b6044820152606490fdfea26469706673582212204aaad8f296acff6904837805156f6480cb8d7c1a90d7e42ff1a8c64814238edc64736f6c63430008140033",
|
|
249
249
|
"linkReferences": {},
|
|
250
250
|
"deployedLinkReferences": {}
|
|
251
251
|
}
|
|
@@ -257,6 +257,11 @@
|
|
|
257
257
|
"internalType": "uint64",
|
|
258
258
|
"name": "eta",
|
|
259
259
|
"type": "uint64"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"internalType": "uint8",
|
|
263
|
+
"name": "maxRevisions",
|
|
264
|
+
"type": "uint8"
|
|
260
265
|
}
|
|
261
266
|
],
|
|
262
267
|
"internalType": "struct IMarketplace.BidInfo",
|
|
@@ -349,6 +354,11 @@
|
|
|
349
354
|
"internalType": "uint64",
|
|
350
355
|
"name": "eta",
|
|
351
356
|
"type": "uint64"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"internalType": "uint8",
|
|
360
|
+
"name": "maxRevisions",
|
|
361
|
+
"type": "uint8"
|
|
352
362
|
}
|
|
353
363
|
],
|
|
354
364
|
"name": "placeBid",
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_format": "hh-sol-artifact-1",
|
|
3
|
+
"contractName": "INeoBadge",
|
|
4
|
+
"sourceName": "contracts/interfaces/INeoBadge.sol",
|
|
5
|
+
"abi": [
|
|
6
|
+
{
|
|
7
|
+
"inputs": [
|
|
8
|
+
{
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "to",
|
|
11
|
+
"type": "address"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"internalType": "enum INeoBadge.BadgeCategory",
|
|
15
|
+
"name": "category",
|
|
16
|
+
"type": "uint8"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"internalType": "string",
|
|
20
|
+
"name": "uri",
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"name": "mint",
|
|
25
|
+
"outputs": [
|
|
26
|
+
{
|
|
27
|
+
"internalType": "uint256",
|
|
28
|
+
"name": "",
|
|
29
|
+
"type": "uint256"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"stateMutability": "nonpayable",
|
|
33
|
+
"type": "function"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"bytecode": "0x",
|
|
37
|
+
"deployedBytecode": "0x",
|
|
38
|
+
"linkReferences": {},
|
|
39
|
+
"deployedLinkReferences": {}
|
|
40
|
+
}
|
package/deployed_addresses.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ModuleRegistry": "0xF15d928954F9Ac529CF706027e5E1829B1aBed34",
|
|
3
|
-
"AgentRegistry": "0xF040bE18dfb1f0ac50c599fb187668a0B428481C",
|
|
4
|
-
"FeeManager": "0x2F6fB6bE3F176B2e424405C27E02fE0414237B83",
|
|
5
|
-
"TokenEscrow": "0xFec348d13419C58c1a638f3a6E6097f4FDF7591C",
|
|
6
|
-
"Marketplace": "0x339f142deE647aD8518db6b7e2045B5F3d5aEeFc",
|
|
7
|
-
"Reputation": "0xf9a166CaF953F6D50af3a63BC0D02084C832a791",
|
|
8
2
|
"network": "sepolia",
|
|
9
3
|
"chainId": 11155111,
|
|
10
|
-
"
|
|
4
|
+
"deployer": "0xfc33a39d546CB88e82beBF0b246E4C458E562A56",
|
|
5
|
+
"treasury": "0xfc33a39d546CB88e82beBF0b246E4C458E562A56",
|
|
6
|
+
"usdc": "0x1Bbd30E93C8e661cA9589f946fa34c04a6DA52EC",
|
|
7
|
+
"ModuleRegistry": "0x8Bb67eec7dD1b060705655a1dBcF49D0CBa80410",
|
|
8
|
+
"AgentRegistry": "0x44a683Ee505e904EB23c7a582Ec355E0c8Adcf51",
|
|
9
|
+
"FeeManager": "0xE0e9658e36549d0be488b01E6169Dc903b810568",
|
|
10
|
+
"NeoBadge": "0xdD999870F13CC1f714EB1F8989c63e03Ea590342",
|
|
11
|
+
"TokenEscrow": "0x03551e91C0d19fEC40088Da46b9d5786696dAb9f",
|
|
12
|
+
"Marketplace": "0x7Ee80Bdbb13417660610fec998E24d9F4d3DeBc3",
|
|
13
|
+
"Reputation": "0xD83be1d2254f25f276E743dE2F59bb7D579f3ac5"
|
|
11
14
|
}
|
package/dist/cli.js
CHANGED
|
@@ -41,7 +41,14 @@ const fs = __importStar(require("fs"));
|
|
|
41
41
|
const dotenv = __importStar(require("dotenv"));
|
|
42
42
|
dotenv.config();
|
|
43
43
|
// Load addresses
|
|
44
|
-
|
|
44
|
+
// Search for deployed_addresses.json in current dir or parent (to support ts-node and dist)
|
|
45
|
+
let ADDR_PATH = path.join(process.cwd(), "deployed_addresses.json");
|
|
46
|
+
if (!fs.existsSync(ADDR_PATH)) {
|
|
47
|
+
ADDR_PATH = path.join(__dirname, "deployed_addresses.json");
|
|
48
|
+
}
|
|
49
|
+
if (!fs.existsSync(ADDR_PATH)) {
|
|
50
|
+
ADDR_PATH = path.join(__dirname, "..", "deployed_addresses.json");
|
|
51
|
+
}
|
|
45
52
|
if (!fs.existsSync(ADDR_PATH)) {
|
|
46
53
|
console.error("❌ Error: deployed_addresses.json not found.");
|
|
47
54
|
process.exit(1);
|
|
@@ -206,16 +213,55 @@ program
|
|
|
206
213
|
break;
|
|
207
214
|
const job = await market.getJob(i);
|
|
208
215
|
console.log(`\n🆔 Job #${job.jobId}`);
|
|
216
|
+
console.log(` Buyer: ${job.buyer}`);
|
|
209
217
|
console.log(` Spec: ${job.jobSpecCID}`);
|
|
210
218
|
console.log(` Budget: ${ethers_1.ethers.formatUnits(job.budget, 6)} USDC`);
|
|
211
219
|
const status = ["Init", "Open", "Selected", "Cancelled", "Closed", "Expired"][Number(job.status)];
|
|
212
220
|
console.log(` Status: ${status}`);
|
|
221
|
+
if (Number(job.status) === 2) { // Selected
|
|
222
|
+
const bidId = await market.selectedBidOf(i);
|
|
223
|
+
const bid = await market.getBid(bidId);
|
|
224
|
+
const escrowId = await market.escrowOf(i);
|
|
225
|
+
console.log(` Selected Bid: #${bidId} by ${bid.agent} ($${ethers_1.ethers.formatUnits(bid.price, 6)})`);
|
|
226
|
+
console.log(` Escrow ID: ${escrowId}`);
|
|
227
|
+
}
|
|
213
228
|
}
|
|
214
229
|
}
|
|
215
230
|
catch (e) {
|
|
216
231
|
console.error("Error fetching jobs:", e);
|
|
217
232
|
}
|
|
218
233
|
});
|
|
234
|
+
// --- Command: Bids ---
|
|
235
|
+
program
|
|
236
|
+
.command("bids")
|
|
237
|
+
.description("List bids for a job")
|
|
238
|
+
.requiredOption("-j, --job <id>", "Job ID")
|
|
239
|
+
.action(async (options) => {
|
|
240
|
+
const provider = getProvider(program.opts());
|
|
241
|
+
const market = getContract("Marketplace", ADDRS.Marketplace, provider);
|
|
242
|
+
try {
|
|
243
|
+
const count = await market.bidCount();
|
|
244
|
+
console.log(`🔍 Bids for Job #${options.job}:\n`);
|
|
245
|
+
let found = 0;
|
|
246
|
+
for (let i = 1; i <= Number(count); i++) {
|
|
247
|
+
const bid = await market.getBid(i);
|
|
248
|
+
if (bid.jobId.toString() === options.job.toString()) {
|
|
249
|
+
console.log(`🆔 Bid #${i}`);
|
|
250
|
+
console.log(` Agent: ${bid.agent}`);
|
|
251
|
+
console.log(` Price: ${ethers_1.ethers.formatUnits(bid.price, 6)} USDC`);
|
|
252
|
+
console.log(` ETA: ${bid.eta}s`);
|
|
253
|
+
console.log(` CID: ${bid.bidCID}`);
|
|
254
|
+
console.log("");
|
|
255
|
+
found++;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (found === 0)
|
|
259
|
+
console.log("No bids found.");
|
|
260
|
+
}
|
|
261
|
+
catch (e) {
|
|
262
|
+
console.error("Error fetching bids:", e);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
219
265
|
// --- Command: Bid ---
|
|
220
266
|
program
|
|
221
267
|
.command("bid")
|
|
@@ -223,6 +269,7 @@ program
|
|
|
223
269
|
.requiredOption("-p, --price <amount>", "Price USDC")
|
|
224
270
|
.requiredOption("-e, --eta <seconds>", "ETA")
|
|
225
271
|
.requiredOption("-c, --cid <ipfs_cid>", "CID")
|
|
272
|
+
.option("-r, --revisions <number>", "Max Revisions", "1")
|
|
226
273
|
.action(async (options) => {
|
|
227
274
|
const provider = getProvider(program.opts());
|
|
228
275
|
const wallet = getWallet(program.opts(), provider);
|
|
@@ -233,8 +280,13 @@ program
|
|
|
233
280
|
const market = getContract("Marketplace", ADDRS.Marketplace, wallet);
|
|
234
281
|
const price = ethers_1.ethers.parseUnits(options.price, 6);
|
|
235
282
|
console.log(`🦞 Bidding on Job #${options.job}...`);
|
|
283
|
+
// Debug: list fragment types
|
|
284
|
+
const fragment = market.interface.getFunction("placeBid");
|
|
285
|
+
if (fragment) {
|
|
286
|
+
console.log(` Found fragment: placeBid(${fragment.inputs.map(i => i.type).join(",")})`);
|
|
287
|
+
}
|
|
236
288
|
try {
|
|
237
|
-
const tx = await market.placeBid(options.job, options.cid, price, options.eta);
|
|
289
|
+
const tx = await market.placeBid(BigInt(options.job), options.cid, price, BigInt(options.eta), Number(options.revisions));
|
|
238
290
|
console.log(`✅ Tx: ${tx.hash}`);
|
|
239
291
|
await tx.wait();
|
|
240
292
|
console.log("🎉 Bid Placed!");
|
|
@@ -243,6 +295,108 @@ program
|
|
|
243
295
|
console.error("❌ Bid Failed:", e.shortMessage || e.message);
|
|
244
296
|
}
|
|
245
297
|
});
|
|
298
|
+
// --- Command: Set SoW ---
|
|
299
|
+
program
|
|
300
|
+
.command("set-sow")
|
|
301
|
+
.description("Lock the negotiated Statement of Work (SoW) hash")
|
|
302
|
+
.requiredOption("-e, --escrow <id>", "Escrow ID")
|
|
303
|
+
.requiredOption("-s, --sow <hash>", "SoW Hash (bytes32)")
|
|
304
|
+
.action(async (options) => {
|
|
305
|
+
const provider = getProvider(program.opts());
|
|
306
|
+
const wallet = getWallet(program.opts(), provider);
|
|
307
|
+
if (!wallet) {
|
|
308
|
+
console.error("❌ Key required");
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
311
|
+
const escrow = getContract("TokenEscrow", ADDRS.TokenEscrow, wallet);
|
|
312
|
+
console.log(`✍️ Locking SoW for Escrow #${options.escrow}...`);
|
|
313
|
+
try {
|
|
314
|
+
const tx = await escrow.setSowHash(options.escrow, options.sow);
|
|
315
|
+
console.log(`✅ Tx: ${tx.hash}`);
|
|
316
|
+
await tx.wait();
|
|
317
|
+
console.log("🎉 SoW Locked!");
|
|
318
|
+
}
|
|
319
|
+
catch (e) {
|
|
320
|
+
console.error("❌ Set SoW Failed:", e.shortMessage || e.message);
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
// --- Command: Pay Intent ---
|
|
324
|
+
program
|
|
325
|
+
.command("pay-intent")
|
|
326
|
+
.description("Pay intent deposit (consultation fee)")
|
|
327
|
+
.requiredOption("-e, --escrow <id>", "Escrow ID")
|
|
328
|
+
.requiredOption("-a, --amount <amount>", "Amount in USDC")
|
|
329
|
+
.action(async (options) => {
|
|
330
|
+
const provider = getProvider(program.opts());
|
|
331
|
+
const wallet = getWallet(program.opts(), provider);
|
|
332
|
+
if (!wallet) {
|
|
333
|
+
console.error("❌ Key required");
|
|
334
|
+
process.exit(1);
|
|
335
|
+
}
|
|
336
|
+
const escrow = getContract("TokenEscrow", ADDRS.TokenEscrow, wallet);
|
|
337
|
+
const token = getContract("USDCMock", ADDRS.usdc, wallet);
|
|
338
|
+
const amount = ethers_1.ethers.parseUnits(options.amount, 6);
|
|
339
|
+
console.log("💰 Approving USDC...");
|
|
340
|
+
const txApprove = await token.approve(ADDRS.TokenEscrow, amount);
|
|
341
|
+
await txApprove.wait();
|
|
342
|
+
console.log(`🚀 Paying Intent Deposit for Escrow #${options.escrow}...`);
|
|
343
|
+
try {
|
|
344
|
+
const tx = await escrow.payIntentDeposit(options.escrow, amount);
|
|
345
|
+
console.log(`✅ Tx: ${tx.hash}`);
|
|
346
|
+
await tx.wait();
|
|
347
|
+
console.log("🎉 Intent Deposit Paid!");
|
|
348
|
+
}
|
|
349
|
+
catch (e) {
|
|
350
|
+
console.error("❌ Pay Intent Failed:", e.shortMessage || e.message);
|
|
351
|
+
}
|
|
352
|
+
});
|
|
353
|
+
// --- Command: Claim Intent ---
|
|
354
|
+
program
|
|
355
|
+
.command("claim-intent")
|
|
356
|
+
.description("Claim intent deposit (Agent only)")
|
|
357
|
+
.requiredOption("-e, --escrow <id>", "Escrow ID")
|
|
358
|
+
.action(async (options) => {
|
|
359
|
+
const provider = getProvider(program.opts());
|
|
360
|
+
const wallet = getWallet(program.opts(), provider);
|
|
361
|
+
if (!wallet) {
|
|
362
|
+
console.error("❌ Key required");
|
|
363
|
+
process.exit(1);
|
|
364
|
+
}
|
|
365
|
+
const escrow = getContract("TokenEscrow", ADDRS.TokenEscrow, wallet);
|
|
366
|
+
console.log(`💸 Claiming Intent Deposit for Escrow #${options.escrow}...`);
|
|
367
|
+
try {
|
|
368
|
+
const tx = await escrow.claimIntentDeposit(options.escrow);
|
|
369
|
+
console.log(`✅ Tx: ${tx.hash}`);
|
|
370
|
+
await tx.wait();
|
|
371
|
+
console.log("🎉 Intent Deposit Claimed!");
|
|
372
|
+
}
|
|
373
|
+
catch (e) {
|
|
374
|
+
console.error("❌ Claim Intent Failed:", e.shortMessage || e.message);
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
// --- Command: Badges ---
|
|
378
|
+
program
|
|
379
|
+
.command("badges")
|
|
380
|
+
.description("View badges for an address")
|
|
381
|
+
.argument("[address]", "Address to query")
|
|
382
|
+
.action(async (address) => {
|
|
383
|
+
const provider = getProvider(program.opts());
|
|
384
|
+
const wallet = getWallet(program.opts(), provider);
|
|
385
|
+
const target = address || (wallet ? wallet.address : null);
|
|
386
|
+
if (!target) {
|
|
387
|
+
console.error("❌ Address required");
|
|
388
|
+
process.exit(1);
|
|
389
|
+
}
|
|
390
|
+
const badge = getContract("NeoBadge", ADDRS.NeoBadge, provider);
|
|
391
|
+
try {
|
|
392
|
+
const balance = await badge.balanceOf(target);
|
|
393
|
+
console.log(`🏅 Badges for ${target}: ${balance}`);
|
|
394
|
+
// In a real CLI we would iterate and fetch URIs
|
|
395
|
+
}
|
|
396
|
+
catch (e) {
|
|
397
|
+
console.error("❌ Failed to fetch badges:", e);
|
|
398
|
+
}
|
|
399
|
+
});
|
|
246
400
|
// --- Command: Deliver ---
|
|
247
401
|
program
|
|
248
402
|
.command("deliver")
|
|
@@ -303,4 +457,28 @@ program
|
|
|
303
457
|
console.error("❌ Deliver Failed:", e.shortMessage || e.message);
|
|
304
458
|
}
|
|
305
459
|
});
|
|
460
|
+
// --- Command: Accept ---
|
|
461
|
+
program
|
|
462
|
+
.command("accept")
|
|
463
|
+
.description("Accept delivery and release payment")
|
|
464
|
+
.requiredOption("-e, --escrow <id>", "Escrow ID")
|
|
465
|
+
.action(async (options) => {
|
|
466
|
+
const provider = getProvider(program.opts());
|
|
467
|
+
const wallet = getWallet(program.opts(), provider);
|
|
468
|
+
if (!wallet) {
|
|
469
|
+
console.error("❌ Key required");
|
|
470
|
+
process.exit(1);
|
|
471
|
+
}
|
|
472
|
+
const escrow = getContract("TokenEscrow", ADDRS.TokenEscrow, wallet);
|
|
473
|
+
console.log(`✅ Accepting Escrow #${options.escrow}...`);
|
|
474
|
+
try {
|
|
475
|
+
const tx = await escrow.accept(options.escrow);
|
|
476
|
+
console.log(`✅ Tx: ${tx.hash}`);
|
|
477
|
+
await tx.wait();
|
|
478
|
+
console.log("🎉 Payment Released & Badges Minted!");
|
|
479
|
+
}
|
|
480
|
+
catch (e) {
|
|
481
|
+
console.error("❌ Accept Failed:", e.shortMessage || e.message);
|
|
482
|
+
}
|
|
483
|
+
});
|
|
306
484
|
program.parse(process.argv);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wangwuww/neo-market-cli",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "CLI for Autonomous Agents to interact with the
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"description": "CLI for Autonomous Agents to interact with the Neo Market",
|
|
5
5
|
"bin": {
|
|
6
6
|
"neo-market": "dist/cli.js"
|
|
7
7
|
},
|