Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wax
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hive
wax
Commits
7d17dffe
Commit
7d17dffe
authored
1 week ago
by
Mateusz Tyszczak
Committed by
Bartek Wrona
4 days ago
Browse files
Options
Downloads
Patches
Plain Diff
Add hpToVests method to TS interface
parent
3d8a5193
No related branches found
No related tags found
1 merge request
!290
Add hpToVests method to TS interface
Pipeline
#118773
passed
4 days ago
Stage: static_code_analysis
Stage: build
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
ts/wasm/lib/detailed/base_api.ts
+8
-0
8 additions, 0 deletions
ts/wasm/lib/detailed/base_api.ts
ts/wasm/lib/detailed/interfaces.ts
+8
-0
8 additions, 0 deletions
ts/wasm/lib/detailed/interfaces.ts
ts/wasm/src/wasm_interface.cpp
+6
-0
6 additions, 0 deletions
ts/wasm/src/wasm_interface.cpp
with
22 additions
and
0 deletions
ts/wasm/lib/detailed/base_api.ts
+
8
−
0
View file @
7d17dffe
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
ts/wasm/lib/detailed/interfaces.ts
+
8
−
0
View file @
7d17dffe
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
ts/wasm/src/wasm_interface.cpp
+
6
−
0
View file @
7d17dffe
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment