@asgcard/sdk 1.1.0 → 1.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.
- package/README.md +26 -5
- package/dist/client.d.ts +17 -5
- package/dist/client.js +39 -4
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +45 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ console.log(result.payment.txHash); // Stellar tx hash
|
|
|
31
31
|
|
|
32
32
|
## How It Works
|
|
33
33
|
|
|
34
|
-
1. SDK calls `POST /cards/create/tier/
|
|
34
|
+
1. SDK calls `POST /cards/create/tier/100`
|
|
35
35
|
2. API returns `402` with x402 payment challenge
|
|
36
36
|
3. SDK builds a Soroban USDC transfer, signs it, and retries with `X-PAYMENT` header
|
|
37
37
|
4. API verifies + settles on Stellar mainnet → returns `201` with card details
|
|
@@ -52,7 +52,7 @@ console.log(result.payment.txHash); // Stellar tx hash
|
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
const card = await client.createCard({
|
|
55
|
-
amount:
|
|
55
|
+
amount: 50, // Any amount $5–$5,000
|
|
56
56
|
nameOnCard: 'MY AGENT',
|
|
57
57
|
email: 'agent@example.com',
|
|
58
58
|
});
|
|
@@ -67,11 +67,11 @@ const funded = await client.fundCard({
|
|
|
67
67
|
});
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
### `client.
|
|
70
|
+
### `client.getPricing()`
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
|
-
const
|
|
74
|
-
// {
|
|
73
|
+
const pricing = await client.getPricing();
|
|
74
|
+
// { cardFee: 10, topUpPercent: 3.5, minAmount: 5, maxAmount: 5000 }
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### `client.health()`
|
|
@@ -81,6 +81,27 @@ const health = await client.health();
|
|
|
81
81
|
// { status: 'ok', version: '0.3.1' }
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
+
### `client.listCards()`
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
const { cards } = await client.listCards();
|
|
88
|
+
// cards: [{ cardId, nameOnCard, lastFour, balance, status, createdAt }]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### `client.getTransactions(cardId, page?, limit?)`
|
|
92
|
+
|
|
93
|
+
```typescript
|
|
94
|
+
const result = await client.getTransactions('card_xxxx');
|
|
95
|
+
// { cardId, transactions: [{ id, type, amount, status, merchantName, createdAt }], pagination }
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### `client.getBalance(cardId)`
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
const result = await client.getBalance('card_xxxx');
|
|
102
|
+
// { cardId, balance: 25.00, currency: 'USD', status: 'active', source: '4payments' }
|
|
103
|
+
```
|
|
104
|
+
|
|
84
105
|
## Low-Level Utilities
|
|
85
106
|
|
|
86
107
|
For custom integrations:
|
package/dist/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ASGCardClientConfig, CardResult, CreateCardParams, FundCardParams, FundResult, HealthResponse,
|
|
1
|
+
import type { ASGCardClientConfig, CardResult, CreateCardParams, FundCardParams, FundResult, HealthResponse, PricingResponse, TransactionListResponse, CardBalanceResponse, CardListEntry } from "./types";
|
|
2
2
|
export declare class ASGCardClient {
|
|
3
3
|
private readonly baseUrl;
|
|
4
4
|
private readonly timeout;
|
|
@@ -9,20 +9,32 @@ export declare class ASGCardClient {
|
|
|
9
9
|
/** Stellar public key (G...) */
|
|
10
10
|
get address(): string;
|
|
11
11
|
/**
|
|
12
|
-
* Create a virtual card
|
|
12
|
+
* Create a virtual card.
|
|
13
|
+
* Card issuance $10 + 3.5% top-up fee.
|
|
13
14
|
* Handles 402 → x402 payment → 201 automatically.
|
|
14
15
|
*/
|
|
15
16
|
createCard(params: CreateCardParams): Promise<CardResult>;
|
|
16
17
|
/**
|
|
17
|
-
* Fund an existing card
|
|
18
|
+
* Fund an existing card. Top-up fee 3.5%.
|
|
18
19
|
* Handles 402 → x402 payment → 200 automatically.
|
|
19
20
|
*/
|
|
20
21
|
fundCard(params: FundCardParams): Promise<FundResult>;
|
|
21
|
-
/** Get
|
|
22
|
-
|
|
22
|
+
/** Get pricing info */
|
|
23
|
+
getPricing(): Promise<PricingResponse>;
|
|
24
|
+
/** @deprecated Use getPricing() */
|
|
25
|
+
getTiers(): Promise<PricingResponse>;
|
|
23
26
|
/** Health check */
|
|
24
27
|
health(): Promise<HealthResponse>;
|
|
28
|
+
/** List all cards for this wallet */
|
|
29
|
+
listCards(): Promise<{
|
|
30
|
+
cards: CardListEntry[];
|
|
31
|
+
}>;
|
|
32
|
+
/** Get transaction history for a card */
|
|
33
|
+
getTransactions(cardId: string, page?: number, limit?: number): Promise<TransactionListResponse>;
|
|
34
|
+
/** Get live balance for a card */
|
|
35
|
+
getBalance(cardId: string): Promise<CardBalanceResponse>;
|
|
25
36
|
private requestWithX402;
|
|
37
|
+
private requestWithAuth;
|
|
26
38
|
private request;
|
|
27
39
|
private rawFetch;
|
|
28
40
|
private parseResponse;
|
package/dist/client.js
CHANGED
|
@@ -39,7 +39,8 @@ class ASGCardClient {
|
|
|
39
39
|
return this.walletAdapter.publicKey;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Create a virtual card
|
|
42
|
+
* Create a virtual card.
|
|
43
|
+
* Card issuance $10 + 3.5% top-up fee.
|
|
43
44
|
* Handles 402 → x402 payment → 201 automatically.
|
|
44
45
|
*/
|
|
45
46
|
async createCard(params) {
|
|
@@ -55,7 +56,7 @@ class ASGCardClient {
|
|
|
55
56
|
});
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
|
-
* Fund an existing card
|
|
59
|
+
* Fund an existing card. Top-up fee 3.5%.
|
|
59
60
|
* Handles 402 → x402 payment → 200 automatically.
|
|
60
61
|
*/
|
|
61
62
|
async fundCard(params) {
|
|
@@ -64,14 +65,30 @@ class ASGCardClient {
|
|
|
64
65
|
body: JSON.stringify({ cardId: params.cardId })
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
|
-
/** Get
|
|
68
|
-
async
|
|
68
|
+
/** Get pricing info */
|
|
69
|
+
async getPricing() {
|
|
69
70
|
return this.request("/cards/tiers", { method: "GET" });
|
|
70
71
|
}
|
|
72
|
+
/** @deprecated Use getPricing() */
|
|
73
|
+
async getTiers() {
|
|
74
|
+
return this.getPricing();
|
|
75
|
+
}
|
|
71
76
|
/** Health check */
|
|
72
77
|
async health() {
|
|
73
78
|
return this.request("/health", { method: "GET" });
|
|
74
79
|
}
|
|
80
|
+
/** List all cards for this wallet */
|
|
81
|
+
async listCards() {
|
|
82
|
+
return this.requestWithAuth("/wallet", { method: "GET" });
|
|
83
|
+
}
|
|
84
|
+
/** Get transaction history for a card */
|
|
85
|
+
async getTransactions(cardId, page = 1, limit = 20) {
|
|
86
|
+
return this.requestWithAuth(`/wallet/${cardId}/transactions?page=${page}&limit=${limit}`, { method: "GET" });
|
|
87
|
+
}
|
|
88
|
+
/** Get live balance for a card */
|
|
89
|
+
async getBalance(cardId) {
|
|
90
|
+
return this.requestWithAuth(`/wallet/${cardId}/balance`, { method: "GET" });
|
|
91
|
+
}
|
|
75
92
|
// ── x402 payment flow ────────────────────────────────
|
|
76
93
|
async requestWithX402(path, init) {
|
|
77
94
|
const first = await this.rawFetch(path, init);
|
|
@@ -95,6 +112,24 @@ class ASGCardClient {
|
|
|
95
112
|
});
|
|
96
113
|
return this.parseResponse(retry);
|
|
97
114
|
}
|
|
115
|
+
// ── Wallet-authenticated requests ────────────────────
|
|
116
|
+
async requestWithAuth(path, init) {
|
|
117
|
+
if (!this.keypair) {
|
|
118
|
+
throw new Error("requestWithAuth requires a keypair (privateKey)");
|
|
119
|
+
}
|
|
120
|
+
const timestamp = Math.floor(Date.now() / 1000).toString();
|
|
121
|
+
const message = Buffer.from(`asgcard-auth:${timestamp}`);
|
|
122
|
+
const signature = this.keypair.sign(message).toString("base64");
|
|
123
|
+
const headers = {
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
"X-WALLET-ADDRESS": this.keypair.publicKey(),
|
|
126
|
+
"X-WALLET-SIGNATURE": signature,
|
|
127
|
+
"X-WALLET-TIMESTAMP": timestamp,
|
|
128
|
+
...(init.headers ?? {}),
|
|
129
|
+
};
|
|
130
|
+
const response = await this.rawFetch(path, { ...init, headers });
|
|
131
|
+
return this.parseResponse(response);
|
|
132
|
+
}
|
|
98
133
|
// ── HTTP primitives ──────────────────────────────────
|
|
99
134
|
async request(path, init) {
|
|
100
135
|
const response = await this.rawFetch(path, init);
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,sDAAkE;AAClE,qCAAkD;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,sDAAkE;AAClE,qCAAkD;AAclD,uCAAiD;AAEjD,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AACnD,MAAM,eAAe,GAAG,gCAAgC,CAAC;AACzD,MAAM,eAAe,GAAG,MAAM,CAAC;AAE/B,MAAa,aAAa;IACP,OAAO,CAAS;IAEhB,OAAO,CAAS;IAEhB,SAAS,CAAoB;IAE7B,OAAO,CAAW;IAElB,aAAa,CAAiB;IAE/C,YAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,UAAU,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;QAChE,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,gBAAgB,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,eAAe,CAAC;QACjD,IAAI,CA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AAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAExD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,iBAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAED,OAAO,OAAY,CAAC;IACtB,CAAC;CACF;AA/LD,sCA+LC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ASGCardClient } from "./client";
|
|
2
2
|
export { ApiError, TimeoutError, PaymentError, InsufficientBalanceError } from "./errors";
|
|
3
|
-
export type { ASGCardClientConfig, WalletAdapter, CreateCardParams, FundCardParams,
|
|
3
|
+
export type { ASGCardClientConfig, WalletAdapter, CreateCardParams, FundCardParams, PricingResponse, CardResult, FundResult, HealthResponse, BillingAddress, SensitiveCardDetails, X402Challenge, X402Accept, X402PaymentPayload } from "./types";
|
|
4
4
|
export { parseChallenge, checkBalance, executePayment, buildPaymentPayload, buildPaymentTransaction, handleX402Payment } from "./utils/x402";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAEtB,mCAKkB;AAJhB,kGAAA,QAAQ,OAAA;AACR,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA;AACZ,kHAAA,wBAAwB,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAEtB,mCAKkB;AAJhB,kGAAA,QAAQ,OAAA;AACR,sGAAA,YAAY,OAAA;AACZ,sGAAA,YAAY,OAAA;AACZ,kHAAA,wBAAwB,OAAA;AAmB1B,qCAOsB;AANpB,sGAAA,cAAc,OAAA;AACd,oGAAA,YAAY,OAAA;AACZ,sGAAA,cAAc,OAAA;AACd,2GAAA,mBAAmB,OAAA;AACnB,+GAAA,uBAAuB,OAAA;AACvB,yGAAA,iBAAiB,OAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -24,26 +24,22 @@ export interface ASGCardClientConfig {
|
|
|
24
24
|
timeout?: number;
|
|
25
25
|
}
|
|
26
26
|
export interface CreateCardParams {
|
|
27
|
-
amount:
|
|
27
|
+
amount: number;
|
|
28
28
|
nameOnCard: string;
|
|
29
29
|
email: string;
|
|
30
30
|
/** Phone number for cardholder registration (e.g. +1234567890). Required by card issuer. */
|
|
31
31
|
phone?: string;
|
|
32
32
|
}
|
|
33
33
|
export interface FundCardParams {
|
|
34
|
-
amount:
|
|
34
|
+
amount: number;
|
|
35
35
|
cardId: string;
|
|
36
36
|
}
|
|
37
|
-
export interface
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
export interface TierResponse {
|
|
45
|
-
creation: TierEntry[];
|
|
46
|
-
funding: TierEntry[];
|
|
37
|
+
export interface PricingResponse {
|
|
38
|
+
cardFee: number;
|
|
39
|
+
topUpPercent: number;
|
|
40
|
+
minAmount: number;
|
|
41
|
+
maxAmount: number;
|
|
42
|
+
description: string;
|
|
47
43
|
}
|
|
48
44
|
export interface BillingAddress {
|
|
49
45
|
street: string;
|
|
@@ -128,3 +124,40 @@ export interface X402PaymentPayload {
|
|
|
128
124
|
transaction: string;
|
|
129
125
|
};
|
|
130
126
|
}
|
|
127
|
+
export interface TransactionEntry {
|
|
128
|
+
id: string;
|
|
129
|
+
type: string;
|
|
130
|
+
amount: number;
|
|
131
|
+
currency: string;
|
|
132
|
+
status: string;
|
|
133
|
+
description?: string;
|
|
134
|
+
merchantName?: string;
|
|
135
|
+
createdAt: string;
|
|
136
|
+
}
|
|
137
|
+
export interface TransactionListResponse {
|
|
138
|
+
cardId: string;
|
|
139
|
+
lastFour?: string;
|
|
140
|
+
transactions: TransactionEntry[];
|
|
141
|
+
pagination: {
|
|
142
|
+
page: number;
|
|
143
|
+
limit: number;
|
|
144
|
+
total: number;
|
|
145
|
+
pages: number;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
export interface CardBalanceResponse {
|
|
149
|
+
cardId: string;
|
|
150
|
+
lastFour?: string;
|
|
151
|
+
balance: number;
|
|
152
|
+
currency: string;
|
|
153
|
+
status?: string;
|
|
154
|
+
source: "4payments" | "local";
|
|
155
|
+
}
|
|
156
|
+
export interface CardListEntry {
|
|
157
|
+
cardId: string;
|
|
158
|
+
nameOnCard: string;
|
|
159
|
+
lastFour: string;
|
|
160
|
+
balance: number;
|
|
161
|
+
status: string;
|
|
162
|
+
createdAt: string;
|
|
163
|
+
}
|