/* In the first approach, no changes need to be made to the existing stellar js sdk. In this approach I mimick the Go reference implementation and use the master keypair of the empty string network passphrase. */ // 1. build the partial transaction (excludes the source account and sequence numbers // Define an empty address s.Network.use(new s.Network("")); const emptyAddress_a1 = s.Keypair.master().publicKey(); // Define an account const account_a1 = new s.Account(emptyAddress_a1, "0"); // Define a transaction object let tx_a1 = new s.TransactionBuilder(account_a1); // Add payment operation tx_a1.addOperation(s.Operation.payment({ destination: "GASIA4ZTLZEF4TRLLDQCQIT43KNZKSAEU3PX3BQVNEZVNJ4FM7LBIPTK", asset: s.Asset.native(), amount: "1", })) // Add a memo if included (Optional) tx_a1.addMemo(s.Memo.text("SEP, SEP 007")); // 2. Convert to a transaction envelope tx_a1 = tx_a1.build().toEnvelope(); // 3. Convert to Base64 tx_a1 = tx_a1.toXDR('base64'); // 4. Url encode (Optional) const url_a1 = encodeURIComponent(tx_a1); // 5. Print out ("web+stellar:tx?xdr=" + urlEncoded) (Optional) console.log(`web+stellar:tx?xdr=${url_a1}`); /* Result: web+stellar:tx?xdr=AAAAAL6Qe0ushP7lzogR2y3vyb8LKiorvD1U2KIlfs1wRBliAAAAZAAAAAAAAAABAAAAAAAAAAEAAAAMU0VQLCBTRVAgMDA3AAAAAQAAAAAAAAABAAAAACSAczNeSF5OK1jgKCJ82puVSASm332GFWkzVqeFZ9YUAAAAAAAAAAAAmJaAAAAAAAAAAAA%3D */