@pafi-dev/issuer 0.5.41 → 0.5.42
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/index.cjs +38 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2457,13 +2457,13 @@ interface IssuerApiAdapterConfig {
|
|
|
2457
2457
|
/** Optional issuer id — when omitted, sponsorAuth is skipped (returns `undefined`). */
|
|
2458
2458
|
pafiIssuerId?: string;
|
|
2459
2459
|
/** Sig-gated mint handler. Required for `claim` / `claimPrepare`. */
|
|
2460
|
-
ptClaimHandler
|
|
2460
|
+
ptClaimHandler?: PTClaimHandler | null;
|
|
2461
2461
|
/** Reverse-flow handler. Required for `redeem` / `redeemPrepare`. */
|
|
2462
2462
|
ptRedeemHandler?: PTRedeemHandler | null;
|
|
2463
2463
|
/** PT → USDT swap handler. Required for `swap`. */
|
|
2464
|
-
swapHandler
|
|
2464
|
+
swapHandler?: SwapHandler | null;
|
|
2465
2465
|
/** Orderly perp-deposit handler. Required for `perpDeposit`. */
|
|
2466
|
-
perpHandler
|
|
2466
|
+
perpHandler?: PerpDepositHandler | null;
|
|
2467
2467
|
/** Pending UserOp store — required for mobile prepare/submit. */
|
|
2468
2468
|
pendingUserOpStore: IPendingUserOpStore;
|
|
2469
2469
|
/** PAFI backend client — required for mobile submit + delegate submit + status fallback. */
|
|
@@ -2661,6 +2661,13 @@ declare class IssuerApiAdapter {
|
|
|
2661
2661
|
private buildSponsorAuth;
|
|
2662
2662
|
private runMobilePrepare;
|
|
2663
2663
|
private assertRedeemHandler;
|
|
2664
|
+
/**
|
|
2665
|
+
* Narrow an optional handler to non-null and throw a clear error when
|
|
2666
|
+
* the issuer wired the adapter without it. Lets issuers opt out of
|
|
2667
|
+
* flows they don't expose (gg56 ships only mobile claim/redeem, so
|
|
2668
|
+
* `swapHandler` + `perpHandler` aren't constructed).
|
|
2669
|
+
*/
|
|
2670
|
+
private assertHandler;
|
|
2664
2671
|
}
|
|
2665
2672
|
|
|
2666
2673
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -2457,13 +2457,13 @@ interface IssuerApiAdapterConfig {
|
|
|
2457
2457
|
/** Optional issuer id — when omitted, sponsorAuth is skipped (returns `undefined`). */
|
|
2458
2458
|
pafiIssuerId?: string;
|
|
2459
2459
|
/** Sig-gated mint handler. Required for `claim` / `claimPrepare`. */
|
|
2460
|
-
ptClaimHandler
|
|
2460
|
+
ptClaimHandler?: PTClaimHandler | null;
|
|
2461
2461
|
/** Reverse-flow handler. Required for `redeem` / `redeemPrepare`. */
|
|
2462
2462
|
ptRedeemHandler?: PTRedeemHandler | null;
|
|
2463
2463
|
/** PT → USDT swap handler. Required for `swap`. */
|
|
2464
|
-
swapHandler
|
|
2464
|
+
swapHandler?: SwapHandler | null;
|
|
2465
2465
|
/** Orderly perp-deposit handler. Required for `perpDeposit`. */
|
|
2466
|
-
perpHandler
|
|
2466
|
+
perpHandler?: PerpDepositHandler | null;
|
|
2467
2467
|
/** Pending UserOp store — required for mobile prepare/submit. */
|
|
2468
2468
|
pendingUserOpStore: IPendingUserOpStore;
|
|
2469
2469
|
/** PAFI backend client — required for mobile submit + delegate submit + status fallback. */
|
|
@@ -2661,6 +2661,13 @@ declare class IssuerApiAdapter {
|
|
|
2661
2661
|
private buildSponsorAuth;
|
|
2662
2662
|
private runMobilePrepare;
|
|
2663
2663
|
private assertRedeemHandler;
|
|
2664
|
+
/**
|
|
2665
|
+
* Narrow an optional handler to non-null and throw a clear error when
|
|
2666
|
+
* the issuer wired the adapter without it. Lets issuers opt out of
|
|
2667
|
+
* flows they don't expose (gg56 ships only mobile claim/redeem, so
|
|
2668
|
+
* `swapHandler` + `perpHandler` aren't constructed).
|
|
2669
|
+
*/
|
|
2670
|
+
private assertHandler;
|
|
2664
2671
|
}
|
|
2665
2672
|
|
|
2666
2673
|
/**
|
package/dist/index.js
CHANGED
|
@@ -2677,8 +2677,13 @@ var IssuerApiAdapter = class {
|
|
|
2677
2677
|
}
|
|
2678
2678
|
// ------------------------------ Action endpoints -------------------------
|
|
2679
2679
|
async claim(input) {
|
|
2680
|
+
const ptClaimHandler = this.assertHandler(
|
|
2681
|
+
this.cfg.ptClaimHandler,
|
|
2682
|
+
"ptClaimHandler",
|
|
2683
|
+
"claim"
|
|
2684
|
+
);
|
|
2680
2685
|
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
2681
|
-
const result = await
|
|
2686
|
+
const result = await ptClaimHandler.handle({
|
|
2682
2687
|
authenticatedAddress: input.authenticatedAddress,
|
|
2683
2688
|
userAddress: input.authenticatedAddress,
|
|
2684
2689
|
amount: input.amount,
|
|
@@ -2731,7 +2736,12 @@ var IssuerApiAdapter = class {
|
|
|
2731
2736
|
};
|
|
2732
2737
|
}
|
|
2733
2738
|
async swap(input) {
|
|
2734
|
-
const
|
|
2739
|
+
const swapHandler = this.assertHandler(
|
|
2740
|
+
this.cfg.swapHandler,
|
|
2741
|
+
"swapHandler",
|
|
2742
|
+
"swap"
|
|
2743
|
+
);
|
|
2744
|
+
const result = await swapHandler.handle({
|
|
2735
2745
|
userAddress: input.authenticatedAddress,
|
|
2736
2746
|
chainId: input.chainId,
|
|
2737
2747
|
pointTokenAddress: getAddress10(input.pointTokenAddress),
|
|
@@ -2758,7 +2768,12 @@ var IssuerApiAdapter = class {
|
|
|
2758
2768
|
};
|
|
2759
2769
|
}
|
|
2760
2770
|
async perpDeposit(input) {
|
|
2761
|
-
const
|
|
2771
|
+
const perpHandler = this.assertHandler(
|
|
2772
|
+
this.cfg.perpHandler,
|
|
2773
|
+
"perpHandler",
|
|
2774
|
+
"perpDeposit"
|
|
2775
|
+
);
|
|
2776
|
+
const result = await perpHandler.handle({
|
|
2762
2777
|
userAddress: input.authenticatedAddress,
|
|
2763
2778
|
chainId: input.chainId,
|
|
2764
2779
|
amount: input.amount,
|
|
@@ -2787,8 +2802,13 @@ var IssuerApiAdapter = class {
|
|
|
2787
2802
|
}
|
|
2788
2803
|
// ------------------------------ Mobile endpoints -------------------------
|
|
2789
2804
|
async claimPrepare(input) {
|
|
2805
|
+
const ptClaimHandler = this.assertHandler(
|
|
2806
|
+
this.cfg.ptClaimHandler,
|
|
2807
|
+
"ptClaimHandler",
|
|
2808
|
+
"claimPrepare"
|
|
2809
|
+
);
|
|
2790
2810
|
const pointTokenAddress = getAddress10(input.pointTokenAddress);
|
|
2791
|
-
const claimResult = await
|
|
2811
|
+
const claimResult = await ptClaimHandler.handle({
|
|
2792
2812
|
authenticatedAddress: input.authenticatedAddress,
|
|
2793
2813
|
userAddress: input.authenticatedAddress,
|
|
2794
2814
|
amount: input.amount,
|
|
@@ -2978,6 +2998,20 @@ var IssuerApiAdapter = class {
|
|
|
2978
2998
|
);
|
|
2979
2999
|
}
|
|
2980
3000
|
}
|
|
3001
|
+
/**
|
|
3002
|
+
* Narrow an optional handler to non-null and throw a clear error when
|
|
3003
|
+
* the issuer wired the adapter without it. Lets issuers opt out of
|
|
3004
|
+
* flows they don't expose (gg56 ships only mobile claim/redeem, so
|
|
3005
|
+
* `swapHandler` + `perpHandler` aren't constructed).
|
|
3006
|
+
*/
|
|
3007
|
+
assertHandler(handler, fieldName, methodName) {
|
|
3008
|
+
if (handler === null || handler === void 0) {
|
|
3009
|
+
throw new Error(
|
|
3010
|
+
`${fieldName} not wired \u2014 IssuerApiAdapter.${methodName}() requires a configured ${fieldName}.`
|
|
3011
|
+
);
|
|
3012
|
+
}
|
|
3013
|
+
return handler;
|
|
3014
|
+
}
|
|
2981
3015
|
};
|
|
2982
3016
|
|
|
2983
3017
|
// src/pools/subgraphPoolsProvider.ts
|