Skip to content

Commit

Permalink
Merge pull request #102 from Ashuaidehao/dev-back
Browse files Browse the repository at this point in the history
rc1 testnet
  • Loading branch information
Ashuaidehao committed Mar 25, 2021
2 parents 6416a2e + 2ac6f75 commit d1a158e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion neo3-gui/neo3-gui/ClientApp/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion neo3-gui/neo3-gui/ClientApp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neo-gui",
"version": "1.2.2",
"version": "1.2.3",
"private": true,
"main": "main.js",
"homepage": "./",
Expand Down
9 changes: 5 additions & 4 deletions neo3-gui/neo3-gui/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,22 +305,23 @@ public static string SafeSerialize(this ContractParametersContext signContext)
/// <param name="script"></param>
/// <param name="signers"></param>
/// <returns></returns>
public static Transaction InitTransaction(this Wallet wallet, byte[] script, params UInt160[] signers)
public static Transaction InitTransaction(this Wallet wallet, byte[] script, UInt160 sender = null, params UInt160[] signers)
{
var cosigners = signers.Select(account => new Signer { Account = account, Scopes = WitnessScope.Global }).ToArray();
return InitTransaction(wallet, script, cosigners);
return InitTransaction(wallet, script, sender, cosigners);
}

/// <summary>
/// create tx by script and signer
/// </summary>
/// <param name="wallet"></param>
/// <param name="script"></param>
/// <param name="sender"></param>
/// <param name="signers"></param>
/// <returns></returns>
public static Transaction InitTransaction(this Wallet wallet, byte[] script, params Signer[] signers)
public static Transaction InitTransaction(this Wallet wallet, byte[] script, UInt160 sender = null, params Signer[] signers)
{
var tx = wallet.MakeTransaction(GetDefaultSnapshot(), script, null, signers, maxGas: 2000_00000000);
var tx = wallet.MakeTransaction(GetDefaultSnapshot(), script, sender, signers, maxGas: 2000_00000000);
return tx;
}

Expand Down
2 changes: 1 addition & 1 deletion neo3-gui/neo3-gui/Models/ErrorCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public enum ErrorCode
UnknownContract = 20028,
[Description("Contract already onchain.")]
ContractAlreadyExist = 20029,
[Description("Validator already exits.")]
[Description("Validator already exists.")]
ValidatorAlreadyExist = 20030,
[Description("No gas for claim.")]
NoNeedClaimGas = 20031,
Expand Down
11 changes: 7 additions & 4 deletions neo3-gui/neo3-gui/Services/ApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ protected WsError Error(int code, string message)
return new WsError() { Code = code, Message = message };
}



protected async Task<object> SignAndBroadcastTx(byte[] script, params UInt160[] signers)
protected async Task<object> SignAndBroadcastTxWithSender(byte[] script, UInt160 sender, params UInt160[] signers)
{
Transaction tx;
try
{
tx = CurrentWallet.InitTransaction(script, signers);
tx = CurrentWallet.InitTransaction(script, sender, signers);
}
catch (InvalidOperationException ex)
{
Expand All @@ -68,5 +66,10 @@ protected async Task<object> SignAndBroadcastTx(byte[] script, params UInt160[]
result.TxId = tx.Hash;
return result;
}

protected async Task<object> SignAndBroadcastTx(byte[] script, params UInt160[] signers)
{
return await SignAndBroadcastTxWithSender(script, null, signers);
}
}
}
5 changes: 2 additions & 3 deletions neo3-gui/neo3-gui/Services/ApiServices/ContractApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public async Task<object> InvokeContract(InvokeContractParameterModel para)

try
{
tx = CurrentWallet.InitTransaction(sb.ToArray(), signers.ToArray());
tx = CurrentWallet.InitTransaction(sb.ToArray(), null, signers.ToArray());
}
catch (InvalidOperationException ex)
{
Expand Down Expand Up @@ -428,8 +428,7 @@ public async Task<object> ApplyForValidator(string pubkey)
var account = contract.ScriptHash;
using ScriptBuilder sb = new ScriptBuilder();
sb.EmitDynamicCall(NativeContract.NEO.Hash, "registerCandidate", publicKey);

return await SignAndBroadcastTx(sb.ToArray(), account);
return await SignAndBroadcastTxWithSender(sb.ToArray(), account, account);
}


Expand Down
49 changes: 23 additions & 26 deletions neo3-gui/neo3-gui/config.testnet.json
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
{
"ApplicationConfiguration": {
"Logger": {
"Path": "Logs",
"ConsoleOutput": true,
"Active": true
"Path": "Logs_{0}",
"ConsoleOutput": false,
"Active": false
},
"Storage": {
"Engine": "LevelDBStore",
"Path": "Data_LevelDB_6713213"
"Path": "Data_LevelDB_827601742"
},
"P2P": {
"Port": 21333,
"WsPort": 21334
"Port": 30333,
"WsPort": 30334
},
"UnlockWallet": {
"Path": "0.json",
"Password": "123456",
"IsActive": true
"Path": "",
"Password": "",
"IsActive": false
},
"PluginURL": "https://github.com/neo-project/neo-modules/releases/download/v{1}/{0}.zip"
},
"ProtocolConfiguration": {
"Magic": 6713213,
"Magic": 827601742,
"MillisecondsPerBlock": 15000,
"MaxTraceableBlocks": 2102400,
"ValidatorsCount": 7,
"StandbyCommittee": [
"02179543000184781e5447b3f0fbace664ea92b7e31227c8e71bc4e7cdafccdb8e",
"038415d0be8dc12b61d3e3b76b98f464dfab7fddee74271c35e2de624bb51023a6",
"03c9b1c89c6e2d4abd629a2db8b7d03aced518a56793bc90f4985ef7ed3f1b481a",
"0302242b1dced63e1bf7eb14876f7ef026b79567f9c5be83de1943dd185ec28e68",
"025e8494903b93dc369f08a2bd7e221f574c75d9675591f04907cba9daeeb83d10",
"03e8ab5186e1deabcd10ec0e509ded4fffade6fddf534ac3e0506268bae3fd44a6",
"020df8858b66ff4d7b0a6a68d11ddedcc7d90d2a64ffa2cd087c4c5dabf4150b40",
"02f5f04a6036caedd68b5bd36e33105c0e9f43c0592e9f9f2188b1659be993bb5e",
"0279ed5e9ed91547e332a4f27135eebff5daab6c978b57992d8ee0359ccb9f5e8b",
"02ff249d06faaf0b5ba865e1531bfabe07f89aef39ab59082e3bc140be0318055d"
"023e9b32ea89b94d066e649b124fd50e396ee91369e8e2a6ae1b11c170d022256d",
"03009b7540e10f2562e5fd8fac9eaec25166a58b26e412348ff5a86927bfac22a2",
"02ba2c70f5996f357a43198705859fae2cfea13e1172962800772b3d588a9d4abd",
"03408dcd416396f64783ac587ea1e1593c57d9fea880c8a6a1920e92a259477806",
"02a7834be9b32e2981d157cb5bbd3acb42cfd11ea5c3b10224d7a44e98c5910f1b",
"0214baf0ceea3a66f17e7e1e839ea25fd8bed6cd82e6bb6e68250189065f44ff01",
"030205e9cefaea5a1dfc580af20c8d5aa2468bb0148f1a5e4605fc622c80e604ba"
],
"SeedList": [
"seed1t.neo.org:21333",
"seed2t.neo.org:21333",
"seed3t.neo.org:21333",
"seed4t.neo.org:21333",
"seed5t.neo.org:21333"
"seed1t.neo.org:20333",
"seed2t.neo.org:20333",
"seed3t.neo.org:20333",
"seed4t.neo.org:20333",
"seed5t.neo.org:20333"
]
}
}
}

0 comments on commit d1a158e

Please sign in to comment.