@pafi-dev/issuer 0.6.1 → 0.7.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 CHANGED
@@ -2140,14 +2140,19 @@ var PerpDepositHandler = class {
2140
2140
  totalAmount: request.amount,
2141
2141
  maxFee: 0n
2142
2142
  };
2143
- const [relayTokenFee, ptGasFee] = await Promise.all([
2143
+ const [relayTokenFee, usdcGasFee] = await Promise.all([
2144
2144
  this.cfg.provider.readContract({
2145
2145
  address: relayAddress,
2146
2146
  abi: import_core9.ORDERLY_RELAY_ABI,
2147
2147
  functionName: "quoteTokenFee",
2148
2148
  args: [requestForQuote]
2149
2149
  }),
2150
- this.cfg.feeService ? this.cfg.feeService.estimateGasFee() : Promise.resolve(0n)
2150
+ (0, import_core9.quoteOperatorFeeUsdt)({
2151
+ provider: this.cfg.provider,
2152
+ chainId: request.chainId,
2153
+ gasUnits: this.cfg.gasUnits,
2154
+ premiumBps: this.cfg.gasPremiumBps
2155
+ })
2151
2156
  ]);
2152
2157
  if (relayTokenFee >= request.amount) {
2153
2158
  throw new PerpDepositError(
@@ -2155,6 +2160,12 @@ var PerpDepositHandler = class {
2155
2160
  `Relay quoted fee ${relayTokenFee} >= deposit amount ${request.amount}`
2156
2161
  );
2157
2162
  }
2163
+ if (usdcGasFee > 0n && usdcGasFee >= request.amount) {
2164
+ throw new PerpDepositError(
2165
+ "FEE_EXCEEDS_AMOUNT",
2166
+ `USDC gas fee ${usdcGasFee} >= deposit amount ${request.amount}`
2167
+ );
2168
+ }
2158
2169
  const maxFee = relayTokenFee * BigInt(1e4 + this.cfg.maxFeePremiumBps) / 10000n;
2159
2170
  const depositReq = {
2160
2171
  token: usdcAddress,
@@ -2168,11 +2179,10 @@ var PerpDepositHandler = class {
2168
2179
  aaNonce: request.aaNonce,
2169
2180
  relayAddress,
2170
2181
  request: depositReq,
2171
- pointTokenAddress: this.cfg.pointTokenAddress,
2172
- gasFeePt: ptGasFee,
2173
- gasFeePtRecipient: pafiFeeRecipient
2182
+ gasFeeUsdc: usdcGasFee,
2183
+ gasFeeUsdcRecipient: pafiFeeRecipient
2174
2184
  });
2175
- const fallbackOp = ptGasFee > 0n ? (0, import_core9.buildPerpDepositViaRelay)({
2185
+ const fallbackOp = usdcGasFee > 0n ? (0, import_core9.buildPerpDepositViaRelay)({
2176
2186
  userAddress: request.userAddress,
2177
2187
  aaNonce: request.aaNonce,
2178
2188
  relayAddress,
@@ -2181,7 +2191,7 @@ var PerpDepositHandler = class {
2181
2191
  return {
2182
2192
  userOp: sponsoredOp,
2183
2193
  fallback: fallbackOp,
2184
- feeAmount: ptGasFee,
2194
+ feeAmount: usdcGasFee,
2185
2195
  relayTokenFee,
2186
2196
  maxFee,
2187
2197
  netDeposit: request.amount - relayTokenFee,