@hashgraphonline/hashinal-wc 1.0.0

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 ADDED
@@ -0,0 +1,115 @@
1
+ # Hedera Wallet Connect SDK
2
+
3
+ This SDK provides a simple interface for interacting with the Hedera Hashgraph using WalletConnect. It allows developers to easily integrate Hedera functionality into inscribed HTML files by injecting the SDK into the window. It is not meant for usage in a traditional non-inscribed dApp.
4
+
5
+ ## Features
6
+
7
+ - Initialize and connect to WalletConnect
8
+ - Submit messages to Hedera topics
9
+ - Transfer HBAR between accounts
10
+ - Execute smart contracts
11
+ - Create topics and tokens
12
+ - Mint NFTs
13
+ - Fetch account balance and information
14
+ - Retrieve messages from a topic
15
+
16
+ ## Usage
17
+
18
+ The script located in the dist folder can be used directly, but it's primarily intended to be integrated with an inscribed Topic ID via the [Recursion SDK](https://github.com/hashgraph-online/hcs-recursion-sdk).
19
+
20
+ To use this script, ensure that you reference the current version's Topic ID in your HTML.
21
+
22
+ ```html
23
+ <script data-src="hcs://1/0.0.6790163" data-script-id="wallet-connect"></script>
24
+ ```
25
+
26
+ Later in your code, access the SDK.
27
+
28
+ ```javascript
29
+ // Initialize the SDK
30
+ await window.HederaWalletConnectSDK.init(projectId, metadata);
31
+
32
+ // Connect to a wallet
33
+ const session = await HederaWalletConnectSDK.connect();
34
+
35
+ // Use various SDK functions
36
+ await HederaWalletConnectSDK.submitMessageToTopic(topicId, message);
37
+ await HederaWalletConnectSDK.transferHbar(fromAccountId, toAccountId, amount);
38
+ // ... and more
39
+ ```
40
+
41
+ ## SDK Reference
42
+
43
+ ### `init(projectId: string, metadata: SignClientTypes.Metadata)`
44
+
45
+ Initializes the SDK with the given project ID and metadata. Ensure you've registered your project using the official WalletConnect website.
46
+
47
+ ### `connect()`
48
+
49
+ Opens the WalletConnect modal and establishes a connection.
50
+
51
+ ### `disconnect()`
52
+
53
+ Disconnects from all connected wallets.
54
+
55
+ ### `submitMessageToTopic(topicId: string, message: string)`
56
+
57
+ Submits a message to the specified Hedera topic.
58
+
59
+ ### `transferHbar(fromAccountId: string, toAccountId: string, amount: number)`
60
+
61
+ Transfers HBAR between accounts.
62
+
63
+ ### `executeSmartContract(contractId: string, functionName: string, parameters: ContractFunctionParameters, gas: number = 100000)`
64
+
65
+ Executes a function on a smart contract.
66
+
67
+ ### `getAccountBalance()`
68
+
69
+ Retrieves the balance of the connected account.
70
+
71
+ ### `getAccountInfo()`
72
+
73
+ Retrieves information about the connected account.
74
+
75
+ ### `createTopic(memo?: string, adminKey?: string, submitKey?: string)`
76
+
77
+ Creates a new topic on the Hedera network.
78
+
79
+ ### `createToken(name: string, symbol: string, initialSupply: number, decimals: number, treasuryAccountId: string, adminKey: string, supplyKey: string)`
80
+
81
+ Creates a new token on the Hedera network.
82
+
83
+ ### `mintNFT(tokenId: string, metadata: string)`
84
+
85
+ Mints a new NFT for the specified token.
86
+
87
+ ### `getMessages(topicId: string, collectedMessages: Message[], lastTimestamp?: number, disableTimestampFilter: boolean = false, nextUrl?: string)`
88
+
89
+ Retrieves messages from a specified topic.
90
+
91
+ ### `connectWallet(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata)`
92
+
93
+ Helper function to connect to the wallet.
94
+
95
+ ### `disconnectWallet(clearStorage: boolean = true)`
96
+
97
+ Helper function to disconnect and optionally wipe local storage.
98
+
99
+ ### `initAccount(PROJECT_ID: string, APP_METADATA: SignClientTypes.Metadata)`
100
+
101
+ Helper function to initialize the SDK from localStorage.
102
+
103
+ ## Versions and Topic IDs
104
+
105
+ | Version | Topic ID |
106
+ | ------- | ----------- |
107
+ | v0.0.1 | 0.0.6790163 |
108
+
109
+ ## Contributing
110
+
111
+ Contributions are welcome! Please feel free to submit a Pull Request.
112
+
113
+ ## License
114
+
115
+ This project is licensed under the [MIT License](LICENSE).