@hashgraphonline/hashinal-wc 1.0.7-3.canary-7 → 1.0.7-3.canary-9

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/README.md CHANGED
@@ -34,7 +34,7 @@ No installation needed. Reference the script directly in your HTML:
34
34
  Install the package:
35
35
 
36
36
  ```bash
37
- npm install @hashgraphonline/hashinal-wc @hashgraph/sdk @hashgraph/proto @hashgraphonline/hedera-wallet-connect @walletconnect/modal @walletconnect/qrcode-modal @walletconnect/utils @walletconnect/types @walletconnect/modal-core fetch-retry
37
+ npm install @hashgraph/hashinal-wc @hashgraph/sdk @hashgraph/proto @hashgraph/hedera-wallet-connect @walletconnect/modal @walletconnect/qrcode-modal @walletconnect/utils @walletconnect/types @walletconnect/modal-core fetch-retry
38
38
  ```
39
39
 
40
40
  ## Usage
@@ -52,7 +52,7 @@ const sdk = window.HashinalsWalletConnectSDK;
52
52
  Import and use the SDK:
53
53
 
54
54
  ```javascript
55
- import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
55
+ import { HashinalsWalletConnectSDK } from '@hashgraph/hashinal-wc';
56
56
  const sdk = HashinalsWalletConnectSDK.getInstance();
57
57
  ```
58
58
 
@@ -78,7 +78,7 @@ await window.HashinalsWalletConnectSDK.init(projectId, metadata);
78
78
  ESM Example:
79
79
 
80
80
  ```javascript
81
- import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc';
81
+ import { HashinalsWalletConnectSDK } from '@hashgraph/hashinal-wc';
82
82
  import { LedgerId } from '@hashgraph/sdk';
83
83
 
84
84
  const sdk = HashinalsWalletConnectSDK.getInstance();
@@ -1,7 +1,7 @@
1
1
  import * as HashgraphSDK from "@hashgraph/sdk";
2
2
  import { LedgerId, TopicMessageSubmitTransaction, TopicId, TransferTransaction, TransactionId, AccountId, Hbar, ContractExecuteTransaction, ContractId, TopicCreateTransaction, PrivateKey, TokenCreateTransaction, TokenType, TokenSupplyType, TokenMintTransaction, TokenId, AccountCreateTransaction, TokenAssociateTransaction, TokenDissociateTransaction, AccountUpdateTransaction, AccountAllowanceApproveTransaction } from "@hashgraph/sdk";
3
- import { DAppConnector, HederaJsonRpcMethod, HederaSessionEvent, HederaChainId } from "@hashgraphonline/hedera-wallet-connect";
4
- import { base64StringToSignatureMap, prefixMessageToSign, verifyMessageSignature } from "@hashgraphonline/hedera-wallet-connect";
3
+ import { DAppConnector, HederaJsonRpcMethod, HederaSessionEvent, HederaChainId } from "@hashgraph/hedera-wallet-connect";
4
+ import { base64StringToSignatureMap, prefixMessageToSign, verifyMessageSignature } from "@hashgraph/hedera-wallet-connect";
5
5
  import retryFetch from "fetch-retry";
6
6
  var buffer = {};
7
7
  var base64Js = {};
@@ -1853,7 +1853,8 @@ class HashinalsWalletConnectSDK {
1853
1853
  projectId,
1854
1854
  Object.values(HederaJsonRpcMethod),
1855
1855
  [HederaSessionEvent.ChainChanged, HederaSessionEvent.AccountsChanged],
1856
- [isMainnet ? HederaChainId.Mainnet : HederaChainId.Testnet]
1856
+ [isMainnet ? HederaChainId.Mainnet : HederaChainId.Testnet],
1857
+ "debug"
1857
1858
  );
1858
1859
  await this.dAppConnector.init({ logger: "error" });
1859
1860
  this.dAppConnector.onSessionIframeCreated = (session) => {
@@ -1871,10 +1872,29 @@ class HashinalsWalletConnectSDK {
1871
1872
  return session;
1872
1873
  }
1873
1874
  async disconnect() {
1875
+ var _a, _b;
1876
+ try {
1877
+ this.ensureInitialized();
1878
+ const accountInfo = this.getAccountInfo();
1879
+ const accountId = accountInfo == null ? void 0 : accountInfo.accountId;
1880
+ const network = accountInfo == null ? void 0 : accountInfo.network;
1881
+ const signer = (_a = this == null ? void 0 : this.dAppConnector) == null ? void 0 : _a.signers.find(
1882
+ (signer_) => signer_.getAccountId().toString() === accountId
1883
+ );
1884
+ await ((_b = this.dAppConnector) == null ? void 0 : _b.disconnect(signer == null ? void 0 : signer.topic));
1885
+ this.logger.info(`Disconnected from ${accountId} on ${network}`);
1886
+ return true;
1887
+ } catch (e) {
1888
+ this.logger.error("Failed to disconnect", e);
1889
+ return false;
1890
+ }
1891
+ }
1892
+ async disconnectAll() {
1893
+ var _a;
1874
1894
  try {
1875
1895
  this.ensureInitialized();
1876
- await this.dAppConnector.disconnectAll();
1877
- this.logger.info("Disconnected from all wallets");
1896
+ await ((_a = this.dAppConnector) == null ? void 0 : _a.disconnectAll());
1897
+ this.logger.info(`Disconnected from all wallets`);
1878
1898
  return true;
1879
1899
  } catch (e) {
1880
1900
  this.logger.error("Failed to disconnect", e);