@dominusnode/sdk 1.1.2 → 1.2.0
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 +3 -3
- package/dist/cjs/auth.d.ts +1 -0
- package/dist/cjs/auth.js +75 -1
- package/dist/cjs/client.d.ts +2 -0
- package/dist/cjs/client.js +3 -0
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/resources/mpp.d.ts +157 -0
- package/dist/cjs/resources/mpp.js +124 -0
- package/dist/cjs/resources/x402.d.ts +59 -4
- package/dist/cjs/resources/x402.js +39 -5
- package/dist/esm/auth.d.ts +1 -0
- package/dist/esm/auth.js +42 -1
- package/dist/esm/client.d.ts +2 -0
- package/dist/esm/client.js +3 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +2 -1
- package/dist/esm/resources/mpp.d.ts +157 -0
- package/dist/esm/resources/mpp.js +120 -0
- package/dist/esm/resources/x402.d.ts +59 -4
- package/dist/esm/resources/x402.js +38 -4
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ const proxyUrl = client.proxy.buildUrl('dn_live_your_key', {
|
|
|
46
46
|
city: 'losangeles',
|
|
47
47
|
});
|
|
48
48
|
console.log(proxyUrl);
|
|
49
|
-
// => http://user-
|
|
49
|
+
// => http://user-country-US-state-california-city-losangeles:dn_live_your_key@proxy.dominusnode.com:8080
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
## Authentication
|
|
@@ -291,11 +291,11 @@ const geoUrl = client.proxy.buildUrl('dn_live_key', {
|
|
|
291
291
|
city: 'losangeles',
|
|
292
292
|
sessionId: 'sticky123',
|
|
293
293
|
});
|
|
294
|
-
// => http://user-
|
|
294
|
+
// => http://user-country-US-state-california-city-losangeles-session-sticky123:dn_live_key@proxy.dominusnode.com:8080
|
|
295
295
|
|
|
296
296
|
// ASN targeting
|
|
297
297
|
const asnUrl = client.proxy.buildUrl('dn_live_key', { asn: 7922 });
|
|
298
|
-
// => http://user-
|
|
298
|
+
// => http://user-asn-7922:dn_live_key@proxy.dominusnode.com:8080
|
|
299
299
|
|
|
300
300
|
// Proxy health (no auth required)
|
|
301
301
|
const health = await client.proxy.getHealth();
|
package/dist/cjs/auth.d.ts
CHANGED
package/dist/cjs/auth.js
CHANGED
|
@@ -1,13 +1,87 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.AuthResource = void 0;
|
|
37
|
+
const crypto = __importStar(require("node:crypto"));
|
|
38
|
+
const POW_MAX_NONCE = 100_000_000;
|
|
39
|
+
function countLeadingZeroBits(hash) {
|
|
40
|
+
let count = 0;
|
|
41
|
+
for (const byte of hash) {
|
|
42
|
+
if (byte === 0) {
|
|
43
|
+
count += 8;
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
let mask = 0x80;
|
|
47
|
+
while (mask && !(byte & mask)) {
|
|
48
|
+
count += 1;
|
|
49
|
+
mask >>= 1;
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return count;
|
|
55
|
+
}
|
|
4
56
|
class AuthResource {
|
|
5
57
|
http;
|
|
6
58
|
constructor(http) {
|
|
7
59
|
this.http = http;
|
|
8
60
|
}
|
|
61
|
+
async solvePoW() {
|
|
62
|
+
try {
|
|
63
|
+
const challenge = await this.http.post("/api/auth/pow/challenge", {}, false);
|
|
64
|
+
const { challengeId, prefix } = challenge;
|
|
65
|
+
const difficulty = Math.min(challenge.difficulty, 32);
|
|
66
|
+
for (let nonce = 0; nonce < POW_MAX_NONCE; nonce++) {
|
|
67
|
+
const hash = crypto.createHash("sha256").update(prefix + nonce).digest();
|
|
68
|
+
if (countLeadingZeroBits(hash) >= difficulty) {
|
|
69
|
+
return { challengeId, nonce };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
9
78
|
async register(email, password) {
|
|
10
|
-
|
|
79
|
+
const pow = await this.solvePoW();
|
|
80
|
+
const body = { email, password };
|
|
81
|
+
if (pow) {
|
|
82
|
+
body.pow = pow;
|
|
83
|
+
}
|
|
84
|
+
return this.http.post("/api/auth/register", body, false);
|
|
11
85
|
}
|
|
12
86
|
async login(email, password) {
|
|
13
87
|
return this.http.post("/api/auth/login", { email, password }, false);
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
|
11
11
|
import { TeamsResource } from "./resources/teams.js";
|
|
12
12
|
import { X402Resource } from "./resources/x402.js";
|
|
13
13
|
import { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
14
|
+
import { MppResource } from "./resources/mpp.js";
|
|
14
15
|
import type { DominusNodeConfig, LoginResult } from "./types.js";
|
|
15
16
|
export declare class DominusNodeClient {
|
|
16
17
|
readonly auth: AuthResource;
|
|
@@ -26,6 +27,7 @@ export declare class DominusNodeClient {
|
|
|
26
27
|
readonly teams: TeamsResource;
|
|
27
28
|
readonly x402: X402Resource;
|
|
28
29
|
readonly walletAuth: WalletAuthResource;
|
|
30
|
+
readonly mpp: MppResource;
|
|
29
31
|
private tokenManager;
|
|
30
32
|
private http;
|
|
31
33
|
private apiKey;
|
package/dist/cjs/client.js
CHANGED
|
@@ -16,6 +16,7 @@ const agent_wallet_js_1 = require("./resources/agent-wallet.js");
|
|
|
16
16
|
const teams_js_1 = require("./resources/teams.js");
|
|
17
17
|
const x402_js_1 = require("./resources/x402.js");
|
|
18
18
|
const wallet_auth_js_1 = require("./resources/wallet-auth.js");
|
|
19
|
+
const mpp_js_1 = require("./resources/mpp.js");
|
|
19
20
|
const constants_js_1 = require("./constants.js");
|
|
20
21
|
class DominusNodeClient {
|
|
21
22
|
auth;
|
|
@@ -31,6 +32,7 @@ class DominusNodeClient {
|
|
|
31
32
|
teams;
|
|
32
33
|
x402;
|
|
33
34
|
walletAuth;
|
|
35
|
+
mpp;
|
|
34
36
|
tokenManager;
|
|
35
37
|
http;
|
|
36
38
|
apiKey = null;
|
|
@@ -53,6 +55,7 @@ class DominusNodeClient {
|
|
|
53
55
|
this.teams = new teams_js_1.TeamsResource(this.http);
|
|
54
56
|
this.x402 = new x402_js_1.X402Resource(this.http);
|
|
55
57
|
this.walletAuth = new wallet_auth_js_1.WalletAuthResource(this.http, this.tokenManager);
|
|
58
|
+
this.mpp = new mpp_js_1.MppResource(this.http);
|
|
56
59
|
// Set refresh function AFTER auth is initialized
|
|
57
60
|
this.tokenManager.setRefreshFunction(async (rt) => {
|
|
58
61
|
const res = await this.auth.refresh(rt);
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
|
18
18
|
export type { AgenticWallet, AgenticWalletTransaction, AgenticWalletListResponse, AgenticWalletFundResponse, AgenticWalletTransactionsResponse, AgenticWalletDeleteResponse, } from "./resources/agent-wallet.js";
|
|
19
19
|
export { TeamsResource } from "./resources/teams.js";
|
|
20
20
|
export type { Team, TeamMember, TeamInvite, TeamListResponse, TeamMembersResponse, TeamInvitesResponse, TeamKeysResponse, TeamKeyCreateResponse, TeamDeleteResponse, TeamFundResponse, TeamTransactionsResponse, } from "./resources/teams.js";
|
|
21
|
-
export { X402Resource } from "./resources/x402.js";
|
|
22
|
-
export type { X402Info, X402Facilitator, X402Pricing, } from "./resources/x402.js";
|
|
21
|
+
export { X402Resource, X402_PROTOCOL_VERSION, X402_HEADERS } from "./resources/x402.js";
|
|
22
|
+
export type { X402Info, X402Facilitator, X402PaymentHeaders, X402Pricing, X402Scheme, X402Token, } from "./resources/x402.js";
|
|
23
23
|
export { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
24
24
|
export type { WalletChallenge, WalletVerifyResult, WalletLinkResult, } from "./resources/wallet-auth.js";
|
|
25
|
+
export { MppResource } from "./resources/mpp.js";
|
|
26
|
+
export type { MppInfo, MppPricing, MppLimits, MppTopUpResponse, MppSessionResponse, MppCloseResponse, MppSessionStatus, MppChallengeResponse, MppCredentialPayload, } from "./resources/mpp.js";
|
|
25
27
|
export type { DateRangeOptions as AdminDateRangeOptions, ListUsersResponse, GetUserResponse, RevenueResponse, DailyRevenueEntry, DailyRevenueResponse, } from "./admin.js";
|
|
26
28
|
export { HttpClient } from "./http.js";
|
|
27
29
|
export type { HttpOptions } from "./http.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SOCKS5_PROXY_PORT = exports.DEFAULT_HTTP_PROXY_PORT = exports.DEFAULT_PROXY_HOST = exports.DEFAULT_BASE_URL = exports.USER_AGENT = exports.SDK_VERSION = exports.ProxyError = exports.NetworkError = exports.ServerError = exports.ConflictError = exports.NotFoundError = exports.ValidationError = exports.InsufficientBalanceError = exports.RateLimitError = exports.AuthorizationError = exports.AuthenticationError = exports.DominusNodeError = exports.HttpClient = exports.WalletAuthResource = exports.X402Resource = exports.TeamsResource = exports.AgenticWalletResource = exports.SlotsResource = exports.AdminResource = exports.ProxyResource = exports.SessionsResource = exports.PlansResource = exports.UsageResource = exports.WalletResource = exports.KeysResource = exports.AuthResource = exports.DominusNodeClient = void 0;
|
|
3
|
+
exports.DEFAULT_SOCKS5_PROXY_PORT = exports.DEFAULT_HTTP_PROXY_PORT = exports.DEFAULT_PROXY_HOST = exports.DEFAULT_BASE_URL = exports.USER_AGENT = exports.SDK_VERSION = exports.ProxyError = exports.NetworkError = exports.ServerError = exports.ConflictError = exports.NotFoundError = exports.ValidationError = exports.InsufficientBalanceError = exports.RateLimitError = exports.AuthorizationError = exports.AuthenticationError = exports.DominusNodeError = exports.HttpClient = exports.MppResource = exports.WalletAuthResource = exports.X402_HEADERS = exports.X402_PROTOCOL_VERSION = exports.X402Resource = exports.TeamsResource = exports.AgenticWalletResource = exports.SlotsResource = exports.AdminResource = exports.ProxyResource = exports.SessionsResource = exports.PlansResource = exports.UsageResource = exports.WalletResource = exports.KeysResource = exports.AuthResource = exports.DominusNodeClient = void 0;
|
|
4
4
|
// Main client
|
|
5
5
|
var client_js_1 = require("./client.js");
|
|
6
6
|
Object.defineProperty(exports, "DominusNodeClient", { enumerable: true, get: function () { return client_js_1.DominusNodeClient; } });
|
|
@@ -29,8 +29,12 @@ var teams_js_1 = require("./resources/teams.js");
|
|
|
29
29
|
Object.defineProperty(exports, "TeamsResource", { enumerable: true, get: function () { return teams_js_1.TeamsResource; } });
|
|
30
30
|
var x402_js_1 = require("./resources/x402.js");
|
|
31
31
|
Object.defineProperty(exports, "X402Resource", { enumerable: true, get: function () { return x402_js_1.X402Resource; } });
|
|
32
|
+
Object.defineProperty(exports, "X402_PROTOCOL_VERSION", { enumerable: true, get: function () { return x402_js_1.X402_PROTOCOL_VERSION; } });
|
|
33
|
+
Object.defineProperty(exports, "X402_HEADERS", { enumerable: true, get: function () { return x402_js_1.X402_HEADERS; } });
|
|
32
34
|
var wallet_auth_js_1 = require("./resources/wallet-auth.js");
|
|
33
35
|
Object.defineProperty(exports, "WalletAuthResource", { enumerable: true, get: function () { return wallet_auth_js_1.WalletAuthResource; } });
|
|
36
|
+
var mpp_js_1 = require("./resources/mpp.js");
|
|
37
|
+
Object.defineProperty(exports, "MppResource", { enumerable: true, get: function () { return mpp_js_1.MppResource; } });
|
|
34
38
|
// Infrastructure (HttpClient for advanced custom integrations)
|
|
35
39
|
var http_js_1 = require("./http.js");
|
|
36
40
|
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_js_1.HttpClient; } });
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
export interface MppInfo {
|
|
3
|
+
supported: boolean;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
protocol: string;
|
|
6
|
+
version: string;
|
|
7
|
+
methods: string[];
|
|
8
|
+
pricing: MppPricing;
|
|
9
|
+
limits: MppLimits;
|
|
10
|
+
}
|
|
11
|
+
export interface MppPricing {
|
|
12
|
+
perGbCents: number;
|
|
13
|
+
depositMinCents: number;
|
|
14
|
+
currency: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MppLimits {
|
|
17
|
+
maxDepositCents: number;
|
|
18
|
+
maxSessionDurationSeconds: number;
|
|
19
|
+
}
|
|
20
|
+
export interface MppTopUpResponse {
|
|
21
|
+
success: boolean;
|
|
22
|
+
amountCents: number;
|
|
23
|
+
method: string;
|
|
24
|
+
transactionId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MppSessionResponse {
|
|
27
|
+
channelId: string;
|
|
28
|
+
depositCents: number;
|
|
29
|
+
method: string;
|
|
30
|
+
poolType: string;
|
|
31
|
+
expiresAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MppCloseResponse {
|
|
34
|
+
channelId: string;
|
|
35
|
+
refundedCents: number;
|
|
36
|
+
usedCents: number;
|
|
37
|
+
closed: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface MppSessionStatus {
|
|
40
|
+
channelId: string;
|
|
41
|
+
status: string;
|
|
42
|
+
depositCents: number;
|
|
43
|
+
usedCents: number;
|
|
44
|
+
method: string;
|
|
45
|
+
poolType: string;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
expiresAt: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* MPP challenge response returned by POST /api/mpp/challenge.
|
|
51
|
+
* Used for keyless proxy access -- AI agents can use the proxy
|
|
52
|
+
* without any API key by solving a challenge and paying per request.
|
|
53
|
+
*/
|
|
54
|
+
export interface MppChallengeResponse {
|
|
55
|
+
challengeId: string;
|
|
56
|
+
nonce: string;
|
|
57
|
+
expiresAt: string;
|
|
58
|
+
poolType: string;
|
|
59
|
+
credential: MppCredentialPayload;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Credential payload for keyless MPP proxy access.
|
|
63
|
+
* Pass this to `buildProxyHeaders()` to construct the headers
|
|
64
|
+
* needed to route through the proxy without an API key.
|
|
65
|
+
*/
|
|
66
|
+
export interface MppCredentialPayload {
|
|
67
|
+
challengeId: string;
|
|
68
|
+
nonce: string;
|
|
69
|
+
poolType: string;
|
|
70
|
+
sessionToken?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Micropayment Payment Protocol (MPP) resource.
|
|
74
|
+
*
|
|
75
|
+
* Provides pay-per-use proxy sessions with real-time micropayment channels.
|
|
76
|
+
* Supports multiple payment methods: Tempo streaming, Stripe SPT, and Lightning.
|
|
77
|
+
*
|
|
78
|
+
* MPP also enables keyless proxy access for AI agents: call `getChallenge()` to
|
|
79
|
+
* obtain a credential, then use `buildProxyHeaders()` to construct the proxy
|
|
80
|
+
* Authorization header -- no API key needed.
|
|
81
|
+
*/
|
|
82
|
+
export declare class MppResource {
|
|
83
|
+
private http;
|
|
84
|
+
constructor(http: HttpClient);
|
|
85
|
+
/**
|
|
86
|
+
* Get MPP protocol information including supported methods, pricing, and limits.
|
|
87
|
+
*
|
|
88
|
+
* This endpoint does not require authentication.
|
|
89
|
+
*/
|
|
90
|
+
getInfo(): Promise<MppInfo>;
|
|
91
|
+
/**
|
|
92
|
+
* Request an MPP challenge for keyless proxy access.
|
|
93
|
+
*
|
|
94
|
+
* This endpoint does not require authentication. The returned credential
|
|
95
|
+
* can be used with `buildProxyHeaders()` to access the proxy without an API key.
|
|
96
|
+
*
|
|
97
|
+
* @param poolType - Proxy pool type: "dc" (datacenter, $3/GB) or "residential" ($5/GB)
|
|
98
|
+
*/
|
|
99
|
+
getChallenge(poolType: "dc" | "residential"): Promise<MppChallengeResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Build proxy Authorization header for keyless MPP access.
|
|
102
|
+
*
|
|
103
|
+
* Returns headers that should be set on the HTTP CONNECT / proxy request
|
|
104
|
+
* to route through the proxy without an API key.
|
|
105
|
+
*
|
|
106
|
+
* @param credential - The credential payload from `getChallenge()`
|
|
107
|
+
* @returns Headers object with `Authorization: MPP <json>`
|
|
108
|
+
*/
|
|
109
|
+
buildProxyHeaders(credential: MppCredentialPayload): Record<string, string>;
|
|
110
|
+
/**
|
|
111
|
+
* Build proxy session token header for ongoing MPP sessions.
|
|
112
|
+
*
|
|
113
|
+
* After opening a session, use the session token for subsequent requests
|
|
114
|
+
* within the same session.
|
|
115
|
+
*
|
|
116
|
+
* @param sessionToken - The session token from an active MPP session
|
|
117
|
+
* @returns Headers object with `MPP-SESSION-TOKEN`
|
|
118
|
+
*/
|
|
119
|
+
buildSessionHeaders(sessionToken: string): Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* Top up MPP balance using the specified payment method.
|
|
122
|
+
*
|
|
123
|
+
* Requires authentication (wallet credit needs a user account).
|
|
124
|
+
*
|
|
125
|
+
* @param amountCents - Amount to top up in cents (must be > 0 and <= 2,147,483,647)
|
|
126
|
+
* @param method - Payment method: "tempo", "stripe_spt", or "lightning"
|
|
127
|
+
*/
|
|
128
|
+
topUp(amountCents: number, method: "tempo" | "stripe_spt" | "lightning"): Promise<MppTopUpResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Open a new micropayment session channel.
|
|
131
|
+
*
|
|
132
|
+
* This endpoint does not require authentication -- anonymous agents can
|
|
133
|
+
* open sessions by providing a payment method and deposit.
|
|
134
|
+
*
|
|
135
|
+
* @param opts.maxDepositCents - Maximum deposit for the session in cents
|
|
136
|
+
* @param opts.method - Payment method identifier
|
|
137
|
+
* @param opts.poolType - Proxy pool type (e.g. "dc", "residential")
|
|
138
|
+
*/
|
|
139
|
+
openSession(opts: {
|
|
140
|
+
maxDepositCents: number;
|
|
141
|
+
method: string;
|
|
142
|
+
poolType: string;
|
|
143
|
+
}): Promise<MppSessionResponse>;
|
|
144
|
+
/**
|
|
145
|
+
* Close an active micropayment session channel.
|
|
146
|
+
* Any unused deposit is refunded.
|
|
147
|
+
*
|
|
148
|
+
* @param channelId - The channel ID to close
|
|
149
|
+
*/
|
|
150
|
+
closeSession(channelId: string): Promise<MppCloseResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Get the status of a micropayment session channel.
|
|
153
|
+
*
|
|
154
|
+
* @param channelId - The channel ID to query
|
|
155
|
+
*/
|
|
156
|
+
getSession(channelId: string): Promise<MppSessionStatus>;
|
|
157
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MppResource = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Micropayment Payment Protocol (MPP) resource.
|
|
6
|
+
*
|
|
7
|
+
* Provides pay-per-use proxy sessions with real-time micropayment channels.
|
|
8
|
+
* Supports multiple payment methods: Tempo streaming, Stripe SPT, and Lightning.
|
|
9
|
+
*
|
|
10
|
+
* MPP also enables keyless proxy access for AI agents: call `getChallenge()` to
|
|
11
|
+
* obtain a credential, then use `buildProxyHeaders()` to construct the proxy
|
|
12
|
+
* Authorization header -- no API key needed.
|
|
13
|
+
*/
|
|
14
|
+
class MppResource {
|
|
15
|
+
http;
|
|
16
|
+
constructor(http) {
|
|
17
|
+
this.http = http;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get MPP protocol information including supported methods, pricing, and limits.
|
|
21
|
+
*
|
|
22
|
+
* This endpoint does not require authentication.
|
|
23
|
+
*/
|
|
24
|
+
async getInfo() {
|
|
25
|
+
return this.http.get("/api/mpp/info", false);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Request an MPP challenge for keyless proxy access.
|
|
29
|
+
*
|
|
30
|
+
* This endpoint does not require authentication. The returned credential
|
|
31
|
+
* can be used with `buildProxyHeaders()` to access the proxy without an API key.
|
|
32
|
+
*
|
|
33
|
+
* @param poolType - Proxy pool type: "dc" (datacenter, $3/GB) or "residential" ($5/GB)
|
|
34
|
+
*/
|
|
35
|
+
async getChallenge(poolType) {
|
|
36
|
+
if (poolType !== "dc" && poolType !== "residential") {
|
|
37
|
+
throw new Error("poolType must be 'dc' or 'residential'");
|
|
38
|
+
}
|
|
39
|
+
return this.http.post("/api/mpp/challenge", { poolType }, false);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Build proxy Authorization header for keyless MPP access.
|
|
43
|
+
*
|
|
44
|
+
* Returns headers that should be set on the HTTP CONNECT / proxy request
|
|
45
|
+
* to route through the proxy without an API key.
|
|
46
|
+
*
|
|
47
|
+
* @param credential - The credential payload from `getChallenge()`
|
|
48
|
+
* @returns Headers object with `Authorization: MPP <json>`
|
|
49
|
+
*/
|
|
50
|
+
buildProxyHeaders(credential) {
|
|
51
|
+
return {
|
|
52
|
+
Authorization: "MPP " + JSON.stringify(credential),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Build proxy session token header for ongoing MPP sessions.
|
|
57
|
+
*
|
|
58
|
+
* After opening a session, use the session token for subsequent requests
|
|
59
|
+
* within the same session.
|
|
60
|
+
*
|
|
61
|
+
* @param sessionToken - The session token from an active MPP session
|
|
62
|
+
* @returns Headers object with `MPP-SESSION-TOKEN`
|
|
63
|
+
*/
|
|
64
|
+
buildSessionHeaders(sessionToken) {
|
|
65
|
+
if (!sessionToken || typeof sessionToken !== "string") {
|
|
66
|
+
throw new Error("sessionToken must be a non-empty string");
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
"MPP-SESSION-TOKEN": sessionToken,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Top up MPP balance using the specified payment method.
|
|
74
|
+
*
|
|
75
|
+
* Requires authentication (wallet credit needs a user account).
|
|
76
|
+
*
|
|
77
|
+
* @param amountCents - Amount to top up in cents (must be > 0 and <= 2,147,483,647)
|
|
78
|
+
* @param method - Payment method: "tempo", "stripe_spt", or "lightning"
|
|
79
|
+
*/
|
|
80
|
+
async topUp(amountCents, method) {
|
|
81
|
+
if (!Number.isInteger(amountCents) || amountCents <= 0 || amountCents > 2_147_483_647) {
|
|
82
|
+
throw new Error("amountCents must be a positive integer <= 2,147,483,647");
|
|
83
|
+
}
|
|
84
|
+
return this.http.post("/api/mpp/topup", { amountCents, method });
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Open a new micropayment session channel.
|
|
88
|
+
*
|
|
89
|
+
* This endpoint does not require authentication -- anonymous agents can
|
|
90
|
+
* open sessions by providing a payment method and deposit.
|
|
91
|
+
*
|
|
92
|
+
* @param opts.maxDepositCents - Maximum deposit for the session in cents
|
|
93
|
+
* @param opts.method - Payment method identifier
|
|
94
|
+
* @param opts.poolType - Proxy pool type (e.g. "dc", "residential")
|
|
95
|
+
*/
|
|
96
|
+
async openSession(opts) {
|
|
97
|
+
if (!Number.isInteger(opts.maxDepositCents) || opts.maxDepositCents <= 0 || opts.maxDepositCents > 2_147_483_647) {
|
|
98
|
+
throw new Error("maxDepositCents must be a positive integer <= 2,147,483,647");
|
|
99
|
+
}
|
|
100
|
+
return this.http.post("/api/mpp/session/open", {
|
|
101
|
+
maxDepositCents: opts.maxDepositCents,
|
|
102
|
+
method: opts.method,
|
|
103
|
+
poolType: opts.poolType,
|
|
104
|
+
}, false);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Close an active micropayment session channel.
|
|
108
|
+
* Any unused deposit is refunded.
|
|
109
|
+
*
|
|
110
|
+
* @param channelId - The channel ID to close
|
|
111
|
+
*/
|
|
112
|
+
async closeSession(channelId) {
|
|
113
|
+
return this.http.post("/api/mpp/session/close", { channelId });
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Get the status of a micropayment session channel.
|
|
117
|
+
*
|
|
118
|
+
* @param channelId - The channel ID to query
|
|
119
|
+
*/
|
|
120
|
+
async getSession(channelId) {
|
|
121
|
+
return this.http.get(`/api/mpp/session/${encodeURIComponent(channelId)}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.MppResource = MppResource;
|
|
@@ -1,37 +1,92 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
+
/**
|
|
3
|
+
* x402 V2 protocol version.
|
|
4
|
+
* V2 uses CAIP-2 network identifiers (e.g. "eip155:8453" instead of "base").
|
|
5
|
+
*/
|
|
6
|
+
export declare const X402_PROTOCOL_VERSION = "2";
|
|
7
|
+
/**
|
|
8
|
+
* x402 V2 header constants.
|
|
9
|
+
* V2 renamed the payment headers. Servers should accept both old and new
|
|
10
|
+
* for backward compatibility during the transition period.
|
|
11
|
+
*/
|
|
12
|
+
export declare const X402_HEADERS: {
|
|
13
|
+
/** V2 payment header (replaces V1 "X-PAYMENT"). */
|
|
14
|
+
readonly PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE";
|
|
15
|
+
/** V1 legacy payment header — kept for backward compatibility. */
|
|
16
|
+
readonly PAYMENT_SIGNATURE_LEGACY: "X-PAYMENT";
|
|
17
|
+
/** V2 payment response header (replaces V1 "X-PAYMENT-RESPONSE"). */
|
|
18
|
+
readonly PAYMENT_RESPONSE: "PAYMENT-RESPONSE";
|
|
19
|
+
/** V1 legacy payment response header. */
|
|
20
|
+
readonly PAYMENT_RESPONSE_LEGACY: "X-PAYMENT-RESPONSE";
|
|
21
|
+
/** V2 payment requirements header. */
|
|
22
|
+
readonly PAYMENT_REQUIRED: "PAYMENT-REQUIRED";
|
|
23
|
+
};
|
|
24
|
+
/** Payment scheme supported by x402. "exact" is the original; "permit2" is new in V2. */
|
|
25
|
+
export type X402Scheme = "exact" | "permit2";
|
|
26
|
+
/** Token supported by x402. V2 adds EURC alongside USDC. */
|
|
27
|
+
export type X402Token = "USDC" | "EURC";
|
|
2
28
|
export interface X402Facilitator {
|
|
3
29
|
address: string;
|
|
4
30
|
chain: string;
|
|
31
|
+
/** Human-readable network name (e.g. "base", "ethereum"). */
|
|
5
32
|
network: string;
|
|
33
|
+
/** CAIP-2 network identifier (e.g. "eip155:8453"). Added in V2. */
|
|
34
|
+
networkId: string;
|
|
6
35
|
}
|
|
7
36
|
export interface X402Pricing {
|
|
8
37
|
perRequestCents: number;
|
|
9
38
|
perGbCents: number;
|
|
10
39
|
currency: string;
|
|
11
40
|
}
|
|
41
|
+
export interface X402PaymentHeaders {
|
|
42
|
+
/** Header the client sends with the payment signature. */
|
|
43
|
+
request: string;
|
|
44
|
+
/** Header the server returns with the payment response. */
|
|
45
|
+
response: string;
|
|
46
|
+
/** Header the server uses to indicate payment requirements. */
|
|
47
|
+
required: string;
|
|
48
|
+
}
|
|
12
49
|
export interface X402Info {
|
|
13
50
|
supported: boolean;
|
|
14
51
|
enabled: boolean;
|
|
15
52
|
protocol: string;
|
|
53
|
+
/** Protocol version — "2" for x402 V2. */
|
|
16
54
|
version: string;
|
|
17
55
|
facilitators: X402Facilitator[];
|
|
18
56
|
pricing: X402Pricing;
|
|
57
|
+
/** Supported token symbols (e.g. ["USDC", "EURC"]). */
|
|
19
58
|
currencies: string[];
|
|
59
|
+
/** Supported payment schemes (e.g. ["exact", "permit2"]). */
|
|
60
|
+
schemes: string[];
|
|
20
61
|
walletType: string;
|
|
21
62
|
agenticWallets: boolean;
|
|
63
|
+
/** Header names used by this protocol version. */
|
|
64
|
+
paymentHeaders: X402PaymentHeaders;
|
|
22
65
|
}
|
|
23
66
|
/**
|
|
24
|
-
* x402 (HTTP 402 Payment Required) protocol information.
|
|
67
|
+
* x402 V2 (HTTP 402 Payment Required) protocol information.
|
|
25
68
|
*
|
|
26
69
|
* Provides details about x402 micropayment support, facilitator addresses,
|
|
27
|
-
* pricing,
|
|
70
|
+
* pricing, supported chains/currencies, and payment schemes for AI agent
|
|
71
|
+
* payments.
|
|
72
|
+
*
|
|
73
|
+
* V2 changes from V1:
|
|
74
|
+
* - Protocol version "2" (was "1")
|
|
75
|
+
* - CAIP-2 network IDs (e.g. "eip155:8453" instead of "base")
|
|
76
|
+
* - Payment header: PAYMENT-SIGNATURE (was X-PAYMENT)
|
|
77
|
+
* - Response header: PAYMENT-RESPONSE (was X-PAYMENT-RESPONSE)
|
|
78
|
+
* - Requirements header: PAYMENT-REQUIRED
|
|
79
|
+
* - New token: EURC (in addition to USDC)
|
|
80
|
+
* - New scheme: permit2 (in addition to exact)
|
|
81
|
+
* - Additional facilitator chains: Ethereum (eip155:1), Optimism (eip155:10),
|
|
82
|
+
* Arbitrum (eip155:42161), and Solana
|
|
28
83
|
*/
|
|
29
84
|
export declare class X402Resource {
|
|
30
85
|
private http;
|
|
31
86
|
constructor(http: HttpClient);
|
|
32
87
|
/**
|
|
33
|
-
* Get x402 protocol information including facilitator details,
|
|
34
|
-
* pricing, supported chains, and
|
|
88
|
+
* Get x402 V2 protocol information including facilitator details,
|
|
89
|
+
* pricing, supported chains, currencies, and payment schemes.
|
|
35
90
|
*
|
|
36
91
|
* This endpoint does not require authentication.
|
|
37
92
|
*/
|
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.X402Resource = void 0;
|
|
3
|
+
exports.X402Resource = exports.X402_HEADERS = exports.X402_PROTOCOL_VERSION = void 0;
|
|
4
4
|
/**
|
|
5
|
-
* x402
|
|
5
|
+
* x402 V2 protocol version.
|
|
6
|
+
* V2 uses CAIP-2 network identifiers (e.g. "eip155:8453" instead of "base").
|
|
7
|
+
*/
|
|
8
|
+
exports.X402_PROTOCOL_VERSION = "2";
|
|
9
|
+
/**
|
|
10
|
+
* x402 V2 header constants.
|
|
11
|
+
* V2 renamed the payment headers. Servers should accept both old and new
|
|
12
|
+
* for backward compatibility during the transition period.
|
|
13
|
+
*/
|
|
14
|
+
exports.X402_HEADERS = {
|
|
15
|
+
/** V2 payment header (replaces V1 "X-PAYMENT"). */
|
|
16
|
+
PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE",
|
|
17
|
+
/** V1 legacy payment header — kept for backward compatibility. */
|
|
18
|
+
PAYMENT_SIGNATURE_LEGACY: "X-PAYMENT",
|
|
19
|
+
/** V2 payment response header (replaces V1 "X-PAYMENT-RESPONSE"). */
|
|
20
|
+
PAYMENT_RESPONSE: "PAYMENT-RESPONSE",
|
|
21
|
+
/** V1 legacy payment response header. */
|
|
22
|
+
PAYMENT_RESPONSE_LEGACY: "X-PAYMENT-RESPONSE",
|
|
23
|
+
/** V2 payment requirements header. */
|
|
24
|
+
PAYMENT_REQUIRED: "PAYMENT-REQUIRED",
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* x402 V2 (HTTP 402 Payment Required) protocol information.
|
|
6
28
|
*
|
|
7
29
|
* Provides details about x402 micropayment support, facilitator addresses,
|
|
8
|
-
* pricing,
|
|
30
|
+
* pricing, supported chains/currencies, and payment schemes for AI agent
|
|
31
|
+
* payments.
|
|
32
|
+
*
|
|
33
|
+
* V2 changes from V1:
|
|
34
|
+
* - Protocol version "2" (was "1")
|
|
35
|
+
* - CAIP-2 network IDs (e.g. "eip155:8453" instead of "base")
|
|
36
|
+
* - Payment header: PAYMENT-SIGNATURE (was X-PAYMENT)
|
|
37
|
+
* - Response header: PAYMENT-RESPONSE (was X-PAYMENT-RESPONSE)
|
|
38
|
+
* - Requirements header: PAYMENT-REQUIRED
|
|
39
|
+
* - New token: EURC (in addition to USDC)
|
|
40
|
+
* - New scheme: permit2 (in addition to exact)
|
|
41
|
+
* - Additional facilitator chains: Ethereum (eip155:1), Optimism (eip155:10),
|
|
42
|
+
* Arbitrum (eip155:42161), and Solana
|
|
9
43
|
*/
|
|
10
44
|
class X402Resource {
|
|
11
45
|
http;
|
|
@@ -13,8 +47,8 @@ class X402Resource {
|
|
|
13
47
|
this.http = http;
|
|
14
48
|
}
|
|
15
49
|
/**
|
|
16
|
-
* Get x402 protocol information including facilitator details,
|
|
17
|
-
* pricing, supported chains, and
|
|
50
|
+
* Get x402 V2 protocol information including facilitator details,
|
|
51
|
+
* pricing, supported chains, currencies, and payment schemes.
|
|
18
52
|
*
|
|
19
53
|
* This endpoint does not require authentication.
|
|
20
54
|
*/
|
package/dist/esm/auth.d.ts
CHANGED
package/dist/esm/auth.js
CHANGED
|
@@ -1,10 +1,51 @@
|
|
|
1
|
+
import * as crypto from "node:crypto";
|
|
2
|
+
const POW_MAX_NONCE = 100_000_000;
|
|
3
|
+
function countLeadingZeroBits(hash) {
|
|
4
|
+
let count = 0;
|
|
5
|
+
for (const byte of hash) {
|
|
6
|
+
if (byte === 0) {
|
|
7
|
+
count += 8;
|
|
8
|
+
}
|
|
9
|
+
else {
|
|
10
|
+
let mask = 0x80;
|
|
11
|
+
while (mask && !(byte & mask)) {
|
|
12
|
+
count += 1;
|
|
13
|
+
mask >>= 1;
|
|
14
|
+
}
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return count;
|
|
19
|
+
}
|
|
1
20
|
export class AuthResource {
|
|
2
21
|
http;
|
|
3
22
|
constructor(http) {
|
|
4
23
|
this.http = http;
|
|
5
24
|
}
|
|
25
|
+
async solvePoW() {
|
|
26
|
+
try {
|
|
27
|
+
const challenge = await this.http.post("/api/auth/pow/challenge", {}, false);
|
|
28
|
+
const { challengeId, prefix } = challenge;
|
|
29
|
+
const difficulty = Math.min(challenge.difficulty, 32);
|
|
30
|
+
for (let nonce = 0; nonce < POW_MAX_NONCE; nonce++) {
|
|
31
|
+
const hash = crypto.createHash("sha256").update(prefix + nonce).digest();
|
|
32
|
+
if (countLeadingZeroBits(hash) >= difficulty) {
|
|
33
|
+
return { challengeId, nonce };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
6
42
|
async register(email, password) {
|
|
7
|
-
|
|
43
|
+
const pow = await this.solvePoW();
|
|
44
|
+
const body = { email, password };
|
|
45
|
+
if (pow) {
|
|
46
|
+
body.pow = pow;
|
|
47
|
+
}
|
|
48
|
+
return this.http.post("/api/auth/register", body, false);
|
|
8
49
|
}
|
|
9
50
|
async login(email, password) {
|
|
10
51
|
return this.http.post("/api/auth/login", { email, password }, false);
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
|
11
11
|
import { TeamsResource } from "./resources/teams.js";
|
|
12
12
|
import { X402Resource } from "./resources/x402.js";
|
|
13
13
|
import { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
14
|
+
import { MppResource } from "./resources/mpp.js";
|
|
14
15
|
import type { DominusNodeConfig, LoginResult } from "./types.js";
|
|
15
16
|
export declare class DominusNodeClient {
|
|
16
17
|
readonly auth: AuthResource;
|
|
@@ -26,6 +27,7 @@ export declare class DominusNodeClient {
|
|
|
26
27
|
readonly teams: TeamsResource;
|
|
27
28
|
readonly x402: X402Resource;
|
|
28
29
|
readonly walletAuth: WalletAuthResource;
|
|
30
|
+
readonly mpp: MppResource;
|
|
29
31
|
private tokenManager;
|
|
30
32
|
private http;
|
|
31
33
|
private apiKey;
|
package/dist/esm/client.js
CHANGED
|
@@ -13,6 +13,7 @@ import { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
|
13
13
|
import { TeamsResource } from "./resources/teams.js";
|
|
14
14
|
import { X402Resource } from "./resources/x402.js";
|
|
15
15
|
import { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
16
|
+
import { MppResource } from "./resources/mpp.js";
|
|
16
17
|
import { DEFAULT_BASE_URL } from "./constants.js";
|
|
17
18
|
export class DominusNodeClient {
|
|
18
19
|
auth;
|
|
@@ -28,6 +29,7 @@ export class DominusNodeClient {
|
|
|
28
29
|
teams;
|
|
29
30
|
x402;
|
|
30
31
|
walletAuth;
|
|
32
|
+
mpp;
|
|
31
33
|
tokenManager;
|
|
32
34
|
http;
|
|
33
35
|
apiKey = null;
|
|
@@ -50,6 +52,7 @@ export class DominusNodeClient {
|
|
|
50
52
|
this.teams = new TeamsResource(this.http);
|
|
51
53
|
this.x402 = new X402Resource(this.http);
|
|
52
54
|
this.walletAuth = new WalletAuthResource(this.http, this.tokenManager);
|
|
55
|
+
this.mpp = new MppResource(this.http);
|
|
53
56
|
// Set refresh function AFTER auth is initialized
|
|
54
57
|
this.tokenManager.setRefreshFunction(async (rt) => {
|
|
55
58
|
const res = await this.auth.refresh(rt);
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -18,10 +18,12 @@ export { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
|
18
18
|
export type { AgenticWallet, AgenticWalletTransaction, AgenticWalletListResponse, AgenticWalletFundResponse, AgenticWalletTransactionsResponse, AgenticWalletDeleteResponse, } from "./resources/agent-wallet.js";
|
|
19
19
|
export { TeamsResource } from "./resources/teams.js";
|
|
20
20
|
export type { Team, TeamMember, TeamInvite, TeamListResponse, TeamMembersResponse, TeamInvitesResponse, TeamKeysResponse, TeamKeyCreateResponse, TeamDeleteResponse, TeamFundResponse, TeamTransactionsResponse, } from "./resources/teams.js";
|
|
21
|
-
export { X402Resource } from "./resources/x402.js";
|
|
22
|
-
export type { X402Info, X402Facilitator, X402Pricing, } from "./resources/x402.js";
|
|
21
|
+
export { X402Resource, X402_PROTOCOL_VERSION, X402_HEADERS } from "./resources/x402.js";
|
|
22
|
+
export type { X402Info, X402Facilitator, X402PaymentHeaders, X402Pricing, X402Scheme, X402Token, } from "./resources/x402.js";
|
|
23
23
|
export { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
24
24
|
export type { WalletChallenge, WalletVerifyResult, WalletLinkResult, } from "./resources/wallet-auth.js";
|
|
25
|
+
export { MppResource } from "./resources/mpp.js";
|
|
26
|
+
export type { MppInfo, MppPricing, MppLimits, MppTopUpResponse, MppSessionResponse, MppCloseResponse, MppSessionStatus, MppChallengeResponse, MppCredentialPayload, } from "./resources/mpp.js";
|
|
25
27
|
export type { DateRangeOptions as AdminDateRangeOptions, ListUsersResponse, GetUserResponse, RevenueResponse, DailyRevenueEntry, DailyRevenueResponse, } from "./admin.js";
|
|
26
28
|
export { HttpClient } from "./http.js";
|
|
27
29
|
export type { HttpOptions } from "./http.js";
|
package/dist/esm/index.js
CHANGED
|
@@ -12,8 +12,9 @@ export { AdminResource } from "./admin.js";
|
|
|
12
12
|
export { SlotsResource } from "./slots.js";
|
|
13
13
|
export { AgenticWalletResource } from "./resources/agent-wallet.js";
|
|
14
14
|
export { TeamsResource } from "./resources/teams.js";
|
|
15
|
-
export { X402Resource } from "./resources/x402.js";
|
|
15
|
+
export { X402Resource, X402_PROTOCOL_VERSION, X402_HEADERS } from "./resources/x402.js";
|
|
16
16
|
export { WalletAuthResource } from "./resources/wallet-auth.js";
|
|
17
|
+
export { MppResource } from "./resources/mpp.js";
|
|
17
18
|
// Infrastructure (HttpClient for advanced custom integrations)
|
|
18
19
|
export { HttpClient } from "./http.js";
|
|
19
20
|
// TokenManager is internal — not exported to prevent misuse of token lifecycle
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
export interface MppInfo {
|
|
3
|
+
supported: boolean;
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
protocol: string;
|
|
6
|
+
version: string;
|
|
7
|
+
methods: string[];
|
|
8
|
+
pricing: MppPricing;
|
|
9
|
+
limits: MppLimits;
|
|
10
|
+
}
|
|
11
|
+
export interface MppPricing {
|
|
12
|
+
perGbCents: number;
|
|
13
|
+
depositMinCents: number;
|
|
14
|
+
currency: string;
|
|
15
|
+
}
|
|
16
|
+
export interface MppLimits {
|
|
17
|
+
maxDepositCents: number;
|
|
18
|
+
maxSessionDurationSeconds: number;
|
|
19
|
+
}
|
|
20
|
+
export interface MppTopUpResponse {
|
|
21
|
+
success: boolean;
|
|
22
|
+
amountCents: number;
|
|
23
|
+
method: string;
|
|
24
|
+
transactionId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface MppSessionResponse {
|
|
27
|
+
channelId: string;
|
|
28
|
+
depositCents: number;
|
|
29
|
+
method: string;
|
|
30
|
+
poolType: string;
|
|
31
|
+
expiresAt: string;
|
|
32
|
+
}
|
|
33
|
+
export interface MppCloseResponse {
|
|
34
|
+
channelId: string;
|
|
35
|
+
refundedCents: number;
|
|
36
|
+
usedCents: number;
|
|
37
|
+
closed: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface MppSessionStatus {
|
|
40
|
+
channelId: string;
|
|
41
|
+
status: string;
|
|
42
|
+
depositCents: number;
|
|
43
|
+
usedCents: number;
|
|
44
|
+
method: string;
|
|
45
|
+
poolType: string;
|
|
46
|
+
createdAt: string;
|
|
47
|
+
expiresAt: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* MPP challenge response returned by POST /api/mpp/challenge.
|
|
51
|
+
* Used for keyless proxy access -- AI agents can use the proxy
|
|
52
|
+
* without any API key by solving a challenge and paying per request.
|
|
53
|
+
*/
|
|
54
|
+
export interface MppChallengeResponse {
|
|
55
|
+
challengeId: string;
|
|
56
|
+
nonce: string;
|
|
57
|
+
expiresAt: string;
|
|
58
|
+
poolType: string;
|
|
59
|
+
credential: MppCredentialPayload;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Credential payload for keyless MPP proxy access.
|
|
63
|
+
* Pass this to `buildProxyHeaders()` to construct the headers
|
|
64
|
+
* needed to route through the proxy without an API key.
|
|
65
|
+
*/
|
|
66
|
+
export interface MppCredentialPayload {
|
|
67
|
+
challengeId: string;
|
|
68
|
+
nonce: string;
|
|
69
|
+
poolType: string;
|
|
70
|
+
sessionToken?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Micropayment Payment Protocol (MPP) resource.
|
|
74
|
+
*
|
|
75
|
+
* Provides pay-per-use proxy sessions with real-time micropayment channels.
|
|
76
|
+
* Supports multiple payment methods: Tempo streaming, Stripe SPT, and Lightning.
|
|
77
|
+
*
|
|
78
|
+
* MPP also enables keyless proxy access for AI agents: call `getChallenge()` to
|
|
79
|
+
* obtain a credential, then use `buildProxyHeaders()` to construct the proxy
|
|
80
|
+
* Authorization header -- no API key needed.
|
|
81
|
+
*/
|
|
82
|
+
export declare class MppResource {
|
|
83
|
+
private http;
|
|
84
|
+
constructor(http: HttpClient);
|
|
85
|
+
/**
|
|
86
|
+
* Get MPP protocol information including supported methods, pricing, and limits.
|
|
87
|
+
*
|
|
88
|
+
* This endpoint does not require authentication.
|
|
89
|
+
*/
|
|
90
|
+
getInfo(): Promise<MppInfo>;
|
|
91
|
+
/**
|
|
92
|
+
* Request an MPP challenge for keyless proxy access.
|
|
93
|
+
*
|
|
94
|
+
* This endpoint does not require authentication. The returned credential
|
|
95
|
+
* can be used with `buildProxyHeaders()` to access the proxy without an API key.
|
|
96
|
+
*
|
|
97
|
+
* @param poolType - Proxy pool type: "dc" (datacenter, $3/GB) or "residential" ($5/GB)
|
|
98
|
+
*/
|
|
99
|
+
getChallenge(poolType: "dc" | "residential"): Promise<MppChallengeResponse>;
|
|
100
|
+
/**
|
|
101
|
+
* Build proxy Authorization header for keyless MPP access.
|
|
102
|
+
*
|
|
103
|
+
* Returns headers that should be set on the HTTP CONNECT / proxy request
|
|
104
|
+
* to route through the proxy without an API key.
|
|
105
|
+
*
|
|
106
|
+
* @param credential - The credential payload from `getChallenge()`
|
|
107
|
+
* @returns Headers object with `Authorization: MPP <json>`
|
|
108
|
+
*/
|
|
109
|
+
buildProxyHeaders(credential: MppCredentialPayload): Record<string, string>;
|
|
110
|
+
/**
|
|
111
|
+
* Build proxy session token header for ongoing MPP sessions.
|
|
112
|
+
*
|
|
113
|
+
* After opening a session, use the session token for subsequent requests
|
|
114
|
+
* within the same session.
|
|
115
|
+
*
|
|
116
|
+
* @param sessionToken - The session token from an active MPP session
|
|
117
|
+
* @returns Headers object with `MPP-SESSION-TOKEN`
|
|
118
|
+
*/
|
|
119
|
+
buildSessionHeaders(sessionToken: string): Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* Top up MPP balance using the specified payment method.
|
|
122
|
+
*
|
|
123
|
+
* Requires authentication (wallet credit needs a user account).
|
|
124
|
+
*
|
|
125
|
+
* @param amountCents - Amount to top up in cents (must be > 0 and <= 2,147,483,647)
|
|
126
|
+
* @param method - Payment method: "tempo", "stripe_spt", or "lightning"
|
|
127
|
+
*/
|
|
128
|
+
topUp(amountCents: number, method: "tempo" | "stripe_spt" | "lightning"): Promise<MppTopUpResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Open a new micropayment session channel.
|
|
131
|
+
*
|
|
132
|
+
* This endpoint does not require authentication -- anonymous agents can
|
|
133
|
+
* open sessions by providing a payment method and deposit.
|
|
134
|
+
*
|
|
135
|
+
* @param opts.maxDepositCents - Maximum deposit for the session in cents
|
|
136
|
+
* @param opts.method - Payment method identifier
|
|
137
|
+
* @param opts.poolType - Proxy pool type (e.g. "dc", "residential")
|
|
138
|
+
*/
|
|
139
|
+
openSession(opts: {
|
|
140
|
+
maxDepositCents: number;
|
|
141
|
+
method: string;
|
|
142
|
+
poolType: string;
|
|
143
|
+
}): Promise<MppSessionResponse>;
|
|
144
|
+
/**
|
|
145
|
+
* Close an active micropayment session channel.
|
|
146
|
+
* Any unused deposit is refunded.
|
|
147
|
+
*
|
|
148
|
+
* @param channelId - The channel ID to close
|
|
149
|
+
*/
|
|
150
|
+
closeSession(channelId: string): Promise<MppCloseResponse>;
|
|
151
|
+
/**
|
|
152
|
+
* Get the status of a micropayment session channel.
|
|
153
|
+
*
|
|
154
|
+
* @param channelId - The channel ID to query
|
|
155
|
+
*/
|
|
156
|
+
getSession(channelId: string): Promise<MppSessionStatus>;
|
|
157
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Micropayment Payment Protocol (MPP) resource.
|
|
3
|
+
*
|
|
4
|
+
* Provides pay-per-use proxy sessions with real-time micropayment channels.
|
|
5
|
+
* Supports multiple payment methods: Tempo streaming, Stripe SPT, and Lightning.
|
|
6
|
+
*
|
|
7
|
+
* MPP also enables keyless proxy access for AI agents: call `getChallenge()` to
|
|
8
|
+
* obtain a credential, then use `buildProxyHeaders()` to construct the proxy
|
|
9
|
+
* Authorization header -- no API key needed.
|
|
10
|
+
*/
|
|
11
|
+
export class MppResource {
|
|
12
|
+
http;
|
|
13
|
+
constructor(http) {
|
|
14
|
+
this.http = http;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Get MPP protocol information including supported methods, pricing, and limits.
|
|
18
|
+
*
|
|
19
|
+
* This endpoint does not require authentication.
|
|
20
|
+
*/
|
|
21
|
+
async getInfo() {
|
|
22
|
+
return this.http.get("/api/mpp/info", false);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Request an MPP challenge for keyless proxy access.
|
|
26
|
+
*
|
|
27
|
+
* This endpoint does not require authentication. The returned credential
|
|
28
|
+
* can be used with `buildProxyHeaders()` to access the proxy without an API key.
|
|
29
|
+
*
|
|
30
|
+
* @param poolType - Proxy pool type: "dc" (datacenter, $3/GB) or "residential" ($5/GB)
|
|
31
|
+
*/
|
|
32
|
+
async getChallenge(poolType) {
|
|
33
|
+
if (poolType !== "dc" && poolType !== "residential") {
|
|
34
|
+
throw new Error("poolType must be 'dc' or 'residential'");
|
|
35
|
+
}
|
|
36
|
+
return this.http.post("/api/mpp/challenge", { poolType }, false);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Build proxy Authorization header for keyless MPP access.
|
|
40
|
+
*
|
|
41
|
+
* Returns headers that should be set on the HTTP CONNECT / proxy request
|
|
42
|
+
* to route through the proxy without an API key.
|
|
43
|
+
*
|
|
44
|
+
* @param credential - The credential payload from `getChallenge()`
|
|
45
|
+
* @returns Headers object with `Authorization: MPP <json>`
|
|
46
|
+
*/
|
|
47
|
+
buildProxyHeaders(credential) {
|
|
48
|
+
return {
|
|
49
|
+
Authorization: "MPP " + JSON.stringify(credential),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build proxy session token header for ongoing MPP sessions.
|
|
54
|
+
*
|
|
55
|
+
* After opening a session, use the session token for subsequent requests
|
|
56
|
+
* within the same session.
|
|
57
|
+
*
|
|
58
|
+
* @param sessionToken - The session token from an active MPP session
|
|
59
|
+
* @returns Headers object with `MPP-SESSION-TOKEN`
|
|
60
|
+
*/
|
|
61
|
+
buildSessionHeaders(sessionToken) {
|
|
62
|
+
if (!sessionToken || typeof sessionToken !== "string") {
|
|
63
|
+
throw new Error("sessionToken must be a non-empty string");
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
"MPP-SESSION-TOKEN": sessionToken,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Top up MPP balance using the specified payment method.
|
|
71
|
+
*
|
|
72
|
+
* Requires authentication (wallet credit needs a user account).
|
|
73
|
+
*
|
|
74
|
+
* @param amountCents - Amount to top up in cents (must be > 0 and <= 2,147,483,647)
|
|
75
|
+
* @param method - Payment method: "tempo", "stripe_spt", or "lightning"
|
|
76
|
+
*/
|
|
77
|
+
async topUp(amountCents, method) {
|
|
78
|
+
if (!Number.isInteger(amountCents) || amountCents <= 0 || amountCents > 2_147_483_647) {
|
|
79
|
+
throw new Error("amountCents must be a positive integer <= 2,147,483,647");
|
|
80
|
+
}
|
|
81
|
+
return this.http.post("/api/mpp/topup", { amountCents, method });
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Open a new micropayment session channel.
|
|
85
|
+
*
|
|
86
|
+
* This endpoint does not require authentication -- anonymous agents can
|
|
87
|
+
* open sessions by providing a payment method and deposit.
|
|
88
|
+
*
|
|
89
|
+
* @param opts.maxDepositCents - Maximum deposit for the session in cents
|
|
90
|
+
* @param opts.method - Payment method identifier
|
|
91
|
+
* @param opts.poolType - Proxy pool type (e.g. "dc", "residential")
|
|
92
|
+
*/
|
|
93
|
+
async openSession(opts) {
|
|
94
|
+
if (!Number.isInteger(opts.maxDepositCents) || opts.maxDepositCents <= 0 || opts.maxDepositCents > 2_147_483_647) {
|
|
95
|
+
throw new Error("maxDepositCents must be a positive integer <= 2,147,483,647");
|
|
96
|
+
}
|
|
97
|
+
return this.http.post("/api/mpp/session/open", {
|
|
98
|
+
maxDepositCents: opts.maxDepositCents,
|
|
99
|
+
method: opts.method,
|
|
100
|
+
poolType: opts.poolType,
|
|
101
|
+
}, false);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Close an active micropayment session channel.
|
|
105
|
+
* Any unused deposit is refunded.
|
|
106
|
+
*
|
|
107
|
+
* @param channelId - The channel ID to close
|
|
108
|
+
*/
|
|
109
|
+
async closeSession(channelId) {
|
|
110
|
+
return this.http.post("/api/mpp/session/close", { channelId });
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get the status of a micropayment session channel.
|
|
114
|
+
*
|
|
115
|
+
* @param channelId - The channel ID to query
|
|
116
|
+
*/
|
|
117
|
+
async getSession(channelId) {
|
|
118
|
+
return this.http.get(`/api/mpp/session/${encodeURIComponent(channelId)}`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -1,37 +1,92 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
+
/**
|
|
3
|
+
* x402 V2 protocol version.
|
|
4
|
+
* V2 uses CAIP-2 network identifiers (e.g. "eip155:8453" instead of "base").
|
|
5
|
+
*/
|
|
6
|
+
export declare const X402_PROTOCOL_VERSION = "2";
|
|
7
|
+
/**
|
|
8
|
+
* x402 V2 header constants.
|
|
9
|
+
* V2 renamed the payment headers. Servers should accept both old and new
|
|
10
|
+
* for backward compatibility during the transition period.
|
|
11
|
+
*/
|
|
12
|
+
export declare const X402_HEADERS: {
|
|
13
|
+
/** V2 payment header (replaces V1 "X-PAYMENT"). */
|
|
14
|
+
readonly PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE";
|
|
15
|
+
/** V1 legacy payment header — kept for backward compatibility. */
|
|
16
|
+
readonly PAYMENT_SIGNATURE_LEGACY: "X-PAYMENT";
|
|
17
|
+
/** V2 payment response header (replaces V1 "X-PAYMENT-RESPONSE"). */
|
|
18
|
+
readonly PAYMENT_RESPONSE: "PAYMENT-RESPONSE";
|
|
19
|
+
/** V1 legacy payment response header. */
|
|
20
|
+
readonly PAYMENT_RESPONSE_LEGACY: "X-PAYMENT-RESPONSE";
|
|
21
|
+
/** V2 payment requirements header. */
|
|
22
|
+
readonly PAYMENT_REQUIRED: "PAYMENT-REQUIRED";
|
|
23
|
+
};
|
|
24
|
+
/** Payment scheme supported by x402. "exact" is the original; "permit2" is new in V2. */
|
|
25
|
+
export type X402Scheme = "exact" | "permit2";
|
|
26
|
+
/** Token supported by x402. V2 adds EURC alongside USDC. */
|
|
27
|
+
export type X402Token = "USDC" | "EURC";
|
|
2
28
|
export interface X402Facilitator {
|
|
3
29
|
address: string;
|
|
4
30
|
chain: string;
|
|
31
|
+
/** Human-readable network name (e.g. "base", "ethereum"). */
|
|
5
32
|
network: string;
|
|
33
|
+
/** CAIP-2 network identifier (e.g. "eip155:8453"). Added in V2. */
|
|
34
|
+
networkId: string;
|
|
6
35
|
}
|
|
7
36
|
export interface X402Pricing {
|
|
8
37
|
perRequestCents: number;
|
|
9
38
|
perGbCents: number;
|
|
10
39
|
currency: string;
|
|
11
40
|
}
|
|
41
|
+
export interface X402PaymentHeaders {
|
|
42
|
+
/** Header the client sends with the payment signature. */
|
|
43
|
+
request: string;
|
|
44
|
+
/** Header the server returns with the payment response. */
|
|
45
|
+
response: string;
|
|
46
|
+
/** Header the server uses to indicate payment requirements. */
|
|
47
|
+
required: string;
|
|
48
|
+
}
|
|
12
49
|
export interface X402Info {
|
|
13
50
|
supported: boolean;
|
|
14
51
|
enabled: boolean;
|
|
15
52
|
protocol: string;
|
|
53
|
+
/** Protocol version — "2" for x402 V2. */
|
|
16
54
|
version: string;
|
|
17
55
|
facilitators: X402Facilitator[];
|
|
18
56
|
pricing: X402Pricing;
|
|
57
|
+
/** Supported token symbols (e.g. ["USDC", "EURC"]). */
|
|
19
58
|
currencies: string[];
|
|
59
|
+
/** Supported payment schemes (e.g. ["exact", "permit2"]). */
|
|
60
|
+
schemes: string[];
|
|
20
61
|
walletType: string;
|
|
21
62
|
agenticWallets: boolean;
|
|
63
|
+
/** Header names used by this protocol version. */
|
|
64
|
+
paymentHeaders: X402PaymentHeaders;
|
|
22
65
|
}
|
|
23
66
|
/**
|
|
24
|
-
* x402 (HTTP 402 Payment Required) protocol information.
|
|
67
|
+
* x402 V2 (HTTP 402 Payment Required) protocol information.
|
|
25
68
|
*
|
|
26
69
|
* Provides details about x402 micropayment support, facilitator addresses,
|
|
27
|
-
* pricing,
|
|
70
|
+
* pricing, supported chains/currencies, and payment schemes for AI agent
|
|
71
|
+
* payments.
|
|
72
|
+
*
|
|
73
|
+
* V2 changes from V1:
|
|
74
|
+
* - Protocol version "2" (was "1")
|
|
75
|
+
* - CAIP-2 network IDs (e.g. "eip155:8453" instead of "base")
|
|
76
|
+
* - Payment header: PAYMENT-SIGNATURE (was X-PAYMENT)
|
|
77
|
+
* - Response header: PAYMENT-RESPONSE (was X-PAYMENT-RESPONSE)
|
|
78
|
+
* - Requirements header: PAYMENT-REQUIRED
|
|
79
|
+
* - New token: EURC (in addition to USDC)
|
|
80
|
+
* - New scheme: permit2 (in addition to exact)
|
|
81
|
+
* - Additional facilitator chains: Ethereum (eip155:1), Optimism (eip155:10),
|
|
82
|
+
* Arbitrum (eip155:42161), and Solana
|
|
28
83
|
*/
|
|
29
84
|
export declare class X402Resource {
|
|
30
85
|
private http;
|
|
31
86
|
constructor(http: HttpClient);
|
|
32
87
|
/**
|
|
33
|
-
* Get x402 protocol information including facilitator details,
|
|
34
|
-
* pricing, supported chains, and
|
|
88
|
+
* Get x402 V2 protocol information including facilitator details,
|
|
89
|
+
* pricing, supported chains, currencies, and payment schemes.
|
|
35
90
|
*
|
|
36
91
|
* This endpoint does not require authentication.
|
|
37
92
|
*/
|
|
@@ -1,8 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* x402
|
|
2
|
+
* x402 V2 protocol version.
|
|
3
|
+
* V2 uses CAIP-2 network identifiers (e.g. "eip155:8453" instead of "base").
|
|
4
|
+
*/
|
|
5
|
+
export const X402_PROTOCOL_VERSION = "2";
|
|
6
|
+
/**
|
|
7
|
+
* x402 V2 header constants.
|
|
8
|
+
* V2 renamed the payment headers. Servers should accept both old and new
|
|
9
|
+
* for backward compatibility during the transition period.
|
|
10
|
+
*/
|
|
11
|
+
export const X402_HEADERS = {
|
|
12
|
+
/** V2 payment header (replaces V1 "X-PAYMENT"). */
|
|
13
|
+
PAYMENT_SIGNATURE: "PAYMENT-SIGNATURE",
|
|
14
|
+
/** V1 legacy payment header — kept for backward compatibility. */
|
|
15
|
+
PAYMENT_SIGNATURE_LEGACY: "X-PAYMENT",
|
|
16
|
+
/** V2 payment response header (replaces V1 "X-PAYMENT-RESPONSE"). */
|
|
17
|
+
PAYMENT_RESPONSE: "PAYMENT-RESPONSE",
|
|
18
|
+
/** V1 legacy payment response header. */
|
|
19
|
+
PAYMENT_RESPONSE_LEGACY: "X-PAYMENT-RESPONSE",
|
|
20
|
+
/** V2 payment requirements header. */
|
|
21
|
+
PAYMENT_REQUIRED: "PAYMENT-REQUIRED",
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* x402 V2 (HTTP 402 Payment Required) protocol information.
|
|
3
25
|
*
|
|
4
26
|
* Provides details about x402 micropayment support, facilitator addresses,
|
|
5
|
-
* pricing,
|
|
27
|
+
* pricing, supported chains/currencies, and payment schemes for AI agent
|
|
28
|
+
* payments.
|
|
29
|
+
*
|
|
30
|
+
* V2 changes from V1:
|
|
31
|
+
* - Protocol version "2" (was "1")
|
|
32
|
+
* - CAIP-2 network IDs (e.g. "eip155:8453" instead of "base")
|
|
33
|
+
* - Payment header: PAYMENT-SIGNATURE (was X-PAYMENT)
|
|
34
|
+
* - Response header: PAYMENT-RESPONSE (was X-PAYMENT-RESPONSE)
|
|
35
|
+
* - Requirements header: PAYMENT-REQUIRED
|
|
36
|
+
* - New token: EURC (in addition to USDC)
|
|
37
|
+
* - New scheme: permit2 (in addition to exact)
|
|
38
|
+
* - Additional facilitator chains: Ethereum (eip155:1), Optimism (eip155:10),
|
|
39
|
+
* Arbitrum (eip155:42161), and Solana
|
|
6
40
|
*/
|
|
7
41
|
export class X402Resource {
|
|
8
42
|
http;
|
|
@@ -10,8 +44,8 @@ export class X402Resource {
|
|
|
10
44
|
this.http = http;
|
|
11
45
|
}
|
|
12
46
|
/**
|
|
13
|
-
* Get x402 protocol information including facilitator details,
|
|
14
|
-
* pricing, supported chains, and
|
|
47
|
+
* Get x402 V2 protocol information including facilitator details,
|
|
48
|
+
* pricing, supported chains, currencies, and payment schemes.
|
|
15
49
|
*
|
|
16
50
|
* This endpoint does not require authentication.
|
|
17
51
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dominusnode/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Official Dominus Node SDK for Node.js/TypeScript",
|
|
5
5
|
"author": "Dominus Node",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
23
|
+
"prepare": "npm run build",
|
|
23
24
|
"test": "vitest run",
|
|
24
25
|
"clean": "rm -rf dist"
|
|
25
26
|
},
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
"node": ">=18.0.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
31
|
+
"@types/node": "^22.0.0",
|
|
30
32
|
"typescript": "^5.3.0",
|
|
31
33
|
"vitest": "^4.0.0"
|
|
32
34
|
}
|