-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathProgram.cs
53 lines (43 loc) · 2.13 KB
/
Program.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
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using TonLibDotNet.Types;
namespace TonLibDotNet
{
public static class Program
{
// You will need actual mnemonic and address with some coins to run tests like SendTon, SendJetton etc.
// These tests have safeguards and will not run on mainnet.
// But anyway, double check that you are using testnet and what tests are uncommented before putting actual seed phrase here!!!
public const string TestAddress = "EQAkEWzRLi1sw9AlaGDDzPvk2_F20hjpTjlvsjQqYawVmdT0";
public const string TestMnemonic = ""; // put space-delimited mnemonic words here
// Some tests need mainnet (e.g. domains), some will run only in testnet (e.g. sending coins).
public const bool UseMainnet = true;
private const string DirectoryForKeys = "D:/Temp/keys";
public static async Task Main(string[] args)
{
var builder = Host.CreateDefaultBuilder(args);
builder.UseConsoleLifetime();
builder.ConfigureServices((context, services) =>
{
services.Configure<TonOptions>(o =>
{
o.UseMainnet = UseMainnet;
o.LogTextLimit = 500; // Set to 0 to see full requests/responses
o.VerbosityLevel = 0;
o.Options.KeystoreType = new KeyStoreTypeDirectory(DirectoryForKeys);
});
services.AddHostedService<SamplesRunner>();
services.AddSingleton<ITonClient, TonClient>();
var samples = typeof(Program).Assembly.GetTypes().Where(x => x.IsClass && x.IsAssignableTo(typeof(ISample))).ToList();
foreach (var sample in samples)
{
services.AddTransient(typeof(ISample), sample);
}
});
/// Add types from current assembly (see <see cref="LibraryExtensibility"/> class for more info).
TonClient.RegisterAssembly(typeof(Program).Assembly);
var app = builder.Build();
await app.RunAsync();
}
}
}