@subwallet/extension-base 1.3.71-0 → 1.3.73-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 (79) hide show
  1. package/background/KoniTypes.d.ts +13 -2
  2. package/background/KoniTypes.js +3 -1
  3. package/cjs/background/KoniTypes.js +3 -1
  4. package/cjs/core/logic-validation/recipientAddress.js +1 -1
  5. package/cjs/core/logic-validation/transfer.js +33 -10
  6. package/cjs/core/types.js +1 -0
  7. package/cjs/koni/background/handlers/Extension.js +81 -10
  8. package/cjs/koni/background/handlers/State.js +2 -4
  9. package/cjs/koni/background/subscription.js +2 -22
  10. package/cjs/packageInfo.js +1 -1
  11. package/cjs/services/balance-service/helpers/subscribe/substrate/index.js +46 -2
  12. package/cjs/services/balance-service/transfer/token.js +13 -35
  13. package/cjs/services/balance-service/transfer/xcm/index.js +3 -8
  14. package/cjs/services/balance-service/transfer/xcm/utils.js +1 -1
  15. package/cjs/services/chain-service/constants.js +6 -5
  16. package/cjs/services/chain-service/index.js +1 -0
  17. package/cjs/services/chain-service/utils/patch.js +1 -1
  18. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +17 -2
  19. package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +55 -0
  20. package/cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +41 -0
  21. package/cjs/services/migration-service/scripts/index.js +17 -13
  22. package/cjs/services/substrate-proxy-service/constant.js +26 -0
  23. package/cjs/services/substrate-proxy-service/index.js +170 -0
  24. package/cjs/services/transaction-service/index.js +78 -10
  25. package/cjs/services/transaction-service/utils.js +8 -5
  26. package/cjs/types/index.js +11 -0
  27. package/cjs/types/substrateProxyAccount/actions/index.js +1 -0
  28. package/cjs/types/substrateProxyAccount/index.js +16 -0
  29. package/cjs/utils/account/transform.js +5 -4
  30. package/cjs/utils/fee/transfer.js +4 -2
  31. package/core/logic-validation/recipientAddress.js +1 -1
  32. package/core/logic-validation/transfer.d.ts +3 -3
  33. package/core/logic-validation/transfer.js +34 -11
  34. package/core/types.d.ts +2 -1
  35. package/core/types.js +1 -0
  36. package/koni/background/handlers/Extension.d.ts +3 -0
  37. package/koni/background/handlers/Extension.js +81 -10
  38. package/koni/background/handlers/State.d.ts +2 -1
  39. package/koni/background/handlers/State.js +2 -4
  40. package/koni/background/subscription.js +2 -22
  41. package/package.json +37 -7
  42. package/packageInfo.js +1 -1
  43. package/services/balance-service/helpers/subscribe/substrate/index.js +47 -3
  44. package/services/balance-service/transfer/token.d.ts +0 -4
  45. package/services/balance-service/transfer/token.js +12 -33
  46. package/services/balance-service/transfer/xcm/index.js +3 -8
  47. package/services/balance-service/transfer/xcm/utils.d.ts +0 -2
  48. package/services/balance-service/transfer/xcm/utils.js +1 -1
  49. package/services/chain-service/constants.d.ts +1 -1
  50. package/services/chain-service/constants.js +4 -4
  51. package/services/chain-service/index.js +1 -0
  52. package/services/chain-service/utils/patch.d.ts +1 -1
  53. package/services/chain-service/utils/patch.js +1 -1
  54. package/services/earning-service/handlers/native-staking/para-chain.js +17 -2
  55. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts +4 -0
  56. package/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js +46 -0
  57. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts +4 -0
  58. package/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js +33 -0
  59. package/services/migration-service/scripts/index.js +8 -4
  60. package/services/open-gov/interface.d.ts +4 -3
  61. package/services/substrate-proxy-service/constant.d.ts +3 -0
  62. package/services/substrate-proxy-service/constant.js +19 -0
  63. package/services/substrate-proxy-service/index.d.ts +13 -0
  64. package/services/substrate-proxy-service/index.js +159 -0
  65. package/services/transaction-service/index.js +79 -11
  66. package/services/transaction-service/types.d.ts +2 -2
  67. package/services/transaction-service/utils.js +8 -5
  68. package/types/balance/transfer.d.ts +1 -0
  69. package/types/index.d.ts +1 -0
  70. package/types/index.js +1 -0
  71. package/types/substrateProxyAccount/actions/index.d.ts +17 -0
  72. package/types/substrateProxyAccount/actions/index.js +1 -0
  73. package/types/substrateProxyAccount/index.d.ts +23 -0
  74. package/types/substrateProxyAccount/index.js +8 -0
  75. package/types/transaction/request.d.ts +1 -0
  76. package/types/yield/actions/join/submit.d.ts +1 -1
  77. package/types/yield/info/pallet.d.ts +1 -1
  78. package/utils/account/transform.js +5 -4
  79. package/utils/fee/transfer.js +4 -2
@@ -1255,6 +1255,7 @@ export default class KoniExtension {
1255
1255
  feeCustom,
1256
1256
  feeOption,
1257
1257
  from,
1258
+ signerSubstrateProxyAddress,
1258
1259
  to,
1259
1260
  tokenPayFeeSlug,
1260
1261
  tokenSlug,
@@ -1488,6 +1489,7 @@ export default class KoniExtension {
1488
1489
  isTransferAll: isTransferNativeToken ? transferAll : false,
1489
1490
  isTransferLocalTokenAndPayThatTokenAsFee,
1490
1491
  edAsWarning: isTransferNativeToken,
1492
+ signerSubstrateProxyAddress,
1491
1493
  additionalValidator: additionalValidator
1492
1494
  });
1493
1495
  }
@@ -1499,6 +1501,7 @@ export default class KoniExtension {
1499
1501
  from,
1500
1502
  isPassConfirmation,
1501
1503
  originNetworkKey,
1504
+ signerSubstrateProxyAddress,
1502
1505
  to,
1503
1506
  tokenPayFeeSlug,
1504
1507
  tokenSlug,
@@ -1694,7 +1697,8 @@ export default class KoniExtension {
1694
1697
  xcmFeeDryRun,
1695
1698
  errors,
1696
1699
  additionalValidator: additionalValidator,
1697
- eventsHandler: eventsHandler
1700
+ eventsHandler: eventsHandler,
1701
+ signerSubstrateProxyAddress
1698
1702
  });
1699
1703
  }
1700
1704
  async makeBitcoinDappTransferConfirmation(inputData) {
@@ -2334,7 +2338,8 @@ export default class KoniExtension {
2334
2338
  feeOptions: feeOptions,
2335
2339
  feeType,
2336
2340
  error,
2337
- id
2341
+ id,
2342
+ maxTransferableWithoutFee: freeBalance.value
2338
2343
  };
2339
2344
  };
2340
2345
  const subscription = combineLatest({
@@ -2418,7 +2423,8 @@ export default class KoniExtension {
2418
2423
  const {
2419
2424
  params,
2420
2425
  recipientAddress,
2421
- senderAddress
2426
+ senderAddress,
2427
+ signerSubstrateProxyAddress
2422
2428
  } = inputData;
2423
2429
  const isSendingSelf = isRecipientSelf(senderAddress, recipientAddress);
2424
2430
 
@@ -2439,7 +2445,8 @@ export default class KoniExtension {
2439
2445
  isSendingSelf
2440
2446
  },
2441
2447
  extrinsicType: ExtrinsicType.SEND_NFT,
2442
- chainType: ChainType.SUBSTRATE
2448
+ chainType: ChainType.SUBSTRATE,
2449
+ signerSubstrateProxyAddress
2443
2450
  });
2444
2451
  return {
2445
2452
  ...rs,
@@ -3313,8 +3320,6 @@ export default class KoniExtension {
3313
3320
  return await this.#koniState.reloadStaking();
3314
3321
  } else if (data === 'balance') {
3315
3322
  return await this.#koniState.reloadBalance();
3316
- } else if (data === 'crowdloan') {
3317
- return await this.#koniState.reloadCrowdloan();
3318
3323
  }
3319
3324
  return Promise.resolve(false);
3320
3325
  }
@@ -3742,7 +3747,8 @@ export default class KoniExtension {
3742
3747
  isPassConfirmation,
3743
3748
  onSend,
3744
3749
  path,
3745
- processId
3750
+ processId,
3751
+ signerSubstrateProxyAddress
3746
3752
  } = inputData;
3747
3753
  const {
3748
3754
  address
@@ -3873,6 +3879,7 @@ export default class KoniExtension {
3873
3879
  // change this depends on step
3874
3880
  chainType,
3875
3881
  resolveOnDone: !isLastStep,
3882
+ signerSubstrateProxyAddress,
3876
3883
  transferNativeAmount,
3877
3884
  balanceType: balanceTypeForPool,
3878
3885
  skipFeeValidation: isMintingStep && isPoolSupportAlternativeFee,
@@ -3885,6 +3892,7 @@ export default class KoniExtension {
3885
3892
  async handleYieldLeave(params) {
3886
3893
  const {
3887
3894
  address,
3895
+ signerSubstrateProxyAddress,
3888
3896
  slug
3889
3897
  } = params;
3890
3898
  const leaveValidation = await this.#koniState.earningService.validateYieldLeave(params);
@@ -3900,6 +3908,7 @@ export default class KoniExtension {
3900
3908
  data: params,
3901
3909
  // TODO
3902
3910
  extrinsicType,
3911
+ signerSubstrateProxyAddress,
3903
3912
  chainType: (handler === null || handler === void 0 ? void 0 : handler.transactionChainType) || ChainType.SUBSTRATE
3904
3913
  });
3905
3914
  }
@@ -3976,6 +3985,7 @@ export default class KoniExtension {
3976
3985
  async yieldSubmitWithdrawal(params) {
3977
3986
  const {
3978
3987
  address,
3988
+ signerSubstrateProxyAddress,
3979
3989
  slug
3980
3990
  } = params;
3981
3991
  const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
@@ -3989,6 +3999,7 @@ export default class KoniExtension {
3989
3999
  transaction: extrinsic,
3990
4000
  data: params,
3991
4001
  extrinsicType: ExtrinsicType.STAKING_WITHDRAW,
4002
+ signerSubstrateProxyAddress,
3992
4003
  chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
3993
4004
  });
3994
4005
  }
@@ -3996,6 +4007,7 @@ export default class KoniExtension {
3996
4007
  const {
3997
4008
  address,
3998
4009
  selectedUnstaking,
4010
+ signerSubstrateProxyAddress,
3999
4011
  slug
4000
4012
  } = params;
4001
4013
  const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
@@ -4010,12 +4022,14 @@ export default class KoniExtension {
4010
4022
  transaction: extrinsic,
4011
4023
  data: params,
4012
4024
  extrinsicType: ExtrinsicType.STAKING_CANCEL_UNSTAKE,
4025
+ signerSubstrateProxyAddress,
4013
4026
  chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
4014
4027
  });
4015
4028
  }
4016
4029
  async yieldSubmitClaimReward(params) {
4017
4030
  const {
4018
4031
  address,
4032
+ signerSubstrateProxyAddress,
4019
4033
  slug
4020
4034
  } = params;
4021
4035
  const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
@@ -4028,6 +4042,7 @@ export default class KoniExtension {
4028
4042
  chain: poolHandler.chain,
4029
4043
  transaction: extrinsic,
4030
4044
  data: params,
4045
+ signerSubstrateProxyAddress,
4031
4046
  extrinsicType: ExtrinsicType.STAKING_CLAIM_REWARD,
4032
4047
  chainType: (poolHandler === null || poolHandler === void 0 ? void 0 : poolHandler.transactionChainType) || ChainType.SUBSTRATE
4033
4048
  });
@@ -4046,6 +4061,7 @@ export default class KoniExtension {
4046
4061
  async handleYieldChangeValidator(params) {
4047
4062
  const {
4048
4063
  address,
4064
+ signerSubstrateProxyAddress,
4049
4065
  slug
4050
4066
  } = params;
4051
4067
  const poolHandler = this.#koniState.earningService.getPoolHandler(slug);
@@ -4058,6 +4074,7 @@ export default class KoniExtension {
4058
4074
  chain: poolHandler.chain,
4059
4075
  transaction: extrinsic,
4060
4076
  data: params,
4077
+ signerSubstrateProxyAddress,
4061
4078
  extrinsicType: ExtrinsicType.CHANGE_EARNING_VALIDATOR,
4062
4079
  chainType: ChainType.SUBSTRATE
4063
4080
  });
@@ -4739,6 +4756,48 @@ export default class KoniExtension {
4739
4756
  pingSession(request) {
4740
4757
  return this.#koniState.keyringService.context.pingSession(request);
4741
4758
  }
4759
+ getSubstrateProxyAccountGroup(request) {
4760
+ return this.#koniState.substrateProxyAccountService.getSubstrateProxyAccountGroup(request);
4761
+ }
4762
+ async handleAddSubstrateProxyAccount(params) {
4763
+ const {
4764
+ address,
4765
+ chain,
4766
+ signerSubstrateProxyAddress
4767
+ } = params;
4768
+ const validationErrors = await this.#koniState.substrateProxyAccountService.validateAddSubstrateProxyAccount(params, signerSubstrateProxyAddress);
4769
+ if (validationErrors.length > 0) {
4770
+ return this.#koniState.transactionService.generateBeforeHandleResponseErrors(validationErrors);
4771
+ }
4772
+ const extrinsic = await this.#koniState.substrateProxyAccountService.addSubstrateProxyAccounts(params);
4773
+ return await this.#koniState.transactionService.handleTransaction({
4774
+ address,
4775
+ chain,
4776
+ transaction: extrinsic,
4777
+ data: params,
4778
+ extrinsicType: ExtrinsicType.ADD_SUBSTRATE_PROXY_ACCOUNT,
4779
+ chainType: ChainType.SUBSTRATE,
4780
+ signerSubstrateProxyAddress
4781
+ });
4782
+ }
4783
+ async handleRemoveSubstrateProxyAccount(params) {
4784
+ const {
4785
+ address,
4786
+ chain,
4787
+ signerSubstrateProxyAddress
4788
+ } = params;
4789
+ const extrinsic = await this.#koniState.substrateProxyAccountService.removeSubstrateProxyAccounts(params);
4790
+ return await this.#koniState.transactionService.handleTransaction({
4791
+ address,
4792
+ chain,
4793
+ transaction: extrinsic,
4794
+ data: params,
4795
+ extrinsicType: ExtrinsicType.REMOVE_SUBSTRATE_PROXY_ACCOUNT,
4796
+ chainType: ChainType.SUBSTRATE,
4797
+ signerSubstrateProxyAddress
4798
+ });
4799
+ }
4800
+
4742
4801
  /* Migrate Unified Account */
4743
4802
 
4744
4803
  /* Open Gov */
@@ -4751,7 +4810,8 @@ export default class KoniExtension {
4751
4810
  transaction: extrinsic,
4752
4811
  data: request,
4753
4812
  extrinsicType: ExtrinsicType.GOV_VOTE,
4754
- chainType: ChainType.SUBSTRATE
4813
+ chainType: ChainType.SUBSTRATE,
4814
+ signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
4755
4815
  });
4756
4816
  }
4757
4817
  async handleRemoveVote(request) {
@@ -4762,7 +4822,8 @@ export default class KoniExtension {
4762
4822
  transaction: extrinsic,
4763
4823
  data: request,
4764
4824
  extrinsicType: ExtrinsicType.GOV_UNVOTE,
4765
- chainType: ChainType.SUBSTRATE
4825
+ chainType: ChainType.SUBSTRATE,
4826
+ signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
4766
4827
  });
4767
4828
  }
4768
4829
  async handleUnlockVote(request) {
@@ -4773,7 +4834,8 @@ export default class KoniExtension {
4773
4834
  transaction: extrinsic,
4774
4835
  data: request,
4775
4836
  extrinsicType: ExtrinsicType.GOV_UNLOCK_VOTE,
4776
- chainType: ChainType.SUBSTRATE
4837
+ chainType: ChainType.SUBSTRATE,
4838
+ signerSubstrateProxyAddress: request.signerSubstrateProxyAddress
4777
4839
  });
4778
4840
  }
4779
4841
  async subscribeGovLockedInfo(id, port) {
@@ -5461,6 +5523,15 @@ export default class KoniExtension {
5461
5523
  return this.handleUnlockVote(request);
5462
5524
  case 'pri(openGov.subscribeGovLockedInfo)':
5463
5525
  return this.subscribeGovLockedInfo(id, port);
5526
+
5527
+ // Proxy
5528
+ case 'pri(substrateProxyAccount.getGroupInfo)':
5529
+ return this.getSubstrateProxyAccountGroup(request);
5530
+ case 'pri(substrateProxyAccount.add)':
5531
+ return this.handleAddSubstrateProxyAccount(request);
5532
+ case 'pri(substrateProxyAccount.remove)':
5533
+ return this.handleRemoveSubstrateProxyAccount(request);
5534
+
5464
5535
  // Default
5465
5536
  default:
5466
5537
  throw new Error(`Unable to handle message of type ${type}`);
@@ -28,6 +28,7 @@ import { AuthUrls, MetaRequest, SignRequest } from '@subwallet/extension-base/se
28
28
  import SettingService from '@subwallet/extension-base/services/setting-service/SettingService';
29
29
  import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
30
30
  import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
31
+ import SubstrateProxyAccountService from '@subwallet/extension-base/services/substrate-proxy-service';
31
32
  import { SwapService } from '@subwallet/extension-base/services/swap-service';
32
33
  import TransactionService from '@subwallet/extension-base/services/transaction-service';
33
34
  import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
@@ -83,6 +84,7 @@ export default class KoniState {
83
84
  readonly inappNotificationService: InappNotificationService;
84
85
  readonly chainOnlineService: ChainOnlineService;
85
86
  readonly openGovService: OpenGovService;
87
+ readonly substrateProxyAccountService: SubstrateProxyAccountService;
86
88
  private generalStatus;
87
89
  private waitSleeping;
88
90
  private waitStarting;
@@ -265,7 +267,6 @@ export default class KoniState {
265
267
  reloadNft(): Promise<boolean>;
266
268
  reloadStaking(): Promise<boolean>;
267
269
  reloadBalance(): Promise<boolean>;
268
- reloadCrowdloan(): Promise<boolean>;
269
270
  approvePassPhishingPage(_url: string): Promise<boolean>;
270
271
  saveEnvConfig<T extends keyof EnvConfig>(key: T, value: EnvConfig[T]): void;
271
272
  initEnvConfig(envConfig: EnvConfig): void;
@@ -38,6 +38,7 @@ import { convertAssetToValue, convertValueToAsset, extractKeyHashesFromCollatera
38
38
  import SettingService from '@subwallet/extension-base/services/setting-service/SettingService';
39
39
  import DatabaseService from '@subwallet/extension-base/services/storage-service/DatabaseService';
40
40
  import { SubscanService } from '@subwallet/extension-base/services/subscan-service';
41
+ import SubstrateProxyAccountService from '@subwallet/extension-base/services/substrate-proxy-service';
41
42
  import { SwapService } from '@subwallet/extension-base/services/swap-service';
42
43
  import TransactionService from '@subwallet/extension-base/services/transaction-service';
43
44
  import WalletConnectService from '@subwallet/extension-base/services/wallet-connect-service';
@@ -124,6 +125,7 @@ export default class KoniState {
124
125
  this.inappNotificationService = new InappNotificationService(this.dbService, this.keyringService, this.eventService, this.chainService);
125
126
  this.chainOnlineService = new ChainOnlineService(this.chainService, this.settingService, this.eventService, this.dbService);
126
127
  this.openGovService = new OpenGovService(this);
128
+ this.substrateProxyAccountService = new SubstrateProxyAccountService(this);
127
129
  this.subscription = new KoniSubscription(this, this.dbService);
128
130
  this.cron = new KoniCron(this, this.subscription, this.dbService);
129
131
  this.logger = createLogger('State');
@@ -1790,10 +1792,6 @@ export default class KoniState {
1790
1792
  await this.balanceService.reloadBalance();
1791
1793
  return true;
1792
1794
  }
1793
- async reloadCrowdloan() {
1794
- await this.subscription.reloadCrowdloan();
1795
- return true;
1796
- }
1797
1795
  async approvePassPhishingPage(_url) {
1798
1796
  return new Promise(resolve => {
1799
1797
  this.settingService.getPassPhishingList(value => {
@@ -3,7 +3,6 @@
3
3
 
4
4
  import { subscribeCrowdloan } from '@subwallet/extension-base/koni/api/dotsama/crowdloan';
5
5
  import { NftHandler } from '@subwallet/extension-base/koni/api/nft';
6
- import { COMMON_RELOAD_EVENTS } from '@subwallet/extension-base/services/event-service/types';
7
6
  import { waitTimeout } from '@subwallet/extension-base/utils';
8
7
  import { logger as createLogger } from '@polkadot/util';
9
8
  const nftHandler = new NftHandler();
@@ -41,26 +40,7 @@ export class KoniSubscription {
41
40
  }
42
41
  }
43
42
  async start() {
44
- var _this$state$keyringSe;
45
43
  await Promise.all([this.state.eventService.waitCryptoReady, this.state.eventService.waitKeyringReady, this.state.eventService.waitAssetReady]);
46
- const currentAddress = (_this$state$keyringSe = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.proxyId;
47
- if (currentAddress) {
48
- this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
49
- }
50
- this.eventHandler = (events, eventTypes) => {
51
- var _serviceInfo$currentA;
52
- const serviceInfo = this.state.getServiceInfo();
53
- const needReload = eventTypes.some(eventType => COMMON_RELOAD_EVENTS.includes(eventType));
54
- if (!needReload) {
55
- return;
56
- }
57
- const address = (_serviceInfo$currentA = serviceInfo.currentAccountInfo) === null || _serviceInfo$currentA === void 0 ? void 0 : _serviceInfo$currentA.proxyId;
58
- if (!address) {
59
- return;
60
- }
61
- this.subscribeCrowdloans(address, serviceInfo.chainApiMap.substrate);
62
- };
63
- this.state.eventService.onLazy(this.eventHandler.bind(this));
64
44
  }
65
45
  async stop() {
66
46
  if (this.eventHandler) {
@@ -106,8 +86,8 @@ export class KoniSubscription {
106
86
  nftHandler.handleNfts(smartContractNfts, (...args) => this.state.updateNftData(...args), (...args) => this.state.setNftCollection(...args)).catch(this.logger.log);
107
87
  }
108
88
  async reloadCrowdloan() {
109
- var _this$state$keyringSe2;
110
- const currentAddress = (_this$state$keyringSe2 = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe2 === void 0 ? void 0 : _this$state$keyringSe2.proxyId;
89
+ var _this$state$keyringSe;
90
+ const currentAddress = (_this$state$keyringSe = this.state.keyringService.context.currentAccount) === null || _this$state$keyringSe === void 0 ? void 0 : _this$state$keyringSe.proxyId;
111
91
  this.subscribeCrowdloans(currentAddress, this.state.getSubstrateApiMap());
112
92
  await waitTimeout(1800);
113
93
  }
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.3.71-0",
20
+ "version": "1.3.73-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -1486,6 +1486,11 @@
1486
1486
  "require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251107.js",
1487
1487
  "default": "./services/migration-service/scripts/databases/MigrateAssetSetting20251107.js"
1488
1488
  },
1489
+ "./services/migration-service/scripts/databases/MigrateAssetSetting20251223": {
1490
+ "types": "./services/migration-service/scripts/databases/MigrateAssetSetting20251223.d.ts",
1491
+ "require": "./cjs/services/migration-service/scripts/databases/MigrateAssetSetting20251223.js",
1492
+ "default": "./services/migration-service/scripts/databases/MigrateAssetSetting20251223.js"
1493
+ },
1489
1494
  "./services/migration-service/scripts/databases/MigrateEarningHistory": {
1490
1495
  "types": "./services/migration-service/scripts/databases/MigrateEarningHistory.d.ts",
1491
1496
  "require": "./cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js",
@@ -1631,6 +1636,11 @@
1631
1636
  "require": "./cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js",
1632
1637
  "default": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251107.js"
1633
1638
  },
1639
+ "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223": {
1640
+ "types": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.d.ts",
1641
+ "require": "./cjs/services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js",
1642
+ "default": "./services/migration-service/scripts/MigrateTransactionHistoryBySymbol20251223.js"
1643
+ },
1634
1644
  "./services/migration-service/scripts/MigrateWalletReference": {
1635
1645
  "types": "./services/migration-service/scripts/MigrateWalletReference.d.ts",
1636
1646
  "require": "./cjs/services/migration-service/scripts/MigrateWalletReference.js",
@@ -2026,6 +2036,16 @@
2026
2036
  "require": "./cjs/services/subscan-service/types.js",
2027
2037
  "default": "./services/subscan-service/types.js"
2028
2038
  },
2039
+ "./services/substrate-proxy-service": {
2040
+ "types": "./services/substrate-proxy-service/index.d.ts",
2041
+ "require": "./cjs/services/substrate-proxy-service/index.js",
2042
+ "default": "./services/substrate-proxy-service/index.js"
2043
+ },
2044
+ "./services/substrate-proxy-service/constant": {
2045
+ "types": "./services/substrate-proxy-service/constant.d.ts",
2046
+ "require": "./cjs/services/substrate-proxy-service/constant.js",
2047
+ "default": "./services/substrate-proxy-service/constant.js"
2048
+ },
2029
2049
  "./services/swap-service": {
2030
2050
  "types": "./services/swap-service/index.d.ts",
2031
2051
  "require": "./cjs/services/swap-service/index.js",
@@ -2521,6 +2541,16 @@
2521
2541
  "require": "./cjs/types/setting.js",
2522
2542
  "default": "./types/setting.js"
2523
2543
  },
2544
+ "./types/substrateProxyAccount": {
2545
+ "types": "./types/substrateProxyAccount/index.d.ts",
2546
+ "require": "./cjs/types/substrateProxyAccount/index.js",
2547
+ "default": "./types/substrateProxyAccount/index.js"
2548
+ },
2549
+ "./types/substrateProxyAccount/actions": {
2550
+ "types": "./types/substrateProxyAccount/actions/index.d.ts",
2551
+ "require": "./cjs/types/substrateProxyAccount/actions/index.js",
2552
+ "default": "./types/substrateProxyAccount/actions/index.js"
2553
+ },
2524
2554
  "./types/swap": {
2525
2555
  "types": "./types/swap/index.d.ts",
2526
2556
  "require": "./cjs/types/swap/index.js",
@@ -2942,12 +2972,12 @@
2942
2972
  "@snowbridge/registry": "^0.2.0",
2943
2973
  "@sora-substrate/type-definitions": "^1.17.7",
2944
2974
  "@substrate/connect": "^0.8.9",
2945
- "@subwallet-monorepos/subwallet-services-sdk": "0.1.14",
2946
- "@subwallet/chain-list": "0.2.122",
2947
- "@subwallet/extension-base": "^1.3.71-0",
2948
- "@subwallet/extension-chains": "^1.3.71-0",
2949
- "@subwallet/extension-dapp": "^1.3.71-0",
2950
- "@subwallet/extension-inject": "^1.3.71-0",
2975
+ "@subwallet-monorepos/subwallet-services-sdk": "0.1.16",
2976
+ "@subwallet/chain-list": "0.2.123",
2977
+ "@subwallet/extension-base": "^1.3.73-0",
2978
+ "@subwallet/extension-chains": "^1.3.73-0",
2979
+ "@subwallet/extension-dapp": "^1.3.73-0",
2980
+ "@subwallet/extension-inject": "^1.3.73-0",
2951
2981
  "@subwallet/keyring": "^0.1.14",
2952
2982
  "@subwallet/ui-keyring": "^0.1.14",
2953
2983
  "@ton/core": "^0.56.3",
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.71-0'
10
+ version: '1.3.73-0'
11
11
  };
@@ -13,7 +13,7 @@ import { _getTokensPalletLocked, _getTokensPalletTransferable } from '@subwallet
13
13
  import { _adaptX1Interior } from '@subwallet/extension-base/core/substrate/xcm-parser';
14
14
  import { getPSP22ContractPromise } from '@subwallet/extension-base/koni/api/contract-handler/wasm';
15
15
  import { getDefaultWeightV2 } from '@subwallet/extension-base/koni/api/contract-handler/wasm/utils';
16
- import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX } from '@subwallet/extension-base/services/chain-service/constants';
16
+ import { _BALANCE_CHAIN_GROUP, _MANTA_ZK_CHAIN_GROUP, _ZK_ASSET_PREFIX, USE_MULTILOCATION_INDEX } from '@subwallet/extension-base/services/chain-service/constants';
17
17
  import { _checkSmartContractSupportByChain, _getAssetExistentialDeposit, _getAssetNetuid, _getChainExistentialDeposit, _getChainNativeTokenSlug, _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getTokenTypesSupportedByChain, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible } from '@subwallet/extension-base/services/chain-service/utils';
18
18
  import { filterAlphaAssetsByChain, filterAssetsByChainAndType } from '@subwallet/extension-base/utils';
19
19
  import BigN from 'bignumber.js';
@@ -422,16 +422,27 @@ const subscribeAssetsAccountPallet = async ({
422
422
  }
423
423
  });
424
424
  const unsubList = await Promise.all(Object.values(tokenMap).map(tokenInfo => {
425
+ if (tokenInfo.slug === 'energy_web_x-LOCAL-stEWT') {
426
+ return timer(0, CRON_REFRESH_PRICE_INTERVAL).subscribe(() => {
427
+ const getEwtFrozenBalance = async () => {
428
+ const ewtTokenBalances = await queryEwtFrozenBalance(substrateApi, addresses, assetMap[tokenInfo.slug], extrinsicType);
429
+ callback(ewtTokenBalances);
430
+ };
431
+ getEwtFrozenBalance().catch(console.error);
432
+ });
433
+ }
425
434
  try {
426
435
  const assetIndex = _getTokenOnChainAssetId(tokenInfo);
427
- if (assetIndex === '-1') {
436
+ if (assetIndex === '-1' && !USE_MULTILOCATION_INDEX.includes(chainInfo.slug)) {
428
437
  return undefined;
429
438
  }
439
+ const version = ['statemint', 'statemine', 'westend_assethub'].includes(chainInfo.slug) ? 4 : 3;
440
+ const index = USE_MULTILOCATION_INDEX.includes(chainInfo.slug) ? _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo), version) : assetIndex;
430
441
  const params = [{
431
442
  section: 'query',
432
443
  module: assetsAccountKey.split('_')[1],
433
444
  method: assetsAccountKey.split('_')[2],
434
- args: addresses.map(address => [assetIndex, address])
445
+ args: addresses.map(address => [index, address])
435
446
  }];
436
447
 
437
448
  // Get Token Balance
@@ -592,4 +603,37 @@ async function queryGigaTokenBalance(substrateApi, addresses, tokenInfo, extrins
592
603
  locked: totalLockedFromTransfer.toString()
593
604
  };
594
605
  }));
606
+ }
607
+ async function queryEwtFrozenBalance(substrateApi, addresses, tokenInfo, extrinsicType) {
608
+ const multilocation = _getXcmAssetMultilocation(tokenInfo);
609
+ return await Promise.all(addresses.map(async address => {
610
+ const [_frozenBalance, _balanceInfo] = await Promise.all([substrateApi.api.query.assetsFreezer.frozenBalances(multilocation, address), substrateApi.api.query.assets.account(multilocation, address)]);
611
+ const balanceInfo = _balanceInfo.toPrimitive();
612
+ if (!balanceInfo) {
613
+ // no balance info response
614
+ return {
615
+ address: address,
616
+ tokenSlug: tokenInfo.slug,
617
+ free: '0',
618
+ locked: '0',
619
+ state: APIItemState.READY
620
+ };
621
+ }
622
+ const transferableBalance = _getAssetsPalletTransferable(balanceInfo, _getAssetExistentialDeposit(tokenInfo), extrinsicType);
623
+ const totalLockedFromTransfer = _getAssetsPalletLocked(balanceInfo);
624
+ let freeBalance = transferableBalance;
625
+ let lockedBalance = totalLockedFromTransfer;
626
+ const frozenBalance = _frozenBalance.toPrimitive();
627
+ if (frozenBalance) {
628
+ freeBalance = transferableBalance - BigInt(frozenBalance);
629
+ lockedBalance = totalLockedFromTransfer + BigInt(frozenBalance);
630
+ }
631
+ return {
632
+ address: address,
633
+ tokenSlug: tokenInfo.slug,
634
+ free: freeBalance.toString(),
635
+ locked: lockedBalance.toString(),
636
+ state: APIItemState.READY
637
+ };
638
+ }));
595
639
  }
@@ -13,8 +13,4 @@ interface CreateTransferExtrinsicProps {
13
13
  }
14
14
  export declare const createSubstrateExtrinsic: ({ from, networkKey, substrateApi, to, tokenInfo, transferAll, value }: CreateTransferExtrinsicProps) => Promise<[SubmittableExtrinsic | null, string]>;
15
15
  export declare const getTransferMockTxFee: (address: string, chainInfo: _ChainInfo, tokenInfo: _ChainAsset, api: _SubstrateApi | _EvmApi | _TonApi) => Promise<BigN>;
16
- export declare const getAccountNetuidTokenInfo: (address: string, tokenInfo: _ChainAsset, substrateApi: _SubstrateApi) => Promise<{
17
- isEnableTransferSubnet: boolean;
18
- accountHotKey: string | undefined;
19
- }>;
20
16
  export {};
@@ -3,10 +3,11 @@
3
3
 
4
4
  import { GearApi } from '@gear-js/api';
5
5
  import { _AssetType } from '@subwallet/chain-list/types';
6
+ import { _adaptX1Interior } from '@subwallet/extension-base/core/substrate/xcm-parser';
6
7
  import { getPSP22ContractPromise } from '@subwallet/extension-base/koni/api/contract-handler/wasm';
7
8
  import { getWasmContractGasLimit } from '@subwallet/extension-base/koni/api/contract-handler/wasm/utils';
8
9
  import { estimateTonTxFee } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
9
- import { _TRANSFER_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
10
+ import { _TRANSFER_CHAIN_GROUP, USE_MULTILOCATION_INDEX } from '@subwallet/extension-base/services/chain-service/constants';
10
11
  import { _getContractAddressOfToken, _getTokenOnChainAssetId, _getTokenOnChainInfo, _getXcmAssetMultilocation, _isBridgedToken, _isChainEvmCompatible, _isChainTonCompatible, _isGigaToken, _isNativeToken, _isTokenGearSmartContract, _isTokenTransferredByEvm, _isTokenTransferredByTon, _isTokenWasmSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
11
12
  import { calculateGasFeeParams } from '@subwallet/extension-base/services/fee-service/utils';
12
13
  import { combineEthFee, getGRC20ContractPromise, getVFTContractPromise } from '@subwallet/extension-base/utils';
@@ -25,7 +26,7 @@ export const createSubstrateExtrinsic = async ({
25
26
  transferAll,
26
27
  value
27
28
  }) => {
28
- var _tokenInfo$metadata, _tokenInfo$metadata2;
29
+ var _tokenInfo$metadata;
29
30
  const api = substrateApi.api;
30
31
  const isDisableTransfer = (_tokenInfo$metadata = tokenInfo.metadata) === null || _tokenInfo$metadata === void 0 ? void 0 : _tokenInfo$metadata.isDisableTransfer;
31
32
  if (isDisableTransfer) {
@@ -94,7 +95,15 @@ export const createSubstrateExtrinsic = async ({
94
95
  } else if (_TRANSFER_CHAIN_GROUP.bitcountry.includes(networkKey) && !_isNativeToken(tokenInfo)) {
95
96
  transfer = api.tx.currencies.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
96
97
  } else if (_TRANSFER_CHAIN_GROUP.statemine.includes(networkKey) && !_isNativeToken(tokenInfo)) {
97
- transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
98
+ if (USE_MULTILOCATION_INDEX.includes(networkKey)) {
99
+ const version = ['statemint', 'statemine', 'westend_assethub'].includes(networkKey) ? 4 : 3;
100
+ const multilocationIndex = _adaptX1Interior(_getXcmAssetMultilocation(tokenInfo), version);
101
+
102
+ // @ts-ignore
103
+ transfer = api.tx.assets.transfer(multilocationIndex, to, value);
104
+ } else {
105
+ transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
106
+ }
98
107
  } else if (_TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
99
108
  transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
100
109
  } else if (isTxBalancesSupported && _isNativeToken(tokenInfo)) {
@@ -112,18 +121,6 @@ export const createSubstrateExtrinsic = async ({
112
121
  }
113
122
  } else if (_TRANSFER_CHAIN_GROUP.truth.includes(networkKey)) {
114
123
  transfer = api.tx.assetManager.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
115
- } else if (_TRANSFER_CHAIN_GROUP.bittensor.includes(networkKey) && (_tokenInfo$metadata2 = tokenInfo.metadata) !== null && _tokenInfo$metadata2 !== void 0 && _tokenInfo$metadata2.netuid) {
116
- var _tokenInfo$metadata3;
117
- const {
118
- accountHotKey,
119
- isEnableTransferSubnet
120
- } = await getAccountNetuidTokenInfo(from, tokenInfo, substrateApi);
121
- const tokenNetuid = (_tokenInfo$metadata3 = tokenInfo.metadata) === null || _tokenInfo$metadata3 === void 0 ? void 0 : _tokenInfo$metadata3.netuid;
122
- if (isEnableTransferSubnet && accountHotKey) {
123
- transfer = api.tx.subtensorModule.transferStake(from, accountHotKey, tokenNetuid, tokenNetuid, value);
124
- } else {
125
- return [null, value];
126
- }
127
124
  }
128
125
  return [transfer, transferAmount || value];
129
126
  };
@@ -180,22 +177,4 @@ export const getTransferMockTxFee = async (address, chainInfo, tokenInfo, api) =
180
177
  console.error('error mocking tx fee', e);
181
178
  return new BigN(0);
182
179
  }
183
- };
184
- export const getAccountNetuidTokenInfo = async (address, tokenInfo, substrateApi) => {
185
- var _tokenInfo$metadata4;
186
- const tokenNetuid = (_tokenInfo$metadata4 = tokenInfo.metadata) === null || _tokenInfo$metadata4 === void 0 ? void 0 : _tokenInfo$metadata4.netuid;
187
- if (!tokenNetuid) {
188
- return {
189
- isEnableTransferSubnet: false,
190
- accountHotKey: undefined
191
- };
192
- }
193
- const [isTransferToggle, rawStakeInfoForColdKey] = await Promise.all([substrateApi.api.query.subtensorModule.transferToggle(tokenNetuid), substrateApi.api.call.stakeInfoRuntimeApi.getStakeInfoForColdkey(address)]);
194
- const isEnableTransferSubnet = isTransferToggle.toPrimitive();
195
- const taoStakeInfos = rawStakeInfoForColdKey.toPrimitive();
196
- const accountHotKey = taoStakeInfos.find(value => value.netuid === tokenNetuid);
197
- return {
198
- isEnableTransferSubnet,
199
- accountHotKey: accountHotKey === null || accountHotKey === void 0 ? void 0 : accountHotKey.hotkey
200
- };
201
180
  };
@@ -102,8 +102,6 @@ export const dryRunXcmExtrinsicV2 = async (request, isPreview = false) => {
102
102
  const originDryRunRs = dryRunResult.origin;
103
103
  if (originDryRunRs.success) {
104
104
  const {
105
- assetHub,
106
- bridgeHub,
107
105
  destination,
108
106
  hops
109
107
  } = dryRunResult;
@@ -112,12 +110,9 @@ export const dryRunXcmExtrinsicV2 = async (request, isPreview = false) => {
112
110
  return false;
113
111
  }
114
112
  }
115
- if ((assetHub === null || assetHub === void 0 ? void 0 : assetHub.success) === false || (bridgeHub === null || bridgeHub === void 0 ? void 0 : bridgeHub.success) === false || (destination === null || destination === void 0 ? void 0 : destination.success) === false) {
116
- if ((destination === null || destination === void 0 ? void 0 : destination.success) === false) {
117
- // pass dry-run in these cases
118
- return isChainNotSupportDryRun(destination.failureReason) || isChainNotSupportPolkadotApi(destination.failureReason);
119
- }
120
- return false;
113
+ if ((destination === null || destination === void 0 ? void 0 : destination.success) === false) {
114
+ // pass dry-run in these cases
115
+ return isChainNotSupportDryRun(destination.failureReason) || isChainNotSupportPolkadotApi(destination.failureReason);
121
116
  }
122
117
  return true;
123
118
  }
@@ -19,8 +19,6 @@ export declare type THopInfo = {
19
19
  export declare type DryRunResult = {
20
20
  origin: DryRunNodeResult;
21
21
  destination?: DryRunNodeResult;
22
- assetHub?: DryRunNodeResult;
23
- bridgeHub?: DryRunNodeResult;
24
22
  hops: THopInfo[];
25
23
  };
26
24
  interface GetXcmFeeRequest {
@@ -6,7 +6,7 @@ import { ProxyServiceRoute } from '@subwallet/extension-base/types/environment';
6
6
  import { fetchFromProxyService } from '@subwallet/extension-base/utils';
7
7
  import BigNumber from 'bignumber.js';
8
8
  import { assert, compactToU8a, isHex, u8aConcat, u8aEq } from '@polkadot/util';
9
- const version = '/v4';
9
+ const version = '/v5';
10
10
  const paraSpellApi = {
11
11
  buildXcm: `${version}/x-transfer`,
12
12
  feeXcm: `${version}/xcm-fee`,