@subwallet/extension-base 1.0.9-2 → 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.
@@ -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) && !(0, _utils2._isNativeToken)(tokenInfo) && isTxEqBalancesSupported) {
79
- result.supportTransfer = true;
80
- result.supportTransferAll = true;
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) && isTxEqBalancesSupported) {
143
- transfer = api.tx.eqBalances.transfer((0, _utils2._getTokenOnChainAssetId)(tokenInfo), to, value);
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
- const [_delegationScheduledRequests, _identity, _collatorInfo] = await Promise.all([substrateApi.api.query.parachainStaking.delegationScheduledRequests(delegation.owner), substrateApi.api.query.identity.identityOf(delegation.owner), substrateApi.api.query.parachainStaking.candidateInfo(delegation.owner)]);
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 !== null) {
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 beneficiary = (0, _utils.getBeneficiary)(destinationChainInfo, recipientAddress);
15
- const destination = (0, _utils.getDestinationChainLocation)(originChainInfo, destinationChainInfo);
16
- let assetLocation = (0, _utils.getTokenLocation)(tokenInfo, value);
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
- V1: [{
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 = ['kusama'].includes(originChainInfo.slug) ? 'V3' : 'V1';
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
- addContact(to) {
1395
- const toAddress = (0, _utils2.reformatAddress)(to);
1396
- const account = _uiKeyring.keyring.getAccount(toAddress);
1397
- const contact = _uiKeyring.keyring.getAddress(toAddress);
1398
- if (!account && (!contact || contact.meta.isRecent)) {
1399
- _uiKeyring.keyring.saveAddress(toAddress, {});
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
- this.addContact(to);
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
- this.addContact(to);
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
- this.addContact(recipientAddress);
1628
+
1629
+ // this.addContact(recipientAddress);
1630
+
1621
1631
  return await this.#koniState.transactionService.handleTransaction({
1622
1632
  address: senderAddress,
1623
1633
  chain: networkKey,
@@ -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
- this.addContact(recipientAddress);
1840
+
1841
+ // this.addContact(recipientAddress);
1842
+
1831
1843
  const rs = await this.#koniState.transactionService.handleTransaction({
1832
1844
  address: senderAddress,
1833
1845
  chain: networkKey,
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-base',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.0.9-2'
16
+ version: '1.0.10-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
@@ -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,
@@ -67,9 +67,11 @@ export async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMa
67
67
  } else if (_TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && !_isNativeToken(tokenInfo) && isTxTokensSupported) {
68
68
  result.supportTransfer = true;
69
69
  result.supportTransferAll = true;
70
- } else if (_TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey) && !_isNativeToken(tokenInfo) && isTxEqBalancesSupported) {
71
- result.supportTransfer = true;
72
- result.supportTransferAll = true;
70
+ } else if (_TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
71
+ // && !_isNativeToken(tokenInfo) && isTxEqBalancesSupported
72
+ ) {
73
+ result.supportTransfer = false;
74
+ result.supportTransferAll = false;
73
75
  } else if (_TRANSFER_CHAIN_GROUP.crab.includes(networkKey) && _BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol)) {
74
76
  result.supportTransfer = true;
75
77
  result.supportTransferAll = true;
@@ -88,8 +90,10 @@ export async function checkSupportTransfer(networkKey, tokenInfo, substrateApiMa
88
90
  // } else if (_TRANSFER_CHAIN_GROUP.riochain.includes(networkKey) && _isNativeToken(tokenInfo)) {
89
91
  // result.supportTransfer = true;
90
92
  // result.supportTransferAll = true;
93
+ } else if (_TRANSFER_CHAIN_GROUP.avail.includes(networkKey)) {
94
+ result.supportTransfer = false;
95
+ result.supportTransferAll = false;
91
96
  }
92
-
93
97
  return result;
94
98
  }
95
99
  export const createTransferExtrinsic = async ({
@@ -108,7 +112,7 @@ export const createTransferExtrinsic = async ({
108
112
  const isTxCurrenciesSupported = !!api && !!api.tx && !!api.tx.currencies;
109
113
  const isTxBalancesSupported = !!api && !!api.tx && !!api.tx.balances;
110
114
  const isTxTokensSupported = !!api && !!api.tx && !!api.tx.tokens;
111
- const isTxEqBalancesSupported = !!api && !!api.tx && !!api.tx.eqBalances;
115
+ // const isTxEqBalancesSupported = !!api && !!api.tx && !!api.tx.eqBalances;
112
116
  const isTxAssetsSupported = !!api && !!api.tx && !!api.tx.assets;
113
117
  let transferAmount; // for PSP-22 tokens, might be deprecated in the future
114
118
 
@@ -130,8 +134,11 @@ export const createTransferExtrinsic = async ({
130
134
  } else if (value) {
131
135
  transfer = api.tx.tokens.transfer(to, _getTokenOnChainInfo(tokenInfo) || _getTokenOnChainAssetId(tokenInfo), new BN(value));
132
136
  }
133
- } else if (_TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey) && isTxEqBalancesSupported) {
134
- transfer = api.tx.eqBalances.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
137
+ } else if (_TRANSFER_CHAIN_GROUP.genshiro.includes(networkKey)
138
+ // && isTxEqBalancesSupported
139
+ ) {
140
+ // transfer = api.tx.eqBalances.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
141
+ /* empty */
135
142
  } else if (!_isNativeToken(tokenInfo) && (_TRANSFER_CHAIN_GROUP.crab.includes(networkKey) || _BALANCE_TOKEN_GROUP.crab.includes(tokenInfo.symbol))) {
136
143
  if (transferAll) {
137
144
  transfer = api.tx.kton.transferAll(to, false);
@@ -148,6 +155,8 @@ export const createTransferExtrinsic = async ({
148
155
  // }
149
156
  } else if (_TRANSFER_CHAIN_GROUP.sora_substrate.includes(networkKey) && isTxAssetsSupported) {
150
157
  transfer = api.tx.assets.transfer(_getTokenOnChainAssetId(tokenInfo), to, value);
158
+ } else if (_TRANSFER_CHAIN_GROUP.avail.includes(networkKey)) {
159
+ /* empty */
151
160
  } else if (isTxBalancesSupported && _isNativeToken(tokenInfo)) {
152
161
  if (transferAll) {
153
162
  transfer = api.tx.balances.transferAll(to, false);
@@ -147,10 +147,11 @@ export async function subscribeParaChainNominatorMetadata(chainInfo, address, su
147
147
  const roundInfo = _roundInfo.toPrimitive();
148
148
  const currentRound = roundInfo.current;
149
149
  await Promise.all(delegatorState.delegations.map(async delegation => {
150
- const [_delegationScheduledRequests, _identity, _collatorInfo] = await Promise.all([substrateApi.api.query.parachainStaking.delegationScheduledRequests(delegation.owner), substrateApi.api.query.identity.identityOf(delegation.owner), substrateApi.api.query.parachainStaking.candidateInfo(delegation.owner)]);
150
+ var _substrateApi$api$que;
151
+ 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)]);
151
152
  const collatorInfo = _collatorInfo.toPrimitive();
152
153
  const minDelegation = collatorInfo === null || collatorInfo === void 0 ? void 0 : collatorInfo.lowestTopDelegationAmount.toString();
153
- const identityInfo = _identity.toHuman();
154
+ const identityInfo = _identity === null || _identity === void 0 ? void 0 : _identity.toHuman();
154
155
  const delegationScheduledRequests = _delegationScheduledRequests.toPrimitive();
155
156
  const identity = parseIdentity(identityInfo);
156
157
  let hasUnstaking = false;
@@ -171,10 +171,11 @@ export async function subscribeRelayChainNominatorMetadata(chainInfo, address, s
171
171
  if (nominations) {
172
172
  const validatorList = nominations.targets;
173
173
  await Promise.all(validatorList.map(async validatorAddress => {
174
+ var _chainApi$api$query$i;
174
175
  let nominationStatus = StakingStatus.NOT_EARNING;
175
- const [_identityInfo, _eraStaker] = await Promise.all([chainApi.api.query.identity.identityOf(validatorAddress), chainApi.api.query.staking.erasStakers(currentEra, validatorAddress)]);
176
+ 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)]);
176
177
  const eraStaker = _eraStaker.toPrimitive();
177
- const identityInfo = _identityInfo.toHuman();
178
+ const identityInfo = _identityInfo === null || _identityInfo === void 0 ? void 0 : _identityInfo.toHuman();
178
179
  const identity = parseIdentity(identityInfo);
179
180
  const topNominators = eraStaker.others.map(nominator => {
180
181
  return nominator.who;
@@ -26,7 +26,7 @@ export function transformPoolName(input) {
26
26
  }
27
27
  export function parseIdentity(identityInfo) {
28
28
  let identity;
29
- if (identityInfo !== null) {
29
+ if (identityInfo) {
30
30
  var _identityInfo$info, _identityInfo$info$di, _identityInfo$info2, _identityInfo$info2$w, _identityInfo$info3, _identityInfo$info3$r, _identityInfo$info4, _identityInfo$info4$t;
31
31
  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;
32
32
  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;
@@ -5,15 +5,16 @@ import { getBeneficiary, getDestinationChainLocation, getDestWeight, getTokenLoc
5
5
  import { _isNativeToken, _isSubstrateRelayChain } from '@subwallet/extension-base/services/chain-service/utils';
6
6
  export function getExtrinsicByPolkadotXcmPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
7
7
  const weightParam = getDestWeight();
8
- const beneficiary = getBeneficiary(destinationChainInfo, recipientAddress);
9
- const destination = getDestinationChainLocation(originChainInfo, destinationChainInfo);
10
- let assetLocation = getTokenLocation(tokenInfo, value);
8
+ const version = ['statemint', 'statemine', 'shiden'].includes(originChainInfo.slug) ? 'V3' : 'V1';
9
+ const beneficiary = getBeneficiary(destinationChainInfo, recipientAddress, version);
10
+ const destination = getDestinationChainLocation(originChainInfo, destinationChainInfo, version);
11
+ let assetLocation = getTokenLocation(tokenInfo, value, version);
11
12
  let method = 'limitedReserveTransferAssets';
12
13
  if (['astar', 'shiden'].includes(originChainInfo.slug) && !_isNativeToken(tokenInfo)) {
13
14
  method = 'limitedReserveWithdrawAssets';
14
15
  } else if (['statemint', 'statemine'].includes(originChainInfo.slug) && _isSubstrateRelayChain(destinationChainInfo)) {
15
16
  assetLocation = {
16
- V1: [{
17
+ [version]: [{
17
18
  id: {
18
19
  Concrete: {
19
20
  parents: 1,
@@ -19,6 +19,6 @@ function getCurrencyId(tokenInfo) {
19
19
  }
20
20
  export function getExtrinsicByXtokensPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
21
21
  const weightParam = ['pioneer', 'hydradx_main'].includes(originChainInfo.slug) ? FOUR_INSTRUCTIONS_WEIGHT : getDestWeight();
22
- const destVersion = ['moonbeam', 'moonriver'].includes(originChainInfo.slug) ? 'V3' : undefined;
22
+ const destVersion = ['moonbeam', 'moonriver', 'bifrost_dot'].includes(originChainInfo.slug) ? 'V3' : undefined;
23
23
  return api.tx.xTokens.transfer(getCurrencyId(tokenInfo), value, getDestMultilocation(destinationChainInfo, recipientAddress, destVersion), weightParam);
24
24
  }
@@ -5,7 +5,7 @@ import { getBeneficiary, getDestinationChainLocation, getDestWeight, getTokenLoc
5
5
  // this pallet is only used by Relaychains
6
6
  export function getExtrinsicByXcmPalletPallet(tokenInfo, originChainInfo, destinationChainInfo, recipientAddress, value, api) {
7
7
  const weightParam = getDestWeight();
8
- const xcmVer = ['kusama'].includes(originChainInfo.slug) ? 'V3' : 'V1';
8
+ const xcmVer = 'V3';
9
9
  const destination = getDestinationChainLocation(originChainInfo, destinationChainInfo, xcmVer);
10
10
  const beneficiary = getBeneficiary(destinationChainInfo, recipientAddress, xcmVer);
11
11
  const tokenLocation = getTokenLocation(tokenInfo, value, xcmVer);
@@ -112,7 +112,6 @@ export default class KoniExtension {
112
112
  private getStaking;
113
113
  private subscribeStaking;
114
114
  private subscribeHistory;
115
- private addContact;
116
115
  private validateTransfer;
117
116
  private makeTransfer;
118
117
  private validateCrossChainTransfer;
@@ -1343,14 +1343,18 @@ export default class KoniExtension {
1343
1343
  });
1344
1344
  return historySubject.getValue();
1345
1345
  }
1346
- addContact(to) {
1347
- const toAddress = reformatAddress(to);
1348
- const account = keyring.getAccount(toAddress);
1349
- const contact = keyring.getAddress(toAddress);
1350
- if (!account && (!contact || contact.meta.isRecent)) {
1351
- keyring.saveAddress(toAddress, {});
1352
- }
1353
- }
1346
+
1347
+ // Save address to contact
1348
+ // private addContact (to: string) {
1349
+ // const toAddress = reformatAddress(to);
1350
+ // const account = keyring.getAccount(toAddress);
1351
+ // const contact = keyring.getAddress(toAddress);
1352
+ //
1353
+ // if (!account && (!contact || contact.meta.isRecent)) {
1354
+ // keyring.saveAddress(toAddress, {});
1355
+ // }
1356
+ // }
1357
+
1354
1358
  validateTransfer(tokenSlug, from, to, value, transferAll) {
1355
1359
  const errors = [];
1356
1360
  const keypair = keyring.getPair(from);
@@ -1433,7 +1437,9 @@ export default class KoniExtension {
1433
1437
  throw error;
1434
1438
  }
1435
1439
  const transferNativeAmount = isTransferNativeToken ? transferAmount.value : '0';
1436
- this.addContact(to);
1440
+
1441
+ // this.addContact(to);
1442
+
1437
1443
  const additionalValidator = async inputTransaction => {
1438
1444
  const minAmount = tokenInfo.minAmount || '0';
1439
1445
  if (!isTransferNativeToken) {
@@ -1542,7 +1548,9 @@ export default class KoniExtension {
1542
1548
  });
1543
1549
  };
1544
1550
  }
1545
- this.addContact(to);
1551
+
1552
+ // this.addContact(to);
1553
+
1546
1554
  return await this.#koniState.transactionService.handleTransaction({
1547
1555
  url: EXTENSION_REQUEST_URL,
1548
1556
  address: from,
@@ -1569,7 +1577,9 @@ export default class KoniExtension {
1569
1577
  const contractAddress = params.contractAddress;
1570
1578
  const tokenId = params.tokenId;
1571
1579
  const transaction = await getERC721Transaction(this.#koniState.getEvmApi(networkKey), contractAddress, senderAddress, recipientAddress, tokenId);
1572
- this.addContact(recipientAddress);
1580
+
1581
+ // this.addContact(recipientAddress);
1582
+
1573
1583
  return await this.#koniState.transactionService.handleTransaction({
1574
1584
  address: senderAddress,
1575
1585
  chain: networkKey,
@@ -1771,7 +1781,9 @@ export default class KoniExtension {
1771
1781
  const networkKey = params === null || params === void 0 ? void 0 : params.networkKey;
1772
1782
  const apiProps = this.#koniState.getSubstrateApi(networkKey);
1773
1783
  const extrinsic = !isPSP34 ? getNftTransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {}) : await getPSP34TransferExtrinsic(networkKey, apiProps, senderAddress, recipientAddress, params || {});
1774
- this.addContact(recipientAddress);
1784
+
1785
+ // this.addContact(recipientAddress);
1786
+
1775
1787
  const rs = await this.#koniState.transactionService.handleTransaction({
1776
1788
  address: senderAddress,
1777
1789
  chain: networkKey,
package/package.json CHANGED
@@ -17,7 +17,7 @@
17
17
  "./cjs/detectPackage.js"
18
18
  ],
19
19
  "type": "module",
20
- "version": "1.0.9-2",
20
+ "version": "1.0.10-0",
21
21
  "main": "./cjs/index.js",
22
22
  "module": "./index.js",
23
23
  "types": "./index.d.ts",
@@ -705,6 +705,11 @@
705
705
  "require": "./cjs/services/chain-service/helper/api-helper/spec/darwinia.js",
706
706
  "default": "./services/chain-service/helper/api-helper/spec/darwinia.js"
707
707
  },
708
+ "./services/chain-service/helper/api-helper/spec/dataavail": {
709
+ "types": "./services/chain-service/helper/api-helper/spec/dataavail.d.ts",
710
+ "require": "./cjs/services/chain-service/helper/api-helper/spec/dataavail.js",
711
+ "default": "./services/chain-service/helper/api-helper/spec/dataavail.js"
712
+ },
708
713
  "./services/chain-service/helper/api-helper/spec/datahighway": {
709
714
  "types": "./services/chain-service/helper/api-helper/spec/datahighway.d.ts",
710
715
  "require": "./cjs/services/chain-service/helper/api-helper/spec/datahighway.js",
@@ -1712,11 +1717,11 @@
1712
1717
  "@sora-substrate/type-definitions": "^1.17.7",
1713
1718
  "@subsocial/types": "^0.6.8",
1714
1719
  "@substrate/connect": "^0.7.26",
1715
- "@subwallet/chain-list": "0.1.11",
1716
- "@subwallet/extension-base": "^1.0.9-2",
1717
- "@subwallet/extension-chains": "^1.0.9-2",
1718
- "@subwallet/extension-dapp": "^1.0.9-2",
1719
- "@subwallet/extension-inject": "^1.0.9-2",
1720
+ "@subwallet/chain-list": "0.2.1",
1721
+ "@subwallet/extension-base": "^1.0.10-0",
1722
+ "@subwallet/extension-chains": "^1.0.10-0",
1723
+ "@subwallet/extension-dapp": "^1.0.10-0",
1724
+ "@subwallet/extension-inject": "^1.0.10-0",
1720
1725
  "@subwallet/keyring": "^0.0.10",
1721
1726
  "@subwallet/ui-keyring": "^0.0.10",
1722
1727
  "@unique-nft/types": "^0.6.0-4",
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-base',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.0.9-2'
10
+ version: '1.0.10-0'
11
11
  };
@@ -64,6 +64,7 @@ export declare const _TRANSFER_CHAIN_GROUP: {
64
64
  statemine: string[];
65
65
  riochain: string[];
66
66
  sora_substrate: string[];
67
+ avail: string[];
67
68
  };
68
69
  export declare const _BALANCE_PARSING_CHAIN_GROUP: {
69
70
  bobabeam: string[];
@@ -182,7 +182,8 @@ export const _TRANSFER_CHAIN_GROUP = {
182
182
  bitcountry: ['pioneer', 'bitcountry', 'bifrost', 'bifrost_dot'],
183
183
  statemine: ['statemint', 'statemine', 'darwinia2', 'astar', 'shiden', 'shibuya', 'parallel'],
184
184
  riochain: ['riochain'],
185
- sora_substrate: ['sora_substrate']
185
+ sora_substrate: ['sora_substrate'],
186
+ avail: ['kate']
186
187
  };
187
188
  export const _BALANCE_PARSING_CHAIN_GROUP = {
188
189
  bobabeam: ['bobabeam', 'bobabase']
@@ -0,0 +1,3 @@
1
+ import type { OverrideBundleDefinition } from '@polkadot/types/types';
2
+ declare const definitions: OverrideBundleDefinition;
3
+ export default definitions;
@@ -0,0 +1,145 @@
1
+ // Copyright 2017-2021 @polkadot/apps-config authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ // import type {H256} from '@polkadot/types/interfaces';
4
+ // eslint-disable-next-line header/header
5
+
6
+ // structs need to be in order
7
+ /* eslint-disable sort-keys */
8
+
9
+ const definitions = {
10
+ rpc: {
11
+ kate: {
12
+ blockLength: {
13
+ description: 'Get Block Length',
14
+ params: [{
15
+ name: 'at',
16
+ type: 'Hash',
17
+ isOptional: true
18
+ }],
19
+ type: 'BlockLength'
20
+ },
21
+ queryProof: {
22
+ description: 'Generate the kate proof for the given `cells`',
23
+ params: [{
24
+ name: 'cells',
25
+ type: 'Vec<Cell>'
26
+ }, {
27
+ name: 'at',
28
+ type: 'Hash',
29
+ isOptional: true
30
+ }],
31
+ type: 'Vec<u8>'
32
+ },
33
+ queryAppData: {
34
+ description: 'Fetches app data rows for the given app',
35
+ params: [{
36
+ name: 'app_id',
37
+ type: 'AppId'
38
+ }, {
39
+ name: 'at',
40
+ type: 'Hash',
41
+ isOptional: true
42
+ }],
43
+ type: 'Vec<Option<Vec<u8>>>'
44
+ },
45
+ queryDataProof: {
46
+ description: 'Generate the data proof for the given `index`',
47
+ params: [{
48
+ name: 'data_index',
49
+ type: 'u32'
50
+ }, {
51
+ name: 'at',
52
+ type: 'Hash',
53
+ isOptional: true
54
+ }],
55
+ type: 'DataProof'
56
+ }
57
+ }
58
+ },
59
+ types: [{
60
+ // on all versions
61
+ minmax: [0, undefined],
62
+ types: {
63
+ AppId: 'Compact<u32>',
64
+ DataLookupIndexItem: {
65
+ appId: 'AppId',
66
+ start: 'Compact<u32>'
67
+ },
68
+ DataLookup: {
69
+ size: 'Compact<u32>',
70
+ index: 'Vec<DataLookupIndexItem>'
71
+ },
72
+ KateCommitment: {
73
+ rows: 'Compact<u16>',
74
+ cols: 'Compact<u16>',
75
+ dataRoot: 'H256',
76
+ commitment: 'Vec<u8>'
77
+ },
78
+ V1HeaderExtension: {
79
+ commitment: 'KateCommitment',
80
+ appLookup: 'DataLookup'
81
+ },
82
+ VTHeaderExtension: {
83
+ newField: 'Vec<u8>',
84
+ commitment: 'KateCommitment',
85
+ appLookup: 'DataLookup'
86
+ },
87
+ HeaderExtension: {
88
+ _enum: {
89
+ V1: 'V1HeaderExtension',
90
+ VTest: 'VTHeaderExtension'
91
+ }
92
+ },
93
+ DaHeader: {
94
+ parentHash: 'Hash',
95
+ number: 'Compact<BlockNumber>',
96
+ stateRoot: 'Hash',
97
+ extrinsicsRoot: 'Hash',
98
+ digest: 'Digest',
99
+ extension: 'HeaderExtension'
100
+ },
101
+ Header: 'DaHeader',
102
+ CheckAppIdExtra: {
103
+ appId: 'AppId'
104
+ },
105
+ CheckAppIdTypes: {},
106
+ CheckAppId: {
107
+ extra: 'CheckAppIdExtra',
108
+ types: 'CheckAppIdTypes'
109
+ },
110
+ BlockLengthColumns: 'Compact<u32>',
111
+ BlockLengthRows: 'Compact<u32>',
112
+ BlockLength: {
113
+ max: 'PerDispatchClass',
114
+ cols: 'BlockLengthColumns',
115
+ rows: 'BlockLengthRows',
116
+ chunkSize: 'Compact<u32>'
117
+ },
118
+ PerDispatchClass: {
119
+ normal: 'u32',
120
+ operational: 'u32',
121
+ mandatory: 'u32'
122
+ },
123
+ DataProof: {
124
+ root: 'H256',
125
+ proof: 'Vec<H256>',
126
+ numberOfLeaves: 'Compact<u32>',
127
+ leaf_index: 'Compact<u32>',
128
+ leaf: 'H256'
129
+ },
130
+ Cell: {
131
+ row: 'BlockLengthRows',
132
+ col: 'BlockLengthColumns'
133
+ }
134
+ }
135
+ }],
136
+ signedExtensions: {
137
+ CheckAppId: {
138
+ extrinsic: {
139
+ appId: 'AppId'
140
+ },
141
+ payload: {}
142
+ }
143
+ }
144
+ };
145
+ export default definitions;
@@ -30,6 +30,7 @@ import crownSterlingChain from "./crown-sterling.js";
30
30
  import crust from "./crust.js";
31
31
  import testPara from "./cumulus-test-parachain.js";
32
32
  import darwinia from "./darwinia.js";
33
+ import dataavail from "./dataavail.js";
33
34
  import datahighwayParachain from "./datahighway.js";
34
35
  import dockMainnet from "./dock-mainnet.js";
35
36
  import dockTestnet from "./dock-testnet.js";
@@ -162,6 +163,7 @@ const spec = {
162
163
  'crust-parachain': crust,
163
164
  'cumulus-subsocial-parachain': subsocial,
164
165
  'cumulus-test-parachain': testPara,
166
+ 'data-avail': dataavail,
165
167
  datahighway: westlake,
166
168
  'datahighway-parachain': datahighwayParachain,
167
169
  dawn: eave,