@paylobster/mcp-server 1.0.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 +341 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +86 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/resources/index.d.ts +9 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +60 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +240 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/balance.d.ts +6 -0
- package/dist/tools/balance.d.ts.map +1 -0
- package/dist/tools/balance.js +37 -0
- package/dist/tools/balance.js.map +1 -0
- package/dist/tools/escrow.d.ts +91 -0
- package/dist/tools/escrow.d.ts.map +1 -0
- package/dist/tools/escrow.js +244 -0
- package/dist/tools/escrow.js.map +1 -0
- package/dist/tools/reputation.d.ts +51 -0
- package/dist/tools/reputation.d.ts.map +1 -0
- package/dist/tools/reputation.js +125 -0
- package/dist/tools/reputation.js.map +1 -0
- package/dist/tools/search.d.ts +55 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +103 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types/index.d.ts +73 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/contracts.d.ts +236 -0
- package/dist/utils/contracts.d.ts.map +1 -0
- package/dist/utils/contracts.js +200 -0
- package/dist/utils/contracts.js.map +1 -0
- package/package.json +39 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { Address } from 'viem';
|
|
2
|
+
import { PayLobsterConfig } from '../types';
|
|
3
|
+
export declare const IDENTITY_ABI: readonly [{
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "agentURI";
|
|
6
|
+
readonly type: "string";
|
|
7
|
+
}, {
|
|
8
|
+
readonly name: "name";
|
|
9
|
+
readonly type: "string";
|
|
10
|
+
}, {
|
|
11
|
+
readonly name: "capabilities";
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
}];
|
|
14
|
+
readonly name: "register";
|
|
15
|
+
readonly outputs: readonly [{
|
|
16
|
+
readonly name: "agentId";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}];
|
|
19
|
+
readonly stateMutability: "nonpayable";
|
|
20
|
+
readonly type: "function";
|
|
21
|
+
}, {
|
|
22
|
+
readonly inputs: readonly [{
|
|
23
|
+
readonly name: "user";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}];
|
|
26
|
+
readonly name: "getAgentInfo";
|
|
27
|
+
readonly outputs: readonly [{
|
|
28
|
+
readonly name: "name";
|
|
29
|
+
readonly type: "string";
|
|
30
|
+
}, {
|
|
31
|
+
readonly name: "tokenId";
|
|
32
|
+
readonly type: "uint256";
|
|
33
|
+
}, {
|
|
34
|
+
readonly name: "registered";
|
|
35
|
+
readonly type: "bool";
|
|
36
|
+
}];
|
|
37
|
+
readonly stateMutability: "view";
|
|
38
|
+
readonly type: "function";
|
|
39
|
+
}];
|
|
40
|
+
export declare const REPUTATION_ABI: readonly [{
|
|
41
|
+
readonly inputs: readonly [{
|
|
42
|
+
readonly name: "user";
|
|
43
|
+
readonly type: "address";
|
|
44
|
+
}];
|
|
45
|
+
readonly name: "getReputation";
|
|
46
|
+
readonly outputs: readonly [{
|
|
47
|
+
readonly name: "score";
|
|
48
|
+
readonly type: "uint256";
|
|
49
|
+
}, {
|
|
50
|
+
readonly name: "trustVector";
|
|
51
|
+
readonly type: "uint256";
|
|
52
|
+
}];
|
|
53
|
+
readonly stateMutability: "view";
|
|
54
|
+
readonly type: "function";
|
|
55
|
+
}];
|
|
56
|
+
export declare const CREDIT_ABI: readonly [{
|
|
57
|
+
readonly inputs: readonly [{
|
|
58
|
+
readonly name: "user";
|
|
59
|
+
readonly type: "address";
|
|
60
|
+
}];
|
|
61
|
+
readonly name: "getCreditScore";
|
|
62
|
+
readonly outputs: readonly [{
|
|
63
|
+
readonly name: "";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}];
|
|
66
|
+
readonly stateMutability: "view";
|
|
67
|
+
readonly type: "function";
|
|
68
|
+
}, {
|
|
69
|
+
readonly inputs: readonly [{
|
|
70
|
+
readonly name: "user";
|
|
71
|
+
readonly type: "address";
|
|
72
|
+
}];
|
|
73
|
+
readonly name: "getCreditStatus";
|
|
74
|
+
readonly outputs: readonly [{
|
|
75
|
+
readonly name: "limit";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "available";
|
|
79
|
+
readonly type: "uint256";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "inUse";
|
|
82
|
+
readonly type: "uint256";
|
|
83
|
+
}];
|
|
84
|
+
readonly stateMutability: "view";
|
|
85
|
+
readonly type: "function";
|
|
86
|
+
}];
|
|
87
|
+
export declare const ESCROW_ABI: readonly [{
|
|
88
|
+
readonly anonymous: true;
|
|
89
|
+
readonly inputs: readonly [{
|
|
90
|
+
readonly indexed: true;
|
|
91
|
+
readonly name: "escrowId";
|
|
92
|
+
readonly type: "uint256";
|
|
93
|
+
}, {
|
|
94
|
+
readonly indexed: true;
|
|
95
|
+
readonly name: "sender";
|
|
96
|
+
readonly type: "address";
|
|
97
|
+
}, {
|
|
98
|
+
readonly indexed: true;
|
|
99
|
+
readonly name: "recipient";
|
|
100
|
+
readonly type: "address";
|
|
101
|
+
}, {
|
|
102
|
+
readonly indexed: false;
|
|
103
|
+
readonly name: "amount";
|
|
104
|
+
readonly type: "uint256";
|
|
105
|
+
}];
|
|
106
|
+
readonly name: "EscrowCreated";
|
|
107
|
+
readonly type: "event";
|
|
108
|
+
}, {
|
|
109
|
+
readonly anonymous: true;
|
|
110
|
+
readonly inputs: readonly [{
|
|
111
|
+
readonly indexed: true;
|
|
112
|
+
readonly name: "escrowId";
|
|
113
|
+
readonly type: "uint256";
|
|
114
|
+
}];
|
|
115
|
+
readonly name: "EscrowReleased";
|
|
116
|
+
readonly type: "event";
|
|
117
|
+
}, {
|
|
118
|
+
readonly inputs: readonly [{
|
|
119
|
+
readonly name: "recipient";
|
|
120
|
+
readonly type: "address";
|
|
121
|
+
}, {
|
|
122
|
+
readonly name: "amount";
|
|
123
|
+
readonly type: "uint256";
|
|
124
|
+
}, {
|
|
125
|
+
readonly name: "token";
|
|
126
|
+
readonly type: "address";
|
|
127
|
+
}, {
|
|
128
|
+
readonly name: "description";
|
|
129
|
+
readonly type: "string";
|
|
130
|
+
}];
|
|
131
|
+
readonly name: "createEscrow";
|
|
132
|
+
readonly outputs: readonly [{
|
|
133
|
+
readonly name: "escrowId";
|
|
134
|
+
readonly type: "uint256";
|
|
135
|
+
}];
|
|
136
|
+
readonly stateMutability: "nonpayable";
|
|
137
|
+
readonly type: "function";
|
|
138
|
+
}, {
|
|
139
|
+
readonly inputs: readonly [{
|
|
140
|
+
readonly name: "escrowId";
|
|
141
|
+
readonly type: "uint256";
|
|
142
|
+
}];
|
|
143
|
+
readonly name: "releaseEscrow";
|
|
144
|
+
readonly outputs: readonly [];
|
|
145
|
+
readonly stateMutability: "nonpayable";
|
|
146
|
+
readonly type: "function";
|
|
147
|
+
}, {
|
|
148
|
+
readonly inputs: readonly [{
|
|
149
|
+
readonly name: "escrowId";
|
|
150
|
+
readonly type: "uint256";
|
|
151
|
+
}];
|
|
152
|
+
readonly name: "getEscrow";
|
|
153
|
+
readonly outputs: readonly [{
|
|
154
|
+
readonly name: "sender";
|
|
155
|
+
readonly type: "address";
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "recipient";
|
|
158
|
+
readonly type: "address";
|
|
159
|
+
}, {
|
|
160
|
+
readonly name: "amount";
|
|
161
|
+
readonly type: "uint256";
|
|
162
|
+
}, {
|
|
163
|
+
readonly name: "token";
|
|
164
|
+
readonly type: "address";
|
|
165
|
+
}, {
|
|
166
|
+
readonly name: "status";
|
|
167
|
+
readonly type: "uint8";
|
|
168
|
+
}];
|
|
169
|
+
readonly stateMutability: "view";
|
|
170
|
+
readonly type: "function";
|
|
171
|
+
}];
|
|
172
|
+
export declare const USDC_ABI: readonly [{
|
|
173
|
+
readonly inputs: readonly [{
|
|
174
|
+
readonly name: "spender";
|
|
175
|
+
readonly type: "address";
|
|
176
|
+
}, {
|
|
177
|
+
readonly name: "amount";
|
|
178
|
+
readonly type: "uint256";
|
|
179
|
+
}];
|
|
180
|
+
readonly name: "approve";
|
|
181
|
+
readonly outputs: readonly [{
|
|
182
|
+
readonly name: "";
|
|
183
|
+
readonly type: "bool";
|
|
184
|
+
}];
|
|
185
|
+
readonly stateMutability: "nonpayable";
|
|
186
|
+
readonly type: "function";
|
|
187
|
+
}, {
|
|
188
|
+
readonly inputs: readonly [{
|
|
189
|
+
readonly name: "account";
|
|
190
|
+
readonly type: "address";
|
|
191
|
+
}];
|
|
192
|
+
readonly name: "balanceOf";
|
|
193
|
+
readonly outputs: readonly [{
|
|
194
|
+
readonly name: "";
|
|
195
|
+
readonly type: "uint256";
|
|
196
|
+
}];
|
|
197
|
+
readonly stateMutability: "view";
|
|
198
|
+
readonly type: "function";
|
|
199
|
+
}];
|
|
200
|
+
export declare class ContractClient {
|
|
201
|
+
private publicClient;
|
|
202
|
+
private walletClient;
|
|
203
|
+
private account;
|
|
204
|
+
config: PayLobsterConfig;
|
|
205
|
+
constructor(config: PayLobsterConfig);
|
|
206
|
+
getContracts(): {
|
|
207
|
+
identity: Address;
|
|
208
|
+
reputation: Address;
|
|
209
|
+
credit: Address;
|
|
210
|
+
escrow: Address;
|
|
211
|
+
usdc: Address;
|
|
212
|
+
};
|
|
213
|
+
getPublicClient(): any;
|
|
214
|
+
getWalletClient(): any;
|
|
215
|
+
getAccount(): {
|
|
216
|
+
address: Address;
|
|
217
|
+
nonceManager?: import("viem").NonceManager | undefined;
|
|
218
|
+
sign: (parameters: {
|
|
219
|
+
hash: import("viem").Hash;
|
|
220
|
+
}) => Promise<import("viem").Hex>;
|
|
221
|
+
signAuthorization: (parameters: import("viem").AuthorizationRequest) => Promise<import("viem/accounts").SignAuthorizationReturnType>;
|
|
222
|
+
signMessage: ({ message }: {
|
|
223
|
+
message: import("viem").SignableMessage;
|
|
224
|
+
}) => Promise<import("viem").Hex>;
|
|
225
|
+
signTransaction: <serializer extends import("viem").SerializeTransactionFn<import("viem").TransactionSerializable> = import("viem").SerializeTransactionFn<import("viem").TransactionSerializable>, transaction extends Parameters<serializer>[0] = Parameters<serializer>[0]>(transaction: transaction, options?: {
|
|
226
|
+
serializer?: serializer | undefined;
|
|
227
|
+
} | undefined) => Promise<import("viem").Hex>;
|
|
228
|
+
signTypedData: <const typedData extends import("viem").TypedData | Record<string, unknown>, primaryType extends keyof typedData | "EIP712Domain" = keyof typedData>(parameters: import("viem").TypedDataDefinition<typedData, primaryType>) => Promise<import("viem").Hex>;
|
|
229
|
+
publicKey: import("viem").Hex;
|
|
230
|
+
source: "privateKey";
|
|
231
|
+
type: "local";
|
|
232
|
+
};
|
|
233
|
+
parseUSDC(amount: string): bigint;
|
|
234
|
+
formatUSDC(amount: bigint): string;
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../src/utils/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGtG,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAqB5C,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBf,CAAC;AAEX,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAWjB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmBb,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoDb,CAAC;AAEX,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBX,CAAC;AAEX,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAM;IAC1B,OAAO,CAAC,YAAY,CAAoB;IACxC,OAAO,CAAC,OAAO,CAAuD;IAC/D,MAAM,EAAE,gBAAgB,CAAC;gBAEpB,MAAM,EAAE,gBAAgB;IAmBpC,YAAY;;;;;;;IAIZ,eAAe;IAIf,eAAe;IAOf,UAAU;;;;;;;;;;wTA5J8B,CAAC;sBACtB,CAAC;;;;;;;IAkKpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIjC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;CAGnC"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContractClient = exports.USDC_ABI = exports.ESCROW_ABI = exports.CREDIT_ABI = exports.REPUTATION_ABI = exports.IDENTITY_ABI = void 0;
|
|
4
|
+
const viem_1 = require("viem");
|
|
5
|
+
const chains_1 = require("viem/chains");
|
|
6
|
+
const accounts_1 = require("viem/accounts");
|
|
7
|
+
// Default contract addresses
|
|
8
|
+
const DEFAULT_CONTRACTS = {
|
|
9
|
+
'base': {
|
|
10
|
+
identity: '0xA174f250380c4B5C37F6709bBa719E662b77E662',
|
|
11
|
+
reputation: '0x02bb4c4cd10EeaCD04DF7631c81d6E7c1d0c4b29',
|
|
12
|
+
credit: '0xD924B81F2d8EFF3E0A3Bf0a4b9D77d37CC0980E1',
|
|
13
|
+
escrow: '0x49Ed7003C6941a033E7dD8b44552e4E18cf28806',
|
|
14
|
+
usdc: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
15
|
+
},
|
|
16
|
+
'base-sepolia': {
|
|
17
|
+
identity: '0x3dfA02Ed4F0e4F10E8031d7a4cB8Ea0bBbFbCB8c',
|
|
18
|
+
reputation: '0xb0033901e3b94f4F36dA0b3e59A1F4AD9f4f1697',
|
|
19
|
+
credit: '0xBA64e2b2F2a80D03A4B13b3396942C1e78205C7d',
|
|
20
|
+
escrow: '0x78D1f50a1965dE34f6b5a3D3546C94FE1809Cd82',
|
|
21
|
+
usdc: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
// Contract ABIs
|
|
25
|
+
exports.IDENTITY_ABI = [
|
|
26
|
+
{
|
|
27
|
+
inputs: [
|
|
28
|
+
{ name: 'agentURI', type: 'string' },
|
|
29
|
+
{ name: 'name', type: 'string' },
|
|
30
|
+
{ name: 'capabilities', type: 'string' },
|
|
31
|
+
],
|
|
32
|
+
name: 'register',
|
|
33
|
+
outputs: [{ name: 'agentId', type: 'uint256' }],
|
|
34
|
+
stateMutability: 'nonpayable',
|
|
35
|
+
type: 'function',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
inputs: [{ name: 'user', type: 'address' }],
|
|
39
|
+
name: 'getAgentInfo',
|
|
40
|
+
outputs: [
|
|
41
|
+
{ name: 'name', type: 'string' },
|
|
42
|
+
{ name: 'tokenId', type: 'uint256' },
|
|
43
|
+
{ name: 'registered', type: 'bool' },
|
|
44
|
+
],
|
|
45
|
+
stateMutability: 'view',
|
|
46
|
+
type: 'function',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
exports.REPUTATION_ABI = [
|
|
50
|
+
{
|
|
51
|
+
inputs: [{ name: 'user', type: 'address' }],
|
|
52
|
+
name: 'getReputation',
|
|
53
|
+
outputs: [
|
|
54
|
+
{ name: 'score', type: 'uint256' },
|
|
55
|
+
{ name: 'trustVector', type: 'uint256' },
|
|
56
|
+
],
|
|
57
|
+
stateMutability: 'view',
|
|
58
|
+
type: 'function',
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
exports.CREDIT_ABI = [
|
|
62
|
+
{
|
|
63
|
+
inputs: [{ name: 'user', type: 'address' }],
|
|
64
|
+
name: 'getCreditScore',
|
|
65
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
66
|
+
stateMutability: 'view',
|
|
67
|
+
type: 'function',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
inputs: [{ name: 'user', type: 'address' }],
|
|
71
|
+
name: 'getCreditStatus',
|
|
72
|
+
outputs: [
|
|
73
|
+
{ name: 'limit', type: 'uint256' },
|
|
74
|
+
{ name: 'available', type: 'uint256' },
|
|
75
|
+
{ name: 'inUse', type: 'uint256' },
|
|
76
|
+
],
|
|
77
|
+
stateMutability: 'view',
|
|
78
|
+
type: 'function',
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
exports.ESCROW_ABI = [
|
|
82
|
+
{
|
|
83
|
+
anonymous: true,
|
|
84
|
+
inputs: [
|
|
85
|
+
{ indexed: true, name: 'escrowId', type: 'uint256' },
|
|
86
|
+
{ indexed: true, name: 'sender', type: 'address' },
|
|
87
|
+
{ indexed: true, name: 'recipient', type: 'address' },
|
|
88
|
+
{ indexed: false, name: 'amount', type: 'uint256' },
|
|
89
|
+
],
|
|
90
|
+
name: 'EscrowCreated',
|
|
91
|
+
type: 'event',
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
anonymous: true,
|
|
95
|
+
inputs: [
|
|
96
|
+
{ indexed: true, name: 'escrowId', type: 'uint256' },
|
|
97
|
+
],
|
|
98
|
+
name: 'EscrowReleased',
|
|
99
|
+
type: 'event',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
inputs: [
|
|
103
|
+
{ name: 'recipient', type: 'address' },
|
|
104
|
+
{ name: 'amount', type: 'uint256' },
|
|
105
|
+
{ name: 'token', type: 'address' },
|
|
106
|
+
{ name: 'description', type: 'string' },
|
|
107
|
+
],
|
|
108
|
+
name: 'createEscrow',
|
|
109
|
+
outputs: [{ name: 'escrowId', type: 'uint256' }],
|
|
110
|
+
stateMutability: 'nonpayable',
|
|
111
|
+
type: 'function',
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
inputs: [{ name: 'escrowId', type: 'uint256' }],
|
|
115
|
+
name: 'releaseEscrow',
|
|
116
|
+
outputs: [],
|
|
117
|
+
stateMutability: 'nonpayable',
|
|
118
|
+
type: 'function',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
inputs: [{ name: 'escrowId', type: 'uint256' }],
|
|
122
|
+
name: 'getEscrow',
|
|
123
|
+
outputs: [
|
|
124
|
+
{ name: 'sender', type: 'address' },
|
|
125
|
+
{ name: 'recipient', type: 'address' },
|
|
126
|
+
{ name: 'amount', type: 'uint256' },
|
|
127
|
+
{ name: 'token', type: 'address' },
|
|
128
|
+
{ name: 'status', type: 'uint8' },
|
|
129
|
+
],
|
|
130
|
+
stateMutability: 'view',
|
|
131
|
+
type: 'function',
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
exports.USDC_ABI = [
|
|
135
|
+
{
|
|
136
|
+
inputs: [
|
|
137
|
+
{ name: 'spender', type: 'address' },
|
|
138
|
+
{ name: 'amount', type: 'uint256' },
|
|
139
|
+
],
|
|
140
|
+
name: 'approve',
|
|
141
|
+
outputs: [{ name: '', type: 'bool' }],
|
|
142
|
+
stateMutability: 'nonpayable',
|
|
143
|
+
type: 'function',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
inputs: [{ name: 'account', type: 'address' }],
|
|
147
|
+
name: 'balanceOf',
|
|
148
|
+
outputs: [{ name: '', type: 'uint256' }],
|
|
149
|
+
stateMutability: 'view',
|
|
150
|
+
type: 'function',
|
|
151
|
+
},
|
|
152
|
+
];
|
|
153
|
+
class ContractClient {
|
|
154
|
+
publicClient;
|
|
155
|
+
walletClient = null;
|
|
156
|
+
account = null;
|
|
157
|
+
config;
|
|
158
|
+
constructor(config) {
|
|
159
|
+
this.config = config;
|
|
160
|
+
const chain = config.network === 'base' ? chains_1.base : chains_1.baseSepolia;
|
|
161
|
+
this.publicClient = (0, viem_1.createPublicClient)({
|
|
162
|
+
chain,
|
|
163
|
+
transport: (0, viem_1.http)(config.rpcUrl),
|
|
164
|
+
});
|
|
165
|
+
if (config.wallet?.privateKey) {
|
|
166
|
+
this.account = (0, accounts_1.privateKeyToAccount)(config.wallet.privateKey);
|
|
167
|
+
this.walletClient = (0, viem_1.createWalletClient)({
|
|
168
|
+
account: this.account,
|
|
169
|
+
chain,
|
|
170
|
+
transport: (0, viem_1.http)(config.rpcUrl),
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
getContracts() {
|
|
175
|
+
return this.config.contracts || DEFAULT_CONTRACTS[this.config.network];
|
|
176
|
+
}
|
|
177
|
+
getPublicClient() {
|
|
178
|
+
return this.publicClient;
|
|
179
|
+
}
|
|
180
|
+
getWalletClient() {
|
|
181
|
+
if (!this.walletClient) {
|
|
182
|
+
throw new Error('Wallet not configured. Set PAYLOBSTER_PRIVATE_KEY.');
|
|
183
|
+
}
|
|
184
|
+
return this.walletClient;
|
|
185
|
+
}
|
|
186
|
+
getAccount() {
|
|
187
|
+
if (!this.account) {
|
|
188
|
+
throw new Error('Wallet not configured. Set PAYLOBSTER_PRIVATE_KEY.');
|
|
189
|
+
}
|
|
190
|
+
return this.account;
|
|
191
|
+
}
|
|
192
|
+
parseUSDC(amount) {
|
|
193
|
+
return (0, viem_1.parseUnits)(amount, 6); // USDC has 6 decimals
|
|
194
|
+
}
|
|
195
|
+
formatUSDC(amount) {
|
|
196
|
+
return (0, viem_1.formatUnits)(amount, 6);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
exports.ContractClient = ContractClient;
|
|
200
|
+
//# sourceMappingURL=contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
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AAC,CAAC,CAAC;IAChC,CAAC;CACF;AAtDD,wCAsDC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paylobster/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for PayLobster agent payment infrastructure",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"paylobster-mcp-server": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch",
|
|
13
|
+
"start": "node dist/cli.js",
|
|
14
|
+
"test": "echo \"Tests not yet implemented\" && exit 0"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"mcp",
|
|
18
|
+
"model-context-protocol",
|
|
19
|
+
"paylobster",
|
|
20
|
+
"agent-payments",
|
|
21
|
+
"blockchain",
|
|
22
|
+
"escrow"
|
|
23
|
+
],
|
|
24
|
+
"author": "PayLobster",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.0.4",
|
|
28
|
+
"viem": "^2.21.54",
|
|
29
|
+
"zod": "^3.24.1",
|
|
30
|
+
"dotenv": "^16.4.7"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.10.5",
|
|
34
|
+
"typescript": "^5.7.3"
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=18.0.0"
|
|
38
|
+
}
|
|
39
|
+
}
|