From b8e6e46ac1520e2215f5767686b76ba3d1b1452a Mon Sep 17 00:00:00 2001 From: Gregory Hill Date: Tue, 7 Feb 2023 10:29:45 +0000 Subject: [PATCH] feat: add dex-general and dex-stable rpc defs Signed-off-by: Gregory Hill --- definitions.json | 283 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 282 insertions(+), 1 deletion(-) diff --git a/definitions.json b/definitions.json index 5685772..596d50a 100644 --- a/definitions.json +++ b/definitions.json @@ -6,6 +6,9 @@ null ], "types": { + "AssetBalance": "Balance", + "AssetId": "CurrencyId", + "Balance": "u128", "BalanceWrapper": { "amount": "String" }, @@ -47,6 +50,7 @@ "InterbtcStablePoolId": "u32", "LendTokenId": "u32", "StablePoolId": "u32", + "PoolId": "StablePoolId", "Rate": "FixedU128", "Ratio": "Permill", "Liquidity": "FixedU128", @@ -102,6 +106,283 @@ "type": "void" } }, + "dexGeneral": { + "getPairByAssetId": { + "params": [ + { + "name": "asset_0", + "type": "AssetId" + }, + { + "name": "asset_1", + "type": "AssetId" + } + ], + "type": "Option>" + }, + "getAmountInPrice": { + "params": [ + { + "name": "supply", + "type": "AssetBalance" + }, + { + "name": "path", + "type": "Vec" + } + ], + "type": "NumberOrHex" + }, + "getAmountOutPrice": { + "params": [ + { + "name": "supply", + "type": "AssetBalance" + }, + { + "name": "path", + "type": "Vec" + } + ], + "type": "NumberOrHex" + }, + "getEstimateLptoken": { + "params": [ + { + "name": "asset_0", + "type": "AssetId" + }, + { + "name": "asset_1", + "type": "AssetId" + }, + { + "name": "amount_0_desired", + "type": "AssetBalance" + }, + { + "name": "amount_1_desired", + "type": "AssetBalance" + }, + { + "name": "amount_0_min", + "type": "AssetBalance" + }, + { + "name": "amount_1_min", + "type": "AssetBalance" + } + ], + "type": "NumberOrHex" + }, + "calculateRemoveLiquidity": { + "params": [ + { + "name": "asset_0", + "type": "AssetId" + }, + { + "name": "asset_1", + "type": "AssetId" + }, + { + "name": "amount", + "type": "AssetBalance" + } + ], + "type": "Option<(AssetBalance, AssetBalance)>" + } + }, + "dexStable": { + "getVirtualPrice": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "NumberOrHex" + }, + "getA": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "NumberOrHex" + }, + "getAPrecise": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "NumberOrHex" + }, + "getCurrencies": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "Vec" + }, + "getCurrency": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "index", + "type": "u32" + } + ], + "type": "CurrencyId" + }, + "getLpCurrency": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "CurrencyId" + }, + "getCurrencyIndex": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "currency", + "type": "CurrencyId" + } + ], + "type": "u32" + }, + "getCurrencyPrecisionMultipliers": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "Vec" + }, + "getCurrencyBalances": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "Vec" + }, + "getNumberOfCurrencies": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "u32" + }, + "getAdminBalances": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + } + ], + "type": "Vec" + }, + "getAdminBalance": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "index", + "type": "u32" + } + ], + "type": "NumberOrHex" + }, + "calculateCurrencyAmount": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "amounts", + "type": "Vec" + }, + { + "name": "deposit", + "type": "bool" + } + ], + "type": "NumberOrHex" + }, + "calculateSwap": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "in_index", + "type": "u32" + }, + { + "name": "out_index", + "type": "u32" + }, + { + "name": "in_amount", + "type": "Balance" + } + ], + "type": "NumberOrHex" + }, + "calculateRemoveLiquidity": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "amount", + "type": "Balance" + } + ], + "type": "Vec" + }, + "calculateRemoveLiquidityOneCurrency": { + "params": [ + { + "name": "pool_id", + "type": "PoolId" + }, + { + "name": "amount", + "type": "Balance" + }, + { + "name": "index", + "type": "u32" + } + ], + "type": "NumberOrHex" + } + }, "escrow": { "balanceAt": { "description": "Get a given user's escrowed balance", @@ -506,4 +787,4 @@ "intr" ] } -} +} \ No newline at end of file