@subwallet/extension-base 1.3.29-1 → 1.3.30-0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/background/KoniTypes.d.ts +4 -4
  2. package/background/errors/SwapError.js +1 -1
  3. package/cjs/background/errors/SwapError.js +1 -1
  4. package/cjs/constants/blocked-actions.js +2 -2
  5. package/cjs/constants/remind-notification-time.js +3 -3
  6. package/cjs/core/logic-validation/swap.js +63 -4
  7. package/cjs/core/utils.js +1 -1
  8. package/cjs/koni/background/handlers/Extension.js +5 -82
  9. package/cjs/packageInfo.js +1 -1
  10. package/cjs/services/balance-service/transfer/xcm/availBridge.js +6 -6
  11. package/cjs/services/earning-service/handlers/base.js +6 -3
  12. package/cjs/services/earning-service/handlers/native-staking/base.js +4 -1
  13. package/cjs/services/earning-service/handlers/native-staking/dtao.js +68 -50
  14. package/cjs/services/earning-service/handlers/native-staking/tao.js +12 -2
  15. package/cjs/services/earning-service/service.js +2 -1
  16. package/cjs/services/fee-service/utils/index.js +16 -4
  17. package/cjs/services/inapp-notification-service/index.js +19 -13
  18. package/cjs/services/swap-service/handler/asset-hub/handler.js +61 -314
  19. package/cjs/services/swap-service/handler/base-handler.js +393 -231
  20. package/cjs/services/swap-service/handler/chainflip-handler.js +18 -40
  21. package/cjs/services/swap-service/handler/hydradx-handler.js +77 -269
  22. package/cjs/services/swap-service/handler/simpleswap-handler.js +27 -48
  23. package/cjs/services/swap-service/handler/uniswap-handler.js +33 -54
  24. package/cjs/services/swap-service/index.js +154 -143
  25. package/cjs/services/swap-service/utils.js +107 -17
  26. package/cjs/services/transaction-service/index.js +1 -1
  27. package/cjs/types/swap/index.js +13 -1
  28. package/cjs/utils/swap.js +5 -1
  29. package/constants/blocked-actions.d.ts +1 -1
  30. package/constants/blocked-actions.js +1 -1
  31. package/constants/remind-notification-time.d.ts +1 -1
  32. package/constants/remind-notification-time.js +1 -1
  33. package/core/logic-validation/swap.d.ts +15 -0
  34. package/core/logic-validation/swap.js +60 -4
  35. package/core/utils.js +1 -1
  36. package/koni/background/handlers/Extension.d.ts +0 -1
  37. package/koni/background/handlers/Extension.js +6 -83
  38. package/package.json +6 -12
  39. package/packageInfo.js +1 -1
  40. package/services/balance-service/transfer/xcm/availBridge.js +6 -6
  41. package/services/base/types.d.ts +0 -4
  42. package/services/earning-service/handlers/base.d.ts +4 -3
  43. package/services/earning-service/handlers/base.js +6 -4
  44. package/services/earning-service/handlers/native-staking/base.js +4 -1
  45. package/services/earning-service/handlers/native-staking/dtao.d.ts +9 -6
  46. package/services/earning-service/handlers/native-staking/dtao.js +69 -48
  47. package/services/earning-service/handlers/native-staking/tao.js +12 -2
  48. package/services/earning-service/service.d.ts +2 -1
  49. package/services/earning-service/service.js +2 -1
  50. package/services/fee-service/utils/index.d.ts +1 -0
  51. package/services/fee-service/utils/index.js +14 -4
  52. package/services/inapp-notification-service/index.js +13 -7
  53. package/services/swap-service/handler/asset-hub/handler.d.ts +2 -9
  54. package/services/swap-service/handler/asset-hub/handler.js +64 -317
  55. package/services/swap-service/handler/base-handler.d.ts +6 -9
  56. package/services/swap-service/handler/base-handler.js +391 -229
  57. package/services/swap-service/handler/chainflip-handler.d.ts +2 -4
  58. package/services/swap-service/handler/chainflip-handler.js +15 -37
  59. package/services/swap-service/handler/hydradx-handler.d.ts +3 -10
  60. package/services/swap-service/handler/hydradx-handler.js +78 -270
  61. package/services/swap-service/handler/simpleswap-handler.d.ts +2 -4
  62. package/services/swap-service/handler/simpleswap-handler.js +24 -45
  63. package/services/swap-service/handler/uniswap-handler.d.ts +4 -6
  64. package/services/swap-service/handler/uniswap-handler.js +25 -46
  65. package/services/swap-service/index.d.ts +8 -14
  66. package/services/swap-service/index.js +141 -129
  67. package/services/swap-service/utils.d.ts +11 -3
  68. package/services/swap-service/utils.js +96 -15
  69. package/services/transaction-service/index.js +2 -2
  70. package/types/service-base.d.ts +2 -3
  71. package/types/swap/index.d.ts +25 -9
  72. package/types/swap/index.js +10 -0
  73. package/types/transaction/process.d.ts +19 -0
  74. package/types/yield/actions/join/submit.d.ts +4 -1
  75. package/types/yield/actions/others.d.ts +2 -0
  76. package/utils/swap.d.ts +3 -0
  77. package/utils/swap.js +3 -0
  78. package/cjs/services/swap-service/interface.js +0 -14
  79. package/services/swap-service/interface.d.ts +0 -9
  80. package/services/swap-service/interface.js +0 -8
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.29-1",
20
+ "version": "1.3.30-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1886,11 +1886,6 @@
1886
1886
  "require": "./cjs/services/swap-service/handler/uniswap-handler.js",
1887
1887
  "default": "./services/swap-service/handler/uniswap-handler.js"
1888
1888
  },
1889
- "./services/swap-service/interface": {
1890
- "types": "./services/swap-service/interface.d.ts",
1891
- "require": "./cjs/services/swap-service/interface.js",
1892
- "default": "./services/swap-service/interface.js"
1893
- },
1894
1889
  "./services/swap-service/utils": {
1895
1890
  "types": "./services/swap-service/utils.d.ts",
1896
1891
  "require": "./cjs/services/swap-service/utils.js",
@@ -2642,7 +2637,6 @@
2642
2637
  "@ethereumjs/common": "^4.1.0",
2643
2638
  "@ethereumjs/tx": "^5.1.0",
2644
2639
  "@ethersproject/abi": "^5.7.0",
2645
- "@galacticcouncil/sdk": "^5.1.0",
2646
2640
  "@gear-js/api": "^0.38.1",
2647
2641
  "@json-rpc-tools/utils": "^1.7.6",
2648
2642
  "@metamask/eth-sig-util": "^7.0.3",
@@ -2670,12 +2664,12 @@
2670
2664
  "@sora-substrate/type-definitions": "^1.17.7",
2671
2665
  "@substrate/connect": "^0.8.9",
2672
2666
  "@subwallet/chain-list": "0.2.102",
2673
- "@subwallet/extension-base": "^1.3.29-1",
2674
- "@subwallet/extension-chains": "^1.3.29-1",
2675
- "@subwallet/extension-dapp": "^1.3.29-1",
2676
- "@subwallet/extension-inject": "^1.3.29-1",
2667
+ "@subwallet/extension-base": "^1.3.30-0",
2668
+ "@subwallet/extension-chains": "^1.3.30-0",
2669
+ "@subwallet/extension-dapp": "^1.3.30-0",
2670
+ "@subwallet/extension-inject": "^1.3.30-0",
2677
2671
  "@subwallet/keyring": "^0.1.9",
2678
- "@subwallet/subwallet-api-sdk": "^1.3.29-1",
2672
+ "@subwallet/subwallet-api-sdk": "^1.3.30-0",
2679
2673
  "@subwallet/ui-keyring": "^0.1.9",
2680
2674
  "@ton/core": "^0.56.3",
2681
2675
  "@ton/crypto": "^3.2.0",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-base',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.3.29-1'
10
+ version: '1.3.30-0'
11
11
  };
@@ -55,12 +55,12 @@ export async function getClaimTxOnAvail(notification, substrateApi) {
55
55
  const chainApi = await substrateApi.isReady;
56
56
  const chainSlug = chainApi.chainSlug;
57
57
  const metadata = notification.metadata;
58
- const lastestEthHeadSlot = await getLastestEthHeadSlot(chainSlug);
59
- const lastestBlockHash = await getLastestBlockHash(chainSlug, lastestEthHeadSlot);
60
- const proof = await getClaimProofOnAvail(chainSlug, lastestBlockHash, metadata.messageId);
61
- return chainApi.api.tx.vector.execute(lastestEthHeadSlot, getAddressMessage(notification), proof.accountProof, proof.storageProof);
58
+ const latestEthHeadSlot = await getLatestEthHeadSlot(chainSlug);
59
+ const latestBlockHash = await getLatestBlockHash(chainSlug, latestEthHeadSlot);
60
+ const proof = await getClaimProofOnAvail(chainSlug, latestBlockHash, metadata.messageId);
61
+ return chainApi.api.tx.vector.execute(latestEthHeadSlot, getAddressMessage(notification), proof.accountProof, proof.storageProof);
62
62
  }
63
- async function getLastestEthHeadSlot(chainSlug) {
63
+ async function getLatestEthHeadSlot(chainSlug) {
64
64
  try {
65
65
  const api = getAvailBridgeApi(chainSlug);
66
66
  const rawResponse = await fetch(`${api}/eth/head`);
@@ -71,7 +71,7 @@ async function getLastestEthHeadSlot(chainSlug) {
71
71
  throw e;
72
72
  }
73
73
  }
74
- async function getLastestBlockHash(chainSlug, slot) {
74
+ async function getLatestBlockHash(chainSlug, slot) {
75
75
  try {
76
76
  const api = getAvailBridgeApi(chainSlug);
77
77
  const rawResponse = await fetch(`${api}/beacon/slot/${slot}`);
@@ -1,4 +1,3 @@
1
- import { OptimalProcessParams, OptimalProcessResult } from '@subwallet/extension-base/types/service-base';
2
1
  import { PromiseHandler } from '@subwallet/extension-base/utils/promise';
3
2
  export declare enum ServiceStatus {
4
3
  NOT_INITIALIZED = "not_initialized",
@@ -33,6 +32,3 @@ export interface CronServiceInterface {
33
32
  startCron: () => Promise<void>;
34
33
  stopCron: () => Promise<void>;
35
34
  }
36
- export interface ServiceWithProcessInterface {
37
- generateOptimalProcess(params: OptimalProcessParams): Promise<OptimalProcessResult>;
38
- }
@@ -4,6 +4,7 @@ import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/K
4
4
  import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
5
5
  import { _EvmApi, _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
6
6
  import { BasePoolInfo, BaseYieldPoolMetadata, EarningRewardHistoryItem, EarningRewardItem, HandleYieldStepData, OptimalYieldPath, OptimalYieldPathParams, RequestEarlyValidateYield, RequestEarningSlippage, ResponseEarlyValidateYield, StakeCancelWithdrawalParams, SubmitYieldJoinData, TransactionData, UnstakingInfo, YieldPoolInfo, YieldPoolMethodInfo, YieldPoolTarget, YieldPoolType, YieldPositionInfo, YieldStepBaseInfo, YieldTokenBaseInfo } from '@subwallet/extension-base/types';
7
+ import { EarningSlippageResult } from './native-staking/dtao';
7
8
  /**
8
9
  * @class BasePoolHandler
9
10
  * @description Base pool handler
@@ -101,11 +102,11 @@ export default abstract class BasePoolHandler {
101
102
  /** Validate param to leave the pool */
102
103
  abstract validateYieldLeave(amount: string, address: string, fastLeave: boolean, selectedTarget?: string, slug?: string, poolInfo?: YieldPoolInfo): Promise<TransactionError[]>;
103
104
  /** Create `transaction` to leave the pool normal (default unstake) */
104
- protected abstract handleYieldUnstake(amount: string, address: string, selectedTarget?: string, netuid?: number): Promise<[ExtrinsicType, TransactionData]>;
105
+ protected abstract handleYieldUnstake(amount: string, address: string, selectedTarget?: string, netuid?: number, slippage?: number): Promise<[ExtrinsicType, TransactionData]>;
105
106
  /** Create `transaction` to leave the pool fast (swap token) */
106
107
  protected abstract handleYieldRedeem(amount: string, address: string, selectedTarget?: string): Promise<[ExtrinsicType, TransactionData]>;
107
108
  /** Create `transaction` to leave the pool */
108
- handleYieldLeave(fastLeave: boolean, amount: string, address: string, selectedTarget?: string, netuid?: number): Promise<[ExtrinsicType, TransactionData]>;
109
+ handleYieldLeave(fastLeave: boolean, amount: string, address: string, selectedTarget?: string, netuid?: number, slippage?: number): Promise<[ExtrinsicType, TransactionData]>;
109
110
  /** Create `transaction` to withdraw unstaked amount */
110
111
  abstract handleYieldWithdraw(address: string, unstakingInfo: UnstakingInfo): Promise<TransactionData>;
111
112
  /** Create `transaction` to cancel unstake */
@@ -114,5 +115,5 @@ export default abstract class BasePoolHandler {
114
115
  abstract handleYieldClaimReward(address: string, bondReward?: boolean): Promise<TransactionData>;
115
116
  /** Check handler can handle slug */
116
117
  canHandleSlug(slug: string): boolean;
117
- getEarningSlippage(params: RequestEarningSlippage): Promise<number>;
118
+ getEarningSlippage(params: RequestEarningSlippage): Promise<EarningSlippageResult>;
118
119
  }
@@ -7,7 +7,6 @@ import { DEFAULT_YIELD_FIRST_STEP } from '@subwallet/extension-base/services/ear
7
7
  import { createClaimNotification, createWithdrawNotifications } from '@subwallet/extension-base/services/inapp-notification-service/utils';
8
8
  import { formatNumber, reformatAddress } from '@subwallet/extension-base/utils';
9
9
  import { BN, BN_TEN } from '@polkadot/util';
10
-
11
10
  /**
12
11
  * @class BasePoolHandler
13
12
  * @description Base pool handler
@@ -249,11 +248,11 @@ export default class BasePoolHandler {
249
248
  /** Validate param to join the pool */
250
249
 
251
250
  /** Create `transaction` to leave the pool */
252
- async handleYieldLeave(fastLeave, amount, address, selectedTarget, netuid) {
251
+ async handleYieldLeave(fastLeave, amount, address, selectedTarget, netuid, slippage) {
253
252
  if (fastLeave) {
254
253
  return this.handleYieldRedeem(amount, address, selectedTarget);
255
254
  } else {
256
- return this.handleYieldUnstake(amount, address, selectedTarget, netuid);
255
+ return this.handleYieldUnstake(amount, address, selectedTarget, netuid, slippage);
257
256
  }
258
257
  }
259
258
 
@@ -268,7 +267,10 @@ export default class BasePoolHandler {
268
267
  return this.slug === slug;
269
268
  }
270
269
  getEarningSlippage(params) {
271
- return Promise.resolve(0);
270
+ return Promise.resolve({
271
+ slippage: 0,
272
+ rate: 1
273
+ });
272
274
  }
273
275
  /* Other actions */
274
276
  }
@@ -102,7 +102,10 @@ export default class BaseNativeStakingPoolHandler extends BasePoolHandler {
102
102
  address,
103
103
  slug,
104
104
  selectedValidators,
105
- netuid
105
+ subnetData: {
106
+ netuid: netuid || 0,
107
+ slippage: 0
108
+ }
106
109
  };
107
110
  const positionInfo = await this.getPoolPosition(address);
108
111
  const [, fee] = await this.createJoinExtrinsic(data, positionInfo);
@@ -2,10 +2,9 @@ import { _ChainInfo } from '@subwallet/chain-list/types';
2
2
  import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
3
3
  import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
4
4
  import KoniState from '@subwallet/extension-base/koni/background/handlers/State';
5
- import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
6
5
  import BaseParaStakingPoolHandler from '@subwallet/extension-base/services/earning-service/handlers/native-staking/base-para';
7
6
  import { BaseYieldPositionInfo, OptimalYieldPath, RequestEarningSlippage, StakeCancelWithdrawalParams, SubmitJoinNativeStaking, TransactionData, UnstakingInfo, ValidatorInfo, YieldPoolInfo, YieldPoolMethodInfo, YieldPoolType, YieldPositionInfo, YieldTokenBaseInfo } from '@subwallet/extension-base/types';
8
- import { BigNumber } from 'bignumber.js';
7
+ import BigN from 'bignumber.js';
9
8
  export interface SubnetData {
10
9
  netuid: number;
11
10
  name: string;
@@ -13,11 +12,12 @@ export interface SubnetData {
13
12
  ownerHotkey: string;
14
13
  maxAllowedValidators: number;
15
14
  taoIn: number;
15
+ taoInEmission: number;
16
16
  }
17
17
  interface TaoStakingStakeOption {
18
18
  owner: string;
19
19
  amount: string;
20
- rate?: BigNumber;
20
+ rate?: BigN;
21
21
  identity?: string;
22
22
  }
23
23
  export interface RawDelegateState {
@@ -36,8 +36,11 @@ export interface TestnetBittensorDelegateInfo {
36
36
  nominators: Nominators;
37
37
  returnPer1000: number;
38
38
  }
39
+ export interface EarningSlippageResult {
40
+ slippage: number;
41
+ rate: number;
42
+ }
39
43
  export declare const DEFAULT_DTAO_MINBOND = "600000";
40
- export declare const getAlphaToTaoMapping: (substrateApi: _SubstrateApi) => Promise<Record<number, string>>;
41
44
  export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHandler {
42
45
  handleYieldWithdraw(address: string, unstakingInfo: UnstakingInfo): Promise<TransactionData>;
43
46
  handleYieldCancelUnstake(params: StakeCancelWithdrawalParams): Promise<TransactionData>;
@@ -51,7 +54,7 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
51
54
  readonly availableMethod: YieldPoolMethodInfo;
52
55
  constructor(state: KoniState, chain: string);
53
56
  canHandleSlug(slug: string): boolean;
54
- getEarningSlippage(params: RequestEarningSlippage): Promise<number>;
57
+ getEarningSlippage(params: RequestEarningSlippage): Promise<EarningSlippageResult>;
55
58
  get maintainBalance(): string;
56
59
  private init;
57
60
  protected getDescription(): string;
@@ -63,7 +66,7 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
63
66
  getPoolTargets(): Promise<ValidatorInfo[]>;
64
67
  createJoinExtrinsic(data: SubmitJoinNativeStaking, positionInfo?: YieldPositionInfo, bondDest?: string): Promise<[TransactionData, YieldTokenBaseInfo]>;
65
68
  validateYieldJoin(data: SubmitJoinNativeStaking, path: OptimalYieldPath): Promise<TransactionError[]>;
66
- handleYieldUnstake(amount: string, address: string, selectedTarget?: string, netuid?: number): Promise<[ExtrinsicType, TransactionData]>;
69
+ handleYieldUnstake(amount: string, address: string, selectedTarget?: string, netuid?: number, slippage?: number): Promise<[ExtrinsicType, TransactionData]>;
67
70
  validateYieldLeave(amount: string, address: string, fastLeave: boolean, selectedTarget?: string, slug?: string, poolInfo?: YieldPoolInfo): Promise<TransactionError[]>;
68
71
  }
69
72
  export {};
@@ -9,31 +9,38 @@ import { _getAssetDecimals, _getAssetSymbol } from '@subwallet/extension-base/se
9
9
  import BaseParaStakingPoolHandler from '@subwallet/extension-base/services/earning-service/handlers/native-staking/base-para';
10
10
  import { BasicTxErrorType, EarningStatus, YieldPoolType } from '@subwallet/extension-base/types';
11
11
  import { formatNumber, reformatAddress } from '@subwallet/extension-base/utils';
12
- import BigN, { BigNumber } from 'bignumber.js';
12
+ import BigN from 'bignumber.js';
13
13
  import { t } from 'i18next';
14
- import { BN, BN_TEN, BN_ZERO } from '@polkadot/util';
14
+ import { BN, BN_ZERO } from '@polkadot/util';
15
15
  import { calculateReward } from "../../utils/index.js";
16
16
  import { BittensorCache } from "./tao.js";
17
17
  const DEFAULT_BITTENSOR_SLIPPAGE = 0.005;
18
18
  export const DEFAULT_DTAO_MINBOND = '600000';
19
- export const getAlphaToTaoMapping = async substrateApi => {
19
+ const getAlphaToTaoMapping = async substrateApi => {
20
20
  const allSubnets = (await substrateApi.api.call.subnetInfoRuntimeApi.getAllDynamicInfo()).toJSON();
21
- if (!allSubnets) {
21
+ if (!allSubnets || allSubnets.length === 0) {
22
22
  return {};
23
23
  }
24
- return allSubnets.reduce((acc, subnet) => {
24
+ const result = Object.create(null);
25
+ for (const subnet of allSubnets) {
25
26
  const netuid = subnet === null || subnet === void 0 ? void 0 : subnet.netuid;
27
+ if (netuid === undefined) {
28
+ continue;
29
+ }
26
30
  const taoIn = subnet !== null && subnet !== void 0 && subnet.taoIn ? new BigN(subnet.taoIn) : new BigN(0);
27
31
  const alphaIn = subnet !== null && subnet !== void 0 && subnet.alphaIn ? new BigN(subnet.alphaIn) : new BigN(0);
28
- if (netuid === 0) {
29
- acc[netuid] = '1';
30
- } else if (alphaIn.gt(0)) {
31
- acc[netuid] = taoIn.dividedBy(alphaIn).toString();
32
- } else {
33
- acc[netuid] = '1';
34
- }
35
- return acc;
36
- }, {});
32
+ result[netuid] = netuid === 0 || alphaIn.lte(0) ? '1' : taoIn.dividedBy(alphaIn).toString();
33
+ }
34
+ return result;
35
+ };
36
+ const getAlphaToTaoRate = async (substrateApi, netuid) => {
37
+ const subnetInfo = (await substrateApi.api.call.subnetInfoRuntimeApi.getDynamicInfo(netuid)).toJSON();
38
+ if (!subnetInfo) {
39
+ return '1';
40
+ }
41
+ const taoIn = subnetInfo.taoIn ? new BigN(subnetInfo.taoIn) : new BigN(0);
42
+ const alphaIn = subnetInfo.alphaIn ? new BigN(subnetInfo.alphaIn) : new BigN(0);
43
+ return netuid === 0 || alphaIn.lte(0) ? '1' : taoIn.dividedBy(alphaIn).toString();
37
44
  };
38
45
  export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHandler {
39
46
  /* Unimplemented function */
@@ -73,30 +80,40 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
73
80
  async getEarningSlippage(params) {
74
81
  const substrateApi = await this.substrateApi.isReady;
75
82
  const subnetInfo = (await substrateApi.api.call.subnetInfoRuntimeApi.getDynamicInfo(params.netuid)).toJSON();
76
- const alphaIn = new BigNumber((subnetInfo === null || subnetInfo === void 0 ? void 0 : subnetInfo.alphaIn) || 0);
77
- const taoIn = new BigNumber((subnetInfo === null || subnetInfo === void 0 ? void 0 : subnetInfo.taoIn) || 0);
83
+ const alphaIn = new BigN((subnetInfo === null || subnetInfo === void 0 ? void 0 : subnetInfo.alphaIn) || 0);
84
+ const taoIn = new BigN((subnetInfo === null || subnetInfo === void 0 ? void 0 : subnetInfo.taoIn) || 0);
78
85
  const k = alphaIn.multipliedBy(taoIn);
79
- const value = new BigNumber(params.value);
86
+ const value = new BigN(params.value);
87
+ const rate = taoIn.dividedBy(alphaIn);
80
88
  if (params.type === ExtrinsicType.STAKING_BOND) {
81
89
  const newTaoIn = taoIn.plus(value);
82
90
  const newAlphaIn = k.dividedBy(newTaoIn);
83
91
  const alphaReturned = alphaIn.minus(newAlphaIn);
84
92
  const alphaIdeal = value.multipliedBy(alphaIn).dividedBy(taoIn);
85
93
  const slippage = alphaIdeal.minus(alphaReturned).dividedBy(alphaIdeal);
86
- return slippage.toNumber();
94
+ return {
95
+ slippage: slippage.plus(0.0001).toNumber(),
96
+ rate: rate.toNumber()
97
+ };
87
98
  } else if (params.type === ExtrinsicType.STAKING_UNBOND) {
88
99
  const newAlphaIn = alphaIn.plus(value);
89
100
  const newTaoReserve = k.dividedBy(newAlphaIn);
90
101
  const taoReturned = taoIn.minus(newTaoReserve);
91
102
  const taoIdeal = value.multipliedBy(taoIn).dividedBy(alphaIn);
92
103
  const slippage = taoIdeal.minus(taoReturned).dividedBy(taoIdeal);
93
- return slippage.toNumber();
104
+ return {
105
+ slippage: slippage.plus(0.0001).toNumber(),
106
+ rate: rate.toNumber()
107
+ };
94
108
  }
95
- return 0;
109
+ return {
110
+ slippage: 0,
111
+ rate: 1
112
+ };
96
113
  }
97
114
  get maintainBalance() {
98
- const ed = new BN(this.nativeToken.minAmount || '0');
99
- const calculateMaintainBalance = new BN(15).mul(ed).div(BN_TEN);
115
+ const ed = new BigN(this.nativeToken.minAmount || '0');
116
+ const calculateMaintainBalance = new BigN(15).multipliedBy(ed).dividedBy(10);
100
117
  const maintainBalance = calculateMaintainBalance;
101
118
  return maintainBalance.toString();
102
119
  }
@@ -123,7 +140,8 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
123
140
  symbol,
124
141
  ownerHotkey: dynInfo.ownerHotkey,
125
142
  maxAllowedValidators: extraInfo ? extraInfo.maxAllowedValidators : 0,
126
- taoIn: dynInfo.taoIn
143
+ taoIn: dynInfo.taoIn,
144
+ taoInEmission: dynInfo.taoInEmission
127
145
  };
128
146
  });
129
147
  this.subnetData = mergedData;
@@ -153,7 +171,8 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
153
171
  const netuid = subnet.netuid.toString().padStart(2, '0');
154
172
  const subnetSlug = `${this.slug}__subnet_${netuid.padStart(2, '0')}`;
155
173
  const subnetName = `${subnet.name || 'Unknown'} ${netuid}`;
156
- const bnTaoIn = new BN(subnet.taoIn);
174
+ const bnTaoIn = new BigN(subnet.taoIn);
175
+ const emission = new BigN(subnet.taoInEmission).dividedBy(new BigN(10).pow(new BigN(7)));
157
176
  const data = {
158
177
  ...this.baseInfo,
159
178
  type: this.type,
@@ -182,7 +201,8 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
182
201
  eraTime: 24,
183
202
  era: 0,
184
203
  unstakingPeriod: 1.2,
185
- tvl: bnTaoIn.toString()
204
+ tvl: bnTaoIn.toString(),
205
+ totalApy: emission.toNumber()
186
206
  }
187
207
  };
188
208
  callback(data);
@@ -350,7 +370,7 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
350
370
  // eslint-disable-next-line @typescript-eslint/require-await
351
371
  async getDevnetPoolTargets() {
352
372
  const testnetDelegate = (await this.substrateApi.api.call.delegateInfoRuntimeApi.getDelegates()).toJSON();
353
- const bnMinBond = new BN(DEFAULT_DTAO_MINBOND);
373
+ const bnMinBond = new BigN(DEFAULT_DTAO_MINBOND);
354
374
  const filteredDelegates = testnetDelegate.filter(delegate => {
355
375
  return delegate.returnPer1000 !== 0;
356
376
  });
@@ -371,14 +391,14 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
371
391
  async getMainnetPoolTargets() {
372
392
  const _topValidator = await this.bittensorCache.get();
373
393
  const topValidator = _topValidator;
374
- const bnMinBond = new BN(DEFAULT_DTAO_MINBOND);
394
+ const bnMinBond = new BigN(DEFAULT_DTAO_MINBOND);
375
395
  const validatorList = topValidator.data;
376
396
  const validatorAddresses = Object.keys(validatorList);
377
397
  const results = await Promise.all(validatorAddresses.map(i => {
378
398
  const address = validatorList[i].hotkey.ss58;
379
- const bnTotalStake = new BN(validatorList[i].stake);
380
- const bnOwnStake = new BN(validatorList[i].validator_stake);
381
- const otherStake = bnTotalStake.sub(bnOwnStake);
399
+ const bnTotalStake = new BigN(validatorList[i].stake);
400
+ const bnOwnStake = new BigN(validatorList[i].validator_stake);
401
+ const otherStake = bnTotalStake.minus(bnOwnStake);
382
402
  const nominatorCount = validatorList[i].nominators;
383
403
  const commission = validatorList[i].take;
384
404
  const roundedCommission = (parseFloat(commission) * 100).toFixed(0);
@@ -419,15 +439,18 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
419
439
  async createJoinExtrinsic(data, positionInfo, bondDest = 'Staked') {
420
440
  const {
421
441
  amount,
422
- netuid,
423
- selectedValidators: targetValidators
442
+ selectedValidators: targetValidators,
443
+ subnetData
424
444
  } = data;
445
+ const {
446
+ netuid,
447
+ slippage
448
+ } = subnetData;
425
449
  const chainApi = await this.substrateApi.isReady;
426
- const binaryAmount = new BN(amount);
427
- const price = await getAlphaToTaoMapping(this.substrateApi);
428
- const alphaToTaoPrice = new BigN(price[netuid]);
429
- const limitPrice = alphaToTaoPrice.multipliedBy(10 ** _getAssetDecimals(this.nativeToken)).multipliedBy(1 + DEFAULT_BITTENSOR_SLIPPAGE);
430
- const BNlimitPrice = new BN(limitPrice.integerValue(BigNumber.ROUND_CEIL).toFixed());
450
+ const binaryAmount = new BigN(amount);
451
+ const alphaToTaoPrice = new BigN(await getAlphaToTaoRate(this.substrateApi, netuid));
452
+ const limitPrice = alphaToTaoPrice.multipliedBy(10 ** _getAssetDecimals(this.nativeToken)).multipliedBy(1 + (slippage || DEFAULT_BITTENSOR_SLIPPAGE));
453
+ const BNlimitPrice = new BigN(limitPrice.integerValue(BigN.ROUND_CEIL).toFixed());
431
454
  const selectedValidatorInfo = targetValidators[0];
432
455
  const hotkey = selectedValidatorInfo.address;
433
456
  const extrinsic = chainApi.api.tx.subtensorModule.addStakeLimit(hotkey, netuid, binaryAmount, BNlimitPrice, false);
@@ -444,7 +467,7 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
444
467
  const {
445
468
  amount
446
469
  } = data;
447
- if (new BN(amount).lt(new BN(DEFAULT_DTAO_MINBOND))) {
470
+ if (new BigN(amount).lt(new BigN(DEFAULT_DTAO_MINBOND))) {
448
471
  return [new TransactionError(BasicTxErrorType.INVALID_PARAMS, t(`Insufficient stake. You need to stake at least ${formatNumber(DEFAULT_DTAO_MINBOND, _getAssetDecimals(this.nativeToken))} ${_getAssetSymbol(this.nativeToken)} to earn rewards`))];
449
472
  }
450
473
  return baseErrors;
@@ -454,16 +477,15 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
454
477
 
455
478
  /* Leave pool action */
456
479
 
457
- async handleYieldUnstake(amount, address, selectedTarget, netuid) {
480
+ async handleYieldUnstake(amount, address, selectedTarget, netuid, slippage) {
458
481
  const apiPromise = await this.substrateApi.isReady;
459
- const binaryAmount = new BN(amount);
460
- const price = await getAlphaToTaoMapping(this.substrateApi);
461
- const alphaToTaoPrice = new BigN(price[netuid]);
462
- const limitPrice = alphaToTaoPrice.multipliedBy(10 ** _getAssetDecimals(this.nativeToken)).multipliedBy(1 - DEFAULT_BITTENSOR_SLIPPAGE);
463
- const BNlimitPrice = new BN(limitPrice.integerValue(BigNumber.ROUND_CEIL).toFixed());
464
482
  if (!selectedTarget) {
465
483
  return Promise.reject(new TransactionError(BasicTxErrorType.INVALID_PARAMS));
466
484
  }
485
+ const binaryAmount = new BigN(amount);
486
+ const alphaToTaoPrice = new BigN(await getAlphaToTaoRate(this.substrateApi, netuid || 0));
487
+ const limitPrice = alphaToTaoPrice.multipliedBy(10 ** _getAssetDecimals(this.nativeToken)).multipliedBy(1 - (slippage || DEFAULT_BITTENSOR_SLIPPAGE));
488
+ const BNlimitPrice = new BigN(limitPrice.integerValue(BigN.ROUND_CEIL).toFixed());
467
489
  const extrinsic = apiPromise.api.tx.subtensorModule.removeStakeLimit(selectedTarget, netuid, binaryAmount, BNlimitPrice, false);
468
490
  return [ExtrinsicType.STAKING_UNBOND, extrinsic];
469
491
  }
@@ -477,10 +499,9 @@ export default class SubnetTaoStakingPoolHandler extends BaseParaStakingPoolHand
477
499
  return [new TransactionError(BasicTxErrorType.INVALID_PARAMS)];
478
500
  }
479
501
  const netuid = (_poolInfo$metadata$su = poolInfo.metadata.subnetData) === null || _poolInfo$metadata$su === void 0 ? void 0 : _poolInfo$metadata$su.netuid;
480
- const price = await getAlphaToTaoMapping(this.substrateApi);
481
- const minUnstake = new BigN(DEFAULT_DTAO_MINBOND).dividedBy(new BigN(price[netuid]));
482
- console.log('minUnstake', minUnstake.dividedBy(10 ** _getAssetDecimals(this.nativeToken)).toString());
483
- const formattedMinUnstake = minUnstake.dividedBy(1000000).integerValue(BigNumber.ROUND_CEIL).dividedBy(1000);
502
+ const alphaToTaoPrice = new BigN(await getAlphaToTaoRate(this.substrateApi, netuid || 0));
503
+ const minUnstake = new BigN(DEFAULT_DTAO_MINBOND).dividedBy(alphaToTaoPrice);
504
+ const formattedMinUnstake = minUnstake.dividedBy(1000000).integerValue(BigN.ROUND_CEIL).dividedBy(1000);
484
505
  if (new BigN(amount).lt(formattedMinUnstake.multipliedBy(10 ** _getAssetDecimals(this.nativeToken)))) {
485
506
  var _poolInfo$metadata$su2;
486
507
  return [new TransactionError(BasicTxErrorType.INVALID_PARAMS, t(`Amount too low. You need to unstake at least ${formattedMinUnstake.toString()} ${((_poolInfo$metadata$su2 = poolInfo.metadata.subnetData) === null || _poolInfo$metadata$su2 === void 0 ? void 0 : _poolInfo$metadata$su2.subnetSymbol) || ''}`))];
@@ -61,7 +61,7 @@ export class BittensorCache {
61
61
  async fetchData() {
62
62
  const apiKey = bittensorApiKey();
63
63
  try {
64
- const resp = await fetch('https://api.taostats.io/api/validator/latest/v1?limit=200', {
64
+ const resp = await fetch('https://api.taostats.io/api/validator/latest/v1?limit=50', {
65
65
  method: 'GET',
66
66
  headers: {
67
67
  'Content-Type': 'application/json',
@@ -173,8 +173,17 @@ export default class TaoNativeStakingPoolHandler extends BaseParaStakingPoolHand
173
173
  const minDelegatorStake = (await substrateApi.api.query.subtensorModule.nominatorMinRequiredStake()).toPrimitive() || 0;
174
174
  const maxValidatorPerNominator = (await substrateApi.api.query.subtensorModule.maxAllowedValidators(0)).toPrimitive();
175
175
  const taoIn = (await substrateApi.api.query.subtensorModule.subnetTAO(0)).toPrimitive();
176
+ const _topValidator = await this.bittensorCache.get();
177
+ const validators = _topValidator.data;
178
+ let highestApr = validators[0];
179
+ for (let i = 1; i < validators.length; i++) {
180
+ if (parseFloat(validators[i].apr) > parseFloat(highestApr.apr)) {
181
+ highestApr = validators[i];
182
+ }
183
+ }
176
184
  const bnTaoIn = new BN(taoIn);
177
185
  const BNminDelegatorStake = new BigN(minDelegatorStake.toString());
186
+ const apr = this.chain === 'bittensor' ? Number(highestApr.apr) * 100 : 0;
178
187
  const data = {
179
188
  ...this.baseInfo,
180
189
  type: this.type,
@@ -196,7 +205,8 @@ export default class TaoNativeStakingPoolHandler extends BaseParaStakingPoolHand
196
205
  eraTime: 24,
197
206
  era: 0,
198
207
  unstakingPeriod: 1.2,
199
- tvl: bnTaoIn.toString()
208
+ tvl: bnTaoIn.toString(),
209
+ totalApy: apr
200
210
  }
201
211
  };
202
212
  callback(data);
@@ -6,6 +6,7 @@ import { PersistDataServiceInterface, ServiceStatus, StoppableServiceInterface }
6
6
  import { EarningRewardHistoryItem, EarningRewardItem, EarningRewardJson, HandleYieldStepData, HandleYieldStepParams, OptimalYieldPath, OptimalYieldPathParams, RequestEarlyValidateYield, RequestEarningSlippage, RequestStakeCancelWithdrawal, RequestStakeClaimReward, RequestYieldLeave, RequestYieldWithdrawal, ResponseEarlyValidateYield, TransactionData, ValidateYieldProcessParams, YieldPoolInfo, YieldPoolTarget, YieldPositionInfo } from '@subwallet/extension-base/types';
7
7
  import { PromiseHandler } from '@subwallet/extension-base/utils';
8
8
  import { BehaviorSubject } from 'rxjs';
9
+ import { EarningSlippageResult } from './handlers/native-staking/dtao';
9
10
  import { BasePoolHandler } from './handlers';
10
11
  export default class EarningService implements StoppableServiceInterface, PersistDataServiceInterface {
11
12
  protected readonly state: KoniState;
@@ -98,6 +99,6 @@ export default class EarningService implements StoppableServiceInterface, Persis
98
99
  handleYieldWithdraw(params: RequestYieldWithdrawal): Promise<TransactionData>;
99
100
  handleYieldCancelUnstake(params: RequestStakeCancelWithdrawal): Promise<TransactionData>;
100
101
  handleYieldClaimReward(params: RequestStakeClaimReward): Promise<TransactionData>;
101
- yieldGetEarningSlippage(params: RequestEarningSlippage): Promise<number>;
102
+ yieldGetEarningSlippage(params: RequestEarningSlippage): Promise<EarningSlippageResult>;
102
103
  resetWallet(): Promise<void>;
103
104
  }
@@ -755,8 +755,9 @@ export default class EarningService {
755
755
  } = params;
756
756
  const handler = this.getPoolHandler(slug);
757
757
  const netuid = (_params$poolInfo$meta = params.poolInfo.metadata.subnetData) === null || _params$poolInfo$meta === void 0 ? void 0 : _params$poolInfo$meta.netuid;
758
+ const slippage = params.slippage;
758
759
  if (handler) {
759
- return handler.handleYieldLeave(params.fastLeave, params.amount, params.address, params.selectedTarget, netuid);
760
+ return handler.handleYieldLeave(params.fastLeave, params.amount, params.address, params.selectedTarget, netuid, slippage);
760
761
  } else {
761
762
  return Promise.reject(new TransactionError(BasicTxErrorType.INTERNAL_ERROR));
762
763
  }
@@ -11,4 +11,5 @@ export declare const fetchOnlineFeeData: (chainId: number, networkKey: string, u
11
11
  export declare const recalculateGasPrice: (_price: string, chain: string) => string;
12
12
  export declare const getEIP1559GasFee: (baseFee: BigN, maxPriorityFee: BigN, blockNumber: number, blockTime: number) => EvmEIP1559FeeOption;
13
13
  export declare const calculateGasFeeParams: (web3: _EvmApi, networkKey: string, useOnline?: boolean, useInfura?: boolean) => Promise<EvmFeeInfo>;
14
+ export declare const enforceMinOneTip: (feeOptionDetail: EvmEIP1559FeeOption) => EvmEIP1559FeeOption;
14
15
  export declare const calculateToAmountByReservePool: (api: ApiPromise, fromToken: _ChainAsset, toToken: _ChainAsset, fromAmount: string) => Promise<string>;
@@ -10,7 +10,7 @@ const INFURA_API_KEY = process.env.INFURA_API_KEY || '';
10
10
  const INFURA_API_KEY_SECRET = process.env.INFURA_API_KEY_SECRET || '';
11
11
  const INFURA_AUTH = 'Basic ' + Buffer.from(INFURA_API_KEY + ':' + INFURA_API_KEY_SECRET).toString('base64');
12
12
  export const FEE_COVERAGE_PERCENTAGE_SPECIAL_CASE = 105; // percentage
13
-
13
+ const EIP1559_MIN_PRIORITY_FEE = '1';
14
14
  export const parseInfuraFee = (info, threshold) => {
15
15
  const base = new BigN(info.estimatedBaseFee).multipliedBy(BN_WEI);
16
16
  const thresholdBN = new BigN(threshold.busyThreshold).multipliedBy(BN_WEI);
@@ -161,15 +161,18 @@ export const calculateGasFeeParams = async (web3, networkKey, useOnline = true,
161
161
  const slowPriorityFee = history.reward.reduce((previous, rewards) => previous.plus(rewards[0]), BN_ZERO).dividedBy(numBlock).decimalPlaces(0);
162
162
  const averagePriorityFee = history.reward.reduce((previous, rewards) => previous.plus(rewards[1]), BN_ZERO).dividedBy(numBlock).decimalPlaces(0);
163
163
  const fastPriorityFee = history.reward.reduce((previous, rewards) => previous.plus(rewards[2]), BN_ZERO).dividedBy(numBlock).decimalPlaces(0);
164
+ if (slowPriorityFee.eq(0) && averagePriorityFee.eq(0) && fastPriorityFee.eq(0)) {
165
+ throw new Error('Fee rates are currently same for all levels');
166
+ }
164
167
  return {
165
168
  type: 'evm',
166
169
  gasPrice: undefined,
167
170
  baseGasFee: baseGasFee.toString(),
168
171
  busyNetwork,
169
172
  options: {
170
- slow: getEIP1559GasFee(baseGasFee, slowPriorityFee, 10, blockTime),
171
- average: getEIP1559GasFee(baseGasFee, averagePriorityFee, 5, blockTime),
172
- fast: getEIP1559GasFee(baseGasFee, fastPriorityFee, 3, blockTime),
173
+ slow: enforceMinOneTip(getEIP1559GasFee(baseGasFee, slowPriorityFee, 10, blockTime)),
174
+ average: enforceMinOneTip(getEIP1559GasFee(baseGasFee, averagePriorityFee, 5, blockTime)),
175
+ fast: enforceMinOneTip(getEIP1559GasFee(baseGasFee, fastPriorityFee, 3, blockTime)),
173
176
  default: busyNetwork ? 'average' : 'slow'
174
177
  }
175
178
  };
@@ -185,6 +188,13 @@ export const calculateGasFeeParams = async (web3, networkKey, useOnline = true,
185
188
  };
186
189
  }
187
190
  };
191
+ export const enforceMinOneTip = feeOptionDetail => {
192
+ if (feeOptionDetail.maxPriorityFeePerGas === '0') {
193
+ feeOptionDetail.maxPriorityFeePerGas = EIP1559_MIN_PRIORITY_FEE;
194
+ return feeOptionDetail;
195
+ }
196
+ return feeOptionDetail;
197
+ };
188
198
  export const calculateToAmountByReservePool = async (api, fromToken, toToken, fromAmount) => {
189
199
  const reserve = await getReserveForPool(api, fromToken, toToken);
190
200
  return estimateTokensForPool(fromAmount, reserve);
@@ -4,12 +4,13 @@
4
4
  import { COMMON_ASSETS, COMMON_CHAIN_SLUGS } from '@subwallet/chain-list';
5
5
  import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
6
6
  import { CRON_LISTEN_AVAIL_BRIDGE_CLAIM } from '@subwallet/extension-base/constants';
7
- import { fetchLastestRemindNotificationTime } from '@subwallet/extension-base/constants/remind-notification-time';
7
+ import { fetchLatestRemindNotificationTime } from '@subwallet/extension-base/constants/remind-notification-time';
8
8
  import { ServiceStatus } from '@subwallet/extension-base/services/base/types';
9
9
  import { _STAKING_CHAIN_GROUP } from '@subwallet/extension-base/services/earning-service/constants';
10
10
  import { NotificationDescriptionMap, NotificationTitleMap, ONE_DAY_MILLISECOND } from '@subwallet/extension-base/services/inapp-notification-service/consts';
11
11
  import { NotificationActionType, NotificationTab } from '@subwallet/extension-base/services/inapp-notification-service/interfaces';
12
12
  import { AvailBridgeSourceChain, fetchAllAvailBridgeClaimable, fetchPolygonBridgeTransactions, hrsToMillisecond } from '@subwallet/extension-base/services/inapp-notification-service/utils';
13
+ import { getTokenPairFromStep } from '@subwallet/extension-base/services/swap-service/utils';
13
14
  import { ProcessType, YieldPoolType } from '@subwallet/extension-base/types';
14
15
  import { formatNumber, getAddressesByChainType, reformatAddress } from '@subwallet/extension-base/utils';
15
16
  import { isSubstrateAddress } from '@subwallet/keyring';
@@ -148,7 +149,7 @@ export class InappNotificationService {
148
149
  const [comparedNotifications, remindTimeConfig] = await Promise.all([this.fetchNotificationsByParams({
149
150
  notificationTab: NotificationTab.ALL,
150
151
  proxyId
151
- }), await fetchLastestRemindNotificationTime()]);
152
+ }), await fetchLatestRemindNotificationTime()]);
152
153
  for (const candidateNotification of notifications) {
153
154
  candidateNotification.title = candidateNotification.title.replace('{{accountName}}', accountName);
154
155
  if (this.passValidateNotification(candidateNotification, comparedNotifications, remindTimeConfig)) {
@@ -349,12 +350,17 @@ export class InappNotificationService {
349
350
  actionType = NotificationActionType.SWAP;
350
351
  extrinsicType = ExtrinsicType.SWAP;
351
352
  const combineInfo = process.combineInfo;
352
- const fromAsset = this.chainService.getAssetBySlug(combineInfo.quote.pair.from);
353
- const toAsset = this.chainService.getAssetBySlug(combineInfo.quote.pair.to);
354
- const fromChain = this.chainService.getChainInfoByKey(fromAsset.originChain);
355
- const toChain = this.chainService.getChainInfoByKey(toAsset.originChain);
353
+ const targetPair = (() => {
354
+ try {
355
+ return getTokenPairFromStep(combineInfo.process.steps) || combineInfo.quote.pair;
356
+ } catch (e) {
357
+ return combineInfo.quote.pair;
358
+ }
359
+ })();
360
+ const fromAsset = this.chainService.getAssetBySlug(targetPair.from);
361
+ const toAsset = this.chainService.getAssetBySlug(targetPair.to);
356
362
  title = '[{{accountName}}] SWAPPED {{fromAsset}}'.replace('{{fromAsset}}', fromAsset.symbol);
357
- description = '{{fromAmount}} {{fromAsset}} on {{fromChain}} swapped for {{toAmount}} {{toAsset}} on {{toChain}}. Click to view details'.replace('{{fromAmount}}', formatNumber(combineInfo.quote.fromAmount, fromAsset.decimals || 0)).replace('{{fromAsset}}', fromAsset.symbol).replace('{{fromChain}}', fromChain.name).replace('{{toAmount}}', formatNumber(combineInfo.quote.toAmount, toAsset.decimals || 0)).replace('{{toAsset}}', toAsset.symbol).replace('{{toChain}}', toChain.name);
363
+ description = '{{fromAmount}} {{fromAsset}} swapped for {{toAmount}} {{toAsset}}. Click to view details'.replace('{{fromAmount}}', formatNumber(combineInfo.quote.fromAmount, fromAsset.decimals || 0)).replace('{{fromAsset}}', fromAsset.symbol).replace('{{toAmount}}', formatNumber(combineInfo.quote.toAmount, toAsset.decimals || 0)).replace('{{toAsset}}', toAsset.symbol);
358
364
  } else {
359
365
  actionType = NotificationActionType.EARNING;
360
366
  extrinsicType = ExtrinsicType.JOIN_YIELD_POOL; // Not used