@subwallet/extension-base 1.3.7-0 → 1.3.9-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.
- package/background/KoniTypes.d.ts +11 -5
- package/background/KoniTypes.js +1 -1
- package/cjs/background/KoniTypes.js +1 -1
- package/cjs/core/logic-validation/transfer.js +35 -24
- package/cjs/core/substrate/system-pallet.js +1 -1
- package/cjs/core/substrate/xcm-parser.js +16 -2
- package/cjs/core/utils.js +2 -2
- package/cjs/koni/api/contract-handler/utils/index.js +15 -1
- package/cjs/koni/background/handlers/Extension.js +158 -86
- package/cjs/koni/background/handlers/State.js +11 -2
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/balance-service/index.js +24 -2
- package/cjs/services/balance-service/transfer/smart-contract.js +16 -5
- package/cjs/services/balance-service/transfer/xcm/index.js +31 -1
- package/cjs/services/balance-service/transfer/xcm/polygonBridge.js +108 -0
- package/cjs/services/chain-online-service/constants.js +32 -0
- package/cjs/services/chain-online-service/index.js +190 -0
- package/cjs/services/chain-service/constants.js +3 -1
- package/cjs/services/chain-service/index.js +87 -127
- package/cjs/services/chain-service/utils/index.js +0 -2
- package/cjs/services/chain-service/utils/patch.js +7 -3
- package/cjs/services/fee-service/utils/index.js +14 -0
- package/cjs/services/inapp-notification-service/consts.js +6 -4
- package/cjs/services/inapp-notification-service/index.js +110 -6
- package/cjs/services/inapp-notification-service/interfaces.js +9 -1
- package/cjs/services/inapp-notification-service/utils/avail.js +88 -0
- package/cjs/services/inapp-notification-service/{utils.js → utils/common.js} +1 -84
- package/cjs/services/inapp-notification-service/utils/index.js +38 -0
- package/cjs/services/inapp-notification-service/utils/polygon.js +66 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +37 -0
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/services/setting-service/SettingService.js +8 -0
- package/cjs/services/setting-service/constants.js +2 -1
- package/cjs/services/storage-service/DatabaseService.js +3 -0
- package/cjs/services/transaction-service/index.js +1 -1
- package/cjs/stores/ChainlistStore.js +18 -0
- package/cjs/types/index.js +11 -0
- package/cjs/types/transaction/error.js +1 -0
- package/cjs/utils/account/transform.js +1 -1
- package/core/logic-validation/transfer.d.ts +2 -1
- package/core/logic-validation/transfer.js +36 -25
- package/core/substrate/system-pallet.js +1 -1
- package/core/substrate/xcm-parser.d.ts +1 -0
- package/core/substrate/xcm-parser.js +15 -2
- package/core/types.d.ts +1 -0
- package/core/utils.js +2 -2
- package/koni/api/contract-handler/utils/index.d.ts +2 -0
- package/koni/api/contract-handler/utils/index.js +12 -0
- package/koni/api/contract-handler/utils/polygon_bridge_abi.json +1004 -0
- package/koni/background/handlers/Extension.d.ts +4 -0
- package/koni/background/handlers/Extension.js +93 -22
- package/koni/background/handlers/State.d.ts +2 -0
- package/koni/background/handlers/State.js +11 -2
- package/package.json +56 -14
- package/packageInfo.js +1 -1
- package/services/balance-service/index.d.ts +3 -0
- package/services/balance-service/index.js +21 -2
- package/services/balance-service/transfer/smart-contract.js +16 -5
- package/services/balance-service/transfer/xcm/index.d.ts +1 -0
- package/services/balance-service/transfer/xcm/index.js +29 -1
- package/services/balance-service/transfer/xcm/polygonBridge.d.ts +22 -0
- package/services/balance-service/transfer/xcm/polygonBridge.js +95 -0
- package/services/chain-online-service/constants.d.ts +4 -0
- package/services/chain-online-service/constants.js +23 -0
- package/services/chain-online-service/index.d.ts +22 -0
- package/services/chain-online-service/index.js +182 -0
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +1 -0
- package/services/chain-service/index.d.ts +6 -7
- package/services/chain-service/index.js +78 -116
- package/services/chain-service/utils/index.js +0 -2
- package/services/chain-service/utils/patch.d.ts +16 -1
- package/services/chain-service/utils/patch.js +7 -3
- package/services/fee-service/utils/index.js +14 -0
- package/services/inapp-notification-service/consts.d.ts +3 -1
- package/services/inapp-notification-service/consts.js +6 -4
- package/services/inapp-notification-service/index.d.ts +10 -2
- package/services/inapp-notification-service/index.js +111 -7
- package/services/inapp-notification-service/interfaces.d.ts +27 -3
- package/services/inapp-notification-service/interfaces.js +7 -0
- package/services/inapp-notification-service/utils/avail.d.ts +40 -0
- package/services/inapp-notification-service/utils/avail.js +73 -0
- package/services/inapp-notification-service/utils/common.d.ts +11 -0
- package/services/inapp-notification-service/{utils.js → utils/common.js} +1 -72
- package/services/inapp-notification-service/utils/index.d.ts +3 -0
- package/services/inapp-notification-service/utils/index.js +6 -0
- package/services/inapp-notification-service/utils/polygon.d.ts +71 -0
- package/services/inapp-notification-service/utils/polygon.js +54 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBridge.d.ts +4 -0
- package/services/migration-service/scripts/MigrateTransactionHistoryBridge.js +29 -0
- package/services/migration-service/scripts/index.js +3 -1
- package/services/setting-service/SettingService.d.ts +4 -0
- package/services/setting-service/SettingService.js +8 -0
- package/services/setting-service/constants.js +2 -1
- package/services/storage-service/DatabaseService.d.ts +1 -0
- package/services/storage-service/DatabaseService.js +3 -0
- package/services/transaction-service/index.js +1 -1
- package/stores/ChainlistStore.d.ts +7 -0
- package/stores/ChainlistStore.js +10 -0
- package/types/{avail-bridge → bridge}/index.d.ts +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.js +1 -0
- package/types/notification/index.d.ts +5 -0
- package/types/transaction/error.d.ts +2 -1
- package/types/transaction/error.js +1 -0
- package/utils/account/transform.js +1 -1
- package/services/inapp-notification-service/utils.d.ts +0 -55
- /package/cjs/types/{avail-bridge → bridge}/index.js +0 -0
- /package/types/{avail-bridge → bridge}/index.js +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.AvailBridgeSourceChain = exports.AVAIL_BRIDGE_INDEXER = exports.AVAIL_BRIDGE_API = void 0;
|
|
7
|
+
exports.fetchAllAvailBridgeClaimable = fetchAllAvailBridgeClaimable;
|
|
8
|
+
exports.fetchAvailBridgeTransactions = fetchAvailBridgeTransactions;
|
|
9
|
+
exports.filterClaimableOfAddress = filterClaimableOfAddress;
|
|
10
|
+
exports.getAvailBridgeClaimDescription = getAvailBridgeClaimDescription;
|
|
11
|
+
var _interfaces = require("../interfaces");
|
|
12
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
13
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
14
|
+
|
|
15
|
+
/* Description */
|
|
16
|
+
function getAvailBridgeClaimDescription(amount, symbol) {
|
|
17
|
+
return `${amount} ${symbol} ready to claim from ${symbol} cross-chain transfer. Click to claim now!`;
|
|
18
|
+
}
|
|
19
|
+
/* Description */
|
|
20
|
+
|
|
21
|
+
// todo: can refactor utils and const of avail bridge to a new file. Also check in /transfer/xcm/availBridge.ts file
|
|
22
|
+
|
|
23
|
+
const AVAIL_BRIDGE_INDEXER = {
|
|
24
|
+
AVAIL_MAINNET: 'https://bridge-indexer.avail.so',
|
|
25
|
+
AVAIL_TESTNET: 'https://turing-bridge-indexer.fra.avail.so'
|
|
26
|
+
};
|
|
27
|
+
exports.AVAIL_BRIDGE_INDEXER = AVAIL_BRIDGE_INDEXER;
|
|
28
|
+
const AVAIL_BRIDGE_API = {
|
|
29
|
+
AVAIL_MAINNET: 'https://bridge-api.avail.so',
|
|
30
|
+
AVAIL_TESTNET: 'https://turing-bridge-api.fra.avail.so'
|
|
31
|
+
};
|
|
32
|
+
exports.AVAIL_BRIDGE_API = AVAIL_BRIDGE_API;
|
|
33
|
+
let AvailBridgeSourceChain;
|
|
34
|
+
exports.AvailBridgeSourceChain = AvailBridgeSourceChain;
|
|
35
|
+
(function (AvailBridgeSourceChain) {
|
|
36
|
+
AvailBridgeSourceChain["AVAIL"] = "AVAIL";
|
|
37
|
+
AvailBridgeSourceChain["ETHEREUM"] = "ETHEREUM";
|
|
38
|
+
})(AvailBridgeSourceChain || (exports.AvailBridgeSourceChain = AvailBridgeSourceChain = {}));
|
|
39
|
+
async function fetchAllAvailBridgeClaimable(address, sourceChain, isTestnet) {
|
|
40
|
+
const transactions = [];
|
|
41
|
+
let isContinue = true;
|
|
42
|
+
let page = 0;
|
|
43
|
+
const pageSize = 100;
|
|
44
|
+
while (isContinue) {
|
|
45
|
+
const response = await fetchAvailBridgeTransactions(address, sourceChain, _interfaces.BridgeTransactionStatus.READY_TO_CLAIM, pageSize, page, isTestnet);
|
|
46
|
+
if (!response) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
transactions.push(...filterClaimableOfAddress(address, response.data.result));
|
|
50
|
+
isContinue = response.data.paginationData.hasNextPage;
|
|
51
|
+
page = page + 1;
|
|
52
|
+
}
|
|
53
|
+
return transactions;
|
|
54
|
+
}
|
|
55
|
+
async function fetchAvailBridgeTransactions(userAddress, sourceChain, status) {
|
|
56
|
+
let pageSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
|
|
57
|
+
let page = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
58
|
+
let isTestnet = arguments.length > 5 ? arguments[5] : undefined;
|
|
59
|
+
const params = new URLSearchParams({
|
|
60
|
+
userAddress,
|
|
61
|
+
sourceChain,
|
|
62
|
+
status,
|
|
63
|
+
pageSize: pageSize.toString(),
|
|
64
|
+
page: page.toString()
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
const api = isTestnet ? AVAIL_BRIDGE_INDEXER.AVAIL_TESTNET : AVAIL_BRIDGE_INDEXER.AVAIL_MAINNET;
|
|
68
|
+
const rawResponse = await fetch(`${api}/transactions?${params.toString()}`, {
|
|
69
|
+
method: 'GET',
|
|
70
|
+
headers: {
|
|
71
|
+
'Content-Type': 'application/json',
|
|
72
|
+
'Access-Control-Allow-Origin': '*'
|
|
73
|
+
},
|
|
74
|
+
credentials: 'omit'
|
|
75
|
+
});
|
|
76
|
+
if (!rawResponse.ok) {
|
|
77
|
+
console.error('Error fetching claimable bridge transactions');
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return await rawResponse.json();
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.error(e);
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function filterClaimableOfAddress(address, transactions) {
|
|
87
|
+
return transactions.filter(transaction => transaction.receiverAddress.toLowerCase() === address.toLowerCase());
|
|
88
|
+
}
|
|
@@ -3,13 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.AvailBridgeTransactionStatus = exports.AvailBridgeSourceChain = exports.AVAIL_BRIDGE_INDEXER = exports.AVAIL_BRIDGE_API = void 0;
|
|
7
6
|
exports.createClaimNotification = createClaimNotification;
|
|
8
7
|
exports.createWithdrawNotifications = createWithdrawNotifications;
|
|
9
|
-
exports.fetchAllAvailBridgeClaimable = fetchAllAvailBridgeClaimable;
|
|
10
|
-
exports.fetchAvailBridgeTransactions = fetchAvailBridgeTransactions;
|
|
11
|
-
exports.filterClaimableOfAddress = filterClaimableOfAddress;
|
|
12
|
-
exports.getAvailBridgeClaimDescription = getAvailBridgeClaimDescription;
|
|
13
8
|
exports.getClaimDescription = getClaimDescription;
|
|
14
9
|
exports.getIsTabRead = getIsTabRead;
|
|
15
10
|
exports.getReceiveDescription = getReceiveDescription;
|
|
@@ -41,9 +36,7 @@ function getSendDescription(amount, symbol) {
|
|
|
41
36
|
function getReceiveDescription(amount, symbol) {
|
|
42
37
|
return `You have just received ${amount} ${symbol}`;
|
|
43
38
|
}
|
|
44
|
-
|
|
45
|
-
return `${amount} ${symbol} ready to claim from ${symbol} cross-chain transfer. Click to claim now!`;
|
|
46
|
-
}
|
|
39
|
+
|
|
47
40
|
/* Description */
|
|
48
41
|
|
|
49
42
|
function getIsTabRead(notificationTab) {
|
|
@@ -116,82 +109,6 @@ function createClaimNotification(claimItemInfo, tokenInfo) {
|
|
|
116
109
|
}
|
|
117
110
|
};
|
|
118
111
|
}
|
|
119
|
-
|
|
120
|
-
// todo: can refactor utils and const of avail bridge to a new file. Also check in /transfer/xcm/availBridge.ts file
|
|
121
|
-
|
|
122
|
-
const AVAIL_BRIDGE_INDEXER = {
|
|
123
|
-
AVAIL_MAINNET: 'https://bridge-indexer.avail.so',
|
|
124
|
-
AVAIL_TESTNET: 'https://turing-bridge-indexer.fra.avail.so'
|
|
125
|
-
};
|
|
126
|
-
exports.AVAIL_BRIDGE_INDEXER = AVAIL_BRIDGE_INDEXER;
|
|
127
|
-
const AVAIL_BRIDGE_API = {
|
|
128
|
-
AVAIL_MAINNET: 'https://bridge-api.avail.so',
|
|
129
|
-
AVAIL_TESTNET: 'https://turing-bridge-api.fra.avail.so'
|
|
130
|
-
};
|
|
131
|
-
exports.AVAIL_BRIDGE_API = AVAIL_BRIDGE_API;
|
|
132
|
-
let AvailBridgeTransactionStatus;
|
|
133
|
-
exports.AvailBridgeTransactionStatus = AvailBridgeTransactionStatus;
|
|
134
|
-
(function (AvailBridgeTransactionStatus) {
|
|
135
|
-
AvailBridgeTransactionStatus["READY_TO_CLAIM"] = "READY_TO_CLAIM";
|
|
136
|
-
AvailBridgeTransactionStatus["CLAIMED"] = "CLAIMED";
|
|
137
|
-
AvailBridgeTransactionStatus["BRIDGED"] = "BRIDGED";
|
|
138
|
-
})(AvailBridgeTransactionStatus || (exports.AvailBridgeTransactionStatus = AvailBridgeTransactionStatus = {}));
|
|
139
|
-
let AvailBridgeSourceChain;
|
|
140
|
-
exports.AvailBridgeSourceChain = AvailBridgeSourceChain;
|
|
141
|
-
(function (AvailBridgeSourceChain) {
|
|
142
|
-
AvailBridgeSourceChain["AVAIL"] = "AVAIL";
|
|
143
|
-
AvailBridgeSourceChain["ETHEREUM"] = "ETHEREUM";
|
|
144
|
-
})(AvailBridgeSourceChain || (exports.AvailBridgeSourceChain = AvailBridgeSourceChain = {}));
|
|
145
|
-
async function fetchAllAvailBridgeClaimable(address, sourceChain, isTestnet) {
|
|
146
|
-
const transactions = [];
|
|
147
|
-
let isContinue = true;
|
|
148
|
-
let page = 0;
|
|
149
|
-
const pageSize = 100;
|
|
150
|
-
while (isContinue) {
|
|
151
|
-
const response = await fetchAvailBridgeTransactions(address, sourceChain, AvailBridgeTransactionStatus.READY_TO_CLAIM, pageSize, page, isTestnet);
|
|
152
|
-
if (!response) {
|
|
153
|
-
break;
|
|
154
|
-
}
|
|
155
|
-
transactions.push(...filterClaimableOfAddress(address, response.data.result));
|
|
156
|
-
isContinue = response.data.paginationData.hasNextPage;
|
|
157
|
-
page = page + 1;
|
|
158
|
-
}
|
|
159
|
-
return transactions;
|
|
160
|
-
}
|
|
161
|
-
async function fetchAvailBridgeTransactions(userAddress, sourceChain, status) {
|
|
162
|
-
let pageSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 100;
|
|
163
|
-
let page = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
164
|
-
let isTestnet = arguments.length > 5 ? arguments[5] : undefined;
|
|
165
|
-
const params = new URLSearchParams({
|
|
166
|
-
userAddress,
|
|
167
|
-
sourceChain,
|
|
168
|
-
status,
|
|
169
|
-
pageSize: pageSize.toString(),
|
|
170
|
-
page: page.toString()
|
|
171
|
-
});
|
|
172
|
-
try {
|
|
173
|
-
const api = isTestnet ? AVAIL_BRIDGE_INDEXER.AVAIL_TESTNET : AVAIL_BRIDGE_INDEXER.AVAIL_MAINNET;
|
|
174
|
-
const rawResponse = await fetch(`${api}/transactions?${params.toString()}`, {
|
|
175
|
-
method: 'GET',
|
|
176
|
-
headers: {
|
|
177
|
-
'Content-Type': 'application/json',
|
|
178
|
-
'Access-Control-Allow-Origin': '*'
|
|
179
|
-
},
|
|
180
|
-
credentials: 'omit'
|
|
181
|
-
});
|
|
182
|
-
if (!rawResponse.ok) {
|
|
183
|
-
console.error('Error fetching claimable bridge transactions');
|
|
184
|
-
return undefined;
|
|
185
|
-
}
|
|
186
|
-
return await rawResponse.json();
|
|
187
|
-
} catch (e) {
|
|
188
|
-
console.error(e);
|
|
189
|
-
return undefined;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
function filterClaimableOfAddress(address, transactions) {
|
|
193
|
-
return transactions.filter(transaction => transaction.receiverAddress.toLowerCase() === address.toLowerCase());
|
|
194
|
-
}
|
|
195
112
|
function hrsToMillisecond(hours) {
|
|
196
113
|
return hours * 60 * 60 * 1000;
|
|
197
114
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _avail = require("./avail");
|
|
7
|
+
Object.keys(_avail).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _avail[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _avail[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _common = require("./common");
|
|
18
|
+
Object.keys(_common).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _common[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _polygon = require("./polygon");
|
|
29
|
+
Object.keys(_polygon).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _polygon[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _polygon[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.POLYGON_BRIDGE_INDEXER = void 0;
|
|
7
|
+
exports.fetchAndFilterPolygonTransactionById = fetchAndFilterPolygonTransactionById;
|
|
8
|
+
exports.fetchPolygonBridgeTransactions = fetchPolygonBridgeTransactions;
|
|
9
|
+
exports.getPolygonBridgeClaimDescription = getPolygonBridgeClaimDescription;
|
|
10
|
+
var _interfaces = require("../interfaces");
|
|
11
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
12
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
|
|
14
|
+
const POLYGON_BRIDGE_INDEXER = {
|
|
15
|
+
MAINNET: 'https://api-gateway.polygon.technology/api/v3/transactions/mainnet',
|
|
16
|
+
TESTNET: 'https://api-gateway.polygon.technology/api/v3/transactions/testnet'
|
|
17
|
+
};
|
|
18
|
+
exports.POLYGON_BRIDGE_INDEXER = POLYGON_BRIDGE_INDEXER;
|
|
19
|
+
/* Description */
|
|
20
|
+
function getPolygonBridgeClaimDescription(amount, symbol) {
|
|
21
|
+
return `${amount} ${symbol} ready to claim from ${symbol} cross-chain transfer. Click to claim now!`;
|
|
22
|
+
}
|
|
23
|
+
/* Description */
|
|
24
|
+
|
|
25
|
+
async function fetchPolygonBridgeTransactions(userAddress, isTestnet) {
|
|
26
|
+
let pageSize = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 500;
|
|
27
|
+
let page = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
28
|
+
const params = new URLSearchParams({
|
|
29
|
+
userAddress,
|
|
30
|
+
pageSize: pageSize.toString(),
|
|
31
|
+
page: page.toString()
|
|
32
|
+
});
|
|
33
|
+
const networkIds = [0, 1];
|
|
34
|
+
networkIds.forEach(networkId => {
|
|
35
|
+
params.append('destinationNetworkIds', networkId.toString());
|
|
36
|
+
params.append('sourceNetworkIds', networkId.toString());
|
|
37
|
+
params.append('status', _interfaces.BridgeTransactionStatus.READY_TO_CLAIM);
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
const domain = isTestnet ? POLYGON_BRIDGE_INDEXER.TESTNET : POLYGON_BRIDGE_INDEXER.MAINNET;
|
|
41
|
+
const rawResponse = await fetch(`${domain}?${params.toString()}`, {
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
'Access-Control-Allow-Origin': '*',
|
|
46
|
+
'x-api-key': 'polygonag_4RFN-g_wt2o12GmK9WWOWrGf-4Hamhtd'
|
|
47
|
+
},
|
|
48
|
+
credentials: 'omit'
|
|
49
|
+
});
|
|
50
|
+
if (!rawResponse.ok) {
|
|
51
|
+
console.error('Error fetching claimable bridge transactions');
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
return await rawResponse.json();
|
|
55
|
+
} catch (e) {
|
|
56
|
+
console.error(e);
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async function fetchAndFilterPolygonTransactionById(transactionId, userAddress, isTestnet) {
|
|
61
|
+
const response = await fetchPolygonBridgeTransactions(userAddress, isTestnet);
|
|
62
|
+
if (!response || !response.success) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return response.result.find(tx => tx._id === transactionId);
|
|
66
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
9
|
+
var _Base = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/Base"));
|
|
10
|
+
var _dexie = _interopRequireDefault(require("dexie"));
|
|
11
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
12
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
|
|
14
|
+
class MigrateTransactionHistoryBridge extends _Base.default {
|
|
15
|
+
async run() {
|
|
16
|
+
const state = this.state;
|
|
17
|
+
const newTransactionItems = [];
|
|
18
|
+
try {
|
|
19
|
+
const db = new _dexie.default('SubWalletDB_v2');
|
|
20
|
+
const dexieDB = await db.open();
|
|
21
|
+
const transactionTable = dexieDB.table('transactions');
|
|
22
|
+
const oldTransactionData = await transactionTable.toArray();
|
|
23
|
+
const claimAvailBridgeTransactions = oldTransactionData.filter(item => item.type === 'claim.claim_avail_bridge');
|
|
24
|
+
claimAvailBridgeTransactions.forEach(item => {
|
|
25
|
+
const newItem = {
|
|
26
|
+
...item,
|
|
27
|
+
type: _KoniTypes.ExtrinsicType.CLAIM_BRIDGE
|
|
28
|
+
};
|
|
29
|
+
newTransactionItems.push(newItem);
|
|
30
|
+
});
|
|
31
|
+
await state.dbService.upsertHistory(newTransactionItems);
|
|
32
|
+
} catch (e) {
|
|
33
|
+
this.logger.error(e);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.default = MigrateTransactionHistoryBridge;
|
|
@@ -31,6 +31,7 @@ var _MigrateNetworkSettings = _interopRequireDefault(require("./MigrateNetworkSe
|
|
|
31
31
|
var _MigrateSettings = _interopRequireDefault(require("./MigrateSettings"));
|
|
32
32
|
var _MigrateTokenDecimals = _interopRequireDefault(require("./MigrateTokenDecimals"));
|
|
33
33
|
var _MigrateTransactionHistory = _interopRequireDefault(require("./MigrateTransactionHistory"));
|
|
34
|
+
var _MigrateTransactionHistoryBridge = _interopRequireDefault(require("./MigrateTransactionHistoryBridge"));
|
|
34
35
|
var _MigrateTransactionHistoryBySymbol = _interopRequireDefault(require("./MigrateTransactionHistoryBySymbol"));
|
|
35
36
|
var _MigrateWalletReference = _interopRequireDefault(require("./MigrateWalletReference"));
|
|
36
37
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
@@ -67,7 +68,8 @@ var _default = {
|
|
|
67
68
|
'1.2.69-01': _MigrateRemoveGenesisHash.default,
|
|
68
69
|
'1.2.13-01': _ReloadMetadata.default,
|
|
69
70
|
'1.2.14-01': _ClearMetadataDatabase.default,
|
|
70
|
-
'1.2.32-01': _MigratePairData.default
|
|
71
|
+
'1.2.32-01': _MigratePairData.default,
|
|
72
|
+
'1.3.6-01': _MigrateTransactionHistoryBridge.default
|
|
71
73
|
// [`${EVERYTIME}-1.1.42-02`]: MigrateTransactionHistoryBySymbol
|
|
72
74
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
73
75
|
};
|
|
@@ -8,6 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _constants = require("@subwallet/extension-base/constants");
|
|
9
9
|
var _Environment = require("@subwallet/extension-base/services/environment-service/stores/Environment");
|
|
10
10
|
var _storage = require("@subwallet/extension-base/storage");
|
|
11
|
+
var _ChainlistStore = _interopRequireDefault(require("@subwallet/extension-base/stores/ChainlistStore"));
|
|
11
12
|
var _PassPhishingStore = _interopRequireDefault(require("@subwallet/extension-base/stores/PassPhishingStore"));
|
|
12
13
|
var _Settings = _interopRequireDefault(require("@subwallet/extension-base/stores/Settings"));
|
|
13
14
|
var _i18n = _interopRequireDefault(require("./i18n/i18n"));
|
|
@@ -18,6 +19,7 @@ var _constants2 = require("./constants");
|
|
|
18
19
|
class SettingService {
|
|
19
20
|
settingsStore = new _Settings.default();
|
|
20
21
|
passPhishingStore = new _PassPhishingStore.default();
|
|
22
|
+
chainlistStore = new _ChainlistStore.default();
|
|
21
23
|
environmentStore = new _Environment.EnvironmentStoreSubject();
|
|
22
24
|
constructor() {
|
|
23
25
|
this.initSetting().catch(console.error);
|
|
@@ -71,6 +73,12 @@ class SettingService {
|
|
|
71
73
|
setPassPhishing(data, callback) {
|
|
72
74
|
this.passPhishingStore.set('PassPhishing', data, callback);
|
|
73
75
|
}
|
|
76
|
+
getChainlistSetting() {
|
|
77
|
+
return this.chainlistStore.asyncGet('Chainlist');
|
|
78
|
+
}
|
|
79
|
+
setChainlist(data, callback) {
|
|
80
|
+
this.chainlistStore.set('Chainlist', data, callback);
|
|
81
|
+
}
|
|
74
82
|
getEnvironmentSetting() {
|
|
75
83
|
return this.environmentStore.subject.value;
|
|
76
84
|
}
|
|
@@ -38,7 +38,8 @@ const DEFAULT_NOTIFICATION_SETUP = {
|
|
|
38
38
|
// receive: true,
|
|
39
39
|
earningClaim: true,
|
|
40
40
|
earningWithdraw: true,
|
|
41
|
-
availBridgeClaim: true
|
|
41
|
+
availBridgeClaim: true,
|
|
42
|
+
polygonBridgeClaim: true
|
|
42
43
|
// isHideWithdraw: false, // todo: just for test, remove later
|
|
43
44
|
// isHideMarketing: false,
|
|
44
45
|
// isHideAnnouncement: false
|
|
@@ -343,6 +343,9 @@ class DatabaseService {
|
|
|
343
343
|
async updateAssetStore(item) {
|
|
344
344
|
return this.stores.asset.upsert(item);
|
|
345
345
|
}
|
|
346
|
+
async bulkUpdateAssetsStore(items) {
|
|
347
|
+
return this.stores.asset.bulkUpsert(items);
|
|
348
|
+
}
|
|
346
349
|
async getAllAssetStore() {
|
|
347
350
|
return this.stores.asset.getAll();
|
|
348
351
|
}
|
|
@@ -592,7 +592,7 @@ class TransactionService {
|
|
|
592
592
|
historyItem.additionalInfo = data;
|
|
593
593
|
break;
|
|
594
594
|
}
|
|
595
|
-
case _KoniTypes.ExtrinsicType.
|
|
595
|
+
case _KoniTypes.ExtrinsicType.CLAIM_BRIDGE:
|
|
596
596
|
{
|
|
597
597
|
const data = (0, _utils3.parseTransactionData)(transaction.data); // TODO: switch by provider
|
|
598
598
|
const metadata = data.notification.metadata;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _defaults = require("@subwallet/extension-base/defaults");
|
|
9
|
+
var _SubscribableStore = _interopRequireDefault(require("@subwallet/extension-base/stores/SubscribableStore"));
|
|
10
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
11
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
12
|
+
|
|
13
|
+
class ChainlistStore extends _SubscribableStore.default {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(_defaults.EXTENSION_PREFIX ? `${_defaults.EXTENSION_PREFIX}chainlist` : null);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.default = ChainlistStore;
|
package/cjs/types/index.js
CHANGED
|
@@ -25,6 +25,17 @@ Object.keys(_balance).forEach(function (key) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
|
+
var _bridge = require("./bridge");
|
|
29
|
+
Object.keys(_bridge).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _bridge[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _bridge[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
28
39
|
var _buy = require("./buy");
|
|
29
40
|
Object.keys(_buy).forEach(function (key) {
|
|
30
41
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -50,4 +50,5 @@ exports.TransferTxErrorType = TransferTxErrorType;
|
|
|
50
50
|
TransferTxErrorType["INVALID_TOKEN"] = "INVALID_TOKEN";
|
|
51
51
|
TransferTxErrorType["TRANSFER_ERROR"] = "TRANSFER_ERROR";
|
|
52
52
|
TransferTxErrorType["RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT"] = "RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT";
|
|
53
|
+
TransferTxErrorType["RECEIVER_ACCOUNT_INACTIVE"] = "RECEIVER_ACCOUNT_INACTIVE";
|
|
53
54
|
})(TransferTxErrorType || (exports.TransferTxErrorType = TransferTxErrorType = {}));
|
|
@@ -145,7 +145,7 @@ const EARN_QDOT_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_QDOT, _KoniTypes.Extrin
|
|
|
145
145
|
const EARN_STDOT_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_STDOT, _KoniTypes.ExtrinsicType.REDEEM_STDOT, _KoniTypes.ExtrinsicType.UNSTAKE_STDOT];
|
|
146
146
|
const EARN_VMANTA_ACTIONS = [_KoniTypes.ExtrinsicType.MINT_VMANTA, _KoniTypes.ExtrinsicType.REDEEM_VMANTA, _KoniTypes.ExtrinsicType.UNSTAKE_VMANTA];
|
|
147
147
|
const EVM_ACTIONS = [_KoniTypes.ExtrinsicType.TOKEN_SPENDING_APPROVAL, _KoniTypes.ExtrinsicType.EVM_EXECUTE];
|
|
148
|
-
const CLAIM_AVAIL_BRIDGE = [_KoniTypes.ExtrinsicType.
|
|
148
|
+
const CLAIM_AVAIL_BRIDGE = [_KoniTypes.ExtrinsicType.CLAIM_BRIDGE];
|
|
149
149
|
const OTHER_ACTIONS = [_KoniTypes.ExtrinsicType.TRANSFER_XCM, _KoniTypes.ExtrinsicType.SEND_NFT, _KoniTypes.ExtrinsicType.SWAP, _KoniTypes.ExtrinsicType.CROWDLOAN];
|
|
150
150
|
const getAccountTransactionActions = (signMode, networkType, type, _meta, _specialNetwork) => {
|
|
151
151
|
if ([_types2.AccountSignMode.PASSWORD, _types2.AccountSignMode.INJECTED].includes(signMode)) {
|
|
@@ -2,12 +2,13 @@ import { _ChainAsset, _ChainInfo } from '@subwallet/chain-list/types';
|
|
|
2
2
|
import { TransactionError } from '@subwallet/extension-base/background/errors/TransactionError';
|
|
3
3
|
import { _Address, AmountData, ExtrinsicType, FeeData } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
4
|
import { TransactionWarning } from '@subwallet/extension-base/background/warnings/TransactionWarning';
|
|
5
|
+
import { FrameSystemAccountInfo } from '@subwallet/extension-base/core/substrate/types';
|
|
5
6
|
import { _EvmApi, _TonApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
6
7
|
import { OptionalSWTransaction, SWTransactionInput, SWTransactionResponse } from '@subwallet/extension-base/services/transaction-service/types';
|
|
7
8
|
import { KeyringPair } from '@subwallet/keyring/types';
|
|
8
9
|
import BigN from 'bignumber.js';
|
|
9
10
|
export declare function validateTransferRequest(tokenInfo: _ChainAsset, from: _Address, to: _Address, value: string | undefined, transferAll: boolean | undefined): [TransactionError[], KeyringPair | undefined, BigN | undefined];
|
|
10
|
-
export declare function
|
|
11
|
+
export declare function additionalValidateTransferForRecipient(sendingTokenInfo: _ChainAsset, nativeTokenInfo: _ChainAsset, extrinsicType: ExtrinsicType, receiverSendingTokenKeepAliveBalance: bigint, transferAmount: bigint, senderSendingTokenTransferable?: bigint, receiverSystemAccountInfo?: FrameSystemAccountInfo, isSendingTokenSufficient?: boolean): [TransactionWarning[], TransactionError[]];
|
|
11
12
|
export declare function validateXcmTransferRequest(destTokenInfo: _ChainAsset | undefined, sender: _Address, sendingValue: string): [TransactionError[], KeyringPair | undefined, BigN | undefined];
|
|
12
13
|
export declare function additionalValidateXcmTransfer(originTokenInfo: _ChainAsset, destinationTokenInfo: _ChainAsset, sendingAmount: string, senderTransferable: string, receiverNativeBalance: string, destChainInfo: _ChainInfo, isSnowBridge?: boolean): [TransactionWarning | undefined, TransactionError | undefined];
|
|
13
14
|
export declare function checkSupportForFeature(validationResponse: SWTransactionResponse, blockedFeaturesList: string[], chainInfo: _ChainInfo): void;
|
|
@@ -5,10 +5,10 @@ import { TransactionError } from '@subwallet/extension-base/background/errors/Tr
|
|
|
5
5
|
import { ExtrinsicType } from '@subwallet/extension-base/background/KoniTypes';
|
|
6
6
|
import { TransactionWarning } from '@subwallet/extension-base/background/warnings/TransactionWarning';
|
|
7
7
|
import { LEDGER_SIGNING_COMPATIBLE_MAP, SIGNING_COMPATIBLE_MAP, XCM_MIN_AMOUNT_RATIO } from '@subwallet/extension-base/constants';
|
|
8
|
-
import { _canAccountBeReaped } from '@subwallet/extension-base/core/substrate/system-pallet';
|
|
8
|
+
import { _canAccountBeReaped, _isAccountActive } from '@subwallet/extension-base/core/substrate/system-pallet';
|
|
9
9
|
import { isBounceableAddress } from '@subwallet/extension-base/services/balance-service/helpers/subscribe/ton/utils';
|
|
10
10
|
import { _TRANSFER_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
11
|
-
import { _getChainExistentialDeposit, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getTokenMinAmount, _isNativeToken, _isTokenEvmSmartContract, _isTokenTonSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
|
|
11
|
+
import { _getAssetDecimals, _getChainExistentialDeposit, _getChainNativeTokenBasicInfo, _getContractAddressOfToken, _getTokenMinAmount, _isNativeToken, _isTokenEvmSmartContract, _isTokenTonSmartContract } from '@subwallet/extension-base/services/chain-service/utils';
|
|
12
12
|
import { calculateGasFeeParams } from '@subwallet/extension-base/services/fee-service/utils';
|
|
13
13
|
import { isSubstrateTransaction, isTonTransaction } from '@subwallet/extension-base/services/transaction-service/helpers';
|
|
14
14
|
import { AccountSignMode, BasicTxErrorType, BasicTxWarningCode, TransferTxErrorType } from '@subwallet/extension-base/types';
|
|
@@ -43,44 +43,55 @@ export function validateTransferRequest(tokenInfo, from, to, value, transferAll)
|
|
|
43
43
|
}
|
|
44
44
|
return [errors, keypair, transferValue];
|
|
45
45
|
}
|
|
46
|
-
export function
|
|
47
|
-
const
|
|
48
|
-
const
|
|
46
|
+
export function additionalValidateTransferForRecipient(sendingTokenInfo, nativeTokenInfo, extrinsicType, receiverSendingTokenKeepAliveBalance, transferAmount, senderSendingTokenTransferable, receiverSystemAccountInfo, isSendingTokenSufficient) {
|
|
47
|
+
const sendingTokenMinAmount = BigInt(_getTokenMinAmount(sendingTokenInfo));
|
|
48
|
+
const nativeTokenMinAmount = _getTokenMinAmount(nativeTokenInfo);
|
|
49
49
|
const warnings = [];
|
|
50
50
|
const errors = [];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const remainingSendingTokenOfSenderEnoughED = senderSendingTokenTransferable ? senderSendingTokenTransferable - transferAmount >= sendingTokenMinAmount : false;
|
|
52
|
+
const isReceiverAliveByNativeToken = receiverSystemAccountInfo ? _isAccountActive(receiverSystemAccountInfo) : false;
|
|
53
|
+
const isReceivingAmountPassED = receiverSendingTokenKeepAliveBalance + transferAmount >= sendingTokenMinAmount;
|
|
54
|
+
if (extrinsicType === ExtrinsicType.TRANSFER_TOKEN) {
|
|
55
|
+
if (!remainingSendingTokenOfSenderEnoughED) {
|
|
55
56
|
const warning = new TransactionWarning(BasicTxWarningCode.NOT_ENOUGH_EXISTENTIAL_DEPOSIT);
|
|
56
57
|
warnings.push(warning);
|
|
57
58
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('The recipient account has {{amount}} {{nativeSymbol}} which can lead to your {{localSymbol}} being lost. Change recipient account and try again', {
|
|
59
|
+
if (!isReceiverAliveByNativeToken && !isSendingTokenSufficient) {
|
|
60
|
+
const balanceKeepAlive = formatNumber(nativeTokenMinAmount, _getAssetDecimals(nativeTokenInfo), balanceFormatter, {
|
|
61
|
+
maxNumberFormat: _getAssetDecimals(nativeTokenInfo) || 6
|
|
62
|
+
});
|
|
63
|
+
const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('The recipient account has less than {{amount}} {{nativeSymbol}}, which can lead to your {{localSymbol}} being lost. Change recipient account and try again', {
|
|
64
64
|
replace: {
|
|
65
|
-
amount:
|
|
65
|
+
amount: balanceKeepAlive,
|
|
66
66
|
nativeSymbol: nativeTokenInfo.symbol,
|
|
67
|
-
localSymbol:
|
|
67
|
+
localSymbol: sendingTokenInfo.symbol
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
errors.push(error);
|
|
71
|
+
}
|
|
72
|
+
if (!isReceivingAmountPassED) {
|
|
73
|
+
const atLeast = sendingTokenMinAmount - receiverSendingTokenKeepAliveBalance;
|
|
74
|
+
const atLeastStr = formatNumber(atLeast.toString(), _getAssetDecimals(sendingTokenInfo), balanceFormatter, {
|
|
75
|
+
maxNumberFormat: _getAssetDecimals(sendingTokenInfo) || 6
|
|
76
|
+
});
|
|
77
|
+
const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to avoid losing funds on the recipient account. Increase amount and try again', {
|
|
78
|
+
replace: {
|
|
79
|
+
amount: atLeastStr,
|
|
80
|
+
symbol: sendingTokenInfo.symbol
|
|
68
81
|
}
|
|
69
82
|
}));
|
|
70
83
|
errors.push(error);
|
|
71
84
|
}
|
|
72
85
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const atLeastStr = formatNumber(atLeast, tokenInfo.decimals || 0, balanceFormatter, {
|
|
78
|
-
maxNumberFormat: tokenInfo.decimals || 6
|
|
86
|
+
if (!isReceivingAmountPassED) {
|
|
87
|
+
const atLeast = sendingTokenMinAmount - receiverSendingTokenKeepAliveBalance;
|
|
88
|
+
const atLeastStr = formatNumber(atLeast.toString(), _getAssetDecimals(sendingTokenInfo), balanceFormatter, {
|
|
89
|
+
maxNumberFormat: _getAssetDecimals(sendingTokenInfo) || 6
|
|
79
90
|
});
|
|
80
|
-
const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to keep the
|
|
91
|
+
const error = new TransactionError(TransferTxErrorType.RECEIVER_NOT_ENOUGH_EXISTENTIAL_DEPOSIT, t('You must transfer at least {{amount}} {{symbol}} to keep the recipient account alive. Increase amount and try again', {
|
|
81
92
|
replace: {
|
|
82
93
|
amount: atLeastStr,
|
|
83
|
-
symbol:
|
|
94
|
+
symbol: sendingTokenInfo.symbol
|
|
84
95
|
}
|
|
85
96
|
}));
|
|
86
97
|
errors.push(error);
|
|
@@ -20,7 +20,7 @@ export function _canAccountBeReaped(accountInfo) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function _isAccountActive(accountInfo) {
|
|
23
|
-
return accountInfo.providers === 0 && accountInfo.
|
|
23
|
+
return !(accountInfo.consumers === 0 && accountInfo.providers === 0 && accountInfo.sufficients === 0);
|
|
24
24
|
}
|
|
25
25
|
export function _getSystemPalletTotalBalance(accountInfo) {
|
|
26
26
|
if (isV1(accountInfo)) {
|
|
@@ -53,4 +53,5 @@ export declare function _isXcmWithinSameConsensus(originChainInfo: _ChainInfo, d
|
|
|
53
53
|
export declare function _isSnowBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
54
54
|
export declare function _isAvailBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
55
55
|
export declare function _isMythosFromHydrationToMythos(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo, assetSlug: string): boolean;
|
|
56
|
+
export declare function _isPolygonBridgeXcm(originChainInfo: _ChainInfo, destChainInfo: _ChainInfo): boolean;
|
|
56
57
|
export declare function _adaptX1Interior(_assetIdentifier: Record<string, any>, version: number): Record<string, any>;
|