btc-wallet 0.5.59-beta → 0.5.60-beta

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/esm/index.js CHANGED
@@ -1101,7 +1101,7 @@ var MagicEdenConnector = class extends BaseConnector {
1101
1101
  };
1102
1102
  sendBtcTransaction(sendBtcOptions).catch((e) => reject(e));
1103
1103
  });
1104
- return result;
1104
+ return (result == null ? void 0 : result.txid) || result;
1105
1105
  });
1106
1106
  }
1107
1107
  disconnect() {
@@ -4402,9 +4402,12 @@ function setupWalletButton({
4402
4402
  }, 0);
4403
4403
  }
4404
4404
  });
4405
+ const isNearWallet = !btcWallet;
4406
+ const openImageUrl = `https://assets.deltatrade.ai/wallet-assets/wallet${isNearWallet ? "-near" : ""}-btn.png`;
4407
+ const closeImageUrl = `https://assets.deltatrade.ai/wallet-assets/wallet${isNearWallet ? "-near" : ""}-btn-active.png`;
4405
4408
  const button = createFloatingButtonWithIframe({
4406
- openImageUrl: "https://assets.deltatrade.ai/wallet-assets/wallet-btn.png",
4407
- closeImageUrl: "https://assets.deltatrade.ai/wallet-assets/wallet-btn-active.png",
4409
+ openImageUrl,
4410
+ closeImageUrl,
4408
4411
  iframe
4409
4412
  });
4410
4413
  setupButtonClickHandler(button, iframe, nearWallet, btcWallet);
@@ -5078,12 +5081,20 @@ function setupWalletSelectorModal(selector, options) {
5078
5081
  }
5079
5082
  `;
5080
5083
  }
5084
+ if (group.includes("eth")) {
5085
+ document.head.appendChild(document.createElement("style")).textContent = `
5086
+ #near-wallet-selector-modal .options-list .ethereum-wallets {
5087
+ display: none;
5088
+ }
5089
+ `;
5090
+ }
5081
5091
  const modal = _setupModal(selector, options);
5082
5092
  const originalShow = modal.show.bind(modal);
5083
5093
  modal.show = () => __async(this, null, function* () {
5084
- const chain = group.length > 1 && showChainGroups ? yield openChainModal() : group[0];
5085
- if (chain === "btc") {
5086
- const module = state.modules.find((module2) => module2.id === "btc-wallet");
5094
+ const chain = group.length > 1 && showChainGroups ? yield openChainModal(group) : group[0];
5095
+ if (["btc", "eth"].includes(chain)) {
5096
+ const moduleId = chain === "btc" ? "btc-wallet" : "ethereum-wallets";
5097
+ const module = state.modules.find((module2) => module2.id === moduleId);
5087
5098
  if (module) {
5088
5099
  const wallet = yield module.wallet();
5089
5100
  yield wallet.signIn(options);
@@ -5094,15 +5105,20 @@ function setupWalletSelectorModal(selector, options) {
5094
5105
  });
5095
5106
  return modal;
5096
5107
  }
5097
- function openChainModal() {
5108
+ var CHAINS = [
5109
+ { id: "btc", name: "Bitcoin" },
5110
+ { id: "eth", name: "Ethereum" },
5111
+ { id: "near", name: "Near" }
5112
+ ];
5113
+ function openChainModal(group) {
5098
5114
  return __async(this, null, function* () {
5099
- const chains5 = ["btc", "near"];
5115
+ const chains5 = CHAINS.filter((chain) => group.includes(chain.id));
5100
5116
  const content = (resolve, close) => {
5101
5117
  const buttons = `
5102
5118
  <div class="option-list">${chains5.map(
5103
- (chain) => `<button class="chain-button option-item" data-chain="${chain}">
5104
- <img src="https://assets.deltatrade.ai/assets/chain/${chain}.svg" alt="${chain}" style="width:32px; height: 32px;" />
5105
- ${chain.toUpperCase()}
5119
+ (chain) => `<button class="chain-button option-item" data-chain="${chain.id}">
5120
+ <img src="https://assets.deltatrade.ai/assets/chain/${chain.id}.svg" alt="${chain.id}" style="width:32px; height: 32px;" />
5121
+ ${chain.name}
5106
5122
  </button>`
5107
5123
  ).join("")}
5108
5124
  </div>
@@ -5127,10 +5143,15 @@ function openChainModal() {
5127
5143
  }
5128
5144
  function getGroup(state) {
5129
5145
  const hasBtcWallet = state.modules.some((module) => module.id === "btc-wallet");
5130
- const hasNearWallet = state.modules.some((module) => module.id !== "btc-wallet");
5146
+ const hasEvmWallet = state.modules.some((module) => module.id === "ethereum-wallets");
5147
+ const hasNearWallet = state.modules.some(
5148
+ (module) => module.id !== "btc-wallet" && module.id !== "ethereum-wallets"
5149
+ );
5131
5150
  const group = [];
5132
5151
  if (hasBtcWallet)
5133
5152
  group.push("btc");
5153
+ if (hasEvmWallet)
5154
+ group.push("eth");
5134
5155
  if (hasNearWallet)
5135
5156
  group.push("near");
5136
5157
  return group;
@@ -5138,7 +5159,7 @@ function getGroup(state) {
5138
5159
 
5139
5160
  // src/index.ts
5140
5161
  var getVersion = () => {
5141
- return "0.5.59-beta";
5162
+ return "0.5.60-beta";
5142
5163
  };
5143
5164
  if (typeof window !== "undefined") {
5144
5165
  window.__BTC_WALLET_VERSION = getVersion();