@subwallet/extension-base 1.1.55-0 → 1.1.57-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 +9 -1
- package/background/KoniTypes.js +5 -0
- package/cjs/background/KoniTypes.js +7 -1
- package/cjs/koni/api/nft/{statemint_nft → assethub_nft}/index.js +5 -3
- package/cjs/koni/api/nft/{statemine_nft → assethub_unique}/index.js +5 -3
- package/cjs/koni/api/nft/index.js +13 -13
- package/cjs/koni/api/nft/nft.js +1 -1
- package/cjs/koni/api/nft/transfer.js +11 -15
- package/cjs/koni/background/handlers/State.js +20 -3
- package/cjs/packageInfo.js +1 -1
- package/cjs/services/chain-service/constants.js +17 -3
- package/cjs/services/chain-service/index.js +9 -0
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +7 -9
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +11 -8
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +28 -7
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +11 -3
- package/cjs/services/earning-service/service.js +0 -1
- package/cjs/services/earning-service/utils/index.js +2 -2
- package/cjs/utils/fetchStaticCache.js +4 -1
- package/koni/api/nft/{statemint_nft → assethub_nft}/index.d.ts +1 -1
- package/koni/api/nft/{statemint_nft → assethub_nft}/index.js +4 -2
- package/koni/api/nft/{statemine_nft → assethub_unique}/index.d.ts +1 -1
- package/koni/api/nft/{statemine_nft → assethub_unique}/index.js +4 -2
- package/koni/api/nft/index.js +13 -13
- package/koni/api/nft/nft.js +1 -1
- package/koni/api/nft/transfer.d.ts +1 -2
- package/koni/api/nft/transfer.js +10 -13
- package/koni/background/handlers/State.js +21 -4
- package/package.json +26 -26
- package/packageInfo.js +1 -1
- package/services/chain-service/constants.js +17 -3
- package/services/chain-service/index.d.ts +1 -0
- package/services/chain-service/index.js +9 -0
- package/services/earning-service/handlers/native-staking/amplitude.js +7 -9
- package/services/earning-service/handlers/native-staking/para-chain.js +12 -9
- package/services/earning-service/handlers/native-staking/relay-chain.js +28 -7
- package/services/earning-service/handlers/nomination-pool/index.js +11 -3
- package/services/earning-service/service.js +0 -1
- package/services/earning-service/utils/index.js +2 -2
- package/types/yield/info/pallet.d.ts +4 -0
- package/utils/fetchStaticCache.js +4 -1
|
@@ -159,7 +159,7 @@ export declare enum CrowdloanParaState {
|
|
|
159
159
|
COMPLETED = "completed",
|
|
160
160
|
FAILED = "failed"
|
|
161
161
|
}
|
|
162
|
-
export interface NftItem {
|
|
162
|
+
export interface NftItem extends NftItemExtraInfo {
|
|
163
163
|
id: string;
|
|
164
164
|
chain: string;
|
|
165
165
|
collectionId: string;
|
|
@@ -171,9 +171,16 @@ export interface NftItem {
|
|
|
171
171
|
rarity?: string;
|
|
172
172
|
description?: string;
|
|
173
173
|
properties?: Record<any, any> | null;
|
|
174
|
+
}
|
|
175
|
+
interface NftItemExtraInfo {
|
|
174
176
|
type?: _AssetType.ERC721 | _AssetType.PSP34 | RMRK_VER;
|
|
175
177
|
rmrk_ver?: RMRK_VER;
|
|
176
178
|
onChainOption?: any;
|
|
179
|
+
assetHubType?: AssetHubNftType;
|
|
180
|
+
}
|
|
181
|
+
export declare enum AssetHubNftType {
|
|
182
|
+
NFTS = "nfts",
|
|
183
|
+
UNIQUES = "uniques"
|
|
177
184
|
}
|
|
178
185
|
export interface NftCollection {
|
|
179
186
|
collectionId: string;
|
|
@@ -1874,3 +1881,4 @@ export interface ApplicationMetadataType {
|
|
|
1874
1881
|
}
|
|
1875
1882
|
export declare type OSType = 'Mac OS' | 'iOS' | 'Windows' | 'Android' | 'Linux' | 'Unknown';
|
|
1876
1883
|
export declare const MobileOS: OSType[];
|
|
1884
|
+
export {};
|
package/background/KoniTypes.js
CHANGED
|
@@ -38,6 +38,11 @@ export let CrowdloanParaState;
|
|
|
38
38
|
CrowdloanParaState["COMPLETED"] = "completed";
|
|
39
39
|
CrowdloanParaState["FAILED"] = "failed";
|
|
40
40
|
})(CrowdloanParaState || (CrowdloanParaState = {}));
|
|
41
|
+
export let AssetHubNftType;
|
|
42
|
+
(function (AssetHubNftType) {
|
|
43
|
+
AssetHubNftType["NFTS"] = "nfts";
|
|
44
|
+
AssetHubNftType["UNIQUES"] = "uniques";
|
|
45
|
+
})(AssetHubNftType || (AssetHubNftType = {}));
|
|
41
46
|
export let ContractType;
|
|
42
47
|
(function (ContractType) {
|
|
43
48
|
ContractType["wasm"] = "wasm";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WalletUnlockType = exports.TransferTxErrorType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.StakingTxErrorType = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.NotificationType = exports.NETWORK_STATUS = exports.NETWORK_ERROR = exports.MobileOS = exports.MantaPayEnableMessage = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.ChainEditStandard = exports.CampaignDataType = exports.BasicTxWarningCode = exports.BasicTxErrorType = exports.BalanceErrorType = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
|
|
6
|
+
exports.WalletUnlockType = exports.TransferTxErrorType = exports.TransactionDirection = exports.ThemeNames = exports.StakingType = exports.StakingTxErrorType = exports.RuntimeEnvironment = exports.RMRK_VER = exports.ProviderErrorType = exports.NotificationType = exports.NETWORK_STATUS = exports.NETWORK_ERROR = exports.MobileOS = exports.MantaPayEnableMessage = exports.ExtrinsicType = exports.ExtrinsicStatus = exports.ExternalRequestPromiseStatus = exports.EvmProviderErrorType = exports.CrowdloanParaState = exports.ContractType = exports.ChainType = exports.ChainEditStandard = exports.CampaignDataType = exports.BasicTxWarningCode = exports.BasicTxErrorType = exports.BalanceErrorType = exports.AssetHubNftType = exports.AccountExternalErrorCode = exports.APIItemState = void 0;
|
|
7
7
|
// Copyright 2019-2022 @polkadot/extension-koni authors & contributors
|
|
8
8
|
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
let RuntimeEnvironment;
|
|
@@ -47,6 +47,12 @@ exports.CrowdloanParaState = CrowdloanParaState;
|
|
|
47
47
|
CrowdloanParaState["COMPLETED"] = "completed";
|
|
48
48
|
CrowdloanParaState["FAILED"] = "failed";
|
|
49
49
|
})(CrowdloanParaState || (exports.CrowdloanParaState = CrowdloanParaState = {}));
|
|
50
|
+
let AssetHubNftType;
|
|
51
|
+
exports.AssetHubNftType = AssetHubNftType;
|
|
52
|
+
(function (AssetHubNftType) {
|
|
53
|
+
AssetHubNftType["NFTS"] = "nfts";
|
|
54
|
+
AssetHubNftType["UNIQUES"] = "uniques";
|
|
55
|
+
})(AssetHubNftType || (exports.AssetHubNftType = AssetHubNftType = {}));
|
|
50
56
|
let ContractType;
|
|
51
57
|
exports.ContractType = ContractType;
|
|
52
58
|
(function (ContractType) {
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
8
9
|
var _nft = require("@subwallet/extension-base/koni/api/nft/nft");
|
|
9
10
|
var _utils = require("@subwallet/extension-base/utils");
|
|
10
11
|
var _crossFetch = _interopRequireDefault(require("cross-fetch"));
|
|
11
12
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
12
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
13
14
|
|
|
14
|
-
class
|
|
15
|
+
class AssetHubNftsPalletApi extends _nft.BaseNftApi {
|
|
15
16
|
// eslint-disable-next-line no-useless-constructor
|
|
16
17
|
constructor(api, addresses, chain) {
|
|
17
18
|
super(chain, api, addresses);
|
|
@@ -112,7 +113,8 @@ class StatemintNftApi extends _nft.BaseNftApi {
|
|
|
112
113
|
image: tokenInfo && tokenInfo.image ? this.parseUrl(tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.image) : undefined,
|
|
113
114
|
collectionId: this.parseTokenId(parsedClassId),
|
|
114
115
|
chain: this.chain,
|
|
115
|
-
owner: address
|
|
116
|
+
owner: address,
|
|
117
|
+
assetHubType: _KoniTypes.AssetHubNftType.NFTS
|
|
116
118
|
};
|
|
117
119
|
params.updateItem(this.chain, parsedNft, address);
|
|
118
120
|
const parsedCollection = {
|
|
@@ -140,4 +142,4 @@ class StatemintNftApi extends _nft.BaseNftApi {
|
|
|
140
142
|
return 1;
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
|
-
exports.default =
|
|
145
|
+
exports.default = AssetHubNftsPalletApi;
|
|
@@ -5,13 +5,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
8
9
|
var _nft = require("@subwallet/extension-base/koni/api/nft/nft");
|
|
9
10
|
var _utils = require("@subwallet/extension-base/utils");
|
|
10
11
|
var _crossFetch = _interopRequireDefault(require("cross-fetch"));
|
|
11
12
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
12
13
|
// SPDX-License-Identifier: Apache-2.0
|
|
13
14
|
|
|
14
|
-
class
|
|
15
|
+
class AssetHubUniquesPalletApi extends _nft.BaseNftApi {
|
|
15
16
|
// eslint-disable-next-line no-useless-constructor
|
|
16
17
|
constructor(api, addresses, chain) {
|
|
17
18
|
super(chain, api, addresses);
|
|
@@ -112,7 +113,8 @@ class StatemineNftApi extends _nft.BaseNftApi {
|
|
|
112
113
|
image: tokenInfo && tokenInfo.image ? this.parseUrl(tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.image) : undefined,
|
|
113
114
|
collectionId: this.parseTokenId(parsedClassId),
|
|
114
115
|
chain: this.chain,
|
|
115
|
-
owner: address
|
|
116
|
+
owner: address,
|
|
117
|
+
assetHubType: _KoniTypes.AssetHubNftType.UNIQUES
|
|
116
118
|
};
|
|
117
119
|
params.updateItem(this.chain, parsedNft, address);
|
|
118
120
|
const parsedCollection = {
|
|
@@ -140,4 +142,4 @@ class StatemineNftApi extends _nft.BaseNftApi {
|
|
|
140
142
|
return 1;
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
|
-
exports.default =
|
|
145
|
+
exports.default = AssetHubUniquesPalletApi;
|
|
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.NftHandler = void 0;
|
|
8
8
|
var _acala_nft = require("@subwallet/extension-base/koni/api/nft/acala_nft");
|
|
9
|
+
var _assethub_unique = _interopRequireDefault(require("@subwallet/extension-base/koni/api/nft/assethub_unique"));
|
|
9
10
|
var _bit = require("@subwallet/extension-base/koni/api/nft/bit.country");
|
|
10
11
|
var _evm_nft = require("@subwallet/extension-base/koni/api/nft/evm_nft");
|
|
11
12
|
var _karura_nft = require("@subwallet/extension-base/koni/api/nft/karura_nft");
|
|
12
13
|
var _ordinal_nft = _interopRequireDefault(require("@subwallet/extension-base/koni/api/nft/ordinal_nft"));
|
|
13
14
|
var _rmrk_nft = require("@subwallet/extension-base/koni/api/nft/rmrk_nft");
|
|
14
|
-
var _statemine_nft = _interopRequireDefault(require("@subwallet/extension-base/koni/api/nft/statemine_nft"));
|
|
15
15
|
var _unique_network_nft = require("@subwallet/extension-base/koni/api/nft/unique_network_nft");
|
|
16
16
|
var _vara_nft = require("@subwallet/extension-base/koni/api/nft/vara_nft");
|
|
17
17
|
var _wasm_nft = require("@subwallet/extension-base/koni/api/nft/wasm_nft");
|
|
18
18
|
var _constants = require("@subwallet/extension-base/services/chain-service/constants");
|
|
19
19
|
var _utils = require("@subwallet/extension-base/services/chain-service/utils");
|
|
20
20
|
var _utils2 = require("@subwallet/extension-base/utils");
|
|
21
|
-
var
|
|
21
|
+
var _assethub_nft = _interopRequireDefault(require("./assethub_nft"));
|
|
22
22
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
23
23
|
// SPDX-License-Identifier: Apache-2.0
|
|
24
24
|
|
|
@@ -27,21 +27,21 @@ var _statemint_nft = _interopRequireDefault(require("./statemint_nft"));
|
|
|
27
27
|
function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
28
28
|
const [substrateAddresses] = (0, _utils2.categoryAddresses)(addresses);
|
|
29
29
|
if (_constants._NFT_CHAIN_GROUP.acala.includes(chain)) {
|
|
30
|
-
return new _acala_nft.AcalaNftApi(substrateApi, substrateAddresses, chain);
|
|
30
|
+
return [new _acala_nft.AcalaNftApi(substrateApi, substrateAddresses, chain)];
|
|
31
31
|
} else if (_constants._NFT_CHAIN_GROUP.karura.includes(chain)) {
|
|
32
|
-
return new _karura_nft.KaruraNftApi(substrateApi, substrateAddresses, chain);
|
|
32
|
+
return [new _karura_nft.KaruraNftApi(substrateApi, substrateAddresses, chain)];
|
|
33
33
|
} else if (_constants._NFT_CHAIN_GROUP.rmrk.includes(chain)) {
|
|
34
|
-
return new _rmrk_nft.RmrkNftApi(substrateAddresses, chain);
|
|
34
|
+
return [new _rmrk_nft.RmrkNftApi(substrateAddresses, chain)];
|
|
35
35
|
} else if (_constants._NFT_CHAIN_GROUP.statemine.includes(chain)) {
|
|
36
|
-
return new
|
|
36
|
+
return [new _assethub_unique.default(substrateApi, substrateAddresses, chain), new _assethub_nft.default(substrateApi, substrateAddresses, chain)];
|
|
37
37
|
} else if (_constants._NFT_CHAIN_GROUP.statemint.includes(chain)) {
|
|
38
|
-
return new
|
|
38
|
+
return [new _assethub_unique.default(substrateApi, substrateAddresses, chain), new _assethub_nft.default(substrateApi, substrateAddresses, chain)];
|
|
39
39
|
} else if (_constants._NFT_CHAIN_GROUP.unique_network.includes(chain)) {
|
|
40
|
-
return new _unique_network_nft.UniqueNftApi(chain, substrateAddresses);
|
|
40
|
+
return [new _unique_network_nft.UniqueNftApi(chain, substrateAddresses)];
|
|
41
41
|
} else if (_constants._NFT_CHAIN_GROUP.bitcountry.includes(chain)) {
|
|
42
|
-
return new _bit.BitCountryNftApi(substrateApi, substrateAddresses, chain);
|
|
42
|
+
return [new _bit.BitCountryNftApi(substrateApi, substrateAddresses, chain)];
|
|
43
43
|
} else if (_constants._NFT_CHAIN_GROUP.vara.includes(chain)) {
|
|
44
|
-
return new _vara_nft.VaraNftApi(chain, substrateAddresses);
|
|
44
|
+
return [new _vara_nft.VaraNftApi(chain, substrateAddresses)];
|
|
45
45
|
}
|
|
46
46
|
return null;
|
|
47
47
|
}
|
|
@@ -114,9 +114,9 @@ class NftHandler {
|
|
|
114
114
|
let [chain, chainInfo] = _ref;
|
|
115
115
|
if ((0, _utils._isChainSupportNativeNft)(chainInfo)) {
|
|
116
116
|
if (this.substrateApiMap[chain]) {
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
this.handlers.push(
|
|
117
|
+
const handlers = createSubstrateNftApi(chain, this.substrateApiMap[chain], substrateAddresses);
|
|
118
|
+
if (handlers && !!handlers.length) {
|
|
119
|
+
this.handlers.push(...handlers);
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
}
|
package/cjs/koni/api/nft/nft.js
CHANGED
|
@@ -4,12 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.acalaGetExtrinsic = acalaGetExtrinsic;
|
|
7
|
+
exports.assetHubGetExtrinsic = assetHubGetExtrinsic;
|
|
7
8
|
exports.getNftTransferExtrinsic = getNftTransferExtrinsic;
|
|
8
9
|
exports.isRecipientSelf = isRecipientSelf;
|
|
9
10
|
exports.rmrkGetExtrinsic = rmrkGetExtrinsic;
|
|
10
|
-
exports.statemineGetExtrinsic = statemineGetExtrinsic;
|
|
11
|
-
exports.statemintGetExtrinsic = statemintGetExtrinsic;
|
|
12
11
|
exports.uniqueGetExtrinsic = uniqueGetExtrinsic;
|
|
12
|
+
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
13
13
|
var _config = require("@subwallet/extension-base/koni/api/nft/config");
|
|
14
14
|
var _utils = require("@subwallet/extension-base/utils");
|
|
15
15
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
@@ -64,21 +64,17 @@ async function uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress,
|
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function assetHubGetExtrinsic(substrateApi, senderAddress, recipientAddress, params) {
|
|
68
68
|
try {
|
|
69
69
|
const itemId = params.itemId;
|
|
70
70
|
const collectionId = params.collectionId;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
const nftType = params.assetHubType;
|
|
72
|
+
if (nftType === _KoniTypes.AssetHubNftType.NFTS) {
|
|
73
|
+
return substrateApi.api.tx.nfts.transfer(collectionId, itemId, recipientAddress);
|
|
74
|
+
} else if (nftType === _KoniTypes.AssetHubNftType.UNIQUES) {
|
|
75
|
+
return substrateApi.api.tx.uniques.transfer(collectionId, itemId, recipientAddress);
|
|
76
|
+
}
|
|
74
77
|
return null;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
function statemintGetExtrinsic(substrateApi, senderAddress, recipientAddress, params) {
|
|
78
|
-
try {
|
|
79
|
-
const itemId = params.itemId;
|
|
80
|
-
const collectionId = params.collectionId;
|
|
81
|
-
return substrateApi.api.tx.nfts.transfer(collectionId, itemId, recipientAddress);
|
|
82
78
|
} catch (e) {
|
|
83
79
|
console.error(e);
|
|
84
80
|
return null;
|
|
@@ -99,9 +95,9 @@ async function getNftTransferExtrinsic(networkKey, substrateApi, senderAddress,
|
|
|
99
95
|
case _config.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.opal:
|
|
100
96
|
return await uniqueGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
101
97
|
case _config.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.statemine:
|
|
102
|
-
return
|
|
98
|
+
return assetHubGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
103
99
|
case _config.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.statemint:
|
|
104
|
-
return
|
|
100
|
+
return assetHubGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
105
101
|
case _config.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.bitcountry:
|
|
106
102
|
return acalaGetExtrinsic(substrateApi, senderAddress, recipientAddress, params);
|
|
107
103
|
case _config.SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME.pioneer:
|
|
@@ -1227,17 +1227,34 @@ class KoniState {
|
|
|
1227
1227
|
maxFeePerGas: autoFormatNumber(transactionParams.maxFeePerGas),
|
|
1228
1228
|
data: transactionParams.data
|
|
1229
1229
|
};
|
|
1230
|
+
const getTransactionGas = async () => {
|
|
1231
|
+
try {
|
|
1232
|
+
transaction.gas = await web3.eth.estimateGas({
|
|
1233
|
+
...transaction
|
|
1234
|
+
});
|
|
1235
|
+
} catch (e) {
|
|
1236
|
+
// @ts-ignore
|
|
1237
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1238
|
+
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, e === null || e === void 0 ? void 0 : e.message);
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1230
1241
|
|
|
1231
1242
|
// Calculate transaction data
|
|
1232
1243
|
try {
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1244
|
+
await Promise.race([getTransactionGas(), (0, _utils3.wait)(3000).then(async () => {
|
|
1245
|
+
if (!transaction.gas) {
|
|
1246
|
+
await this.chainService.initSingleApi(networkKey);
|
|
1247
|
+
await getTransactionGas();
|
|
1248
|
+
}
|
|
1249
|
+
})]);
|
|
1236
1250
|
} catch (e) {
|
|
1237
1251
|
// @ts-ignore
|
|
1238
1252
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
1239
1253
|
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS, e === null || e === void 0 ? void 0 : e.message);
|
|
1240
1254
|
}
|
|
1255
|
+
if (!transaction.gas) {
|
|
1256
|
+
throw new _EvmProviderError.EvmProviderError(_KoniTypes.EvmProviderErrorType.INVALID_PARAMS);
|
|
1257
|
+
}
|
|
1241
1258
|
let estimateGas;
|
|
1242
1259
|
|
|
1243
1260
|
// TODO: Review, If not override, transaction maybe fail because fee too low
|
package/cjs/packageInfo.js
CHANGED
|
@@ -84,7 +84,8 @@ const _STAKING_ERA_LENGTH_MAP = {
|
|
|
84
84
|
shiden: 24,
|
|
85
85
|
shibuya: 24,
|
|
86
86
|
bifrost_testnet: 0.5,
|
|
87
|
-
bifrost:
|
|
87
|
+
bifrost: 13 * 600 / 3600,
|
|
88
|
+
// real blocktime of bifros ksm = 13s
|
|
88
89
|
bifrost_dot: 24,
|
|
89
90
|
ternoa: 24,
|
|
90
91
|
calamari: 6,
|
|
@@ -101,7 +102,8 @@ const _STAKING_ERA_LENGTH_MAP = {
|
|
|
101
102
|
goldberg_testnet: 24,
|
|
102
103
|
manta_network: 6,
|
|
103
104
|
krest_network: 4,
|
|
104
|
-
polimec: 6
|
|
105
|
+
polimec: 6,
|
|
106
|
+
enjin_relaychain: 24
|
|
105
107
|
};
|
|
106
108
|
exports._STAKING_ERA_LENGTH_MAP = _STAKING_ERA_LENGTH_MAP;
|
|
107
109
|
const _EXPECTED_BLOCK_TIME = {
|
|
@@ -119,7 +121,19 @@ const _EXPECTED_BLOCK_TIME = {
|
|
|
119
121
|
creditcoin: 12,
|
|
120
122
|
vara_network: 3,
|
|
121
123
|
goldberg_testnet: 20,
|
|
122
|
-
polimec: 12
|
|
124
|
+
polimec: 12,
|
|
125
|
+
bifrost: 13,
|
|
126
|
+
// expect 12 but actual 13
|
|
127
|
+
moonbeam: 12,
|
|
128
|
+
moonriver: 12,
|
|
129
|
+
moonbase: 6,
|
|
130
|
+
turing: 12,
|
|
131
|
+
turingStaging: 12,
|
|
132
|
+
bifrost_testnet: 3,
|
|
133
|
+
calamari: 12,
|
|
134
|
+
calamari_test: 12,
|
|
135
|
+
manta_network: 12,
|
|
136
|
+
enjin_relaychain: 6
|
|
123
137
|
};
|
|
124
138
|
exports._EXPECTED_BLOCK_TIME = _EXPECTED_BLOCK_TIME;
|
|
125
139
|
const _PARACHAIN_INFLATION_DISTRIBUTION = {
|
|
@@ -631,6 +631,15 @@ class ChainService {
|
|
|
631
631
|
}
|
|
632
632
|
}));
|
|
633
633
|
}
|
|
634
|
+
async initSingleApi(slug) {
|
|
635
|
+
const chainInfoMap = this.getChainInfoMap();
|
|
636
|
+
const chainStateMap = this.getChainStateMap();
|
|
637
|
+
if (!chainStateMap[slug].active) {
|
|
638
|
+
return false;
|
|
639
|
+
}
|
|
640
|
+
await this.initApiForChain(chainInfoMap[slug]);
|
|
641
|
+
return true;
|
|
642
|
+
}
|
|
634
643
|
async initApiForChain(chainInfo) {
|
|
635
644
|
const {
|
|
636
645
|
endpoint,
|
|
@@ -137,27 +137,25 @@ class AmplitudeNativeStakingPoolHandler extends _basePara.default {
|
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
139
|
if (hasUnstakingInfo) {
|
|
140
|
-
const
|
|
141
|
-
const
|
|
142
|
-
const
|
|
140
|
+
const [_currentBlock, _currentTimestamp] = await Promise.all([substrateApi.api.query.system.number(), substrateApi.api.query.timestamp.now()]);
|
|
141
|
+
const currentBlock = _currentBlock.toPrimitive();
|
|
142
|
+
const currentTimestamp = _currentTimestamp.toPrimitive();
|
|
143
143
|
const _blockPerRound = substrateApi.api.consts.parachainStaking.defaultBlocksPerRound.toString();
|
|
144
144
|
const blockPerRound = parseFloat(_blockPerRound);
|
|
145
145
|
for (const [unstakingBlock, unstakingAmount] of Object.entries(unstakingInfo)) {
|
|
146
146
|
const blockDuration = (_constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug] || _constants._STAKING_ERA_LENGTH_MAP.default) / blockPerRound; // in hours
|
|
147
147
|
|
|
148
|
-
const isClaimable = parseInt(unstakingBlock) -
|
|
149
|
-
const remainingBlock = parseInt(unstakingBlock) -
|
|
148
|
+
const isClaimable = parseInt(unstakingBlock) - currentBlock <= 0;
|
|
149
|
+
const remainingBlock = parseInt(unstakingBlock) - currentBlock;
|
|
150
150
|
const waitingTime = remainingBlock * blockDuration;
|
|
151
|
-
|
|
152
|
-
// const targetTimestampMs = currentTimestampMs + waitingTime * 60 * 60 * 1000;
|
|
153
|
-
|
|
151
|
+
const targetTimestampMs = remainingBlock * blockDuration * 3600 * 1000 + currentTimestamp;
|
|
154
152
|
unstakingBalance = unstakingAmount.toString();
|
|
155
153
|
unstakingList.push({
|
|
156
154
|
chain: chainInfo.slug,
|
|
157
155
|
status: isClaimable ? _types.UnstakingStatus.CLAIMABLE : _types.UnstakingStatus.UNLOCKING,
|
|
158
156
|
claimable: unstakingAmount.toString(),
|
|
159
157
|
waitingTime,
|
|
160
|
-
|
|
158
|
+
targetTimestampMs: targetTimestampMs,
|
|
161
159
|
validatorAddress: undefined
|
|
162
160
|
});
|
|
163
161
|
}
|
|
@@ -144,7 +144,9 @@ class ParaNativeStakingPoolHandler extends _basePara.default {
|
|
|
144
144
|
const roundInfo = _roundInfo.toPrimitive();
|
|
145
145
|
const currentRound = roundInfo.current;
|
|
146
146
|
await Promise.all(delegatorState.delegations.map(async delegation => {
|
|
147
|
-
const [_delegationScheduledRequests, [identity], _collatorInfo] = await Promise.all([substrateApi.api.query.parachainStaking.delegationScheduledRequests(delegation.owner), (0, _utils2.parseIdentity)(substrateApi, delegation.owner), substrateApi.api.query.parachainStaking.candidateInfo(delegation.owner)]);
|
|
147
|
+
const [_delegationScheduledRequests, [identity], _collatorInfo, _currentBlock, _currentTimestamp] = await Promise.all([substrateApi.api.query.parachainStaking.delegationScheduledRequests(delegation.owner), (0, _utils2.parseIdentity)(substrateApi, delegation.owner), substrateApi.api.query.parachainStaking.candidateInfo(delegation.owner), substrateApi.api.query.system.number(), substrateApi.api.query.timestamp.now()]);
|
|
148
|
+
const currentBlock = _currentBlock.toPrimitive();
|
|
149
|
+
const currentTimestamp = _currentTimestamp.toPrimitive();
|
|
148
150
|
const collatorInfo = _collatorInfo.toPrimitive();
|
|
149
151
|
const minDelegation = collatorInfo === null || collatorInfo === void 0 ? void 0 : collatorInfo.lowestTopDelegationAmount.toString();
|
|
150
152
|
const delegationScheduledRequests = _delegationScheduledRequests.toPrimitive();
|
|
@@ -156,22 +158,23 @@ class ParaNativeStakingPoolHandler extends _basePara.default {
|
|
|
156
158
|
for (const scheduledRequest of delegationScheduledRequests) {
|
|
157
159
|
if ((0, _utils3.reformatAddress)(scheduledRequest.delegator, 0) === (0, _utils3.reformatAddress)(address, 0)) {
|
|
158
160
|
// add network prefix
|
|
159
|
-
const isClaimable = scheduledRequest.whenExecutable - currentRound <= 0;
|
|
160
|
-
const remainingEra = scheduledRequest.whenExecutable - currentRound;
|
|
161
|
+
const isClaimable = scheduledRequest.whenExecutable - parseInt(currentRound) <= 0;
|
|
162
|
+
const remainingEra = scheduledRequest.whenExecutable - parseInt(currentRound);
|
|
161
163
|
const waitingTime = remainingEra * _constants._STAKING_ERA_LENGTH_MAP[chainInfo.slug];
|
|
162
164
|
const claimable = Object.values(scheduledRequest.action)[0];
|
|
163
|
-
// const currentTimestampMs = Date.now();
|
|
164
|
-
// const targetTimestampMs = currentTimestampMs + waitingTime * 60 * 60 * 1000;
|
|
165
165
|
|
|
166
|
+
// noted: target timestamp in parachainStaking easily volatile if block time volatile
|
|
167
|
+
const targetBlock = remainingEra * parseInt(roundInfo.length) + parseInt(roundInfo.first);
|
|
168
|
+
const remainingBlock = targetBlock - currentBlock;
|
|
169
|
+
const targetTimestampMs = remainingBlock * _constants._EXPECTED_BLOCK_TIME[chainInfo.slug] * 1000 + currentTimestamp;
|
|
166
170
|
unstakingMap[delegation.owner] = {
|
|
167
171
|
chain: chainInfo.slug,
|
|
168
172
|
status: isClaimable ? _types.UnstakingStatus.CLAIMABLE : _types.UnstakingStatus.UNLOCKING,
|
|
169
173
|
validatorAddress: delegation.owner,
|
|
170
174
|
claimable: claimable.toString(),
|
|
171
|
-
waitingTime
|
|
172
|
-
|
|
175
|
+
waitingTime,
|
|
176
|
+
targetTimestampMs: targetTimestampMs
|
|
173
177
|
};
|
|
174
|
-
|
|
175
178
|
hasUnstaking = true;
|
|
176
179
|
break; // only handle 1 scheduledRequest per collator
|
|
177
180
|
}
|
|
@@ -51,13 +51,16 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
51
51
|
await defaultCallback();
|
|
52
52
|
await substrateApi.isReady;
|
|
53
53
|
const unsub = await ((_substrateApi$api$que = substrateApi.api.query.staking) === null || _substrateApi$api$que === void 0 ? void 0 : _substrateApi$api$que.currentEra(async _currentEra => {
|
|
54
|
-
var _substrateApi$api$con, _substrateApi$api$con2, _substrateApi$api$que2, _substrateApi$api$que3, _substrateApi$api$que4, _substrateApi$api$que5, _substrateApi$api$que6;
|
|
54
|
+
var _substrateApi$api$con, _substrateApi$api$con2, _substrateApi$api$cal, _substrateApi$api$que2, _substrateApi$api$que3, _substrateApi$api$que4, _substrateApi$api$que5, _substrateApi$api$que6;
|
|
55
55
|
if (cancel) {
|
|
56
56
|
unsub();
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
|
+
let maxNominations = ((_substrateApi$api$con = substrateApi.api.consts.staking) === null || _substrateApi$api$con === void 0 ? void 0 : (_substrateApi$api$con2 = _substrateApi$api$con.maxNominations) === null || _substrateApi$api$con2 === void 0 ? void 0 : _substrateApi$api$con2.toString()) || '16';
|
|
60
|
+
const _maxNominationsByNominationQuota = await ((_substrateApi$api$cal = substrateApi.api.call.stakingApi) === null || _substrateApi$api$cal === void 0 ? void 0 : _substrateApi$api$cal.nominationsQuota(0)); // todo: review param. Currently return constant for all param.
|
|
61
|
+
const maxNominationsByNominationQuota = _maxNominationsByNominationQuota === null || _maxNominationsByNominationQuota === void 0 ? void 0 : _maxNominationsByNominationQuota.toString();
|
|
62
|
+
maxNominations = maxNominationsByNominationQuota !== null && maxNominationsByNominationQuota !== void 0 ? maxNominationsByNominationQuota : maxNominations;
|
|
59
63
|
const currentEra = _currentEra.toString();
|
|
60
|
-
const maxNominations = ((_substrateApi$api$con = substrateApi.api.consts.staking) === null || _substrateApi$api$con === void 0 ? void 0 : (_substrateApi$api$con2 = _substrateApi$api$con.maxNominations) === null || _substrateApi$api$con2 === void 0 ? void 0 : _substrateApi$api$con2.toString()) || '16'; // TODO
|
|
61
64
|
const maxUnlockingChunks = substrateApi.api.consts.staking.maxUnlockingChunks.toString();
|
|
62
65
|
const unlockingEras = substrateApi.api.consts.staking.bondingDuration.toString();
|
|
63
66
|
const maxSupportedEras = substrateApi.api.consts.staking.historyDepth.toString();
|
|
@@ -146,9 +149,20 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
146
149
|
const validatorList = nominations.targets;
|
|
147
150
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
148
151
|
let nominationStatus = _types.EarningStatus.NOT_EARNING;
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
+
let eraStakerOtherList = [];
|
|
153
|
+
let identity;
|
|
154
|
+
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
155
|
+
// todo: review all relaychains later
|
|
156
|
+
const [[_identity], _eraStaker] = await Promise.all([(0, _utils3.parseIdentity)(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress)]);
|
|
157
|
+
identity = _identity;
|
|
158
|
+
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|
|
159
|
+
} else {
|
|
160
|
+
const [[_identity], _eraStaker] = await Promise.all([(0, _utils3.parseIdentity)(substrateApi, validatorAddress), substrateApi.api.query.staking.erasStakers(currentEra, validatorAddress)]);
|
|
161
|
+
identity = _identity;
|
|
162
|
+
const eraStaker = _eraStaker.toPrimitive();
|
|
163
|
+
eraStakerOtherList = eraStaker.others;
|
|
164
|
+
}
|
|
165
|
+
const sortedNominators = eraStakerOtherList.sort((a, b) => {
|
|
152
166
|
return new _bignumber.default(b.value).minus(a.value).toNumber();
|
|
153
167
|
});
|
|
154
168
|
const topNominators = sortedNominators.map(nominator => {
|
|
@@ -290,7 +304,14 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
290
304
|
const maxEraRewardPointsEras = _constants2.MaxEraRewardPointsEras;
|
|
291
305
|
const endEraForPoints = parseInt(activeEra) - 1;
|
|
292
306
|
let startEraForPoints = endEraForPoints - maxEraRewardPointsEras + 1;
|
|
293
|
-
|
|
307
|
+
let _eraStakersPromise;
|
|
308
|
+
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
309
|
+
// todo: review all relaychains later
|
|
310
|
+
_eraStakersPromise = chainApi.api.query.staking.erasStakersOverview.entries(parseInt(currentEra));
|
|
311
|
+
} else {
|
|
312
|
+
_eraStakersPromise = chainApi.api.query.staking.erasStakers.entries(parseInt(currentEra));
|
|
313
|
+
}
|
|
314
|
+
const [_totalEraStake, _eraStakers, _minBond, _stakingRewards, _validators, ..._eraRewardPoints] = await Promise.all([chainApi.api.query.staking.erasTotalStake(parseInt(currentEra)), _eraStakersPromise, chainApi.api.query.staking.minNominatorBond(), ((_chainApi$api$query$s = chainApi.api.query.stakingRewards) === null || _chainApi$api$query$s === void 0 ? void 0 : _chainApi$api$query$s.data) && chainApi.api.query.stakingRewards.data(), chainApi.api.query.staking.validators.entries(), chainApi.api.query.staking.erasRewardPoints.multi([...Array(maxEraRewardPointsEras).keys()].map(i => i + startEraForPoints))]);
|
|
294
315
|
const eraRewardMap = {};
|
|
295
316
|
for (const item of _eraRewardPoints[0]) {
|
|
296
317
|
eraRewardMap[startEraForPoints] = item.toHuman();
|
|
@@ -316,11 +337,11 @@ class RelayNativeStakingPoolHandler extends _base.default {
|
|
|
316
337
|
const unlimitedNominatorRewarded = chainApi.api.consts.staking.maxExposurePageSize !== undefined;
|
|
317
338
|
const maxNominatorRewarded = (chainApi.api.consts.staking.maxNominatorRewardedPerValidator || 0).toString();
|
|
318
339
|
const bnTotalEraStake = new _util.BN(_totalEraStake.toString());
|
|
319
|
-
const eraStakers = _eraStakers;
|
|
320
340
|
const rawMinBond = _minBond.toHuman();
|
|
321
341
|
const minBond = rawMinBond.replaceAll(',', '');
|
|
322
342
|
const totalStakeMap = {};
|
|
323
343
|
const bnDecimals = new _util.BN((10 ** decimals).toString());
|
|
344
|
+
const eraStakers = _eraStakers;
|
|
324
345
|
for (const item of eraStakers) {
|
|
325
346
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access
|
|
326
347
|
const rawValidatorInfo = item[0].toHuman();
|
|
@@ -166,9 +166,17 @@ class NominationPoolHandler extends _base.default {
|
|
|
166
166
|
if (nominations) {
|
|
167
167
|
const validatorList = nominations.targets;
|
|
168
168
|
await Promise.all(validatorList.map(async validatorAddress => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
let eraStakerOtherList = [];
|
|
170
|
+
if (['kusama', 'polkadot', 'westend'].includes(this.chain)) {
|
|
171
|
+
// todo: review all relaychains later
|
|
172
|
+
const _eraStaker = await substrateApi.api.query.staking.erasStakersPaged.entries(currentEra, validatorAddress);
|
|
173
|
+
eraStakerOtherList = _eraStaker.flatMap(paged => paged[1].toPrimitive().others);
|
|
174
|
+
} else {
|
|
175
|
+
const _eraStaker = await substrateApi.api.query.staking.erasStakers(currentEra, validatorAddress);
|
|
176
|
+
const eraStaker = _eraStaker.toPrimitive();
|
|
177
|
+
eraStakerOtherList = eraStaker.others;
|
|
178
|
+
}
|
|
179
|
+
const sortedNominators = eraStakerOtherList.sort((a, b) => {
|
|
172
180
|
return new _bignumber.default(b.value).minus(a.value).toNumber();
|
|
173
181
|
});
|
|
174
182
|
const topNominators = sortedNominators.map(nominator => {
|
|
@@ -404,7 +404,6 @@ class EarningService {
|
|
|
404
404
|
const removeKeys = [];
|
|
405
405
|
chains && chains.length > 0 && Object.entries(this.yieldPositionSubject.getValue()).forEach(_ref => {
|
|
406
406
|
let [key, value] = _ref;
|
|
407
|
-
console.log('removeYieldPositions', key, value.chain, chains.indexOf(value.chain) > -1);
|
|
408
407
|
if (chains.indexOf(value.chain) > -1 && !removeKeys.includes(key)) {
|
|
409
408
|
removeKeys.push(key);
|
|
410
409
|
}
|
|
@@ -81,12 +81,12 @@ async function parseIdentity(substrateApi, address, children) {
|
|
|
81
81
|
const _identity = await substrateApi.api.query.identity.identityOf(address);
|
|
82
82
|
const identityInfo = _identity.toHuman();
|
|
83
83
|
if (identityInfo) {
|
|
84
|
-
var _identityInfo$info, _identityInfo$info$di, _identityInfo$info2, _identityInfo$info2$w, _identityInfo$info3, _identityInfo$info3$r, _identityInfo$info4, _identityInfo$info4$t;
|
|
84
|
+
var _identityInfo$info, _identityInfo$info$di, _identityInfo$info2, _identityInfo$info2$w, _identityInfo$info3, _identityInfo$info3$r, _identityInfo$info4, _identityInfo$info4$t, _identityInfo$judgeme;
|
|
85
85
|
const displayName = (_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;
|
|
86
86
|
const web = (_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;
|
|
87
87
|
const riot = (_identityInfo$info3 = identityInfo.info) === null || _identityInfo$info3 === void 0 ? void 0 : (_identityInfo$info3$r = _identityInfo$info3.riot) === null || _identityInfo$info3$r === void 0 ? void 0 : _identityInfo$info3$r.Raw;
|
|
88
88
|
const twitter = (_identityInfo$info4 = identityInfo.info) === null || _identityInfo$info4 === void 0 ? void 0 : (_identityInfo$info4$t = _identityInfo$info4.twitter) === null || _identityInfo$info4$t === void 0 ? void 0 : _identityInfo$info4$t.Raw;
|
|
89
|
-
const isReasonable = identityInfo.judgements.length > 0;
|
|
89
|
+
const isReasonable = ((_identityInfo$judgeme = identityInfo.judgements) === null || _identityInfo$judgeme === void 0 ? void 0 : _identityInfo$judgeme.length) > 0;
|
|
90
90
|
if (displayName) {
|
|
91
91
|
identity = (0, _util.isHex)(displayName) ? (0, _util.hexToString)(displayName) : displayName;
|
|
92
92
|
} else {
|
|
@@ -9,10 +9,13 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
9
9
|
// Copyright 2019-2022 @subwallet/extension-base
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
|
|
12
|
+
const PRODUCTION_BRANCHES = ['master', 'webapp', 'webapp-dev'];
|
|
13
|
+
const branchName = process.env.BRANCH_NAME || 'koni-dev';
|
|
14
|
+
const fetchTarget = PRODUCTION_BRANCHES.indexOf(branchName) > -1 ? 'https://static-cache.subwallet.app' : 'https://dev.sw-static-cache.pages.dev';
|
|
12
15
|
async function fetchStaticCache(slug, defaultData) {
|
|
13
16
|
let timeout = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 9000;
|
|
14
17
|
try {
|
|
15
|
-
const rs = await _axios.default.get(
|
|
18
|
+
const rs = await _axios.default.get(`${fetchTarget}/${slug}`, {
|
|
16
19
|
timeout
|
|
17
20
|
});
|
|
18
21
|
return rs.data;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseNftApi, HandleNftParams } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
2
2
|
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
3
|
-
export default class
|
|
3
|
+
export default class AssetHubNftsPalletApi extends BaseNftApi {
|
|
4
4
|
constructor(api: _SubstrateApi | null, addresses: string[], chain: string);
|
|
5
5
|
private getMetadata;
|
|
6
6
|
/**
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
import { AssetHubNftType } from '@subwallet/extension-base/background/KoniTypes';
|
|
4
5
|
import { BaseNftApi } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
5
6
|
import { isUrl } from '@subwallet/extension-base/utils';
|
|
6
7
|
import fetch from 'cross-fetch';
|
|
7
|
-
export default class
|
|
8
|
+
export default class AssetHubNftsPalletApi extends BaseNftApi {
|
|
8
9
|
// eslint-disable-next-line no-useless-constructor
|
|
9
10
|
constructor(api, addresses, chain) {
|
|
10
11
|
super(chain, api, addresses);
|
|
@@ -105,7 +106,8 @@ export default class StatemintNftApi extends BaseNftApi {
|
|
|
105
106
|
image: tokenInfo && tokenInfo.image ? this.parseUrl(tokenInfo === null || tokenInfo === void 0 ? void 0 : tokenInfo.image) : undefined,
|
|
106
107
|
collectionId: this.parseTokenId(parsedClassId),
|
|
107
108
|
chain: this.chain,
|
|
108
|
-
owner: address
|
|
109
|
+
owner: address,
|
|
110
|
+
assetHubType: AssetHubNftType.NFTS
|
|
109
111
|
};
|
|
110
112
|
params.updateItem(this.chain, parsedNft, address);
|
|
111
113
|
const parsedCollection = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseNftApi, HandleNftParams } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
2
2
|
import { _SubstrateApi } from '@subwallet/extension-base/services/chain-service/types';
|
|
3
|
-
export default class
|
|
3
|
+
export default class AssetHubUniquesPalletApi extends BaseNftApi {
|
|
4
4
|
constructor(api: _SubstrateApi | null, addresses: string[], chain: string);
|
|
5
5
|
private getMetadata;
|
|
6
6
|
/**
|