btc-wallet 0.5.75-beta → 0.5.77-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 +37 -11
- package/dist/index.js.map +2 -2
- package/esm/index.js +37 -11
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/esm/index.js
CHANGED
@@ -4241,7 +4241,26 @@ function calculateWithdraw(_0) {
|
|
4241
4241
|
satoshis = new Big2(amount).minus(gasLimit).toNumber();
|
4242
4242
|
}
|
4243
4243
|
const brgConfig = yield getBridgeConfig({ env });
|
4244
|
-
const
|
4244
|
+
const { current_utxos_num } = yield nearCallFunction(
|
4245
|
+
config.bridgeContractId,
|
4246
|
+
"get_metadata",
|
4247
|
+
{},
|
4248
|
+
{ network: config.network }
|
4249
|
+
);
|
4250
|
+
const pageSize = 300;
|
4251
|
+
const totalPages = Math.ceil(current_utxos_num / pageSize);
|
4252
|
+
const utxoRequests = Array.from({ length: totalPages }, (_, index) => {
|
4253
|
+
const fromIndex = index * pageSize;
|
4254
|
+
const limit = Math.min(pageSize, current_utxos_num - fromIndex);
|
4255
|
+
return nearCallFunction(
|
4256
|
+
config.bridgeContractId,
|
4257
|
+
"get_utxos_paged",
|
4258
|
+
{ from_index: fromIndex, limit },
|
4259
|
+
{ network: config.network }
|
4260
|
+
);
|
4261
|
+
});
|
4262
|
+
const utxoResults = yield Promise.all(utxoRequests);
|
4263
|
+
const allUTXO = utxoResults.reduce((acc, result) => __spreadValues(__spreadValues({}, acc), result), {});
|
4245
4264
|
if (brgConfig.min_withdraw_amount) {
|
4246
4265
|
if (Number(satoshis) < Number(brgConfig.min_withdraw_amount)) {
|
4247
4266
|
return {
|
@@ -5129,7 +5148,8 @@ function setupWalletSelectorModal(selector, options) {
|
|
5129
5148
|
draggable = true,
|
5130
5149
|
initialPosition = { right: "20px", bottom: "20px" },
|
5131
5150
|
buttonSize = "60px",
|
5132
|
-
mobileButtonSize = "40px"
|
5151
|
+
mobileButtonSize = "40px",
|
5152
|
+
customGroups = []
|
5133
5153
|
} = options;
|
5134
5154
|
subscription == null ? void 0 : subscription.unsubscribe();
|
5135
5155
|
const state = selector.store.getState();
|
@@ -5172,7 +5192,7 @@ function setupWalletSelectorModal(selector, options) {
|
|
5172
5192
|
const modal = _setupModal(selector, options);
|
5173
5193
|
const originalShow = modal.show.bind(modal);
|
5174
5194
|
modal.show = () => __async(this, null, function* () {
|
5175
|
-
const chain = group.length > 1 && showChainGroups ? yield openChainModal(group) : group[0];
|
5195
|
+
const chain = group.length > 1 && showChainGroups ? yield openChainModal(group, customGroups) : group[0];
|
5176
5196
|
if (["btc", "eth"].includes(chain)) {
|
5177
5197
|
const moduleId = chain === "btc" ? "btc-wallet" : "ethereum-wallets";
|
5178
5198
|
const module = state.modules.find((module2) => module2.id === moduleId);
|
@@ -5182,6 +5202,11 @@ function setupWalletSelectorModal(selector, options) {
|
|
5182
5202
|
}
|
5183
5203
|
} else if (chain === "near") {
|
5184
5204
|
originalShow();
|
5205
|
+
} else {
|
5206
|
+
const customGroup = customGroups.find((g) => g.id === chain);
|
5207
|
+
if (customGroup == null ? void 0 : customGroup.onClick) {
|
5208
|
+
yield customGroup.onClick(customGroup);
|
5209
|
+
}
|
5185
5210
|
}
|
5186
5211
|
});
|
5187
5212
|
return modal;
|
@@ -5191,17 +5216,18 @@ var CHAINS = [
|
|
5191
5216
|
{ id: "eth", name: "Ethereum", description: "EVM address as Near Account" },
|
5192
5217
|
{ id: "btc", name: "Bitcoin", description: "MPC Mapping" }
|
5193
5218
|
];
|
5194
|
-
function openChainModal(
|
5195
|
-
return __async(this,
|
5219
|
+
function openChainModal(_0) {
|
5220
|
+
return __async(this, arguments, function* (group, customGroups = []) {
|
5196
5221
|
const chains5 = CHAINS.filter((chain) => group.includes(chain.id));
|
5222
|
+
const allGroups = [...chains5, ...customGroups];
|
5197
5223
|
const content = (resolve, close) => {
|
5198
5224
|
const buttons = `
|
5199
|
-
<div class="option-list">${
|
5200
|
-
(
|
5201
|
-
<img src="https://assets.deltatrade.ai/assets/chain/${
|
5225
|
+
<div class="option-list">${allGroups.map(
|
5226
|
+
(item) => `<button class="chain-button option-item" data-chain="${item.id}">
|
5227
|
+
<img src="https://assets.deltatrade.ai/assets/chain/${item.id}.svg" alt="${item.id}" style="width:32px; height: 32px;" />
|
5202
5228
|
<div style="display: flex; flex-direction: column; text-align: left;">
|
5203
|
-
<div style="font-size: 16px; font-weight: bold;">${
|
5204
|
-
<div style="font-size: 12px; opacity:0.5;">${
|
5229
|
+
<div style="font-size: 16px; font-weight: bold;">${item.name}</div>
|
5230
|
+
<div style="font-size: 12px; opacity:0.5;">${item.description}</div>
|
5205
5231
|
</div>
|
5206
5232
|
</button>`
|
5207
5233
|
).join("")}
|
@@ -5243,7 +5269,7 @@ function getGroup(state) {
|
|
5243
5269
|
|
5244
5270
|
// src/index.ts
|
5245
5271
|
var getVersion = () => {
|
5246
|
-
return "0.5.
|
5272
|
+
return "0.5.77-beta";
|
5247
5273
|
};
|
5248
5274
|
if (typeof window !== "undefined") {
|
5249
5275
|
window.__BTC_WALLET_VERSION = getVersion();
|