@glacislabs/stablegenie-zerodelta 4.3.0 → 4.5.0

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.
@@ -300,6 +300,15 @@ interface Quote {
300
300
  bridge?: string;
301
301
  feeBps?: number;
302
302
  estimatedDuration?: number;
303
+ /** How long the order should live, in seconds from quote time, for the lane the gateway just
304
+ * priced — derived server-side from this lane's `estimatedDuration`. Absent on a gateway that
305
+ * predates the field, in which case the widget keeps its own flat default. Advisory: the
306
+ * deadline is still the client's to sign, and `orderRequests[].deadline` still comes back "0".
307
+ * See `recommendedDeadlineSeconds` in `core/order.ts`. */
308
+ recommendedDeadlineSeconds?: number;
309
+ /** The same value as an absolute unix second (decimal string). Informational — the widget builds
310
+ * the deadline from the span so it is measured against the signer's own clock. */
311
+ recommendedDeadline?: string;
303
312
  gasCostSource?: string;
304
313
  gasCostDest?: string;
305
314
  /** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
@@ -946,6 +955,36 @@ declare function laneLimitError(limit: LaneLimit, symbol: string): string;
946
955
  * gateway message: that text is untrusted and can carry infrastructure detail. */
947
956
  declare function brokenLaneReason(lane: BrokenLane | undefined): string;
948
957
 
958
+ /**
959
+ * The shapes the gateway would refuse anyway, checked here so a bad value costs
960
+ * no request.
961
+ *
962
+ * ⚠️ A submit transaction has TWO shapes, and accepting only the EVM one would
963
+ * drop the whole Solana family silently: an EVM 32-byte hash in 0x-hex, or a
964
+ * Solana transaction SIGNATURE in base58 (64 bytes ⇒ 86-88 chars). The length
965
+ * floor keeps a signature distinguishable from an ADDRESS (32-44 chars), which
966
+ * shares the alphabet.
967
+ *
968
+ * ⚠️ The WALLET is always the EVM owner, on every family. A Solana-source order
969
+ * is PAID by a Solana wallet but OWNED by an EVM account — that is the cancel
970
+ * and refund path, and it is what the chain records. Reporting the signer would
971
+ * name a wallet the chain never held for that order.
972
+ */
973
+ /**
974
+ * How far this widget followed the transaction it is reporting.
975
+ *
976
+ * `submitted` — the wallet handed back a hash. Reported immediately, so
977
+ * attribution survives a payer closing the tab during the wait.
978
+ * `confirmed` — the widget's own receipt check agreed it landed. This is the
979
+ * one fact only the surface can supply: whether the payer was still here when
980
+ * the payment completed, which for an embedded widget is exactly the
981
+ * conversion question its integrator is asking.
982
+ *
983
+ * ⚠️ It is NOT a claim about the chain. The gateway reads the order's real
984
+ * status from its own indexed data either way.
985
+ */
986
+ type SubmissionStage = "submitted" | "confirmed";
987
+
949
988
  interface ResolvedConfig {
950
989
  apiBase: string;
951
990
  getApiKey: () => Promise<string>;
@@ -1027,6 +1066,21 @@ interface ApiClient {
1027
1066
  * direct ERC-20 transfer and a sanctioned counterparty.
1028
1067
  */
1029
1068
  screenWallet: (address: string, chainId?: number) => Promise<WalletScreen>;
1069
+ /**
1070
+ * Tell the gateway this widget sent a transaction. Resolves to whether it was
1071
+ * accepted and **never rejects**.
1072
+ *
1073
+ * ⚠️ OPTIONAL on the type, and deliberately so: a host may hold an engine
1074
+ * built before this existed, and a caller must be able to reach for it
1075
+ * without a payment depending on it being there. See `reportQuietly` in
1076
+ * `useFlow` for the other half of that rule.
1077
+ */
1078
+ reportSubmission?: (report: {
1079
+ txHash: string;
1080
+ chainId: number;
1081
+ wallet: string;
1082
+ stage?: SubmissionStage;
1083
+ }) => Promise<boolean>;
1030
1084
  apiBase: string;
1031
1085
  }
1032
1086
  /** Build an API client bound to a resolved config. The 60s resource cache is per-instance. */
@@ -300,6 +300,15 @@ interface Quote {
300
300
  bridge?: string;
301
301
  feeBps?: number;
302
302
  estimatedDuration?: number;
303
+ /** How long the order should live, in seconds from quote time, for the lane the gateway just
304
+ * priced — derived server-side from this lane's `estimatedDuration`. Absent on a gateway that
305
+ * predates the field, in which case the widget keeps its own flat default. Advisory: the
306
+ * deadline is still the client's to sign, and `orderRequests[].deadline` still comes back "0".
307
+ * See `recommendedDeadlineSeconds` in `core/order.ts`. */
308
+ recommendedDeadlineSeconds?: number;
309
+ /** The same value as an absolute unix second (decimal string). Informational — the widget builds
310
+ * the deadline from the span so it is measured against the signer's own clock. */
311
+ recommendedDeadline?: string;
303
312
  gasCostSource?: string;
304
313
  gasCostDest?: string;
305
314
  /** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
@@ -946,6 +955,36 @@ declare function laneLimitError(limit: LaneLimit, symbol: string): string;
946
955
  * gateway message: that text is untrusted and can carry infrastructure detail. */
947
956
  declare function brokenLaneReason(lane: BrokenLane | undefined): string;
948
957
 
958
+ /**
959
+ * The shapes the gateway would refuse anyway, checked here so a bad value costs
960
+ * no request.
961
+ *
962
+ * ⚠️ A submit transaction has TWO shapes, and accepting only the EVM one would
963
+ * drop the whole Solana family silently: an EVM 32-byte hash in 0x-hex, or a
964
+ * Solana transaction SIGNATURE in base58 (64 bytes ⇒ 86-88 chars). The length
965
+ * floor keeps a signature distinguishable from an ADDRESS (32-44 chars), which
966
+ * shares the alphabet.
967
+ *
968
+ * ⚠️ The WALLET is always the EVM owner, on every family. A Solana-source order
969
+ * is PAID by a Solana wallet but OWNED by an EVM account — that is the cancel
970
+ * and refund path, and it is what the chain records. Reporting the signer would
971
+ * name a wallet the chain never held for that order.
972
+ */
973
+ /**
974
+ * How far this widget followed the transaction it is reporting.
975
+ *
976
+ * `submitted` — the wallet handed back a hash. Reported immediately, so
977
+ * attribution survives a payer closing the tab during the wait.
978
+ * `confirmed` — the widget's own receipt check agreed it landed. This is the
979
+ * one fact only the surface can supply: whether the payer was still here when
980
+ * the payment completed, which for an embedded widget is exactly the
981
+ * conversion question its integrator is asking.
982
+ *
983
+ * ⚠️ It is NOT a claim about the chain. The gateway reads the order's real
984
+ * status from its own indexed data either way.
985
+ */
986
+ type SubmissionStage = "submitted" | "confirmed";
987
+
949
988
  interface ResolvedConfig {
950
989
  apiBase: string;
951
990
  getApiKey: () => Promise<string>;
@@ -1027,6 +1066,21 @@ interface ApiClient {
1027
1066
  * direct ERC-20 transfer and a sanctioned counterparty.
1028
1067
  */
1029
1068
  screenWallet: (address: string, chainId?: number) => Promise<WalletScreen>;
1069
+ /**
1070
+ * Tell the gateway this widget sent a transaction. Resolves to whether it was
1071
+ * accepted and **never rejects**.
1072
+ *
1073
+ * ⚠️ OPTIONAL on the type, and deliberately so: a host may hold an engine
1074
+ * built before this existed, and a caller must be able to reach for it
1075
+ * without a payment depending on it being there. See `reportQuietly` in
1076
+ * `useFlow` for the other half of that rule.
1077
+ */
1078
+ reportSubmission?: (report: {
1079
+ txHash: string;
1080
+ chainId: number;
1081
+ wallet: string;
1082
+ stage?: SubmissionStage;
1083
+ }) => Promise<boolean>;
1030
1084
  apiBase: string;
1031
1085
  }
1032
1086
  /** Build an API client bound to a resolved config. The 60s resource cache is per-instance. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glacislabs/stablegenie-zerodelta",
3
- "version": "4.3.0",
3
+ "version": "4.5.0",
4
4
  "description": "Lightweight embeddable ZeroDelta payment + swap widget (exact-receive Pay and exact-in Swap). Wallet always owns the final signature.",
5
5
  "type": "module",
6
6
  "license": "MIT",