Skip to content

Commit 27f4801

Browse files
authored
Added persistent auth on WebGL platform; Updated npm beacon-sdk and kukai-embed packages; (#130)
1 parent b192bf3 commit 27f4801

File tree

18 files changed

+396
-316
lines changed

18 files changed

+396
-316
lines changed

CHANGELOG.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8-
## [unreleased]
8+
## [2.0.6]
99
### Changed
10-
- Disabled Kukai Embed silent signing
11-
- Updated Kukai Embed to `0.8.9`
10+
- Disabled `Kukai Embed` silent signing
11+
- Updated `Kukai Embed` to `0.8.9`
12+
- Updated `@airgap/beacon-sdk` to `4.0.12`
13+
14+
### Added
15+
- Persistent auth on WebGL platform
1216

1317

1418
## [2.0.5] - 2023-08-12
@@ -158,7 +162,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
158162
- Added auto releases with GH actions
159163

160164

161-
[unreleased]: https://github.com/trilitech/tezos-unity-sdk/compare/2.0.5...HEAD
165+
[unreleased]: https://github.com/trilitech/tezos-unity-sdk/compare/2.0.6...HEAD
166+
[2.0.6]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/2.0.6
162167
[2.0.5]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/2.0.5
163168
[2.0.4]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/2.0.4
164169
[2.0.3]: https://github.com/trilitech/tezos-unity-sdk/releases/tag/2.0.3

Runtime/Scripts/Beacon/BeaconConnection.jslib

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@ mergeInto(LibraryManager.library, {
4242
UTF8ToString(delegateAddress)
4343
);
4444
},
45+
46+
JsUnityReadyEvent: function () {
47+
UnityReadyEvent();
48+
}
4549
});

Runtime/Scripts/Beacon/BeaconConnectorDotNet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,10 @@ private async void OnBeaconDappClientMessageReceived(object sender, BeaconMessag
298298
}
299299
}
300300
}
301+
302+
public void OnReady()
303+
{
304+
}
301305

302306
#endregion
303307

Runtime/Scripts/Beacon/BeaconConnectorWebGl.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,24 @@ public class BeaconConnectorWebGl : IBeaconConnector
3434

3535
[DllImport("__Internal")]
3636
private static extern string JsRequestContractOrigination(string script, string delegateAddress);
37+
38+
[DllImport("__Internal")]
39+
private static extern string JsUnityReadyEvent();
3740

3841
#endregion
3942

4043
private string _activeAccountAddress;
41-
44+
4245
public void InitWalletProvider(string network, string rpc, WalletProviderType walletProviderType)
4346
{
4447
JsInitWallet(network, rpc, walletProviderType.ToString());
4548
}
4649

50+
public void OnReady()
51+
{
52+
JsUnityReadyEvent();
53+
}
54+
4755
public void ConnectAccount()
4856
{
4957
JsConnectAccount();

Runtime/Scripts/Beacon/IBeaconConnector.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ public interface IBeaconConnector
1717
/// <param name="rpc">Uri of an specific RPC.</param>
1818
/// <param name="walletProviderType">Type of wallet, e.g. "beacon" or "kukai"</param>
1919
void InitWalletProvider(string network, string rpc, WalletProviderType walletProviderType);
20+
21+
/// <summary>
22+
/// Callback that needed in WebGL to determine that UI is rendered
23+
/// </summary>
24+
void OnReady();
2025

2126
/// <summary>
2227
/// Starts the connection between Beacon SDK and a wallet to connect to

Runtime/Scripts/Tezos/Wallet/IWalletProvider.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ public interface IWalletProvider
99
/// Exposes a MonoBehaviour class that exposes wallet events
1010
/// </summary>
1111
WalletMessageReceiver MessageReceiver { get; }
12+
13+
/// <summary>
14+
/// Callback that needed in WebGL to determine that UI is rendered
15+
/// </summary>
16+
void OnReady();
1217

1318
/// <summary>
1419
/// Makes a call to connect with a wallet

Runtime/Scripts/Tezos/Wallet/WalletProvider.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,14 @@ private IEnumerator OnOpenWallet(bool withRedirectToWallet)
9595
#endif
9696
}
9797

98+
public void OnReady()
99+
{
100+
_beaconConnector.OnReady();
101+
}
102+
98103
public void Connect(WalletProviderType walletProvider, bool withRedirectToWallet)
99104
{
105+
100106
_beaconConnector.InitWalletProvider(
101107
network: TezosConfig.Instance.Network.ToString(),
102108
rpc: TezosConfig.Instance.RpcBaseUrl,

Samples~/Scripts/DemoExample/Core/ExampleManager.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,5 +471,10 @@ public void GetOriginatedContracts(Action<IEnumerable<TokenContract>> callback)
471471
var routine = Tezos.GetOriginatedContracts(callback);
472472
CoroutineRunner.Instance.StartWrappedCoroutine(routine);
473473
}
474+
475+
public void OnReady()
476+
{
477+
Tezos.Wallet.OnReady();
478+
}
474479
}
475480
}

Samples~/Scripts/DemoExample/Core/IExampleManager.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace TezosSDK.Samples.DemoExample
1111
{
1212
public interface IExampleManager
1313
{
14-
ITezos Tezos { get; }
14+
ITezos Tezos { get; }
1515

1616
public void Init(Action<bool> callback = null);
1717
public void Unpair();
@@ -139,5 +139,10 @@ public interface IExampleManager
139139
/// </summary>
140140
/// <param name="callback">callback that takes the retrieved contracts(IEnumerable)</param>
141141
void GetOriginatedContracts(Action<IEnumerable<TokenContract>> callback);
142+
143+
/// <summary>
144+
/// Callback that needed in WebGL to determine that UI is rendered
145+
/// </summary>
146+
void OnReady();
142147
}
143148
}

Samples~/Scripts/DemoExample/UI/RegisterPanel.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,15 @@ private IEnumerator Start()
3434
// make QR code available for Standalone
3535
_qrImage.gameObject.SetActive(true);
3636
#elif (UNITY_IOS || UNITY_ANDROID)
37-
SetButtonState(_deepLinkPair, true, true);
37+
SetButtonState(_deepLinkPair, true, true);
3838
#elif UNITY_WEBGL
39-
SetButtonState(_deepLinkPair, true, true);
40-
SetButtonState(_socialLoginButton, true, true);
39+
ExampleFactory
40+
.Instance
41+
.GetExampleManager()
42+
.OnReady();
43+
44+
SetButtonState(_deepLinkPair, true, true);
45+
SetButtonState(_socialLoginButton, true, true);
4146
#endif
4247
}
4348

0 commit comments

Comments
 (0)