3

How do I implement the issuance of a loan with a pledge?

I want to send a loan from a multi-signature account and receive a pledge in the form of custom tokens in a single transaction.

At the moment I'm stuck in this place:

const transaction = new Stellar.TransactionBuilder(loan)
    .addOperation(Stellar.Operation.payment({
      destination: borrowerPublicKey,
      asset: Stellar.Asset.native(),
      amount
    }))
    .addOperation(... receive custom tokens)
    .build();
4
const transaction = new Stellar.TransactionBuilder(loan)
    .addOperation(Stellar.Operation.payment({
      destination: borrowerPublicKey,
      asset: Stellar.Asset.native(),
      amount
    }))
    .addOperation(Stellar.Operation.payment({
      destination: loan,
      asset: new Stellar.Asset('LOAN', loan),
      amount,
      source: borrowerPublicKey
    }))
    .build()

You'll need signatures from both the loan and borrowerPublicKey accounts, otherwise the transaction will fail. To achieve this you can prepare and sign a transaction with loan secret key on the server, and then request a signature from the borrower on the client side.

  • Thanks, this is exactly what i was looking for. – Tim Golovchak Dec 26 '18 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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