@envarai/envarpay 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 +6 -5
- package/dist/index.js +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ Node.js >=22.14 and Bun are supported. Import this package from an ESM applicati
|
|
|
23
23
|
The npm library is a client; the wallet runs as a separate service:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
uv tool install --python 3.13
|
|
26
|
+
uv tool install --python 3.13 envarpay==0.1.0a10
|
|
27
27
|
envarpay init --agent mcp --role buyer --directory ./buyer \
|
|
28
28
|
--peer-url https://seller.example/mcp --pay-to SELLER_FULL_RECEIVING_ADDRESS \
|
|
29
29
|
--tool ask_agent --max-per-call 0.01 --budget 0.05
|
|
@@ -76,11 +76,11 @@ const wallet = await WalletClient.connect({
|
|
|
76
76
|
token: process.env.ENVARPAY_WALLET_TOKEN!,
|
|
77
77
|
});
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
const tools = await wallet.listPaidTools('seller');
|
|
80
80
|
console.log(tools.tools.map(tool => tool.name));
|
|
81
81
|
// This may pay within the wallet operator's existing allowlist and budget.
|
|
82
82
|
const result = await wallet.callPaidTool({
|
|
83
|
-
peer: '
|
|
83
|
+
peer: 'seller', tool: 'ask_agent',
|
|
84
84
|
arguments: { question: 'Review my API design' }, requestId: 'review-001',
|
|
85
85
|
});
|
|
86
86
|
console.log(result.result.content);
|
|
@@ -95,7 +95,8 @@ try {
|
|
|
95
95
|
}
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
The example uses the `seller` alias generated by the quickstart. If you changed it,
|
|
99
|
+
use the alias actually configured in `buyer.toml`.
|
|
99
100
|
`listPaidTools` does not pay. `callPaidTool` may spend within the existing wallet
|
|
100
101
|
policy; `paymentStatus` and `recoverPayment` retain the original purchase.
|
|
101
102
|
|
|
@@ -145,7 +146,7 @@ This client has no task-escrow API or framework-native plugin manifest.
|
|
|
145
146
|
|
|
146
147
|
## Reviewed purchases from Envar
|
|
147
148
|
|
|
148
|
-
|
|
149
|
+
Use the published Python EnvarPay 0.1.0a10 service with this client. `walletPolicy()` reads limits
|
|
149
150
|
and already-approved peers. `callAgent()` selects only a peer bound to the reviewed
|
|
150
151
|
Agent and endpoint IDs; it never adds a directory candidate to wallet policy. Supply
|
|
151
152
|
`expectedNetwork`, `expectedPayTo` and `expectedAmountAtomic` from the terms you
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
1
2
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
3
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
4
|
+
const packageIdentity = createRequire(import.meta.url)('../package.json');
|
|
3
5
|
/** A wallet refusal or execution error, preserved from the MCP tool response. */
|
|
4
6
|
export class WalletToolError extends Error {
|
|
5
7
|
tool;
|
|
@@ -55,7 +57,7 @@ export class WalletClient {
|
|
|
55
57
|
const timeoutMs = options.timeoutMs ?? 300_000;
|
|
56
58
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0)
|
|
57
59
|
throw new TypeError('timeoutMs must be positive');
|
|
58
|
-
const client = new Client({ name:
|
|
60
|
+
const client = new Client({ name: packageIdentity.name, version: packageIdentity.version });
|
|
59
61
|
const transport = new StreamableHTTPClientTransport(url, {
|
|
60
62
|
requestInit: { headers: { Authorization: `Bearer ${options.token}` }, redirect: 'error' },
|
|
61
63
|
});
|