-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathSimpleExample.cs
71 lines (63 loc) · 2.19 KB
/
SimpleExample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using WalletConnectSharp.Core;
using WalletConnectSharp.Sign;
using WalletConnectSharp.Sign.Models;
using WalletConnectSharp.Sign.Models.Engine;
namespace WalletConnectSharp.Examples
{
public class SimpleExample : IExample
{
public string Name
{
get { return "simple_example"; }
}
public async Task Execute(string[] args)
{
var options = new SignClientOptions()
{
ProjectId = "ef21cf313a63dbf63f2e9e04f3614029",
Metadata = new Metadata()
{
Description = "An example project to showcase WalletConnectSharpv2",
Icons = new[] { "https://walletconnect.com/meta/favicon.ico" },
Name = "WalletConnectSharpv2 Example",
Url = "https://walletconnect.com"
}
};
var client = await WalletConnectSignClient.Init(options);
var connectData = await client.Connect(new ConnectOptions()
{
RequiredNamespaces = new RequiredNamespaces()
{
{
"eip155", new ProposedNamespace()
{
Methods = new[]
{
"eth_sendTransaction",
"eth_signTransaction",
"eth_sign",
"personal_sign",
"eth_signTypedData",
},
Chains = new[]
{
"eip155:1"
},
Events = new[]
{
"chainChanged", "accountsChanged"
}
}
}
}
});
Console.WriteLine(connectData.Uri);
await connectData.Approval;
Console.WriteLine("Connected");
while (true)
{
await Task.Delay(2000);
}
}
}
}