moltspay 0.5.3 → 0.7.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/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 +940 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +917 -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 -937
- package/dist/index.d.ts +6 -937
- package/dist/index.js +31023 -3250
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +30998 -3178
- 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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { C as ChainName } from '../index-Dg8n6wdW.mjs';
|
|
2
|
+
import { getChain } from '../chains/index.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CDP (Coinbase Developer Platform) Wallet Integration
|
|
6
|
+
*
|
|
7
|
+
* Creates and manages wallets via Coinbase's CDP SDK.
|
|
8
|
+
* These wallets are hosted by Coinbase, making them easy to use for AI Agents.
|
|
9
|
+
*
|
|
10
|
+
* @see https://docs.cdp.coinbase.com/
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface CDPWalletConfig {
|
|
14
|
+
/** Storage directory (default: ~/.moltspay) */
|
|
15
|
+
storageDir?: string;
|
|
16
|
+
/** Chain name */
|
|
17
|
+
chain?: ChainName;
|
|
18
|
+
/** CDP API credentials (or use env vars) */
|
|
19
|
+
apiKeyId?: string;
|
|
20
|
+
apiKeySecret?: string;
|
|
21
|
+
walletSecret?: string;
|
|
22
|
+
}
|
|
23
|
+
interface CDPWalletData {
|
|
24
|
+
/** Wallet address */
|
|
25
|
+
address: string;
|
|
26
|
+
/** CDP wallet ID */
|
|
27
|
+
walletId: string;
|
|
28
|
+
/** Chain */
|
|
29
|
+
chain: ChainName;
|
|
30
|
+
/** Created timestamp */
|
|
31
|
+
createdAt: string;
|
|
32
|
+
/** CDP account data (for restoration) */
|
|
33
|
+
accountData?: string;
|
|
34
|
+
}
|
|
35
|
+
interface CDPInitResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
address?: string;
|
|
38
|
+
walletId?: string;
|
|
39
|
+
isNew?: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
storagePath?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if CDP SDK is available
|
|
45
|
+
*/
|
|
46
|
+
declare function isCDPAvailable(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Initialize CDP wallet
|
|
49
|
+
*
|
|
50
|
+
* Creates a new CDP wallet or loads existing one.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```bash
|
|
54
|
+
* # Set credentials
|
|
55
|
+
* export CDP_API_KEY_ID=your-key-id
|
|
56
|
+
* export CDP_API_KEY_SECRET=your-key-secret
|
|
57
|
+
*
|
|
58
|
+
* # Initialize
|
|
59
|
+
* npx moltspay init --cdp --chain base
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function initCDPWallet(config?: CDPWalletConfig): Promise<CDPInitResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Load existing CDP wallet
|
|
65
|
+
*/
|
|
66
|
+
declare function loadCDPWallet(config?: CDPWalletConfig): CDPWalletData | null;
|
|
67
|
+
/**
|
|
68
|
+
* Get CDP wallet address (quick check without full init)
|
|
69
|
+
*/
|
|
70
|
+
declare function getCDPWalletAddress(storageDir?: string): string | null;
|
|
71
|
+
/**
|
|
72
|
+
* CDP Wallet class for making payments
|
|
73
|
+
*
|
|
74
|
+
* Uses CDP SDK for wallet operations with x402 support.
|
|
75
|
+
*/
|
|
76
|
+
declare class CDPWallet {
|
|
77
|
+
readonly address: string;
|
|
78
|
+
readonly chain: ChainName;
|
|
79
|
+
readonly chainConfig: ReturnType<typeof getChain>;
|
|
80
|
+
private storageDir;
|
|
81
|
+
constructor(config?: CDPWalletConfig);
|
|
82
|
+
/**
|
|
83
|
+
* Get USDC balance
|
|
84
|
+
*/
|
|
85
|
+
getBalance(): Promise<{
|
|
86
|
+
usdc: string;
|
|
87
|
+
eth: string;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Transfer USDC to a recipient
|
|
91
|
+
*
|
|
92
|
+
* Requires CDP SDK and credentials to sign transactions.
|
|
93
|
+
*/
|
|
94
|
+
transfer(params: {
|
|
95
|
+
to: string;
|
|
96
|
+
amount: number;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
success: boolean;
|
|
99
|
+
txHash?: string;
|
|
100
|
+
error?: string;
|
|
101
|
+
explorerUrl?: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Create viem-compatible signer for x402
|
|
105
|
+
*
|
|
106
|
+
* This allows using CDP wallet with x402 protocol.
|
|
107
|
+
*/
|
|
108
|
+
getViemAccount(): Promise<unknown>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { type CDPInitResult, CDPWallet, type CDPWalletConfig, type CDPWalletData, getCDPWalletAddress, initCDPWallet, isCDPAvailable, loadCDPWallet };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { C as ChainName } from '../index-Dg8n6wdW.js';
|
|
2
|
+
import { getChain } from '../chains/index.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CDP (Coinbase Developer Platform) Wallet Integration
|
|
6
|
+
*
|
|
7
|
+
* Creates and manages wallets via Coinbase's CDP SDK.
|
|
8
|
+
* These wallets are hosted by Coinbase, making them easy to use for AI Agents.
|
|
9
|
+
*
|
|
10
|
+
* @see https://docs.cdp.coinbase.com/
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
interface CDPWalletConfig {
|
|
14
|
+
/** Storage directory (default: ~/.moltspay) */
|
|
15
|
+
storageDir?: string;
|
|
16
|
+
/** Chain name */
|
|
17
|
+
chain?: ChainName;
|
|
18
|
+
/** CDP API credentials (or use env vars) */
|
|
19
|
+
apiKeyId?: string;
|
|
20
|
+
apiKeySecret?: string;
|
|
21
|
+
walletSecret?: string;
|
|
22
|
+
}
|
|
23
|
+
interface CDPWalletData {
|
|
24
|
+
/** Wallet address */
|
|
25
|
+
address: string;
|
|
26
|
+
/** CDP wallet ID */
|
|
27
|
+
walletId: string;
|
|
28
|
+
/** Chain */
|
|
29
|
+
chain: ChainName;
|
|
30
|
+
/** Created timestamp */
|
|
31
|
+
createdAt: string;
|
|
32
|
+
/** CDP account data (for restoration) */
|
|
33
|
+
accountData?: string;
|
|
34
|
+
}
|
|
35
|
+
interface CDPInitResult {
|
|
36
|
+
success: boolean;
|
|
37
|
+
address?: string;
|
|
38
|
+
walletId?: string;
|
|
39
|
+
isNew?: boolean;
|
|
40
|
+
error?: string;
|
|
41
|
+
storagePath?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Check if CDP SDK is available
|
|
45
|
+
*/
|
|
46
|
+
declare function isCDPAvailable(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Initialize CDP wallet
|
|
49
|
+
*
|
|
50
|
+
* Creates a new CDP wallet or loads existing one.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```bash
|
|
54
|
+
* # Set credentials
|
|
55
|
+
* export CDP_API_KEY_ID=your-key-id
|
|
56
|
+
* export CDP_API_KEY_SECRET=your-key-secret
|
|
57
|
+
*
|
|
58
|
+
* # Initialize
|
|
59
|
+
* npx moltspay init --cdp --chain base
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function initCDPWallet(config?: CDPWalletConfig): Promise<CDPInitResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Load existing CDP wallet
|
|
65
|
+
*/
|
|
66
|
+
declare function loadCDPWallet(config?: CDPWalletConfig): CDPWalletData | null;
|
|
67
|
+
/**
|
|
68
|
+
* Get CDP wallet address (quick check without full init)
|
|
69
|
+
*/
|
|
70
|
+
declare function getCDPWalletAddress(storageDir?: string): string | null;
|
|
71
|
+
/**
|
|
72
|
+
* CDP Wallet class for making payments
|
|
73
|
+
*
|
|
74
|
+
* Uses CDP SDK for wallet operations with x402 support.
|
|
75
|
+
*/
|
|
76
|
+
declare class CDPWallet {
|
|
77
|
+
readonly address: string;
|
|
78
|
+
readonly chain: ChainName;
|
|
79
|
+
readonly chainConfig: ReturnType<typeof getChain>;
|
|
80
|
+
private storageDir;
|
|
81
|
+
constructor(config?: CDPWalletConfig);
|
|
82
|
+
/**
|
|
83
|
+
* Get USDC balance
|
|
84
|
+
*/
|
|
85
|
+
getBalance(): Promise<{
|
|
86
|
+
usdc: string;
|
|
87
|
+
eth: string;
|
|
88
|
+
}>;
|
|
89
|
+
/**
|
|
90
|
+
* Transfer USDC to a recipient
|
|
91
|
+
*
|
|
92
|
+
* Requires CDP SDK and credentials to sign transactions.
|
|
93
|
+
*/
|
|
94
|
+
transfer(params: {
|
|
95
|
+
to: string;
|
|
96
|
+
amount: number;
|
|
97
|
+
}): Promise<{
|
|
98
|
+
success: boolean;
|
|
99
|
+
txHash?: string;
|
|
100
|
+
error?: string;
|
|
101
|
+
explorerUrl?: string;
|
|
102
|
+
}>;
|
|
103
|
+
/**
|
|
104
|
+
* Create viem-compatible signer for x402
|
|
105
|
+
*
|
|
106
|
+
* This allows using CDP wallet with x402 protocol.
|
|
107
|
+
*/
|
|
108
|
+
getViemAccount(): Promise<unknown>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { type CDPInitResult, CDPWallet, type CDPWalletConfig, type CDPWalletData, getCDPWalletAddress, initCDPWallet, isCDPAvailable, loadCDPWallet };
|