402mob-merchant-sdk 0.1.2 → 0.1.3
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 +10 -2
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Install from npm:
|
|
|
26
26
|
npm install 402mob-merchant-sdk
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
The current published release is **0.1.2**. The working tree prepares **0.1.3** with a typed directory visibility method; publish it from the SDK package directory when ready. See the [npm package page](https://www.npmjs.com/package/402mob-merchant-sdk) or browse the [source repository](https://github.com/gggggggg424242/402mob-merchant-sdk).
|
|
30
30
|
|
|
31
31
|
Requires Node.js 18 or newer. The SDK uses the built-in Fetch API and has no runtime dependencies.
|
|
32
32
|
|
|
@@ -56,6 +56,9 @@ const offer = await merchant.createOffer({
|
|
|
56
56
|
result: { summary: "Prepared by the seller agent" },
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
+
// Make active offers searchable in the public merchant directory.
|
|
60
|
+
await merchant.setDiscoverable(true);
|
|
61
|
+
|
|
59
62
|
console.log({ offerId: offer.id, checkout: offer.checkout });
|
|
60
63
|
```
|
|
61
64
|
|
|
@@ -102,6 +105,7 @@ This action moves no USDC and grants no allowance, but it costs Base ETH for gas
|
|
|
102
105
|
- `getMerchant()`
|
|
103
106
|
- `createOffer(input)`
|
|
104
107
|
- `setOfferActive(offerId, active)`
|
|
108
|
+
- `setDiscoverable(discoverable)` — opt the merchant into or out of public offer search. Defaults to hidden.
|
|
105
109
|
- `listSales(limit?)`
|
|
106
110
|
- `getSale(operationId)`
|
|
107
111
|
|
|
@@ -130,6 +134,10 @@ See [`examples/enroll-and-publish.ts`](./examples/enroll-and-publish.ts) for an
|
|
|
130
134
|
|
|
131
135
|
MIT licensed. See [LICENSE](./LICENSE).
|
|
132
136
|
|
|
137
|
+
## Version 0.1.3 (unpublished)
|
|
138
|
+
|
|
139
|
+
Adds `setDiscoverable(discoverable)`, which calls the authenticated `PUT /v1/agent/merchant/discovery` endpoint. The service controls visibility; enrollment still defaults to hidden. Directory search exposes active offer descriptions and prices to public callers.
|
|
140
|
+
|
|
133
141
|
## Version 0.1.2
|
|
134
142
|
|
|
135
|
-
The source now rejects unreadable or incomplete successful API responses with `MerchantApiError` code `invalid_response`. Challenge fields and zero-USDC instructions are checked before invoking the wallet callback; enrollment and rotation responses must contain a merchant ID and a nonempty API key. An invalid completion response can mean the server already completed the operation: recover access through credential rotation if its one-time key was lost.
|
|
143
|
+
The source now rejects unreadable or incomplete successful API responses with `MerchantApiError` code `invalid_response`. Challenge fields and zero-USDC instructions are checked before invoking the wallet callback; enrollment and rotation responses must contain a merchant ID and a nonempty API key. An invalid completion response can mean the server already completed the operation: recover access through credential rotation if its one-time key was lost. This validation is included in published 0.1.2. Integrations using 0.1.1 should validate required fields explicitly. Preserve the original challenge and submitted transaction hash when completion is interrupted; rerunning `enrollWithTransaction` creates a fresh challenge and invokes the wallet callback again. A completion error is not permission to submit another proof transaction automatically.
|
package/dist/index.d.ts
CHANGED
|
@@ -33,6 +33,8 @@ export interface MerchantProfile {
|
|
|
33
33
|
name: string;
|
|
34
34
|
payoutAddress: EvmAddress;
|
|
35
35
|
createdAt: string;
|
|
36
|
+
/** Present in authenticated merchant workspace responses; opt-in controls directory search. */
|
|
37
|
+
discoverable?: boolean;
|
|
36
38
|
}
|
|
37
39
|
export interface MerchantAgent {
|
|
38
40
|
id: string;
|
|
@@ -209,6 +211,10 @@ export declare class MerchantClient {
|
|
|
209
211
|
rotateWithSignature(input: CredentialRotationSignatureInput): Promise<CredentialRotationResult>;
|
|
210
212
|
rotateWithTransaction(input: CredentialRotationTransactionInput): Promise<CredentialRotationResult>;
|
|
211
213
|
getMerchant(): Promise<MerchantWorkspace>;
|
|
214
|
+
setDiscoverable(discoverable: boolean): Promise<{
|
|
215
|
+
merchantId: string;
|
|
216
|
+
discoverable: boolean;
|
|
217
|
+
}>;
|
|
212
218
|
createOffer(input: CreateOfferInput): Promise<MerchantOffer>;
|
|
213
219
|
setOfferActive(offerId: string, active: boolean): Promise<MerchantOffer>;
|
|
214
220
|
listSales(limit?: number): Promise<SaleList>;
|
package/dist/index.js
CHANGED
|
@@ -97,6 +97,9 @@ export class MerchantClient {
|
|
|
97
97
|
getMerchant() {
|
|
98
98
|
return this.request("GET", "/v1/agent/merchant", undefined, true);
|
|
99
99
|
}
|
|
100
|
+
setDiscoverable(discoverable) {
|
|
101
|
+
return this.request("PUT", "/v1/agent/merchant/discovery", { discoverable }, true);
|
|
102
|
+
}
|
|
100
103
|
createOffer(input) {
|
|
101
104
|
return this.request("POST", "/v1/agent/merchant/offers", input, true);
|
|
102
105
|
}
|