账本类¶
获得最新账本信息¶
Node.JS Example¶
var Remote = require('jingtum-lib').Remote;
var remote = new Remote({server: 'ws://ts5.jingtum.com:5020', local_sign:true});
remote.connect(function (err, result) {
if(err) return console.log('err: ', err);
var req = remote.requestLedgerClosed();
req.submit(function(err, result) {
if(err) {return console.log('err:',err);}
console.log('get the latest ledger:', result);
});
});
C# Example¶
var remote = new Remote(@"ws://ts5.jingtum.com:5020", true);
remote.Connect(result =>
{
if(result.Exception != null)
{
Console.Write(result.Exception.Message);
}
else
{
var req = remote.RequestLedgerClosed();
req.Submit(reqResult =>
{
Console.Write(reqResult.Message);
// get result from reqResult.Result
});
}
});
获得指定账本信息¶
Node.JS Example¶
var Remote = require('jingtum-lib').Remote;
var remote = new Remote({server: 'ws://ts5.jingtum.com:5020', local_sign:true});
remote.connect(function (err, result) {
if(err) return console.log('err: ', err);
var req = remote.requestLedger({
ledger_index: '8488670',
transactions: true
});
req.submit(function(err, result) {
if(err) {return console.log('err:',err);}
console.log('get the latest ledger:', result);
});
});
C# Example¶
var remote = new Remote(@"ws://ts5.jingtum.com:5020", true);
remote.Connect(result =>
{
if(result.Exception != null)
{
Console.Write(result.Exception.Message);
}
else
{
var req = remote.RequestLedger(newLedgerOptions{ LedgerIndex = 330784, Transactions = true});
req.Submit(reqResult =>
{
Console.Write(reqResult.Message);
// get result from reqResult.Result
//账本信息在ledger属性中
});
}
});