@pafi-dev/issuer 0.5.13 → 0.5.15
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 +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -614,6 +614,29 @@ var RelayService = class {
|
|
|
614
614
|
data: burnCallData
|
|
615
615
|
}
|
|
616
616
|
];
|
|
617
|
+
if (params.feeAmount && params.feeAmount > 0n) {
|
|
618
|
+
if (!params.feeRecipient) {
|
|
619
|
+
throw new RelayError(
|
|
620
|
+
"ENCODE_FAILED",
|
|
621
|
+
"prepareBurn: feeRecipient required when feeAmount > 0"
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
if (params.feeRecipient === "0x0000000000000000000000000000000000000000") {
|
|
625
|
+
throw new RelayError(
|
|
626
|
+
"ENCODE_FAILED",
|
|
627
|
+
"prepareBurn: feeRecipient must not be zero address"
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
operations.push({
|
|
631
|
+
target: params.pointTokenAddress,
|
|
632
|
+
value: 0n,
|
|
633
|
+
data: (0, import_viem3.encodeFunctionData)({
|
|
634
|
+
abi: import_viem3.erc20Abi,
|
|
635
|
+
functionName: "transfer",
|
|
636
|
+
args: [params.feeRecipient, params.feeAmount]
|
|
637
|
+
})
|
|
638
|
+
});
|
|
639
|
+
}
|
|
617
640
|
return (0, import_core2.buildPartialUserOperation)({
|
|
618
641
|
sender: params.userAddress,
|
|
619
642
|
nonce: params.aaNonce,
|
|
@@ -1396,10 +1419,11 @@ var PTRedeemHandler = class {
|
|
|
1396
1419
|
this.pointTokenAddress,
|
|
1397
1420
|
request.userAddress
|
|
1398
1421
|
);
|
|
1399
|
-
|
|
1422
|
+
const totalRequired = request.amount + (request.feeAmount && request.feeAmount > 0n ? request.feeAmount : 0n);
|
|
1423
|
+
if (onChainBalance < totalRequired) {
|
|
1400
1424
|
throw new PTRedeemError(
|
|
1401
1425
|
"INVALID_AMOUNT",
|
|
1402
|
-
`insufficient on-chain PT balance: have ${onChainBalance}, need ${request.amount}`
|
|
1426
|
+
`insufficient on-chain PT balance: have ${onChainBalance}, need ${totalRequired}` + (request.feeAmount && request.feeAmount > 0n ? ` (${request.amount} burn + ${request.feeAmount} fee)` : "")
|
|
1403
1427
|
);
|
|
1404
1428
|
}
|
|
1405
1429
|
const deadline = BigInt(
|
|
@@ -1443,7 +1467,9 @@ var PTRedeemHandler = class {
|
|
|
1443
1467
|
pointTokenAddress: this.pointTokenAddress,
|
|
1444
1468
|
batchExecutorAddress: this.batchExecutorAddress,
|
|
1445
1469
|
burnRequest,
|
|
1446
|
-
burnerSignature
|
|
1470
|
+
burnerSignature,
|
|
1471
|
+
feeAmount: request.feeAmount,
|
|
1472
|
+
feeRecipient: request.feeRecipient
|
|
1447
1473
|
});
|
|
1448
1474
|
return {
|
|
1449
1475
|
lockId,
|