@subwallet/extension-base 1.0.9-1 → 1.0.10-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 +5 -1
- package/background/types.d.ts +2 -1
- package/cjs/koni/api/dotsama/transfer.js +16 -7
- package/cjs/koni/api/staking/bonding/paraChain.js +3 -2
- package/cjs/koni/api/staking/bonding/relayChain.js +3 -2
- package/cjs/koni/api/staking/bonding/utils.js +1 -1
- package/cjs/koni/api/xcm/polkadotXcm.js +5 -4
- package/cjs/koni/api/xcm/xTokens.js +1 -1
- package/cjs/koni/api/xcm/xcmPallet.js +1 -1
- package/cjs/koni/background/handlers/Extension.js +57 -18
- package/cjs/koni/background/handlers/State.js +3 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +2 -1
- package/cjs/services/chain-service/helper/api-helper/spec/dataavail.js +152 -0
- package/cjs/services/chain-service/helper/api-helper/spec/index.js +2 -0
- package/cjs/services/chain-service/index.js +1 -1
- package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +42 -0
- package/cjs/services/migration-service/scripts/index.js +3 -1
- package/cjs/services/transaction-service/index.js +15 -15
- package/cjs/signers/web3/QrSigner.js +14 -6
- package/cjs/utils/eth/mergeTransactionAndSignature.js +22 -13
- package/cjs/utils/eth/parseTransaction/base.js +6 -6
- package/cjs/utils/eth/parseTransaction/index.js +4 -5
- package/cjs/utils/eth.js +14 -18
- package/koni/api/dotsama/transfer.js +16 -7
- package/koni/api/staking/bonding/paraChain.js +3 -2
- package/koni/api/staking/bonding/relayChain.js +3 -2
- package/koni/api/staking/bonding/utils.js +1 -1
- package/koni/api/xcm/polkadotXcm.js +5 -4
- package/koni/api/xcm/xTokens.js +1 -1
- package/koni/api/xcm/xcmPallet.js +1 -1
- package/koni/background/handlers/Extension.d.ts +0 -1
- package/koni/background/handlers/Extension.js +57 -18
- package/koni/background/handlers/State.js +3 -3
- package/package.json +17 -8
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.d.ts +1 -0
- package/services/chain-service/constants.js +2 -1
- package/services/chain-service/helper/api-helper/spec/dataavail.d.ts +3 -0
- package/services/chain-service/helper/api-helper/spec/dataavail.js +145 -0
- package/services/chain-service/helper/api-helper/spec/index.js +2 -0
- package/services/chain-service/index.js +1 -1
- package/services/migration-service/scripts/MigrateLedgerAccount.d.ts +4 -0
- package/services/migration-service/scripts/MigrateLedgerAccount.js +33 -0
- package/services/migration-service/scripts/index.js +3 -1
- package/services/transaction-service/index.js +17 -17
- package/signers/types.d.ts +1 -1
- package/signers/web3/QrSigner.js +14 -5
- package/utils/eth/mergeTransactionAndSignature.d.ts +1 -1
- package/utils/eth/mergeTransactionAndSignature.js +20 -10
- package/utils/eth/parseTransaction/base.js +6 -6
- package/utils/eth/parseTransaction/index.js +4 -5
- package/utils/eth.d.ts +2 -3
- package/utils/eth.js +14 -17
|
@@ -628,6 +628,7 @@ export interface CreateHardwareAccountItem {
|
|
|
628
628
|
genesisHash: string;
|
|
629
629
|
hardwareType: string;
|
|
630
630
|
name: string;
|
|
631
|
+
isEthereum: boolean;
|
|
631
632
|
}
|
|
632
633
|
export interface RequestAccountCreateHardwareMultiple {
|
|
633
634
|
accounts: CreateHardwareAccountItem[];
|
|
@@ -979,11 +980,14 @@ export interface ResponseParseEvmContractInput {
|
|
|
979
980
|
}
|
|
980
981
|
export interface LedgerNetwork {
|
|
981
982
|
genesisHash: string;
|
|
982
|
-
|
|
983
|
+
networkName: string;
|
|
984
|
+
accountName: string;
|
|
985
|
+
appName: string;
|
|
983
986
|
network: string;
|
|
984
987
|
slug: string;
|
|
985
988
|
icon: 'substrate' | 'ethereum';
|
|
986
989
|
isDevMode: boolean;
|
|
990
|
+
isEthereum: boolean;
|
|
987
991
|
}
|
|
988
992
|
export interface TransakNetwork {
|
|
989
993
|
networks: string[];
|
package/background/types.d.ts
CHANGED
|
@@ -27,7 +27,6 @@ export interface AbstractAddressJson extends KeyringPair$Meta {
|
|
|
27
27
|
type?: KeypairType;
|
|
28
28
|
whenCreated?: number;
|
|
29
29
|
name?: string;
|
|
30
|
-
originGenesisHash?: string | null;
|
|
31
30
|
}
|
|
32
31
|
export interface AccountJson extends AbstractAddressJson {
|
|
33
32
|
accountIndex?: number;
|
|
@@ -41,6 +40,8 @@ export interface AccountJson extends AbstractAddressJson {
|
|
|
41
40
|
isReadOnly?: boolean;
|
|
42
41
|
parentAddress?: string;
|
|
43
42
|
suri?: string;
|
|
43
|
+
originGenesisHash?: string | null;
|
|
44
|
+
availableGenesisHashes?: string[];
|
|
44
45
|
}
|
|
45
46
|
export interface AddressJson extends AbstractAddressJson {
|
|
46
47
|
isRecent?: boolean;
|
|
@@ -75,9 +75,11 @@ async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMap, chai
|
|
|
75
75
|
} else if (_constants._TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxTokensSupported) {
|
|
76
76
|
result.supportTransfer = true;
|
|
77
77
|
result.supportTransferAll = true;
|
|
78
|
-
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
|
|
79
|
+
// && !_isNativeToken(tokenInfo) && isTxEqBalancesSupported
|
|
80
|
+
) {
|
|
81
|
+
result.supportTransfer = false;
|
|
82
|
+
result.supportTransferAll = false;
|
|
81
83
|
} else if (_constants._TRANSFER_CHAIN_GROUP.crab.includes(networkKey) && _constants._BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol)) {
|
|
82
84
|
result.supportTransfer = true;
|
|
83
85
|
result.supportTransferAll = true;
|
|
@@ -96,8 +98,10 @@ async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMap, chai
|
|
|
96
98
|
// } else if (_TRANSFER_CHAIN_GROUP.riochain.includes(networkKey) && _isNativeToken(tokenInfo)) {
|
|
97
99
|
// result.supportTransfer = true;
|
|
98
100
|
// result.supportTransferAll = true;
|
|
101
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.avail.includes(networkKey)) {
|
|
102
|
+
result.supportTransfer = false;
|
|
103
|
+
result.supportTransferAll = false;
|
|
99
104
|
}
|
|
100
|
-
|
|
101
105
|
return result;
|
|
102
106
|
}
|
|
103
107
|
const createTransferExtrinsic = async _ref => {
|
|
@@ -117,7 +121,7 @@ const createTransferExtrinsic = async _ref => {
|
|
|
117
121
|
const isTxCurrenciesSupported = !!api && !!api.tx && !!api.tx.currencies;
|
|
118
122
|
const isTxBalancesSupported = !!api && !!api.tx && !!api.tx.balances;
|
|
119
123
|
const isTxTokensSupported = !!api && !!api.tx && !!api.tx.tokens;
|
|
120
|
-
const isTxEqBalancesSupported = !!api && !!api.tx && !!api.tx.eqBalances;
|
|
124
|
+
// const isTxEqBalancesSupported = !!api && !!api.tx && !!api.tx.eqBalances;
|
|
121
125
|
const isTxAssetsSupported = !!api && !!api.tx && !!api.tx.assets;
|
|
122
126
|
let transferAmount; // for PSP-22 tokens, might be deprecated in the future
|
|
123
127
|
|
|
@@ -139,8 +143,11 @@ const createTransferExtrinsic = async _ref => {
|
|
|
139
143
|
} else if (value) {
|
|
140
144
|
transfer = api.tx.tokens.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo) || (0, _utils2._getTokenOnChainAssetId)(tokenInfo), new _util.BN(value));
|
|
141
145
|
}
|
|
142
|
-
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
|
|
143
|
-
|
|
146
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
|
|
147
|
+
// && isTxEqBalancesSupported
|
|
148
|
+
) {
|
|
149
|
+
// transfer = api.tx.eqBalances.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
|
|
150
|
+
/* empty */
|
|
144
151
|
} else if (!(0, _utils2._isNativeToken)(tokenInfo) && (_constants._TRANSFER_CHAIN_GROUP.crab.includes(networkKey) || _constants._BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol))) {
|
|
145
152
|
if (transferAll) {
|
|
146
153
|
transfer = api.tx.kton.transferAll(to, false);
|
|
@@ -157,6 +164,8 @@ const createTransferExtrinsic = async _ref => {
|
|
|
157
164
|
// }
|
|
158
165
|
} else if (_constants._TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
|
|
159
166
|
transfer = api.tx.assets.transfer((0, _utils2._getTokenOnChainAssetId)(tokenInfo), to, value);
|
|
167
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.avail.includes(networkKey)) {
|
|
168
|
+
/* empty */
|
|
160
169
|
} else if (isTxBalancesSupported && (0, _utils2._isNativeToken)(tokenInfo)) {
|
|
161
170
|
if (transferAll) {
|
|
162
171
|
transfer = api.tx.balances.transferAll(to, false);
|
|
@@ -165,10 +165,11 @@ async function subscribeParaChainNominatorMetadata(chainInfo, address, substrate
|
|
|
165
165
|
const roundInfo = _roundInfo.toPrimitive();
|
|
166
166
|
const currentRound = roundInfo.current;
|
|
167
167
|
await Promise.all(delegatorState.delegations.map(async delegation => {
|
|
168
|
-
|
|
168
|
+
var _substrateApi$api$que;
|
|
169
|
+
const [_delegationScheduledRequests, _identity, _collatorInfo] = await Promise.all([substrateApi.api.query.parachainStaking.delegationScheduledRequests(delegation.owner), (_substrateApi$api$que = substrateApi.api.query.identity) === null || _substrateApi$api$que === void 0 ? void 0 : _substrateApi$api$que.identityOf(delegation.owner), substrateApi.api.query.parachainStaking.candidateInfo(delegation.owner)]);
|
|
169
170
|
const collatorInfo = _collatorInfo.toPrimitive();
|
|
170
171
|
const minDelegation = collatorInfo === null || collatorInfo === void 0 ? void 0 : collatorInfo.lowestTopDelegationAmount.toString();
|
|
171
|
-
const identityInfo = _identity.toHuman();
|
|
172
|
+
const identityInfo = _identity === null || _identity === void 0 ? void 0 : _identity.toHuman();
|
|
172
173
|
const delegationScheduledRequests = _delegationScheduledRequests.toPrimitive();
|
|
173
174
|
const identity = (0, _utils.parseIdentity)(identityInfo);
|
|
174
175
|
let hasUnstaking = false;
|
|
@@ -195,10 +195,11 @@ async function subscribeRelayChainNominatorMetadata(chainInfo, address, substrat
|
|
|
195
195
|
if (nominations) {
|
|
196
196
|
const validatorList = nominations.targets;
|
|
197
197
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
198
|
+
var _chainApi$api$query$i;
|
|
198
199
|
let nominationStatus = _KoniTypes.StakingStatus.NOT_EARNING;
|
|
199
|
-
const [_identityInfo, _eraStaker] = await Promise.all([chainApi.api.query.identity.identityOf(validatorAddress), chainApi.api.query.staking.erasStakers(currentEra, validatorAddress)]);
|
|
200
|
+
const [_identityInfo, _eraStaker] = await Promise.all([(_chainApi$api$query$i = chainApi.api.query.identity) === null || _chainApi$api$query$i === void 0 ? void 0 : _chainApi$api$query$i.identityOf(validatorAddress), chainApi.api.query.staking.erasStakers(currentEra, validatorAddress)]);
|
|
200
201
|
const eraStaker = _eraStaker.toPrimitive();
|
|
201
|
-
const identityInfo = _identityInfo.toHuman();
|
|
202
|
+
const identityInfo = _identityInfo === null || _identityInfo === void 0 ? void 0 : _identityInfo.toHuman();
|
|
202
203
|
const identity = (0, _utils.parseIdentity)(identityInfo);
|
|
203
204
|
const topNominators = eraStaker.others.map(nominator => {
|
|
204
205
|
return nominator.who;
|
|
@@ -54,7 +54,7 @@ function transformPoolName(input) {
|
|
|
54
54
|
}
|
|
55
55
|
function parseIdentity(identityInfo) {
|
|
56
56
|
let identity;
|
|
57
|
-
if (identityInfo
|
|
57
|
+
if (identityInfo) {
|
|
58
58
|
var _identityInfo$info, _identityInfo$info$di, _identityInfo$info2, _identityInfo$info2$w, _identityInfo$info3, _identityInfo$info3$r, _identityInfo$info4, _identityInfo$info4$t;
|
|
59
59
|
const displayName = identityInfo === null || identityInfo === void 0 ? void 0 : (_identityInfo$info = identityInfo.info) === null || _identityInfo$info === void 0 ? void 0 : (_identityInfo$info$di = _identityInfo$info.display) === null || _identityInfo$info$di === void 0 ? void 0 : _identityInfo$info$di.Raw;
|
|
60
60
|
const web = identityInfo === null || identityInfo === void 0 ? void 0 : (_identityInfo$info2 = identityInfo.info) === null || _identityInfo$info2 === void 0 ? void 0 : (_identityInfo$info2$w = _identityInfo$info2.web) === null || _identityInfo$info2$w === void 0 ? void 0 : _identityInfo$info2$w.Raw;
|
|
@@ -11,15 +11,16 @@ var _utils2 = require("@subwallet/extension-base/services/chain-service/utils");
|
|
|
11
11
|
|
|
12
12
|
function getExtrinsicByPolkadotXcmPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
13
13
|
const weightParam = (0, _utils.getDestWeight)();
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
14
|
+
const version = ['statemint', 'statemine', 'shiden'].includes(originChainInfo.slug) ? 'V3' : 'V1';
|
|
15
|
+
const beneficiary = (0, _utils.getBeneficiary)(destinationChainInfo, recipientAddress, version);
|
|
16
|
+
const destination = (0, _utils.getDestinationChainLocation)(originChainInfo, destinationChainInfo, version);
|
|
17
|
+
let assetLocation = (0, _utils.getTokenLocation)(tokenInfo, value, version);
|
|
17
18
|
let method = 'limitedReserveTransferAssets';
|
|
18
19
|
if (['astar', 'shiden'].includes(originChainInfo.slug) && !(0, _utils2._isNativeToken)(tokenInfo)) {
|
|
19
20
|
method = 'limitedReserveWithdrawAssets';
|
|
20
21
|
} else if (['statemint', 'statemine'].includes(originChainInfo.slug) && (0, _utils2._isSubstrateRelayChain)(destinationChainInfo)) {
|
|
21
22
|
assetLocation = {
|
|
22
|
-
|
|
23
|
+
[version]: [{
|
|
23
24
|
id: {
|
|
24
25
|
Concrete: {
|
|
25
26
|
parents: 1,
|
|
@@ -25,6 +25,6 @@ function getCurrencyId(tokenInfo) {
|
|
|
25
25
|
}
|
|
26
26
|
function getExtrinsicByXtokensPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
27
27
|
const weightParam = ['pioneer', 'hydradx_main'].includes(originChainInfo.slug) ? _utils.FOUR_INSTRUCTIONS_WEIGHT : (0, _utils.getDestWeight)();
|
|
28
|
-
const destVersion = ['moonbeam', 'moonriver'].includes(originChainInfo.slug) ? 'V3' : undefined;
|
|
28
|
+
const destVersion = ['moonbeam', 'moonriver', 'bifrost_dot'].includes(originChainInfo.slug) ? 'V3' : undefined;
|
|
29
29
|
return api.tx.xTokens.transfer(getCurrencyId(tokenInfo), value, (0, _utils.getDestMultilocation)(destinationChainInfo, recipientAddress, destVersion), weightParam);
|
|
30
30
|
}
|
|
@@ -11,7 +11,7 @@ var _utils = require("@subwallet/extension-base/koni/api/xcm/utils");
|
|
|
11
11
|
// this pallet is only used by Relaychains
|
|
12
12
|
function getExtrinsicByXcmPalletPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
|
|
13
13
|
const weightParam = (0, _utils.getDestWeight)();
|
|
14
|
-
const xcmVer =
|
|
14
|
+
const xcmVer = 'V3';
|
|
15
15
|
const destination = (0, _utils.getDestinationChainLocation)(originChainInfo, destinationChainInfo, xcmVer);
|
|
16
16
|
const beneficiary = (0, _utils.getBeneficiary)(destinationChainInfo, recipientAddress, xcmVer);
|
|
17
17
|
const tokenLocation = (0, _utils.getTokenLocation)(tokenInfo, value, xcmVer);
|
|
@@ -1391,14 +1391,18 @@ class KoniExtension {
|
|
|
1391
1391
|
});
|
|
1392
1392
|
return historySubject.getValue();
|
|
1393
1393
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1394
|
+
|
|
1395
|
+
// Save address to contact
|
|
1396
|
+
// private addContact (to: string) {
|
|
1397
|
+
// const toAddress = reformatAddress(to);
|
|
1398
|
+
// const account = keyring.getAccount(toAddress);
|
|
1399
|
+
// const contact = keyring.getAddress(toAddress);
|
|
1400
|
+
//
|
|
1401
|
+
// if (!account && (!contact || contact.meta.isRecent)) {
|
|
1402
|
+
// keyring.saveAddress(toAddress, {});
|
|
1403
|
+
// }
|
|
1404
|
+
// }
|
|
1405
|
+
|
|
1402
1406
|
validateTransfer(tokenSlug, from, to, value, transferAll) {
|
|
1403
1407
|
const errors = [];
|
|
1404
1408
|
const keypair = _uiKeyring.keyring.getPair(from);
|
|
@@ -1481,7 +1485,9 @@ class KoniExtension {
|
|
|
1481
1485
|
throw error;
|
|
1482
1486
|
}
|
|
1483
1487
|
const transferNativeAmount = isTransferNativeToken ? transferAmount.value : '0';
|
|
1484
|
-
|
|
1488
|
+
|
|
1489
|
+
// this.addContact(to);
|
|
1490
|
+
|
|
1485
1491
|
const additionalValidator = async inputTransaction => {
|
|
1486
1492
|
const minAmount = tokenInfo.minAmount || '0';
|
|
1487
1493
|
if (!isTransferNativeToken) {
|
|
@@ -1590,7 +1596,9 @@ class KoniExtension {
|
|
|
1590
1596
|
});
|
|
1591
1597
|
};
|
|
1592
1598
|
}
|
|
1593
|
-
|
|
1599
|
+
|
|
1600
|
+
// this.addContact(to);
|
|
1601
|
+
|
|
1594
1602
|
return await this.#koniState.transactionService.handleTransaction({
|
|
1595
1603
|
url: _constants2.EXTENSION_REQUEST_URL,
|
|
1596
1604
|
address: from,
|
|
@@ -1617,7 +1625,9 @@ class KoniExtension {
|
|
|
1617
1625
|
const contractAddress = params.contractAddress;
|
|
1618
1626
|
const tokenId = params.tokenId;
|
|
1619
1627
|
const transaction = await (0, _transfer3.getERC721Transaction)(this.#koniState.getEvmApi(networkKey), contractAddress, senderAddress, recipientAddress, tokenId);
|
|
1620
|
-
|
|
1628
|
+
|
|
1629
|
+
// this.addContact(recipientAddress);
|
|
1630
|
+
|
|
1621
1631
|
return await this.#koniState.transactionService.handleTransaction({
|
|
1622
1632
|
address: senderAddress,
|
|
1623
1633
|
chain: networkKey,
|
|
@@ -1740,7 +1750,7 @@ class KoniExtension {
|
|
|
1740
1750
|
}
|
|
1741
1751
|
} else {
|
|
1742
1752
|
const chainInfo = this.#koniState.chainService.getChainInfoByKey(networkKey);
|
|
1743
|
-
if ((0, _utils._isChainEvmCompatible)(chainInfo)) {
|
|
1753
|
+
if ((0, _utils._isChainEvmCompatible)(chainInfo) && (0, _utils._isTokenTransferredByEvm)(tokenInfo)) {
|
|
1744
1754
|
const web3 = this.#koniState.chainService.getEvmApi(networkKey);
|
|
1745
1755
|
const transaction = {
|
|
1746
1756
|
value: 0,
|
|
@@ -1827,7 +1837,9 @@ class KoniExtension {
|
|
|
1827
1837
|
const networkKey = params === null || params === void 0 ? void 0 : params.networkKey;
|
|
1828
1838
|
const apiProps = this.#koniState.getSubstrateApi(networkKey);
|
|
1829
1839
|
const extrinsic = !isPSP34 ? (0, _transfer2.getNftTransferExtrinsic)(networkKey, apiProps, senderAddress, recipientAddress, params || {}) : await (0, _wasm.getPSP34TransferExtrinsic)(networkKey, apiProps, senderAddress, recipientAddress, params || {});
|
|
1830
|
-
|
|
1840
|
+
|
|
1841
|
+
// this.addContact(recipientAddress);
|
|
1842
|
+
|
|
1831
1843
|
const rs = await this.#koniState.transactionService.handleTransaction({
|
|
1832
1844
|
address: senderAddress,
|
|
1833
1845
|
chain: networkKey,
|
|
@@ -1983,6 +1995,7 @@ class KoniExtension {
|
|
|
1983
1995
|
if (!accounts.length) {
|
|
1984
1996
|
throw new Error('No accounts to import');
|
|
1985
1997
|
}
|
|
1998
|
+
const slugMap = {};
|
|
1986
1999
|
for (const account of accounts) {
|
|
1987
2000
|
const {
|
|
1988
2001
|
accountIndex,
|
|
@@ -1990,16 +2003,36 @@ class KoniExtension {
|
|
|
1990
2003
|
addressOffset,
|
|
1991
2004
|
genesisHash,
|
|
1992
2005
|
hardwareType,
|
|
2006
|
+
isEthereum,
|
|
1993
2007
|
name
|
|
1994
2008
|
} = account;
|
|
1995
|
-
|
|
2009
|
+
let result;
|
|
2010
|
+
const baseMeta = {
|
|
2011
|
+
name,
|
|
2012
|
+
hardwareType,
|
|
1996
2013
|
accountIndex,
|
|
1997
2014
|
addressOffset,
|
|
1998
2015
|
genesisHash,
|
|
1999
|
-
name,
|
|
2000
2016
|
originGenesisHash: genesisHash
|
|
2001
|
-
}
|
|
2002
|
-
|
|
2017
|
+
};
|
|
2018
|
+
if (isEthereum) {
|
|
2019
|
+
result = _uiKeyring.keyring.keyring.addFromAddress(address, {
|
|
2020
|
+
...baseMeta,
|
|
2021
|
+
isExternal: true,
|
|
2022
|
+
isHardware: true
|
|
2023
|
+
}, null, 'ethereum');
|
|
2024
|
+
_uiKeyring.keyring.saveAccount(result);
|
|
2025
|
+
slugMap.ethereum = 'ethereum';
|
|
2026
|
+
} else {
|
|
2027
|
+
result = _uiKeyring.keyring.addHardware(address, hardwareType, {
|
|
2028
|
+
...baseMeta,
|
|
2029
|
+
availableGenesisHashes: [genesisHash]
|
|
2030
|
+
}).pair;
|
|
2031
|
+
const [slug] = this.#koniState.findNetworkKeyByGenesisHash(genesisHash);
|
|
2032
|
+
if (slug) {
|
|
2033
|
+
slugMap[slug] = slug;
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2003
2036
|
const _address = result.address;
|
|
2004
2037
|
addresses.push(_address);
|
|
2005
2038
|
await new Promise(resolve => {
|
|
@@ -2027,6 +2060,12 @@ class KoniExtension {
|
|
|
2027
2060
|
resolve();
|
|
2028
2061
|
});
|
|
2029
2062
|
});
|
|
2063
|
+
if (Object.keys(slugMap).length) {
|
|
2064
|
+
this.enableChains({
|
|
2065
|
+
chainSlugs: Object.keys(slugMap),
|
|
2066
|
+
enableTokens: true
|
|
2067
|
+
}).catch(console.error);
|
|
2068
|
+
}
|
|
2030
2069
|
return true;
|
|
2031
2070
|
}
|
|
2032
2071
|
async accountsCreateWithSecret(_ref53) {
|
|
@@ -2253,7 +2292,7 @@ class KoniExtension {
|
|
|
2253
2292
|
}
|
|
2254
2293
|
const txObject = {
|
|
2255
2294
|
gasPrice: new _bignumber.default(tx.gasPrice).toNumber(),
|
|
2256
|
-
to: tx.
|
|
2295
|
+
to: tx.to,
|
|
2257
2296
|
value: new _bignumber.default(tx.value).toNumber(),
|
|
2258
2297
|
data: tx.data,
|
|
2259
2298
|
nonce: new _bignumber.default(tx.nonce).toNumber(),
|
|
@@ -1151,12 +1151,12 @@ class KoniState {
|
|
|
1151
1151
|
address: pair.address,
|
|
1152
1152
|
...pair.meta
|
|
1153
1153
|
};
|
|
1154
|
-
let
|
|
1154
|
+
let hashPayload = '';
|
|
1155
1155
|
let canSign = false;
|
|
1156
1156
|
switch (method) {
|
|
1157
1157
|
case 'personal_sign':
|
|
1158
1158
|
canSign = true;
|
|
1159
|
-
|
|
1159
|
+
hashPayload = payload;
|
|
1160
1160
|
break;
|
|
1161
1161
|
case 'eth_sign':
|
|
1162
1162
|
case 'eth_signTypedData':
|
|
@@ -1174,7 +1174,7 @@ class KoniState {
|
|
|
1174
1174
|
account: account,
|
|
1175
1175
|
type: method,
|
|
1176
1176
|
payload: payload,
|
|
1177
|
-
hashPayload:
|
|
1177
|
+
hashPayload: hashPayload,
|
|
1178
1178
|
canSign: canSign,
|
|
1179
1179
|
id
|
|
1180
1180
|
};
|
package/cjs/packageInfo.js
CHANGED
|
@@ -198,7 +198,8 @@ const _TRANSFER_CHAIN_GROUP = {
|
|
|
198
198
|
bitcountry: ['pioneer', 'bitcountry', 'bifrost', 'bifrost_dot'],
|
|
199
199
|
statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel'],
|
|
200
200
|
riochain: ['riochain'],
|
|
201
|
-
sora_substrate: ['sora_substrate']
|
|
201
|
+
sora_substrate: ['sora_substrate'],
|
|
202
|
+
avail: ['kate']
|
|
202
203
|
};
|
|
203
204
|
exports._TRANSFER_CHAIN_GROUP = _TRANSFER_CHAIN_GROUP;
|
|
204
205
|
const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
// import type {H256} from '@polkadot/types/interfaces';
|
|
10
|
+
// eslint-disable-next-line header/header
|
|
11
|
+
|
|
12
|
+
// structs need to be in order
|
|
13
|
+
/* eslint-disable sort-keys */
|
|
14
|
+
|
|
15
|
+
const definitions = {
|
|
16
|
+
rpc: {
|
|
17
|
+
kate: {
|
|
18
|
+
blockLength: {
|
|
19
|
+
description: 'Get Block Length',
|
|
20
|
+
params: [{
|
|
21
|
+
name: 'at',
|
|
22
|
+
type: 'Hash',
|
|
23
|
+
isOptional: true
|
|
24
|
+
}],
|
|
25
|
+
type: 'BlockLength'
|
|
26
|
+
},
|
|
27
|
+
queryProof: {
|
|
28
|
+
description: 'Generate the kate proof for the given `cells`',
|
|
29
|
+
params: [{
|
|
30
|
+
name: 'cells',
|
|
31
|
+
type: 'Vec<Cell>'
|
|
32
|
+
}, {
|
|
33
|
+
name: 'at',
|
|
34
|
+
type: 'Hash',
|
|
35
|
+
isOptional: true
|
|
36
|
+
}],
|
|
37
|
+
type: 'Vec<u8>'
|
|
38
|
+
},
|
|
39
|
+
queryAppData: {
|
|
40
|
+
description: 'Fetches app data rows for the given app',
|
|
41
|
+
params: [{
|
|
42
|
+
name: 'app_id',
|
|
43
|
+
type: 'AppId'
|
|
44
|
+
}, {
|
|
45
|
+
name: 'at',
|
|
46
|
+
type: 'Hash',
|
|
47
|
+
isOptional: true
|
|
48
|
+
}],
|
|
49
|
+
type: 'Vec<Option<Vec<u8>>>'
|
|
50
|
+
},
|
|
51
|
+
queryDataProof: {
|
|
52
|
+
description: 'Generate the data proof for the given `index`',
|
|
53
|
+
params: [{
|
|
54
|
+
name: 'data_index',
|
|
55
|
+
type: 'u32'
|
|
56
|
+
}, {
|
|
57
|
+
name: 'at',
|
|
58
|
+
type: 'Hash',
|
|
59
|
+
isOptional: true
|
|
60
|
+
}],
|
|
61
|
+
type: 'DataProof'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
types: [{
|
|
66
|
+
// on all versions
|
|
67
|
+
minmax: [0, undefined],
|
|
68
|
+
types: {
|
|
69
|
+
AppId: 'Compact<u32>',
|
|
70
|
+
DataLookupIndexItem: {
|
|
71
|
+
appId: 'AppId',
|
|
72
|
+
start: 'Compact<u32>'
|
|
73
|
+
},
|
|
74
|
+
DataLookup: {
|
|
75
|
+
size: 'Compact<u32>',
|
|
76
|
+
index: 'Vec<DataLookupIndexItem>'
|
|
77
|
+
},
|
|
78
|
+
KateCommitment: {
|
|
79
|
+
rows: 'Compact<u16>',
|
|
80
|
+
cols: 'Compact<u16>',
|
|
81
|
+
dataRoot: 'H256',
|
|
82
|
+
commitment: 'Vec<u8>'
|
|
83
|
+
},
|
|
84
|
+
V1HeaderExtension: {
|
|
85
|
+
commitment: 'KateCommitment',
|
|
86
|
+
appLookup: 'DataLookup'
|
|
87
|
+
},
|
|
88
|
+
VTHeaderExtension: {
|
|
89
|
+
newField: 'Vec<u8>',
|
|
90
|
+
commitment: 'KateCommitment',
|
|
91
|
+
appLookup: 'DataLookup'
|
|
92
|
+
},
|
|
93
|
+
HeaderExtension: {
|
|
94
|
+
_enum: {
|
|
95
|
+
V1: 'V1HeaderExtension',
|
|
96
|
+
VTest: 'VTHeaderExtension'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
DaHeader: {
|
|
100
|
+
parentHash: 'Hash',
|
|
101
|
+
number: 'Compact<BlockNumber>',
|
|
102
|
+
stateRoot: 'Hash',
|
|
103
|
+
extrinsicsRoot: 'Hash',
|
|
104
|
+
digest: 'Digest',
|
|
105
|
+
extension: 'HeaderExtension'
|
|
106
|
+
},
|
|
107
|
+
Header: 'DaHeader',
|
|
108
|
+
CheckAppIdExtra: {
|
|
109
|
+
appId: 'AppId'
|
|
110
|
+
},
|
|
111
|
+
CheckAppIdTypes: {},
|
|
112
|
+
CheckAppId: {
|
|
113
|
+
extra: 'CheckAppIdExtra',
|
|
114
|
+
types: 'CheckAppIdTypes'
|
|
115
|
+
},
|
|
116
|
+
BlockLengthColumns: 'Compact<u32>',
|
|
117
|
+
BlockLengthRows: 'Compact<u32>',
|
|
118
|
+
BlockLength: {
|
|
119
|
+
max: 'PerDispatchClass',
|
|
120
|
+
cols: 'BlockLengthColumns',
|
|
121
|
+
rows: 'BlockLengthRows',
|
|
122
|
+
chunkSize: 'Compact<u32>'
|
|
123
|
+
},
|
|
124
|
+
PerDispatchClass: {
|
|
125
|
+
normal: 'u32',
|
|
126
|
+
operational: 'u32',
|
|
127
|
+
mandatory: 'u32'
|
|
128
|
+
},
|
|
129
|
+
DataProof: {
|
|
130
|
+
root: 'H256',
|
|
131
|
+
proof: 'Vec<H256>',
|
|
132
|
+
numberOfLeaves: 'Compact<u32>',
|
|
133
|
+
leaf_index: 'Compact<u32>',
|
|
134
|
+
leaf: 'H256'
|
|
135
|
+
},
|
|
136
|
+
Cell: {
|
|
137
|
+
row: 'BlockLengthRows',
|
|
138
|
+
col: 'BlockLengthColumns'
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}],
|
|
142
|
+
signedExtensions: {
|
|
143
|
+
CheckAppId: {
|
|
144
|
+
extrinsic: {
|
|
145
|
+
appId: 'AppId'
|
|
146
|
+
},
|
|
147
|
+
payload: {}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
var _default = definitions;
|
|
152
|
+
exports.default = _default;
|
|
@@ -34,6 +34,7 @@ var _crownSterling = _interopRequireDefault(require("./crown-sterling"));
|
|
|
34
34
|
var _crust = _interopRequireDefault(require("./crust"));
|
|
35
35
|
var _cumulusTestParachain = _interopRequireDefault(require("./cumulus-test-parachain"));
|
|
36
36
|
var _darwinia = _interopRequireDefault(require("./darwinia"));
|
|
37
|
+
var _dataavail = _interopRequireDefault(require("./dataavail"));
|
|
37
38
|
var _datahighway = _interopRequireDefault(require("./datahighway"));
|
|
38
39
|
var _dockMainnet = _interopRequireDefault(require("./dock-mainnet"));
|
|
39
40
|
var _dockTestnet = _interopRequireDefault(require("./dock-testnet"));
|
|
@@ -169,6 +170,7 @@ const spec = {
|
|
|
169
170
|
'crust-parachain': _crust.default,
|
|
170
171
|
'cumulus-subsocial-parachain': _subsocial.default,
|
|
171
172
|
'cumulus-test-parachain': _cumulusTestParachain.default,
|
|
173
|
+
'data-avail': _dataavail.default,
|
|
172
174
|
datahighway: _westlake.default,
|
|
173
175
|
'datahighway-parachain': _datahighway.default,
|
|
174
176
|
dawn: _eave.default,
|
|
@@ -558,7 +558,7 @@ class ChainService {
|
|
|
558
558
|
mergedChainInfoMap[storedSlug].providers = {
|
|
559
559
|
...storedChainInfo.providers,
|
|
560
560
|
...mergedChainInfoMap[storedSlug].providers
|
|
561
|
-
};
|
|
561
|
+
}; // TODO: review merging providers
|
|
562
562
|
this.dataMap.chainStateMap[storedSlug] = {
|
|
563
563
|
currentProvider: storedChainInfo.currentProvider,
|
|
564
564
|
slug: storedSlug,
|
|
@@ -0,0 +1,42 @@
|
|
|
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 _Base = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/Base"));
|
|
9
|
+
var _stores = require("@subwallet/extension-base/stores");
|
|
10
|
+
var _util = require("@polkadot/util");
|
|
11
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
12
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
13
|
+
|
|
14
|
+
class MigrateLedgerAccount extends _Base.default {
|
|
15
|
+
async run() {
|
|
16
|
+
try {
|
|
17
|
+
return new Promise(resolve => {
|
|
18
|
+
const store = new _stores.AccountsStore();
|
|
19
|
+
const update = (key, value) => {
|
|
20
|
+
var _value$meta;
|
|
21
|
+
if (key.startsWith('account:') && value.meta && (0, _util.isString)((_value$meta = value.meta) === null || _value$meta === void 0 ? void 0 : _value$meta.originGenesisHash)) {
|
|
22
|
+
const newValue = {
|
|
23
|
+
...value
|
|
24
|
+
};
|
|
25
|
+
newValue.meta.availableGenesisHashes = [value.meta.originGenesisHash];
|
|
26
|
+
store.set(key, newValue);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
store.allMap(map => {
|
|
30
|
+
Object.entries(map).forEach(_ref => {
|
|
31
|
+
let [key, value] = _ref;
|
|
32
|
+
update(key, value);
|
|
33
|
+
});
|
|
34
|
+
resolve();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
} catch (e) {
|
|
38
|
+
console.error(e);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.default = MigrateLedgerAccount;
|
|
@@ -10,6 +10,7 @@ var _MigrateAuthUrls = _interopRequireDefault(require("@subwallet/extension-base
|
|
|
10
10
|
var _MigrateAutoLock = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateAutoLock"));
|
|
11
11
|
var _MigrateChainPatrol = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateChainPatrol"));
|
|
12
12
|
var _MigrateImportedToken = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateImportedToken"));
|
|
13
|
+
var _MigrateLedgerAccount = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateLedgerAccount"));
|
|
13
14
|
var _MigrateNetworkSettings = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateNetworkSettings"));
|
|
14
15
|
var _MigrateSettings = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateSettings"));
|
|
15
16
|
var _MigrateTransactionHistory = _interopRequireDefault(require("@subwallet/extension-base/services/migration-service/scripts/MigrateTransactionHistory"));
|
|
@@ -26,7 +27,8 @@ var _default = {
|
|
|
26
27
|
'1.0.1-50': _MigrateSettings.default,
|
|
27
28
|
'1.0.1-60': _MigrateAuthUrls.default,
|
|
28
29
|
'1.0.3-01': _MigrateAutoLock.default,
|
|
29
|
-
'1.0.3-02': _MigrateChainPatrol.default
|
|
30
|
+
'1.0.3-02': _MigrateChainPatrol.default,
|
|
31
|
+
'1.0.9-01': _MigrateLedgerAccount.default
|
|
30
32
|
// [`${EVERYTIME}-1`]: AutoEnableChainsTokens
|
|
31
33
|
};
|
|
32
34
|
exports.default = _default;
|