|
1 | | -# WalletConnectSharp |
| 1 | +# Deprecated - WalletConnectSharp |
2 | 2 |
|
3 | | -WalletConnectSharp is an implementation of the [WalletConnect](https://walletconnect.org/) protocol v2 using .NET. This library implements the [WalletConnect Technical Specification](https://docs.walletconnect.org/tech-spec) in .NET to allow C# dApps makers and wallet makers to add support for the open [WalletConnect](https://walletconnect.org/) protocol. |
4 | | - |
5 | | -## Installation |
6 | | - |
7 | | -install via Nuget |
8 | | - |
9 | | -```jsx |
10 | | -dotnet add package WalletConnect.Sign |
11 | | -``` |
12 | | - |
13 | | -## Usage |
14 | | - |
15 | | -### **Dapp Usage** |
16 | | - |
17 | | -First you must setup `SignClientOptions` which stores both the `ProjectId` and `Metadata`. You may also optionally specify the storage module to use. By default, the `FileSystemStorage` module is used if none is specified. |
18 | | - |
19 | | -```csharp |
20 | | -var dappOptions = new SignClientOptions() |
21 | | -{ |
22 | | - ProjectId = "39f3dc0a2c604ec9885799f9fc5feb7c", |
23 | | - Metadata = new Metadata() |
24 | | - { |
25 | | - Description = "An example dapp to showcase WalletConnectSharpv2", |
26 | | - Icons = new[] { "https://walletconnect.com/meta/favicon.ico" }, |
27 | | - Name = "WalletConnectSharpv2 Dapp Example", |
28 | | - Url = "https://walletconnect.com" |
29 | | - }, |
30 | | - // Uncomment to disable persistant storage |
31 | | - // Storage = new InMemoryStorage() |
32 | | -}; |
33 | | -``` |
34 | | - |
35 | | -Then, you must setup the `ConnectOptions` which define what blockchain, RPC methods and events your dapp will use. |
36 | | - |
37 | | -*C# Constructor* |
38 | | - |
39 | | -```csharp |
40 | | -var dappConnectOptions = new ConnectOptions() |
41 | | -{ |
42 | | - RequiredNamespaces = new RequiredNamespaces() |
43 | | - { |
44 | | - { |
45 | | - "eip155", new RequiredNamespace() |
46 | | - { |
47 | | - Methods = new[] |
48 | | - { |
49 | | - "eth_sendTransaction", |
50 | | - "eth_signTransaction", |
51 | | - "eth_sign", |
52 | | - "personal_sign", |
53 | | - "eth_signTypedData", |
54 | | - }, |
55 | | - Chains = new[] |
56 | | - { |
57 | | - "eip155:1" |
58 | | - }, |
59 | | - Events = new[] |
60 | | - { |
61 | | - "chainChanged", |
62 | | - "accountsChanged", |
63 | | - } |
64 | | - } |
65 | | - } |
66 | | - } |
67 | | -}; |
68 | | -``` |
69 | | - |
70 | | -*Builder Functions Style* |
71 | | - |
72 | | -```csharp |
73 | | -var dappConnectOptions1 = new ConnectOptions() |
74 | | - .RequireNamespace("eip155", new RequiredNamespace() |
75 | | - .WithMethod("eth_sendTransaction") |
76 | | - .WithMethod("eth_signTransaction") |
77 | | - .WithMethod("eth_sign") |
78 | | - .WithMethod("personal_sign") |
79 | | - .WithMethod("eth_signTypedData") |
80 | | - .WithChain("eip155:1") |
81 | | - .WithEvent("chainChanged") |
82 | | - .WithEvent("accountsChanged") |
83 | | - ); |
84 | | -``` |
85 | | - |
86 | | -With both options defined, you can initialize and connect the SDK |
87 | | - |
88 | | -```csharp |
89 | | -var dappClient = await WalletConnectSignClient.Init(dappOptions); |
90 | | -var connectData = await dappClient.Connect(dappConnectOptions); |
91 | | -``` |
92 | | - |
93 | | -You can grab the `Uri` for the connection request from `connectData` |
94 | | - |
95 | | -```csharp |
96 | | -ExampleShowQRCode(connectData.Uri); |
97 | | -``` |
98 | | - |
99 | | -and await for connection approval using the `Approval` Task object |
| 3 | +WalletConnect Inc is now Reown. As part of this transition, we are deprecating a number of repositories/packages across our supported platforms, and transitioning to their equivalents published under the Reown organization. |
100 | 4 |
|
101 | | -```csharp |
102 | | -Task<SessionData> sessionConnectTask = connectData.Approval; |
103 | | -SessionData sessionData = await sessionConnectTask; |
| 5 | +This repository is now considered deprecated and will reach End-of-Life on February 17th 2025. For more details, including migration guides please see: https://docs.reown.com/advanced/walletconnect-deprecations |
104 | 6 |
|
105 | | -// or |
106 | | -// SessionData sessionData = await connectData.Approval; |
107 | | -``` |
| 7 | +--- |
108 | 8 |
|
109 | | -This `Task` will return the `SessionData` when the session was approved, or throw an exception when the session rquest has either |
110 | | - |
111 | | -* Timed out |
112 | | -* Been Rejected |
113 | | - |
114 | | -### **Wallet Usage** |
115 | | - |
116 | | -First you must setup `SignClientOptions` which stores both the `ProjectId` and `Metadata`. You may also optionally specify the storage module to use. By default, the `FileSystemStorage` module is used if none is specified. |
117 | | - |
118 | | -```csharp |
119 | | -var walletOptions = new SignClientOptions() |
120 | | -{ |
121 | | - ProjectId = "39f3dc0a2c604ec9885799f9fc5feb7c", |
122 | | - Metadata = new Metadata() |
123 | | - { |
124 | | - Description = "An example wallet to showcase WalletConnectSharpv2", |
125 | | - Icons = new[] { "https://walletconnect.com/meta/favicon.ico" }, |
126 | | - Name = "WalletConnectSharpv2 Wallet Example", |
127 | | - Url = "https://walletconnect.com" |
128 | | - }, |
129 | | - // Uncomment to disable persistant storage |
130 | | - // Storage = new InMemoryStorage() |
131 | | -}; |
132 | | -``` |
133 | | - |
134 | | -Once you have options defined, you can initialize the SDK |
135 | | - |
136 | | -```csharp |
137 | | -var walletClient = await WalletConnectSignClient.Init(walletOptions); |
138 | | -``` |
139 | | - |
140 | | -Wallets can pair an incoming session using the session's Uri. Pairing a session lets the Wallet obtain the connection proposal which can then be approved or denied. |
141 | | - |
142 | | -```csharp |
143 | | -ProposalStruct proposal = await walletClient.Pair(connectData.Uri); |
144 | | -``` |
145 | | - |
146 | | -The wallet can then approve or reject the proposal using either of the following |
147 | | - |
148 | | -```csharp |
149 | | -string addressToConnect = ...; |
150 | | -var approveData = await walletClient.Approve(proposal, addressToConnect); |
151 | | -await approveData.Acknowledged(); |
152 | | -``` |
153 | | - |
154 | | -```csharp |
155 | | -string[] addressesToConnect = ...; |
156 | | -var approveData = await walletClient.Approve(proposal, addressesToConnect); |
157 | | -await approveData.Acknowledged(); |
158 | | -``` |
159 | | - |
160 | | -```csharp |
161 | | -await walletClient.Reject(proposal, "User rejected"); |
162 | | -``` |
163 | | - |
164 | | - |
165 | | -## Examples |
166 | | - |
167 | | -There are examples and unit tests in the Tests directory. Some examples include |
168 | | - |
169 | | -* BiDirectional Communication |
170 | | -* Basic dApp Example |
| 9 | +WalletConnectSharp is an implementation of the [WalletConnect](https://walletconnect.org/) protocol v2 using .NET. This library implements the [WalletConnect Technical Specification](https://docs.walletconnect.org/tech-spec) in .NET to allow C# dApps makers and wallet makers to add support for the open [WalletConnect](https://walletconnect.org/) protocol. |
0 commit comments