@pafi-dev/issuer 0.9.1 → 0.10.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/index.cjs +34 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +35 -12
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -644,6 +644,19 @@ interface PrepareMintParams {
|
|
|
644
644
|
mintRequestNonce: bigint;
|
|
645
645
|
/** Unix timestamp after which the signature expires. */
|
|
646
646
|
deadline: bigint;
|
|
647
|
+
/**
|
|
648
|
+
* Optional v1.6+ — when set, mint is routed through MintFeeWrapper:
|
|
649
|
+
* - sig.receiver = wrapper address (vs `userAddress` for direct path)
|
|
650
|
+
* - calldata target = wrapper.mintWithFee(pointToken, user, gross, ...)
|
|
651
|
+
* - the wrapper then mints `amount` to itself, splits per recipient list,
|
|
652
|
+
* and forwards net to the user.
|
|
653
|
+
*
|
|
654
|
+
* Leave undefined to keep the v1.5 direct-mint behavior (no fee skim).
|
|
655
|
+
* Wrapper must be registered on the PointToken via
|
|
656
|
+
* `IssuerRegistry.addIssuer` cascade (or owner-only `wrapper.registerToken`)
|
|
657
|
+
* before this path works on-chain.
|
|
658
|
+
*/
|
|
659
|
+
mintFeeWrapperAddress?: Address;
|
|
647
660
|
/**
|
|
648
661
|
* Optional — application-level fee transfer appended after mint.
|
|
649
662
|
* Set both `feeAmount` and `feeRecipient` together.
|
|
@@ -2224,6 +2237,16 @@ interface PTClaimHandlerConfig {
|
|
|
2224
2237
|
/** How far ahead of `now` to set the MintRequest deadline. Default 15 min. */
|
|
2225
2238
|
signatureDeadlineSeconds?: number;
|
|
2226
2239
|
now?: () => number;
|
|
2240
|
+
/**
|
|
2241
|
+
* Optional v1.6+ — when set, mints route through `MintFeeWrapper` so a
|
|
2242
|
+
* fee is skimmed and split per the registered recipient list. Caller
|
|
2243
|
+
* responsibility:
|
|
2244
|
+
* - DAO must have called `IssuerRegistry.setMintFeeWrapper(this address)`
|
|
2245
|
+
* - The PointToken must have been registered (cascaded from
|
|
2246
|
+
* `IssuerRegistry.addIssuer` or owner-only `wrapper.registerToken`)
|
|
2247
|
+
* When unset, claims fall back to direct PointToken.mint (no fee skim).
|
|
2248
|
+
*/
|
|
2249
|
+
mintFeeWrapperAddress?: Address;
|
|
2227
2250
|
}
|
|
2228
2251
|
interface PTClaimRequest {
|
|
2229
2252
|
authenticatedAddress: Address;
|
package/dist/index.d.ts
CHANGED
|
@@ -644,6 +644,19 @@ interface PrepareMintParams {
|
|
|
644
644
|
mintRequestNonce: bigint;
|
|
645
645
|
/** Unix timestamp after which the signature expires. */
|
|
646
646
|
deadline: bigint;
|
|
647
|
+
/**
|
|
648
|
+
* Optional v1.6+ — when set, mint is routed through MintFeeWrapper:
|
|
649
|
+
* - sig.receiver = wrapper address (vs `userAddress` for direct path)
|
|
650
|
+
* - calldata target = wrapper.mintWithFee(pointToken, user, gross, ...)
|
|
651
|
+
* - the wrapper then mints `amount` to itself, splits per recipient list,
|
|
652
|
+
* and forwards net to the user.
|
|
653
|
+
*
|
|
654
|
+
* Leave undefined to keep the v1.5 direct-mint behavior (no fee skim).
|
|
655
|
+
* Wrapper must be registered on the PointToken via
|
|
656
|
+
* `IssuerRegistry.addIssuer` cascade (or owner-only `wrapper.registerToken`)
|
|
657
|
+
* before this path works on-chain.
|
|
658
|
+
*/
|
|
659
|
+
mintFeeWrapperAddress?: Address;
|
|
647
660
|
/**
|
|
648
661
|
* Optional — application-level fee transfer appended after mint.
|
|
649
662
|
* Set both `feeAmount` and `feeRecipient` together.
|
|
@@ -2224,6 +2237,16 @@ interface PTClaimHandlerConfig {
|
|
|
2224
2237
|
/** How far ahead of `now` to set the MintRequest deadline. Default 15 min. */
|
|
2225
2238
|
signatureDeadlineSeconds?: number;
|
|
2226
2239
|
now?: () => number;
|
|
2240
|
+
/**
|
|
2241
|
+
* Optional v1.6+ — when set, mints route through `MintFeeWrapper` so a
|
|
2242
|
+
* fee is skimmed and split per the registered recipient list. Caller
|
|
2243
|
+
* responsibility:
|
|
2244
|
+
* - DAO must have called `IssuerRegistry.setMintFeeWrapper(this address)`
|
|
2245
|
+
* - The PointToken must have been registered (cascaded from
|
|
2246
|
+
* `IssuerRegistry.addIssuer` or owner-only `wrapper.registerToken`)
|
|
2247
|
+
* When unset, claims fall back to direct PointToken.mint (no fee skim).
|
|
2248
|
+
*/
|
|
2249
|
+
mintFeeWrapperAddress?: Address;
|
|
2227
2250
|
}
|
|
2228
2251
|
interface PTClaimRequest {
|
|
2229
2252
|
authenticatedAddress: Address;
|
package/dist/index.js
CHANGED
|
@@ -580,6 +580,7 @@ import {
|
|
|
580
580
|
} from "viem";
|
|
581
581
|
import {
|
|
582
582
|
POINT_TOKEN_V2_ABI,
|
|
583
|
+
mintFeeWrapperAbi,
|
|
583
584
|
buildPartialUserOperation,
|
|
584
585
|
signMintRequest,
|
|
585
586
|
getContractAddresses,
|
|
@@ -666,13 +667,16 @@ var RelayService = class {
|
|
|
666
667
|
"prepareMint: deadline exceeds maximum allowed window (1 hour)"
|
|
667
668
|
);
|
|
668
669
|
}
|
|
670
|
+
const useWrapper = params.mintFeeWrapperAddress !== void 0;
|
|
671
|
+
const receiverForSig = useWrapper ? params.mintFeeWrapperAddress : params.userAddress;
|
|
669
672
|
let minterSig;
|
|
670
673
|
try {
|
|
671
674
|
const sig = await signMintRequest(
|
|
672
675
|
params.issuerSignerWallet,
|
|
673
676
|
params.domain,
|
|
674
677
|
{
|
|
675
|
-
|
|
678
|
+
user: params.userAddress,
|
|
679
|
+
receiver: receiverForSig,
|
|
676
680
|
amount: params.amount,
|
|
677
681
|
nonce: params.mintRequestNonce,
|
|
678
682
|
deadline: params.deadline
|
|
@@ -682,27 +686,44 @@ var RelayService = class {
|
|
|
682
686
|
} catch (err) {
|
|
683
687
|
throw new RelayError(
|
|
684
688
|
"ENCODE_FAILED",
|
|
685
|
-
`prepareMint: failed to sign
|
|
689
|
+
`prepareMint: failed to sign MintForRequest: ${errorMessage(err)}`,
|
|
686
690
|
err
|
|
687
691
|
);
|
|
688
692
|
}
|
|
689
693
|
let mintCallData;
|
|
694
|
+
let mintTarget;
|
|
690
695
|
try {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
+
if (useWrapper) {
|
|
697
|
+
mintCallData = encodeFunctionData({
|
|
698
|
+
abi: mintFeeWrapperAbi,
|
|
699
|
+
functionName: "mintWithFee",
|
|
700
|
+
args: [
|
|
701
|
+
params.pointTokenAddress,
|
|
702
|
+
params.userAddress,
|
|
703
|
+
params.amount,
|
|
704
|
+
params.deadline,
|
|
705
|
+
minterSig
|
|
706
|
+
]
|
|
707
|
+
});
|
|
708
|
+
mintTarget = params.mintFeeWrapperAddress;
|
|
709
|
+
} else {
|
|
710
|
+
mintCallData = encodeFunctionData({
|
|
711
|
+
abi: POINT_TOKEN_V2_ABI,
|
|
712
|
+
functionName: "mint",
|
|
713
|
+
args: [params.userAddress, params.amount, params.deadline, minterSig]
|
|
714
|
+
});
|
|
715
|
+
mintTarget = params.pointTokenAddress;
|
|
716
|
+
}
|
|
696
717
|
} catch (err) {
|
|
697
718
|
throw new RelayError(
|
|
698
719
|
"ENCODE_FAILED",
|
|
699
|
-
`prepareMint: failed to encode
|
|
720
|
+
`prepareMint: failed to encode mint call: ${errorMessage(err)}`,
|
|
700
721
|
err
|
|
701
722
|
);
|
|
702
723
|
}
|
|
703
724
|
const operations = [
|
|
704
725
|
{
|
|
705
|
-
target:
|
|
726
|
+
target: mintTarget,
|
|
706
727
|
value: 0n,
|
|
707
728
|
data: mintCallData
|
|
708
729
|
}
|
|
@@ -2425,7 +2446,8 @@ var PTClaimHandler = class {
|
|
|
2425
2446
|
issuerSignerWallet: this.cfg.issuerSignerWallet,
|
|
2426
2447
|
domain,
|
|
2427
2448
|
mintRequestNonce: request.mintRequestNonce,
|
|
2428
|
-
deadline: signatureDeadline
|
|
2449
|
+
deadline: signatureDeadline,
|
|
2450
|
+
mintFeeWrapperAddress: this.cfg.mintFeeWrapperAddress
|
|
2429
2451
|
// No feeAmount/feeRecipient — RelayService auto-resolves.
|
|
2430
2452
|
});
|
|
2431
2453
|
} catch (err) {
|
|
@@ -2447,7 +2469,8 @@ var PTClaimHandler = class {
|
|
|
2447
2469
|
domain,
|
|
2448
2470
|
mintRequestNonce: request.mintRequestNonce,
|
|
2449
2471
|
deadline: signatureDeadline,
|
|
2450
|
-
feeAmount: 0n
|
|
2472
|
+
feeAmount: 0n,
|
|
2473
|
+
mintFeeWrapperAddress: this.cfg.mintFeeWrapperAddress
|
|
2451
2474
|
});
|
|
2452
2475
|
} catch (err) {
|
|
2453
2476
|
throw new PTClaimError(
|
|
@@ -4391,7 +4414,7 @@ var MemoryRedemptionHistoryStore = class {
|
|
|
4391
4414
|
};
|
|
4392
4415
|
|
|
4393
4416
|
// src/index.ts
|
|
4394
|
-
var PAFI_ISSUER_SDK_VERSION = true ? "0.
|
|
4417
|
+
var PAFI_ISSUER_SDK_VERSION = true ? "0.10.1" : "dev";
|
|
4395
4418
|
export {
|
|
4396
4419
|
AdapterMisconfiguredError,
|
|
4397
4420
|
AuthError,
|