moltspay 0.5.4 → 0.7.1
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 +0 -124
- package/dist/cdp/index.d.mts +111 -0
- package/dist/cdp/index.d.ts +111 -0
- package/dist/cdp/index.js +30655 -0
- package/dist/cdp/index.js.map +1 -0
- package/dist/cdp/index.mjs +30631 -0
- package/dist/cdp/index.mjs.map +1 -0
- package/dist/chains/index.d.mts +1 -1
- package/dist/chains/index.d.ts +1 -1
- package/dist/cli/index.js +990 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +967 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/client/index.d.mts +134 -0
- package/dist/client/index.d.ts +134 -0
- package/dist/client/index.js +331 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/index.mjs +296 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/createWallet-D53qu7ie.d.mts +77 -0
- package/dist/createWallet-D53qu7ie.d.ts +77 -0
- package/dist/index-Dg8n6wdW.d.mts +32 -0
- package/dist/index-Dg8n6wdW.d.ts +32 -0
- package/dist/index.d.mts +6 -1483
- package/dist/index.d.ts +6 -1483
- package/dist/index.js +31039 -4254
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31042 -4203
- package/dist/index.mjs.map +1 -1
- package/dist/server/index.d.mts +120 -0
- package/dist/server/index.d.ts +120 -0
- package/dist/server/index.js +418 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +393 -0
- package/dist/server/index.mjs.map +1 -0
- package/dist/wallet/index.d.mts +3 -451
- package/dist/wallet/index.d.ts +3 -451
- package/dist/wallet/index.js +5 -1021
- package/dist/wallet/index.js.map +1 -1
- package/dist/wallet/index.mjs +16 -1015
- package/dist/wallet/index.mjs.map +1 -1
- package/package.json +19 -19
- package/dist/cli.js +0 -1984
- package/dist/cli.js.map +0 -1
- package/dist/cli.mjs +0 -1969
- package/dist/cli.mjs.map +0 -1
- package/dist/guide/index.d.mts +0 -39
- package/dist/guide/index.d.ts +0 -39
- package/dist/guide/index.js +0 -181
- package/dist/guide/index.js.map +0 -1
- package/dist/guide/index.mjs +0 -152
- package/dist/guide/index.mjs.map +0 -1
- package/dist/index-CyFg9s2m.d.mts +0 -161
- package/dist/index-CyFg9s2m.d.ts +0 -161
- package/dist/orders/index.d.mts +0 -97
- package/dist/orders/index.d.ts +0 -97
- package/dist/orders/index.js +0 -162
- package/dist/orders/index.js.map +0 -1
- package/dist/orders/index.mjs +0 -136
- package/dist/orders/index.mjs.map +0 -1
- package/dist/permit/index.d.mts +0 -49
- package/dist/permit/index.d.ts +0 -49
- package/dist/permit/index.js +0 -273
- package/dist/permit/index.js.map +0 -1
- package/dist/permit/index.mjs +0 -246
- package/dist/permit/index.mjs.map +0 -1
- /package/dist/{cli.d.mts → cli/index.d.mts} +0 -0
- /package/dist/{cli.d.ts → cli/index.d.ts} +0 -0
package/dist/guide/index.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/guide/index.ts
|
|
21
|
-
var guide_exports = {};
|
|
22
|
-
__export(guide_exports, {
|
|
23
|
-
extractTransactionHash: () => extractTransactionHash,
|
|
24
|
-
generatePaymentGuide: () => generatePaymentGuide,
|
|
25
|
-
generatePaymentReminder: () => generatePaymentReminder,
|
|
26
|
-
generateWalletGuide: () => generateWalletGuide,
|
|
27
|
-
hasTransactionHash: () => hasTransactionHash
|
|
28
|
-
});
|
|
29
|
-
module.exports = __toCommonJS(guide_exports);
|
|
30
|
-
function generatePaymentGuide(params) {
|
|
31
|
-
const {
|
|
32
|
-
orderId,
|
|
33
|
-
prompt,
|
|
34
|
-
price,
|
|
35
|
-
recipientAddress,
|
|
36
|
-
chain = "base",
|
|
37
|
-
serviceName = "Video Generation Service"
|
|
38
|
-
} = params;
|
|
39
|
-
const chainId = chain === "base" ? 8453 : 84532;
|
|
40
|
-
const chainName = chain === "base" ? "Base Mainnet" : "Base Sepolia Testnet";
|
|
41
|
-
const explorer = chain === "base" ? "https://basescan.org/tx/" : "https://sepolia.basescan.org/tx/";
|
|
42
|
-
return `\u{1F3AC} **${serviceName}**
|
|
43
|
-
|
|
44
|
-
\u{1F4CB} **Order Details:**
|
|
45
|
-
- Order ID: \`${orderId}\`
|
|
46
|
-
- Content: ${prompt.length > 50 ? prompt.slice(0, 50) + "..." : prompt}
|
|
47
|
-
- Price: **${price} USDC**
|
|
48
|
-
- Chain: ${chainName}
|
|
49
|
-
|
|
50
|
-
---
|
|
51
|
-
|
|
52
|
-
## \u{1F4B3} How to Pay
|
|
53
|
-
|
|
54
|
-
### Option 1: Install moltspay SDK (Recommended)
|
|
55
|
-
|
|
56
|
-
\`\`\`bash
|
|
57
|
-
npm install moltspay ethers
|
|
58
|
-
\`\`\`
|
|
59
|
-
|
|
60
|
-
**Create wallet and pay:**
|
|
61
|
-
|
|
62
|
-
\`\`\`javascript
|
|
63
|
-
const { SecureWallet, getChain } = require('moltspay');
|
|
64
|
-
const { Wallet } = require('ethers');
|
|
65
|
-
|
|
66
|
-
// 1. Create new wallet (first time)
|
|
67
|
-
const newWallet = Wallet.createRandom();
|
|
68
|
-
console.log('Wallet address:', newWallet.address);
|
|
69
|
-
console.log('Private key (save securely):', newWallet.privateKey);
|
|
70
|
-
|
|
71
|
-
// 2. Or use existing wallet
|
|
72
|
-
const wallet = new SecureWallet({
|
|
73
|
-
chainId: ${chainId},
|
|
74
|
-
privateKey: process.env.WALLET_KEY, // Your private key
|
|
75
|
-
limits: { requireWhitelist: false } // Allow transfers to any address
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
// 3. Check balance
|
|
79
|
-
const balance = await wallet.getBalance();
|
|
80
|
-
console.log('USDC balance:', balance.usdc);
|
|
81
|
-
|
|
82
|
-
// 4. Pay
|
|
83
|
-
const result = await wallet.transfer('${recipientAddress}', '${price}');
|
|
84
|
-
if (result.success) {
|
|
85
|
-
console.log('\u2705 Payment successful!');
|
|
86
|
-
console.log('Tx hash:', result.hash);
|
|
87
|
-
// Send the tx hash to me
|
|
88
|
-
}
|
|
89
|
-
\`\`\`
|
|
90
|
-
|
|
91
|
-
### Option 2: Direct Transfer
|
|
92
|
-
|
|
93
|
-
Transfer USDC from any wallet:
|
|
94
|
-
- **Chain:** ${chainName} (Chain ID: ${chainId})
|
|
95
|
-
- **Token:** USDC
|
|
96
|
-
- **Recipient:** \`${recipientAddress}\`
|
|
97
|
-
- **Amount:** ${price} USDC
|
|
98
|
-
|
|
99
|
-
---
|
|
100
|
-
|
|
101
|
-
## \u2705 After Payment
|
|
102
|
-
|
|
103
|
-
Send me the **transaction hash**, format:
|
|
104
|
-
\`\`\`
|
|
105
|
-
tx: 0x1234...
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
Or just send the hash directly:
|
|
109
|
-
\`\`\`
|
|
110
|
-
0x1234abcd...
|
|
111
|
-
\`\`\`
|
|
112
|
-
|
|
113
|
-
I'll verify the on-chain transaction and start processing your request.
|
|
114
|
-
|
|
115
|
-
---
|
|
116
|
-
|
|
117
|
-
\u{1F4E6} **moltspay:** https://www.npmjs.com/package/moltspay
|
|
118
|
-
\u{1F517} **Block Explorer:** ${explorer}`;
|
|
119
|
-
}
|
|
120
|
-
function generatePaymentReminder(params) {
|
|
121
|
-
const { orderId, price, recipientAddress, chain = "base" } = params;
|
|
122
|
-
const chainName = chain === "base" ? "Base" : "Base Sepolia";
|
|
123
|
-
return `\u23F3 **Pending Order: ${orderId}**
|
|
124
|
-
|
|
125
|
-
Please pay **${price} USDC** to:
|
|
126
|
-
- Chain: ${chainName}
|
|
127
|
-
- Address: \`${recipientAddress}\`
|
|
128
|
-
|
|
129
|
-
Send the tx hash after payment.
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
\u{1F4A1} No payment capability? Run \`npm install moltspay\` to get the payment SDK`;
|
|
133
|
-
}
|
|
134
|
-
function generateWalletGuide() {
|
|
135
|
-
return `## \u{1F510} Create Payment Wallet
|
|
136
|
-
|
|
137
|
-
**1. Install moltspay:**
|
|
138
|
-
\`\`\`bash
|
|
139
|
-
npm install moltspay ethers
|
|
140
|
-
\`\`\`
|
|
141
|
-
|
|
142
|
-
**2. Create new wallet:**
|
|
143
|
-
\`\`\`javascript
|
|
144
|
-
const { Wallet } = require('ethers');
|
|
145
|
-
|
|
146
|
-
const wallet = Wallet.createRandom();
|
|
147
|
-
console.log('Address:', wallet.address);
|
|
148
|
-
console.log('Private key:', wallet.privateKey);
|
|
149
|
-
// \u26A0\uFE0F Save the private key securely!
|
|
150
|
-
\`\`\`
|
|
151
|
-
|
|
152
|
-
**3. Get USDC:**
|
|
153
|
-
- Mainnet: Withdraw from exchange to your wallet
|
|
154
|
-
- Testnet: Use Base Sepolia faucet
|
|
155
|
-
|
|
156
|
-
**4. Set environment variable:**
|
|
157
|
-
\`\`\`bash
|
|
158
|
-
export WALLET_KEY="your_private_key"
|
|
159
|
-
\`\`\`
|
|
160
|
-
|
|
161
|
-
You're now ready to make on-chain payments with moltspay!`;
|
|
162
|
-
}
|
|
163
|
-
function extractTransactionHash(message) {
|
|
164
|
-
const match = message.match(/0x[a-fA-F0-9]{64}/);
|
|
165
|
-
if (match) return match[0];
|
|
166
|
-
const txMatch = message.match(/tx:\s*([a-fA-F0-9]{64})/i);
|
|
167
|
-
if (txMatch) return "0x" + txMatch[1];
|
|
168
|
-
return null;
|
|
169
|
-
}
|
|
170
|
-
function hasTransactionHash(message) {
|
|
171
|
-
return extractTransactionHash(message) !== null;
|
|
172
|
-
}
|
|
173
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
174
|
-
0 && (module.exports = {
|
|
175
|
-
extractTransactionHash,
|
|
176
|
-
generatePaymentGuide,
|
|
177
|
-
generatePaymentReminder,
|
|
178
|
-
generateWalletGuide,
|
|
179
|
-
hasTransactionHash
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=index.js.map
|
package/dist/guide/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/guide/index.ts"],"sourcesContent":["/**\n * Payment Guide Generator\n * Generate guides for Agents without payment capability to install and use moltspay\n */\n\nexport interface PaymentGuideParams {\n orderId: string;\n prompt: string;\n price: number;\n recipientAddress: string;\n chain?: 'base' | 'base_sepolia';\n serviceName?: string;\n}\n\n/**\n * Generate complete payment guide message\n */\nexport function generatePaymentGuide(params: PaymentGuideParams): string {\n const {\n orderId,\n prompt,\n price,\n recipientAddress,\n chain = 'base',\n serviceName = 'Video Generation Service'\n } = params;\n\n const chainId = chain === 'base' ? 8453 : 84532;\n const chainName = chain === 'base' ? 'Base Mainnet' : 'Base Sepolia Testnet';\n const explorer = chain === 'base' \n ? 'https://basescan.org/tx/' \n : 'https://sepolia.basescan.org/tx/';\n\n return `🎬 **${serviceName}**\n\n📋 **Order Details:**\n- Order ID: \\`${orderId}\\`\n- Content: ${prompt.length > 50 ? prompt.slice(0, 50) + '...' : prompt}\n- Price: **${price} USDC**\n- Chain: ${chainName}\n\n---\n\n## 💳 How to Pay\n\n### Option 1: Install moltspay SDK (Recommended)\n\n\\`\\`\\`bash\nnpm install moltspay ethers\n\\`\\`\\`\n\n**Create wallet and pay:**\n\n\\`\\`\\`javascript\nconst { SecureWallet, getChain } = require('moltspay');\nconst { Wallet } = require('ethers');\n\n// 1. Create new wallet (first time)\nconst newWallet = Wallet.createRandom();\nconsole.log('Wallet address:', newWallet.address);\nconsole.log('Private key (save securely):', newWallet.privateKey);\n\n// 2. Or use existing wallet\nconst wallet = new SecureWallet({\n chainId: ${chainId},\n privateKey: process.env.WALLET_KEY, // Your private key\n limits: { requireWhitelist: false } // Allow transfers to any address\n});\n\n// 3. Check balance\nconst balance = await wallet.getBalance();\nconsole.log('USDC balance:', balance.usdc);\n\n// 4. Pay\nconst result = await wallet.transfer('${recipientAddress}', '${price}');\nif (result.success) {\n console.log('✅ Payment successful!');\n console.log('Tx hash:', result.hash);\n // Send the tx hash to me\n}\n\\`\\`\\`\n\n### Option 2: Direct Transfer\n\nTransfer USDC from any wallet:\n- **Chain:** ${chainName} (Chain ID: ${chainId})\n- **Token:** USDC\n- **Recipient:** \\`${recipientAddress}\\`\n- **Amount:** ${price} USDC\n\n---\n\n## ✅ After Payment\n\nSend me the **transaction hash**, format:\n\\`\\`\\`\ntx: 0x1234...\n\\`\\`\\`\n\nOr just send the hash directly:\n\\`\\`\\`\n0x1234abcd...\n\\`\\`\\`\n\nI'll verify the on-chain transaction and start processing your request.\n\n---\n\n📦 **moltspay:** https://www.npmjs.com/package/moltspay\n🔗 **Block Explorer:** ${explorer}`;\n}\n\n/**\n * Generate short payment reminder\n */\nexport function generatePaymentReminder(params: {\n orderId: string;\n price: number;\n recipientAddress: string;\n chain?: 'base' | 'base_sepolia';\n}): string {\n const { orderId, price, recipientAddress, chain = 'base' } = params;\n const chainName = chain === 'base' ? 'Base' : 'Base Sepolia';\n\n return `⏳ **Pending Order: ${orderId}**\n\nPlease pay **${price} USDC** to:\n- Chain: ${chainName}\n- Address: \\`${recipientAddress}\\`\n\nSend the tx hash after payment.\n\n---\n💡 No payment capability? Run \\`npm install moltspay\\` to get the payment SDK`;\n}\n\n/**\n * Generate wallet creation guide\n */\nexport function generateWalletGuide(): string {\n return `## 🔐 Create Payment Wallet\n\n**1. Install moltspay:**\n\\`\\`\\`bash\nnpm install moltspay ethers\n\\`\\`\\`\n\n**2. Create new wallet:**\n\\`\\`\\`javascript\nconst { Wallet } = require('ethers');\n\nconst wallet = Wallet.createRandom();\nconsole.log('Address:', wallet.address);\nconsole.log('Private key:', wallet.privateKey);\n// ⚠️ Save the private key securely!\n\\`\\`\\`\n\n**3. Get USDC:**\n- Mainnet: Withdraw from exchange to your wallet\n- Testnet: Use Base Sepolia faucet\n\n**4. Set environment variable:**\n\\`\\`\\`bash\nexport WALLET_KEY=\"your_private_key\"\n\\`\\`\\`\n\nYou're now ready to make on-chain payments with moltspay!`;\n}\n\n/**\n * Extract transaction hash from user message\n */\nexport function extractTransactionHash(message: string): string | null {\n // Match 0x followed by 64 hex chars\n const match = message.match(/0x[a-fA-F0-9]{64}/);\n if (match) return match[0];\n\n // Match tx: followed by content\n const txMatch = message.match(/tx:\\s*([a-fA-F0-9]{64})/i);\n if (txMatch) return '0x' + txMatch[1];\n\n return null;\n}\n\n/**\n * Check if message contains transaction hash\n */\nexport function hasTransactionHash(message: string): boolean {\n return extractTransactionHash(message) !== null;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBO,SAAS,qBAAqB,QAAoC;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,EAChB,IAAI;AAEJ,QAAM,UAAU,UAAU,SAAS,OAAO;AAC1C,QAAM,YAAY,UAAU,SAAS,iBAAiB;AACtD,QAAM,WAAW,UAAU,SACvB,6BACA;AAEJ,SAAO,eAAQ,WAAW;AAAA;AAAA;AAAA,gBAGZ,OAAO;AAAA,aACV,OAAO,SAAS,KAAK,OAAO,MAAM,GAAG,EAAE,IAAI,QAAQ,MAAM;AAAA,aACzD,KAAK;AAAA,WACP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAyBP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAUoB,gBAAgB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAWrD,SAAS,eAAe,OAAO;AAAA;AAAA,qBAEzB,gBAAgB;AAAA,gBACrB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAqBI,QAAQ;AACjC;AAKO,SAAS,wBAAwB,QAK7B;AACT,QAAM,EAAE,SAAS,OAAO,kBAAkB,QAAQ,OAAO,IAAI;AAC7D,QAAM,YAAY,UAAU,SAAS,SAAS;AAE9C,SAAO,2BAAsB,OAAO;AAAA;AAAA,eAEvB,KAAK;AAAA,WACT,SAAS;AAAA,eACL,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAM/B;AAKO,SAAS,sBAA8B;AAC5C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BT;AAKO,SAAS,uBAAuB,SAAgC;AAErE,QAAM,QAAQ,QAAQ,MAAM,mBAAmB;AAC/C,MAAI,MAAO,QAAO,MAAM,CAAC;AAGzB,QAAM,UAAU,QAAQ,MAAM,0BAA0B;AACxD,MAAI,QAAS,QAAO,OAAO,QAAQ,CAAC;AAEpC,SAAO;AACT;AAKO,SAAS,mBAAmB,SAA0B;AAC3D,SAAO,uBAAuB,OAAO,MAAM;AAC7C;","names":[]}
|
package/dist/guide/index.mjs
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// src/guide/index.ts
|
|
2
|
-
function generatePaymentGuide(params) {
|
|
3
|
-
const {
|
|
4
|
-
orderId,
|
|
5
|
-
prompt,
|
|
6
|
-
price,
|
|
7
|
-
recipientAddress,
|
|
8
|
-
chain = "base",
|
|
9
|
-
serviceName = "Video Generation Service"
|
|
10
|
-
} = params;
|
|
11
|
-
const chainId = chain === "base" ? 8453 : 84532;
|
|
12
|
-
const chainName = chain === "base" ? "Base Mainnet" : "Base Sepolia Testnet";
|
|
13
|
-
const explorer = chain === "base" ? "https://basescan.org/tx/" : "https://sepolia.basescan.org/tx/";
|
|
14
|
-
return `\u{1F3AC} **${serviceName}**
|
|
15
|
-
|
|
16
|
-
\u{1F4CB} **Order Details:**
|
|
17
|
-
- Order ID: \`${orderId}\`
|
|
18
|
-
- Content: ${prompt.length > 50 ? prompt.slice(0, 50) + "..." : prompt}
|
|
19
|
-
- Price: **${price} USDC**
|
|
20
|
-
- Chain: ${chainName}
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## \u{1F4B3} How to Pay
|
|
25
|
-
|
|
26
|
-
### Option 1: Install moltspay SDK (Recommended)
|
|
27
|
-
|
|
28
|
-
\`\`\`bash
|
|
29
|
-
npm install moltspay ethers
|
|
30
|
-
\`\`\`
|
|
31
|
-
|
|
32
|
-
**Create wallet and pay:**
|
|
33
|
-
|
|
34
|
-
\`\`\`javascript
|
|
35
|
-
const { SecureWallet, getChain } = require('moltspay');
|
|
36
|
-
const { Wallet } = require('ethers');
|
|
37
|
-
|
|
38
|
-
// 1. Create new wallet (first time)
|
|
39
|
-
const newWallet = Wallet.createRandom();
|
|
40
|
-
console.log('Wallet address:', newWallet.address);
|
|
41
|
-
console.log('Private key (save securely):', newWallet.privateKey);
|
|
42
|
-
|
|
43
|
-
// 2. Or use existing wallet
|
|
44
|
-
const wallet = new SecureWallet({
|
|
45
|
-
chainId: ${chainId},
|
|
46
|
-
privateKey: process.env.WALLET_KEY, // Your private key
|
|
47
|
-
limits: { requireWhitelist: false } // Allow transfers to any address
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// 3. Check balance
|
|
51
|
-
const balance = await wallet.getBalance();
|
|
52
|
-
console.log('USDC balance:', balance.usdc);
|
|
53
|
-
|
|
54
|
-
// 4. Pay
|
|
55
|
-
const result = await wallet.transfer('${recipientAddress}', '${price}');
|
|
56
|
-
if (result.success) {
|
|
57
|
-
console.log('\u2705 Payment successful!');
|
|
58
|
-
console.log('Tx hash:', result.hash);
|
|
59
|
-
// Send the tx hash to me
|
|
60
|
-
}
|
|
61
|
-
\`\`\`
|
|
62
|
-
|
|
63
|
-
### Option 2: Direct Transfer
|
|
64
|
-
|
|
65
|
-
Transfer USDC from any wallet:
|
|
66
|
-
- **Chain:** ${chainName} (Chain ID: ${chainId})
|
|
67
|
-
- **Token:** USDC
|
|
68
|
-
- **Recipient:** \`${recipientAddress}\`
|
|
69
|
-
- **Amount:** ${price} USDC
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## \u2705 After Payment
|
|
74
|
-
|
|
75
|
-
Send me the **transaction hash**, format:
|
|
76
|
-
\`\`\`
|
|
77
|
-
tx: 0x1234...
|
|
78
|
-
\`\`\`
|
|
79
|
-
|
|
80
|
-
Or just send the hash directly:
|
|
81
|
-
\`\`\`
|
|
82
|
-
0x1234abcd...
|
|
83
|
-
\`\`\`
|
|
84
|
-
|
|
85
|
-
I'll verify the on-chain transaction and start processing your request.
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
\u{1F4E6} **moltspay:** https://www.npmjs.com/package/moltspay
|
|
90
|
-
\u{1F517} **Block Explorer:** ${explorer}`;
|
|
91
|
-
}
|
|
92
|
-
function generatePaymentReminder(params) {
|
|
93
|
-
const { orderId, price, recipientAddress, chain = "base" } = params;
|
|
94
|
-
const chainName = chain === "base" ? "Base" : "Base Sepolia";
|
|
95
|
-
return `\u23F3 **Pending Order: ${orderId}**
|
|
96
|
-
|
|
97
|
-
Please pay **${price} USDC** to:
|
|
98
|
-
- Chain: ${chainName}
|
|
99
|
-
- Address: \`${recipientAddress}\`
|
|
100
|
-
|
|
101
|
-
Send the tx hash after payment.
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
\u{1F4A1} No payment capability? Run \`npm install moltspay\` to get the payment SDK`;
|
|
105
|
-
}
|
|
106
|
-
function generateWalletGuide() {
|
|
107
|
-
return `## \u{1F510} Create Payment Wallet
|
|
108
|
-
|
|
109
|
-
**1. Install moltspay:**
|
|
110
|
-
\`\`\`bash
|
|
111
|
-
npm install moltspay ethers
|
|
112
|
-
\`\`\`
|
|
113
|
-
|
|
114
|
-
**2. Create new wallet:**
|
|
115
|
-
\`\`\`javascript
|
|
116
|
-
const { Wallet } = require('ethers');
|
|
117
|
-
|
|
118
|
-
const wallet = Wallet.createRandom();
|
|
119
|
-
console.log('Address:', wallet.address);
|
|
120
|
-
console.log('Private key:', wallet.privateKey);
|
|
121
|
-
// \u26A0\uFE0F Save the private key securely!
|
|
122
|
-
\`\`\`
|
|
123
|
-
|
|
124
|
-
**3. Get USDC:**
|
|
125
|
-
- Mainnet: Withdraw from exchange to your wallet
|
|
126
|
-
- Testnet: Use Base Sepolia faucet
|
|
127
|
-
|
|
128
|
-
**4. Set environment variable:**
|
|
129
|
-
\`\`\`bash
|
|
130
|
-
export WALLET_KEY="your_private_key"
|
|
131
|
-
\`\`\`
|
|
132
|
-
|
|
133
|
-
You're now ready to make on-chain payments with moltspay!`;
|
|
134
|
-
}
|
|
135
|
-
function extractTransactionHash(message) {
|
|
136
|
-
const match = message.match(/0x[a-fA-F0-9]{64}/);
|
|
137
|
-
if (match) return match[0];
|
|
138
|
-
const txMatch = message.match(/tx:\s*([a-fA-F0-9]{64})/i);
|
|
139
|
-
if (txMatch) return "0x" + txMatch[1];
|
|
140
|
-
return null;
|
|
141
|
-
}
|
|
142
|
-
function hasTransactionHash(message) {
|
|
143
|
-
return extractTransactionHash(message) !== null;
|
|
144
|
-
}
|
|
145
|
-
export {
|
|
146
|
-
extractTransactionHash,
|
|
147
|
-
generatePaymentGuide,
|
|
148
|
-
generatePaymentReminder,
|
|
149
|
-
generateWalletGuide,
|
|
150
|
-
hasTransactionHash
|
|
151
|
-
};
|
|
152
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/guide/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/guide/index.ts"],"sourcesContent":["/**\n * Payment Guide Generator\n * Generate guides for Agents without payment capability to install and use moltspay\n */\n\nexport interface PaymentGuideParams {\n orderId: string;\n prompt: string;\n price: number;\n recipientAddress: string;\n chain?: 'base' | 'base_sepolia';\n serviceName?: string;\n}\n\n/**\n * Generate complete payment guide message\n */\nexport function generatePaymentGuide(params: PaymentGuideParams): string {\n const {\n orderId,\n prompt,\n price,\n recipientAddress,\n chain = 'base',\n serviceName = 'Video Generation Service'\n } = params;\n\n const chainId = chain === 'base' ? 8453 : 84532;\n const chainName = chain === 'base' ? 'Base Mainnet' : 'Base Sepolia Testnet';\n const explorer = chain === 'base' \n ? 'https://basescan.org/tx/' \n : 'https://sepolia.basescan.org/tx/';\n\n return `🎬 **${serviceName}**\n\n📋 **Order Details:**\n- Order ID: \\`${orderId}\\`\n- Content: ${prompt.length > 50 ? prompt.slice(0, 50) + '...' : prompt}\n- Price: **${price} USDC**\n- Chain: ${chainName}\n\n---\n\n## 💳 How to Pay\n\n### Option 1: Install moltspay SDK (Recommended)\n\n\\`\\`\\`bash\nnpm install moltspay ethers\n\\`\\`\\`\n\n**Create wallet and pay:**\n\n\\`\\`\\`javascript\nconst { SecureWallet, getChain } = require('moltspay');\nconst { Wallet } = require('ethers');\n\n// 1. Create new wallet (first time)\nconst newWallet = Wallet.createRandom();\nconsole.log('Wallet address:', newWallet.address);\nconsole.log('Private key (save securely):', newWallet.privateKey);\n\n// 2. Or use existing wallet\nconst wallet = new SecureWallet({\n chainId: ${chainId},\n privateKey: process.env.WALLET_KEY, // Your private key\n limits: { requireWhitelist: false } // Allow transfers to any address\n});\n\n// 3. Check balance\nconst balance = await wallet.getBalance();\nconsole.log('USDC balance:', balance.usdc);\n\n// 4. Pay\nconst result = await wallet.transfer('${recipientAddress}', '${price}');\nif (result.success) {\n console.log('✅ Payment successful!');\n console.log('Tx hash:', result.hash);\n // Send the tx hash to me\n}\n\\`\\`\\`\n\n### Option 2: Direct Transfer\n\nTransfer USDC from any wallet:\n- **Chain:** ${chainName} (Chain ID: ${chainId})\n- **Token:** USDC\n- **Recipient:** \\`${recipientAddress}\\`\n- **Amount:** ${price} USDC\n\n---\n\n## ✅ After Payment\n\nSend me the **transaction hash**, format:\n\\`\\`\\`\ntx: 0x1234...\n\\`\\`\\`\n\nOr just send the hash directly:\n\\`\\`\\`\n0x1234abcd...\n\\`\\`\\`\n\nI'll verify the on-chain transaction and start processing your request.\n\n---\n\n📦 **moltspay:** https://www.npmjs.com/package/moltspay\n🔗 **Block Explorer:** ${explorer}`;\n}\n\n/**\n * Generate short payment reminder\n */\nexport function generatePaymentReminder(params: {\n orderId: string;\n price: number;\n recipientAddress: string;\n chain?: 'base' | 'base_sepolia';\n}): string {\n const { orderId, price, recipientAddress, chain = 'base' } = params;\n const chainName = chain === 'base' ? 'Base' : 'Base Sepolia';\n\n return `⏳ **Pending Order: ${orderId}**\n\nPlease pay **${price} USDC** to:\n- Chain: ${chainName}\n- Address: \\`${recipientAddress}\\`\n\nSend the tx hash after payment.\n\n---\n💡 No payment capability? Run \\`npm install moltspay\\` to get the payment SDK`;\n}\n\n/**\n * Generate wallet creation guide\n */\nexport function generateWalletGuide(): string {\n return `## 🔐 Create Payment Wallet\n\n**1. Install moltspay:**\n\\`\\`\\`bash\nnpm install moltspay ethers\n\\`\\`\\`\n\n**2. Create new wallet:**\n\\`\\`\\`javascript\nconst { Wallet } = require('ethers');\n\nconst wallet = Wallet.createRandom();\nconsole.log('Address:', wallet.address);\nconsole.log('Private key:', wallet.privateKey);\n// ⚠️ Save the private key securely!\n\\`\\`\\`\n\n**3. Get USDC:**\n- Mainnet: Withdraw from exchange to your wallet\n- Testnet: Use Base Sepolia faucet\n\n**4. Set environment variable:**\n\\`\\`\\`bash\nexport WALLET_KEY=\"your_private_key\"\n\\`\\`\\`\n\nYou're now ready to make on-chain payments with moltspay!`;\n}\n\n/**\n * Extract transaction hash from user message\n */\nexport function extractTransactionHash(message: string): string | null {\n // Match 0x followed by 64 hex chars\n const match = message.match(/0x[a-fA-F0-9]{64}/);\n if (match) return match[0];\n\n // Match tx: followed by content\n const txMatch = message.match(/tx:\\s*([a-fA-F0-9]{64})/i);\n if (txMatch) return '0x' + txMatch[1];\n\n return null;\n}\n\n/**\n * Check if message contains transaction hash\n */\nexport function hasTransactionHash(message: string): boolean {\n return extractTransactionHash(message) !== null;\n}\n"],"mappings":";AAiBO,SAAS,qBAAqB,QAAoC;AACvE,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR,cAAc;AAAA,EAChB,IAAI;AAEJ,QAAM,UAAU,UAAU,SAAS,OAAO;AAC1C,QAAM,YAAY,UAAU,SAAS,iBAAiB;AACtD,QAAM,WAAW,UAAU,SACvB,6BACA;AAEJ,SAAO,eAAQ,WAAW;AAAA;AAAA;AAAA,gBAGZ,OAAO;AAAA,aACV,OAAO,SAAS,KAAK,OAAO,MAAM,GAAG,EAAE,IAAI,QAAQ,MAAM;AAAA,aACzD,KAAK;AAAA,WACP,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAyBP,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCAUoB,gBAAgB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,eAWrD,SAAS,eAAe,OAAO;AAAA;AAAA,qBAEzB,gBAAgB;AAAA,gBACrB,KAAK;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gCAqBI,QAAQ;AACjC;AAKO,SAAS,wBAAwB,QAK7B;AACT,QAAM,EAAE,SAAS,OAAO,kBAAkB,QAAQ,OAAO,IAAI;AAC7D,QAAM,YAAY,UAAU,SAAS,SAAS;AAE9C,SAAO,2BAAsB,OAAO;AAAA;AAAA,eAEvB,KAAK;AAAA,WACT,SAAS;AAAA,eACL,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAM/B;AAKO,SAAS,sBAA8B;AAC5C,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BT;AAKO,SAAS,uBAAuB,SAAgC;AAErE,QAAM,QAAQ,QAAQ,MAAM,mBAAmB;AAC/C,MAAI,MAAO,QAAO,MAAM,CAAC;AAGzB,QAAM,UAAU,QAAQ,MAAM,0BAA0B;AACxD,MAAI,QAAS,QAAO,OAAO,QAAQ,CAAC;AAEpC,SAAO;AACT;AAKO,SAAS,mBAAmB,SAA0B;AAC3D,SAAO,uBAAuB,OAAO,MAAM;AAC7C;","names":[]}
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Payment Agent Type Definitions
|
|
3
|
-
*/
|
|
4
|
-
interface ChainConfig {
|
|
5
|
-
name: string;
|
|
6
|
-
chainId: number;
|
|
7
|
-
rpc: string;
|
|
8
|
-
usdc: string;
|
|
9
|
-
explorer: string;
|
|
10
|
-
explorerTx: string;
|
|
11
|
-
avgBlockTime: number;
|
|
12
|
-
}
|
|
13
|
-
type ChainName = 'base' | 'base_sepolia' | 'polygon' | 'ethereum' | 'sepolia';
|
|
14
|
-
interface Invoice {
|
|
15
|
-
type: 'payment_request';
|
|
16
|
-
version: string;
|
|
17
|
-
order_id: string;
|
|
18
|
-
service: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
amount: string;
|
|
21
|
-
token: 'USDC' | 'USDT' | 'ETH';
|
|
22
|
-
chain: string;
|
|
23
|
-
chain_id: number;
|
|
24
|
-
recipient: string;
|
|
25
|
-
memo?: string;
|
|
26
|
-
expires_at: string;
|
|
27
|
-
deep_link?: string;
|
|
28
|
-
explorer_url?: string;
|
|
29
|
-
metadata?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
interface CreateInvoiceParams {
|
|
32
|
-
orderId: string;
|
|
33
|
-
amount: number;
|
|
34
|
-
service: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
expiresMinutes?: number;
|
|
37
|
-
metadata?: Record<string, unknown>;
|
|
38
|
-
}
|
|
39
|
-
interface VerifyResult {
|
|
40
|
-
verified: boolean;
|
|
41
|
-
tx_hash?: string;
|
|
42
|
-
amount?: string;
|
|
43
|
-
token?: string;
|
|
44
|
-
from?: string;
|
|
45
|
-
to?: string;
|
|
46
|
-
block_number?: number;
|
|
47
|
-
confirmations?: number;
|
|
48
|
-
explorer_url?: string;
|
|
49
|
-
error?: string;
|
|
50
|
-
pending?: boolean;
|
|
51
|
-
}
|
|
52
|
-
interface VerifyOptions {
|
|
53
|
-
expectedAmount?: number;
|
|
54
|
-
tolerance?: number;
|
|
55
|
-
}
|
|
56
|
-
interface WalletBalance {
|
|
57
|
-
address: string;
|
|
58
|
-
eth: string;
|
|
59
|
-
usdc: string;
|
|
60
|
-
chain: string;
|
|
61
|
-
}
|
|
62
|
-
interface TransferResult {
|
|
63
|
-
success: boolean;
|
|
64
|
-
tx_hash?: string;
|
|
65
|
-
from?: string;
|
|
66
|
-
to?: string;
|
|
67
|
-
amount?: number;
|
|
68
|
-
gas_used?: number;
|
|
69
|
-
block_number?: number;
|
|
70
|
-
explorer_url?: string;
|
|
71
|
-
error?: string;
|
|
72
|
-
}
|
|
73
|
-
interface TransferParams {
|
|
74
|
-
to: string;
|
|
75
|
-
amount: number;
|
|
76
|
-
reason?: string;
|
|
77
|
-
requester?: string;
|
|
78
|
-
}
|
|
79
|
-
interface SecurityLimits {
|
|
80
|
-
singleMax: number;
|
|
81
|
-
dailyMax: number;
|
|
82
|
-
requireWhitelist: boolean;
|
|
83
|
-
}
|
|
84
|
-
interface SecureWalletConfig {
|
|
85
|
-
chain?: ChainName;
|
|
86
|
-
privateKey?: string;
|
|
87
|
-
walletAddress?: string;
|
|
88
|
-
limits?: Partial<SecurityLimits>;
|
|
89
|
-
whitelist?: string[];
|
|
90
|
-
auditPath?: string;
|
|
91
|
-
}
|
|
92
|
-
interface PendingTransfer {
|
|
93
|
-
id: string;
|
|
94
|
-
to: string;
|
|
95
|
-
amount: number;
|
|
96
|
-
reason?: string;
|
|
97
|
-
requester?: string;
|
|
98
|
-
created_at: string;
|
|
99
|
-
status: 'pending' | 'approved' | 'rejected' | 'executed';
|
|
100
|
-
}
|
|
101
|
-
interface AuditEntry {
|
|
102
|
-
timestamp: number;
|
|
103
|
-
datetime: string;
|
|
104
|
-
action: AuditAction;
|
|
105
|
-
request_id: string;
|
|
106
|
-
from?: string;
|
|
107
|
-
to?: string;
|
|
108
|
-
amount?: number;
|
|
109
|
-
tx_hash?: string;
|
|
110
|
-
reason?: string;
|
|
111
|
-
requester?: string;
|
|
112
|
-
prev_hash: string;
|
|
113
|
-
hash: string;
|
|
114
|
-
metadata?: Record<string, unknown>;
|
|
115
|
-
}
|
|
116
|
-
type AuditAction = 'transfer_request' | 'transfer_approved' | 'transfer_rejected' | 'transfer_executed' | 'transfer_failed' | 'whitelist_add' | 'whitelist_remove' | 'limit_change';
|
|
117
|
-
interface PermitRequest {
|
|
118
|
-
type: 'permit_request';
|
|
119
|
-
version: string;
|
|
120
|
-
order_id: string;
|
|
121
|
-
typed_data: EIP712TypedData;
|
|
122
|
-
}
|
|
123
|
-
interface EIP712TypedData {
|
|
124
|
-
types: Record<string, Array<{
|
|
125
|
-
name: string;
|
|
126
|
-
type: string;
|
|
127
|
-
}>>;
|
|
128
|
-
primaryType: string;
|
|
129
|
-
domain: {
|
|
130
|
-
name: string;
|
|
131
|
-
version: string;
|
|
132
|
-
chainId: number;
|
|
133
|
-
verifyingContract: string;
|
|
134
|
-
};
|
|
135
|
-
message: {
|
|
136
|
-
owner: string;
|
|
137
|
-
spender: string;
|
|
138
|
-
value: string;
|
|
139
|
-
nonce: number;
|
|
140
|
-
deadline: number;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
interface PermitSignature {
|
|
144
|
-
v: number;
|
|
145
|
-
r: string;
|
|
146
|
-
s: string;
|
|
147
|
-
deadline: number;
|
|
148
|
-
}
|
|
149
|
-
interface PermitExecuteResult {
|
|
150
|
-
success: boolean;
|
|
151
|
-
tx_hash?: string;
|
|
152
|
-
error?: string;
|
|
153
|
-
}
|
|
154
|
-
interface PaymentAgentConfig {
|
|
155
|
-
chain?: ChainName;
|
|
156
|
-
walletAddress?: string;
|
|
157
|
-
privateKey?: string;
|
|
158
|
-
rpcUrl?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export type { AuditAction as A, ChainName as C, EIP712TypedData as E, Invoice as I, PaymentAgentConfig as P, SecureWalletConfig as S, TransferParams as T, VerifyOptions as V, WalletBalance as W, ChainConfig as a, CreateInvoiceParams as b, VerifyResult as c, AuditEntry as d, PendingTransfer as e, PermitExecuteResult as f, PermitRequest as g, PermitSignature as h, SecurityLimits as i, TransferResult as j };
|
package/dist/index-CyFg9s2m.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Payment Agent Type Definitions
|
|
3
|
-
*/
|
|
4
|
-
interface ChainConfig {
|
|
5
|
-
name: string;
|
|
6
|
-
chainId: number;
|
|
7
|
-
rpc: string;
|
|
8
|
-
usdc: string;
|
|
9
|
-
explorer: string;
|
|
10
|
-
explorerTx: string;
|
|
11
|
-
avgBlockTime: number;
|
|
12
|
-
}
|
|
13
|
-
type ChainName = 'base' | 'base_sepolia' | 'polygon' | 'ethereum' | 'sepolia';
|
|
14
|
-
interface Invoice {
|
|
15
|
-
type: 'payment_request';
|
|
16
|
-
version: string;
|
|
17
|
-
order_id: string;
|
|
18
|
-
service: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
amount: string;
|
|
21
|
-
token: 'USDC' | 'USDT' | 'ETH';
|
|
22
|
-
chain: string;
|
|
23
|
-
chain_id: number;
|
|
24
|
-
recipient: string;
|
|
25
|
-
memo?: string;
|
|
26
|
-
expires_at: string;
|
|
27
|
-
deep_link?: string;
|
|
28
|
-
explorer_url?: string;
|
|
29
|
-
metadata?: Record<string, unknown>;
|
|
30
|
-
}
|
|
31
|
-
interface CreateInvoiceParams {
|
|
32
|
-
orderId: string;
|
|
33
|
-
amount: number;
|
|
34
|
-
service: string;
|
|
35
|
-
description?: string;
|
|
36
|
-
expiresMinutes?: number;
|
|
37
|
-
metadata?: Record<string, unknown>;
|
|
38
|
-
}
|
|
39
|
-
interface VerifyResult {
|
|
40
|
-
verified: boolean;
|
|
41
|
-
tx_hash?: string;
|
|
42
|
-
amount?: string;
|
|
43
|
-
token?: string;
|
|
44
|
-
from?: string;
|
|
45
|
-
to?: string;
|
|
46
|
-
block_number?: number;
|
|
47
|
-
confirmations?: number;
|
|
48
|
-
explorer_url?: string;
|
|
49
|
-
error?: string;
|
|
50
|
-
pending?: boolean;
|
|
51
|
-
}
|
|
52
|
-
interface VerifyOptions {
|
|
53
|
-
expectedAmount?: number;
|
|
54
|
-
tolerance?: number;
|
|
55
|
-
}
|
|
56
|
-
interface WalletBalance {
|
|
57
|
-
address: string;
|
|
58
|
-
eth: string;
|
|
59
|
-
usdc: string;
|
|
60
|
-
chain: string;
|
|
61
|
-
}
|
|
62
|
-
interface TransferResult {
|
|
63
|
-
success: boolean;
|
|
64
|
-
tx_hash?: string;
|
|
65
|
-
from?: string;
|
|
66
|
-
to?: string;
|
|
67
|
-
amount?: number;
|
|
68
|
-
gas_used?: number;
|
|
69
|
-
block_number?: number;
|
|
70
|
-
explorer_url?: string;
|
|
71
|
-
error?: string;
|
|
72
|
-
}
|
|
73
|
-
interface TransferParams {
|
|
74
|
-
to: string;
|
|
75
|
-
amount: number;
|
|
76
|
-
reason?: string;
|
|
77
|
-
requester?: string;
|
|
78
|
-
}
|
|
79
|
-
interface SecurityLimits {
|
|
80
|
-
singleMax: number;
|
|
81
|
-
dailyMax: number;
|
|
82
|
-
requireWhitelist: boolean;
|
|
83
|
-
}
|
|
84
|
-
interface SecureWalletConfig {
|
|
85
|
-
chain?: ChainName;
|
|
86
|
-
privateKey?: string;
|
|
87
|
-
walletAddress?: string;
|
|
88
|
-
limits?: Partial<SecurityLimits>;
|
|
89
|
-
whitelist?: string[];
|
|
90
|
-
auditPath?: string;
|
|
91
|
-
}
|
|
92
|
-
interface PendingTransfer {
|
|
93
|
-
id: string;
|
|
94
|
-
to: string;
|
|
95
|
-
amount: number;
|
|
96
|
-
reason?: string;
|
|
97
|
-
requester?: string;
|
|
98
|
-
created_at: string;
|
|
99
|
-
status: 'pending' | 'approved' | 'rejected' | 'executed';
|
|
100
|
-
}
|
|
101
|
-
interface AuditEntry {
|
|
102
|
-
timestamp: number;
|
|
103
|
-
datetime: string;
|
|
104
|
-
action: AuditAction;
|
|
105
|
-
request_id: string;
|
|
106
|
-
from?: string;
|
|
107
|
-
to?: string;
|
|
108
|
-
amount?: number;
|
|
109
|
-
tx_hash?: string;
|
|
110
|
-
reason?: string;
|
|
111
|
-
requester?: string;
|
|
112
|
-
prev_hash: string;
|
|
113
|
-
hash: string;
|
|
114
|
-
metadata?: Record<string, unknown>;
|
|
115
|
-
}
|
|
116
|
-
type AuditAction = 'transfer_request' | 'transfer_approved' | 'transfer_rejected' | 'transfer_executed' | 'transfer_failed' | 'whitelist_add' | 'whitelist_remove' | 'limit_change';
|
|
117
|
-
interface PermitRequest {
|
|
118
|
-
type: 'permit_request';
|
|
119
|
-
version: string;
|
|
120
|
-
order_id: string;
|
|
121
|
-
typed_data: EIP712TypedData;
|
|
122
|
-
}
|
|
123
|
-
interface EIP712TypedData {
|
|
124
|
-
types: Record<string, Array<{
|
|
125
|
-
name: string;
|
|
126
|
-
type: string;
|
|
127
|
-
}>>;
|
|
128
|
-
primaryType: string;
|
|
129
|
-
domain: {
|
|
130
|
-
name: string;
|
|
131
|
-
version: string;
|
|
132
|
-
chainId: number;
|
|
133
|
-
verifyingContract: string;
|
|
134
|
-
};
|
|
135
|
-
message: {
|
|
136
|
-
owner: string;
|
|
137
|
-
spender: string;
|
|
138
|
-
value: string;
|
|
139
|
-
nonce: number;
|
|
140
|
-
deadline: number;
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
interface PermitSignature {
|
|
144
|
-
v: number;
|
|
145
|
-
r: string;
|
|
146
|
-
s: string;
|
|
147
|
-
deadline: number;
|
|
148
|
-
}
|
|
149
|
-
interface PermitExecuteResult {
|
|
150
|
-
success: boolean;
|
|
151
|
-
tx_hash?: string;
|
|
152
|
-
error?: string;
|
|
153
|
-
}
|
|
154
|
-
interface PaymentAgentConfig {
|
|
155
|
-
chain?: ChainName;
|
|
156
|
-
walletAddress?: string;
|
|
157
|
-
privateKey?: string;
|
|
158
|
-
rpcUrl?: string;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export type { AuditAction as A, ChainName as C, EIP712TypedData as E, Invoice as I, PaymentAgentConfig as P, SecureWalletConfig as S, TransferParams as T, VerifyOptions as V, WalletBalance as W, ChainConfig as a, CreateInvoiceParams as b, VerifyResult as c, AuditEntry as d, PendingTransfer as e, PermitExecuteResult as f, PermitRequest as g, PermitSignature as h, SecurityLimits as i, TransferResult as j };
|