@lunch-money/ethereum-to-lunch-money
Version:
A wrapper around Ethereum APIs for enabling Lunch Money to gather information about a user's wallet.
35 lines • 2.05 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LunchMoneyEthereumWalletConnection = exports.EthereumInitializationService = exports.createEthereumWalletClient = void 0;
const ethereum_init_js_1 = __importDefault(require("./ethereum_init.js"));
exports.EthereumInitializationService = ethereum_init_js_1.default;
var client_js_1 = require("./client.js");
Object.defineProperty(exports, "createEthereumWalletClient", { enumerable: true, get: function () { return client_js_1.createEthereumWalletClient; } });
/** The minimum balance (in wei) that a token should have in order to be
* considered for returning as a balance. */
const NEGLIGIBLE_BALANCE_THRESHOLD = 1000;
exports.LunchMoneyEthereumWalletConnection = {
initiate(config, context) {
return __awaiter(this, void 0, void 0, function* () {
return this.getBalances(config, context);
});
},
getBalances({ walletAddress, negligibleBalanceThreshold = NEGLIGIBLE_BALANCE_THRESHOLD }, { client }) {
return __awaiter(this, void 0, void 0, function* () {
return client.getBalances(walletAddress, negligibleBalanceThreshold);
});
},
};
//# sourceMappingURL=main.js.map