Add AssetConversionApi (#5694)

* Add Asset Conversion Api

* Fix lint errors
This commit is contained in:
Jegor Sidorenko
2023-07-24 14:02:17 +03:00
committed by GitHub
parent 1fcc278381
commit c2944f2dc1
8 changed files with 138 additions and 1 deletions
+21 -1
View File
@@ -6,8 +6,9 @@
import '@polkadot/api-base/types/calls';
import type { ApiTypes, AugmentedCall, DecoratedCallBase } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, Vec, u32 } from '@polkadot/types-codec';
import type { Bytes, Null, Option, Result, Vec, bool, u128, u32 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { MultiAssetId } from '@polkadot/types/interfaces/assetConversion';
import type { TAssetBalance } from '@polkadot/types/interfaces/assets';
import type { BabeEquivocationProof, BabeGenesisConfiguration, Epoch, OpaqueKeyOwnershipProof } from '@polkadot/types/interfaces/babe';
import type { CheckInherentsResult, InherentData } from '@polkadot/types/interfaces/blockbuilder';
@@ -43,6 +44,25 @@ declare module '@polkadot/api-base/types/calls' {
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x8a8047a53a8277ec/1 */
assetConversionApi: {
/**
* Get pool reserves
**/
getReserves: AugmentedCall<ApiType, (asset1: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array, asset2: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array) => Observable<Option<ITuple<[Balance, Balance]>>>>;
/**
* Quote price: exact tokens for tokens
**/
quotePriceExactTokensForTokens: AugmentedCall<ApiType, (asset1: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array, asset2: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, include_fee: bool | boolean | Uint8Array) => Observable<Option<Balance>>>;
/**
* Quote price: tokens for exact tokens
**/
quotePriceTokensForExactTokens: AugmentedCall<ApiType, (asset1: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array, asset2: MultiAssetId | { Native: any } | { Asset: any } | string | Uint8Array, amount: u128 | AnyNumber | Uint8Array, include_fee: bool | boolean | Uint8Array) => Observable<Option<Balance>>>;
/**
* Generic call
**/
[key: string]: DecoratedCallBase<ApiType>;
};
/** 0x8453b50b22293977/1 */
assetsApi: {
/**