@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.cjs
CHANGED
|
@@ -2695,8 +2695,13 @@ var IssuerApiAdapter = class {
|
|
|
2695
2695
|
}
|
|
2696
2696
|
// ------------------------------ Action endpoints -------------------------
|
|
2697
2697
|
async claim(input) {
|
|
2698
|
+
const ptClaimHandler = this.assertHandler(
|
|
2699
|
+
this.cfg.ptClaimHandler,
|
|
2700
|
+
"ptClaimHandler",
|
|
2701
|
+
"claim"
|
|
2702
|
+
);
|
|
2698
2703
|
const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
|
|
2699
|
-
const result = await
|
|
2704
|
+
const result = await ptClaimHandler.handle({
|
|
2700
2705
|
authenticatedAddress: input.authenticatedAddress,
|
|
2701
2706
|
userAddress: input.authenticatedAddress,
|
|
2702
2707
|
amount: input.amount,
|
|
@@ -2749,7 +2754,12 @@ var IssuerApiAdapter = class {
|
|
|
2749
2754
|
};
|
|
2750
2755
|
}
|
|
2751
2756
|
async swap(input) {
|
|
2752
|
-
const
|
|
2757
|
+
const swapHandler = this.assertHandler(
|
|
2758
|
+
this.cfg.swapHandler,
|
|
2759
|
+
"swapHandler",
|
|
2760
|
+
"swap"
|
|
2761
|
+
);
|
|
2762
|
+
const result = await swapHandler.handle({
|
|
2753
2763
|
userAddress: input.authenticatedAddress,
|
|
2754
2764
|
chainId: input.chainId,
|
|
2755
2765
|
pointTokenAddress: (0, import_viem11.getAddress)(input.pointTokenAddress),
|
|
@@ -2776,7 +2786,12 @@ var IssuerApiAdapter = class {
|
|
|
2776
2786
|
};
|
|
2777
2787
|
}
|
|
2778
2788
|
async perpDeposit(input) {
|
|
2779
|
-
const
|
|
2789
|
+
const perpHandler = this.assertHandler(
|
|
2790
|
+
this.cfg.perpHandler,
|
|
2791
|
+
"perpHandler",
|
|
2792
|
+
"perpDeposit"
|
|
2793
|
+
);
|
|
2794
|
+
const result = await perpHandler.handle({
|
|
2780
2795
|
userAddress: input.authenticatedAddress,
|
|
2781
2796
|
chainId: input.chainId,
|
|
2782
2797
|
amount: input.amount,
|
|
@@ -2805,8 +2820,13 @@ var IssuerApiAdapter = class {
|
|
|
2805
2820
|
}
|
|
2806
2821
|
// ------------------------------ Mobile endpoints -------------------------
|
|
2807
2822
|
async claimPrepare(input) {
|
|
2823
|
+
const ptClaimHandler = this.assertHandler(
|
|
2824
|
+
this.cfg.ptClaimHandler,
|
|
2825
|
+
"ptClaimHandler",
|
|
2826
|
+
"claimPrepare"
|
|
2827
|
+
);
|
|
2808
2828
|
const pointTokenAddress = (0, import_viem11.getAddress)(input.pointTokenAddress);
|
|
2809
|
-
const claimResult = await
|
|
2829
|
+
const claimResult = await ptClaimHandler.handle({
|
|
2810
2830
|
authenticatedAddress: input.authenticatedAddress,
|
|
2811
2831
|
userAddress: input.authenticatedAddress,
|
|
2812
2832
|
amount: input.amount,
|
|
@@ -2996,6 +3016,20 @@ var IssuerApiAdapter = class {
|
|
|
2996
3016
|
);
|
|
2997
3017
|
}
|
|
2998
3018
|
}
|
|
3019
|
+
/**
|
|
3020
|
+
* Narrow an optional handler to non-null and throw a clear error when
|
|
3021
|
+
* the issuer wired the adapter without it. Lets issuers opt out of
|
|
3022
|
+
* flows they don't expose (gg56 ships only mobile claim/redeem, so
|
|
3023
|
+
* `swapHandler` + `perpHandler` aren't constructed).
|
|
3024
|
+
*/
|
|
3025
|
+
assertHandler(handler, fieldName, methodName) {
|
|
3026
|
+
if (handler === null || handler === void 0) {
|
|
3027
|
+
throw new Error(
|
|
3028
|
+
`${fieldName} not wired \u2014 IssuerApiAdapter.${methodName}() requires a configured ${fieldName}.`
|
|
3029
|
+
);
|
|
3030
|
+
}
|
|
3031
|
+
return handler;
|
|
3032
|
+
}
|
|
2999
3033
|
};
|
|
3000
3034
|
|
|
3001
3035
|
// src/pools/subgraphPoolsProvider.ts
|