btc-wallet 0.2.1 → 0.2.3
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 +23 -10
- package/dist/index.js.map +2 -2
- package/dist/utils/setupBTCWallet.d.ts +1 -1
- package/esm/index.js +23 -10
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
    
        package/dist/index.js
    CHANGED
    
    | @@ -2358,12 +2358,17 @@ var import_bs58 = __toESM(require("bs58"), 1); | |
| 2358 2358 | 
             
            var import_js_sha256 = require("js-sha256");
         | 
| 2359 2359 |  | 
| 2360 2360 | 
             
            // src/utils/initWalletButton.ts
         | 
| 2361 | 
            +
            var walletUrlConfig = {
         | 
| 2362 | 
            +
              dev: "https://wallet-dev.satoshibridge.top",
         | 
| 2363 | 
            +
              testnet: "https://wallet-test.satoshibridge.top",
         | 
| 2364 | 
            +
              mainnet: "https://wallet.satoshibridge.top"
         | 
| 2365 | 
            +
            };
         | 
| 2361 2366 | 
             
            function setupWalletButton(network, wallet, originalWallet) {
         | 
| 2362 2367 | 
             
              if (document.getElementById("satoshi-wallet-button")) {
         | 
| 2363 2368 | 
             
                return;
         | 
| 2364 2369 | 
             
              }
         | 
| 2365 2370 | 
             
              const iframe = createIframe({
         | 
| 2366 | 
            -
                iframeUrl: network | 
| 2371 | 
            +
                iframeUrl: walletUrlConfig[network],
         | 
| 2367 2372 | 
             
                iframeStyle: { width: "400px", height: "650px" }
         | 
| 2368 2373 | 
             
              });
         | 
| 2369 2374 | 
             
              iframe.addEventListener("mouseenter", () => {
         | 
| @@ -2494,8 +2499,8 @@ var { transfer, functionCall } = import_transactions.actionCreators; | |
| 2494 2499 | 
             
            var config = {
         | 
| 2495 2500 | 
             
              dev: {
         | 
| 2496 2501 | 
             
                base_url: "https://api.dev.satoshibridge.top/v1",
         | 
| 2497 | 
            -
                token: "nbtc1-nsp. | 
| 2498 | 
            -
                contractId: "dev1-nsp. | 
| 2502 | 
            +
                token: "nbtc1-nsp.testnet",
         | 
| 2503 | 
            +
                contractId: "dev1-nsp.testnet"
         | 
| 2499 2504 | 
             
              },
         | 
| 2500 2505 | 
             
              testnet: {
         | 
| 2501 2506 | 
             
                base_url: "https://api.testnet.satoshibridge.top/v1",
         | 
| @@ -2566,7 +2571,8 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({ | |
| 2566 2571 | 
             
                signAndSendTransactions
         | 
| 2567 2572 | 
             
              };
         | 
| 2568 2573 | 
             
              const currentConfig = "isDev" in metadata && metadata.isDev ? config.dev : config[options.network.networkId];
         | 
| 2569 | 
            -
               | 
| 2574 | 
            +
              const walletNetwork = "isDev" in metadata && metadata.isDev ? "dev" : options.network.networkId;
         | 
| 2575 | 
            +
              initWalletButton(walletNetwork, wallet);
         | 
| 2570 2576 | 
             
              if (!inter) {
         | 
| 2571 2577 | 
             
                inter = setInterval(() => __async(void 0, null, function* () {
         | 
| 2572 2578 | 
             
                  const btcContext = window.btcContext;
         | 
| @@ -2576,7 +2582,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({ | |
| 2576 2582 | 
             
                    context.on("updatePublicKey", (btcPublicKey) => __async(void 0, null, function* () {
         | 
| 2577 2583 | 
             
                      const { nearTempAddress } = yield getNearAccountByBtcPublicKey(btcPublicKey);
         | 
| 2578 2584 | 
             
                      removeWalletButton();
         | 
| 2579 | 
            -
                      initWalletButton( | 
| 2585 | 
            +
                      initWalletButton(walletNetwork, wallet);
         | 
| 2580 2586 | 
             
                      emitter.emit("accountsChanged", {
         | 
| 2581 2587 | 
             
                        accounts: [
         | 
| 2582 2588 | 
             
                          {
         | 
| @@ -2633,7 +2639,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({ | |
| 2633 2639 | 
             
                  const accountId = state.getAccount();
         | 
| 2634 2640 | 
             
                  const publicKey = state.getPublicKey();
         | 
| 2635 2641 | 
             
                  const btcContext = window.btcContext;
         | 
| 2636 | 
            -
                  initWalletButton( | 
| 2642 | 
            +
                  initWalletButton(walletNetwork, wallet);
         | 
| 2637 2643 | 
             
                  if (accountId && publicKey) {
         | 
| 2638 2644 | 
             
                    return [
         | 
| 2639 2645 | 
             
                      {
         | 
| @@ -2754,7 +2760,12 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({ | |
| 2754 2760 | 
             
                    gas_limit: "3000",
         | 
| 2755 2761 | 
             
                    use_near_pay_gas: false
         | 
| 2756 2762 | 
             
                  };
         | 
| 2757 | 
            -
                  const  | 
| 2763 | 
            +
                  const nearAccount = yield provider.query({
         | 
| 2764 | 
            +
                    request_type: "view_account",
         | 
| 2765 | 
            +
                    account_id: accountId,
         | 
| 2766 | 
            +
                    finality: "final"
         | 
| 2767 | 
            +
                  });
         | 
| 2768 | 
            +
                  const availableBalance = parseFloat(nearAccount.amount) / __pow(10, 24);
         | 
| 2758 2769 | 
             
                  if (availableBalance > 0.2) {
         | 
| 2759 2770 | 
             
                    intention.use_near_pay_gas = true;
         | 
| 2760 2771 | 
             
                  }
         | 
| @@ -2822,7 +2833,8 @@ function uploadBTCTx(url, data) { | |
| 2822 2833 | 
             
            function setupBTCWallet({
         | 
| 2823 2834 | 
             
              iconUrl = "https://assets.deltatrade.ai/assets/chain/btc.svg",
         | 
| 2824 2835 | 
             
              deprecated = false,
         | 
| 2825 | 
            -
              autoConnect = true
         | 
| 2836 | 
            +
              autoConnect = true,
         | 
| 2837 | 
            +
              isDev = false
         | 
| 2826 2838 | 
             
            } = {}) {
         | 
| 2827 2839 | 
             
              const btcWallet = () => __async(this, null, function* () {
         | 
| 2828 2840 | 
             
                return {
         | 
| @@ -2835,7 +2847,8 @@ function setupBTCWallet({ | |
| 2835 2847 | 
             
                    downloadUrl: iconUrl,
         | 
| 2836 2848 | 
             
                    deprecated,
         | 
| 2837 2849 | 
             
                    available: true,
         | 
| 2838 | 
            -
                    autoConnect
         | 
| 2850 | 
            +
                    autoConnect,
         | 
| 2851 | 
            +
                    isDev
         | 
| 2839 2852 | 
             
                  },
         | 
| 2840 2853 | 
             
                  init: BTCWallet
         | 
| 2841 2854 | 
             
                };
         | 
| @@ -2895,7 +2908,7 @@ function pollTransactionStatuses(network, hashes) { | |
| 2895 2908 |  | 
| 2896 2909 | 
             
            // src/index.ts
         | 
| 2897 2910 | 
             
            var getVersion = () => {
         | 
| 2898 | 
            -
              return "0.2. | 
| 2911 | 
            +
              return "0.2.3";
         | 
| 2899 2912 | 
             
            };
         | 
| 2900 2913 | 
             
            if (typeof window !== "undefined") {
         | 
| 2901 2914 | 
             
              window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();
         |