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/dist/index.js CHANGED
@@ -1171,7 +1171,7 @@ var MagicEdenConnector = class extends BaseConnector {
1171
1171
  };
1172
1172
  sendBtcTransaction(sendBtcOptions).catch((e) => reject(e));
1173
1173
  });
1174
- return result;
1174
+ return (result == null ? void 0 : result.txid) || result;
1175
1175
  });
1176
1176
  }
1177
1177
  disconnect() {
@@ -4472,9 +4472,12 @@ function setupWalletButton({
4472
4472
  }, 0);
4473
4473
  }
4474
4474
  });
4475
+ const isNearWallet = !btcWallet;
4476
+ const openImageUrl = `https://assets.deltatrade.ai/wallet-assets/wallet${isNearWallet ? "-near" : ""}-btn.png`;
4477
+ const closeImageUrl = `https://assets.deltatrade.ai/wallet-assets/wallet${isNearWallet ? "-near" : ""}-btn-active.png`;
4475
4478
  const button = createFloatingButtonWithIframe({
4476
- openImageUrl: "https://assets.deltatrade.ai/wallet-assets/wallet-btn.png",
4477
- closeImageUrl: "https://assets.deltatrade.ai/wallet-assets/wallet-btn-active.png",
4479
+ openImageUrl,
4480
+ closeImageUrl,
4478
4481
  iframe
4479
4482
  });
4480
4483
  setupButtonClickHandler(button, iframe, nearWallet, btcWallet);
@@ -5146,12 +5149,20 @@ function setupWalletSelectorModal(selector, options) {
5146
5149
  }
5147
5150
  `;
5148
5151
  }
5152
+ if (group.includes("eth")) {
5153
+ document.head.appendChild(document.createElement("style")).textContent = `
5154
+ #near-wallet-selector-modal .options-list .ethereum-wallets {
5155
+ display: none;
5156
+ }
5157
+ `;
5158
+ }
5149
5159
  const modal = (0, import_ref_modal_ui.setupModal)(selector, options);
5150
5160
  const originalShow = modal.show.bind(modal);
5151
5161
  modal.show = () => __async(this, null, function* () {
5152
- const chain = group.length > 1 && showChainGroups ? yield openChainModal() : group[0];
5153
- if (chain === "btc") {
5154
- const module2 = state.modules.find((module3) => module3.id === "btc-wallet");
5162
+ const chain = group.length > 1 && showChainGroups ? yield openChainModal(group) : group[0];
5163
+ if (["btc", "eth"].includes(chain)) {
5164
+ const moduleId = chain === "btc" ? "btc-wallet" : "ethereum-wallets";
5165
+ const module2 = state.modules.find((module3) => module3.id === moduleId);
5155
5166
  if (module2) {
5156
5167
  const wallet = yield module2.wallet();
5157
5168
  yield wallet.signIn(options);
@@ -5162,15 +5173,20 @@ function setupWalletSelectorModal(selector, options) {
5162
5173
  });
5163
5174
  return modal;
5164
5175
  }
5165
- function openChainModal() {
5176
+ var CHAINS = [
5177
+ { id: "btc", name: "Bitcoin" },
5178
+ { id: "eth", name: "Ethereum" },
5179
+ { id: "near", name: "Near" }
5180
+ ];
5181
+ function openChainModal(group) {
5166
5182
  return __async(this, null, function* () {
5167
- const chains5 = ["btc", "near"];
5183
+ const chains5 = CHAINS.filter((chain) => group.includes(chain.id));
5168
5184
  const content = (resolve, close) => {
5169
5185
  const buttons = `
5170
5186
  <div class="option-list">${chains5.map(
5171
- (chain) => `<button class="chain-button option-item" data-chain="${chain}">
5172
- <img src="https://assets.deltatrade.ai/assets/chain/${chain}.svg" alt="${chain}" style="width:32px; height: 32px;" />
5173
- ${chain.toUpperCase()}
5187
+ (chain) => `<button class="chain-button option-item" data-chain="${chain.id}">
5188
+ <img src="https://assets.deltatrade.ai/assets/chain/${chain.id}.svg" alt="${chain.id}" style="width:32px; height: 32px;" />
5189
+ ${chain.name}
5174
5190
  </button>`
5175
5191
  ).join("")}
5176
5192
  </div>
@@ -5195,10 +5211,15 @@ function openChainModal() {
5195
5211
  }
5196
5212
  function getGroup(state) {
5197
5213
  const hasBtcWallet = state.modules.some((module2) => module2.id === "btc-wallet");
5198
- const hasNearWallet = state.modules.some((module2) => module2.id !== "btc-wallet");
5214
+ const hasEvmWallet = state.modules.some((module2) => module2.id === "ethereum-wallets");
5215
+ const hasNearWallet = state.modules.some(
5216
+ (module2) => module2.id !== "btc-wallet" && module2.id !== "ethereum-wallets"
5217
+ );
5199
5218
  const group = [];
5200
5219
  if (hasBtcWallet)
5201
5220
  group.push("btc");
5221
+ if (hasEvmWallet)
5222
+ group.push("eth");
5202
5223
  if (hasNearWallet)
5203
5224
  group.push("near");
5204
5225
  return group;
@@ -5206,7 +5227,7 @@ function getGroup(state) {
5206
5227
 
5207
5228
  // src/index.ts
5208
5229
  var getVersion = () => {
5209
- return "0.5.59-beta";
5230
+ return "0.5.60-beta";
5210
5231
  };
5211
5232
  if (typeof window !== "undefined") {
5212
5233
  window.__BTC_WALLET_VERSION = getVersion();