@hashgraphonline/hashinal-wc 2.0.19 → 2.0.20

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.
@@ -1,120 +1,171 @@
1
1
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
2
- import { Transaction, AccountId, ContractId, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
3
- import { AppKit } from '@reown/appkit';
4
- import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
5
- import { FetchMessagesResult, TokenBalance, HederaAccountResponse, HederaTXResponse, Nft } from './types';
6
- import { Logger } from './logger';
2
+ import {
3
+ LedgerId,
4
+ TransactionReceipt,
5
+ ContractFunctionParameters,
6
+ PrivateKey,
7
+ } from '@hashgraph/sdk';
7
8
  import * as HashgraphSDK from '@hashgraph/sdk';
9
+ import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
10
+ import type {
11
+ FetchMessagesResult,
12
+ HederaAccountResponse,
13
+ TokenBalance,
14
+ } from './types';
15
+ import { ILogger } from './logger/logger';
16
+
17
+ declare class HashinalsWalletConnectSDK {
18
+ private static instance;
19
+ private dAppConnector;
20
+ private logger;
21
+ private network;
22
+ constructor(logger?: ILogger, network?: LedgerId);
23
+ static getInstance(
24
+ logger?: ILogger,
25
+ network?: LedgerId
26
+ ): HashinalsWalletConnectSDK;
27
+ setLogger(logger: ILogger): void;
28
+ setNetwork(network: LedgerId): void;
29
+ getNetwork(): LedgerId;
30
+ setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void;
31
+ init(
32
+ projectId: string,
33
+ metadata: SignClientTypes.Metadata,
34
+ network?: LedgerId,
35
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
36
+ ): Promise<DAppConnector>;
37
+ connect(options?: { pairingTopic?: string }): Promise<SessionTypes.Struct>;
38
+ disconnect(): Promise<boolean>;
39
+ disconnectAll(): Promise<boolean>;
40
+ private executeTransaction;
41
+ submitMessageToTopic(
42
+ topicId: string,
43
+ message: string,
44
+ submitKey?: PrivateKey
45
+ ): Promise<TransactionReceipt>;
46
+ transferHbar(
47
+ fromAccountId: string,
48
+ toAccountId: string,
49
+ amount: number
50
+ ): Promise<TransactionReceipt>;
51
+ executeSmartContract(
52
+ contractId: string,
53
+ functionName: string,
54
+ parameters: ContractFunctionParameters,
55
+ gas?: number
56
+ ): Promise<TransactionReceipt>;
57
+ requestAccount(account: string): Promise<HederaAccountResponse>;
58
+ getAccountBalance(): Promise<string>;
59
+ getAccountInfo(): { accountId: string; network: LedgerId } | null;
60
+ createTopic(
61
+ memo?: string,
62
+ adminKey?: string,
63
+ submitKey?: string
64
+ ): Promise<string>;
65
+ createToken(
66
+ name: string,
67
+ symbol: string,
68
+ initialSupply: number,
69
+ decimals: number,
70
+ treasuryAccountId: string,
71
+ adminKey: string,
72
+ supplyKey: string
73
+ ): Promise<string>;
74
+ mintNFT(
75
+ tokenId: string,
76
+ metadata: string,
77
+ supplyKey: PrivateKey
78
+ ): Promise<TransactionReceipt>;
79
+ getMessages(
80
+ topicId: string,
81
+ lastTimestamp?: number,
82
+ disableTimestampFilter?: boolean,
83
+ network?: string
84
+ ): Promise<FetchMessagesResult>;
85
+ saveConnectionInfo(accountId: string | undefined, connectedNetwork?: string): void;
86
+ loadConnectionInfo(): { accountId: string | null; network: string | null };
87
+ connectWallet(
88
+ PROJECT_ID: string,
89
+ APP_METADATA: SignClientTypes.Metadata,
90
+ network?: LedgerId
91
+ ): Promise<{
92
+ accountId: string;
93
+ balance: string;
94
+ session: SessionTypes.Struct;
95
+ }>;
96
+ disconnectWallet(clearStorage?: boolean): Promise<boolean>;
97
+ initAccount(
98
+ PROJECT_ID: string,
99
+ APP_METADATA: SignClientTypes.Metadata,
100
+ networkOverride?: LedgerId,
101
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
102
+ ): Promise<{
103
+ accountId: string;
104
+ balance: string;
105
+ } | null>;
106
+ subscribeToExtensions(callback: (extension: any) => void): () => void;
107
+ connectViaDappBrowser(): Promise<void>;
108
+ private ensureInitialized;
109
+ static run(): void;
110
+ transferToken(
111
+ tokenId: string,
112
+ fromAccountId: string,
113
+ toAccountId: string,
114
+ amount: number
115
+ ): Promise<TransactionReceipt>;
116
+ createAccount(initialBalance: number): Promise<TransactionReceipt>;
117
+ associateTokenToAccount(
118
+ accountId: string,
119
+ tokenId: string
120
+ ): Promise<TransactionReceipt>;
121
+ dissociateTokenFromAccount(
122
+ accountId: string,
123
+ tokenId: string
124
+ ): Promise<TransactionReceipt>;
125
+ updateAccount(
126
+ accountId: string,
127
+ maxAutomaticTokenAssociations: number
128
+ ): Promise<TransactionReceipt>;
129
+ approveAllowance(
130
+ spenderAccountId: string,
131
+ tokenId: string,
132
+ amount: number,
133
+ ownerAccountId: string
134
+ ): Promise<TransactionReceipt>;
135
+ getAccountTokens(accountId: string): Promise<{
136
+ tokens: TokenBalance[];
137
+ }>;
138
+ signMessage(
139
+ message: string,
140
+ options?: {
141
+ openWalletOnMobile?: boolean;
142
+ onMobileRedirect?: () => void;
143
+ }
144
+ ): Promise<{ userSignature: string }>;
145
+ }
146
+
8
147
  /**
9
148
  * Detect if current device is mobile
10
149
  */
11
150
  declare function isMobileDevice(): boolean;
151
+
12
152
  /**
13
153
  * Detect if device is iOS
14
154
  */
15
155
  declare function isIOSDevice(): boolean;
156
+
16
157
  /**
17
158
  * Open HashPack app on mobile device
18
- * Returns a promise that resolves after a short delay to allow the app to open
159
+ * @param wcUri - Optional WalletConnect URI to pass to HashPack
19
160
  */
20
161
  declare function openHashPackOnMobile(wcUri?: string): Promise<void>;
21
- declare class HashinalsWalletConnectSDK {
22
- private static instance;
23
- private static dAppConnectorInstance;
24
- private static proxyInstance;
25
- private logger;
26
- private network;
27
- private reownAppKit;
28
- private reownAppKitKey;
29
- private extensionCheckInterval;
30
- private hasCalledExtensionCallback;
31
- get dAppConnector(): DAppConnector;
32
- constructor(logger?: Logger, network?: LedgerId);
33
- static getInstance(logger?: Logger, network?: LedgerId): HashinalsWalletConnectSDK;
34
- setLogger(logger: Logger): void;
35
- setNetwork(network: LedgerId): void;
36
- getNetwork(): LedgerId;
37
- setReownAppKit(appKit: AppKit | null): void;
38
- private ensureReownAppKit;
39
- setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void;
40
- init(projectId: string, metadata: SignClientTypes.Metadata, network?: LedgerId, onSessionIframeCreated?: (session: SessionTypes.Struct) => void): Promise<DAppConnector>;
41
- connect(options?: {
42
- pairingTopic?: string;
43
- }): Promise<SessionTypes.Struct>;
44
- private connectUsingReownAppKit;
45
- disconnect(): Promise<boolean>;
46
- disconnectAll(): Promise<boolean>;
47
- executeTransaction(tx: Transaction, disableSigner?: boolean): Promise<TransactionReceipt>;
48
- executeTransactionWithErrorHandling(tx: Transaction, disableSigner: boolean): Promise<{
49
- result?: TransactionReceipt;
50
- error?: string;
51
- }>;
52
- submitMessageToTopic(topicId: string, message: string, submitKey?: PrivateKey): Promise<TransactionReceipt>;
53
- transferHbar(fromAccountId: string, toAccountId: string, amount: number): Promise<TransactionReceipt>;
54
- executeSmartContract(contractId: string, functionName: string, parameters: ContractFunctionParameters, gas?: number): Promise<TransactionReceipt>;
55
- private handleNewSession;
56
- private getNetworkPrefix;
57
- requestAccount(account: string): Promise<HederaAccountResponse>;
58
- getAccountBalance(): Promise<string>;
59
- getAccountInfo(): {
60
- accountId: string;
61
- network: LedgerId;
62
- };
63
- createTopic(memo?: string, adminKey?: string, submitKey?: string): Promise<string>;
64
- createToken(name: string, symbol: string, initialSupply: number, decimals: number, treasuryAccountId: string, adminKey: string, supplyKey: string): Promise<string>;
65
- mintNFT(tokenId: string, metadata: string, supplyKey: PrivateKey): Promise<TransactionReceipt>;
66
- getMessages(topicId: string, lastTimestamp?: number, disableTimestampFilter?: boolean, network?: string): Promise<FetchMessagesResult>;
67
- /**
68
- * Sign a message with the connected wallet.
69
- * On mobile devices, this will automatically open the HashPack app
70
- * to prompt the user to sign the message.
71
- *
72
- * @param message - The message to sign
73
- * @param options - Optional configuration for signing
74
- * @param options.openWalletOnMobile - Whether to open the wallet app on mobile (default: true)
75
- * @param options.onMobileRedirect - Callback before redirecting to wallet on mobile
76
- */
77
- signMessage(message: string, options?: {
78
- openWalletOnMobile?: boolean;
79
- onMobileRedirect?: () => void;
80
- }): Promise<{
81
- userSignature: any;
82
- }>;
83
- private saveConnectionInfo;
84
- loadConnectionInfo(): {
85
- accountId: string | null;
86
- network: string | null;
87
- };
88
- connectWallet(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata, network?: LedgerId): Promise<{
89
- accountId: string;
90
- balance: string;
91
- session: SessionTypes.Struct;
92
- }>;
93
- disconnectWallet(clearStorage?: boolean): Promise<boolean>;
94
- initAccount(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata, networkOverride?: LedgerId, onSessionIframeCreated?: (session: SessionTypes.Struct) => void): Promise<{
95
- accountId: string;
96
- balance: string;
97
- } | null>;
98
- subscribeToExtensions(callback: (extension: any) => void): () => void;
99
- connectViaDappBrowser(): Promise<void>;
100
- private connectToExtension;
101
- private ensureInitialized;
102
- static run(): void;
103
- transferToken(tokenId: string, fromAccountId: string, toAccountId: string, amount: number): Promise<TransactionReceipt>;
104
- createAccount(initialBalance: number): Promise<TransactionReceipt>;
105
- associateTokenToAccount(accountId: string, tokenId: string): Promise<TransactionReceipt>;
106
- dissociateTokenFromAccount(accountId: string, tokenId: string): Promise<TransactionReceipt>;
107
- updateAccount(accountId: string, maxAutomaticTokenAssociations: number): Promise<TransactionReceipt>;
108
- approveAllowance(spenderAccountId: string, tokenId: string, amount: number, ownerAccountId: string): Promise<TransactionReceipt>;
109
- getAccountTokens(accountId: string): Promise<{
110
- tokens: TokenBalance[];
111
- }>;
112
- getTransaction(transactionId: string): Promise<HederaTXResponse | null>;
113
- getTransactionByTimestamp(timestamp: string): Promise<HederaTXResponse | null>;
114
- getAccountNFTs(accountId: string, tokenId?: string): Promise<Nft[]>;
115
- validateNFTOwnership(serialNumber: string, accountId: string, tokenId: string): Promise<Nft | null>;
116
- readSmartContract(data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number): Promise<any>;
162
+
163
+ declare global {
164
+ interface Window {
165
+ HashinalsWalletConnectSDK: HashinalsWalletConnectSDK;
166
+ }
117
167
  }
118
- export * from './types';
119
- export * from './sign';
168
+
169
+ declare const __UMD__: boolean;
170
+
120
171
  export { HashinalsWalletConnectSDK, HashgraphSDK, isMobileDevice, isIOSDevice, openHashPackOnMobile };
package/dist/index.d.ts CHANGED
@@ -25,14 +25,18 @@ declare class HashinalsWalletConnectSDK {
25
25
  network?: LedgerId
26
26
  ): HashinalsWalletConnectSDK;
27
27
  setLogger(logger: ILogger): void;
28
+ setNetwork(network: LedgerId): void;
29
+ getNetwork(): LedgerId;
28
30
  setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void;
29
31
  init(
30
32
  projectId: string,
31
33
  metadata: SignClientTypes.Metadata,
32
- network?: LedgerId
34
+ network?: LedgerId,
35
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
33
36
  ): Promise<DAppConnector>;
34
- connect(): Promise<SessionTypes.Struct>;
37
+ connect(options?: { pairingTopic?: string }): Promise<SessionTypes.Struct>;
35
38
  disconnect(): Promise<boolean>;
39
+ disconnectAll(): Promise<boolean>;
36
40
  private executeTransaction;
37
41
  submitMessageToTopic(
38
42
  topicId: string,
@@ -52,7 +56,7 @@ declare class HashinalsWalletConnectSDK {
52
56
  ): Promise<TransactionReceipt>;
53
57
  requestAccount(account: string): Promise<HederaAccountResponse>;
54
58
  getAccountBalance(): Promise<string>;
55
- getAccountInfo(): Promise<string>;
59
+ getAccountInfo(): { accountId: string; network: LedgerId } | null;
56
60
  createTopic(
57
61
  memo?: string,
58
62
  adminKey?: string,
@@ -75,10 +79,11 @@ declare class HashinalsWalletConnectSDK {
75
79
  getMessages(
76
80
  topicId: string,
77
81
  lastTimestamp?: number,
78
- disableTimestampFilter?: boolean
82
+ disableTimestampFilter?: boolean,
83
+ network?: string
79
84
  ): Promise<FetchMessagesResult>;
80
- saveConnectionInfo(accountId: string | undefined): void;
81
- loadConnectionInfo(): string | null;
85
+ saveConnectionInfo(accountId: string | undefined, connectedNetwork?: string): void;
86
+ loadConnectionInfo(): { accountId: string | null; network: string | null };
82
87
  connectWallet(
83
88
  PROJECT_ID: string,
84
89
  APP_METADATA: SignClientTypes.Metadata,
@@ -91,11 +96,15 @@ declare class HashinalsWalletConnectSDK {
91
96
  disconnectWallet(clearStorage?: boolean): Promise<boolean>;
92
97
  initAccount(
93
98
  PROJECT_ID: string,
94
- APP_METADATA: SignClientTypes.Metadata
99
+ APP_METADATA: SignClientTypes.Metadata,
100
+ networkOverride?: LedgerId,
101
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
95
102
  ): Promise<{
96
103
  accountId: string;
97
104
  balance: string;
98
105
  } | null>;
106
+ subscribeToExtensions(callback: (extension: any) => void): () => void;
107
+ connectViaDappBrowser(): Promise<void>;
99
108
  private ensureInitialized;
100
109
  static run(): void;
101
110
  transferToken(
@@ -1,120 +1,171 @@
1
1
  import { SessionTypes, SignClientTypes } from '@walletconnect/types';
2
- import { Transaction, AccountId, ContractId, LedgerId, TransactionReceipt, ContractFunctionParameters, PrivateKey } from '@hashgraph/sdk';
3
- import { AppKit } from '@reown/appkit';
4
- import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
5
- import { FetchMessagesResult, TokenBalance, HederaAccountResponse, HederaTXResponse, Nft } from './types';
6
- import { Logger } from './logger';
2
+ import {
3
+ LedgerId,
4
+ TransactionReceipt,
5
+ ContractFunctionParameters,
6
+ PrivateKey,
7
+ } from '@hashgraph/sdk';
7
8
  import * as HashgraphSDK from '@hashgraph/sdk';
9
+ import { DAppConnector } from '@hashgraph/hedera-wallet-connect';
10
+ import type {
11
+ FetchMessagesResult,
12
+ HederaAccountResponse,
13
+ TokenBalance,
14
+ } from './types';
15
+ import { ILogger } from './logger/logger';
16
+
17
+ declare class HashinalsWalletConnectSDK {
18
+ private static instance;
19
+ private dAppConnector;
20
+ private logger;
21
+ private network;
22
+ constructor(logger?: ILogger, network?: LedgerId);
23
+ static getInstance(
24
+ logger?: ILogger,
25
+ network?: LedgerId
26
+ ): HashinalsWalletConnectSDK;
27
+ setLogger(logger: ILogger): void;
28
+ setNetwork(network: LedgerId): void;
29
+ getNetwork(): LedgerId;
30
+ setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void;
31
+ init(
32
+ projectId: string,
33
+ metadata: SignClientTypes.Metadata,
34
+ network?: LedgerId,
35
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
36
+ ): Promise<DAppConnector>;
37
+ connect(options?: { pairingTopic?: string }): Promise<SessionTypes.Struct>;
38
+ disconnect(): Promise<boolean>;
39
+ disconnectAll(): Promise<boolean>;
40
+ private executeTransaction;
41
+ submitMessageToTopic(
42
+ topicId: string,
43
+ message: string,
44
+ submitKey?: PrivateKey
45
+ ): Promise<TransactionReceipt>;
46
+ transferHbar(
47
+ fromAccountId: string,
48
+ toAccountId: string,
49
+ amount: number
50
+ ): Promise<TransactionReceipt>;
51
+ executeSmartContract(
52
+ contractId: string,
53
+ functionName: string,
54
+ parameters: ContractFunctionParameters,
55
+ gas?: number
56
+ ): Promise<TransactionReceipt>;
57
+ requestAccount(account: string): Promise<HederaAccountResponse>;
58
+ getAccountBalance(): Promise<string>;
59
+ getAccountInfo(): { accountId: string; network: LedgerId } | null;
60
+ createTopic(
61
+ memo?: string,
62
+ adminKey?: string,
63
+ submitKey?: string
64
+ ): Promise<string>;
65
+ createToken(
66
+ name: string,
67
+ symbol: string,
68
+ initialSupply: number,
69
+ decimals: number,
70
+ treasuryAccountId: string,
71
+ adminKey: string,
72
+ supplyKey: string
73
+ ): Promise<string>;
74
+ mintNFT(
75
+ tokenId: string,
76
+ metadata: string,
77
+ supplyKey: PrivateKey
78
+ ): Promise<TransactionReceipt>;
79
+ getMessages(
80
+ topicId: string,
81
+ lastTimestamp?: number,
82
+ disableTimestampFilter?: boolean,
83
+ network?: string
84
+ ): Promise<FetchMessagesResult>;
85
+ saveConnectionInfo(accountId: string | undefined, connectedNetwork?: string): void;
86
+ loadConnectionInfo(): { accountId: string | null; network: string | null };
87
+ connectWallet(
88
+ PROJECT_ID: string,
89
+ APP_METADATA: SignClientTypes.Metadata,
90
+ network?: LedgerId
91
+ ): Promise<{
92
+ accountId: string;
93
+ balance: string;
94
+ session: SessionTypes.Struct;
95
+ }>;
96
+ disconnectWallet(clearStorage?: boolean): Promise<boolean>;
97
+ initAccount(
98
+ PROJECT_ID: string,
99
+ APP_METADATA: SignClientTypes.Metadata,
100
+ networkOverride?: LedgerId,
101
+ onSessionIframeCreated?: (session: SessionTypes.Struct) => void
102
+ ): Promise<{
103
+ accountId: string;
104
+ balance: string;
105
+ } | null>;
106
+ subscribeToExtensions(callback: (extension: any) => void): () => void;
107
+ connectViaDappBrowser(): Promise<void>;
108
+ private ensureInitialized;
109
+ static run(): void;
110
+ transferToken(
111
+ tokenId: string,
112
+ fromAccountId: string,
113
+ toAccountId: string,
114
+ amount: number
115
+ ): Promise<TransactionReceipt>;
116
+ createAccount(initialBalance: number): Promise<TransactionReceipt>;
117
+ associateTokenToAccount(
118
+ accountId: string,
119
+ tokenId: string
120
+ ): Promise<TransactionReceipt>;
121
+ dissociateTokenFromAccount(
122
+ accountId: string,
123
+ tokenId: string
124
+ ): Promise<TransactionReceipt>;
125
+ updateAccount(
126
+ accountId: string,
127
+ maxAutomaticTokenAssociations: number
128
+ ): Promise<TransactionReceipt>;
129
+ approveAllowance(
130
+ spenderAccountId: string,
131
+ tokenId: string,
132
+ amount: number,
133
+ ownerAccountId: string
134
+ ): Promise<TransactionReceipt>;
135
+ getAccountTokens(accountId: string): Promise<{
136
+ tokens: TokenBalance[];
137
+ }>;
138
+ signMessage(
139
+ message: string,
140
+ options?: {
141
+ openWalletOnMobile?: boolean;
142
+ onMobileRedirect?: () => void;
143
+ }
144
+ ): Promise<{ userSignature: string }>;
145
+ }
146
+
8
147
  /**
9
148
  * Detect if current device is mobile
10
149
  */
11
150
  declare function isMobileDevice(): boolean;
151
+
12
152
  /**
13
153
  * Detect if device is iOS
14
154
  */
15
155
  declare function isIOSDevice(): boolean;
156
+
16
157
  /**
17
158
  * Open HashPack app on mobile device
18
- * Returns a promise that resolves after a short delay to allow the app to open
159
+ * @param wcUri - Optional WalletConnect URI to pass to HashPack
19
160
  */
20
161
  declare function openHashPackOnMobile(wcUri?: string): Promise<void>;
21
- declare class HashinalsWalletConnectSDK {
22
- private static instance;
23
- private static dAppConnectorInstance;
24
- private static proxyInstance;
25
- private logger;
26
- private network;
27
- private reownAppKit;
28
- private reownAppKitKey;
29
- private extensionCheckInterval;
30
- private hasCalledExtensionCallback;
31
- get dAppConnector(): DAppConnector;
32
- constructor(logger?: Logger, network?: LedgerId);
33
- static getInstance(logger?: Logger, network?: LedgerId): HashinalsWalletConnectSDK;
34
- setLogger(logger: Logger): void;
35
- setNetwork(network: LedgerId): void;
36
- getNetwork(): LedgerId;
37
- setReownAppKit(appKit: AppKit | null): void;
38
- private ensureReownAppKit;
39
- setLogLevel(level: 'error' | 'warn' | 'info' | 'debug'): void;
40
- init(projectId: string, metadata: SignClientTypes.Metadata, network?: LedgerId, onSessionIframeCreated?: (session: SessionTypes.Struct) => void): Promise<DAppConnector>;
41
- connect(options?: {
42
- pairingTopic?: string;
43
- }): Promise<SessionTypes.Struct>;
44
- private connectUsingReownAppKit;
45
- disconnect(): Promise<boolean>;
46
- disconnectAll(): Promise<boolean>;
47
- executeTransaction(tx: Transaction, disableSigner?: boolean): Promise<TransactionReceipt>;
48
- executeTransactionWithErrorHandling(tx: Transaction, disableSigner: boolean): Promise<{
49
- result?: TransactionReceipt;
50
- error?: string;
51
- }>;
52
- submitMessageToTopic(topicId: string, message: string, submitKey?: PrivateKey): Promise<TransactionReceipt>;
53
- transferHbar(fromAccountId: string, toAccountId: string, amount: number): Promise<TransactionReceipt>;
54
- executeSmartContract(contractId: string, functionName: string, parameters: ContractFunctionParameters, gas?: number): Promise<TransactionReceipt>;
55
- private handleNewSession;
56
- private getNetworkPrefix;
57
- requestAccount(account: string): Promise<HederaAccountResponse>;
58
- getAccountBalance(): Promise<string>;
59
- getAccountInfo(): {
60
- accountId: string;
61
- network: LedgerId;
62
- };
63
- createTopic(memo?: string, adminKey?: string, submitKey?: string): Promise<string>;
64
- createToken(name: string, symbol: string, initialSupply: number, decimals: number, treasuryAccountId: string, adminKey: string, supplyKey: string): Promise<string>;
65
- mintNFT(tokenId: string, metadata: string, supplyKey: PrivateKey): Promise<TransactionReceipt>;
66
- getMessages(topicId: string, lastTimestamp?: number, disableTimestampFilter?: boolean, network?: string): Promise<FetchMessagesResult>;
67
- /**
68
- * Sign a message with the connected wallet.
69
- * On mobile devices, this will automatically open the HashPack app
70
- * to prompt the user to sign the message.
71
- *
72
- * @param message - The message to sign
73
- * @param options - Optional configuration for signing
74
- * @param options.openWalletOnMobile - Whether to open the wallet app on mobile (default: true)
75
- * @param options.onMobileRedirect - Callback before redirecting to wallet on mobile
76
- */
77
- signMessage(message: string, options?: {
78
- openWalletOnMobile?: boolean;
79
- onMobileRedirect?: () => void;
80
- }): Promise<{
81
- userSignature: any;
82
- }>;
83
- private saveConnectionInfo;
84
- loadConnectionInfo(): {
85
- accountId: string | null;
86
- network: string | null;
87
- };
88
- connectWallet(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata, network?: LedgerId): Promise<{
89
- accountId: string;
90
- balance: string;
91
- session: SessionTypes.Struct;
92
- }>;
93
- disconnectWallet(clearStorage?: boolean): Promise<boolean>;
94
- initAccount(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata, networkOverride?: LedgerId, onSessionIframeCreated?: (session: SessionTypes.Struct) => void): Promise<{
95
- accountId: string;
96
- balance: string;
97
- } | null>;
98
- subscribeToExtensions(callback: (extension: any) => void): () => void;
99
- connectViaDappBrowser(): Promise<void>;
100
- private connectToExtension;
101
- private ensureInitialized;
102
- static run(): void;
103
- transferToken(tokenId: string, fromAccountId: string, toAccountId: string, amount: number): Promise<TransactionReceipt>;
104
- createAccount(initialBalance: number): Promise<TransactionReceipt>;
105
- associateTokenToAccount(accountId: string, tokenId: string): Promise<TransactionReceipt>;
106
- dissociateTokenFromAccount(accountId: string, tokenId: string): Promise<TransactionReceipt>;
107
- updateAccount(accountId: string, maxAutomaticTokenAssociations: number): Promise<TransactionReceipt>;
108
- approveAllowance(spenderAccountId: string, tokenId: string, amount: number, ownerAccountId: string): Promise<TransactionReceipt>;
109
- getAccountTokens(accountId: string): Promise<{
110
- tokens: TokenBalance[];
111
- }>;
112
- getTransaction(transactionId: string): Promise<HederaTXResponse | null>;
113
- getTransactionByTimestamp(timestamp: string): Promise<HederaTXResponse | null>;
114
- getAccountNFTs(accountId: string, tokenId?: string): Promise<Nft[]>;
115
- validateNFTOwnership(serialNumber: string, accountId: string, tokenId: string): Promise<Nft | null>;
116
- readSmartContract(data: string, fromAccount: AccountId, contractId: ContractId, estimate?: boolean, value?: number): Promise<any>;
162
+
163
+ declare global {
164
+ interface Window {
165
+ HashinalsWalletConnectSDK: HashinalsWalletConnectSDK;
166
+ }
117
167
  }
118
- export * from './types';
119
- export * from './sign';
168
+
169
+ declare const __UMD__: boolean;
170
+
120
171
  export { HashinalsWalletConnectSDK, HashgraphSDK, isMobileDevice, isIOSDevice, openHashPackOnMobile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hashgraphonline/hashinal-wc",
3
- "version": "2.0.19",
3
+ "version": "2.0.20",
4
4
  "description": "The official Hashinal Wallet Connect SDK. A set of easy-to-use functions to interact with Hedera through Wallet Connect.",
5
5
  "type": "module",
6
6
  "files": [