Follow these steps to write the Node.js utility:
- Create a new nodejs app called CreateTrustline.js. Start by importing the stellar-sdk from node-modules and creating a new server object pointed at localhost:8000 (the Horizon instance), as shown in the following code:
const StellarSdk = require('stellar-sdk'); const server = new StellarSdk.Server('http://127.0.0.1:8000', {allowHttp: true});
- Next, we'll use the accounts we generated in the previous section. Here, the first account will be our issuing account, which issues assets. The second and third accounts will map to Bank A and Bank B, respectively. Use the secret key of the three accounts to extract their key pairs:
var issuingKeys = StellarSdk.Keypair.fromSecret('SAEEE4UUP3DRYTEFHNFKCVB4ZCQT2W2KPFW7FLE6VLE7QABAAZATFZFD'); ...