Skip to content

Commit 580fb75

Browse files
authored
Merge pull request #29 from ixian-platform/jaka/feat/mini-apps-UI-screens
feat: mini apps ui screens
2 parents 9ed2118 + 826eee7 commit 580fb75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+7906
-4466
lines changed

Spixi/CustomApps/CustomApp.cs

Lines changed: 0 additions & 68 deletions
This file was deleted.

Spixi/Meta/Config.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using IXICore;
22
using IXICore.Meta;
3-
using System.IO;
43

54
namespace SPIXI.Meta
65
{

Spixi/Meta/Node.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Newtonsoft.Json;
77
using Newtonsoft.Json.Linq;
88
using Spixi;
9-
using SPIXI.CustomApps;
9+
using SPIXI.MiniApps;
1010
using SPIXI.Network;
1111
using SPIXI.Storage;
1212
using System.Text;
@@ -38,12 +38,14 @@ class Node : IxianNode
3838
public static int startCounter = 0;
3939

4040
public static bool shouldRefreshContacts = true;
41+
public static bool shouldRefreshApps = true;
4142

4243
public static bool refreshAppRequests = true;
4344

4445
public static TransactionInclusion tiv = null;
4546

46-
public static CustomAppManager customAppManager = null;
47+
public static MiniAppManager MiniAppManager = null;
48+
public static MiniAppStorage MiniAppStorage = null;
4749

4850
public static bool generatedNewWallet = false;
4951

@@ -86,7 +88,8 @@ public Node()
8688
// Prepare the local storage
8789
localStorage = new SPIXI.Storage.LocalStorage(Config.spixiUserFolder);
8890

89-
customAppManager = new CustomAppManager(Config.spixiUserFolder);
91+
MiniAppManager = new MiniAppManager(Config.spixiUserFolder);
92+
MiniAppStorage = new MiniAppStorage(Config.spixiUserFolder);
9093

9194
FriendList.init(Config.spixiUserFolder);
9295

@@ -163,7 +166,7 @@ static public void start()
163166
// Start the transfer manager
164167
TransferManager.start();
165168

166-
customAppManager.start();
169+
MiniAppManager.start();
167170

168171
startCounter++;
169172

@@ -310,7 +313,7 @@ static public void stop()
310313

311314
localStorage.stop();
312315

313-
customAppManager.stop();
316+
MiniAppManager.stop();
314317

315318
// Stop TIV
316319
tiv.stop();
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace SPIXI.MiniApps.ActionRequestModels
2+
{
3+
public class AuthData
4+
{
5+
public string challenge;
6+
}
7+
8+
public class AuthAction : MiniAppActionBase
9+
{
10+
public AuthData data;
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace SPIXI.MiniApps.ActionRequestModels
2+
{
3+
public class MiniAppActionBase
4+
{
5+
public string command;
6+
public string requestId;
7+
public string responseUrl;
8+
}
9+
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
using IXICore;
2+
using IXICore.RegNames;
3+
4+
namespace SPIXI.MiniApps.ActionRequestModels
5+
{
6+
public class RegNameAction<T> : MiniAppActionBase
7+
{
8+
public T data;
9+
public Address? feeRecipientAddress;
10+
public IxiNumber? feeAmount;
11+
public RegisteredNameRecord? nameRecord;
12+
public List<RegisteredNameDataRecord>? nameDataRecords;
13+
14+
public RegNameAction(T data, string? feeRecipientAddress, string? feeAmount, byte[]? nameRecord, byte[][]? nameDataRecords)
15+
{
16+
this.data = data;
17+
if (feeRecipientAddress != null)
18+
{
19+
this.feeRecipientAddress = new Address(feeRecipientAddress);
20+
}
21+
22+
if (feeAmount != null)
23+
{
24+
this.feeAmount = new IxiNumber(feeAmount);
25+
}
26+
27+
if (nameRecord != null)
28+
{
29+
this.nameRecord = new RegisteredNameRecord(nameRecord);
30+
}
31+
32+
if (nameDataRecords != null)
33+
{
34+
this.nameDataRecords = new();
35+
foreach (var record in nameDataRecords)
36+
{
37+
this.nameDataRecords.Add(new RegisteredNameDataRecord(record, true));
38+
}
39+
}
40+
}
41+
}
42+
43+
public class RegNameActionBase
44+
{
45+
public RegNameInstruction instruction { get; protected set; }
46+
public string decodedName { get; protected set; }
47+
public byte[] name { get; protected set; }
48+
public Address nextPkHash { get; protected set; }
49+
public byte[] signaturePk { get; protected set; }
50+
public byte[] signature { get; protected set; }
51+
public RegNameActionBase(RegNameInstruction instruction, string name, string nextPkHash, byte[] signaturePk, byte[] signature)
52+
{
53+
this.instruction = instruction;
54+
this.decodedName = name;
55+
this.name = IxiNameUtils.encodeAndHashIxiName(name);
56+
if (nextPkHash != null)
57+
{
58+
this.nextPkHash = new Address(nextPkHash);
59+
}
60+
this.signaturePk = signaturePk;
61+
this.signature = signature;
62+
}
63+
64+
protected RegNameActionBase() { }
65+
}
66+
67+
public class RegNameRegisterAction : RegNameActionBase
68+
{
69+
public uint registrationTimeInBlocks { get; private set; }
70+
public Address recoveryHash { get; private set; }
71+
public uint capacity { get; private set; }
72+
73+
public RegNameRegisterAction(string name, uint registrationTime, uint capacity, string nextPkHash, string recoveryHash)
74+
: base(RegNameInstruction.register, name, nextPkHash, null, null)
75+
{
76+
this.registrationTimeInBlocks = registrationTime;
77+
this.capacity = capacity;
78+
this.recoveryHash = new Address(recoveryHash);
79+
}
80+
}
81+
82+
public class RegNameExtendAction : RegNameActionBase
83+
{
84+
public uint extensionTimeInBlocks { get; private set; }
85+
public RegNameExtendAction(string name, uint extensionTimeInBlocks)
86+
: base(RegNameInstruction.extend, name, null, null, null)
87+
{
88+
this.extensionTimeInBlocks = extensionTimeInBlocks;
89+
}
90+
91+
}
92+
93+
public class RegNameChangeCapacityAction : RegNameActionBase
94+
{
95+
public uint newCapacity { get; private set; }
96+
public ulong sequence { get; private set; }
97+
98+
public RegNameChangeCapacityAction(string name, uint newCapacity, ulong sequence, string nextPkHash, byte[] sigPk, byte[] signature)
99+
: base(RegNameInstruction.changeCapacity, name, nextPkHash, sigPk, signature)
100+
{
101+
this.newCapacity = newCapacity;
102+
this.sequence = sequence;
103+
}
104+
105+
}
106+
107+
public class RegNameRecoverAction : RegNameActionBase
108+
{
109+
public Address newRecoveryHash { get; private set; }
110+
public ulong sequence { get; private set; }
111+
public RegNameRecoverAction(string name, ulong sequence, string nextPkHash, string newRecoveryHash, byte[] recoveryPk, byte[] recoverySig)
112+
: base(RegNameInstruction.recover, name, nextPkHash, recoveryPk, recoverySig)
113+
{
114+
this.newRecoveryHash = new Address(newRecoveryHash);
115+
this.sequence = sequence;
116+
}
117+
118+
}
119+
120+
public class RegNameActionDataRecord
121+
{
122+
public string? name { get; private set; }
123+
public int ttl { get; private set; }
124+
public string data { get; private set; }
125+
public byte[]? checksum { get; private set; }
126+
127+
public RegNameActionDataRecord(string? name, int ttl, string data, byte[]? checksum)
128+
{
129+
this.name = name;
130+
this.ttl = ttl;
131+
this.data = data;
132+
this.checksum = checksum;
133+
}
134+
}
135+
136+
public class RegNameUpdateRecordsAction : RegNameActionBase
137+
{
138+
public RegNameActionDataRecord[] records { get; private set; }
139+
public ulong sequence { get; private set; }
140+
public RegNameUpdateRecordsAction(string name, RegNameActionDataRecord[] records, ulong sequence, string nextPkHash, byte[] pkSig, byte[] signature)
141+
: base(RegNameInstruction.updateRecord, name, nextPkHash, pkSig, signature)
142+
{
143+
this.records = records;
144+
this.sequence = sequence;
145+
}
146+
147+
}
148+
149+
public class RegNameToggleAllowSubnamesAction : RegNameActionBase
150+
{
151+
public bool allowSubnames { get; private set; }
152+
public IxiNumber fee { get; private set; }
153+
public Address feeRecipientAddress { get; private set; }
154+
public ulong sequence { get; private set; }
155+
156+
public RegNameToggleAllowSubnamesAction(string name, bool allowSubnames, IxiNumber fee, string feeRecipientAddress, ulong sequence, string nextPkHash, byte[] pkSig, byte[] signature)
157+
: base(RegNameInstruction.toggleAllowSubnames, name, nextPkHash, pkSig, signature)
158+
{
159+
this.allowSubnames = allowSubnames;
160+
this.fee = fee;
161+
this.feeRecipientAddress = new Address(feeRecipientAddress);
162+
this.sequence = sequence;
163+
}
164+
165+
}
166+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace SPIXI.MiniApps.ActionResponseModels
2+
{
3+
public class AuthResponse
4+
{
5+
public string challenge;
6+
public string publicKey;
7+
public string signature;
8+
public string requestId;
9+
}
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace SPIXI.MiniApps.ActionResponseModels
2+
{
3+
public class TransactionResponse
4+
{
5+
public string tx;
6+
public string requestId;
7+
}
8+
}

0 commit comments

Comments
 (0)