@subwallet/extension-base 1.1.14-0 → 1.1.15-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/cjs/koni/api/dotsama/transfer.js +13 -3
- package/cjs/koni/api/nft/wasm_nft/index.js +1 -1
- package/cjs/koni/api/staking/bonding/relayChain.js +2 -1
- package/cjs/koni/api/tokens/wasm/index.js +17 -0
- package/cjs/koni/background/handlers/Extension.js +14 -4
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +5 -4
- package/cjs/services/chain-service/helper/index.js +4 -1
- package/koni/api/dotsama/transfer.js +13 -3
- package/koni/api/nft/wasm_nft/index.js +2 -2
- package/koni/api/staking/bonding/relayChain.js +2 -1
- package/koni/api/tokens/wasm/index.d.ts +2 -0
- package/koni/api/tokens/wasm/index.js +16 -1
- package/koni/background/handlers/Extension.js +14 -4
- package/package.json +7 -6
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +5 -4
- package/services/chain-service/helper/index.d.ts +1 -0
- package/services/chain-service/helper/index.js +2 -0
- package/services/chain-service/helper/neuroguns_psp34_abi.json +1866 -0
|
@@ -141,15 +141,25 @@ const createTransferExtrinsic = async _ref => {
|
|
|
141
141
|
gasLimit
|
|
142
142
|
}, to, value, {});
|
|
143
143
|
transferAmount = value;
|
|
144
|
-
} else if (_constants._TRANSFER_CHAIN_GROUP.acala.includes(networkKey)
|
|
145
|
-
|
|
144
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.acala.includes(networkKey)) {
|
|
145
|
+
if (!(0, _utils2._isNativeToken)(tokenInfo)) {
|
|
146
|
+
if (isTxCurrenciesSupported) {
|
|
147
|
+
transfer = api.tx.currencies.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), value);
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
if (transferAll) {
|
|
151
|
+
transfer = api.tx.balances.transferAll(to, false);
|
|
152
|
+
} else if (value) {
|
|
153
|
+
transfer = api.tx.balances.transferKeepAlive(to, new _util.BN(value));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
146
156
|
} else if (_constants._TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && isTxTokensSupported) {
|
|
147
157
|
if (transferAll) {
|
|
148
158
|
transfer = api.tx.tokens.transferAll(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo) || (0, _utils2._getTokenOnChainAssetId)(tokenInfo), false);
|
|
149
159
|
} else if (value) {
|
|
150
160
|
transfer = api.tx.tokens.transfer(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo) || (0, _utils2._getTokenOnChainAssetId)(tokenInfo), new _util.BN(value));
|
|
151
161
|
}
|
|
152
|
-
} else if (_constants._TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported) {
|
|
162
|
+
} else if (_constants._TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported && !(0, _utils2._isNativeToken)(tokenInfo)) {
|
|
153
163
|
if (transferAll) {
|
|
154
164
|
transfer = api.tx.tokens.transferAll(to, (0, _utils2._getTokenOnChainInfo)(tokenInfo), false);
|
|
155
165
|
} else if (value) {
|
|
@@ -268,7 +268,7 @@ class WasmNftApi extends _nft.BaseNftApi {
|
|
|
268
268
|
name: tokenId
|
|
269
269
|
};
|
|
270
270
|
const _isFeatured = isFeatured && !_domain.AZERO_DOMAIN_CONTRACTS.includes(contractPromise.address.toString());
|
|
271
|
-
const _tokenUri = await contractPromise.query[(0, _wasm.
|
|
271
|
+
const _tokenUri = await contractPromise.query[(0, _wasm.getTokenUriMethod)(contractPromise.address.toString())](address, {
|
|
272
272
|
gasLimit: (0, _utils2.getDefaultWeightV2)((_this$substrateApi2 = this.substrateApi) === null || _this$substrateApi2 === void 0 ? void 0 : _this$substrateApi2.api)
|
|
273
273
|
}, (0, _wasm.isAzeroDomainNft)(contractPromise.address.toString()) ? {
|
|
274
274
|
bytes: tokenId
|
|
@@ -518,12 +518,13 @@ async function getRelayChainPoolMemberMetadata(chainInfo, address, substrateApi)
|
|
|
518
518
|
};
|
|
519
519
|
}
|
|
520
520
|
async function getRelayValidatorsInfo(chain, substrateApi, decimals, chainStakingMetadata) {
|
|
521
|
+
var _chainApi$api$query$s2;
|
|
521
522
|
const chainApi = await substrateApi.isReady;
|
|
522
523
|
const _era = await chainApi.api.query.staking.currentEra();
|
|
523
524
|
const currentEra = _era.toString();
|
|
524
525
|
const allValidators = [];
|
|
525
526
|
const validatorInfoList = [];
|
|
526
|
-
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra)), chainApi.api.query.staking.minNominatorBond(), chainApi.api.query.stakingRewards && chainApi.api.query.stakingRewards.data()]);
|
|
527
|
+
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra)), chainApi.api.query.staking.minNominatorBond(), ((_chainApi$api$query$s2 = chainApi.api.query.stakingRewards) === null || _chainApi$api$query$s2 === void 0 ? void 0 : _chainApi$api$query$s2.data) && chainApi.api.query.stakingRewards.data()]);
|
|
527
528
|
const stakingRewards = _stakingRewards === null || _stakingRewards === void 0 ? void 0 : _stakingRewards.toPrimitive();
|
|
528
529
|
const maxNominatorRewarded = chainApi.api.consts.staking.maxNominatorRewardedPerValidator.toString();
|
|
529
530
|
const bnTotalEraStake = new _util.BN(_totalEraStake.toString());
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getPSP22ContractPromise = getPSP22ContractPromise;
|
|
7
7
|
exports.getPSP34ContractPromise = getPSP34ContractPromise;
|
|
8
8
|
exports.getPSP34TransferExtrinsic = getPSP34TransferExtrinsic;
|
|
9
|
+
exports.getTokenUriMethod = getTokenUriMethod;
|
|
9
10
|
exports.isAzeroDomainNft = isAzeroDomainNft;
|
|
11
|
+
exports.isNeurogunNft = isNeurogunNft;
|
|
10
12
|
exports.isPinkRoboNft = isPinkRoboNft;
|
|
11
13
|
var _utils = require("@subwallet/extension-base/koni/api/tokens/wasm/utils");
|
|
12
14
|
var _helper = require("@subwallet/extension-base/services/chain-service/helper");
|
|
@@ -20,6 +22,9 @@ function getPSP22ContractPromise(apiPromise, contractAddress) {
|
|
|
20
22
|
function isPinkRoboNft(contractAddress) {
|
|
21
23
|
return ['XoywUxTTtNKPRrRN7V5KXCqz2QLMFeK7DxhpSniqZHps5Xq'].includes(contractAddress);
|
|
22
24
|
}
|
|
25
|
+
function isNeurogunNft(contractAddress) {
|
|
26
|
+
return ['aZ9bd2tHeGKrs3FnJv5oe7kgVrP5GQvdJMhC2GxjXA2Yqbd'].includes(contractAddress);
|
|
27
|
+
}
|
|
23
28
|
function isAzeroDomainNft(contractAddress) {
|
|
24
29
|
return ['5FsB91tXSEuMj6akzdPczAtmBaVKToqHmtAwSUzXh49AYzaD', '5CTQBfBC9SfdrCDBJdfLiyW2pg9z5W6C6Es8sK313BLnFgDf'].includes(contractAddress);
|
|
25
30
|
}
|
|
@@ -27,11 +32,23 @@ function getPSP34ContractPromise(apiPromise, contractAddress) {
|
|
|
27
32
|
if (isPinkRoboNft(contractAddress)) {
|
|
28
33
|
return new _apiContract.ContractPromise(apiPromise, _helper._PINK_PSP34_ABI, contractAddress);
|
|
29
34
|
}
|
|
35
|
+
if (isNeurogunNft(contractAddress)) {
|
|
36
|
+
return new _apiContract.ContractPromise(apiPromise, _helper._NEUROGUNS_PSP34_ABI, contractAddress);
|
|
37
|
+
}
|
|
30
38
|
if (isAzeroDomainNft(contractAddress)) {
|
|
31
39
|
return new _apiContract.ContractPromise(apiPromise, _helper._AZERO_DOMAIN_REGISTRY_ABI, contractAddress);
|
|
32
40
|
}
|
|
33
41
|
return new _apiContract.ContractPromise(apiPromise, _helper._PSP34_ABI, contractAddress);
|
|
34
42
|
}
|
|
43
|
+
function getTokenUriMethod(contractAddress) {
|
|
44
|
+
if (isPinkRoboNft(contractAddress)) {
|
|
45
|
+
return 'pinkMint::tokenUri';
|
|
46
|
+
}
|
|
47
|
+
if (isNeurogunNft(contractAddress)) {
|
|
48
|
+
return 'tokenUri';
|
|
49
|
+
}
|
|
50
|
+
return 'psp34Traits::tokenUri';
|
|
51
|
+
}
|
|
35
52
|
const mustFormatNumberReg = /^-?[0-9][0-9,.]+$/;
|
|
36
53
|
async function getPSP34TransferExtrinsic(networkKey, substrateApi, senderAddress, recipientAddress, params) {
|
|
37
54
|
const contractAddress = params.contractAddress;
|
|
@@ -3141,17 +3141,22 @@ class KoniExtension {
|
|
|
3141
3141
|
}
|
|
3142
3142
|
|
|
3143
3143
|
// ChainService -------------------------------------------------
|
|
3144
|
-
subscribeChainInfoMap(id, port) {
|
|
3144
|
+
async subscribeChainInfoMap(id, port) {
|
|
3145
3145
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3146
|
+
let ready = false;
|
|
3146
3147
|
const chainInfoMapSubscription = this.#koniState.subscribeChainInfoMap().subscribe({
|
|
3147
3148
|
next: rs => {
|
|
3148
|
-
|
|
3149
|
+
if (ready) {
|
|
3150
|
+
cb(rs);
|
|
3151
|
+
}
|
|
3149
3152
|
}
|
|
3150
3153
|
});
|
|
3151
3154
|
this.createUnsubscriptionHandle(id, chainInfoMapSubscription.unsubscribe);
|
|
3152
3155
|
port.onDisconnect.addListener(() => {
|
|
3153
3156
|
this.cancelSubscription(id);
|
|
3154
3157
|
});
|
|
3158
|
+
await this.#koniState.eventService.waitChainReady;
|
|
3159
|
+
ready = true;
|
|
3155
3160
|
return this.#koniState.getChainInfoMap();
|
|
3156
3161
|
}
|
|
3157
3162
|
subscribeChainStateMap(id, port) {
|
|
@@ -3167,17 +3172,22 @@ class KoniExtension {
|
|
|
3167
3172
|
});
|
|
3168
3173
|
return this.#koniState.getChainStateMap();
|
|
3169
3174
|
}
|
|
3170
|
-
subscribeAssetRegistry(id, port) {
|
|
3175
|
+
async subscribeAssetRegistry(id, port) {
|
|
3171
3176
|
const cb = (0, _subscriptions.createSubscription)(id, port);
|
|
3177
|
+
let ready = false;
|
|
3172
3178
|
const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
|
|
3173
3179
|
next: rs => {
|
|
3174
|
-
|
|
3180
|
+
if (ready) {
|
|
3181
|
+
cb(rs);
|
|
3182
|
+
}
|
|
3175
3183
|
}
|
|
3176
3184
|
});
|
|
3177
3185
|
this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
|
|
3178
3186
|
port.onDisconnect.addListener(() => {
|
|
3179
3187
|
this.cancelSubscription(id);
|
|
3180
3188
|
});
|
|
3189
|
+
await this.#koniState.eventService.waitAssetReady;
|
|
3190
|
+
ready = true;
|
|
3181
3191
|
return this.#koniState.getAssetRegistry();
|
|
3182
3192
|
}
|
|
3183
3193
|
subscribeMultiChainAssetMap(id, port) {
|
package/cjs/packageInfo.js
CHANGED
|
@@ -38,7 +38,7 @@ const _BALANCE_CHAIN_GROUP = {
|
|
|
38
38
|
kintsugi: ['kintsugi', 'interlay', 'kintsugi_test', 'mangatax_para'],
|
|
39
39
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
40
40
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
41
|
-
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum'],
|
|
41
|
+
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude'],
|
|
42
42
|
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari'],
|
|
43
43
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'] // perhaps there are some runtime updates
|
|
44
44
|
};
|
|
@@ -61,7 +61,7 @@ const _NFT_CHAIN_GROUP = {
|
|
|
61
61
|
// Staking--------------------------------------------------------------------------------------------------------------
|
|
62
62
|
exports._NFT_CHAIN_GROUP = _NFT_CHAIN_GROUP;
|
|
63
63
|
const _STAKING_CHAIN_GROUP = {
|
|
64
|
-
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin'],
|
|
64
|
+
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network'],
|
|
65
65
|
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari'],
|
|
66
66
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
67
67
|
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum'],
|
|
@@ -103,7 +103,8 @@ const _STAKING_ERA_LENGTH_MAP = {
|
|
|
103
103
|
kilt_peregrine: 2,
|
|
104
104
|
edgeware: 6,
|
|
105
105
|
kate: 6,
|
|
106
|
-
creditcoin: 24
|
|
106
|
+
creditcoin: 24,
|
|
107
|
+
vara_network: 12
|
|
107
108
|
};
|
|
108
109
|
exports._STAKING_ERA_LENGTH_MAP = _STAKING_ERA_LENGTH_MAP;
|
|
109
110
|
const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
@@ -207,7 +208,7 @@ const _TRANSFER_CHAIN_GROUP = {
|
|
|
207
208
|
riochain: ['riochain'],
|
|
208
209
|
sora_substrate: ['sora_substrate'],
|
|
209
210
|
avail: ['kate'],
|
|
210
|
-
pendulum: ['pendulum']
|
|
211
|
+
pendulum: ['pendulum', 'amplitude', 'amplitude_test']
|
|
211
212
|
};
|
|
212
213
|
exports._TRANSFER_CHAIN_GROUP = _TRANSFER_CHAIN_GROUP;
|
|
213
214
|
const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports._TEST_ERC721_ABI = exports._PSP34_ABI = exports._PSP22_ABI = exports._PINK_PSP34_ABI = exports._ERC721_ABI = exports._ERC20_ABI = exports._AZERO_DOMAIN_REGISTRY_ABI = void 0;
|
|
6
|
+
exports._TEST_ERC721_ABI = exports._PSP34_ABI = exports._PSP22_ABI = exports._PINK_PSP34_ABI = exports._NEUROGUNS_PSP34_ABI = exports._ERC721_ABI = exports._ERC20_ABI = exports._AZERO_DOMAIN_REGISTRY_ABI = void 0;
|
|
7
7
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
|
|
@@ -26,5 +26,8 @@ exports._PSP34_ABI = _PSP34_ABI;
|
|
|
26
26
|
const _PINK_PSP34_ABI = require('./pink_psp34_abi.json');
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
28
28
|
exports._PINK_PSP34_ABI = _PINK_PSP34_ABI;
|
|
29
|
+
const _NEUROGUNS_PSP34_ABI = require('./neuroguns_psp34_abi.json');
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
31
|
+
exports._NEUROGUNS_PSP34_ABI = _NEUROGUNS_PSP34_ABI;
|
|
29
32
|
const _AZERO_DOMAIN_REGISTRY_ABI = require('./azero_domain_registry_abi.json');
|
|
30
33
|
exports._AZERO_DOMAIN_REGISTRY_ABI = _AZERO_DOMAIN_REGISTRY_ABI;
|
|
@@ -132,15 +132,25 @@ export const createTransferExtrinsic = async ({
|
|
|
132
132
|
gasLimit
|
|
133
133
|
}, to, value, {});
|
|
134
134
|
transferAmount = value;
|
|
135
|
-
} else if (_TRANSFER_CHAIN_GROUP.acala.includes(networkKey)
|
|
136
|
-
|
|
135
|
+
} else if (_TRANSFER_CHAIN_GROUP.acala.includes(networkKey)) {
|
|
136
|
+
if (!_isNativeToken(tokenInfo)) {
|
|
137
|
+
if (isTxCurrenciesSupported) {
|
|
138
|
+
transfer = api.tx.currencies.transfer(to, _getTokenOnChainInfo(tokenInfo), value);
|
|
139
|
+
}
|
|
140
|
+
} else {
|
|
141
|
+
if (transferAll) {
|
|
142
|
+
transfer = api.tx.balances.transferAll(to, false);
|
|
143
|
+
} else if (value) {
|
|
144
|
+
transfer = api.tx.balances.transferKeepAlive(to, new BN(value));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
137
147
|
} else if (_TRANSFER_CHAIN_GROUP.kintsugi.includes(networkKey) && isTxTokensSupported) {
|
|
138
148
|
if (transferAll) {
|
|
139
149
|
transfer = api.tx.tokens.transferAll(to, _getTokenOnChainInfo(tokenInfo) || _getTokenOnChainAssetId(tokenInfo), false);
|
|
140
150
|
} else if (value) {
|
|
141
151
|
transfer = api.tx.tokens.transfer(to, _getTokenOnChainInfo(tokenInfo) || _getTokenOnChainAssetId(tokenInfo), new BN(value));
|
|
142
152
|
}
|
|
143
|
-
} else if (_TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported) {
|
|
153
|
+
} else if (_TRANSFER_CHAIN_GROUP.pendulum.includes(networkKey) && isTxTokensSupported && !_isNativeToken(tokenInfo)) {
|
|
144
154
|
if (transferAll) {
|
|
145
155
|
transfer = api.tx.tokens.transferAll(to, _getTokenOnChainInfo(tokenInfo), false);
|
|
146
156
|
} else if (value) {
|
|
@@ -5,7 +5,7 @@ import { _AssetType } from '@subwallet/chain-list/types';
|
|
|
5
5
|
import { AZERO_DOMAIN_CONTRACTS } from '@subwallet/extension-base/koni/api/dotsama/domain';
|
|
6
6
|
import { BaseNftApi } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
7
7
|
import { collectionApiFromArtZero, collectionDetailApiFromArtZero, externalUrlOnArtZero, ipfsApiFromArtZero, itemImageApiFromArtZero } from '@subwallet/extension-base/koni/api/nft/wasm_nft/utils';
|
|
8
|
-
import { getPSP34ContractPromise, isAzeroDomainNft, isPinkRoboNft } from '@subwallet/extension-base/koni/api/tokens/wasm';
|
|
8
|
+
import { getPSP34ContractPromise, getTokenUriMethod, isAzeroDomainNft, isPinkRoboNft } from '@subwallet/extension-base/koni/api/tokens/wasm';
|
|
9
9
|
import { getDefaultWeightV2 } from '@subwallet/extension-base/koni/api/tokens/wasm/utils';
|
|
10
10
|
import { _getContractAddressOfToken } from '@subwallet/extension-base/services/chain-service/utils';
|
|
11
11
|
import { isUrl } from '@subwallet/extension-base/utils';
|
|
@@ -262,7 +262,7 @@ export class WasmNftApi extends BaseNftApi {
|
|
|
262
262
|
name: tokenId
|
|
263
263
|
};
|
|
264
264
|
const _isFeatured = isFeatured && !AZERO_DOMAIN_CONTRACTS.includes(contractPromise.address.toString());
|
|
265
|
-
const _tokenUri = await contractPromise.query[
|
|
265
|
+
const _tokenUri = await contractPromise.query[getTokenUriMethod(contractPromise.address.toString())](address, {
|
|
266
266
|
gasLimit: getDefaultWeightV2((_this$substrateApi2 = this.substrateApi) === null || _this$substrateApi2 === void 0 ? void 0 : _this$substrateApi2.api)
|
|
267
267
|
}, isAzeroDomainNft(contractPromise.address.toString()) ? {
|
|
268
268
|
bytes: tokenId
|
|
@@ -492,12 +492,13 @@ export async function getRelayChainPoolMemberMetadata(chainInfo, address, substr
|
|
|
492
492
|
};
|
|
493
493
|
}
|
|
494
494
|
export async function getRelayValidatorsInfo(chain, substrateApi, decimals, chainStakingMetadata) {
|
|
495
|
+
var _chainApi$api$query$s2;
|
|
495
496
|
const chainApi = await substrateApi.isReady;
|
|
496
497
|
const _era = await chainApi.api.query.staking.currentEra();
|
|
497
498
|
const currentEra = _era.toString();
|
|
498
499
|
const allValidators = [];
|
|
499
500
|
const validatorInfoList = [];
|
|
500
|
-
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra)), chainApi.api.query.staking.minNominatorBond(), chainApi.api.query.stakingRewards && chainApi.api.query.stakingRewards.data()]);
|
|
501
|
+
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra)), chainApi.api.query.staking.minNominatorBond(), ((_chainApi$api$query$s2 = chainApi.api.query.stakingRewards) === null || _chainApi$api$query$s2 === void 0 ? void 0 : _chainApi$api$query$s2.data) && chainApi.api.query.stakingRewards.data()]);
|
|
501
502
|
const stakingRewards = _stakingRewards === null || _stakingRewards === void 0 ? void 0 : _stakingRewards.toPrimitive();
|
|
502
503
|
const maxNominatorRewarded = chainApi.api.consts.staking.maxNominatorRewardedPerValidator.toString();
|
|
503
504
|
const bnTotalEraStake = new BN(_totalEraStake.toString());
|
|
@@ -3,6 +3,8 @@ import { ApiPromise } from '@polkadot/api';
|
|
|
3
3
|
import { ContractPromise } from '@polkadot/api-contract';
|
|
4
4
|
export declare function getPSP22ContractPromise(apiPromise: ApiPromise, contractAddress: string): ContractPromise;
|
|
5
5
|
export declare function isPinkRoboNft(contractAddress: string): boolean;
|
|
6
|
+
export declare function isNeurogunNft(contractAddress: string): boolean;
|
|
6
7
|
export declare function isAzeroDomainNft(contractAddress: string): boolean;
|
|
7
8
|
export declare function getPSP34ContractPromise(apiPromise: ApiPromise, contractAddress: string): ContractPromise;
|
|
9
|
+
export declare function getTokenUriMethod(contractAddress: string): string;
|
|
8
10
|
export declare function getPSP34TransferExtrinsic(networkKey: string, substrateApi: _SubstrateApi, senderAddress: string, recipientAddress: string, params: Record<string, any>): Promise<import("@polkadot/api-base/types").SubmittableExtrinsic<"promise", import("@polkadot/types/types").ISubmittableResult> | null>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
4
|
import { getWasmContractGasLimit } from '@subwallet/extension-base/koni/api/tokens/wasm/utils';
|
|
5
|
-
import { _AZERO_DOMAIN_REGISTRY_ABI, _PINK_PSP34_ABI, _PSP22_ABI, _PSP34_ABI } from '@subwallet/extension-base/services/chain-service/helper';
|
|
5
|
+
import { _AZERO_DOMAIN_REGISTRY_ABI, _NEUROGUNS_PSP34_ABI, _PINK_PSP34_ABI, _PSP22_ABI, _PSP34_ABI } from '@subwallet/extension-base/services/chain-service/helper';
|
|
6
6
|
import { ContractPromise } from '@polkadot/api-contract';
|
|
7
7
|
export function getPSP22ContractPromise(apiPromise, contractAddress) {
|
|
8
8
|
return new ContractPromise(apiPromise, _PSP22_ABI, contractAddress);
|
|
@@ -10,6 +10,9 @@ export function getPSP22ContractPromise(apiPromise, contractAddress) {
|
|
|
10
10
|
export function isPinkRoboNft(contractAddress) {
|
|
11
11
|
return ['XoywUxTTtNKPRrRN7V5KXCqz2QLMFeK7DxhpSniqZHps5Xq'].includes(contractAddress);
|
|
12
12
|
}
|
|
13
|
+
export function isNeurogunNft(contractAddress) {
|
|
14
|
+
return ['aZ9bd2tHeGKrs3FnJv5oe7kgVrP5GQvdJMhC2GxjXA2Yqbd'].includes(contractAddress);
|
|
15
|
+
}
|
|
13
16
|
export function isAzeroDomainNft(contractAddress) {
|
|
14
17
|
return ['5FsB91tXSEuMj6akzdPczAtmBaVKToqHmtAwSUzXh49AYzaD', '5CTQBfBC9SfdrCDBJdfLiyW2pg9z5W6C6Es8sK313BLnFgDf'].includes(contractAddress);
|
|
15
18
|
}
|
|
@@ -17,11 +20,23 @@ export function getPSP34ContractPromise(apiPromise, contractAddress) {
|
|
|
17
20
|
if (isPinkRoboNft(contractAddress)) {
|
|
18
21
|
return new ContractPromise(apiPromise, _PINK_PSP34_ABI, contractAddress);
|
|
19
22
|
}
|
|
23
|
+
if (isNeurogunNft(contractAddress)) {
|
|
24
|
+
return new ContractPromise(apiPromise, _NEUROGUNS_PSP34_ABI, contractAddress);
|
|
25
|
+
}
|
|
20
26
|
if (isAzeroDomainNft(contractAddress)) {
|
|
21
27
|
return new ContractPromise(apiPromise, _AZERO_DOMAIN_REGISTRY_ABI, contractAddress);
|
|
22
28
|
}
|
|
23
29
|
return new ContractPromise(apiPromise, _PSP34_ABI, contractAddress);
|
|
24
30
|
}
|
|
31
|
+
export function getTokenUriMethod(contractAddress) {
|
|
32
|
+
if (isPinkRoboNft(contractAddress)) {
|
|
33
|
+
return 'pinkMint::tokenUri';
|
|
34
|
+
}
|
|
35
|
+
if (isNeurogunNft(contractAddress)) {
|
|
36
|
+
return 'tokenUri';
|
|
37
|
+
}
|
|
38
|
+
return 'psp34Traits::tokenUri';
|
|
39
|
+
}
|
|
25
40
|
const mustFormatNumberReg = /^-?[0-9][0-9,.]+$/;
|
|
26
41
|
export async function getPSP34TransferExtrinsic(networkKey, substrateApi, senderAddress, recipientAddress, params) {
|
|
27
42
|
const contractAddress = params.contractAddress;
|
|
@@ -3056,17 +3056,22 @@ export default class KoniExtension {
|
|
|
3056
3056
|
}
|
|
3057
3057
|
|
|
3058
3058
|
// ChainService -------------------------------------------------
|
|
3059
|
-
subscribeChainInfoMap(id, port) {
|
|
3059
|
+
async subscribeChainInfoMap(id, port) {
|
|
3060
3060
|
const cb = createSubscription(id, port);
|
|
3061
|
+
let ready = false;
|
|
3061
3062
|
const chainInfoMapSubscription = this.#koniState.subscribeChainInfoMap().subscribe({
|
|
3062
3063
|
next: rs => {
|
|
3063
|
-
|
|
3064
|
+
if (ready) {
|
|
3065
|
+
cb(rs);
|
|
3066
|
+
}
|
|
3064
3067
|
}
|
|
3065
3068
|
});
|
|
3066
3069
|
this.createUnsubscriptionHandle(id, chainInfoMapSubscription.unsubscribe);
|
|
3067
3070
|
port.onDisconnect.addListener(() => {
|
|
3068
3071
|
this.cancelSubscription(id);
|
|
3069
3072
|
});
|
|
3073
|
+
await this.#koniState.eventService.waitChainReady;
|
|
3074
|
+
ready = true;
|
|
3070
3075
|
return this.#koniState.getChainInfoMap();
|
|
3071
3076
|
}
|
|
3072
3077
|
subscribeChainStateMap(id, port) {
|
|
@@ -3082,17 +3087,22 @@ export default class KoniExtension {
|
|
|
3082
3087
|
});
|
|
3083
3088
|
return this.#koniState.getChainStateMap();
|
|
3084
3089
|
}
|
|
3085
|
-
subscribeAssetRegistry(id, port) {
|
|
3090
|
+
async subscribeAssetRegistry(id, port) {
|
|
3086
3091
|
const cb = createSubscription(id, port);
|
|
3092
|
+
let ready = false;
|
|
3087
3093
|
const assetRegistrySubscription = this.#koniState.subscribeAssetRegistry().subscribe({
|
|
3088
3094
|
next: rs => {
|
|
3089
|
-
|
|
3095
|
+
if (ready) {
|
|
3096
|
+
cb(rs);
|
|
3097
|
+
}
|
|
3090
3098
|
}
|
|
3091
3099
|
});
|
|
3092
3100
|
this.createUnsubscriptionHandle(id, assetRegistrySubscription.unsubscribe);
|
|
3093
3101
|
port.onDisconnect.addListener(() => {
|
|
3094
3102
|
this.cancelSubscription(id);
|
|
3095
3103
|
});
|
|
3104
|
+
await this.#koniState.eventService.waitAssetReady;
|
|
3105
|
+
ready = true;
|
|
3096
3106
|
return this.#koniState.getAssetRegistry();
|
|
3097
3107
|
}
|
|
3098
3108
|
subscribeMultiChainAssetMap(id, port) {
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"./cjs/detectPackage.js"
|
|
18
18
|
],
|
|
19
19
|
"type": "module",
|
|
20
|
-
"version": "1.1.
|
|
20
|
+
"version": "1.1.15-0",
|
|
21
21
|
"main": "./cjs/index.js",
|
|
22
22
|
"module": "./index.js",
|
|
23
23
|
"types": "./index.d.ts",
|
|
@@ -583,6 +583,7 @@
|
|
|
583
583
|
"./services/chain-service/helper/azero_domain_registry_abi.json": "./services/chain-service/helper/azero_domain_registry_abi.json",
|
|
584
584
|
"./services/chain-service/helper/erc20_abi.json": "./services/chain-service/helper/erc20_abi.json",
|
|
585
585
|
"./services/chain-service/helper/erc721_abi.json": "./services/chain-service/helper/erc721_abi.json",
|
|
586
|
+
"./services/chain-service/helper/neuroguns_psp34_abi.json": "./services/chain-service/helper/neuroguns_psp34_abi.json",
|
|
586
587
|
"./services/chain-service/helper/pink_psp34_abi.json": "./services/chain-service/helper/pink_psp34_abi.json",
|
|
587
588
|
"./services/chain-service/helper/psp22_abi.json": "./services/chain-service/helper/psp22_abi.json",
|
|
588
589
|
"./services/chain-service/helper/psp34_abi.json": "./services/chain-service/helper/psp34_abi.json",
|
|
@@ -1226,11 +1227,11 @@
|
|
|
1226
1227
|
"@reduxjs/toolkit": "^1.9.1",
|
|
1227
1228
|
"@sora-substrate/type-definitions": "^1.17.7",
|
|
1228
1229
|
"@substrate/connect": "^0.7.26",
|
|
1229
|
-
"@subwallet/chain-list": "
|
|
1230
|
-
"@subwallet/extension-base": "^1.1.
|
|
1231
|
-
"@subwallet/extension-chains": "^1.1.
|
|
1232
|
-
"@subwallet/extension-dapp": "^1.1.
|
|
1233
|
-
"@subwallet/extension-inject": "^1.1.
|
|
1230
|
+
"@subwallet/chain-list": "0.2.16-beta.4",
|
|
1231
|
+
"@subwallet/extension-base": "^1.1.15-0",
|
|
1232
|
+
"@subwallet/extension-chains": "^1.1.15-0",
|
|
1233
|
+
"@subwallet/extension-dapp": "^1.1.15-0",
|
|
1234
|
+
"@subwallet/extension-inject": "^1.1.15-0",
|
|
1234
1235
|
"@subwallet/keyring": "^0.1.1",
|
|
1235
1236
|
"@subwallet/ui-keyring": "^0.1.1",
|
|
1236
1237
|
"@walletconnect/sign-client": "^2.8.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.1.
|
|
10
|
+
version: '1.1.15-0'
|
|
11
11
|
};
|
|
@@ -27,7 +27,7 @@ export const _BALANCE_CHAIN_GROUP = {
|
|
|
27
27
|
kintsugi: ['kintsugi', 'interlay', 'kintsugi_test', 'mangatax_para'],
|
|
28
28
|
genshiro: ['genshiro_testnet', 'genshiro'],
|
|
29
29
|
equilibrium_parachain: ['equilibrium_parachain'],
|
|
30
|
-
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum'],
|
|
30
|
+
bifrost: ['bifrost', 'acala', 'karura', 'acala_testnet', 'pioneer', 'bitcountry', 'bifrost_dot', 'hydradx_main', 'pendulum', 'amplitude'],
|
|
31
31
|
statemine: ['statemine', 'astar', 'shiden', 'statemint', 'moonbeam', 'moonbase', 'moonriver', 'crabParachain', 'darwinia2', 'parallel', 'calamari'],
|
|
32
32
|
kusama: ['kusama', 'kintsugi', 'kintsugi_test', 'interlay', 'acala', 'statemint', 'karura', 'bifrost'] // perhaps there are some runtime updates
|
|
33
33
|
};
|
|
@@ -49,7 +49,7 @@ export const _NFT_CHAIN_GROUP = {
|
|
|
49
49
|
// Staking--------------------------------------------------------------------------------------------------------------
|
|
50
50
|
|
|
51
51
|
export const _STAKING_CHAIN_GROUP = {
|
|
52
|
-
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin'],
|
|
52
|
+
relay: ['polkadot', 'kusama', 'aleph', 'polkadex', 'ternoa', 'ternoa_alphanet', 'alephTest', 'polkadexTest', 'westend', 'kate', 'edgeware', 'creditcoin', 'vara_network'],
|
|
53
53
|
para: ['moonbeam', 'moonriver', 'moonbase', 'turing', 'turingStaging', 'bifrost', 'bifrost_testnet', 'calamari_test', 'calamari'],
|
|
54
54
|
astar: ['astar', 'shiden', 'shibuya'],
|
|
55
55
|
amplitude: ['amplitude', 'amplitude_test', 'kilt', 'kilt_peregrine', 'pendulum'],
|
|
@@ -90,7 +90,8 @@ export const _STAKING_ERA_LENGTH_MAP = {
|
|
|
90
90
|
kilt_peregrine: 2,
|
|
91
91
|
edgeware: 6,
|
|
92
92
|
kate: 6,
|
|
93
|
-
creditcoin: 24
|
|
93
|
+
creditcoin: 24,
|
|
94
|
+
vara_network: 12
|
|
94
95
|
};
|
|
95
96
|
export const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
96
97
|
moonbeam: {
|
|
@@ -190,7 +191,7 @@ export const _TRANSFER_CHAIN_GROUP = {
|
|
|
190
191
|
riochain: ['riochain'],
|
|
191
192
|
sora_substrate: ['sora_substrate'],
|
|
192
193
|
avail: ['kate'],
|
|
193
|
-
pendulum: ['pendulum']
|
|
194
|
+
pendulum: ['pendulum', 'amplitude', 'amplitude_test']
|
|
194
195
|
};
|
|
195
196
|
export const _BALANCE_PARSING_CHAIN_GROUP = {
|
|
196
197
|
bobabeam: ['bobabeam', 'bobabase']
|
|
@@ -4,4 +4,5 @@ export declare const _TEST_ERC721_ABI: any;
|
|
|
4
4
|
export declare const _PSP22_ABI: Record<string, any>;
|
|
5
5
|
export declare const _PSP34_ABI: Record<string, any>;
|
|
6
6
|
export declare const _PINK_PSP34_ABI: Record<string, any>;
|
|
7
|
+
export declare const _NEUROGUNS_PSP34_ABI: Record<string, any>;
|
|
7
8
|
export declare const _AZERO_DOMAIN_REGISTRY_ABI: Record<string, any>;
|
|
@@ -14,4 +14,6 @@ export const _PSP34_ABI = require("./psp34_abi.json");
|
|
|
14
14
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
15
15
|
export const _PINK_PSP34_ABI = require("./pink_psp34_abi.json");
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
17
|
+
export const _NEUROGUNS_PSP34_ABI = require("./neuroguns_psp34_abi.json");
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires,@typescript-eslint/no-unsafe-assignment
|
|
17
19
|
export const _AZERO_DOMAIN_REGISTRY_ABI = require("./azero_domain_registry_abi.json");
|