Skip to content
Snippets Groups Projects
Commit 7d17dffe authored by Mateusz Tyszczak's avatar Mateusz Tyszczak :scroll: Committed by Bartek Wrona
Browse files

Add hpToVests method to TS interface

parent 3d8a5193
No related branches found
No related tags found
1 merge request!290Add hpToVests method to TS interface
Pipeline #118773 passed
......@@ -252,6 +252,14 @@ export class WaxBaseApi implements IWaxBaseInterface {
return safeWasmCall(() => this.proto.cpp_vests_to_hp(vestsAsset, totalVestingFundHiveAsset, totalVestingSharesAsset) as NaiAsset);
}
public hpToVests(hive: TNaiAssetSource, totalVestingFundHive: TNaiAssetSource, totalVestingShares: TNaiAssetSource): NaiAsset {
const hiveAsset = this.createAssetWithRequiredSymbol(EAssetName.HIVE, hive);
const totalVestingFundHiveAsset = this.createAssetWithRequiredSymbol(EAssetName.HIVE, totalVestingFundHive);
const totalVestingSharesAsset = this.createAssetWithRequiredSymbol(EAssetName.VESTS, totalVestingShares);
return safeWasmCall(() => this.proto.cpp_hp_to_vests(hiveAsset, totalVestingFundHiveAsset, totalVestingSharesAsset) as NaiAsset);
}
public hbdToHive(hbd: TNaiAssetSource, base: TNaiAssetSource, quote: TNaiAssetSource): NaiAsset {
const hbdAsset = this.createAssetWithRequiredSymbol(EAssetName.HBD, hbd as NaiAsset);
const baseAsset = this.createAssetWithRequiredSymbol(EAssetName.HBD, base as NaiAsset);
......
......@@ -770,6 +770,14 @@ export interface IWaxBaseInterface {
*/
vestsToHp(vests: TNaiAssetSource, totalVestingFundHive: TNaiAssetSource, totalVestingShares: TNaiAssetSource): NaiAsset
/**
* Converts HP to VESTS in nai form
* @param {NaiAsset} hive HIVE asset
* @param {NaiAsset} totalVestingFundHive HIVE assest total vesting fund
* @param {NaiAsset} totalVestingShares VESTS asset total shares
*/
hpToVests(hive: TNaiAssetSource, totalVestingFundHive: TNaiAssetSource, totalVestingShares: TNaiAssetSource): NaiAsset;
/**
* Converts HBD to HIVE in nai form
* @param {NaiAsset} hbd HBD asset
......
......@@ -145,6 +145,11 @@ json_asset cpp_vests_to_hp(const json_asset& vests, const json_asset& total_vest
return foundation::cpp_vests_to_hp(vests, total_vesting_fund_hive, total_vesting_shares);
}
json_asset cpp_hp_to_vests(const json_asset& vests, const json_asset& total_vesting_fund_hive, const json_asset& total_vesting_shares) const
{
return foundation::cpp_hp_to_vests(vests, total_vesting_fund_hive, total_vesting_shares);
}
result cpp_calculate_inflation_rate_for_block(const uint32_t block_num) const
{
return foundation::cpp_calculate_inflation_rate_for_block( block_num );
......@@ -347,6 +352,7 @@ EMSCRIPTEN_BINDINGS(wax_api_instance) {
.function("cpp_calculate_hp_apr", &foundation_wasm::cpp_calculate_hp_apr)
.function("cpp_calculate_inflation_rate_for_block", &foundation_wasm::cpp_calculate_inflation_rate_for_block)
.function("cpp_vests_to_hp", &foundation_wasm::cpp_vests_to_hp)
.function("cpp_hp_to_vests", &foundation_wasm::cpp_hp_to_vests)
.function("cpp_hbd_to_hive", &foundation_wasm::cpp_hbd_to_hive)
.function("cpp_hive_to_hbd", &foundation_wasm::cpp_hive_to_hbd)
.function("cpp_estimate_hive_collateral", &foundation_wasm::cpp_estimate_hive_collateral)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment