@atumlabs/mppx-atum-escrow 0.3.0 → 0.4.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.
package/dist/server.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import * as zod_v4_core from 'zod/v4/core';
2
- import * as z from 'zod/mini';
3
- import { j as ChainDefaults, c as ChargeRequest } from './internal-9tB7y-A7.js';
4
- export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, d as ChargeRequestSchema, e as CredentialPayloadSchema, I as INTENT, f as INTENT_ID_META_KEY, M as METHOD_NAME, h as atumEscrowChargeMethod } from './internal-9tB7y-A7.js';
1
+ import { i as atumEscrowChargeMethod, j as ChainDefaults, d as ChargeRequest } from './internal-BZBJJfaL.js';
2
+ export { A as AtumEscrowChallenge, a as AtumEscrowCredential, C as ChargeCredentialPayload, e as ChargeRequestSchema, f as CredentialPayloadSchema, I as INTENT, g as INTENT_ID_META_KEY, M as METHOD_NAME } from './internal-BZBJJfaL.js';
5
3
  import { Errors, Receipt, Method } from 'mppx';
6
4
  import { PaymentRequest } from './generated/index.js';
7
5
  export { PaymentRequest } from './generated/index.js';
6
+ import './sender-auth-verify-C-Q-zvAO.js';
7
+ import 'zod/mini';
8
8
 
9
9
  /**
10
10
  * This file was automatically generated by json-schema-to-typescript.
@@ -178,6 +178,26 @@ declare class PaymentRejectedError extends Errors.BadRequestError {
178
178
  });
179
179
  }
180
180
 
181
+ /**
182
+ * Merchant-side entry point for the Atum escrow MPP payment method.
183
+ *
184
+ * Register the returned method into your `mppx` server to accept `atum-escrow`
185
+ * payments, and use {@link buildChargeRequest} / {@link corridorFromDefaults} to construct
186
+ * the `402` challenges. Verification recovers the source-chain deposit authorization per
187
+ * chain (EVM, Tron, Solana) and settles through the Atum Payment Gateway.
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * import { Mppx } from 'mppx/server'
192
+ * import { registerServer } from '@atumlabs/mppx-atum-escrow/server'
193
+ *
194
+ * const method = registerServer({ submitter })
195
+ * const mppx = Mppx.create({ realm: 'api.example.com', secretKey, methods: [method] })
196
+ * ```
197
+ *
198
+ * @packageDocumentation
199
+ */
200
+
181
201
  /** One source chain/token the merchant accepts payment from. */
182
202
  interface AtumEscrowSource {
183
203
  /** CAIP-2 source chain id (e.g. `eip155:8453`, `tron:mainnet`, `solana:<genesis>`). */
@@ -220,8 +240,15 @@ interface AtumEscrowCorridor {
220
240
  /** Accepted source options; selected per charge by `(network, asset)`. */
221
241
  sources: AtumEscrowSource[];
222
242
  }
223
- /** Lifecycle state the gateway reports for a payment. */
224
- type PaymentSettlementStatus = "pending" | "completed" | "failed" | "cancelled";
243
+ /**
244
+ * Lifecycle state the gateway reports for a payment.
245
+ *
246
+ * `finalizing` means the payment is on chain but has not yet reached the confirmation depth its
247
+ * chain requires. It is NOT terminal: a payer must keep waiting on the same idempotency key, never
248
+ * start a second payment for it.
249
+ *
250
+ */
251
+ type PaymentSettlementStatus = 'pending' | 'finalizing' | 'completed' | 'failed';
225
252
  /** What a {@link PaymentSubmitter} resolves with. */
226
253
  interface PaymentSubmitResult {
227
254
  /** The gateway's payment id. Present whenever the payment was accepted. */
@@ -269,6 +296,18 @@ type AtumEscrowReceipt = Receipt.Receipt & {
269
296
  /** The full settlement confirmation. */
270
297
  fulfillmentConfirmation: FulfillmentConfirmation;
271
298
  };
299
+ /**
300
+ * The merchant-side method {@link registerServer} returns, ready to register into an
301
+ * `mppx` server via `Mppx.create({ methods: [method] })`.
302
+ *
303
+ * Name this type when the method is built in one place and registered in another — for
304
+ * example a factory that assembles the corridor and submitter for your environment. Its
305
+ * `verify()` resolves with an {@link AtumEscrowReceipt}, so the settlement confirmation is
306
+ * available directly on the result.
307
+ */
308
+ type AtumEscrowServer = Omit<Method.Server<typeof atumEscrowChargeMethod, {}, undefined, {}, undefined>, 'verify'> & {
309
+ verify: (parameters: Method.VerifyContext<typeof atumEscrowChargeMethod>) => Promise<AtumEscrowReceipt>;
310
+ };
272
311
  /**
273
312
  * Configure the merchant side of the method.
274
313
  *
@@ -284,42 +323,7 @@ type AtumEscrowReceipt = Receipt.Receipt & {
284
323
  *
285
324
  * @param config - the gateway submitter and options.
286
325
  */
287
- declare function registerServer(config: AtumEscrowServerConfig): Method.Server<{
288
- readonly name: "atum-escrow";
289
- readonly intent: "charge";
290
- readonly schema: {
291
- readonly request: z.ZodMiniObject<{
292
- source: z.ZodMiniObject<{
293
- network: z.ZodMiniString<string>;
294
- asset: z.ZodMiniString<string>;
295
- amount: z.ZodMiniString<string>;
296
- }, zod_v4_core.$strip>;
297
- extra: z.ZodMiniObject<{
298
- destination: z.ZodMiniObject<{
299
- network: z.ZodMiniString<string>;
300
- asset: z.ZodMiniString<string>;
301
- address: z.ZodMiniString<string>;
302
- }, zod_v4_core.$strip>;
303
- fulfillmentAmount: z.ZodMiniString<string>;
304
- escrow: z.ZodMiniString<string>;
305
- fulfillmentProxy: z.ZodMiniString<string>;
306
- reserver: z.ZodMiniString<string>;
307
- releaser: z.ZodMiniString<string>;
308
- fulfillmentVerifierEndpoint: z.ZodMiniString<string>;
309
- quoteDeadlineSeconds: z.ZodMiniNumber<number>;
310
- fulfillmentDeadlineSeconds: z.ZodMiniNumber<number>;
311
- svmSignatureClusterId: z.ZodMiniOptional<z.ZodMiniString<string>>;
312
- svmSignatureDomainVersion: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
313
- issuedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
314
- }, zod_v4_core.$strip>;
315
- }, zod_v4_core.$strip>;
316
- readonly credential: {
317
- readonly payload: z.ZodMiniObject<{
318
- paymentRequest: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>;
319
- }, zod_v4_core.$strip>;
320
- };
321
- };
322
- }, {}, undefined, {}, undefined>;
326
+ declare function registerServer(config: AtumEscrowServerConfig): AtumEscrowServer;
323
327
  /**
324
328
  * Validate a corridor's shape and per-source addresses. Run automatically by
325
329
  * {@link buildChargeRequest}; call it directly to fail fast at merchant startup.
@@ -444,4 +448,4 @@ declare function corridorFromDefaults(defaults: ChainDefaultsSource, params: {
444
448
  fulfillmentDeadlineSeconds: number;
445
449
  }): Promise<AtumEscrowCorridor>;
446
450
 
447
- export { type AtumEscrowCorridor, type AtumEscrowReceipt, type AtumEscrowServerConfig, type AtumEscrowSource, type ChainDefaultsSource, type ChargeChallenge, ChargeRequest, type FulfillmentConfirmation, PaymentRejectedError, type PaymentSettlementStatus, type PaymentSubmitResult, type PaymentSubmitter, type SettlementErrorDetails, SettlementFailedError, SettlementPendingError, buildChargeChallenge, buildChargeRequest, corridorFromDefaults, isPaymentRejected, isSettlementFailed, isSettlementPending, registerServer, validateCorridor };
451
+ export { type AtumEscrowCorridor, type AtumEscrowReceipt, type AtumEscrowServer, type AtumEscrowServerConfig, type AtumEscrowSource, type ChainDefaultsSource, type ChargeChallenge, ChargeRequest, type FulfillmentConfirmation, PaymentRejectedError, type PaymentSettlementStatus, type PaymentSubmitResult, type PaymentSubmitter, type SettlementErrorDetails, SettlementFailedError, SettlementPendingError, atumEscrowChargeMethod, buildChargeChallenge, buildChargeRequest, corridorFromDefaults, isPaymentRejected, isSettlementFailed, isSettlementPending, registerServer, validateCorridor };
package/dist/server.js CHANGED
@@ -1,8 +1,6 @@
1
1
  /*
2
- * Copyright (c) 2026 Atum Labs, Inc. All rights reserved.
3
- * Proprietary and confidential.
4
- * Access and use are governed by the LICENSE file distributed with this package.
5
- * Do not remove, alter, or obscure this notice.
2
+ * Copyright 2026 Atum Labs, Inc.
3
+ * SPDX-License-Identifier: Apache-2.0
6
4
  */
7
5
  import { createRequire as __atumCreateRequire } from 'module'; const require = __atumCreateRequire(import.meta.url);
8
6
  import {
@@ -17,7 +15,7 @@ import {
17
15
  isSettlementPending,
18
16
  registerServer,
19
17
  validateCorridor
20
- } from "./chunk-4YD6566T.js";
18
+ } from "./chunk-EWIOTGMO.js";
21
19
  import {
22
20
  ChargeRequestSchema,
23
21
  CredentialPayloadSchema,
@@ -25,7 +23,7 @@ import {
25
23
  INTENT_ID_META_KEY,
26
24
  METHOD_NAME,
27
25
  atumEscrowChargeMethod
28
- } from "./chunk-Z3AUNEU5.js";
26
+ } from "./chunk-LAWFMGYD.js";
29
27
  export {
30
28
  ChargeRequestSchema,
31
29
  CredentialPayloadSchema,
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@atumlabs/mppx-atum-escrow",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Atum cross-chain escrow payment method for the Machine Payments Protocol (MPP).",
5
5
  "author": "Atum Labs, Inc.",
6
- "license": "SEE LICENSE IN LICENSE",
6
+ "license": "Apache-2.0",
7
7
  "publishConfig": {
8
- "access": "restricted"
8
+ "access": "public"
9
9
  },
10
10
  "homepage": "https://github.com/Atum-Labs/protocol/tree/main/mppx-atum-escrow#readme",
11
11
  "repository": {
@@ -51,16 +51,18 @@
51
51
  "README.md",
52
52
  "CHANGELOG.md",
53
53
  "LICENSE",
54
+ "NOTICE",
54
55
  "THIRD-PARTY-NOTICES.txt"
55
56
  ],
56
57
  "scripts": {
57
- "prebuild:deps": "node -e \"const {existsSync}=require('fs');for(const p of ['../contracts/evm/escrow-encoding/typescript/tsconfig.json','../contracts/tvm/escrow-encoding/typescript/tsconfig.json','../contracts/svm/escrow-encoding/typescript/tsconfig.json','../schemas/apis/x402/v1/bindings/typescript/tsconfig.json','../schemas/apis/fulfillment-confirmation/v1/bindings/typescript/tsconfig.json','../schemas/declarations/PaymentRequest/v1/bindings/typescript/sender-auth/tsconfig.json']){if(!existsSync(p)){console.error('bundled sibling not found at '+p+'. Is this checked out inside the protocol monorepo?');process.exit(1)}}if(!existsSync('../payment-gateway-client/dist/index.js')){console.error('@atum-labs/payment-gateway-client is not built. Run its build first (pnpm --filter @atum-labs/payment-gateway-client build).');process.exit(1)}\"",
58
- "build:deps": "tsc -p ../contracts/evm/escrow-encoding/typescript/tsconfig.json && tsc -p ../contracts/tvm/escrow-encoding/typescript/tsconfig.json && tsc -p ../contracts/svm/escrow-encoding/typescript/tsconfig.json && tsc -p ../schemas/apis/x402/v1/bindings/typescript/tsconfig.json && tsc -p ../schemas/apis/fulfillment-confirmation/v1/bindings/typescript/tsconfig.json && tsc -p ../schemas/declarations/PaymentRequest/v1/bindings/typescript/sender-auth/tsconfig.json",
59
- "build": "pnpm run build:deps && tsup && node scripts/stamp-entry-headers.mjs",
60
- "typecheck": "pnpm run build:deps && tsc --noEmit",
61
- "pretest": "pnpm run build:deps",
62
- "test": "vitest run",
63
- "clean": "rm -rf dist ../contracts/evm/escrow-encoding/typescript/dist ../contracts/tvm/escrow-encoding/typescript/dist ../contracts/svm/escrow-encoding/typescript/dist ../schemas/apis/x402/v1/bindings/typescript/dist ../schemas/apis/fulfillment-confirmation/v1/bindings/typescript/dist ../schemas/declarations/PaymentRequest/v1/bindings/typescript/sender-auth/dist",
58
+ "prebuild:deps": "node -e \"if(!require('fs').existsSync('../pnpm-workspace.yaml')){console.error('protocol workspace not found at ../pnpm-workspace.yaml. Is this checked out inside the protocol monorepo?');process.exit(1)}\"",
59
+ "build:deps": "pnpm --filter \"@atum-labs/mppx-atum-escrow^...\" run build",
60
+ "build": "tsup && node scripts/stamp-entry-headers.mjs",
61
+ "lint": "eslint . --max-warnings 0",
62
+ "typecheck": "tsc --noEmit",
63
+ "typecheck:tests": "tsc -p tsconfig.test.json",
64
+ "test": "pnpm run typecheck:tests && vitest run",
65
+ "clean": "rm -rf dist && pnpm --filter \"@atum-labs/mppx-atum-escrow^...\" run clean",
64
66
  "check:publishable": "node scripts/check-publishable.mjs",
65
67
  "gen:notices": "node scripts/gen-third-party-notices.mjs",
66
68
  "prepare": "pnpm run build",
@@ -82,6 +84,7 @@
82
84
  "@atum-labs/fulfillment-confirmation": "workspace:*",
83
85
  "@atum-labs/payment-gateway-client": "workspace:*",
84
86
  "@atum-labs/payment-request-sender-auth": "workspace:*",
87
+ "@atum-labs/payment-request-token-approval": "workspace:*",
85
88
  "@atum-labs/publish-guard": "workspace:*",
86
89
  "@atum-labs/schema-declarations": "workspace:*",
87
90
  "@atum-labs/solana-escrow-encoding": "workspace:*",
@@ -90,7 +93,7 @@
90
93
  "mppx": "^0.8.12",
91
94
  "tsup": "^8.5.1",
92
95
  "typescript": "^5.6.3",
93
- "vitest": "^2.1.9",
96
+ "vitest": "^4.1.11",
94
97
  "zod": "^4.4.3"
95
98
  }
96
99
  }