1
0
Fork 0
merge-requests/1/head
progr76@gmail.com 2019-02-18 17:03:36 +03:00
parent ce5a3b57e3
commit 501ea7c584
6 changed files with 18 additions and 5 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
# API v2 (for exchanges)
Works with update version 0.895
Works with update version 0.897
The API is designed to make it easier to write third-party applications. Server-side cryptography and POW operations are performed. Therefore, it is not recommended for public access, because it is not protected from DDOS attacks. Use it if applications such as the exchange server are on the same private network.
@ -233,6 +233,7 @@ option to set parameters for organizing page navigation:
Advanced setting:
* GetTxID - if set to 1, the transaction ID in hex-format is returned in the TxID field
* GetDescription - if set to 1, the transaction description is returned
example1:

View File

@ -1,5 +1,5 @@
# API v2 (для бирж и обменников)
Работает с версии обновления 0.895
Работает с версии обновления 0.897
API предназначено для облегчения написания сторонних приложений. На стороне сервера выполняется криптография и операции POW. Поэтому оно не рекомендуется для публичного доступа, т.к. нет защиты от DDOS атак. Используйте его, если приложения такие как сервер биржи находятся в одной приватной сети.
@ -244,6 +244,7 @@ return:
Дополнительные параметры:
* GetTxID - если стоит 1 - то возвращается в поле TxID возвращается ID транзакции в 16 формате
* GetDescription - если стоит 1 - то возвращается описание транзакции в поле Description (если это описание доступно)
example1:

View File

@ -8,7 +8,7 @@
* Telegram: https://web.telegram.org/#/im?p=@terafoundation
*/
global.UPDATE_CODE_VERSION_NUM = 895;
global.UPDATE_CODE_VERSION_NUM = 897;
global.MIN_CODE_VERSION_NUM = 884;
global.MINING_VERSION_NUM = 3;
global.InitParamsArg = InitParamsArg;

View File

@ -156,7 +156,7 @@ WebApi2.GetHistoryTransactions = function (Params)
if(!Params.Count)
Params.Count = 100;
var arr = DApps.Accounts.GetHistory(Params.AccountID, Params.Count, Params.NextPos);
if(Params.GetTxID)
if(Params.GetTxID || Params.GetDescription)
{
for(var i = 0; i < arr.length; i++)
{
@ -167,7 +167,18 @@ WebApi2.GetHistoryTransactions = function (Params)
var Body = Block.arrContent[Item.TrNum];
if(!Body)
continue;
Item.TxID = GetHexFromArr(GetTxID(Item.BlockNum, Body));
if(Params.GetTxID)
{
Item.TxID = GetHexFromArr(GetTxID(Item.BlockNum, Body));
}
if(Params.GetDescription)
{
var TR = DApps.Accounts.GetObjectTransaction(Body);
if(TR)
{
Item.Description = TR.Description;
}
}
}
}
var Result = {result:arr.length > 0 ? 1 : 0, History:arr, Tail:DApps.Accounts.DBStateHistory.Read(Params.AccountID), Meta:Params ? Params.Meta : undefined};