{"size": 1102, "ext": "js", "max_stars_repo_path": "examples/index.js", "max_stars_repo_name": "vessels-tech/iota-lambda", "max_stars_repo_stars_event_min_datetime": "2018-02-25T16:16:11.000Z", "max_stars_repo_stars_event_max_datetime": "2018-05-22T17:42:12.000Z", "max_issues_repo_path": "examples/index.js", "max_issues_repo_name": "vessels-tech/iota-lambda", "max_issues_repo_issues_event_min_datetime": "2018-05-28T01:56:48.000Z", "max_issues_repo_issues_event_max_datetime": "2018-05-29T00:05:08.000Z", "max_forks_repo_path": "examples/index.js", "max_forks_repo_name": "vessels-tech/iota-lambda", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 24.4888888889, "max_line_length": 71, "alphanum_fraction": 0.6297640653}
/*iota library */
const IOTA = require('iota.lib.js');
const { 
  provider, 
  functionName,
  trytes //todo: remove
} = require('./config');

//Please don't ever use this seed for anything
const seed = "UFLKWXVHYTPDBAOJS9CQMGNRZEI";
const iota = new IOTA({
  provider,
});

/* set up AWS config to refer to our lambda */
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda({
  region: 'ap-southeast-2' //I come from a land down under
});

const IotaLambdaShim = require('iota-lambda-shim');

// Patch the current IOTA instance
IotaLambdaShim({ iota, lambda, functionName });



//Do whatever you want with the IOTA js api now.
iota.api.getNewAddress(seed, {}, (error, address) => {
    console.log("ADDRESS:", address)
    if (error) throw error;
    let transfers = [{
        'address': address,
        'message': iota.utils.toTrytes("testing"),
        // 'message': trytes,
        'value': 0,
        'tag': 'SURJIKAL'
    }];

    iota.api.sendTransfer(seed, 5, 14, transfers, (error, results) => {
        if (error) throw error;
        console.log("RESULTS:", results)
    });
});
