-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAuthenticationTests.cs
More file actions
94 lines (80 loc) · 3.45 KB
/
AuthenticationTests.cs
File metadata and controls
94 lines (80 loc) · 3.45 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Numerics;
using System.Threading.Tasks;
using NUnit.Framework;
using Sequence.EcosystemWallet.Primitives;
using Sequence.EcosystemWallet.Primitives.Common;
using Sequence.Utils;
using UnityEngine;
namespace Sequence.EcosystemWallet.UnitTests
{
public class AuthenticationTests
{
private static readonly Chain Chain = Chain.TestnetArbitrumSepolia;
[Test]
public void Disconnect()
{
SequenceWallet.RecoverFromStorage().Disconnect();
}
[Test]
public async Task TestGetEcosystemConfig()
{
var config = await new SequenceConnect().GetEcosystemConfig();
Debug.Log($"Ecosystem Name: {config.name}");
foreach (var provider in config.enabledProviders)
Debug.Log($"Provider: {provider}");
}
[Test]
public async Task CreateSessionForExplicitEmit()
{
var deadline = new BigInteger(DateTimeOffset.UtcNow.ToUnixTimeSeconds() + 1000 * 60);
var permissions = new ContractPermission(Chain, new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA"),
deadline, 0);
var connect = new SequenceConnect();
await connect.SignInWithGoogle(permissions);
}
[Test]
public async Task CreateSessionForSafeMint()
{
var deadline = new BigInteger(DateTimeOffset.UtcNow.ToUnixTimeSeconds() + 1000 * 60);
var permissions = new ContractPermission(Chain, new Address("0xd25b37e2fb07f85e9eca9d40fe3bcf60ba2dc57b"),
deadline, 0);
permissions.AddRule(new ParameterRule
{
cumulative = false,
mask = "0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff".HexStringToByteArray(),
offset = new BigInt(4),
operation = (int)ParameterOperation.equal,
value = "0x000000000000000000000000bd7f38b943452e0c14d7ba92b9b504a9c9fc3518".HexStringToByteArray(),
});
var connect = new SequenceConnect();
await connect.SignInWithGoogle(permissions);
}
[Test]
public async Task CallExplicitEmit()
{
var wallet = SequenceWallet.RecoverFromStorage();
await wallet.SendTransaction(Chain,
new Transaction(new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA"), 0, "explicitEmit()"));
}
[Test]
public async Task CallSafeMint()
{
var wallet = SequenceWallet.RecoverFromStorage();
await wallet.SendTransaction(Chain,
new Transaction(new Address("0xd25b37e2fb07f85e9eca9d40fe3bcf60ba2dc57b"), 0, "safeMint(address)", wallet.Address));
}
[Test]
public async Task AddUnrestrictiveExplicitSession()
{
var wallet = SequenceWallet.RecoverFromStorage();
await wallet.AddSession(new ContractPermission(Chain, new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA"), 0, 0));
}
[Test]
public async Task AddRestrictiveExplicitSession()
{
var wallet = SequenceWallet.RecoverFromStorage();
await wallet.AddSession(new ContractPermission(Chain, new Address("0x33985d320809E26274a72E03268c8a29927Bc6dA"), 0, 0));
}
}
}