@asgcard/pay 0.1.1 → 0.1.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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StellarPaymentAdapter = exports.BasePaymentAdapter = exports.StripePaymentAdapter = exports.listEvmChains = exports.EvmPaymentAdapter = void 0;
3
+ exports.SolanaPaymentAdapter = exports.StellarPaymentAdapter = exports.BasePaymentAdapter = exports.StripePaymentAdapter = exports.listEvmChains = exports.EvmPaymentAdapter = void 0;
4
4
  var evm_1 = require("./evm");
5
5
  Object.defineProperty(exports, "EvmPaymentAdapter", { enumerable: true, get: function () { return evm_1.EvmPaymentAdapter; } });
6
6
  Object.defineProperty(exports, "listEvmChains", { enumerable: true, get: function () { return evm_1.listEvmChains; } });
@@ -10,4 +10,6 @@ var base_1 = require("./base");
10
10
  Object.defineProperty(exports, "BasePaymentAdapter", { enumerable: true, get: function () { return base_1.BasePaymentAdapter; } });
11
11
  var stellar_1 = require("./stellar");
12
12
  Object.defineProperty(exports, "StellarPaymentAdapter", { enumerable: true, get: function () { return stellar_1.StellarPaymentAdapter; } });
13
+ var solana_1 = require("./solana");
14
+ Object.defineProperty(exports, "SolanaPaymentAdapter", { enumerable: true, get: function () { return solana_1.SolanaPaymentAdapter; } });
13
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":";;;AACA,6BAA0F;AAAjF,wGAAA,iBAAiB,OAAA;AAAmC,oGAAA,aAAa,OAAA;AAC1E,mCAAsE;AAA7D,8GAAA,oBAAoB,OAAA;AAC7B,+BAAgE;AAAvD,0GAAA,kBAAkB,OAAA;AAC3B,qCAAgF;AAAvE,gHAAA,qBAAqB,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":";;;AACA,6BAA0F;AAAjF,wGAAA,iBAAiB,OAAA;AAAmC,oGAAA,aAAa,OAAA;AAC1E,mCAAsE;AAA7D,8GAAA,oBAAoB,OAAA;AAC7B,+BAAgE;AAAvD,0GAAA,kBAAkB,OAAA;AAC3B,qCAAgF;AAAvE,gHAAA,qBAAqB,OAAA;AAC9B,mCAAsE;AAA7D,8GAAA,oBAAoB,OAAA"}
@@ -0,0 +1,210 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SolanaPaymentAdapter = void 0;
4
+ const web3_js_1 = require("@solana/web3.js");
5
+ const spl_token_1 = require("@solana/spl-token");
6
+ const logger_1 = require("../logger");
7
+ // ─── USDC Mint Addresses ────────────────────────────────────────────
8
+ /** Circle's official USDC on Solana mainnet. */
9
+ const USDC_MAINNET = new web3_js_1.PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
10
+ /** Circle's USDC on Solana devnet (for testing). */
11
+ const USDC_DEVNET = new web3_js_1.PublicKey('4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU');
12
+ // ─── Solana Payment Adapter ─────────────────────────────────────────
13
+ /**
14
+ * SolanaPaymentAdapter — On-chain settlement on Solana.
15
+ *
16
+ * Supports:
17
+ * - Native SOL transfers (System Program)
18
+ * - USDC (SPL Token) transfers with automatic ATA creation
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * // SOL on devnet
23
+ * const adapter = new SolanaPaymentAdapter({
24
+ * secretKey: myKeypair.secretKey,
25
+ * network: 'devnet',
26
+ * asset: 'SOL',
27
+ * logger: console.log,
28
+ * });
29
+ *
30
+ * // USDC on mainnet
31
+ * const adapter = new SolanaPaymentAdapter({
32
+ * secretKey: myKeypair.secretKey,
33
+ * network: 'mainnet-beta',
34
+ * asset: 'USDC',
35
+ * });
36
+ * ```
37
+ *
38
+ * @see https://spl.solana.com/token — SPL Token program
39
+ * @see https://pay.asgcard.dev — ASG Pay production infrastructure
40
+ */
41
+ class SolanaPaymentAdapter {
42
+ chainName;
43
+ caip2Id;
44
+ connection;
45
+ keypair;
46
+ asset;
47
+ usdcMint;
48
+ network;
49
+ log;
50
+ constructor(options) {
51
+ this.network = options.network ?? 'devnet';
52
+ this.asset = options.asset ?? 'SOL';
53
+ this.log = options.logger ?? logger_1.noopLogger;
54
+ // Set CAIP-2 ID
55
+ const chainRef = this.network === 'mainnet-beta' ? '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' : '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z';
56
+ this.caip2Id = `solana:${chainRef}`;
57
+ this.chainName = `Solana ${this.network === 'mainnet-beta' ? 'Mainnet' : this.network === 'devnet' ? 'Devnet' : 'Testnet'}`;
58
+ // USDC mint per network
59
+ this.usdcMint = this.network === 'mainnet-beta' ? USDC_MAINNET : USDC_DEVNET;
60
+ // Connection
61
+ const rpcUrl = options.rpcUrl ?? (0, web3_js_1.clusterApiUrl)(this.network);
62
+ this.connection = new web3_js_1.Connection(rpcUrl, 'confirmed');
63
+ // Keypair
64
+ if (options.secretKey) {
65
+ const keyArray = options.secretKey instanceof Uint8Array
66
+ ? options.secretKey
67
+ : Uint8Array.from(options.secretKey);
68
+ this.keypair = web3_js_1.Keypair.fromSecretKey(keyArray);
69
+ }
70
+ else {
71
+ this.keypair = web3_js_1.Keypair.generate();
72
+ }
73
+ }
74
+ getAddress() {
75
+ return this.keypair.publicKey.toBase58();
76
+ }
77
+ /** Get SOL balance in SOL (not lamports). */
78
+ async getSolBalance() {
79
+ const lamports = await this.connection.getBalance(this.keypair.publicKey);
80
+ return (lamports / web3_js_1.LAMPORTS_PER_SOL).toFixed(9);
81
+ }
82
+ /** Get USDC balance (6 decimals). */
83
+ async getUsdcBalance() {
84
+ try {
85
+ const ata = await this.findAta(this.keypair.publicKey);
86
+ if (!ata)
87
+ return '0.000000';
88
+ const account = await (0, spl_token_1.getAccount)(this.connection, ata);
89
+ return (Number(account.amount) / 1e6).toFixed(6);
90
+ }
91
+ catch {
92
+ return '0.000000';
93
+ }
94
+ }
95
+ async pay(destination, amount, network) {
96
+ if (this.asset === 'USDC') {
97
+ return this.payUsdc(destination, amount);
98
+ }
99
+ return this.paySol(destination, amount);
100
+ }
101
+ // ── Native SOL transfer ─────────────────────────────────────────
102
+ async paySol(destination, amount) {
103
+ const tag = `[Solana/SOL]`;
104
+ try {
105
+ const lamports = BigInt(amount);
106
+ const solAmount = (Number(lamports) / web3_js_1.LAMPORTS_PER_SOL).toFixed(9);
107
+ const destPubkey = new web3_js_1.PublicKey(destination);
108
+ this.log(`${tag} 🚀 ${solAmount} SOL → ${destination.slice(0, 8)}…`);
109
+ // Balance check
110
+ const balance = await this.connection.getBalance(this.keypair.publicKey);
111
+ if (BigInt(balance) < lamports) {
112
+ this.log(`${tag} ❌ Insufficient: ${(balance / web3_js_1.LAMPORTS_PER_SOL).toFixed(9)} < ${solAmount} SOL`);
113
+ return null;
114
+ }
115
+ const tx = new web3_js_1.Transaction().add(web3_js_1.SystemProgram.transfer({
116
+ fromPubkey: this.keypair.publicKey,
117
+ toPubkey: destPubkey,
118
+ lamports: lamports,
119
+ }));
120
+ const signature = await this.connection.sendTransaction(tx, [this.keypair]);
121
+ await this.connection.confirmTransaction(signature, 'confirmed');
122
+ this.log(`${tag} ✅ ${signature}`);
123
+ return signature;
124
+ }
125
+ catch (error) {
126
+ this.log(`${tag} ❌ ${error.message}`);
127
+ return null;
128
+ }
129
+ }
130
+ // ── USDC SPL Token transfer ─────────────────────────────────────
131
+ async payUsdc(destination, amount) {
132
+ const tag = `[Solana/USDC]`;
133
+ try {
134
+ const atomicAmount = BigInt(amount);
135
+ const formatted = (Number(atomicAmount) / 1e6).toFixed(6);
136
+ const destPubkey = new web3_js_1.PublicKey(destination);
137
+ this.log(`${tag} 🚀 ${formatted} USDC → ${destination.slice(0, 8)}…`);
138
+ // Get or create sender's ATA
139
+ const senderAta = await (0, spl_token_1.getOrCreateAssociatedTokenAccount)(this.connection, this.keypair, // payer
140
+ this.usdcMint, // mint
141
+ this.keypair.publicKey // owner
142
+ );
143
+ // Balance check
144
+ if (senderAta.amount < atomicAmount) {
145
+ this.log(`${tag} ❌ Insufficient: ${(Number(senderAta.amount) / 1e6).toFixed(6)} < ${formatted} USDC`);
146
+ return null;
147
+ }
148
+ // Get or create destination ATA
149
+ const destAta = await (0, spl_token_1.getOrCreateAssociatedTokenAccount)(this.connection, this.keypair, // payer (creates ATA if needed)
150
+ this.usdcMint, // mint
151
+ destPubkey // owner
152
+ );
153
+ // Build transfer instruction
154
+ const tx = new web3_js_1.Transaction().add((0, spl_token_1.createTransferInstruction)(senderAta.address, // source
155
+ destAta.address, // destination
156
+ this.keypair.publicKey, // authority
157
+ atomicAmount, // amount
158
+ [], // multiSigners
159
+ spl_token_1.TOKEN_PROGRAM_ID));
160
+ const signature = await this.connection.sendTransaction(tx, [this.keypair]);
161
+ await this.connection.confirmTransaction(signature, 'confirmed');
162
+ this.log(`${tag} ✅ ${signature}`);
163
+ return signature;
164
+ }
165
+ catch (error) {
166
+ this.log(`${tag} ❌ ${error.message}`);
167
+ return null;
168
+ }
169
+ }
170
+ // ── Helpers ─────────────────────────────────────────────────────
171
+ /** Find the Associated Token Account for USDC. Returns null if none. */
172
+ async findAta(owner) {
173
+ try {
174
+ const ASSOCIATED_TOKEN_PROGRAM_ID = new web3_js_1.PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
175
+ // Compute the ATA deterministically
176
+ const [ata] = web3_js_1.PublicKey.findProgramAddressSync([
177
+ owner.toBuffer(),
178
+ spl_token_1.TOKEN_PROGRAM_ID.toBuffer(),
179
+ this.usdcMint.toBuffer(),
180
+ ], ASSOCIATED_TOKEN_PROGRAM_ID);
181
+ // Check if it exists
182
+ const info = await this.connection.getAccountInfo(ata);
183
+ return info ? ata : null;
184
+ }
185
+ catch {
186
+ return null;
187
+ }
188
+ }
189
+ /** Request SOL airdrop from devnet/testnet faucet (for testing). */
190
+ async requestAirdrop(amountSol = 1) {
191
+ if (this.network === 'mainnet-beta') {
192
+ this.log('[Solana] ❌ Cannot airdrop on mainnet');
193
+ return null;
194
+ }
195
+ try {
196
+ const lamports = amountSol * web3_js_1.LAMPORTS_PER_SOL;
197
+ this.log(`[Solana] 💧 Requesting ${amountSol} SOL airdrop…`);
198
+ const sig = await this.connection.requestAirdrop(this.keypair.publicKey, lamports);
199
+ await this.connection.confirmTransaction(sig, 'confirmed');
200
+ this.log(`[Solana] ✅ Airdrop: ${sig}`);
201
+ return sig;
202
+ }
203
+ catch (error) {
204
+ this.log(`[Solana] ❌ Airdrop failed: ${error.message}`);
205
+ return null;
206
+ }
207
+ }
208
+ }
209
+ exports.SolanaPaymentAdapter = SolanaPaymentAdapter;
210
+ //# sourceMappingURL=solana.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../src/adapters/solana.ts"],"names":[],"mappings":";;;AAAA,6CAQyB;AACzB,iDAM2B;AAE3B,sCAA+C;AAE/C,uEAAuE;AAEvE,gDAAgD;AAChD,MAAM,YAAY,GAAG,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC;AAEnF,oDAAoD;AACpD,MAAM,WAAW,GAAG,IAAI,mBAAS,CAAC,8CAA8C,CAAC,CAAC;AA4BlF,uEAAuE;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAa,oBAAoB;IACf,SAAS,CAAS;IAClB,OAAO,CAAS;IAExB,UAAU,CAAa;IACvB,OAAO,CAAU;IACjB,KAAK,CAAiB;IACtB,QAAQ,CAAY;IACpB,OAAO,CAAwC;IAC/C,GAAG,CAAS;IAEpB,YAAY,OAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,QAAQ,CAAC;QAC3C,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC;QACpC,IAAI,CAAC,GAAG,G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C;YACvD,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,oEAAoE;IACpE,KAAK,CAAC,cAAc,CAAC,YAAoB,CAAC;QACxC,IAAI,IAAI,CAAC,OAAO,KAAK,cAAc,EAAE,CAAC;YACpC,IAAI,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,SAAS,GAAG,0BAAgB,CAAC;YAC9C,IAAI,CAAC,GAAG,CAAC,0BAA0B,SAAS,eAAe,CAAC,CAAC;YAC7D,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACnF,MAAM,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;YACvC,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF;AApND,oDAoNC"}
package/dist/cjs/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // @asgcard/pay — Production x402/MPP SDK for AI agent payments
3
3
  // https://pay.asgcard.dev
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.BasePaymentAdapter = exports.StellarPaymentAdapter = exports.StripePaymentAdapter = exports.listEvmChains = exports.EvmPaymentAdapter = exports.base64urlDecode = exports.base64urlEncode = exports.extractMppChallenges = exports.detectProtocol = exports.parseMppReceipt = exports.buildAuthorizationHeader = exports.buildMppCredential = exports.decodeChallengeRequest = exports.parseMppChallenges = exports.parseMppChallenge = exports.PolicyEngine = exports.OwsClient = void 0;
5
+ exports.BasePaymentAdapter = exports.SolanaPaymentAdapter = exports.StellarPaymentAdapter = exports.StripePaymentAdapter = exports.listEvmChains = exports.EvmPaymentAdapter = exports.base64urlDecode = exports.base64urlEncode = exports.extractMppChallenges = exports.detectProtocol = exports.parseMppReceipt = exports.buildAuthorizationHeader = exports.buildMppCredential = exports.decodeChallengeRequest = exports.parseMppChallenges = exports.parseMppChallenge = exports.PolicyEngine = exports.OwsClient = void 0;
6
6
  // Core
7
7
  var client_1 = require("./client");
8
8
  Object.defineProperty(exports, "OwsClient", { enumerable: true, get: function () { return client_1.OwsClient; } });
@@ -30,6 +30,9 @@ Object.defineProperty(exports, "StripePaymentAdapter", { enumerable: true, get:
30
30
  // Adapters — Stellar
31
31
  var stellar_1 = require("./adapters/stellar");
32
32
  Object.defineProperty(exports, "StellarPaymentAdapter", { enumerable: true, get: function () { return stellar_1.StellarPaymentAdapter; } });
33
+ // Adapters — Solana (SOL + USDC SPL, mainnet/devnet/testnet)
34
+ var solana_1 = require("./adapters/solana");
35
+ Object.defineProperty(exports, "SolanaPaymentAdapter", { enumerable: true, get: function () { return solana_1.SolanaPaymentAdapter; } });
33
36
  // Adapters — Base (backward compat, use EvmPaymentAdapter instead)
34
37
  var base_1 = require("./adapters/base");
35
38
  Object.defineProperty(exports, "BasePaymentAdapter", { enumerable: true, get: function () { return base_1.BasePaymentAdapter; } });
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,0BAA0B;;;AAE1B,OAAO;AACP,mCAAuD;AAA9C,mGAAA,SAAS,OAAA;AAClB,mCAAsD;AAA7C,sGAAA,YAAY,OAAA;AAGrB,yBAAyB;AACzB,6BAWe;AAVb,wGAAA,iBAAiB,OAAA;A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oB,OAAA;AAG7B,mEAAmE;AACnE,wCAAqD;AAA5C,0GAAA,kBAAkB,OAAA"}
@@ -2,4 +2,5 @@ export { EvmPaymentAdapter, listEvmChains } from './evm';
2
2
  export { StripePaymentAdapter } from './stripe';
3
3
  export { BasePaymentAdapter } from './base';
4
4
  export { StellarPaymentAdapter } from './stellar';
5
+ export { SolanaPaymentAdapter } from './solana';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAmC,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAgC,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAmC,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAsB,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAgC,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAwB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,206 @@
1
+ import { Connection, Keypair, PublicKey, Transaction, SystemProgram, LAMPORTS_PER_SOL, clusterApiUrl, } from '@solana/web3.js';
2
+ import { getOrCreateAssociatedTokenAccount, createTransferInstruction, getAccount, TOKEN_PROGRAM_ID, } from '@solana/spl-token';
3
+ import { noopLogger } from '../logger';
4
+ // ─── USDC Mint Addresses ────────────────────────────────────────────
5
+ /** Circle's official USDC on Solana mainnet. */
6
+ const USDC_MAINNET = new PublicKey('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v');
7
+ /** Circle's USDC on Solana devnet (for testing). */
8
+ const USDC_DEVNET = new PublicKey('4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU');
9
+ // ─── Solana Payment Adapter ─────────────────────────────────────────
10
+ /**
11
+ * SolanaPaymentAdapter — On-chain settlement on Solana.
12
+ *
13
+ * Supports:
14
+ * - Native SOL transfers (System Program)
15
+ * - USDC (SPL Token) transfers with automatic ATA creation
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * // SOL on devnet
20
+ * const adapter = new SolanaPaymentAdapter({
21
+ * secretKey: myKeypair.secretKey,
22
+ * network: 'devnet',
23
+ * asset: 'SOL',
24
+ * logger: console.log,
25
+ * });
26
+ *
27
+ * // USDC on mainnet
28
+ * const adapter = new SolanaPaymentAdapter({
29
+ * secretKey: myKeypair.secretKey,
30
+ * network: 'mainnet-beta',
31
+ * asset: 'USDC',
32
+ * });
33
+ * ```
34
+ *
35
+ * @see https://spl.solana.com/token — SPL Token program
36
+ * @see https://pay.asgcard.dev — ASG Pay production infrastructure
37
+ */
38
+ export class SolanaPaymentAdapter {
39
+ chainName;
40
+ caip2Id;
41
+ connection;
42
+ keypair;
43
+ asset;
44
+ usdcMint;
45
+ network;
46
+ log;
47
+ constructor(options) {
48
+ this.network = options.network ?? 'devnet';
49
+ this.asset = options.asset ?? 'SOL';
50
+ this.log = options.logger ?? noopLogger;
51
+ // Set CAIP-2 ID
52
+ const chainRef = this.network === 'mainnet-beta' ? '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp' : '4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z';
53
+ this.caip2Id = `solana:${chainRef}`;
54
+ this.chainName = `Solana ${this.network === 'mainnet-beta' ? 'Mainnet' : this.network === 'devnet' ? 'Devnet' : 'Testnet'}`;
55
+ // USDC mint per network
56
+ this.usdcMint = this.network === 'mainnet-beta' ? USDC_MAINNET : USDC_DEVNET;
57
+ // Connection
58
+ const rpcUrl = options.rpcUrl ?? clusterApiUrl(this.network);
59
+ this.connection = new Connection(rpcUrl, 'confirmed');
60
+ // Keypair
61
+ if (options.secretKey) {
62
+ const keyArray = options.secretKey instanceof Uint8Array
63
+ ? options.secretKey
64
+ : Uint8Array.from(options.secretKey);
65
+ this.keypair = Keypair.fromSecretKey(keyArray);
66
+ }
67
+ else {
68
+ this.keypair = Keypair.generate();
69
+ }
70
+ }
71
+ getAddress() {
72
+ return this.keypair.publicKey.toBase58();
73
+ }
74
+ /** Get SOL balance in SOL (not lamports). */
75
+ async getSolBalance() {
76
+ const lamports = await this.connection.getBalance(this.keypair.publicKey);
77
+ return (lamports / LAMPORTS_PER_SOL).toFixed(9);
78
+ }
79
+ /** Get USDC balance (6 decimals). */
80
+ async getUsdcBalance() {
81
+ try {
82
+ const ata = await this.findAta(this.keypair.publicKey);
83
+ if (!ata)
84
+ return '0.000000';
85
+ const account = await getAccount(this.connection, ata);
86
+ return (Number(account.amount) / 1e6).toFixed(6);
87
+ }
88
+ catch {
89
+ return '0.000000';
90
+ }
91
+ }
92
+ async pay(destination, amount, network) {
93
+ if (this.asset === 'USDC') {
94
+ return this.payUsdc(destination, amount);
95
+ }
96
+ return this.paySol(destination, amount);
97
+ }
98
+ // ── Native SOL transfer ─────────────────────────────────────────
99
+ async paySol(destination, amount) {
100
+ const tag = `[Solana/SOL]`;
101
+ try {
102
+ const lamports = BigInt(amount);
103
+ const solAmount = (Number(lamports) / LAMPORTS_PER_SOL).toFixed(9);
104
+ const destPubkey = new PublicKey(destination);
105
+ this.log(`${tag} 🚀 ${solAmount} SOL → ${destination.slice(0, 8)}…`);
106
+ // Balance check
107
+ const balance = await this.connection.getBalance(this.keypair.publicKey);
108
+ if (BigInt(balance) < lamports) {
109
+ this.log(`${tag} ❌ Insufficient: ${(balance / LAMPORTS_PER_SOL).toFixed(9)} < ${solAmount} SOL`);
110
+ return null;
111
+ }
112
+ const tx = new Transaction().add(SystemProgram.transfer({
113
+ fromPubkey: this.keypair.publicKey,
114
+ toPubkey: destPubkey,
115
+ lamports: lamports,
116
+ }));
117
+ const signature = await this.connection.sendTransaction(tx, [this.keypair]);
118
+ await this.connection.confirmTransaction(signature, 'confirmed');
119
+ this.log(`${tag} ✅ ${signature}`);
120
+ return signature;
121
+ }
122
+ catch (error) {
123
+ this.log(`${tag} ❌ ${error.message}`);
124
+ return null;
125
+ }
126
+ }
127
+ // ── USDC SPL Token transfer ─────────────────────────────────────
128
+ async payUsdc(destination, amount) {
129
+ const tag = `[Solana/USDC]`;
130
+ try {
131
+ const atomicAmount = BigInt(amount);
132
+ const formatted = (Number(atomicAmount) / 1e6).toFixed(6);
133
+ const destPubkey = new PublicKey(destination);
134
+ this.log(`${tag} 🚀 ${formatted} USDC → ${destination.slice(0, 8)}…`);
135
+ // Get or create sender's ATA
136
+ const senderAta = await getOrCreateAssociatedTokenAccount(this.connection, this.keypair, // payer
137
+ this.usdcMint, // mint
138
+ this.keypair.publicKey // owner
139
+ );
140
+ // Balance check
141
+ if (senderAta.amount < atomicAmount) {
142
+ this.log(`${tag} ❌ Insufficient: ${(Number(senderAta.amount) / 1e6).toFixed(6)} < ${formatted} USDC`);
143
+ return null;
144
+ }
145
+ // Get or create destination ATA
146
+ const destAta = await getOrCreateAssociatedTokenAccount(this.connection, this.keypair, // payer (creates ATA if needed)
147
+ this.usdcMint, // mint
148
+ destPubkey // owner
149
+ );
150
+ // Build transfer instruction
151
+ const tx = new Transaction().add(createTransferInstruction(senderAta.address, // source
152
+ destAta.address, // destination
153
+ this.keypair.publicKey, // authority
154
+ atomicAmount, // amount
155
+ [], // multiSigners
156
+ TOKEN_PROGRAM_ID));
157
+ const signature = await this.connection.sendTransaction(tx, [this.keypair]);
158
+ await this.connection.confirmTransaction(signature, 'confirmed');
159
+ this.log(`${tag} ✅ ${signature}`);
160
+ return signature;
161
+ }
162
+ catch (error) {
163
+ this.log(`${tag} ❌ ${error.message}`);
164
+ return null;
165
+ }
166
+ }
167
+ // ── Helpers ─────────────────────────────────────────────────────
168
+ /** Find the Associated Token Account for USDC. Returns null if none. */
169
+ async findAta(owner) {
170
+ try {
171
+ const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL');
172
+ // Compute the ATA deterministically
173
+ const [ata] = PublicKey.findProgramAddressSync([
174
+ owner.toBuffer(),
175
+ TOKEN_PROGRAM_ID.toBuffer(),
176
+ this.usdcMint.toBuffer(),
177
+ ], ASSOCIATED_TOKEN_PROGRAM_ID);
178
+ // Check if it exists
179
+ const info = await this.connection.getAccountInfo(ata);
180
+ return info ? ata : null;
181
+ }
182
+ catch {
183
+ return null;
184
+ }
185
+ }
186
+ /** Request SOL airdrop from devnet/testnet faucet (for testing). */
187
+ async requestAirdrop(amountSol = 1) {
188
+ if (this.network === 'mainnet-beta') {
189
+ this.log('[Solana] ❌ Cannot airdrop on mainnet');
190
+ return null;
191
+ }
192
+ try {
193
+ const lamports = amountSol * LAMPORTS_PER_SOL;
194
+ this.log(`[Solana] 💧 Requesting ${amountSol} SOL airdrop…`);
195
+ const sig = await this.connection.requestAirdrop(this.keypair.publicKey, lamports);
196
+ await this.connection.confirmTransaction(sig, 'confirmed');
197
+ this.log(`[Solana] ✅ Airdrop: ${sig}`);
198
+ return sig;
199
+ }
200
+ catch (error) {
201
+ this.log(`[Solana] ❌ Airdrop failed: ${error.message}`);
202
+ return null;
203
+ }
204
+ }
205
+ }
206
+ //# sourceMappingURL=solana.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../src/adapters/solana.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,aAAa,GACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iCAAiC,EACjC,yBAAyB,EAEzB,UAAU,EACV,gBAAgB,GACjB,MAAM,mBAAmB,CAAC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AAkB,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;YAC3D,IAAI,CAAC,GAAG,CAAC,uBAAuB,GAAG,EAAE,CAAC,CAAC;YACvC,OAAO,GAAG,CAAC;QACb,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,CAAC,GAAG,CAAC,8BAA8B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACxD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
package/dist/esm/index.js CHANGED
@@ -11,6 +11,8 @@ export { EvmPaymentAdapter, listEvmChains } from './adapters/evm';
11
11
  export { StripePaymentAdapter } from './adapters/stripe';
12
12
  // Adapters — Stellar
13
13
  export { StellarPaymentAdapter } from './adapters/stellar';
14
+ // Adapters — Solana (SOL + USDC SPL, mainnet/devnet/testnet)
15
+ export { SolanaPaymentAdapter } from './adapters/solana';
14
16
  // Adapters — Base (backward compat, use EvmPaymentAdapter instead)
15
17
  export { BasePaymentAdapter } from './adapters/base';
16
18
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,0BAA0B;AAE1B,OAAO;AACP,OAAO,EAAE,SAAS,EAAoB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AAGtD,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,OAAO,CAAC;AAYf,2DAA2D;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlE,uEAAuE;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,qBAAqB;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,mEAAmE;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,0BAA0B;AAE1B,OAAO;AACP,OAAO,EAAE,SAAS,EAAoB,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,YAAY,EAAgB,MAAM,UAAU,CAAC;AAGtD,yBAAyB;AACzB,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,OAAO,CAAC;AAYf,2DAA2D;AAC3D,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAGlE,uEAAuE;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,qBAAqB;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,6DAA6D;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAGzD,mEAAmE;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -3,4 +3,5 @@ export { EvmPaymentAdapter, EvmAdapterOptions, EvmChainName, listEvmChains } fro
3
3
  export { StripePaymentAdapter, StripeAdapterOptions } from './stripe';
4
4
  export { BasePaymentAdapter, BaseAdapterOptions } from './base';
5
5
  export { StellarPaymentAdapter, StellarPaymentAdapterOptions } from './stellar';
6
+ export { SolanaPaymentAdapter, SolanaAdapterOptions } from './solana';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,4BAA4B,EAAE,MAAM,WAAW,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,77 @@
1
+ import { PaymentAdapter } from './types';
2
+ import { Logger } from '../logger';
3
+ export interface SolanaAdapterOptions {
4
+ /**
5
+ * Solana secret key as a Uint8Array (64 bytes) or base58 string.
6
+ * If omitted, a random keypair is generated (useful for receiving-only agents).
7
+ */
8
+ secretKey?: Uint8Array | number[];
9
+ /**
10
+ * Network: 'mainnet-beta' | 'devnet' | 'testnet'
11
+ * @default 'devnet'
12
+ */
13
+ network?: 'mainnet-beta' | 'devnet' | 'testnet';
14
+ /**
15
+ * Asset to settle with.
16
+ * - 'SOL' — native SOL (default)
17
+ * - 'USDC' — Circle's native USDC (SPL token)
18
+ * @default 'SOL'
19
+ */
20
+ asset?: 'SOL' | 'USDC';
21
+ /** Optional custom RPC URL. Uses Solana public RPC if omitted. */
22
+ rpcUrl?: string;
23
+ /** Optional logger. SDK is silent by default. */
24
+ logger?: Logger;
25
+ }
26
+ /**
27
+ * SolanaPaymentAdapter — On-chain settlement on Solana.
28
+ *
29
+ * Supports:
30
+ * - Native SOL transfers (System Program)
31
+ * - USDC (SPL Token) transfers with automatic ATA creation
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // SOL on devnet
36
+ * const adapter = new SolanaPaymentAdapter({
37
+ * secretKey: myKeypair.secretKey,
38
+ * network: 'devnet',
39
+ * asset: 'SOL',
40
+ * logger: console.log,
41
+ * });
42
+ *
43
+ * // USDC on mainnet
44
+ * const adapter = new SolanaPaymentAdapter({
45
+ * secretKey: myKeypair.secretKey,
46
+ * network: 'mainnet-beta',
47
+ * asset: 'USDC',
48
+ * });
49
+ * ```
50
+ *
51
+ * @see https://spl.solana.com/token — SPL Token program
52
+ * @see https://pay.asgcard.dev — ASG Pay production infrastructure
53
+ */
54
+ export declare class SolanaPaymentAdapter implements PaymentAdapter {
55
+ readonly chainName: string;
56
+ readonly caip2Id: string;
57
+ private connection;
58
+ private keypair;
59
+ private asset;
60
+ private usdcMint;
61
+ private network;
62
+ private log;
63
+ constructor(options: SolanaAdapterOptions);
64
+ getAddress(): string;
65
+ /** Get SOL balance in SOL (not lamports). */
66
+ getSolBalance(): Promise<string>;
67
+ /** Get USDC balance (6 decimals). */
68
+ getUsdcBalance(): Promise<string>;
69
+ pay(destination: string, amount: string, network: string): Promise<string | null>;
70
+ private paySol;
71
+ private payUsdc;
72
+ /** Find the Associated Token Account for USDC. Returns null if none. */
73
+ private findAta;
74
+ /** Request SOL airdrop from devnet/testnet faucet (for testing). */
75
+ requestAirdrop(amountSol?: number): Promise<string | null>;
76
+ }
77
+ //# sourceMappingURL=solana.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../src/adapters/solana.ts"],"names":[],"m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E"}
@@ -9,6 +9,8 @@ export { StripePaymentAdapter } from './adapters/stripe';
9
9
  export type { StripeAdapterOptions } from './adapters/stripe';
10
10
  export { StellarPaymentAdapter } from './adapters/stellar';
11
11
  export type { StellarPaymentAdapterOptions } from './adapters/stellar';
12
+ export { SolanaPaymentAdapter } from './adapters/solana';
13
+ export type { SolanaAdapterOptions } from './adapters/solana';
12
14
  export { BasePaymentAdapter } from './adapters/base';
13
15
  export type { BaseAdapterOptions } from './adapters/base';
14
16
  export type { PaymentAdapter } from './adapters/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACtD,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGvC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,eAAe,GAChB,MAAM,OAAO,CAAC;AACf,YAAY,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,YAAY,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAC;AAGvE,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iBAAiB,CAAC;AAG1D,YAAY,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@asgcard/pay",
3
- "version": "0.1.1",
4
- "description": "Production x402/MPP payment SDK for AI agents — autonomous 402 settlement on 12 networks (EVM + Stellar + Stripe) with fail-closed policy engine.",
3
+ "version": "0.1.2",
4
+ "description": "Production x402/MPP payment SDK for AI agents — autonomous 402 settlement on 15 networks (EVM + Stellar + Solana + Stripe) with fail-closed policy engine.",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
7
7
  "types": "./dist/types/index.d.ts",
@@ -43,6 +43,8 @@
43
43
  "optimism",
44
44
  "polygon",
45
45
  "stellar",
46
+ "solana",
47
+ "spl-token",
46
48
  "usdc",
47
49
  "evm",
48
50
  "viem",
@@ -65,6 +67,8 @@
65
67
  "url": "https://github.com/ASGCompute/ASGCompute-ows-agent-pay/issues"
66
68
  },
67
69
  "dependencies": {
70
+ "@solana/spl-token": "^0.4.14",
71
+ "@solana/web3.js": "^1.98.4",
68
72
  "@stellar/stellar-sdk": "^13.3.0",
69
73
  "axios": "^1.14.0",
70
74
  "viem": "^2.47.6"