btc-wallet 0.5.75-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/dist/core/setupModal.d.ts +7 -0
- package/dist/index.js +17 -10
- package/dist/index.js.map +2 -2
- package/esm/index.js +17 -10
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
@@ -1,6 +1,12 @@
|
|
1
1
|
import { type WalletSelectorModal as _WalletSelectorModal, type ModalOptions as _ModalOptions } from 'ref-modal-ui';
|
2
2
|
import type { WalletSelector } from '@near-wallet-selector/core';
|
3
3
|
import { ENV } from '../config';
|
4
|
+
export interface CustomGroup {
|
5
|
+
id: string;
|
6
|
+
name: string;
|
7
|
+
description: string;
|
8
|
+
onClick?: (group: CustomGroup) => void | Promise<void>;
|
9
|
+
}
|
4
10
|
export interface WalletSelectorModalOptions extends _ModalOptions {
|
5
11
|
showChainGroups?: boolean;
|
6
12
|
showWalletUIForNearAccount?: boolean;
|
@@ -14,6 +20,7 @@ export interface WalletSelectorModalOptions extends _ModalOptions {
|
|
14
20
|
};
|
15
21
|
buttonSize?: string;
|
16
22
|
mobileButtonSize?: string;
|
23
|
+
customGroups?: CustomGroup[];
|
17
24
|
}
|
18
25
|
export type WalletSelectorModal = _WalletSelectorModal;
|
19
26
|
declare global {
|
package/dist/index.js
CHANGED
@@ -5199,7 +5199,8 @@ function setupWalletSelectorModal(selector, options) {
|
|
5199
5199
|
draggable = true,
|
5200
5200
|
initialPosition = { right: "20px", bottom: "20px" },
|
5201
5201
|
buttonSize = "60px",
|
5202
|
-
mobileButtonSize = "40px"
|
5202
|
+
mobileButtonSize = "40px",
|
5203
|
+
customGroups = []
|
5203
5204
|
} = options;
|
5204
5205
|
subscription == null ? void 0 : subscription.unsubscribe();
|
5205
5206
|
const state = selector.store.getState();
|
@@ -5242,7 +5243,7 @@ function setupWalletSelectorModal(selector, options) {
|
|
5242
5243
|
const modal = (0, import_ref_modal_ui.setupModal)(selector, options);
|
5243
5244
|
const originalShow = modal.show.bind(modal);
|
5244
5245
|
modal.show = () => __async(this, null, function* () {
|
5245
|
-
const chain = group.length > 1 && showChainGroups ? yield openChainModal(group) : group[0];
|
5246
|
+
const chain = group.length > 1 && showChainGroups ? yield openChainModal(group, customGroups) : group[0];
|
5246
5247
|
if (["btc", "eth"].includes(chain)) {
|
5247
5248
|
const moduleId = chain === "btc" ? "btc-wallet" : "ethereum-wallets";
|
5248
5249
|
const module2 = state.modules.find((module3) => module3.id === moduleId);
|
@@ -5252,6 +5253,11 @@ function setupWalletSelectorModal(selector, options) {
|
|
5252
5253
|
}
|
5253
5254
|
} else if (chain === "near") {
|
5254
5255
|
originalShow();
|
5256
|
+
} else {
|
5257
|
+
const customGroup = customGroups.find((g) => g.id === chain);
|
5258
|
+
if (customGroup == null ? void 0 : customGroup.onClick) {
|
5259
|
+
yield customGroup.onClick(customGroup);
|
5260
|
+
}
|
5255
5261
|
}
|
5256
5262
|
});
|
5257
5263
|
return modal;
|
@@ -5261,17 +5267,18 @@ var CHAINS = [
|
|
5261
5267
|
{ id: "eth", name: "Ethereum", description: "EVM address as Near Account" },
|
5262
5268
|
{ id: "btc", name: "Bitcoin", description: "MPC Mapping" }
|
5263
5269
|
];
|
5264
|
-
function openChainModal(
|
5265
|
-
return __async(this,
|
5270
|
+
function openChainModal(_0) {
|
5271
|
+
return __async(this, arguments, function* (group, customGroups = []) {
|
5266
5272
|
const chains5 = CHAINS.filter((chain) => group.includes(chain.id));
|
5273
|
+
const allGroups = [...chains5, ...customGroups];
|
5267
5274
|
const content = (resolve, close) => {
|
5268
5275
|
const buttons = `
|
5269
|
-
<div class="option-list">${
|
5270
|
-
(
|
5271
|
-
<img src="https://assets.deltatrade.ai/assets/chain/${
|
5276
|
+
<div class="option-list">${allGroups.map(
|
5277
|
+
(item) => `<button class="chain-button option-item" data-chain="${item.id}">
|
5278
|
+
<img src="https://assets.deltatrade.ai/assets/chain/${item.id}.svg" alt="${item.id}" style="width:32px; height: 32px;" />
|
5272
5279
|
<div style="display: flex; flex-direction: column; text-align: left;">
|
5273
|
-
<div style="font-size: 16px; font-weight: bold;">${
|
5274
|
-
<div style="font-size: 12px; opacity:0.5;">${
|
5280
|
+
<div style="font-size: 16px; font-weight: bold;">${item.name}</div>
|
5281
|
+
<div style="font-size: 12px; opacity:0.5;">${item.description}</div>
|
5275
5282
|
</div>
|
5276
5283
|
</button>`
|
5277
5284
|
).join("")}
|
@@ -5313,7 +5320,7 @@ function getGroup(state) {
|
|
5313
5320
|
|
5314
5321
|
// src/index.ts
|
5315
5322
|
var getVersion = () => {
|
5316
|
-
return "0.5.
|
5323
|
+
return "0.5.76-beta";
|
5317
5324
|
};
|
5318
5325
|
if (typeof window !== "undefined") {
|
5319
5326
|
window.__BTC_WALLET_VERSION = getVersion();
|