From 89da93bef2609f86375975b9cf3f1ff0460e54c0 Mon Sep 17 00:00:00 2001 From: Alex <56650632+alexxxkny@users.noreply.github.com> Date: Tue, 20 May 2025 06:36:44 +0300 Subject: [PATCH] use interfaces package for jamton (#11538) --- packages/apps-config/package.json | 1 + packages/apps-config/src/api/spec/jamton.ts | 49 +------ packages/apps-config/src/api/typesBundle.ts | 149 ++++++++++++++++++-- yarn.lock | 10 ++ 4 files changed, 154 insertions(+), 55 deletions(-) diff --git a/packages/apps-config/package.json b/packages/apps-config/package.json index 107da5b350..da58c77b54 100644 --- a/packages/apps-config/package.json +++ b/packages/apps-config/package.json @@ -28,6 +28,7 @@ "@fragnova/api-augment": "0.1.0-spec-1.0.4-mainnet", "@frequency-chain/api-augment": "1.11.1", "@interlay/interbtc-types": "1.13.0", + "@jamton/parachain-ts-interfaces": "1.10.4", "@kiltprotocol/type-definitions": "^1.11401.0", "@laminar/type-definitions": "0.3.1", "@logion/node-api": "0.27.0-4", diff --git a/packages/apps-config/src/api/spec/jamton.ts b/packages/apps-config/src/api/spec/jamton.ts index 3ee26f6958..71801e5686 100644 --- a/packages/apps-config/src/api/spec/jamton.ts +++ b/packages/apps-config/src/api/spec/jamton.ts @@ -3,57 +3,20 @@ import type { OverrideBundleDefinition } from '@polkadot/types/types'; +import { rpc, runtime, signedExtensions, types } from '@jamton/parachain-ts-interfaces/bundle'; + /* eslint-disable sort-keys */ const definitions: OverrideBundleDefinition = { types: [ { // on all versions minmax: [0, undefined], - types: { - StakingRates: { - collatorStakingRate: 'Perquintill', - collatorRewardRate: 'Perquintill', - delegatorStakingRate: 'Perquintill', - delegatorRewardRate: 'Perquintill' - }, - AssetId: 'u32', - Balance: 'u128' - } + types } ], - runtime: { - ParachainStaking: [ - { - methods: { - get_staking_rates: { - description: 'Calculate the current staking and reward rates for collators and delegators', - params: [], - type: 'StakingRates' - }, - get_unclaimed_staking_rewards: { - description: 'Calculate the claimable staking rewards for a given account address', - params: [ - { - name: 'account', - type: 'AccountId32' - } - ], - type: 'Balance' - } - }, - version: 1 - } - ] - }, - signedExtensions: { - ChargeAssetTxPayment: { - extrinsic: { - tip: 'Compact', - assetId: 'Option' - }, - payload: {} - } - } + runtime, + rpc, + signedExtensions }; export default definitions; diff --git a/packages/apps-config/src/api/typesBundle.ts b/packages/apps-config/src/api/typesBundle.ts index c7a956bb57..c503ba30a6 100644 --- a/packages/apps-config/src/api/typesBundle.ts +++ b/packages/apps-config/src/api/typesBundle.ts @@ -30142,18 +30142,113 @@ export const typesBundle = { null ], "types": { + "Amount": "i128", + "Balance": "u128", + "BlockNumber": "u64", + "CurrencyId": { + "_enum": { + "Native": "u32", + "DexShare": "(DexShare, DexShare)", + "ForeignAsset": "u32" + } + }, + "DexShare": { + "_enum": { + "Native": "u32", + "ForeignAsset": "u32" + } + }, + "TradingPair": "(CurrencyId, CurrencyId)", + "ProvisionParameters": { + "minContribution": "(Balance, Balance)", + "targetProvision": "(Balance, Balance)", + "accumulatedProvision": "(Balance, Balance)", + "notBefore": "u32" + }, + "TradingPairStatus": { + "_enum": { + "Disabled": "Null", + "Provisioning": "ProvisionParameters", + "Enabled": "Null" + } + }, "StakingRates": { "collatorStakingRate": "Perquintill", "collatorRewardRate": "Perquintill", "delegatorStakingRate": "Perquintill", "delegatorRewardRate": "Perquintill" - }, - "AssetId": "u32", - "Balance": "u128" + } } } ], "runtime": { + "Doton": [ + { + "methods": { + "doton_mint_amount_with_dot": { + "description": "Amount of DOTON that expected to be minted from passed DOT amount.", + "params": [ + { + "name": "amount", + "type": "Balance" + } + ], + "type": "Result" + }, + "dot_redeem_amount_with_doton": { + "description": "Amount of DOT that expected to be redeemed with passed amount of DOTON.", + "params": [ + { + "name": "amount", + "type": "Balance" + } + ], + "type": "Result" + }, + "min_mint_from_dot_amount": { + "description": "Minimal amount of DOT to stake through DOTON module.", + "params": [], + "type": "Result" + }, + "min_redeem_to_dot_amount": { + "description": "Minimal amount of DOTON to redeem DOT.", + "params": [], + "type": "Result" + }, + "doton_mint_amount_with_jamton": { + "description": "Amount of DOTON that expected to be minted from passed jamTON amount.", + "params": [ + { + "name": "amount", + "type": "Balance" + } + ], + "type": "Result" + }, + "jamton_redeem_amount_with_doton": { + "description": "Amount of jamTON that expected to be redeemed with passed amount of DOTON.", + "params": [ + { + "name": "amount", + "type": "Balance" + } + ], + "type": "Result" + }, + "max_doton_amount_to_redeem_into_dot": { + "description": "Maximum amount of DOTON to request redeem to DOT due to the vault state.", + "params": [], + "type": "Result" + }, + "max_doton_amount_to_redeem_into_jamton": { + "description": "Maximum amount of DOTON to redeem to jamTON due to the vault state.", + "params": [], + "type": "Result" + } + }, + "version": 1 + } + ], "ParachainStaking": [ { "methods": { @@ -30171,21 +30266,51 @@ export const typesBundle = { } ], "type": "Balance" + }, + "get_sorted_proposed_candidates": { + "description": "Provides a sorted list of collators most suited for given delegator's stake amount determined with some heuristic algorithm.", + "params": [ + { + "name": "balance", + "type": "Balance" + } + ], + "type": "Vec" + } + }, + "version": 1 + } + ], + "Limits": [ + { + "methods": { + "maybe_remaining_dot_stake_limit": { + "description": "Remaining DOT amount that account allowed to stake. Returns None if no limit.", + "params": [ + { + "name": "account", + "type": "AccountId" + } + ], + "type": "Option" + }, + "maybe_remaining_issue_allowance": { + "description": "Remaining amount of currency that could be minted. Returns None if no limit.", + "params": [ + { + "name": "currency_id", + "type": "CurrencyId" + } + ], + "type": "Option" } }, "version": 1 } ] }, - "signedExtensions": { - "ChargeAssetTxPayment": { - "extrinsic": { - "tip": "Compact", - "assetId": "Option" - }, - "payload": {} - } - } + "rpc": {}, + "signedExtensions": {} }, "jupiter-prep": { "types": [ diff --git a/yarn.lock b/yarn.lock index 5f9c3a3f1e..c52681befc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -772,6 +772,15 @@ __metadata: languageName: node linkType: hard +"@jamton/parachain-ts-interfaces@npm:1.10.4": + version: 1.10.4 + resolution: "@jamton/parachain-ts-interfaces@npm:1.10.4" + dependencies: + "@polkadot/api": "npm:^15.0.0" + checksum: 10/4b94986dfc5ed2b829e5b904994b7ce98007bcb235f35fde6de74fb0e7a466deb943b4c7c487a53b873630dbe8274b03d1cd3071d2e5b702aa8da932a796558a + languageName: node + linkType: hard + "@jest/expect-utils@npm:^29.6.2": version: 29.6.2 resolution: "@jest/expect-utils@npm:29.6.2" @@ -2162,6 +2171,7 @@ __metadata: "@fragnova/api-augment": "npm:0.1.0-spec-1.0.4-mainnet" "@frequency-chain/api-augment": "npm:1.11.1" "@interlay/interbtc-types": "npm:1.13.0" + "@jamton/parachain-ts-interfaces": "npm:1.10.4" "@kiltprotocol/type-definitions": "npm:^1.11401.0" "@laminar/type-definitions": "npm:0.3.1" "@logion/node-api": "npm:0.27.0-4"