@pafi-dev/issuer 0.9.1 → 0.10.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.
- package/dist/index.cjs +30 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +31 -10
- 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.
|
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.
|
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
|
}
|
|
@@ -4391,7 +4412,7 @@ var MemoryRedemptionHistoryStore = class {
|
|
|
4391
4412
|
};
|
|
4392
4413
|
|
|
4393
4414
|
// src/index.ts
|
|
4394
|
-
var PAFI_ISSUER_SDK_VERSION = true ? "0.
|
|
4415
|
+
var PAFI_ISSUER_SDK_VERSION = true ? "0.10.0" : "dev";
|
|
4395
4416
|
export {
|
|
4396
4417
|
AdapterMisconfiguredError,
|
|
4397
4418
|
AuthError,
|