cards402 0.2.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +133 -0
  3. package/dist/__tests__/client.test.d.ts +2 -0
  4. package/dist/__tests__/client.test.d.ts.map +1 -0
  5. package/dist/__tests__/client.test.js +251 -0
  6. package/dist/__tests__/client.test.js.map +1 -0
  7. package/dist/__tests__/errors.test.d.ts +2 -0
  8. package/dist/__tests__/errors.test.d.ts.map +1 -0
  9. package/dist/__tests__/errors.test.js +177 -0
  10. package/dist/__tests__/errors.test.js.map +1 -0
  11. package/dist/__tests__/integration.test.d.ts +13 -0
  12. package/dist/__tests__/integration.test.d.ts.map +1 -0
  13. package/dist/__tests__/integration.test.js +223 -0
  14. package/dist/__tests__/integration.test.js.map +1 -0
  15. package/dist/client.d.ts +116 -0
  16. package/dist/client.d.ts.map +1 -0
  17. package/dist/client.js +261 -0
  18. package/dist/client.js.map +1 -0
  19. package/dist/errors.d.ts +66 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +148 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/index.d.ts +8 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +35 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/mcp.d.ts +3 -0
  28. package/dist/mcp.d.ts.map +1 -0
  29. package/dist/mcp.js +521 -0
  30. package/dist/mcp.js.map +1 -0
  31. package/dist/ows.d.ts +121 -0
  32. package/dist/ows.d.ts.map +1 -0
  33. package/dist/ows.js +300 -0
  34. package/dist/ows.js.map +1 -0
  35. package/dist/soroban.d.ts +48 -0
  36. package/dist/soroban.d.ts.map +1 -0
  37. package/dist/soroban.js +132 -0
  38. package/dist/soroban.js.map +1 -0
  39. package/dist/stellar.d.ts +53 -0
  40. package/dist/stellar.d.ts.map +1 -0
  41. package/dist/stellar.js +156 -0
  42. package/dist/stellar.js.map +1 -0
  43. package/package.json +73 -0
@@ -0,0 +1,53 @@
1
+ import { Networks } from '@stellar/stellar-sdk';
2
+ import type { CardDetails, PaymentInstructions } from './client';
3
+ export interface WalletInfo {
4
+ publicKey: string;
5
+ secret: string;
6
+ }
7
+ export declare function createWallet(): WalletInfo;
8
+ export declare function getBalance(publicKey: string, networkPassphrase?: string): Promise<{
9
+ xlm: string;
10
+ usdc: string;
11
+ }>;
12
+ export declare function addUsdcTrustline(secret: string, networkPassphrase?: Networks): Promise<string>;
13
+ export interface PayOpts {
14
+ walletSecret: string;
15
+ payment: PaymentInstructions;
16
+ paymentAsset?: 'usdc' | 'xlm';
17
+ networkPassphrase?: string;
18
+ sorobanRpcUrl?: string;
19
+ }
20
+ /**
21
+ * Pay the cards402 receiver contract using a raw Stellar secret key.
22
+ * Invokes pay_usdc or pay_xlm with the agent's G-address, the quoted amount
23
+ * converted to 7-decimal stroops, and the order_id from the create-order
24
+ * response. Returns the Soroban transaction hash.
25
+ */
26
+ export declare function payViaContract(opts: PayOpts): Promise<string>;
27
+ /**
28
+ * Full purchase flow with a raw keypair: create order → invoke contract →
29
+ * wait for card. Pass `resume: { orderId, payment }` to re-enter a partially
30
+ * completed flow without creating a new order (S-9).
31
+ */
32
+ export declare function purchaseCard(opts: {
33
+ apiKey: string;
34
+ walletSecret: string;
35
+ amountUsdc: string;
36
+ paymentAsset?: 'usdc' | 'xlm';
37
+ baseUrl?: string;
38
+ networkPassphrase?: string;
39
+ sorobanRpcUrl?: string;
40
+ resume?: {
41
+ orderId: string;
42
+ payment: PaymentInstructions;
43
+ };
44
+ waitForCardOpts?: {
45
+ timeoutMs?: number;
46
+ intervalMs?: number;
47
+ };
48
+ }): Promise<CardDetails & {
49
+ order_id: string;
50
+ }>;
51
+ /** @deprecated Use `payViaContract` — this is the Soroban contract call, not a direct Stellar payment. */
52
+ export declare const payVCC: typeof payViaContract;
53
+ //# sourceMappingURL=stellar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stellar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EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAC3D,eAAe,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/D,GAAG,OAAO,CAAC,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAgC9C;AAKD,0GAA0G;AAC1G,eAAO,MAAM,MAAM,uBAAiB,CAAC"}
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ // Helpers for agents using a raw Stellar keypair (S...) to pay the cards402
3
+ // receiver contract on Soroban. For OWS-wallet custody, see ./ows.ts.
4
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
5
+ if (k2 === undefined) k2 = k;
6
+ var desc = Object.getOwnPropertyDescriptor(m, k);
7
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
8
+ desc = { enumerable: true, get: function() { return m[k]; } };
9
+ }
10
+ Object.defineProperty(o, k2, desc);
11
+ }) : (function(o, m, k, k2) {
12
+ if (k2 === undefined) k2 = k;
13
+ o[k2] = m[k];
14
+ }));
15
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
16
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
17
+ }) : function(o, v) {
18
+ o["default"] = v;
19
+ });
20
+ var __importStar = (this && this.__importStar) || (function () {
21
+ var ownKeys = function(o) {
22
+ ownKeys = Object.getOwnPropertyNames || function (o) {
23
+ var ar = [];
24
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
25
+ return ar;
26
+ };
27
+ return ownKeys(o);
28
+ };
29
+ return function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.payVCC = void 0;
39
+ exports.createWallet = createWallet;
40
+ exports.getBalance = getBalance;
41
+ exports.addUsdcTrustline = addUsdcTrustline;
42
+ exports.payViaContract = payViaContract;
43
+ exports.purchaseCard = purchaseCard;
44
+ const stellar_sdk_1 = require("@stellar/stellar-sdk");
45
+ const soroban_1 = require("./soroban");
46
+ const USDC_ISSUER = 'GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN';
47
+ const HORIZON_TIMEOUT_MS = 15000;
48
+ function getHorizonUrl(networkPassphrase) {
49
+ return networkPassphrase === stellar_sdk_1.Networks.TESTNET
50
+ ? 'https://horizon-testnet.stellar.org'
51
+ : 'https://horizon.stellar.org';
52
+ }
53
+ function getServer(networkPassphrase) {
54
+ return new stellar_sdk_1.Horizon.Server(getHorizonUrl(networkPassphrase));
55
+ }
56
+ function withTimeout(promise, ms = HORIZON_TIMEOUT_MS) {
57
+ return Promise.race([
58
+ promise,
59
+ new Promise((_, reject) => setTimeout(() => reject(new Error(`Horizon request timed out after ${ms}ms`)), ms)),
60
+ ]);
61
+ }
62
+ function createWallet() {
63
+ const keypair = stellar_sdk_1.Keypair.random();
64
+ return { publicKey: keypair.publicKey(), secret: keypair.secret() };
65
+ }
66
+ async function getBalance(publicKey, networkPassphrase) {
67
+ const server = getServer(networkPassphrase);
68
+ const account = await withTimeout(server.loadAccount(publicKey));
69
+ let xlm = '0', usdc = '0';
70
+ for (const b of account.balances) {
71
+ if (b.asset_type === 'native')
72
+ xlm = b.balance;
73
+ if (b.asset_type === 'credit_alphanum4' &&
74
+ b.asset_code === 'USDC' &&
75
+ b.asset_issuer === USDC_ISSUER)
76
+ usdc = b.balance;
77
+ }
78
+ return { xlm, usdc };
79
+ }
80
+ async function addUsdcTrustline(secret, networkPassphrase = stellar_sdk_1.Networks.PUBLIC) {
81
+ const server = getServer(networkPassphrase);
82
+ const keypair = stellar_sdk_1.Keypair.fromSecret(secret);
83
+ const account = await withTimeout(server.loadAccount(keypair.publicKey()));
84
+ const tx = new stellar_sdk_1.TransactionBuilder(account, { fee: stellar_sdk_1.BASE_FEE, networkPassphrase })
85
+ .addOperation(stellar_sdk_1.Operation.changeTrust({ asset: new stellar_sdk_1.Asset('USDC', USDC_ISSUER) }))
86
+ .setTimeout(300)
87
+ .build();
88
+ tx.sign(keypair);
89
+ const result = await server.submitTransaction(tx);
90
+ return result.hash;
91
+ }
92
+ /**
93
+ * Pay the cards402 receiver contract using a raw Stellar secret key.
94
+ * Invokes pay_usdc or pay_xlm with the agent's G-address, the quoted amount
95
+ * converted to 7-decimal stroops, and the order_id from the create-order
96
+ * response. Returns the Soroban transaction hash.
97
+ */
98
+ async function payViaContract(opts) {
99
+ const { walletSecret, payment, paymentAsset = 'usdc', networkPassphrase = stellar_sdk_1.Networks.PUBLIC, sorobanRpcUrl, } = opts;
100
+ if (!stellar_sdk_1.StrKey.isValidContract(payment.contract_id)) {
101
+ throw new Error(`Invalid contract_id in order response: ${payment.contract_id}`);
102
+ }
103
+ const keypair = stellar_sdk_1.Keypair.fromSecret(walletSecret);
104
+ const { fn, amountDecimal } = (0, soroban_1.selectContractCall)(payment, paymentAsset);
105
+ const { tx, server } = await (0, soroban_1.buildContractPaymentTx)({
106
+ contractId: payment.contract_id,
107
+ fn,
108
+ fromPublicKey: keypair.publicKey(),
109
+ amountStroops: (0, soroban_1.decimalToStroops)(amountDecimal),
110
+ orderId: payment.order_id,
111
+ networkPassphrase,
112
+ rpcUrl: sorobanRpcUrl,
113
+ });
114
+ tx.sign(keypair);
115
+ return (0, soroban_1.submitSorobanTx)(tx, server);
116
+ }
117
+ /**
118
+ * Full purchase flow with a raw keypair: create order → invoke contract →
119
+ * wait for card. Pass `resume: { orderId, payment }` to re-enter a partially
120
+ * completed flow without creating a new order (S-9).
121
+ */
122
+ async function purchaseCard(opts) {
123
+ const { Cards402Client } = await Promise.resolve().then(() => __importStar(require('./client')));
124
+ const client = new Cards402Client({ apiKey: opts.apiKey, baseUrl: opts.baseUrl });
125
+ const paymentAsset = opts.paymentAsset ?? 'usdc';
126
+ let orderId;
127
+ let payment;
128
+ if (opts.resume) {
129
+ orderId = opts.resume.orderId;
130
+ payment = opts.resume.payment;
131
+ const status = await client.getOrder(orderId);
132
+ if (status.phase !== 'awaiting_payment') {
133
+ const card = await client.waitForCard(orderId, opts.waitForCardOpts);
134
+ return { ...card, order_id: orderId };
135
+ }
136
+ }
137
+ else {
138
+ const order = await client.createOrder({ amount_usdc: opts.amountUsdc });
139
+ orderId = order.order_id;
140
+ payment = order.payment;
141
+ }
142
+ await payViaContract({
143
+ walletSecret: opts.walletSecret,
144
+ payment,
145
+ paymentAsset,
146
+ networkPassphrase: opts.networkPassphrase,
147
+ sorobanRpcUrl: opts.sorobanRpcUrl,
148
+ });
149
+ const card = await client.waitForCard(orderId, opts.waitForCardOpts);
150
+ return { ...card, order_id: orderId };
151
+ }
152
+ // Back-compat aliases — the pre-V3 SDK exposed these names. Keep them around
153
+ // as deprecated exports so existing imports don't break on upgrade.
154
+ /** @deprecated Use `payViaContract` — this is the Soroban contract call, not a direct Stellar payment. */
155
+ exports.payVCC = payViaContract;
156
+ //# sourceMappingURL=stellar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stellar.js","sourceRoot":"","sources":["../src/stellar.ts"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,sEAAsE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+CtE,oCAGC;AAED,gCAkBC;AAED,4CAcC;AAkBD,wCA4BC;AAOD,oCA0CC;AAnLD,sDAS8B;AAE9B,uCAKmB;AAEnB,MAAM,WAAW,GAAG,0DAA0D,CAAC;AAC/E,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEjC,SAAS,aAAa,CAAC,iBAA0B;IAC/C,OAAO,iBAAiB,KAAK,sBAAQ,CAAC,OAAO;QAC3C,C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AAC;YACxC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;YACrE,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QACxC,CAAC;IACH,CAAC;SAAM,CAAC;QACN,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QACzE,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC;QACzB,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,cAAc,CAAC;QACnB,YAAY,EAAE,IAAI,CAAC,YAAY;QAC/B,OAAO;QACP,YAAY;QACZ,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,aAAa,EAAE,IAAI,CAAC,aAAa;KAClC,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IACrE,OAAO,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,6EAA6E;AAC7E,oEAAoE;AAEpE,0GAA0G;AAC7F,QAAA,MAAM,GAAG,cAAc,CAAC"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "cards402",
3
+ "version": "0.2.1",
4
+ "description": "Virtual Visa cards for AI agents — pay USDC or XLM on Stellar, get a card in ~60s",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ },
12
+ "./mcp": {
13
+ "import": "./dist/mcp.js",
14
+ "types": "./dist/mcp.d.ts"
15
+ }
16
+ },
17
+ "bin": {
18
+ "cards402": "./dist/mcp.js"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc",
27
+ "dev": "tsc --watch",
28
+ "lint": "eslint src",
29
+ "typecheck": "tsc --noEmit",
30
+ "test": "vitest run",
31
+ "prepublishOnly": "npm run build && npm test"
32
+ },
33
+ "keywords": [
34
+ "stellar",
35
+ "usdc",
36
+ "xlm",
37
+ "virtual-card",
38
+ "vcc",
39
+ "visa",
40
+ "ai-agent",
41
+ "mcp",
42
+ "model-context-protocol",
43
+ "402-payment",
44
+ "soroban",
45
+ "cards402"
46
+ ],
47
+ "license": "MIT",
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/CTX-com/Cards402"
51
+ },
52
+ "homepage": "https://cards402.com",
53
+ "publishConfig": {
54
+ "access": "public"
55
+ },
56
+ "engines": {
57
+ "node": ">=18"
58
+ },
59
+ "overrides": {
60
+ "axios": "^1.15.0"
61
+ },
62
+ "dependencies": {
63
+ "@modelcontextprotocol/sdk": "^1.0.0",
64
+ "@ctx.com/stellar-ows-core": "^1.3.0-stellar",
65
+ "@stellar/stellar-sdk": "^15.0.1"
66
+ },
67
+ "devDependencies": {
68
+ "@types/node": "^22.0.0",
69
+ "@vitest/coverage-v8": "^4.1.3",
70
+ "typescript": "^5.0.0",
71
+ "vitest": "^4.1.3"
72
+ }
73
+ }