Skip to content

Commit

Permalink
Merge pull request #7 from mangata-finance/rc/types/2.1.0
Browse files Browse the repository at this point in the history
feat: update metadata
  • Loading branch information
devdanco authored Dec 11, 2023
2 parents e5fd1cd + 1b9a31e commit 9dfd157
Show file tree
Hide file tree
Showing 15 changed files with 651 additions and 334 deletions.
2 changes: 1 addition & 1 deletion packages/types/metadata.json

Large diffs are not rendered by default.

12 changes: 3 additions & 9 deletions packages/types/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Data } from '@polkadot/types';
import type { BTreeMap, Bytes, Null, Option, Vec, bool, u128, u16, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, Perbill } from '@polkadot/types/interfaces/runtime';
import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCodeUpgradeAuthorization, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, FrameSupportDispatchPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, MangataRococoRuntimeSessionKeys, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlTraitsAssetRegistryAssetMetadata, PalletBootstrapBootstrapPhase, PalletCollectiveMangataVotes, PalletCrowdloanRewardsRewardInfo, PalletFeeLockAccountFeeLockDataInfo, PalletFeeLockFeeLockMetadataInfo, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletIssuanceIssuanceInfo, PalletMaintenanceMaintenanceStatusInfo, PalletMultipurposeLiquidityRelockStatusInfo, PalletMultipurposeLiquidityReserveStatusInfo, PalletProofOfStakePromotedPools, PalletProofOfStakeRewardInfo, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletTransactionPaymentMangataReleases, PalletTreasuryProposal, PalletVestingMangataReleases, PalletVestingMangataVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, ParachainStakingAggregatorMetadataType, ParachainStakingBond, ParachainStakingCollatorCandidate, ParachainStakingCollatorSnapshot, ParachainStakingDelegator, ParachainStakingRoundCollatorRewardInfoType, ParachainStakingRoundInfo, ParachainStakingSetOrderedSetBond, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { CumulusPalletDmpQueueConfigData, CumulusPalletDmpQueuePageIndexData, CumulusPalletParachainSystemCodeUpgradeAuthorization, CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot, CumulusPalletXcmpQueueInboundChannelDetails, CumulusPalletXcmpQueueOutboundChannelDetails, CumulusPalletXcmpQueueQueueConfigData, FrameSupportDispatchPerDispatchClassWeight, FrameSystemAccountInfo, FrameSystemEventRecord, FrameSystemLastRuntimeUpgradeInfo, FrameSystemPhase, MangataKusamaRuntimeSessionKeys, OrmlTokensAccountData, OrmlTokensBalanceLock, OrmlTokensReserveData, OrmlTraitsAssetRegistryAssetMetadata, PalletBootstrapBootstrapPhase, PalletCollectiveMangataVotes, PalletCrowdloanRewardsRewardInfo, PalletFeeLockAccountFeeLockDataInfo, PalletFeeLockFeeLockMetadataInfo, PalletIdentityRegistrarInfo, PalletIdentityRegistration, PalletIssuanceIssuanceInfo, PalletMaintenanceMaintenanceStatusInfo, PalletMultipurposeLiquidityRelockStatusInfo, PalletMultipurposeLiquidityReserveStatusInfo, PalletProofOfStakePromotedPools, PalletProofOfStakeRewardInfo, PalletProxyAnnouncement, PalletProxyProxyDefinition, PalletTransactionPaymentMangataReleases, PalletTreasuryProposal, PalletVestingMangataReleases, PalletVestingMangataVestingInfo, PalletXcmQueryStatus, PalletXcmRemoteLockedFungibleRecord, PalletXcmVersionMigrationStage, ParachainStakingAggregatorMetadataType, ParachainStakingBond, ParachainStakingCollatorCandidate, ParachainStakingCollatorSnapshot, ParachainStakingDelegator, ParachainStakingRoundCollatorRewardInfoType, ParachainStakingRoundInfo, ParachainStakingSetOrderedSetBond, PolkadotCorePrimitivesOutboundHrmpMessage, PolkadotPrimitivesV2AbridgedHostConfiguration, PolkadotPrimitivesV2PersistedValidationData, PolkadotPrimitivesV2UpgradeRestriction, SpConsensusAuraSr25519AppSr25519Public, SpCoreCryptoKeyTypeId, SpRuntimeDigest, SpTrieStorageProof, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmVersionedAssetId, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { Observable } from '@polkadot/types/types';

export type __AugmentedQuery<ApiType extends ApiTypes> = AugmentedQuery<ApiType, () => unknown>;
Expand Down Expand Up @@ -580,12 +580,6 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
rootTesting: {
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
session: {
/**
* Current index of the session.
Expand All @@ -606,7 +600,7 @@ declare module '@polkadot/api-base/types/storage' {
/**
* The next session keys for a validator.
**/
nextKeys: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<MangataRococoRuntimeSessionKeys>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
nextKeys: AugmentedQuery<ApiType, (arg: AccountId32 | string | Uint8Array) => Observable<Option<MangataKusamaRuntimeSessionKeys>>, [AccountId32]> & QueryableStorageEntry<ApiType, [AccountId32]>;
/**
* True if the underlying economic identities or weighting behind the validators
* has changed in the queued validator set.
Expand All @@ -616,7 +610,7 @@ declare module '@polkadot/api-base/types/storage' {
* The queued keys for the next session. When the next session begins, these keys
* will be used to determine the validator's session keys.
**/
queuedKeys: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId32, MangataRococoRuntimeSessionKeys]>>>, []> & QueryableStorageEntry<ApiType, []>;
queuedKeys: AugmentedQuery<ApiType, () => Observable<Vec<ITuple<[AccountId32, MangataKusamaRuntimeSessionKeys]>>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* The current set of validators.
**/
Expand Down
73 changes: 71 additions & 2 deletions packages/types/src/interfaces/augment-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/rpc-core/types/jsonrpc';

import type { RpcAssetMetadata, TokenId } from '@mangata-finance/types/interfaces/default';
import type { AugmentedRpc } from '@polkadot/rpc-core/types';
import type { Metadata, StorageKey } from '@polkadot/types';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, f64, u32, u64 } from '@polkadot/types-codec';
import type { AnyNumber, Codec } from '@polkadot/types-codec/types';
import type { AnyNumber, Codec, ITuple } from '@polkadot/types-codec/types';
import type { ExtrinsicOrHash, ExtrinsicStatus } from '@polkadot/types/interfaces/author';
import type { EpochAuthorship } from '@polkadot/types/interfaces/babe';
import type { BeefySignedCommitment } from '@polkadot/types/interfaces/beefy';
Expand All @@ -25,7 +26,7 @@ import type { MmrHash, MmrLeafBatchProof } from '@polkadot/types/interfaces/mmr'
import type { StorageKind } from '@polkadot/types/interfaces/offchain';
import type { FeeDetails, RuntimeDispatchInfoV1 } from '@polkadot/types/interfaces/payment';
import type { RpcMethods } from '@polkadot/types/interfaces/rpc';
import type { AccountId, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import type { AccountId, Balance, BlockNumber, H160, H256, H64, Hash, Header, Index, Justification, KeyValue, SignedBlock, StorageData } from '@polkadot/types/interfaces/runtime';
import type { MigrationStatusResult, ReadProof, RuntimeVersion, TraceBlockResponse } from '@polkadot/types/interfaces/state';
import type { ApplyExtrinsicResult, ChainProperties, ChainType, Health, NetworkState, NodeRole, PeerInfo, SyncState } from '@polkadot/types/interfaces/system';
import type { IExtrinsic, Observable } from '@polkadot/types/types';
Expand Down Expand Up @@ -425,6 +426,20 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
**/
queryInfo: AugmentedRpc<(extrinsic: Bytes | string | Uint8Array, at?: BlockHash | string | Uint8Array) => Observable<RuntimeDispatchInfoV1>>;
};
pos: {
/**
* Calculates all amount of available 3rdparty rewards
**/
calculate_3rdparty_rewards_all: AugmentedRpc<(account: AccountId | string | Uint8Array) => Observable<Balance>>;
/**
* Calculates amount of available 3rdparty rewards
**/
calculate_3rdparty_rewards_amount: AugmentedRpc<(account: AccountId | string | Uint8Array, liquidity_token: TokenId | AnyNumber | Uint8Array, rewards_token: TokenId | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Calculates amount of available native rewards
**/
calculate_native_rewards_amount: AugmentedRpc<(account: AccountId | string | Uint8Array, liquidity_token: TokenId | AnyNumber | Uint8Array) => Observable<Balance>>;
};
rpc: {
/**
* Retrieves the list of RPC methods that are exposed by the node
Expand Down Expand Up @@ -613,5 +628,59 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
**/
sha3: AugmentedRpc<(data: Bytes | string | Uint8Array) => Observable<H256>>;
};
xyk: {
/**
* Calculates how much amount x we need to swap from total_amount, so that after y = swap(x), the resulting balance equals (total_amount - x) / y = pool_x / pool_y - the resulting amounts can then be used to `mint_liquidity` with minimal leftover after operation
**/
calculate_balanced_sell_amount: AugmentedRpc<(total_amount: Balance | AnyNumber | Uint8Array, reserve_amount: Balance | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Calculates and returns sold_token_amount while providing bought_token_amount and respective reserves
**/
calculate_buy_price: AugmentedRpc<(input_reserve: Balance | AnyNumber | Uint8Array, output_reserve: Balance | AnyNumber | Uint8Array, sell_amount: Balance | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Same as calculate_buy_price, but providing token_id instead of reserves. Reserves are fetched by function.
**/
calculate_buy_price_id: AugmentedRpc<(sold_token_id: TokenId | AnyNumber | Uint8Array, bought_token_id: TokenId | AnyNumber | Uint8Array, buy_amount: Balance | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Calculate rewards amount of liquidity token id for the user
**/
calculate_rewards_amount: AugmentedRpc<(user: AccountId | string | Uint8Array, liquidity_asset_id: TokenId | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Calculates and returns bought_token_amount while providing sold_token_amount and respective reserves
**/
calculate_sell_price: AugmentedRpc<(input_reserve: Balance | AnyNumber | Uint8Array, output_reserve: Balance | AnyNumber | Uint8Array, sell_amount: Balance | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Same as calculate_sell_price, but providing token_id instead of reserves. Reserves are fetched by function.
**/
calculate_sell_price_id: AugmentedRpc<(sold_token_id: TokenId | AnyNumber | Uint8Array, bought_token_id: TokenId | AnyNumber | Uint8Array, sell_amount: Balance | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Returns amounts of tokens received by burning provided liquidity_token_amount in pool of provided token ids
**/
get_burn_amount: AugmentedRpc<(first_asset_id: TokenId | AnyNumber | Uint8Array, second_asset_id: TokenId | AnyNumber | Uint8Array, liquidity_asset_amount: Balance | AnyNumber | Uint8Array) => Observable<ITuple<[Balance, Balance]>>>;
/**
*
**/
get_liq_tokens_for_trading: AugmentedRpc<() => Observable<Vec<TokenId>>>;
/**
*
**/
get_max_instant_burn_amount: AugmentedRpc<(user: AccountId | string | Uint8Array, liquidity_asset_id: TokenId | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* Instant unreserve amount
**/
get_max_instant_unreserve_amount: AugmentedRpc<(user: AccountId | string | Uint8Array, liquidity_asset_id: TokenId | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
*
**/
get_tradeable_tokens: AugmentedRpc<() => Observable<Vec<RpcAssetMetadata>>>;
/**
*
**/
is_buy_asset_lock_free: AugmentedRpc<(path: Vec<TokenId> | (TokenId | AnyNumber | Uint8Array)[], input_amount: Balance | AnyNumber | Uint8Array) => Observable<Option<bool>>>;
/**
*
**/
is_sell_asset_lock_free: AugmentedRpc<(path: Vec<TokenId> | (TokenId | AnyNumber | Uint8Array)[], input_amount: Balance | AnyNumber | Uint8Array) => Observable<Option<bool>>>;
};
} // RpcInterface
} // declare module
16 changes: 3 additions & 13 deletions packages/types/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import type { Data } from '@polkadot/types';
import type { Bytes, Compact, Option, Vec, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { AnyNumber, IMethod, ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, Call, H256, MultiAddress, Perbill, Permill } from '@polkadot/types/interfaces/runtime';
import type { CommonRuntimeConfigPalletProxyProxyType, CumulusPrimitivesParachainInherentParachainInherentData, MangataRococoRuntimeOriginCaller, MangataRococoRuntimeSessionKeys, MangataTypesAssetsCustomMetadata, MangataTypesMultipurposeLiquidityActivateKind, MangataTypesMultipurposeLiquidityBondKind, OrmlTraitsAssetRegistryAssetMetadata, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIssuanceTgeInfo, PalletVestingMangataVestingInfo, ParachainStakingMetadataUpdateAction, ParachainStakingPairedOrLiquidityToken, SpRuntimeMultiSignature, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3WeightLimit, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';
import type { CommonRuntimeConfigPalletProxyProxyType, CumulusPrimitivesParachainInherentParachainInherentData, MangataKusamaRuntimeOriginCaller, MangataKusamaRuntimeSessionKeys, MangataTypesAssetsCustomMetadata, MangataTypesMultipurposeLiquidityActivateKind, MangataTypesMultipurposeLiquidityBondKind, OrmlTraitsAssetRegistryAssetMetadata, PalletIdentityBitFlags, PalletIdentityIdentityInfo, PalletIdentityJudgement, PalletIssuanceTgeInfo, PalletVestingMangataVestingInfo, ParachainStakingMetadataUpdateAction, ParachainStakingPairedOrLiquidityToken, SpRuntimeMultiSignature, SpWeightsWeightV2Weight, XcmV3MultiLocation, XcmV3WeightLimit, XcmVersionedMultiAsset, XcmVersionedMultiAssets, XcmVersionedMultiLocation, XcmVersionedXcm } from '@polkadot/types/lookup';

export type __AugmentedSubmittable = AugmentedSubmittable<() => unknown>;
export type __SubmittableExtrinsic<ApiType extends ApiTypes> = SubmittableExtrinsic<ApiType>;
Expand Down Expand Up @@ -1137,16 +1137,6 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
rootTesting: {
/**
* A dispatch that will fill the block weight up to the given ratio.
**/
fillBlock: AugmentedSubmittable<(ratio: Perbill | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Perbill]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
session: {
/**
* Removes any session key(s) of the function caller.
Expand Down Expand Up @@ -1174,7 +1164,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - `O(1)`. Actual cost depends on the number of length of `T::Keys::key_ids()` which is
* fixed.
**/
setKeys: AugmentedSubmittable<(keys: MangataRococoRuntimeSessionKeys | { aura?: any } | string | Uint8Array, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MangataRococoRuntimeSessionKeys, Bytes]>;
setKeys: AugmentedSubmittable<(keys: MangataKusamaRuntimeSessionKeys | { aura?: any } | string | Uint8Array, proof: Bytes | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MangataKusamaRuntimeSessionKeys, Bytes]>;
/**
* Generic tx
**/
Expand Down Expand Up @@ -1572,7 +1562,7 @@ declare module '@polkadot/api-base/types/submittable' {
* - Weight of derivative `call` execution + T::WeightInfo::dispatch_as().
* # </weight>
**/
dispatchAs: AugmentedSubmittable<(asOrigin: MangataRococoRuntimeOriginCaller | { system: any } | { Void: any } | { PolkadotXcm: any } | { CumulusXcm: any } | { Council: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MangataRococoRuntimeOriginCaller, Call]>;
dispatchAs: AugmentedSubmittable<(asOrigin: MangataKusamaRuntimeOriginCaller | { system: any } | { Void: any } | { PolkadotXcm: any } | { CumulusXcm: any } | { Council: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MangataKusamaRuntimeOriginCaller, Call]>;
/**
* Send a batch of dispatch calls.
* Unlike `batch`, it allows errors and won't interrupt.
Expand Down
31 changes: 27 additions & 4 deletions packages/types/src/interfaces/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
import { mTypes } from "@mangata-finance/type-definitions";

export default {
types: mTypes
};
types: {
ShufflingSeed: {
seed: "H256",
proof: "H512"
},
Header: {
parentHash: "Hash",
number: "Compact<BlockNumber>",
stateRoot: "Hash",
extrinsicsRoot: "Hash",
digest: "Digest",
seed: "ShufflingSeed",
count: "BlockNumber"
},
RpcAssetMetadata: {
tokenId: "TokenId",
decimals: "u32",
name: "Vec<u8>",
symbol: "Vec<u8>"
},
TokenId: "u32",
}
}


export { default as pos } from './pos/definitions.js';
export { default as xyk } from './xyk/definitions.js';
Loading

0 comments on commit 9dfd157

Please sign in to comment.