Skip to content

Commit

Permalink
Merge pull request #80 from phantasma-io/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
TeknoPT authored May 5, 2023
2 parents a96684f + fea5190 commit 956f3b1
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 23 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/activation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Acquire activation file
on:
workflow_dispatch: {}
jobs:
activation:
name: Request manual activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- name: Request manual activation file
id: getManualLicenseFile
uses: game-ci/unity-request-activation-file@v2
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
5 changes: 3 additions & 2 deletions Assets/Phantasma/Phantasma.Core/src/Domain/WalletLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public struct Balance : IAPIResult
public string symbol;
public string value;
public int decimals;
public string[] ids;
}

public struct File: IAPIResult
Expand Down Expand Up @@ -132,7 +133,7 @@ private Connection ValidateRequest(string[] args)

protected abstract void Authorize(string dapp, string token, int version, Action<bool, string> callback);

protected abstract void GetAccount(string platform, Action<Account, string> callback);
protected abstract void GetAccount(string platform, int version, Action<Account, string> callback);

protected abstract void GetPeer(Action<string> callback);

Expand Down Expand Up @@ -259,7 +260,7 @@ private void HandleGetAccount(string[] args, Connection connection, int id, Acti
platform = "phantasma";
}

GetAccount(platform, (account, error) => {
GetAccount(platform, connection.Version, (account, error) => {
if (error == null)
{
success = true;
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scripts/Wallet/AccountManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3602,7 +3602,7 @@ internal void SettleSwap(string sourcePlatform, string destPlatform, string symb
// We swap some tokens into KCAL
script = ScriptUtils.BeginScript()
.CallContract("interop", "SettleTransaction", transcodedAddress, PlatformKind.Ethereum.ToString().ToLower(), PlatformKind.Ethereum.ToString().ToLower(), ethTxHash)
.CallContract("swap", "SwapFee", transcodedAddress, symbol, UnitConversion.ToBigInteger(0.1m, DomainSettings.FuelTokenDecimals))
.CallContract("swap", "SwapFee", transcodedAddress, symbol, UnitConversion.ToBigInteger(1m, DomainSettings.FuelTokenDecimals))
.AllowGas(transcodedAddress, Address.Null, phaGasPrice, phaGasLimit)
.TransferBalance(symbol, transcodedAddress, phantasmaKeys.Address)
.SpendGas(transcodedAddress)
Expand Down Expand Up @@ -3653,7 +3653,7 @@ internal void SettleSwap(string sourcePlatform, string destPlatform, string symb
// We swap some tokens into KCAL
script = ScriptUtils.BeginScript()
.CallContract("interop", "SettleTransaction", transcodedAddress, PlatformKind.BSC.ToString().ToLower(), PlatformKind.BSC.ToString().ToLower(), ethTxHash)
.CallContract("swap", "SwapFee", transcodedAddress, symbol, UnitConversion.ToBigInteger(0.1m, DomainSettings.FuelTokenDecimals))
.CallContract("swap", "SwapFee", transcodedAddress, symbol, UnitConversion.ToBigInteger(1m, DomainSettings.FuelTokenDecimals))
.AllowGas(address, Address.Null, accountManager.Settings.feePrice, accountManager.Settings.feeLimit)
.TransferBalance(symbol, transcodedAddress, phantasmaKeys.Address)
.SpendGas(address)
Expand Down
48 changes: 31 additions & 17 deletions Assets/Scripts/Wallet/WalletConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private void GetAddressesForTransaction(string subject, int id, Action<Address[]

}

protected override void GetAccount(string platform, Action<Account, string> callback)
protected override void GetAccount(string platform, int version, Action<Account, string> callback)
{
var targetPlatform = RequestPlatform(platform);
if (targetPlatform == PlatformKind.None)
Expand All @@ -124,31 +124,45 @@ protected override void GetAccount(string platform, Action<Account, string> call

var state = accountManager.CurrentState;

if (state != null)
if (state == null)
{
callback(new Account(), "not logged in, devs should implement this case!");
return;
}

IEnumerable<Balance> balances;

var balances = state.balances.Select(x => new Balance()
if (version >= 3)
{
balances = state.balances.Select(x => new Balance()
{
symbol = x.Symbol,
value = UnitConversion.ToBigInteger(x.Available, x.Decimals).ToString(),
decimals = x.Decimals,
ids = x.Ids
});

callback(new Account()
{
name = account.name,
alias = account.name,
address = AccountManager.Instance.MainState.address,
balances = balances.ToArray(),
avatar = state.avatarData,
platform = platform,
external = targetPlatform != PlatformKind.Phantasma ? state.address : ""
}, null);

return;
}
else
{
balances = state.balances.Select(x => new Balance()
{
symbol = x.Symbol,
value = UnitConversion.ToBigInteger(x.Available, x.Decimals).ToString(),
decimals = x.Decimals
});
}

callback(new Account()
{
name = account.name,
alias = account.name,
address = AccountManager.Instance.MainState.address,
balances = balances.ToArray(),
avatar = state.avatarData,
platform = platform,
external = targetPlatform != PlatformKind.Phantasma ? state.address : ""
}, null);

callback(new Account(), "not logged in, devs should implement this case!");
}

protected override void GetPeer(Action<string> callback)
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Wallet/WalletGUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5516,7 +5516,7 @@ private void RequestFee(string swapSymbol, string feeSymbol, decimal min, Action
var sb = new ScriptBuilder();
if (feeSymbol == "KCAL")
{
sb.CallContract("swap", "SwapFee", source, swapSymbol, UnitConversion.ToBigInteger(1m, decimalsSwap));
sb.CallContract("swap", "SwapFee", source, swapSymbol, UnitConversion.ToBigInteger(1m, decimals));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PlayerSettings:
16:10: 1
16:9: 1
Others: 1
bundleVersion: 2.8.5
bundleVersion: 2.8.6
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
Expand Down

0 comments on commit 956f3b1

Please sign in to comment.