@subwallet/extension-base 1.3.22-0 → 1.3.23-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 (193) hide show
  1. package/background/KoniTypes.d.ts +75 -2
  2. package/background/KoniTypes.js +2 -0
  3. package/cjs/background/KoniTypes.js +2 -0
  4. package/cjs/constants/environment.js +4 -2
  5. package/cjs/constants/signing.js +6 -2
  6. package/cjs/core/logic-validation/recipientAddress.js +9 -1
  7. package/cjs/core/logic-validation/transfer.js +35 -29
  8. package/cjs/core/types.js +1 -0
  9. package/cjs/core/utils.js +12 -1
  10. package/cjs/defaults.js +1 -1
  11. package/cjs/koni/api/dotsama/crowdloan.js +1 -1
  12. package/cjs/koni/api/nft/index.js +9 -16
  13. package/cjs/koni/api/staking/index.js +3 -4
  14. package/cjs/koni/background/handlers/Extension.js +234 -96
  15. package/cjs/koni/background/handlers/State.js +15 -0
  16. package/cjs/packageInfo.js +1 -1
  17. package/cjs/services/balance-service/helpers/subscribe/cardano/consts.js +11 -0
  18. package/cjs/services/balance-service/helpers/subscribe/cardano/index.js +63 -0
  19. package/cjs/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
  20. package/cjs/services/balance-service/helpers/subscribe/cardano/utils.js +74 -0
  21. package/cjs/services/balance-service/helpers/subscribe/index.js +21 -7
  22. package/cjs/services/balance-service/helpers/subscribe/ton/utils.js +2 -2
  23. package/cjs/services/balance-service/index.js +4 -2
  24. package/cjs/services/balance-service/transfer/cardano-transfer.js +122 -0
  25. package/cjs/services/balance-service/transfer/token.js +4 -4
  26. package/cjs/services/chain-service/handler/CardanoApi.js +176 -0
  27. package/cjs/services/chain-service/handler/CardanoChainHandler.js +83 -0
  28. package/cjs/services/chain-service/handler/TonApi.js +2 -5
  29. package/cjs/services/chain-service/index.js +29 -7
  30. package/cjs/services/chain-service/utils/index.js +40 -11
  31. package/cjs/services/chain-service/utils/patch.js +1 -1
  32. package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
  33. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
  34. package/cjs/services/earning-service/service.js +6 -12
  35. package/cjs/services/fee-service/service.js +19 -8
  36. package/cjs/services/history-service/index.js +4 -6
  37. package/cjs/services/inapp-notification-service/index.js +12 -4
  38. package/cjs/services/keyring-service/context/account-context.js +17 -2
  39. package/cjs/services/keyring-service/context/handlers/Derive.js +10 -7
  40. package/cjs/services/keyring-service/context/handlers/Migration.js +268 -0
  41. package/cjs/services/keyring-service/context/handlers/Mnemonic.js +2 -2
  42. package/cjs/services/keyring-service/context/handlers/Secret.js +1 -1
  43. package/cjs/services/keyring-service/utils.js +18 -0
  44. package/cjs/services/request-service/handler/CardanoRequestHandler.js +172 -0
  45. package/cjs/services/request-service/handler/EvmRequestHandler.js +1 -1
  46. package/cjs/services/request-service/index.js +20 -2
  47. package/cjs/services/setting-service/constants.js +10 -1
  48. package/cjs/services/storage-service/DatabaseService.js +3 -0
  49. package/cjs/services/storage-service/db-stores/InappNotification.js +6 -0
  50. package/cjs/services/swap-service/handler/asset-hub/handler.js +0 -59
  51. package/cjs/services/swap-service/handler/chainflip-handler.js +33 -281
  52. package/cjs/services/swap-service/handler/hydradx-handler.js +23 -190
  53. package/cjs/services/swap-service/handler/simpleswap-handler.js +1 -222
  54. package/cjs/services/swap-service/handler/uniswap-handler.js +331 -0
  55. package/cjs/services/swap-service/index.js +31 -22
  56. package/cjs/services/swap-service/utils.js +21 -38
  57. package/cjs/services/transaction-service/helpers/index.js +6 -1
  58. package/cjs/services/transaction-service/index.js +278 -21
  59. package/cjs/services/transaction-service/utils.js +5 -1
  60. package/cjs/types/account/info/keyring.js +12 -1
  61. package/cjs/types/fee/cardano.js +1 -0
  62. package/cjs/types/swap/index.js +7 -2
  63. package/cjs/utils/account/analyze.js +2 -1
  64. package/cjs/utils/account/common.js +29 -20
  65. package/cjs/utils/account/derive/info/solo.js +9 -4
  66. package/cjs/utils/account/derive/validate.js +36 -2
  67. package/cjs/utils/account/transform.js +38 -13
  68. package/cjs/utils/fee/transfer.js +40 -7
  69. package/cjs/utils/index.js +2 -2
  70. package/cjs/utils/staticData/index.js +7 -2
  71. package/constants/environment.d.ts +1 -0
  72. package/constants/environment.js +2 -1
  73. package/constants/signing.js +6 -2
  74. package/core/logic-validation/recipientAddress.js +11 -3
  75. package/core/logic-validation/transfer.js +9 -3
  76. package/core/substrate/xcm-parser.d.ts +1 -1
  77. package/core/types.d.ts +1 -0
  78. package/core/types.js +1 -0
  79. package/core/utils.d.ts +1 -0
  80. package/core/utils.js +13 -3
  81. package/defaults.d.ts +1 -1
  82. package/defaults.js +1 -1
  83. package/koni/api/dotsama/crowdloan.js +3 -3
  84. package/koni/api/nft/index.js +10 -16
  85. package/koni/api/nft/story_odyssey_nft/index.d.ts +1 -1
  86. package/koni/api/staking/index.js +4 -5
  87. package/koni/background/handlers/Extension.d.ts +9 -0
  88. package/koni/background/handlers/Extension.js +144 -8
  89. package/koni/background/handlers/State.d.ts +5 -1
  90. package/koni/background/handlers/State.js +16 -1
  91. package/package.json +71 -9
  92. package/packageInfo.js +1 -1
  93. package/services/balance-service/helpers/subscribe/cardano/consts.d.ts +1 -0
  94. package/services/balance-service/helpers/subscribe/cardano/consts.js +4 -0
  95. package/services/balance-service/helpers/subscribe/cardano/index.d.ts +2 -0
  96. package/services/balance-service/helpers/subscribe/cardano/index.js +57 -0
  97. package/services/balance-service/helpers/subscribe/cardano/types.d.ts +34 -0
  98. package/services/balance-service/helpers/subscribe/cardano/types.js +1 -0
  99. package/services/balance-service/helpers/subscribe/cardano/utils.d.ts +15 -0
  100. package/services/balance-service/helpers/subscribe/cardano/utils.js +62 -0
  101. package/services/balance-service/helpers/subscribe/index.d.ts +2 -2
  102. package/services/balance-service/helpers/subscribe/index.js +23 -9
  103. package/services/balance-service/helpers/subscribe/ton/utils.d.ts +1 -1
  104. package/services/balance-service/helpers/subscribe/ton/utils.js +1 -1
  105. package/services/balance-service/index.js +4 -2
  106. package/services/balance-service/transfer/cardano-transfer.d.ts +24 -0
  107. package/services/balance-service/transfer/cardano-transfer.js +114 -0
  108. package/services/balance-service/transfer/token.d.ts +1 -1
  109. package/services/balance-service/transfer/token.js +2 -2
  110. package/services/chain-service/handler/CardanoApi.d.ts +38 -0
  111. package/services/chain-service/handler/CardanoApi.js +167 -0
  112. package/services/chain-service/handler/CardanoChainHandler.d.ts +17 -0
  113. package/services/chain-service/handler/CardanoChainHandler.js +75 -0
  114. package/services/chain-service/handler/TonApi.js +3 -6
  115. package/services/chain-service/handler/types.d.ts +1 -0
  116. package/services/chain-service/index.d.ts +3 -1
  117. package/services/chain-service/index.js +29 -7
  118. package/services/chain-service/types.d.ts +9 -1
  119. package/services/chain-service/utils/index.d.ts +4 -0
  120. package/services/chain-service/utils/index.js +32 -11
  121. package/services/chain-service/utils/patch.js +1 -1
  122. package/services/earning-service/handlers/liquid-staking/bifrost-manta.js +1 -1
  123. package/services/earning-service/handlers/liquid-staking/bifrost.js +1 -1
  124. package/services/earning-service/service.js +8 -14
  125. package/services/fee-service/service.js +19 -8
  126. package/services/history-service/index.js +6 -8
  127. package/services/inapp-notification-service/index.d.ts +3 -4
  128. package/services/inapp-notification-service/index.js +14 -6
  129. package/services/keyring-service/context/account-context.d.ts +6 -2
  130. package/services/keyring-service/context/account-context.js +17 -2
  131. package/services/keyring-service/context/handlers/Derive.d.ts +1 -1
  132. package/services/keyring-service/context/handlers/Derive.js +10 -8
  133. package/services/keyring-service/context/handlers/Migration.d.ts +17 -0
  134. package/services/keyring-service/context/handlers/Migration.js +258 -0
  135. package/services/keyring-service/context/handlers/Mnemonic.js +2 -2
  136. package/services/keyring-service/context/handlers/Secret.js +2 -2
  137. package/services/keyring-service/utils.d.ts +2 -0
  138. package/services/keyring-service/utils.js +11 -0
  139. package/services/request-service/handler/CardanoRequestHandler.d.ts +16 -0
  140. package/services/request-service/handler/CardanoRequestHandler.js +163 -0
  141. package/services/request-service/handler/EvmRequestHandler.js +1 -1
  142. package/services/request-service/index.d.ts +6 -3
  143. package/services/request-service/index.js +19 -5
  144. package/services/setting-service/constants.d.ts +3 -0
  145. package/services/setting-service/constants.js +6 -0
  146. package/services/storage-service/DatabaseService.d.ts +1 -0
  147. package/services/storage-service/DatabaseService.js +3 -0
  148. package/services/storage-service/db-stores/InappNotification.d.ts +1 -0
  149. package/services/storage-service/db-stores/InappNotification.js +6 -0
  150. package/services/swap-service/handler/asset-hub/handler.d.ts +1 -4
  151. package/services/swap-service/handler/asset-hub/handler.js +2 -61
  152. package/services/swap-service/handler/base-handler.d.ts +1 -4
  153. package/services/swap-service/handler/chainflip-handler.d.ts +2 -9
  154. package/services/swap-service/handler/chainflip-handler.js +31 -280
  155. package/services/swap-service/handler/hydradx-handler.d.ts +1 -6
  156. package/services/swap-service/handler/hydradx-handler.js +13 -180
  157. package/services/swap-service/handler/simpleswap-handler.d.ts +1 -4
  158. package/services/swap-service/handler/simpleswap-handler.js +5 -226
  159. package/services/swap-service/handler/uniswap-handler.d.ts +41 -0
  160. package/services/swap-service/handler/uniswap-handler.js +323 -0
  161. package/services/swap-service/index.js +30 -22
  162. package/services/swap-service/utils.d.ts +1 -5
  163. package/services/swap-service/utils.js +7 -21
  164. package/services/transaction-service/helpers/index.d.ts +2 -0
  165. package/services/transaction-service/helpers/index.js +4 -0
  166. package/services/transaction-service/index.d.ts +8 -2
  167. package/services/transaction-service/index.js +263 -10
  168. package/services/transaction-service/types.d.ts +7 -0
  169. package/services/transaction-service/utils.js +7 -2
  170. package/types/account/info/keyring.d.ts +4 -1
  171. package/types/account/info/keyring.js +9 -0
  172. package/types/account/info/proxy.d.ts +2 -0
  173. package/types/balance/index.d.ts +4 -1
  174. package/types/fee/base.d.ts +1 -1
  175. package/types/fee/cardano.d.ts +18 -0
  176. package/types/fee/cardano.js +1 -0
  177. package/types/fee/subscription.d.ts +4 -3
  178. package/types/swap/index.d.ts +11 -3
  179. package/types/swap/index.js +7 -2
  180. package/utils/account/analyze.js +2 -1
  181. package/utils/account/common.d.ts +11 -6
  182. package/utils/account/common.js +28 -19
  183. package/utils/account/derive/info/solo.js +10 -5
  184. package/utils/account/derive/validate.d.ts +1 -0
  185. package/utils/account/derive/validate.js +34 -1
  186. package/utils/account/transform.d.ts +2 -1
  187. package/utils/account/transform.js +37 -13
  188. package/utils/fee/transfer.d.ts +2 -1
  189. package/utils/fee/transfer.js +44 -11
  190. package/utils/index.js +4 -4
  191. package/utils/staticData/index.d.ts +4 -1
  192. package/utils/staticData/index.js +5 -1
  193. package/utils/staticData/oldChainPrefix.json +1 -0
@@ -5,7 +5,7 @@ import { AccountExternalErrorCode } from '@subwallet/extension-base/background/K
5
5
  import { AccountChainType, CommonAccountErrorType, SWCommonAccountError } from '@subwallet/extension-base/types';
6
6
  import { getKeypairTypeByAddress } from '@subwallet/keyring';
7
7
  import { decodePair } from '@subwallet/keyring/pair/decode';
8
- import { BitcoinKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
8
+ import { BitcoinKeypairTypes, CardanoKeypairTypes, TonKeypairTypes } from '@subwallet/keyring/types';
9
9
  import keyring from '@subwallet/ui-keyring';
10
10
  import { t } from 'i18next';
11
11
  import { assert, hexStripPrefix, hexToU8a, isHex, u8aToHex } from '@polkadot/util';
@@ -49,7 +49,7 @@ export class AccountSecretHandler extends AccountBaseHandler {
49
49
  isReadOnly,
50
50
  genesisHash: ''
51
51
  };
52
- if ([...BitcoinKeypairTypes, ...TonKeypairTypes].includes(type) && isReadOnly) {
52
+ if ([...BitcoinKeypairTypes, ...TonKeypairTypes, ...CardanoKeypairTypes].includes(type) && isReadOnly) {
53
53
  meta.noPublicKey = true;
54
54
  }
55
55
  const result = keyring.keyring.addFromAddress(address, meta, null, type);
@@ -0,0 +1,2 @@
1
+ import { AccountProxy } from '@subwallet/extension-base/types';
2
+ export declare const hasAnyAccountForMigration: (allAccountProxies: AccountProxy[]) => boolean;
@@ -0,0 +1,11 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export const hasAnyAccountForMigration = allAccountProxies => {
5
+ for (const account of allAccountProxies) {
6
+ if (account.isNeedMigrateUnifiedAccount) {
7
+ return true;
8
+ }
9
+ }
10
+ return false;
11
+ };
@@ -0,0 +1,16 @@
1
+ import { ConfirmationDefinitionsCardano, ConfirmationsQueueCardano, ConfirmationsQueueItemOptions, ConfirmationTypeCardano, RequestConfirmationCompleteCardano } from '@subwallet/extension-base/background/KoniTypes';
2
+ import RequestService from '@subwallet/extension-base/services/request-service';
3
+ import { BehaviorSubject } from 'rxjs';
4
+ export default class CardanoRequestHandler {
5
+ #private;
6
+ private readonly confirmationsQueueSubjectCardano;
7
+ private readonly confirmationsPromiseMap;
8
+ constructor(requestService: RequestService);
9
+ get numCardanoRequests(): number;
10
+ getConfirmationsQueueSubjectCardano(): BehaviorSubject<ConfirmationsQueueCardano>;
11
+ addConfirmationCardano<CT extends ConfirmationTypeCardano>(id: string, url: string, type: CT, payload: ConfirmationDefinitionsCardano[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitionsCardano[CT][1]) => Error | undefined): Promise<ConfirmationDefinitionsCardano[CT][1]>;
12
+ completeConfirmationCardano(request: RequestConfirmationCompleteCardano): Promise<boolean>;
13
+ private decorateResult;
14
+ private signTransactionCardano;
15
+ resetWallet(): void;
16
+ }
@@ -0,0 +1,163 @@
1
+ // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { isInternalRequest } from '@subwallet/extension-base/utils/request';
5
+ import { keyring } from '@subwallet/ui-keyring';
6
+ import { t } from 'i18next';
7
+ import { BehaviorSubject } from 'rxjs';
8
+ import { logger as createLogger } from '@polkadot/util/logger';
9
+ export default class CardanoRequestHandler {
10
+ #requestService;
11
+ #logger;
12
+ confirmationsQueueSubjectCardano = new BehaviorSubject({
13
+ cardanoSignatureRequest: {},
14
+ cardanoSendTransactionRequest: {},
15
+ cardanoWatchTransactionRequest: {}
16
+ });
17
+ confirmationsPromiseMap = {};
18
+ constructor(requestService) {
19
+ this.#requestService = requestService;
20
+ this.#logger = createLogger('CardanoRequestHandler');
21
+ }
22
+ get numCardanoRequests() {
23
+ let count = 0;
24
+ Object.values(this.confirmationsQueueSubjectCardano.getValue()).forEach(x => {
25
+ count += Object.keys(x).length;
26
+ });
27
+ return count;
28
+ }
29
+ getConfirmationsQueueSubjectCardano() {
30
+ return this.confirmationsQueueSubjectCardano;
31
+ }
32
+ async addConfirmationCardano(id, url, type, payload, options = {}, validator) {
33
+ const confirmations = this.confirmationsQueueSubjectCardano.getValue();
34
+ const confirmationType = confirmations[type];
35
+ const payloadJson = JSON.stringify({});
36
+ const isInternal = isInternalRequest(url);
37
+ if (['cardanoSendTransactionRequest', 'cardanoSignatureRequest'].includes(type)) {
38
+ const isAlwaysRequired = await this.#requestService.settingService.isAlwaysRequired;
39
+ if (isAlwaysRequired) {
40
+ this.#requestService.keyringService.lock();
41
+ }
42
+ }
43
+
44
+ // Check duplicate request
45
+ const duplicated = Object.values(confirmationType).find(c => c.url === url && c.payloadJson === payloadJson);
46
+ if (duplicated) {
47
+ throw new Error('Cardano duplicate request'); // update this message.
48
+ }
49
+
50
+ confirmationType[id] = {
51
+ id,
52
+ url,
53
+ isInternal,
54
+ payload,
55
+ payloadJson,
56
+ ...options
57
+ };
58
+ const promise = new Promise((resolve, reject) => {
59
+ this.confirmationsPromiseMap[id] = {
60
+ validator: validator,
61
+ resolver: {
62
+ resolve: resolve,
63
+ reject: reject
64
+ }
65
+ };
66
+ });
67
+ this.confirmationsQueueSubjectCardano.next(confirmations);
68
+ if (!isInternal) {
69
+ this.#requestService.popupOpen();
70
+ }
71
+ this.#requestService.updateIconV2();
72
+ return promise;
73
+ }
74
+ async completeConfirmationCardano(request) {
75
+ const confirmations = this.confirmationsQueueSubjectCardano.getValue();
76
+ for (const ct in request) {
77
+ const type = ct;
78
+ const result = request[type];
79
+ const {
80
+ id
81
+ } = result;
82
+ const {
83
+ resolver,
84
+ validator
85
+ } = this.confirmationsPromiseMap[id];
86
+ const confirmation = confirmations[type][id];
87
+ if (!resolver || !confirmation) {
88
+ this.#logger.error(t('Unable to proceed. Please try again'), type, id);
89
+ throw new Error(t('Unable to proceed. Please try again'));
90
+ }
91
+
92
+ // Fill signature for some special type
93
+ await this.decorateResult(type, confirmation, result);
94
+
95
+ // Validate response from confirmation popup some info like password, response format....
96
+ const error = validator && validator(result);
97
+ if (error) {
98
+ resolver.reject(error);
99
+ }
100
+
101
+ // Delete confirmations from queue
102
+ delete this.confirmationsPromiseMap[id];
103
+ delete confirmations[type][id];
104
+ this.confirmationsQueueSubjectCardano.next(confirmations);
105
+
106
+ // Update icon, and close queue
107
+ this.#requestService.updateIconV2(this.#requestService.numAllRequests === 0);
108
+ resolver.resolve(result);
109
+ }
110
+
111
+ // TODO: Review later
112
+ return true;
113
+ }
114
+ async decorateResult(t, request, result) {
115
+ if (result.payload === '') {
116
+ if (t === 'cardanoSignatureRequest') {
117
+ // result.payload = await this.signMessage(request as ConfirmationDefinitions['evmSignatureRequest'][0]);
118
+ } else if (t === 'cardanoSendTransactionRequest') {
119
+ result.payload = this.signTransactionCardano(request);
120
+ }
121
+ if (t === 'cardanoSignatureRequest' || t === 'cardanoSendTransactionRequest') {
122
+ const isAlwaysRequired = await this.#requestService.settingService.isAlwaysRequired;
123
+ if (isAlwaysRequired) {
124
+ this.#requestService.keyringService.lock();
125
+ }
126
+ }
127
+ }
128
+ }
129
+ signTransactionCardano(confirmation) {
130
+ // alibaba
131
+ const transaction = confirmation.payload;
132
+ const {
133
+ cardanoPayload,
134
+ from
135
+ } = transaction;
136
+ const pair = keyring.getPair(from);
137
+ if (pair.isLocked) {
138
+ keyring.unlockPair(pair.address);
139
+ }
140
+ return pair.cardano.sign(cardanoPayload);
141
+ }
142
+ resetWallet() {
143
+ const confirmations = this.confirmationsQueueSubjectCardano.getValue();
144
+ for (const [type, requests] of Object.entries(confirmations)) {
145
+ for (const confirmation of Object.values(requests)) {
146
+ const {
147
+ id
148
+ } = confirmation;
149
+ const {
150
+ resolver
151
+ } = this.confirmationsPromiseMap[id];
152
+ if (!resolver || !confirmation) {
153
+ console.error('Not found confirmation', type, id);
154
+ } else {
155
+ resolver.reject(new Error('Reset wallet'));
156
+ }
157
+ delete this.confirmationsPromiseMap[id];
158
+ delete confirmations[type][id];
159
+ }
160
+ }
161
+ this.confirmationsQueueSubjectCardano.next(confirmations);
162
+ }
163
+ }
@@ -79,7 +79,7 @@ export default class EvmRequestHandler {
79
79
  }
80
80
  if (options.isPassConfirmation) {
81
81
  await this.completeConfirmation({
82
- evmSendTransactionRequest: {
82
+ [type]: {
83
83
  id,
84
84
  url,
85
85
  isApproved: true,
@@ -1,4 +1,4 @@
1
- import { AuthRequestV2, ConfirmationDefinitions, ConfirmationDefinitionsTon, ConfirmationsQueue, ConfirmationsQueueItemOptions, ConfirmationsQueueTon, ConfirmationType, ConfirmationTypeTon, RequestConfirmationComplete, RequestConfirmationCompleteTon } from '@subwallet/extension-base/background/KoniTypes';
1
+ import { AuthRequestV2, ConfirmationDefinitions, ConfirmationDefinitionsCardano, ConfirmationDefinitionsTon, ConfirmationsQueue, ConfirmationsQueueCardano, ConfirmationsQueueItemOptions, ConfirmationsQueueTon, ConfirmationType, ConfirmationTypeCardano, ConfirmationTypeTon, RequestConfirmationComplete, RequestConfirmationCompleteCardano, RequestConfirmationCompleteTon } from '@subwallet/extension-base/background/KoniTypes';
2
2
  import { AccountAuthType, AuthorizeRequest, MetadataRequest, RequestAuthorizeTab, RequestSign, ResponseSigning, SigningRequest } from '@subwallet/extension-base/background/types';
3
3
  import { ChainService } from '@subwallet/extension-base/services/chain-service';
4
4
  import { KeyringService } from '@subwallet/extension-base/services/keyring-service';
@@ -47,15 +47,18 @@ export default class RequestService {
47
47
  get numSubstrateRequests(): number;
48
48
  get numEvmRequests(): number;
49
49
  get numTonRequests(): number;
50
+ get numCardanoRequests(): number;
50
51
  get confirmationsQueueSubject(): BehaviorSubject<ConfirmationsQueue>;
51
52
  get confirmationsQueueSubjectTon(): BehaviorSubject<ConfirmationsQueueTon>;
53
+ get confirmationsQueueSubjectCardano(): BehaviorSubject<ConfirmationsQueueCardano>;
52
54
  getSignRequest(id: string): import("./types").SignRequest | undefined;
53
55
  signInternalTransaction(id: string, address: string, url: string, payload: SignerPayloadJSON, onSign?: (id: string) => void): Promise<ResponseSigning>;
54
56
  addConfirmation<CT extends ConfirmationType>(id: string, url: string, type: CT, payload: ConfirmationDefinitions[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitions[CT][1]) => Error | undefined): Promise<ConfirmationDefinitions[CT][1]>;
55
- addConfirmationTon<CT extends ConfirmationTypeTon>(id: string, url: string, type: CT, payload: ConfirmationDefinitionsTon[CT][0]['payload'], // todo: messages <-> payload
56
- options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitionsTon[CT][1]) => Error | undefined): Promise<ConfirmationDefinitionsTon[CT][1]>;
57
+ addConfirmationTon<CT extends ConfirmationTypeTon>(id: string, url: string, type: CT, payload: ConfirmationDefinitionsTon[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitionsTon[CT][1]) => Error | undefined): Promise<ConfirmationDefinitionsTon[CT][1]>;
58
+ addConfirmationCardano<CT extends ConfirmationTypeCardano>(id: string, url: string, type: CT, payload: ConfirmationDefinitionsCardano[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitionsCardano[CT][1]) => Error | undefined): Promise<ConfirmationDefinitionsCardano[CT][1]>;
57
59
  completeConfirmation(request: RequestConfirmationComplete): Promise<boolean>;
58
60
  completeConfirmationTon(request: RequestConfirmationCompleteTon): Promise<boolean>;
61
+ completeConfirmationCardano(request: RequestConfirmationCompleteCardano): Promise<boolean>;
59
62
  updateConfirmation<CT extends ConfirmationType>(id: string, type: CT, payload: ConfirmationDefinitions[CT][0]['payload'], options?: ConfirmationsQueueItemOptions, validator?: (input: ConfirmationDefinitions[CT][1]) => Error | undefined): void;
60
63
  getConnectWCRequest(id: string): import("@subwallet/extension-base/services/wallet-connect-service/types").RequestWalletConnectSession;
61
64
  get connectWCSubject(): BehaviorSubject<WalletConnectSessionRequest[]>;
@@ -1,6 +1,7 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-base authors & contributors
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
+ import CardanoRequestHandler from '@subwallet/extension-base/services/request-service/handler/CardanoRequestHandler';
4
5
  import TonRequestHandler from "./handler/TonRequestHandler.js";
5
6
  import { AuthRequestHandler, ConnectWCRequestHandler, EvmRequestHandler, MetadataRequestHandler, NotSupportWCRequestHandler, PopupHandler, SubstrateRequestHandler } from "./handler/index.js";
6
7
  export default class RequestService {
@@ -12,6 +13,7 @@ export default class RequestService {
12
13
  #substrateRequestHandler;
13
14
  #evmRequestHandler;
14
15
  #tonRequestHandler;
16
+ #cardanoRequestHandler;
15
17
  #connectWCRequestHandler;
16
18
  #notSupportWCRequestHandler;
17
19
 
@@ -26,6 +28,7 @@ export default class RequestService {
26
28
  this.#substrateRequestHandler = new SubstrateRequestHandler(this);
27
29
  this.#evmRequestHandler = new EvmRequestHandler(this);
28
30
  this.#tonRequestHandler = new TonRequestHandler(this);
31
+ this.#cardanoRequestHandler = new CardanoRequestHandler(this);
29
32
  this.#connectWCRequestHandler = new ConnectWCRequestHandler(this);
30
33
  this.#notSupportWCRequestHandler = new NotSupportWCRequestHandler(this);
31
34
 
@@ -33,7 +36,7 @@ export default class RequestService {
33
36
  this.updateIconV2();
34
37
  }
35
38
  get numAllRequests() {
36
- return this.allSubstrateRequests.length + this.numEvmRequests + this.numTonRequests;
39
+ return this.allSubstrateRequests.length + this.numEvmRequests + this.numTonRequests + this.numCardanoRequests;
37
40
  }
38
41
  updateIconV2(shouldClose) {
39
42
  this.#popupHandler.updateIconV2(shouldClose);
@@ -142,12 +145,18 @@ export default class RequestService {
142
145
  get numTonRequests() {
143
146
  return this.#tonRequestHandler.numTonRequests;
144
147
  }
148
+ get numCardanoRequests() {
149
+ return this.#cardanoRequestHandler.numCardanoRequests;
150
+ }
145
151
  get confirmationsQueueSubject() {
146
152
  return this.#evmRequestHandler.getConfirmationsQueueSubject();
147
153
  }
148
154
  get confirmationsQueueSubjectTon() {
149
155
  return this.#tonRequestHandler.getConfirmationsQueueSubjectTon();
150
156
  }
157
+ get confirmationsQueueSubjectCardano() {
158
+ return this.#cardanoRequestHandler.getConfirmationsQueueSubjectCardano();
159
+ }
151
160
  getSignRequest(id) {
152
161
  return this.#substrateRequestHandler.getSignRequest(id);
153
162
  }
@@ -157,17 +166,21 @@ export default class RequestService {
157
166
  addConfirmation(id, url, type, payload, options = {}, validator) {
158
167
  return this.#evmRequestHandler.addConfirmation(id, url, type, payload, options, validator);
159
168
  }
160
- addConfirmationTon(id, url, type, payload,
161
- // todo: messages <-> payload
162
- options = {}, validator) {
169
+ addConfirmationTon(id, url, type, payload, options = {}, validator) {
163
170
  return this.#tonRequestHandler.addConfirmationTon(id, url, type, payload, options, validator);
164
171
  }
172
+ addConfirmationCardano(id, url, type, payload, options = {}, validator) {
173
+ return this.#cardanoRequestHandler.addConfirmationCardano(id, url, type, payload, options, validator);
174
+ }
165
175
  async completeConfirmation(request) {
166
176
  return await this.#evmRequestHandler.completeConfirmation(request);
167
177
  }
168
178
  async completeConfirmationTon(request) {
169
179
  return await this.#tonRequestHandler.completeConfirmationTon(request);
170
180
  }
181
+ async completeConfirmationCardano(request) {
182
+ return await this.#cardanoRequestHandler.completeConfirmationCardano(request);
183
+ }
171
184
  updateConfirmation(id, type, payload, options = {}, validator) {
172
185
  return this.#evmRequestHandler.updateConfirmation(id, type, payload, options, validator);
173
186
  }
@@ -208,13 +221,14 @@ export default class RequestService {
208
221
 
209
222
  // General methods
210
223
  get numRequests() {
211
- return this.numMetaRequests + this.numAuthRequests + this.numSubstrateRequests + this.numEvmRequests + this.numConnectWCRequests + this.numNotSupportWCRequests + this.numTonRequests;
224
+ return this.numMetaRequests + this.numAuthRequests + this.numSubstrateRequests + this.numEvmRequests + this.numConnectWCRequests + this.numNotSupportWCRequests + this.numTonRequests + this.numCardanoRequests;
212
225
  }
213
226
  resetWallet() {
214
227
  this.#authRequestHandler.resetWallet();
215
228
  this.#substrateRequestHandler.resetWallet();
216
229
  this.#evmRequestHandler.resetWallet();
217
230
  this.#tonRequestHandler.resetWallet();
231
+ this.#cardanoRequestHandler.resetWallet();
218
232
  this.#metadataRequestHandler.resetWallet();
219
233
  this.#connectWCRequestHandler.resetWallet();
220
234
  this.#notSupportWCRequestHandler.resetWallet();
@@ -13,4 +13,7 @@ export declare const DEFAULT_ALL_LOGO = "";
13
13
  export declare const DEFAULT_CAMERA_ENABLE = false;
14
14
  export declare const DEFAULT_ALLOW_ONE_SIGN = true;
15
15
  export declare const DEFAULT_NOTIFICATION_SETUP: NotificationSetup;
16
+ export declare const DEFAULT_ACKNOWLEDGED_MIGRATION_STATUS = false;
17
+ export declare const DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_PROGRESS = false;
18
+ export declare const DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_DONE = false;
16
19
  export declare const DEFAULT_SETTING: UiSettings;
@@ -30,6 +30,9 @@ export const DEFAULT_NOTIFICATION_SETUP = {
30
30
  }
31
31
  };
32
32
 
33
+ export const DEFAULT_ACKNOWLEDGED_MIGRATION_STATUS = false;
34
+ export const DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_PROGRESS = false;
35
+ export const DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_DONE = false;
33
36
  export const DEFAULT_SETTING = {
34
37
  language: DEFAULT_LANGUAGE,
35
38
  currency: DEFAULT_CURRENCY,
@@ -43,6 +46,9 @@ export const DEFAULT_SETTING = {
43
46
  timeAutoLock: DEFAULT_AUTO_LOCK_TIME,
44
47
  enableChainPatrol: DEFAULT_CHAIN_PATROL_ENABLE,
45
48
  notificationSetup: DEFAULT_NOTIFICATION_SETUP,
49
+ isAcknowledgedUnifiedAccountMigration: DEFAULT_ACKNOWLEDGED_MIGRATION_STATUS,
50
+ isUnifiedAccountMigrationInProgress: DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_PROGRESS,
51
+ isUnifiedAccountMigrationDone: DEFAULT_UNIFIED_ACCOUNT_MIGRATION_IN_DONE,
46
52
  walletReference: '',
47
53
  allowOneSign: DEFAULT_ALLOW_ONE_SIGN
48
54
  };
@@ -134,6 +134,7 @@ export default class DatabaseService {
134
134
  markAllRead(proxyId: string): import("dexie").PromiseExtended<number>;
135
135
  switchReadStatus(params: RequestSwitchStatusParams): import("dexie").PromiseExtended<number>;
136
136
  removeAccountNotifications(proxyId: string): import("dexie").PromiseExtended<number>;
137
+ updateNotificationProxyId(proxyIds: string[], newProxyId: string, newName: string): void;
137
138
  exportDB(): Promise<string>;
138
139
  importDB(data: string): Promise<boolean>;
139
140
  getExportJson(): Promise<DexieExportJsonStructure>;
@@ -595,6 +595,9 @@ export default class DatabaseService {
595
595
  removeAccountNotifications(proxyId) {
596
596
  return this.stores.inappNotification.removeAccountNotifications(proxyId);
597
597
  }
598
+ updateNotificationProxyId(proxyIds, newProxyId, newName) {
599
+ return this.stores.inappNotification.updateNotificationProxyId(proxyIds, newProxyId, newName);
600
+ }
598
601
  async exportDB() {
599
602
  const blob = await exportDB(this._db, {
600
603
  filter: (table, value, key) => {
@@ -5,6 +5,7 @@ export default class InappNotificationStore extends BaseStore<_NotificationInfo>
5
5
  getNotificationInfo(id: string): Promise<_NotificationInfo | undefined>;
6
6
  getAll(): Promise<_NotificationInfo[]>;
7
7
  getNotificationsByParams(params: GetNotificationParams): Promise<_NotificationInfo[]>;
8
+ updateNotificationProxyId(proxyIds: string[], newProxyId: string, newName: string): void;
8
9
  cleanUpOldNotifications(overdueTime: number): Promise<number>;
9
10
  subscribeUnreadNotificationsCount(): import("dexie").Observable<Record<string, number>>;
10
11
  getUnreadNotificationsCountMap(): Promise<Record<string, number>>;
@@ -36,6 +36,12 @@ export default class InappNotificationStore extends BaseStore {
36
36
  });
37
37
  return filteredTable.toArray();
38
38
  }
39
+ updateNotificationProxyId(proxyIds, newProxyId, newName) {
40
+ this.table.where('proxyId').anyOfIgnoreCase(proxyIds).modify(item => {
41
+ item.proxyId = newProxyId;
42
+ item.title = item.title.replace(/\[.*?\]/, `[${newName}]`);
43
+ }).catch(console.error);
44
+ }
39
45
  async cleanUpOldNotifications(overdueTime) {
40
46
  const currentTimestamp = Date.now();
41
47
  return this.table.filter(item => item.time <= currentTimestamp - overdueTime).delete();
@@ -1,10 +1,9 @@
1
- import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
2
1
  import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
3
2
  import { BalanceService } from '@subwallet/extension-base/services/balance-service';
4
3
  import { ChainService } from '@subwallet/extension-base/services/chain-service';
5
4
  import FeeService from '@subwallet/extension-base/services/fee-service/service';
6
5
  import { BaseStepDetail, CommonOptimalPath, CommonStepFeeInfo } from '@subwallet/extension-base/types/service-base';
7
- import { AssetHubSwapEarlyValidation, OptimalSwapPathParams, SwapProviderId, SwapQuote, SwapRequest, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
6
+ import { OptimalSwapPathParams, SwapProviderId, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
8
7
  import { SwapBaseInterface } from '../base-handler';
9
8
  export declare class AssetHubSwapHandler implements SwapBaseInterface {
10
9
  private swapBaseHandler;
@@ -22,11 +21,9 @@ export declare class AssetHubSwapHandler implements SwapBaseInterface {
22
21
  getXcmStep(params: OptimalSwapPathParams): Promise<[BaseStepDetail, CommonStepFeeInfo] | undefined>;
23
22
  getSubmitStep(params: OptimalSwapPathParams): Promise<[BaseStepDetail, CommonStepFeeInfo] | undefined>;
24
23
  generateOptimalProcess(params: OptimalSwapPathParams): Promise<CommonOptimalPath>;
25
- getSwapQuote(request: SwapRequest): Promise<SwapQuote | SwapError>;
26
24
  handleXcmStep(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
27
25
  handleSubmitStep(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
28
26
  handleSwapProcess(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
29
27
  validateSwapStep(params: ValidateSwapProcessParams, isXcmOk: boolean, stepIndex: number): Promise<TransactionError[]>;
30
28
  validateSwapProcess(params: ValidateSwapProcessParams): Promise<TransactionError[]>;
31
- validateSwapRequest(request: SwapRequest): Promise<AssetHubSwapEarlyValidation>;
32
29
  }
@@ -1,14 +1,13 @@
1
1
  // Copyright 2019-2022 @subwallet/extension-base
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
5
4
  import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
6
5
  import { ChainType, ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
7
6
  import { XCM_MIN_AMOUNT_RATIO } from '@subwallet/extension-base/constants';
8
- import { _getEarlyAssetHubValidationError, _validateBalanceToSwapOnAssetHub, _validateSwapRecipient } from '@subwallet/extension-base/core/logic-validation/swap';
7
+ import { _validateBalanceToSwapOnAssetHub, _validateSwapRecipient } from '@subwallet/extension-base/core/logic-validation/swap';
9
8
  import { createXcmExtrinsic } from '@subwallet/extension-base/services/balance-service/transfer/xcm';
10
9
  import { _getChainNativeTokenSlug, _isNativeToken } from '@subwallet/extension-base/services/chain-service/utils';
11
- import { convertSwapRate, getSwapAlternativeAsset, SWAP_QUOTE_TIMEOUT_MAP } from '@subwallet/extension-base/services/swap-service/utils';
10
+ import { getSwapAlternativeAsset } from '@subwallet/extension-base/services/swap-service/utils';
12
11
  import { BasicTxErrorType } from '@subwallet/extension-base/types';
13
12
  import { CommonStepType } from '@subwallet/extension-base/types/service-base';
14
13
  import { SwapErrorType, SwapFeeType, SwapProviderId, SwapStepType } from '@subwallet/extension-base/types/swap';
@@ -16,7 +15,6 @@ import { getId } from '@subwallet/extension-base/utils/getId';
16
15
  import BigN from 'bignumber.js';
17
16
  import { SwapBaseHandler } from "../base-handler.js";
18
17
  import { AssetHubRouter } from "./router.js";
19
- const PAH_LOW_LIQUIDITY_THRESHOLD = 0.15;
20
18
  export class AssetHubSwapHandler {
21
19
  isReady = false;
22
20
  constructor(chainService, balanceService, feeService, chain) {
@@ -150,57 +148,6 @@ export class AssetHubSwapHandler {
150
148
  generateOptimalProcess(params) {
151
149
  return this.swapBaseHandler.generateOptimalProcess(params, [this.getXcmStep.bind(this), this.getSubmitStep.bind(this)]);
152
150
  }
153
- async getSwapQuote(request) {
154
- const fromAsset = this.chainService.getAssetBySlug(request.pair.from);
155
- const toAsset = this.chainService.getAssetBySlug(request.pair.to);
156
- const fromChain = this.chainService.getChainInfoByKey(fromAsset.originChain);
157
- const fromChainNativeTokenSlug = _getChainNativeTokenSlug(fromChain);
158
- if (!this.isReady || !this.router) {
159
- return new SwapError(SwapErrorType.UNKNOWN);
160
- }
161
- const earlyValidation = await this.validateSwapRequest(request);
162
- if (earlyValidation.error) {
163
- const metadata = earlyValidation.metadata;
164
- return _getEarlyAssetHubValidationError(earlyValidation.error, metadata);
165
- }
166
- try {
167
- const paths = this.router.buildPath(request.pair);
168
- const amountOut = earlyValidation.metadata.toAmount;
169
- const toAmount = new BigN(amountOut);
170
- const minReceive = toAmount.times(1 - request.slippage).integerValue(BigN.ROUND_DOWN);
171
- const extrinsic = await this.router.buildSwapExtrinsic(paths, request.address, request.fromAmount, minReceive.toString());
172
- const paymentInfo = await extrinsic.paymentInfo(request.address);
173
- const networkFee = {
174
- tokenSlug: fromChainNativeTokenSlug,
175
- amount: paymentInfo.partialFee.toString(),
176
- feeType: SwapFeeType.NETWORK_FEE
177
- };
178
- const feeTokenOptions = [fromChainNativeTokenSlug];
179
- const selectedFeeToken = fromChainNativeTokenSlug;
180
- const priceImpactPct = earlyValidation.metadata.priceImpactPct || '0';
181
- return {
182
- pair: request.pair,
183
- fromAmount: request.fromAmount,
184
- toAmount: toAmount.toString(),
185
- rate: convertSwapRate(earlyValidation.metadata.quoteRate, fromAsset, toAsset),
186
- provider: this.providerInfo,
187
- aliveUntil: +Date.now() + (SWAP_QUOTE_TIMEOUT_MAP[this.slug] || SWAP_QUOTE_TIMEOUT_MAP.default),
188
- feeInfo: {
189
- feeComponent: [networkFee],
190
- defaultFeeToken: fromChainNativeTokenSlug,
191
- feeOptions: feeTokenOptions,
192
- // TODO: enable fee options
193
- selectedFeeToken
194
- },
195
- isLowLiquidity: Math.abs(parseFloat(priceImpactPct)) >= PAH_LOW_LIQUIDITY_THRESHOLD,
196
- route: {
197
- path: paths.map(asset => asset.slug)
198
- }
199
- };
200
- } catch (e) {
201
- return new SwapError(SwapErrorType.ERROR_FETCHING_QUOTE);
202
- }
203
- }
204
151
  async handleXcmStep(params) {
205
152
  const pair = params.quote.pair;
206
153
  const alternativeAssetSlug = getSwapAlternativeAsset(pair);
@@ -362,10 +309,4 @@ export class AssetHubSwapHandler {
362
309
  }
363
310
  return [];
364
311
  }
365
- validateSwapRequest(request) {
366
- if (!this.isReady || !this.router) {
367
- throw new SwapError(SwapErrorType.ERROR_FETCHING_QUOTE);
368
- }
369
- return this.router.earlyValidateSwapValidation(request);
370
- }
371
312
  }
@@ -1,16 +1,13 @@
1
- import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
2
1
  import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
3
2
  import { BalanceService } from '@subwallet/extension-base/services/balance-service';
4
3
  import { ChainService } from '@subwallet/extension-base/services/chain-service';
5
4
  import FeeService from '@subwallet/extension-base/services/fee-service/service';
6
5
  import { BaseStepDetail, CommonOptimalPath, CommonStepFeeInfo } from '@subwallet/extension-base/types/service-base';
7
- import { GenSwapStepFunc, OptimalSwapPathParams, SwapEarlyValidation, SwapProvider, SwapProviderId, SwapQuote, SwapRequest, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
6
+ import { GenSwapStepFunc, OptimalSwapPathParams, SwapProvider, SwapProviderId, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
8
7
  export interface SwapBaseInterface {
9
8
  providerSlug: SwapProviderId;
10
- getSwapQuote: (request: SwapRequest) => Promise<SwapQuote | SwapError>;
11
9
  generateOptimalProcess: (params: OptimalSwapPathParams) => Promise<CommonOptimalPath>;
12
10
  getSubmitStep: (params: OptimalSwapPathParams) => Promise<[BaseStepDetail, CommonStepFeeInfo] | undefined>;
13
- validateSwapRequest: (request: SwapRequest) => Promise<SwapEarlyValidation>;
14
11
  validateSwapProcess: (params: ValidateSwapProcessParams) => Promise<TransactionError[]>;
15
12
  handleSwapProcess: (params: SwapSubmitParams) => Promise<SwapSubmitStepData>;
16
13
  handleSubmitStep: (params: SwapSubmitParams) => Promise<SwapSubmitStepData>;
@@ -1,31 +1,24 @@
1
- import { Asset } from '@chainflip/sdk/swap';
2
1
  import { COMMON_ASSETS } from '@subwallet/chain-list';
3
- import { SwapError } from '@subwallet/extension-base/background/errors/SwapError';
4
2
  import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
5
3
  import { BalanceService } from '@subwallet/extension-base/services/balance-service';
6
4
  import { ChainService } from '@subwallet/extension-base/services/chain-service';
7
5
  import FeeService from '@subwallet/extension-base/services/fee-service/service';
8
6
  import { SwapBaseInterface } from '@subwallet/extension-base/services/swap-service/handler/base-handler';
9
7
  import { BaseStepDetail, CommonOptimalPath, CommonStepFeeInfo } from '@subwallet/extension-base/types/service-base';
10
- import { OptimalSwapPathParams, SwapEarlyValidation, SwapProviderId, SwapQuote, SwapRequest, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
8
+ import { OptimalSwapPathParams, SwapProviderId, SwapSubmitParams, SwapSubmitStepData, ValidateSwapProcessParams } from '@subwallet/extension-base/types/swap';
11
9
  export declare const CHAINFLIP_BROKER_API: string;
12
10
  export declare class ChainflipSwapHandler implements SwapBaseInterface {
13
- private swapSdk;
14
11
  private readonly isTestnet;
15
12
  private swapBaseHandler;
16
13
  providerSlug: SwapProviderId;
14
+ private baseUrl;
17
15
  constructor(chainService: ChainService, balanceService: BalanceService, feeService: FeeService, isTestnet?: boolean);
18
16
  get chainService(): ChainService;
19
17
  get balanceService(): BalanceService;
20
18
  get providerInfo(): import("@subwallet/extension-base/types").SwapProvider;
21
19
  get name(): string;
22
20
  get slug(): string;
23
- get assetMapping(): Record<string, Asset>;
24
- get chainMapping(): Record<string, import("@chainflip/sdk/dist/contracts-DmShvHR7").C>;
25
21
  get intermediaryAssetSlug(): COMMON_ASSETS.USDC_ETHEREUM | COMMON_ASSETS.USDC_SEPOLIA;
26
- validateSwapRequest(request: SwapRequest): Promise<SwapEarlyValidation>;
27
- private parseSwapPath;
28
- getSwapQuote(request: SwapRequest): Promise<SwapQuote | SwapError>;
29
22
  validateSwapProcess(params: ValidateSwapProcessParams): Promise<TransactionError[]>;
30
23
  handleSubmitStep(params: SwapSubmitParams): Promise<SwapSubmitStepData>;
31
24
  handleSwapProcess(params: SwapSubmitParams): Promise<SwapSubmitStepData>;