I want to send non-native assets to new stellar accounts. To do this, I understand that I need to create a new account by funding it with XLM (1 XLM minimum), add a trust line to the asset issuer and then transfer the asset from my account to the new account. I want to do this in one transaction. This is what I have so far:
var sourceKeys = StellarSdk.Keypair.fromSecret(sourceaccountkey);
let builder = new StellarSdk.TransactionBuilder(sourceAccount);
builder.addOperation(StellarSdk.Operation.createAccount({
destination: destinationId,
startingBalance: sendamount
}));
// This operation needs to be done on the receiver account, but the builder object belongs to the source account
builder.addOperation(
StellarSdk.Operation.changeTrust({
asset: new StellarSDK.Asset(assetcode, assetissueraddress)
})
);
// Assuming the above is even possible, how do I sign with both source and receiver account keys?
transaction.sign(sourceKeys);
Any help is much appreciated. Thanks.