Skip navigation

Monthly Archives: maggio 2014

var Remote = require('ripple-lib').Remote;
var Amount = require('ripple-lib').Amount;

var MY_ADDRESS = 'public_key';
var MY_SECRET = 'private_key';

var SPURKLE = 'gateway_public_key';

var remote = new Remote({
// trace: true,
trusted: true,
local_signing: true,
secure: true,
servers: [
{
host : 's1.Ripple.com',
port : 443,
ssl : true
}]
});

console.log( 'Starting: %s', JSON.stringify( remote.servers ) );

remote.connect( function() {

console.log( 'Connected.' );

// remote.on('transaction_all', transactionListener);

// remote.on('ledger_closed', ledgerListener);

remote.set_secret( MY_ADDRESS, MY_SECRET );

var transaction = remote.transaction();

transaction.offer_create({
from: MY_ADDRESS,
taker_pays: { currency: 'EUR', value: '1', issuer: SPURKLE },
taker_gets: { currency: 'USD', value: '1.3', issuer: SPURKLE }
});

transaction.submit( function( err, res ) {

console.log( JSON.stringify( err, null, 4 ) );

console.log( JSON.stringify( res, null, 4 ) );
});

});

function transactionListener (transaction_data) {
// handle transaction_data
// see https://ripple.com/wiki/RPC_API#transactions_stream_messages for the format of transaction_data
console.log(transaction_data);
}

function ledgerListener (ledger_data) {
// handle ledger_data
// see https://ripple.com/wiki/RPC_API#ledger_stream_messages for the format of ledger_data
console.log(ledger_data);
}

Annunci

https://ripple.com/wiki/Arbitrage

https://ripple.com/wiki/Example_API_Transactions


git push origin 7b60af4738e866eb3ddbcb1073ef8f2946db9f9c:master

Note that all commits before the specified one are also pushed. If you want to push just one commit, rebase -i first and then move the wanted commit at the top of the queue.