@nibgate/sdk 0.2.26 → 0.2.27

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/nibgate.js CHANGED
@@ -27505,20 +27505,19 @@ ${prettyStateOverride(stateOverride)}`;
27505
27505
  document.removeEventListener("touchend", cancelHold);
27506
27506
  };
27507
27507
  card.addEventListener("remove", cleanup);
27508
- const ARC_RPC = "https://arc-testnet.drpc.org";
27509
- const GATEWAY_WALLET = "0x0077777d7EBA4688BDeF3E311b846F25870A19B9";
27510
- const USDC_ADDRESS = "0x3600000000000000000000000000000000000000";
27511
27508
  async function fetchBalance(addr) {
27512
- const sel = "0xdd62e1c6";
27513
- const pad4 = (a) => "000000000000000000000000" + a.slice(2).toLowerCase();
27514
- const data = sel + pad4(USDC_ADDRESS) + pad4(addr);
27515
- const r = await fetch(ARC_RPC, {
27516
- method: "POST",
27517
- headers: { "Content-Type": "application/json" },
27518
- body: JSON.stringify({ jsonrpc: "2.0", method: "eth_call", params: [{ to: GATEWAY_WALLET, data }, "latest"], id: 1 })
27519
- });
27520
- const j = await r.json();
27521
- return j?.result ? (Number(BigInt(j.result)) / 1e6).toFixed(2) + " USDC" : "\u2014";
27509
+ try {
27510
+ const sel = "0xdd62e1c6";
27511
+ const pad4 = (a) => "000000000000000000000000" + a.slice(2).toLowerCase();
27512
+ const data = sel + pad4("0x3600000000000000000000000000000000000000") + pad4(addr);
27513
+ const hex = await window.ethereum.request({
27514
+ method: "eth_call",
27515
+ params: [{ to: "0x0077777d7EBA4688BDeF3E311b846F25870A19B9", data }, "latest"]
27516
+ });
27517
+ return hex && hex !== "0x" ? (Number(BigInt(hex)) / 1e6).toFixed(2) + " USDC" : "0.00 USDC";
27518
+ } catch {
27519
+ return "\u2014";
27520
+ }
27522
27521
  }
27523
27522
  let balEl = null, gwOverlay = null, balTimer = null;
27524
27523
  function depIcon() {