moltspay 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chains/index.d.mts +6 -6
- package/dist/chains/index.d.ts +6 -6
- package/dist/chains/index.js +2 -2
- package/dist/chains/index.js.map +1 -1
- package/dist/chains/index.mjs +2 -2
- package/dist/chains/index.mjs.map +1 -1
- package/dist/cli.js +36 -36
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +36 -36
- package/dist/cli.mjs.map +1 -1
- package/dist/guide/index.d.mts +7 -7
- package/dist/guide/index.d.ts +7 -7
- package/dist/guide/index.js +50 -50
- package/dist/guide/index.js.map +1 -1
- package/dist/guide/index.mjs +50 -50
- package/dist/guide/index.mjs.map +1 -1
- package/dist/{index-CZzgdtin.d.mts → index-CyFg9s2m.d.mts} +1 -1
- package/dist/{index-CZzgdtin.d.ts → index-CyFg9s2m.d.ts} +1 -1
- package/dist/index.d.mts +89 -89
- package/dist/index.d.ts +89 -89
- package/dist/index.js +275 -275
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +275 -275
- package/dist/index.mjs.map +1 -1
- package/dist/orders/index.d.mts +13 -13
- package/dist/orders/index.d.ts +13 -13
- package/dist/orders/index.js +10 -10
- package/dist/orders/index.js.map +1 -1
- package/dist/orders/index.mjs +10 -10
- package/dist/orders/index.mjs.map +1 -1
- package/dist/permit/index.d.mts +11 -11
- package/dist/permit/index.d.ts +11 -11
- package/dist/permit/index.js +14 -14
- package/dist/permit/index.js.map +1 -1
- package/dist/permit/index.mjs +14 -14
- package/dist/permit/index.mjs.map +1 -1
- package/dist/verify/index.d.mts +4 -4
- package/dist/verify/index.d.ts +4 -4
- package/dist/verify/index.js +13 -13
- package/dist/verify/index.js.map +1 -1
- package/dist/verify/index.mjs +13 -13
- package/dist/verify/index.mjs.map +1 -1
- package/dist/wallet/index.d.mts +72 -72
- package/dist/wallet/index.d.ts +72 -72
- package/dist/wallet/index.js +48 -48
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +48 -48
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as ChainName, a as ChainConfig, P as PaymentAgentConfig, b as CreateInvoiceParams, I as Invoice, V as VerifyOptions, c as VerifyResult, W as WalletBalance, A as AuditAction, d as AuditEntry } from './index-
|
|
2
|
-
export { E as EIP712TypedData, e as PendingTransfer, f as PermitExecuteResult, g as PermitRequest, h as PermitSignature, S as SecureWalletConfig, i as SecurityLimits, T as TransferParams, j as TransferResult } from './index-
|
|
1
|
+
import { C as ChainName, a as ChainConfig, P as PaymentAgentConfig, b as CreateInvoiceParams, I as Invoice, V as VerifyOptions, c as VerifyResult, W as WalletBalance, A as AuditAction, d as AuditEntry } from './index-CyFg9s2m.js';
|
|
2
|
+
export { E as EIP712TypedData, e as PendingTransfer, f as PermitExecuteResult, g as PermitRequest, h as PermitSignature, S as SecureWalletConfig, i as SecurityLimits, T as TransferParams, j as TransferResult } from './index-CyFg9s2m.js';
|
|
3
3
|
export { CreateWalletOptions, CreateWalletResult, PermitData, PermitWallet, PermitWalletConfig, SecureWallet, TransferWithPermitParams, TransferWithPermitResult, Wallet, WalletData, createWallet, formatPermitRequest, getWalletAddress, loadWallet, walletExists } from './wallet/index.js';
|
|
4
4
|
export { PermitPayment } from './permit/index.js';
|
|
5
5
|
export { CreateOrderParams, MemoryOrderStore, Order, OrderManager, OrderStatus, OrderStore } from './orders/index.js';
|
|
@@ -8,12 +8,12 @@ export { PaymentGuideParams, extractTransactionHash, generatePaymentGuide, gener
|
|
|
8
8
|
export { CHAINS, ERC20_ABI, getChain, getChainById, listChains } from './chains/index.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* PaymentAgent -
|
|
11
|
+
* PaymentAgent - Core Payment Agent
|
|
12
12
|
*
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
13
|
+
* Features:
|
|
14
|
+
* - Generate Invoice (payment request)
|
|
15
|
+
* - Verify on-chain payment
|
|
16
|
+
* - Generate wallet deep link
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
declare class PaymentAgent {
|
|
@@ -25,38 +25,38 @@ declare class PaymentAgent {
|
|
|
25
25
|
static readonly PROTOCOL_VERSION = "1.0";
|
|
26
26
|
constructor(config?: PaymentAgentConfig);
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Generate payment request(Invoice)
|
|
29
29
|
*/
|
|
30
30
|
createInvoice(params: CreateInvoiceParams): Invoice;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* Generate wallet deep link(supports MetaMask etc)
|
|
33
33
|
*/
|
|
34
34
|
generateDeepLink(amount: number, memo: string): string;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Verify on-chain payment
|
|
37
37
|
*/
|
|
38
38
|
verifyPayment(txHash: string, options?: VerifyOptions): Promise<VerifyResult>;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Scan recent transfers (match by amount)
|
|
41
41
|
*/
|
|
42
42
|
scanRecentTransfers(expectedAmount: number, timeoutMinutes?: number): Promise<VerifyResult>;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* Get wallet balance
|
|
45
45
|
*/
|
|
46
46
|
getBalance(address?: string): Promise<WalletBalance>;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Format Invoice as human-readable message
|
|
49
49
|
*/
|
|
50
50
|
formatInvoiceMessage(invoice: Invoice, includeJson?: boolean): string;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* AuditLog -
|
|
54
|
+
* AuditLog - Immutable Audit Log
|
|
55
55
|
*
|
|
56
|
-
*
|
|
57
|
-
* -
|
|
58
|
-
* -
|
|
59
|
-
* - JSONL
|
|
56
|
+
* Features:
|
|
57
|
+
* - Hash-chained, any modification breaks the chain
|
|
58
|
+
* - Stored by date in separate files
|
|
59
|
+
* - JSONL format for easy append and parse
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
62
|
interface LogParams {
|
|
@@ -75,22 +75,22 @@ declare class AuditLog {
|
|
|
75
75
|
private lastHash;
|
|
76
76
|
constructor(basePath?: string);
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Record audit log
|
|
79
79
|
*/
|
|
80
80
|
log(params: LogParams): Promise<AuditEntry>;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Read logs for specified date
|
|
83
83
|
*/
|
|
84
84
|
read(date?: Date): AuditEntry[];
|
|
85
85
|
/**
|
|
86
|
-
*
|
|
86
|
+
* Verify log integrity
|
|
87
87
|
*/
|
|
88
88
|
verify(date?: Date): {
|
|
89
89
|
valid: boolean;
|
|
90
90
|
errors: string[];
|
|
91
91
|
};
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* Search logs
|
|
94
94
|
*/
|
|
95
95
|
search(filter: Partial<{
|
|
96
96
|
action: AuditAction;
|
|
@@ -101,159 +101,159 @@ declare class AuditLog {
|
|
|
101
101
|
endDate: Date;
|
|
102
102
|
}>): AuditEntry[];
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* Get log file path
|
|
105
105
|
*/
|
|
106
106
|
private getFilePath;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* Calculate entry hash
|
|
109
109
|
*/
|
|
110
110
|
private calculateHash;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* Load last log entry hash
|
|
113
113
|
*/
|
|
114
114
|
private loadLastHash;
|
|
115
115
|
/**
|
|
116
|
-
*
|
|
116
|
+
* Ensure directory exists
|
|
117
117
|
*/
|
|
118
118
|
private ensureDir;
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
|
-
* Receipt -
|
|
122
|
+
* Receipt - Transaction receipt generation
|
|
123
123
|
*
|
|
124
|
-
*
|
|
124
|
+
* Generate standardized transaction receipts for reconciliation/reimbursement/audit
|
|
125
125
|
*/
|
|
126
126
|
|
|
127
127
|
interface ReceiptParams {
|
|
128
|
-
/**
|
|
128
|
+
/** Invoice ID (auto-generated or specified) */
|
|
129
129
|
invoiceId?: string;
|
|
130
|
-
/**
|
|
130
|
+
/** Order ID */
|
|
131
131
|
orderId: string;
|
|
132
|
-
/**
|
|
132
|
+
/** Service name */
|
|
133
133
|
service: string;
|
|
134
|
-
/**
|
|
134
|
+
/** Service description */
|
|
135
135
|
description?: string;
|
|
136
|
-
/**
|
|
136
|
+
/** Amount */
|
|
137
137
|
amount: number;
|
|
138
138
|
/** Token */
|
|
139
139
|
token?: 'USDC' | 'USDT' | 'ETH';
|
|
140
|
-
/**
|
|
140
|
+
/** Chain */
|
|
141
141
|
chain: ChainName;
|
|
142
|
-
/**
|
|
142
|
+
/** Transaction hash */
|
|
143
143
|
txHash: string;
|
|
144
|
-
/**
|
|
144
|
+
/** Payer address */
|
|
145
145
|
payerAddress: string;
|
|
146
|
-
/**
|
|
146
|
+
/** Recipient address */
|
|
147
147
|
recipientAddress: string;
|
|
148
|
-
/**
|
|
148
|
+
/** Delivery info */
|
|
149
149
|
delivery?: {
|
|
150
|
-
/**
|
|
150
|
+
/** Delivery URL */
|
|
151
151
|
url?: string;
|
|
152
|
-
/**
|
|
152
|
+
/** File hash */
|
|
153
153
|
fileHash?: string;
|
|
154
|
-
/**
|
|
154
|
+
/** Delivery timestamp */
|
|
155
155
|
deliveredAt?: string;
|
|
156
156
|
};
|
|
157
|
-
/**
|
|
157
|
+
/** Additional metadata */
|
|
158
158
|
metadata?: Record<string, unknown>;
|
|
159
159
|
}
|
|
160
160
|
interface Receipt {
|
|
161
161
|
type: 'receipt';
|
|
162
162
|
version: '1.0';
|
|
163
|
-
/**
|
|
163
|
+
/** Invoice ID */
|
|
164
164
|
invoiceId: string;
|
|
165
|
-
/**
|
|
165
|
+
/** Order ID */
|
|
166
166
|
orderId: string;
|
|
167
|
-
/**
|
|
167
|
+
/** Service */
|
|
168
168
|
service: string;
|
|
169
169
|
description?: string;
|
|
170
|
-
/**
|
|
170
|
+
/** Amount */
|
|
171
171
|
amount: string;
|
|
172
172
|
token: string;
|
|
173
|
-
/**
|
|
173
|
+
/** Chain info */
|
|
174
174
|
chain: string;
|
|
175
175
|
chainId: number;
|
|
176
|
-
/**
|
|
176
|
+
/** Transaction info */
|
|
177
177
|
txHash: string;
|
|
178
178
|
txUrl: string;
|
|
179
|
-
/**
|
|
179
|
+
/** Parties */
|
|
180
180
|
payer: string;
|
|
181
181
|
recipient: string;
|
|
182
|
-
/**
|
|
182
|
+
/** Timestamps */
|
|
183
183
|
paidAt: string;
|
|
184
184
|
issuedAt: string;
|
|
185
|
-
/**
|
|
185
|
+
/** Delivery info */
|
|
186
186
|
delivery?: {
|
|
187
187
|
url?: string;
|
|
188
188
|
fileHash?: string;
|
|
189
189
|
deliveredAt?: string;
|
|
190
190
|
};
|
|
191
|
-
/**
|
|
191
|
+
/** Additional metadata */
|
|
192
192
|
metadata?: Record<string, unknown>;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
|
-
*
|
|
195
|
+
* Generate transaction receipt
|
|
196
196
|
*/
|
|
197
197
|
declare function generateReceipt(params: ReceiptParams): Receipt;
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* Generate receipt from Invoice + VerifyResult
|
|
200
200
|
*/
|
|
201
201
|
declare function generateReceiptFromInvoice(invoice: Invoice, verifyResult: VerifyResult, delivery?: ReceiptParams['delivery']): Receipt;
|
|
202
202
|
/**
|
|
203
|
-
*
|
|
203
|
+
* Format receipt as human-readable message (Markdown)
|
|
204
204
|
*/
|
|
205
205
|
declare function formatReceiptMessage(receipt: Receipt): string;
|
|
206
206
|
/**
|
|
207
|
-
*
|
|
207
|
+
* Format receipt as plain text (for Feishu/WhatsApp)
|
|
208
208
|
*/
|
|
209
209
|
declare function formatReceiptText(receipt: Receipt): string;
|
|
210
210
|
/**
|
|
211
|
-
*
|
|
211
|
+
* Format receipt as JSON (for Agent parsing)
|
|
212
212
|
*/
|
|
213
213
|
declare function formatReceiptJson(receipt: Receipt): string;
|
|
214
214
|
|
|
215
215
|
/**
|
|
216
|
-
* Agent
|
|
216
|
+
* Agent Conversation Templates
|
|
217
217
|
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
218
|
+
* Standardized Agent-to-Agent payment conversation templates
|
|
219
|
+
* Can be embedded in prompts or used for dialogue generation
|
|
220
220
|
*/
|
|
221
221
|
|
|
222
222
|
declare const SellerTemplates: {
|
|
223
223
|
/**
|
|
224
|
-
* 1.
|
|
224
|
+
* 1. Capability Check - Ask if buyer has payment capability
|
|
225
225
|
*/
|
|
226
226
|
askPaymentCapability(): string;
|
|
227
227
|
/**
|
|
228
|
-
* 2.
|
|
228
|
+
* 2. Settlement Method - Explain how we settle
|
|
229
229
|
*/
|
|
230
230
|
explainSettlement(chain?: ChainName): string;
|
|
231
231
|
/**
|
|
232
|
-
* 3.1
|
|
232
|
+
* 3.1 Installation Guide - First step: install SDK
|
|
233
233
|
*/
|
|
234
234
|
guideInstall(): string;
|
|
235
235
|
/**
|
|
236
|
-
* 3.2
|
|
236
|
+
* 3.2 Confirm Wallet Address
|
|
237
237
|
*/
|
|
238
238
|
confirmWalletAddress(address: string): string;
|
|
239
239
|
/**
|
|
240
|
-
* 3.3
|
|
240
|
+
* 3.3 Funding Options - Choose method
|
|
241
241
|
*/
|
|
242
242
|
guideFunding(): string;
|
|
243
243
|
/**
|
|
244
|
-
* 3.4
|
|
244
|
+
* 3.4 Guide Permit Authorization
|
|
245
245
|
*/
|
|
246
246
|
guidePermit(agentAddress: string, suggestedAmount?: number): string;
|
|
247
247
|
/**
|
|
248
|
-
* 3.5
|
|
248
|
+
* 3.5 Confirm Capability Ready
|
|
249
249
|
*/
|
|
250
250
|
confirmCapabilityReady(): string;
|
|
251
251
|
/**
|
|
252
|
-
* 4.
|
|
252
|
+
* 4. Ask Service Requirements
|
|
253
253
|
*/
|
|
254
254
|
askServiceRequirements(serviceName?: string): string;
|
|
255
255
|
/**
|
|
256
|
-
* 5.
|
|
256
|
+
* 5. Quote
|
|
257
257
|
*/
|
|
258
258
|
quote(params: {
|
|
259
259
|
service: string;
|
|
@@ -262,88 +262,88 @@ declare const SellerTemplates: {
|
|
|
262
262
|
chain?: ChainName;
|
|
263
263
|
}): string;
|
|
264
264
|
/**
|
|
265
|
-
* 7.
|
|
265
|
+
* 7. Verifying
|
|
266
266
|
*/
|
|
267
267
|
verifying(): string;
|
|
268
268
|
/**
|
|
269
|
-
* 7.
|
|
269
|
+
* 7. Verification Passed
|
|
270
270
|
*/
|
|
271
271
|
verificationPassed(amount: string): string;
|
|
272
272
|
/**
|
|
273
|
-
* 7.
|
|
273
|
+
* 7. Verification Failed
|
|
274
274
|
*/
|
|
275
275
|
verificationFailed(error: string): string;
|
|
276
276
|
/**
|
|
277
|
-
* 8.
|
|
277
|
+
* 8. Delivery
|
|
278
278
|
*/
|
|
279
279
|
deliver(params: {
|
|
280
280
|
downloadUrl: string;
|
|
281
281
|
fileHash?: string;
|
|
282
282
|
}): string;
|
|
283
283
|
/**
|
|
284
|
-
* 9.
|
|
284
|
+
* 9. Receipt
|
|
285
285
|
*/
|
|
286
286
|
receipt(receipt: Receipt): string;
|
|
287
287
|
/**
|
|
288
|
-
* 10.
|
|
288
|
+
* 10. End
|
|
289
289
|
*/
|
|
290
290
|
end(): string;
|
|
291
291
|
};
|
|
292
292
|
declare const BuyerTemplates: {
|
|
293
293
|
/**
|
|
294
|
-
* 0.
|
|
294
|
+
* 0. Request Service
|
|
295
295
|
*/
|
|
296
296
|
requestService(service: string): string;
|
|
297
297
|
/**
|
|
298
|
-
* 1.
|
|
298
|
+
* 1. No Capability
|
|
299
299
|
*/
|
|
300
300
|
noCapability(): string;
|
|
301
301
|
/**
|
|
302
|
-
* 1.
|
|
302
|
+
* 1. Has Capability
|
|
303
303
|
*/
|
|
304
304
|
hasCapability(balance?: string): string;
|
|
305
305
|
/**
|
|
306
|
-
* 2.
|
|
306
|
+
* 2. Agree to Guide
|
|
307
307
|
*/
|
|
308
308
|
agreeToGuide(): string;
|
|
309
309
|
/**
|
|
310
|
-
* 3.1
|
|
310
|
+
* 3.1 Report Wallet Created
|
|
311
311
|
*/
|
|
312
312
|
walletCreated(address: string): string;
|
|
313
313
|
/**
|
|
314
|
-
* 3.3
|
|
314
|
+
* 3.3 Choose Permit Method
|
|
315
315
|
*/
|
|
316
316
|
choosePermit(): string;
|
|
317
317
|
/**
|
|
318
|
-
* 3.3
|
|
318
|
+
* 3.3 Choose Direct Transfer
|
|
319
319
|
*/
|
|
320
320
|
chooseDirectTransfer(): string;
|
|
321
321
|
/**
|
|
322
|
-
* 3.4
|
|
322
|
+
* 3.4 Report Permit Received
|
|
323
323
|
*/
|
|
324
324
|
permitReceived(amount: number): string;
|
|
325
325
|
/**
|
|
326
|
-
* 4.
|
|
326
|
+
* 4. Submit Requirements
|
|
327
327
|
*/
|
|
328
328
|
submitRequirements(requirements: string): string;
|
|
329
329
|
/**
|
|
330
|
-
* 5.
|
|
330
|
+
* 5. Confirm Purchase
|
|
331
331
|
*/
|
|
332
332
|
confirmPurchase(): string;
|
|
333
333
|
/**
|
|
334
|
-
* 6.
|
|
334
|
+
* 6. Report Payment Sent
|
|
335
335
|
*/
|
|
336
336
|
paymentSent(txHash: string, amount: number): string;
|
|
337
337
|
/**
|
|
338
|
-
* 8.
|
|
338
|
+
* 8. Confirm Delivery Received
|
|
339
339
|
*/
|
|
340
340
|
deliveryReceived(): string;
|
|
341
341
|
/**
|
|
342
|
-
* 9.
|
|
342
|
+
* 9. Confirm Receipt
|
|
343
343
|
*/
|
|
344
344
|
receiptReceived(): string;
|
|
345
345
|
/**
|
|
346
|
-
*
|
|
346
|
+
* Request Permit from Boss
|
|
347
347
|
*/
|
|
348
348
|
requestPermitFromBoss(params: {
|
|
349
349
|
amount: number;
|