2

In Ripple API,

Is there any apis available to split payment which I can pass more than one destination address in single transaction.

Let me share code:

const RippleAPI = require('ripple-lib').RippleAPI;

const api = new RippleAPI({
    server: 'wss://s.altnet.rippletest.net:51233' // Public rippled server
});



//Payment API:
const address = 'r4Ct32uDZvL9e5GRbPftAnu8rpCg7aXXXX';
const secret = 'shvtBfNDJ3yf9sqGoc7XUgSTnXXXX';
const instructions = {maxLedgerVersionOffset: 5};
const payment = {
    source: {
        address: address,
        maxAmount: {
            value: '1.01',
            currency: 'XRP'
        }
    },
    destination: [{
        address: 'rn8KqzsH7b8fGZYmbaDXinLb8XffneXXXX',
        amount: {
            value: '1.01',
            currency: 'XRP'
        }
    },
    {
        address: 'rn8KqzsH7b8fGZYmbaDXinLb8XffneXXXX',
        amount: {
            value: '2.01',
            currency: 'XRP'
        }
    }]
};
function quit(message) {
    console.log(message);
    process.exit(0);
}
function fail(message) {
    console.error(message);
    process.exit(1);
}
api.connect().then(() => {
    console.log('Connected...');
    return api.preparePayment(address, payment, instructions).then(prepared => {
        console.log('Payment transaction prepared...');
        const {signedTransaction} = api.sign(prepared.txJSON, secret);
        console.log('Payment transaction signed...');
        api.submit(signedTransaction).then(quit, fail);
    });
}).catch(fail);

Currently, I am getting error I am passing designation address in array. But If i will as object then it will work fine. But I need to pass more than one address in single transaction.

Can you please give solution ASAP about it?

1 Answer 1

1

for now there is none... you can only use single destination address

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.