@ledgerhq/coin-hedera
Version:
Ledger Hedera Coin integration
63 lines • 1.96 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const bignumber_js_1 = __importDefault(require("bignumber.js"));
const _1 = require(".");
const utils_1 = require("./utils");
// Balance is 1 Hbar
const account = {
type: "Account",
id: "",
seedIdentifier: "",
derivationMode: "",
index: 0,
freshAddress: "",
freshAddressPath: "",
used: false,
balance: new bignumber_js_1.default(100000000),
spendableBalance: new bignumber_js_1.default(0),
creationDate: new Date(),
blockHeight: 0,
currency: {
type: "CryptoCurrency",
id: "hedera",
managerAppName: "",
coinType: 0,
scheme: "",
color: "",
family: "",
explorerViews: [],
name: "",
ticker: "",
units: [],
},
operationsCount: 0,
operations: [],
pendingOperations: [],
lastSyncDate: new Date(),
balanceHistoryCache: {
HOUR: { latestDate: null, balances: [] },
DAY: { latestDate: null, balances: [] },
WEEK: { latestDate: null, balances: [] },
},
swapHistory: [],
};
describe("js-estimateMaxSpendable", () => {
let bridge;
let estimatedFees = new bignumber_js_1.default("150200").multipliedBy(2); // 0.001502 ℏ (as of 2023-03-14)
beforeAll(async () => {
const signer = jest.fn();
bridge = (0, _1.createBridges)(signer);
estimatedFees = await (0, utils_1.getEstimatedFees)(account);
});
test("estimateMaxSpendable", async () => {
const result = await bridge.accountBridge.estimateMaxSpendable({
account,
});
const data = account.balance.minus(estimatedFees);
expect(result).toEqual(data);
});
});
//# sourceMappingURL=js-estimateMaxSpendable.integration.test.js.map