btc-wallet 0.5.74-beta → 0.5.76-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
@@ -5123,12 +5123,14 @@ function setupWalletSelectorModal(selector, options) {
5123
5123
  const {
5124
5124
  showChainGroups = true,
5125
5125
  showWalletUIForNearAccount = true,
5126
+ hideWalletUIForNearWallets = ["meteor-wallet-app"],
5126
5127
  env = "mainnet",
5127
5128
  walletUrl,
5128
5129
  draggable = true,
5129
5130
  initialPosition = { right: "20px", bottom: "20px" },
5130
5131
  buttonSize = "60px",
5131
- mobileButtonSize = "40px"
5132
+ mobileButtonSize = "40px",
5133
+ customGroups = []
5132
5134
  } = options;
5133
5135
  subscription == null ? void 0 : subscription.unsubscribe();
5134
5136
  const state = selector.store.getState();
@@ -5137,8 +5139,9 @@ function setupWalletSelectorModal(selector, options) {
5137
5139
  const walletId = state2.selectedWalletId;
5138
5140
  window.enableCustomWalletSelectorModal = true;
5139
5141
  console.log("setupWalletSelectorModal walletId", walletId);
5142
+ const showWalletUI = walletId && (walletId === "btc-wallet" || showWalletUIForNearAccount && !hideWalletUIForNearWallets.includes(walletId));
5140
5143
  removeWalletButton();
5141
- if (walletId === "btc-wallet" || showWalletUIForNearAccount) {
5144
+ if (showWalletUI) {
5142
5145
  selector.wallet().then((wallet) => {
5143
5146
  setupWalletButton({
5144
5147
  env,
@@ -5170,7 +5173,7 @@ function setupWalletSelectorModal(selector, options) {
5170
5173
  const modal = _setupModal(selector, options);
5171
5174
  const originalShow = modal.show.bind(modal);
5172
5175
  modal.show = () => __async(this, null, function* () {
5173
- const chain = group.length > 1 && showChainGroups ? yield openChainModal(group) : group[0];
5176
+ const chain = group.length > 1 && showChainGroups ? yield openChainModal(group, customGroups) : group[0];
5174
5177
  if (["btc", "eth"].includes(chain)) {
5175
5178
  const moduleId = chain === "btc" ? "btc-wallet" : "ethereum-wallets";
5176
5179
  const module = state.modules.find((module2) => module2.id === moduleId);
@@ -5180,6 +5183,11 @@ function setupWalletSelectorModal(selector, options) {
5180
5183
  }
5181
5184
  } else if (chain === "near") {
5182
5185
  originalShow();
5186
+ } else {
5187
+ const customGroup = customGroups.find((g) => g.id === chain);
5188
+ if (customGroup == null ? void 0 : customGroup.onClick) {
5189
+ yield customGroup.onClick(customGroup);
5190
+ }
5183
5191
  }
5184
5192
  });
5185
5193
  return modal;
@@ -5189,17 +5197,18 @@ var CHAINS = [
5189
5197
  { id: "eth", name: "Ethereum", description: "EVM address as Near Account" },
5190
5198
  { id: "btc", name: "Bitcoin", description: "MPC Mapping" }
5191
5199
  ];
5192
- function openChainModal(group) {
5193
- return __async(this, null, function* () {
5200
+ function openChainModal(_0) {
5201
+ return __async(this, arguments, function* (group, customGroups = []) {
5194
5202
  const chains5 = CHAINS.filter((chain) => group.includes(chain.id));
5203
+ const allGroups = [...chains5, ...customGroups];
5195
5204
  const content = (resolve, close) => {
5196
5205
  const buttons = `
5197
- <div class="option-list">${chains5.map(
5198
- (chain) => `<button class="chain-button option-item" data-chain="${chain.id}">
5199
- <img src="https://assets.deltatrade.ai/assets/chain/${chain.id}.svg" alt="${chain.id}" style="width:32px; height: 32px;" />
5206
+ <div class="option-list">${allGroups.map(
5207
+ (item) => `<button class="chain-button option-item" data-chain="${item.id}">
5208
+ <img src="https://assets.deltatrade.ai/assets/chain/${item.id}.svg" alt="${item.id}" style="width:32px; height: 32px;" />
5200
5209
  <div style="display: flex; flex-direction: column; text-align: left;">
5201
- <div style="font-size: 16px; font-weight: bold;">${chain.name}</div>
5202
- <div style="font-size: 12px; opacity:0.5;">${chain.description}</div>
5210
+ <div style="font-size: 16px; font-weight: bold;">${item.name}</div>
5211
+ <div style="font-size: 12px; opacity:0.5;">${item.description}</div>
5203
5212
  </div>
5204
5213
  </button>`
5205
5214
  ).join("")}
@@ -5241,7 +5250,7 @@ function getGroup(state) {
5241
5250
 
5242
5251
  // src/index.ts
5243
5252
  var getVersion = () => {
5244
- return "0.5.74-beta";
5253
+ return "0.5.76-beta";
5245
5254
  };
5246
5255
  if (typeof window !== "undefined") {
5247
5256
  window.__BTC_WALLET_VERSION = getVersion();