@coti-io/coti-wallet-plugin 0.2.5 → 0.2.7

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.d.mts CHANGED
@@ -568,8 +568,12 @@ type PortalFeeQuote = {
568
568
  declare const getPodGasPrice: (provider: ethers.BrowserProvider | ethers.JsonRpcProvider | ethers.Provider) => Promise<bigint>;
569
569
  /**
570
570
  * Gas price for PoD inbox fee estimation and tx send.
571
- * Uses `getFeeData().gasPrice` when available, with a 10% buffer so estimate
572
- * and `tx.gasprice` stay aligned per pod-sdk inbox rules.
571
+ * Uses `eth_gasPrice` only (with a 10% buffer) so estimate and `tx.gasprice`
572
+ * stay aligned per pod-sdk inbox rules.
573
+ *
574
+ * Avoids `provider.getFeeData()` — ethers maps that to
575
+ * `eth_maxPriorityFeePerGas`, which MetaMask rejects (-32601) on the injected
576
+ * provider even when the chain RPC supports the method.
573
577
  */
574
578
  declare const resolvePodTxGasPrice: (provider: ethers.BrowserProvider | ethers.JsonRpcProvider | ethers.Provider) => Promise<bigint>;
575
579
  /** @deprecated Use {@link resolvePodTxGasPrice}. */
package/dist/index.d.ts CHANGED
@@ -568,8 +568,12 @@ type PortalFeeQuote = {
568
568
  declare const getPodGasPrice: (provider: ethers.BrowserProvider | ethers.JsonRpcProvider | ethers.Provider) => Promise<bigint>;
569
569
  /**
570
570
  * Gas price for PoD inbox fee estimation and tx send.
571
- * Uses `getFeeData().gasPrice` when available, with a 10% buffer so estimate
572
- * and `tx.gasprice` stay aligned per pod-sdk inbox rules.
571
+ * Uses `eth_gasPrice` only (with a 10% buffer) so estimate and `tx.gasprice`
572
+ * stay aligned per pod-sdk inbox rules.
573
+ *
574
+ * Avoids `provider.getFeeData()` — ethers maps that to
575
+ * `eth_maxPriorityFeePerGas`, which MetaMask rejects (-32601) on the injected
576
+ * provider even when the chain RPC supports the method.
573
577
  */
574
578
  declare const resolvePodTxGasPrice: (provider: ethers.BrowserProvider | ethers.JsonRpcProvider | ethers.Provider) => Promise<bigint>;
575
579
  /** @deprecated Use {@link resolvePodTxGasPrice}. */
package/dist/index.js CHANGED
@@ -1541,13 +1541,7 @@ var init_podPortalFees = __esm({
1541
1541
  return BigInt(gasPriceHex);
1542
1542
  };
1543
1543
  resolvePodTxGasPrice = async (provider) => {
1544
- let base;
1545
- try {
1546
- const feeData = await provider.getFeeData();
1547
- base = feeData.gasPrice ?? await getPodGasPrice(provider);
1548
- } catch {
1549
- base = await getPodGasPrice(provider);
1550
- }
1544
+ const base = await getPodGasPrice(provider);
1551
1545
  return base * POD_GAS_PRICE_BUFFER_BPS / 1000n;
1552
1546
  };
1553
1547
  getSepoliaGasPrice = resolvePodTxGasPrice;
@@ -1733,8 +1727,8 @@ var init_podPortalFees = __esm({
1733
1727
  let supportsEip1559 = false;
1734
1728
  if (provider) {
1735
1729
  try {
1736
- const feeData = await provider.getFeeData();
1737
- supportsEip1559 = feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null;
1730
+ const block = await provider.getBlock("latest");
1731
+ supportsEip1559 = block?.baseFeePerGas != null;
1738
1732
  } catch {
1739
1733
  supportsEip1559 = false;
1740
1734
  }
@@ -6500,9 +6494,14 @@ var usePrivacyBridgeAllowance = ({
6500
6494
  }]
6501
6495
  });
6502
6496
  logger.log("\u{1F510} [Approve] Tx submitted, waiting for confirmation", { txHash: shortHash(rawTxHash) });
6503
- await waitForTransactionResilient(currentChainId, rawTxHash, {
6497
+ const receipt2 = await waitForTransactionResilient(currentChainId, rawTxHash, {
6504
6498
  primary: provider
6505
6499
  });
6500
+ if (!receipt2 || receipt2.status !== 1) {
6501
+ const failed = new Error("Approval transaction failed");
6502
+ failed.txHash = typeof rawTxHash === "string" ? rawTxHash : receipt2?.hash;
6503
+ throw failed;
6504
+ }
6506
6505
  logger.log("\u{1F510} [Approve] Tx confirmed, refreshing allowance...");
6507
6506
  setIsApproving(false);
6508
6507
  setToastState((prev) => ({ ...prev, visible: false }));
@@ -6519,9 +6518,14 @@ var usePrivacyBridgeAllowance = ({
6519
6518
  title: "Approving...",
6520
6519
  message: "Waiting for allowance confirmation..."
6521
6520
  });
6522
- await waitForTransactionResilient(currentChainId, tx.hash, {
6521
+ const receipt = await waitForTransactionResilient(currentChainId, tx.hash, {
6523
6522
  primary: provider
6524
6523
  });
6524
+ if (!receipt || receipt.status !== 1) {
6525
+ const failed = new Error("Approval transaction failed");
6526
+ failed.txHash = tx.hash || receipt?.hash;
6527
+ throw failed;
6528
+ }
6525
6529
  await checkAllowance();
6526
6530
  setIsApproving(false);
6527
6531
  setToastState((prev) => ({ ...prev, visible: false }));