btc-wallet 0.5.59-beta → 0.5.61-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 +37 -13
- package/dist/index.js.map +2 -2
- package/esm/index.js +37 -13
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
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
|
4407
|
-
closeImageUrl
|
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 (
|
5086
|
-
const
|
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,23 @@ function setupWalletSelectorModal(selector, options) {
|
|
5094
5105
|
});
|
5095
5106
|
return modal;
|
5096
5107
|
}
|
5097
|
-
|
5108
|
+
var CHAINS = [
|
5109
|
+
{ id: "btc", name: "Bitcoin", description: "MPC Mapping" },
|
5110
|
+
{ id: "eth", name: "Ethereum", description: "EVM address as Near Account" },
|
5111
|
+
{ id: "near", name: "Near", description: "Near Account" }
|
5112
|
+
];
|
5113
|
+
function openChainModal(group) {
|
5098
5114
|
return __async(this, null, function* () {
|
5099
|
-
const chains5 =
|
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
|
-
|
5105
|
-
|
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
|
+
<div style="display: flex; flex-direction: column; text-align: left;">
|
5122
|
+
<div style="font-size: 16px; font-weight: bold;">${chain.name}</div>
|
5123
|
+
<div style="font-size: 12px; opacity:0.5;">${chain.description}</div>
|
5124
|
+
</div>
|
5106
5125
|
</button>`
|
5107
5126
|
).join("")}
|
5108
5127
|
</div>
|
@@ -5127,10 +5146,15 @@ function openChainModal() {
|
|
5127
5146
|
}
|
5128
5147
|
function getGroup(state) {
|
5129
5148
|
const hasBtcWallet = state.modules.some((module) => module.id === "btc-wallet");
|
5130
|
-
const
|
5149
|
+
const hasEvmWallet = state.modules.some((module) => module.id === "ethereum-wallets");
|
5150
|
+
const hasNearWallet = state.modules.some(
|
5151
|
+
(module) => module.id !== "btc-wallet" && module.id !== "ethereum-wallets"
|
5152
|
+
);
|
5131
5153
|
const group = [];
|
5132
5154
|
if (hasBtcWallet)
|
5133
5155
|
group.push("btc");
|
5156
|
+
if (hasEvmWallet)
|
5157
|
+
group.push("eth");
|
5134
5158
|
if (hasNearWallet)
|
5135
5159
|
group.push("near");
|
5136
5160
|
return group;
|
@@ -5138,7 +5162,7 @@ function getGroup(state) {
|
|
5138
5162
|
|
5139
5163
|
// src/index.ts
|
5140
5164
|
var getVersion = () => {
|
5141
|
-
return "0.5.
|
5165
|
+
return "0.5.61-beta";
|
5142
5166
|
};
|
5143
5167
|
if (typeof window !== "undefined") {
|
5144
5168
|
window.__BTC_WALLET_VERSION = getVersion();
|