@subwallet/extension-base 1.1.35-0 → 1.1.35-beta.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 +111 -69
- package/background/KoniTypes.js +19 -13
- package/background/errors/TransactionError.js +9 -0
- package/cjs/background/KoniTypes.js +20 -16
- package/cjs/background/errors/TransactionError.js +9 -0
- package/cjs/constants/index.js +19 -4
- package/cjs/koni/api/dotsama/balance.js +464 -0
- package/cjs/koni/api/nft/config.js +33 -23
- package/cjs/koni/api/nft/index.js +14 -0
- package/cjs/koni/api/nft/nft.js +1 -22
- package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
- package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
- package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
- package/cjs/koni/api/staking/bonding/amplitude.js +19 -16
- package/cjs/koni/api/staking/bonding/astar.js +11 -10
- package/cjs/koni/api/staking/bonding/index.js +4 -1
- package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
- package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
- package/cjs/koni/api/staking/bonding/utils.js +104 -86
- package/cjs/koni/api/staking/index.js +6 -5
- package/cjs/koni/api/staking/paraChain.js +6 -5
- package/cjs/koni/api/staking/relayChain.js +3 -2
- package/cjs/koni/api/yield/helper/utils.js +46 -0
- package/cjs/koni/background/cron.js +3 -21
- package/cjs/koni/background/handlers/Extension.js +368 -69
- package/cjs/koni/background/handlers/State.js +18 -12
- package/cjs/koni/background/handlers/index.js +4 -2
- package/cjs/koni/background/subscription.js +7 -104
- package/cjs/services/campaign-service/index.js +9 -6
- package/cjs/services/chain-service/constants.js +1 -16
- package/cjs/services/chain-service/index.js +6 -2
- package/cjs/services/chain-service/utils.js +7 -1
- package/cjs/services/earning-service/constants/chains.js +30 -0
- package/cjs/services/earning-service/constants/index.js +27 -0
- package/cjs/services/earning-service/constants/step.js +18 -0
- package/cjs/services/earning-service/handlers/base.js +262 -0
- package/cjs/services/earning-service/handlers/index.js +60 -0
- package/cjs/services/earning-service/handlers/lending/base.js +81 -0
- package/cjs/services/earning-service/handlers/lending/index.js +13 -0
- package/cjs/services/earning-service/handlers/lending/interlay.js +192 -0
- package/cjs/services/earning-service/handlers/liquid-staking/acala.js +240 -0
- package/cjs/services/earning-service/handlers/liquid-staking/base.js +97 -0
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +140 -0
- package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +298 -0
- package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
- package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +227 -0
- package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +404 -0
- package/cjs/services/earning-service/handlers/native-staking/amplitude.js +434 -0
- package/cjs/services/earning-service/handlers/native-staking/astar.js +466 -0
- package/cjs/services/earning-service/handlers/native-staking/base-para.js +146 -0
- package/cjs/services/earning-service/handlers/native-staking/base.js +161 -0
- package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
- package/cjs/services/earning-service/handlers/native-staking/para-chain.js +390 -0
- package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +567 -0
- package/cjs/services/earning-service/handlers/nomination-pool/index.js +566 -0
- package/cjs/services/earning-service/handlers/special.js +493 -0
- package/cjs/services/earning-service/service.js +733 -0
- package/cjs/services/earning-service/utils/index.js +128 -0
- package/cjs/services/event-service/index.js +5 -0
- package/cjs/services/keyring-service/index.js +14 -2
- package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
- package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
- package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
- package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
- package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
- package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
- package/cjs/services/migration-service/scripts/index.js +6 -1
- package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
- package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
- package/cjs/services/mint-campaign-service/constants.js +11 -0
- package/cjs/services/mint-campaign-service/index.js +18 -0
- package/cjs/services/notification-service/NotificationService.js +3 -2
- package/cjs/services/request-service/handler/PopupHandler.js +2 -3
- package/cjs/services/storage-service/DatabaseService.js +63 -0
- package/cjs/services/storage-service/databases/index.js +4 -0
- package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
- package/cjs/services/storage-service/db-stores/YieldPositionStore.js +71 -0
- package/cjs/services/storage-service/index.js +241 -0
- package/cjs/services/subscan-service/index.js +16 -0
- package/cjs/services/transaction-service/event-parser/index.js +58 -0
- package/cjs/services/transaction-service/helpers/index.js +3 -1
- package/cjs/services/transaction-service/index.js +249 -75
- package/cjs/services/transaction-service/utils.js +1 -0
- package/cjs/types/campaigns/index.js +16 -0
- package/cjs/types/campaigns/unlock-dot.js +1 -0
- package/cjs/types/index.js +44 -0
- package/cjs/types/ordinal.js +1 -0
- package/cjs/types/transaction.js +1 -0
- package/cjs/types/yield/actions/index.js +27 -0
- package/cjs/types/yield/actions/join/index.js +38 -0
- package/cjs/types/yield/actions/join/step.js +47 -0
- package/cjs/types/yield/actions/join/submit.js +1 -0
- package/cjs/types/yield/actions/join/validate.js +16 -0
- package/cjs/types/yield/actions/others.js +1 -0
- package/cjs/types/yield/index.js +27 -0
- package/cjs/types/yield/info/account/index.js +49 -0
- package/cjs/types/yield/info/account/info.js +1 -0
- package/cjs/types/yield/info/account/reward.js +1 -0
- package/cjs/types/yield/info/account/target.js +32 -0
- package/cjs/types/yield/info/account/unstake.js +27 -0
- package/cjs/types/yield/info/base.js +41 -0
- package/cjs/types/yield/info/chain/index.js +27 -0
- package/cjs/types/yield/info/chain/info.js +1 -0
- package/cjs/types/yield/info/chain/target.js +1 -0
- package/cjs/types/yield/info/index.js +49 -0
- package/cjs/types/yield/info/pallet.js +15 -0
- package/cjs/types.js +1 -0
- package/cjs/utils/address.js +34 -0
- package/cjs/utils/environment.js +23 -28
- package/cjs/utils/fetchStaticCache.js +22 -0
- package/cjs/utils/fetchStaticData.js +2 -1
- package/cjs/utils/index.js +94 -10
- package/cjs/utils/keyring.js +57 -0
- package/cjs/utils/mv3.js +14 -0
- package/cjs/utils/number.js +6 -2
- package/cjs/utils/object.js +12 -0
- package/constants/index.d.ts +6 -1
- package/constants/index.js +6 -1
- package/koni/api/nft/config.js +33 -23
- package/koni/api/nft/index.js +15 -1
- package/koni/api/nft/nft.js +2 -23
- package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
- package/koni/api/nft/ordinal_nft/constants.js +12 -0
- package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
- package/koni/api/nft/ordinal_nft/index.js +114 -0
- package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
- package/koni/api/nft/ordinal_nft/utils.js +33 -0
- package/koni/api/staking/bonding/amplitude.js +13 -10
- package/koni/api/staking/bonding/astar.js +9 -8
- package/koni/api/staking/bonding/index.d.ts +1 -1
- package/koni/api/staking/bonding/index.js +5 -1
- package/koni/api/staking/bonding/paraChain.js +12 -10
- package/koni/api/staking/bonding/relayChain.d.ts +2 -2
- package/koni/api/staking/bonding/relayChain.js +33 -30
- package/koni/api/staking/bonding/utils.d.ts +15 -38
- package/koni/api/staking/bonding/utils.js +85 -69
- package/koni/api/staking/index.js +2 -1
- package/koni/api/staking/paraChain.js +7 -6
- package/koni/api/staking/relayChain.js +4 -3
- package/koni/api/yield/helper/utils.d.ts +10 -0
- package/koni/api/yield/helper/utils.js +32 -0
- package/koni/background/cron.d.ts +0 -4
- package/koni/background/cron.js +4 -22
- package/koni/background/handlers/Extension.d.ts +17 -1
- package/koni/background/handlers/Extension.js +327 -30
- package/koni/background/handlers/State.d.ts +6 -1
- package/koni/background/handlers/State.js +17 -12
- package/koni/background/handlers/index.js +4 -2
- package/koni/background/subscription.d.ts +1 -6
- package/koni/background/subscription.js +8 -104
- package/package.json +326 -3
- package/services/campaign-service/index.js +9 -6
- package/services/chain-service/constants.d.ts +0 -12
- package/services/chain-service/constants.js +0 -14
- package/services/chain-service/index.js +6 -2
- package/services/chain-service/utils.d.ts +1 -0
- package/services/chain-service/utils.js +5 -1
- package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
- package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
- package/services/earning-service/constants/chains.d.ts +15 -0
- package/services/earning-service/constants/chains.js +22 -0
- package/services/earning-service/constants/index.d.ts +2 -0
- package/services/earning-service/constants/index.js +5 -0
- package/services/earning-service/constants/step.d.ts +3 -0
- package/services/earning-service/constants/step.js +10 -0
- package/services/earning-service/handlers/base.d.ts +113 -0
- package/services/earning-service/handlers/base.js +256 -0
- package/services/earning-service/handlers/index.d.ts +5 -0
- package/services/earning-service/handlers/index.js +8 -0
- package/services/earning-service/handlers/lending/base.d.ts +8 -0
- package/services/earning-service/handlers/lending/base.js +73 -0
- package/services/earning-service/handlers/lending/index.d.ts +1 -0
- package/services/earning-service/handlers/lending/index.js +4 -0
- package/services/earning-service/handlers/lending/interlay.d.ts +24 -0
- package/services/earning-service/handlers/lending/interlay.js +184 -0
- package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
- package/services/earning-service/handlers/liquid-staking/acala.js +232 -0
- package/services/earning-service/handlers/liquid-staking/base.d.ts +11 -0
- package/services/earning-service/handlers/liquid-staking/base.js +89 -0
- package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +46 -0
- package/services/earning-service/handlers/liquid-staking/bifrost.js +287 -0
- package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
- package/services/earning-service/handlers/liquid-staking/index.js +7 -0
- package/services/earning-service/handlers/liquid-staking/parallel.d.ts +26 -0
- package/services/earning-service/handlers/liquid-staking/parallel.js +219 -0
- package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +34 -0
- package/services/earning-service/handlers/liquid-staking/stella-swap.js +394 -0
- package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
- package/services/earning-service/handlers/native-staking/amplitude.js +425 -0
- package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
- package/services/earning-service/handlers/native-staking/astar.js +456 -0
- package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
- package/services/earning-service/handlers/native-staking/base-para.js +138 -0
- package/services/earning-service/handlers/native-staking/base.d.ts +21 -0
- package/services/earning-service/handlers/native-staking/base.js +152 -0
- package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
- package/services/earning-service/handlers/native-staking/index.js +7 -0
- package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
- package/services/earning-service/handlers/native-staking/para-chain.js +382 -0
- package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
- package/services/earning-service/handlers/native-staking/relay-chain.js +558 -0
- package/services/earning-service/handlers/nomination-pool/index.d.ts +36 -0
- package/services/earning-service/handlers/nomination-pool/index.js +556 -0
- package/services/earning-service/handlers/special.d.ts +64 -0
- package/services/earning-service/handlers/special.js +485 -0
- package/services/earning-service/service.d.ts +94 -0
- package/services/earning-service/service.js +722 -0
- package/services/earning-service/utils/index.d.ts +18 -0
- package/services/earning-service/utils/index.js +112 -0
- package/services/event-service/index.d.ts +2 -0
- package/services/event-service/index.js +5 -0
- package/services/event-service/types.d.ts +9 -0
- package/services/keyring-service/index.d.ts +2 -1
- package/services/keyring-service/index.js +14 -2
- package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
- package/services/migration-service/scripts/DeleteEarningData.js +13 -0
- package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
- package/services/migration-service/scripts/EnableEarningChains.js +13 -0
- package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
- package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
- package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
- package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
- package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
- package/services/migration-service/scripts/index.js +6 -1
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
- package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
- package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
- package/services/mint-campaign-service/campaigns/index.js +4 -0
- package/services/mint-campaign-service/constants.d.ts +1 -0
- package/services/mint-campaign-service/constants.js +4 -0
- package/services/mint-campaign-service/index.d.ts +7 -0
- package/services/mint-campaign-service/index.js +11 -0
- package/services/notification-service/NotificationService.js +3 -2
- package/services/request-service/handler/PopupHandler.js +3 -4
- package/services/storage-service/DatabaseService.d.ts +22 -1
- package/services/storage-service/DatabaseService.js +63 -0
- package/services/storage-service/databases/index.d.ts +3 -1
- package/services/storage-service/databases/index.js +4 -0
- package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
- package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
- package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
- package/services/storage-service/db-stores/YieldPositionStore.d.ts +11 -0
- package/services/storage-service/db-stores/YieldPositionStore.js +63 -0
- package/services/subscan-service/index.d.ts +3 -2
- package/services/subscan-service/index.js +15 -0
- package/services/subscan-service/types.d.ts +20 -0
- package/services/transaction-service/event-parser/index.d.ts +3 -1
- package/services/transaction-service/event-parser/index.js +57 -1
- package/services/transaction-service/helpers/index.js +3 -1
- package/services/transaction-service/index.d.ts +6 -13
- package/services/transaction-service/index.js +247 -73
- package/services/transaction-service/types.d.ts +2 -0
- package/services/transaction-service/utils.js +1 -0
- package/types/campaigns/index.d.ts +1 -0
- package/types/campaigns/index.js +4 -0
- package/types/campaigns/unlock-dot.d.ts +71 -0
- package/types/campaigns/unlock-dot.js +1 -0
- package/types/index.d.ts +5 -0
- package/types/index.js +5 -1
- package/types/ordinal.d.ts +69 -0
- package/types/ordinal.js +1 -0
- package/types/transaction.d.ts +3 -0
- package/types/transaction.js +1 -0
- package/types/yield/actions/index.d.ts +2 -0
- package/types/yield/actions/index.js +5 -0
- package/types/yield/actions/join/index.d.ts +3 -0
- package/types/yield/actions/join/index.js +6 -0
- package/types/yield/actions/join/step.d.ts +95 -0
- package/types/yield/actions/join/step.js +46 -0
- package/types/yield/actions/join/submit.d.ts +58 -0
- package/types/yield/actions/join/submit.js +1 -0
- package/types/yield/actions/join/validate.d.ts +18 -0
- package/types/yield/actions/join/validate.js +10 -0
- package/types/yield/actions/others.d.ts +85 -0
- package/types/yield/actions/others.js +1 -0
- package/types/yield/index.d.ts +2 -0
- package/types/yield/index.js +5 -0
- package/types/yield/info/account/index.d.ts +4 -0
- package/types/yield/info/account/index.js +7 -0
- package/types/yield/info/account/info.d.ts +92 -0
- package/types/yield/info/account/info.js +1 -0
- package/types/yield/info/account/reward.d.ts +47 -0
- package/types/yield/info/account/reward.js +1 -0
- package/types/yield/info/account/target.d.ts +43 -0
- package/types/yield/info/account/target.js +27 -0
- package/types/yield/info/account/unstake.d.ts +31 -0
- package/types/yield/info/account/unstake.js +22 -0
- package/types/yield/info/base.d.ts +45 -0
- package/types/yield/info/base.js +36 -0
- package/types/yield/info/chain/index.d.ts +2 -0
- package/types/yield/info/chain/index.js +5 -0
- package/types/yield/info/chain/info.d.ts +252 -0
- package/types/yield/info/chain/info.js +1 -0
- package/types/yield/info/chain/target.d.ts +37 -0
- package/types/yield/info/chain/target.js +1 -0
- package/types/yield/info/index.d.ts +4 -0
- package/types/yield/info/index.js +7 -0
- package/types/yield/info/pallet.d.ts +143 -0
- package/types/yield/info/pallet.js +9 -0
- package/utils/environment.d.ts +9 -2
- package/utils/environment.js +14 -26
- package/utils/fetchStaticCache.d.ts +1 -0
- package/utils/fetchStaticCache.js +14 -0
- package/utils/fetchStaticData.js +2 -1
- package/utils/index.d.ts +5 -1
- package/utils/index.js +53 -3
- package/utils/mv3.d.ts +2 -0
- package/utils/mv3.js +6 -0
- package/utils/number.d.ts +2 -1
- package/utils/number.js +2 -1
- package/utils/object.d.ts +1 -0
- package/utils/object.js +6 -0
package/cjs/utils/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var _exportNames = {
|
|
|
9
9
|
nonEmptyArr: true,
|
|
10
10
|
isEmptyArray: true,
|
|
11
11
|
isAccountAll: true,
|
|
12
|
-
isMobile: true,
|
|
13
12
|
reformatAddress: true,
|
|
14
13
|
filterAddressByNetworkKey: true,
|
|
15
14
|
categoryAddresses: true,
|
|
@@ -36,9 +35,12 @@ var _exportNames = {
|
|
|
36
35
|
getDomainFromUrl: true,
|
|
37
36
|
waitTimeout: true,
|
|
38
37
|
stripUrl: true,
|
|
38
|
+
baseParseIPFSUrl: true,
|
|
39
|
+
swParseIPFSUrl: true,
|
|
39
40
|
wait: true,
|
|
40
41
|
canDerive: true
|
|
41
42
|
};
|
|
43
|
+
exports.baseParseIPFSUrl = void 0;
|
|
42
44
|
Object.defineProperty(exports, "canDerive", {
|
|
43
45
|
enumerable: true,
|
|
44
46
|
get: function () {
|
|
@@ -57,7 +59,7 @@ exports.hexToStr = hexToStr;
|
|
|
57
59
|
exports.hexToUTF16 = hexToUTF16;
|
|
58
60
|
exports.inJestTest = inJestTest;
|
|
59
61
|
exports.isAccountAll = isAccountAll;
|
|
60
|
-
exports.
|
|
62
|
+
exports.isEmptyArray = exports.isDef = exports.isAddressesEqual = void 0;
|
|
61
63
|
exports.isSameAddress = isSameAddress;
|
|
62
64
|
exports.isUrl = isUrl;
|
|
63
65
|
exports.isValidSubstrateAddress = exports.isValidProvider = void 0;
|
|
@@ -67,13 +69,13 @@ exports.parseRawNumber = parseRawNumber;
|
|
|
67
69
|
exports.reformatAddress = reformatAddress;
|
|
68
70
|
exports.stripUrl = void 0;
|
|
69
71
|
exports.sumBN = sumBN;
|
|
70
|
-
exports.toUnit = void 0;
|
|
72
|
+
exports.toUnit = exports.swParseIPFSUrl = void 0;
|
|
71
73
|
exports.utf16ToString = utf16ToString;
|
|
72
74
|
exports.wait = wait;
|
|
73
75
|
exports.waitTimeout = waitTimeout;
|
|
74
76
|
var _KoniTypes = require("@subwallet/extension-base/background/KoniTypes");
|
|
75
77
|
var _constants = require("@subwallet/extension-base/constants");
|
|
76
|
-
var
|
|
78
|
+
var _config = require("@subwallet/extension-base/koni/api/nft/config");
|
|
77
79
|
var _i18next = require("i18next");
|
|
78
80
|
var _util = require("@polkadot/util");
|
|
79
81
|
var _utilCrypto = require("@polkadot/util-crypto");
|
|
@@ -102,15 +104,27 @@ Object.keys(_array).forEach(function (key) {
|
|
|
102
104
|
}
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
|
-
var
|
|
106
|
-
Object.keys(
|
|
107
|
+
var _environment = require("./environment");
|
|
108
|
+
Object.keys(_environment).forEach(function (key) {
|
|
107
109
|
if (key === "default" || key === "__esModule") return;
|
|
108
110
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
109
|
-
if (key in exports && exports[key] ===
|
|
111
|
+
if (key in exports && exports[key] === _environment[key]) return;
|
|
110
112
|
Object.defineProperty(exports, key, {
|
|
111
113
|
enumerable: true,
|
|
112
114
|
get: function () {
|
|
113
|
-
return
|
|
115
|
+
return _environment[key];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
var _number = require("./number");
|
|
120
|
+
Object.keys(_number).forEach(function (key) {
|
|
121
|
+
if (key === "default" || key === "__esModule") return;
|
|
122
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
123
|
+
if (key in exports && exports[key] === _number[key]) return;
|
|
124
|
+
Object.defineProperty(exports, key, {
|
|
125
|
+
enumerable: true,
|
|
126
|
+
get: function () {
|
|
127
|
+
return _number[key];
|
|
114
128
|
}
|
|
115
129
|
});
|
|
116
130
|
});
|
|
@@ -126,6 +140,18 @@ Object.keys(_lazy).forEach(function (key) {
|
|
|
126
140
|
}
|
|
127
141
|
});
|
|
128
142
|
});
|
|
143
|
+
var _promise = require("./promise");
|
|
144
|
+
Object.keys(_promise).forEach(function (key) {
|
|
145
|
+
if (key === "default" || key === "__esModule") return;
|
|
146
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
147
|
+
if (key in exports && exports[key] === _promise[key]) return;
|
|
148
|
+
Object.defineProperty(exports, key, {
|
|
149
|
+
enumerable: true,
|
|
150
|
+
get: function () {
|
|
151
|
+
return _promise[key];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
129
155
|
var _registry = require("./registry");
|
|
130
156
|
Object.keys(_registry).forEach(function (key) {
|
|
131
157
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -150,6 +176,18 @@ Object.keys(_translate).forEach(function (key) {
|
|
|
150
176
|
}
|
|
151
177
|
});
|
|
152
178
|
});
|
|
179
|
+
var _object = require("./object");
|
|
180
|
+
Object.keys(_object).forEach(function (key) {
|
|
181
|
+
if (key === "default" || key === "__esModule") return;
|
|
182
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
183
|
+
if (key in exports && exports[key] === _object[key]) return;
|
|
184
|
+
Object.defineProperty(exports, key, {
|
|
185
|
+
enumerable: true,
|
|
186
|
+
get: function () {
|
|
187
|
+
return _object[key];
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
});
|
|
153
191
|
var _fetchStaticData = require("./fetchStaticData");
|
|
154
192
|
Object.keys(_fetchStaticData).forEach(function (key) {
|
|
155
193
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -188,8 +226,6 @@ exports.isEmptyArray = isEmptyArray;
|
|
|
188
226
|
function isAccountAll(address) {
|
|
189
227
|
return address === _constants.ALL_ACCOUNT_KEY;
|
|
190
228
|
}
|
|
191
|
-
const isMobile = _KoniTypes.MobileOS.includes((0, _environment.getOS)());
|
|
192
|
-
exports.isMobile = isMobile;
|
|
193
229
|
function reformatAddress(address) {
|
|
194
230
|
let networkPrefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 42;
|
|
195
231
|
let isEthereum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
@@ -474,6 +510,54 @@ const stripUrl = url => {
|
|
|
474
510
|
return parts[2];
|
|
475
511
|
};
|
|
476
512
|
exports.stripUrl = stripUrl;
|
|
513
|
+
const baseParseIPFSUrl = input => {
|
|
514
|
+
if (!input || input.length === 0) {
|
|
515
|
+
return undefined;
|
|
516
|
+
}
|
|
517
|
+
if (isUrl(input)) {
|
|
518
|
+
return input;
|
|
519
|
+
}
|
|
520
|
+
if (isUrl(input) || input.includes('https://') || input.includes('http')) {
|
|
521
|
+
return input;
|
|
522
|
+
}
|
|
523
|
+
if (input.startsWith('/ipfs/')) {
|
|
524
|
+
return (0, _config.getRandomIpfsGateway)() + input.split('/ipfs/')[1];
|
|
525
|
+
}
|
|
526
|
+
if (!input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
527
|
+
// just the IPFS hash
|
|
528
|
+
return (0, _config.getRandomIpfsGateway)() + input;
|
|
529
|
+
}
|
|
530
|
+
if (input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
531
|
+
// starts with ipfs://
|
|
532
|
+
return (0, _config.getRandomIpfsGateway)() + input.split('ipfs://')[1];
|
|
533
|
+
}
|
|
534
|
+
return (0, _config.getRandomIpfsGateway)() + input.split('ipfs://ipfs/')[1]; // starts with ipfs://ipfs/
|
|
535
|
+
};
|
|
536
|
+
exports.baseParseIPFSUrl = baseParseIPFSUrl;
|
|
537
|
+
const swParseIPFSUrl = input => {
|
|
538
|
+
if (!input || input.length === 0) {
|
|
539
|
+
return undefined;
|
|
540
|
+
}
|
|
541
|
+
if (isUrl(input)) {
|
|
542
|
+
return input;
|
|
543
|
+
}
|
|
544
|
+
if (isUrl(input) || input.includes('https://') || input.includes('http')) {
|
|
545
|
+
return input;
|
|
546
|
+
}
|
|
547
|
+
if (input.startsWith('/ipfs/')) {
|
|
548
|
+
return _config.SUBWALLET_IPFS + input.split('/ipfs/')[1];
|
|
549
|
+
}
|
|
550
|
+
if (!input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
551
|
+
// just the IPFS hash
|
|
552
|
+
return _config.SUBWALLET_IPFS + input;
|
|
553
|
+
}
|
|
554
|
+
if (input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
555
|
+
// starts with ipfs://
|
|
556
|
+
return _config.SUBWALLET_IPFS + input.split('ipfs://')[1];
|
|
557
|
+
}
|
|
558
|
+
return _config.SUBWALLET_IPFS + input.split('ipfs://ipfs/')[1]; // starts with ipfs://ipfs/
|
|
559
|
+
};
|
|
560
|
+
exports.swParseIPFSUrl = swParseIPFSUrl;
|
|
477
561
|
function wait(milliseconds) {
|
|
478
562
|
return new Promise(resolve => {
|
|
479
563
|
setTimeout(() => {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.extractPrivateKey = extractPrivateKey;
|
|
7
|
+
exports.unlockAccount = exports.lockAccount = void 0;
|
|
8
|
+
var _uiKeyring = require("@subwallet/ui-keyring");
|
|
9
|
+
// Copyright 2019-2022 @subwallet/extension-base
|
|
10
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
11
|
+
|
|
12
|
+
// import _decode from '@polkadot/keyring/pair/decode';
|
|
13
|
+
|
|
14
|
+
function extract(address) {
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
17
|
+
const rs = this.getPair(address);
|
|
18
|
+
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
20
|
+
console.log(rs.publicKey);
|
|
21
|
+
}
|
|
22
|
+
function extractPrivateKey(keyring, address, password) {
|
|
23
|
+
extract.call(keyring, address);
|
|
24
|
+
}
|
|
25
|
+
const unlockAccount = signAddress => {
|
|
26
|
+
let publicKey;
|
|
27
|
+
try {
|
|
28
|
+
publicKey = _uiKeyring.keyring.decodeAddress(signAddress);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.error(error);
|
|
31
|
+
return 'Unable to decode address';
|
|
32
|
+
}
|
|
33
|
+
const pair = _uiKeyring.keyring.getPair(publicKey);
|
|
34
|
+
if (!pair) {
|
|
35
|
+
return 'Unable to find pair';
|
|
36
|
+
}
|
|
37
|
+
if (pair.isLocked) {
|
|
38
|
+
try {
|
|
39
|
+
_uiKeyring.keyring.unlockPair(pair.address);
|
|
40
|
+
} catch (e) {
|
|
41
|
+
return e.message;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
};
|
|
46
|
+
exports.unlockAccount = unlockAccount;
|
|
47
|
+
const lockAccount = address => {
|
|
48
|
+
try {
|
|
49
|
+
const pair = _uiKeyring.keyring.getPair(address);
|
|
50
|
+
if (pair) {
|
|
51
|
+
pair.lock();
|
|
52
|
+
}
|
|
53
|
+
} catch (error) {
|
|
54
|
+
console.error('Unable to lock account', error);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.lockAccount = lockAccount;
|
package/cjs/utils/mv3.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isSupportWindow = exports.isManifestV3 = void 0;
|
|
7
|
+
var _chrome, _chrome$runtime, _chrome$runtime$getMa;
|
|
8
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
9
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
10
|
+
|
|
11
|
+
const isManifestV3 = ((_chrome = chrome) === null || _chrome === void 0 ? void 0 : (_chrome$runtime = _chrome.runtime) === null || _chrome$runtime === void 0 ? void 0 : (_chrome$runtime$getMa = _chrome$runtime.getManifest()) === null || _chrome$runtime$getMa === void 0 ? void 0 : _chrome$runtime$getMa.manifest_version) === 3;
|
|
12
|
+
exports.isManifestV3 = isManifestV3;
|
|
13
|
+
const isSupportWindow = typeof window !== 'undefined';
|
|
14
|
+
exports.isSupportWindow = isSupportWindow;
|
package/cjs/utils/number.js
CHANGED
|
@@ -4,11 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.toBNString = exports.formatNumber = exports.balanceFormatter = exports.PREDEFINED_FORMATTER = exports.BN_TEN = void 0;
|
|
7
|
+
exports.toBNString = exports.formatNumber = exports.balanceFormatter = exports.PREDEFINED_FORMATTER = exports.BN_ZERO = exports.BN_TEN = void 0;
|
|
8
8
|
var _bignumber = _interopRequireDefault(require("bignumber.js"));
|
|
9
9
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
10
10
|
// SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
|
|
12
|
+
const BN_ZERO = new _bignumber.default(0);
|
|
13
|
+
exports.BN_ZERO = BN_ZERO;
|
|
12
14
|
const BN_TEN = new _bignumber.default(10);
|
|
13
15
|
exports.BN_TEN = BN_TEN;
|
|
14
16
|
// Clear zero from end, use with decimal only
|
|
@@ -105,7 +107,9 @@ const toBNString = (input, decimal) => {
|
|
|
105
107
|
return raw.multipliedBy(BN_TEN.pow(decimal)).toFixed();
|
|
106
108
|
};
|
|
107
109
|
exports.toBNString = toBNString;
|
|
108
|
-
const formatNumber = (input, decimal
|
|
110
|
+
const formatNumber = function (input, decimal) {
|
|
111
|
+
let formatter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : balanceFormatter;
|
|
112
|
+
let metadata = arguments.length > 3 ? arguments[3] : undefined;
|
|
109
113
|
const raw = new _bignumber.default(input).dividedBy(BN_TEN.pow(decimal)).toFixed();
|
|
110
114
|
return formatter(raw, metadata);
|
|
111
115
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isEmptyObject = isEmptyObject;
|
|
7
|
+
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
|
+
|
|
10
|
+
function isEmptyObject(input) {
|
|
11
|
+
return Object.keys(input).length === 0;
|
|
12
|
+
}
|
package/constants/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const BASE_SECOND_INTERVAL = 1000;
|
|
2
|
+
export declare const BASE_MINUTE_INTERVAL: number;
|
|
1
3
|
export declare const CRON_REFRESH_PRICE_INTERVAL = 30000;
|
|
2
4
|
export declare const CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = 60000;
|
|
3
5
|
export declare const CRON_AUTO_RECOVER_WEB3_INTERVAL = 90000;
|
|
@@ -6,7 +8,7 @@ export declare const ASTAR_REFRESH_BALANCE_INTERVAL = 60000;
|
|
|
6
8
|
export declare const SUB_TOKEN_REFRESH_BALANCE_INTERVAL = 60000;
|
|
7
9
|
export declare const CRON_REFRESH_NFT_INTERVAL = 7200000;
|
|
8
10
|
export declare const CRON_REFRESH_STAKING_REWARD_INTERVAL = 900000;
|
|
9
|
-
export declare const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL =
|
|
11
|
+
export declare const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = 90000;
|
|
10
12
|
export declare const CRON_REFRESH_HISTORY_INTERVAL = 900000;
|
|
11
13
|
export declare const CRON_GET_API_MAP_STATUS = 10000;
|
|
12
14
|
export declare const CRON_REFRESH_CHAIN_STAKING_METADATA = 900000;
|
|
@@ -14,6 +16,7 @@ export declare const CRON_REFRESH_CHAIN_NOMINATOR_METADATA = 1800000;
|
|
|
14
16
|
export declare const CRON_RECOVER_HISTORY_INTERVAL = 30000;
|
|
15
17
|
export declare const CRON_SYNC_MANTA_PAY = 300000;
|
|
16
18
|
export declare const MANTA_PAY_BALANCE_INTERVAL = 30000;
|
|
19
|
+
export declare const CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL: number;
|
|
17
20
|
export declare const ALL_ACCOUNT_KEY = "ALL";
|
|
18
21
|
export declare const ALL_NETWORK_KEY = "all";
|
|
19
22
|
export declare const ALL_GENESIS_HASH: null;
|
|
@@ -22,5 +25,7 @@ export declare const IGNORE_QR_SIGNER: string[];
|
|
|
22
25
|
export declare const XCM_MIN_AMOUNT_RATIO = 1.2;
|
|
23
26
|
export declare const GAS_PRICE_RATIO: number;
|
|
24
27
|
export declare const NETWORK_MULTI_GAS_FEE: string[];
|
|
28
|
+
export declare const ORDINAL_COLLECTION = "__Ordinal__";
|
|
29
|
+
export declare const ORDINAL_METHODS: string[];
|
|
25
30
|
export * from './staking';
|
|
26
31
|
export * from './storage';
|
package/constants/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
export const BASE_SECOND_INTERVAL = 1000;
|
|
5
|
+
export const BASE_MINUTE_INTERVAL = 60 * BASE_SECOND_INTERVAL;
|
|
4
6
|
export const CRON_REFRESH_PRICE_INTERVAL = 30000;
|
|
5
7
|
export const CRON_AUTO_RECOVER_DOTSAMA_INTERVAL = 60000;
|
|
6
8
|
export const CRON_AUTO_RECOVER_WEB3_INTERVAL = 90000;
|
|
@@ -9,7 +11,7 @@ export const ASTAR_REFRESH_BALANCE_INTERVAL = 60000;
|
|
|
9
11
|
export const SUB_TOKEN_REFRESH_BALANCE_INTERVAL = 60000;
|
|
10
12
|
export const CRON_REFRESH_NFT_INTERVAL = 7200000;
|
|
11
13
|
export const CRON_REFRESH_STAKING_REWARD_INTERVAL = 900000;
|
|
12
|
-
export const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL =
|
|
14
|
+
export const CRON_REFRESH_STAKING_REWARD_FAST_INTERVAL = 90000;
|
|
13
15
|
export const CRON_REFRESH_HISTORY_INTERVAL = 900000;
|
|
14
16
|
export const CRON_GET_API_MAP_STATUS = 10000;
|
|
15
17
|
export const CRON_REFRESH_CHAIN_STAKING_METADATA = 900000;
|
|
@@ -17,6 +19,7 @@ export const CRON_REFRESH_CHAIN_NOMINATOR_METADATA = 1800000;
|
|
|
17
19
|
export const CRON_RECOVER_HISTORY_INTERVAL = 30000;
|
|
18
20
|
export const CRON_SYNC_MANTA_PAY = 300000;
|
|
19
21
|
export const MANTA_PAY_BALANCE_INTERVAL = 30000;
|
|
22
|
+
export const CRON_REFRESH_EARNING_REWARD_HISTORY_INTERVAL = 15 * BASE_MINUTE_INTERVAL;
|
|
20
23
|
export const ALL_ACCOUNT_KEY = 'ALL';
|
|
21
24
|
export const ALL_NETWORK_KEY = 'all';
|
|
22
25
|
export const ALL_GENESIS_HASH = null;
|
|
@@ -25,5 +28,7 @@ export const IGNORE_QR_SIGNER = [];
|
|
|
25
28
|
export const XCM_MIN_AMOUNT_RATIO = 1.2;
|
|
26
29
|
export const GAS_PRICE_RATIO = 1 + 2 / 100;
|
|
27
30
|
export const NETWORK_MULTI_GAS_FEE = ['*'];
|
|
31
|
+
export const ORDINAL_COLLECTION = '__Ordinal__';
|
|
32
|
+
export const ORDINAL_METHODS = ['drc-20', 'pol-20'];
|
|
28
33
|
export * from "./staking.js";
|
|
29
34
|
export * from "./storage.js";
|
package/koni/api/nft/config.js
CHANGED
|
@@ -15,7 +15,11 @@ export const CLOUDFLARE_PINATA_SERVER = 'https://cloudflare-ipfs.com/ipfs/';
|
|
|
15
15
|
export const BIT_COUNTRY_IPFS_SERVER = 'https://ipfs-cdn.bit.country/';
|
|
16
16
|
export const BIT_COUNTRY_LAND_ESTATE_METADATA_API = 'https://pioneer-api.bit.country/metadata/landTokenUriPioneer';
|
|
17
17
|
export const BIT_COUNTRY_THUMBNAIL_RESOLVER = 'https://res.cloudinary.com/ddftctzph/image/upload/c_scale,q_100,w_250/production-ipfs/asset/';
|
|
18
|
+
|
|
19
|
+
// XOrigin
|
|
18
20
|
export const CF_IPFS_GATEWAY = 'https://cf-ipfs.com/ipfs/';
|
|
21
|
+
|
|
22
|
+
// XOrigin
|
|
19
23
|
export const PINATA_IPFS_GATEWAY = 'https://gateway.pinata.cloud/ipfs/';
|
|
20
24
|
export const UNIQUE_SCAN_ENDPOINT = 'https://explorer-api.unique.network/v1/graphql';
|
|
21
25
|
export const QUARTZ_SCAN_ENDPOINT = 'https://hasura-quartz.unique.network/v1/graphql';
|
|
@@ -24,10 +28,18 @@ export const VARA_SCAN_ENDPOINT = 'https://nft-explorer.vara-network.io/graphql'
|
|
|
24
28
|
// GATEWAY
|
|
25
29
|
|
|
26
30
|
export const UNIQUE_IPFS_GATEWAY = 'https://ipfs.unique.network/ipfs/';
|
|
31
|
+
|
|
32
|
+
// XOrigin
|
|
27
33
|
export const NFT_STORAGE_GATEWAY = 'https://nftstorage.link/ipfs/';
|
|
28
34
|
export const IPFS_W3S_LINK = 'https://w3s.link/ipfs/';
|
|
35
|
+
|
|
36
|
+
// XOrigin
|
|
29
37
|
export const GATEWAY_IPFS_IO = 'https://gateway.ipfs.io/ipfs/';
|
|
38
|
+
|
|
39
|
+
// XOrigin
|
|
30
40
|
export const IPFS_IO = 'https://ipfs.io/ipfs/';
|
|
41
|
+
|
|
42
|
+
// XOrigin
|
|
31
43
|
export const DWEB_LINK = 'https://dweb.link/ipfs/';
|
|
32
44
|
export const IPFS_GATEWAY_4EVERLAND = 'https://4everland.io/ipfs/';
|
|
33
45
|
export const IPFS_FLEEK = 'https://ipfs.fleek.co/ipfs/';
|
|
@@ -83,26 +95,8 @@ export let SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME;
|
|
|
83
95
|
SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME["pioneer"] = "pioneer";
|
|
84
96
|
})(SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME || (SUPPORTED_TRANSFER_SUBSTRATE_CHAIN_NAME = {}));
|
|
85
97
|
const RANDOM_IPFS_GATEWAY_SETTING = [{
|
|
86
|
-
provider: CF_IPFS_GATEWAY,
|
|
87
|
-
weight: 4
|
|
88
|
-
}, {
|
|
89
98
|
provider: CLOUDFLARE_PINATA_SERVER,
|
|
90
99
|
weight: 10
|
|
91
|
-
}, {
|
|
92
|
-
provider: PINATA_IPFS_GATEWAY,
|
|
93
|
-
weight: 1 // Rate limit too low
|
|
94
|
-
}, {
|
|
95
|
-
provider: DWEB_LINK,
|
|
96
|
-
weight: 5
|
|
97
|
-
}, {
|
|
98
|
-
provider: GATEWAY_IPFS_IO,
|
|
99
|
-
weight: 5
|
|
100
|
-
}, {
|
|
101
|
-
provider: IPFS_IO,
|
|
102
|
-
weight: 5
|
|
103
|
-
}, {
|
|
104
|
-
provider: NFT_STORAGE_GATEWAY,
|
|
105
|
-
weight: 50
|
|
106
100
|
}];
|
|
107
101
|
if (isFirefox) {
|
|
108
102
|
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
@@ -110,18 +104,34 @@ if (isFirefox) {
|
|
|
110
104
|
weight: 5000
|
|
111
105
|
});
|
|
112
106
|
}
|
|
113
|
-
if (!RuntimeInfo.protocol || RuntimeInfo.protocol
|
|
107
|
+
if (!RuntimeInfo.protocol || !RuntimeInfo.protocol.startsWith('http') || RuntimeInfo.protocol.startsWith('https')) {
|
|
114
108
|
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
115
109
|
provider: IPFS_FLEEK,
|
|
116
110
|
weight: 4
|
|
117
|
-
}
|
|
118
|
-
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
111
|
+
}, {
|
|
119
112
|
provider: IPFS_GATEWAY_4EVERLAND,
|
|
120
113
|
weight: 2
|
|
121
|
-
}
|
|
122
|
-
RANDOM_IPFS_GATEWAY_SETTING.push({
|
|
114
|
+
}, {
|
|
123
115
|
provider: IPFS_W3S_LINK,
|
|
124
116
|
weight: 1
|
|
117
|
+
}, {
|
|
118
|
+
provider: CF_IPFS_GATEWAY,
|
|
119
|
+
weight: 4
|
|
120
|
+
}, {
|
|
121
|
+
provider: PINATA_IPFS_GATEWAY,
|
|
122
|
+
weight: 1 // Rate limit too low
|
|
123
|
+
}, {
|
|
124
|
+
provider: NFT_STORAGE_GATEWAY,
|
|
125
|
+
weight: 50
|
|
126
|
+
}, {
|
|
127
|
+
provider: GATEWAY_IPFS_IO,
|
|
128
|
+
weight: 5
|
|
129
|
+
}, {
|
|
130
|
+
provider: DWEB_LINK,
|
|
131
|
+
weight: 5
|
|
132
|
+
}, {
|
|
133
|
+
provider: IPFS_IO,
|
|
134
|
+
weight: 5
|
|
125
135
|
});
|
|
126
136
|
}
|
|
127
137
|
const RANDOM_IPFS_GATEWAY_TOTAL_WEIGHT = RANDOM_IPFS_GATEWAY_SETTING.reduce((value, item) => value + item.weight, 0);
|
package/koni/api/nft/index.js
CHANGED
|
@@ -5,13 +5,14 @@ import { AcalaNftApi } from '@subwallet/extension-base/koni/api/nft/acala_nft';
|
|
|
5
5
|
import { BitCountryNftApi } from '@subwallet/extension-base/koni/api/nft/bit.country';
|
|
6
6
|
import { EvmNftApi } from '@subwallet/extension-base/koni/api/nft/evm_nft';
|
|
7
7
|
import { KaruraNftApi } from '@subwallet/extension-base/koni/api/nft/karura_nft';
|
|
8
|
+
import OrdinalNftApi from '@subwallet/extension-base/koni/api/nft/ordinal_nft';
|
|
8
9
|
import { RmrkNftApi } from '@subwallet/extension-base/koni/api/nft/rmrk_nft';
|
|
9
10
|
import StatemineNftApi from '@subwallet/extension-base/koni/api/nft/statemine_nft';
|
|
10
11
|
import UniqueNftApi from '@subwallet/extension-base/koni/api/nft/unique_nft';
|
|
11
12
|
import { VaraNftApi } from '@subwallet/extension-base/koni/api/nft/vara_nft';
|
|
12
13
|
import { WasmNftApi } from '@subwallet/extension-base/koni/api/nft/wasm_nft';
|
|
13
14
|
import { _NFT_CHAIN_GROUP } from '@subwallet/extension-base/services/chain-service/constants';
|
|
14
|
-
import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft } from '@subwallet/extension-base/services/chain-service/utils';
|
|
15
|
+
import { _isChainSupportEvmNft, _isChainSupportNativeNft, _isChainSupportWasmNft, _isSupportOrdinal } from '@subwallet/extension-base/services/chain-service/utils';
|
|
15
16
|
import { categoryAddresses } from '@subwallet/extension-base/utils';
|
|
16
17
|
import StatemintNftApi from "./statemint_nft/index.js";
|
|
17
18
|
function createSubstrateNftApi(chain, substrateApi, addresses) {
|
|
@@ -43,6 +44,9 @@ function createWeb3NftApi(chain, evmApi, addresses) {
|
|
|
43
44
|
const [, evmAddresses] = categoryAddresses(addresses);
|
|
44
45
|
return new EvmNftApi(evmApi, evmAddresses, chain);
|
|
45
46
|
}
|
|
47
|
+
const createOrdinalApi = (chain, subscanChain, addresses) => {
|
|
48
|
+
return new OrdinalNftApi(addresses, chain, subscanChain);
|
|
49
|
+
};
|
|
46
50
|
export class NftHandler {
|
|
47
51
|
// General settings
|
|
48
52
|
chainInfoMap = {};
|
|
@@ -122,6 +126,16 @@ export class NftHandler {
|
|
|
122
126
|
}
|
|
123
127
|
}
|
|
124
128
|
}
|
|
129
|
+
if (_isSupportOrdinal(chain)) {
|
|
130
|
+
var _chainInfo$extraInfo;
|
|
131
|
+
const subscanChain = (_chainInfo$extraInfo = chainInfo.extraInfo) === null || _chainInfo$extraInfo === void 0 ? void 0 : _chainInfo$extraInfo.subscanSlug;
|
|
132
|
+
if (subscanChain) {
|
|
133
|
+
const handler = createOrdinalApi(chain, subscanChain, substrateAddresses);
|
|
134
|
+
if (handler && !this.handlers.includes(handler)) {
|
|
135
|
+
this.handlers.push(handler);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
125
139
|
});
|
|
126
140
|
this.needSetupApi = false;
|
|
127
141
|
}
|
package/koni/api/nft/nft.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
// Copyright 2019-2022 @subwallet/extension-koni authors & contributors
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { isUrl } from '@subwallet/extension-base/utils';
|
|
4
|
+
import { baseParseIPFSUrl } from '@subwallet/extension-base/utils';
|
|
6
5
|
export class BaseNftApi {
|
|
7
6
|
chain = '';
|
|
8
7
|
substrateApi = null;
|
|
@@ -65,27 +64,7 @@ export class BaseNftApi {
|
|
|
65
64
|
return tokenId;
|
|
66
65
|
}
|
|
67
66
|
parseUrl(input) {
|
|
68
|
-
|
|
69
|
-
return undefined;
|
|
70
|
-
}
|
|
71
|
-
if (isUrl(input)) {
|
|
72
|
-
return input;
|
|
73
|
-
}
|
|
74
|
-
if (isUrl(input) || input.includes('https://') || input.includes('http')) {
|
|
75
|
-
return input;
|
|
76
|
-
}
|
|
77
|
-
if (input.startsWith('/ipfs/')) {
|
|
78
|
-
return getRandomIpfsGateway() + input.split('/ipfs/')[1];
|
|
79
|
-
}
|
|
80
|
-
if (!input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
81
|
-
// just the IPFS hash
|
|
82
|
-
return getRandomIpfsGateway() + input;
|
|
83
|
-
}
|
|
84
|
-
if (input.includes('ipfs://') && !input.includes('ipfs://ipfs/')) {
|
|
85
|
-
// starts with ipfs://
|
|
86
|
-
return getRandomIpfsGateway() + input.split('ipfs://')[1];
|
|
87
|
-
}
|
|
88
|
-
return getRandomIpfsGateway() + input.split('ipfs://ipfs/')[1]; // starts with ipfs://ipfs/
|
|
67
|
+
return baseParseIPFSUrl(input);
|
|
89
68
|
}
|
|
90
69
|
|
|
91
70
|
// Subclass implements this function to parse data into prop result
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const GET_EVENT_LIST_API = "https://{{chain}}.api.subscan.io/api/v2/scan/events";
|
|
2
|
+
export declare const GET_EXTRINSIC_PARAMS_API = "https://{{chain}}.api.subscan.io/api/scan/extrinsic/params";
|
|
3
|
+
export declare const BASE_FETCH_ORDINAL_EVENT_DATA: {
|
|
4
|
+
event_id: string;
|
|
5
|
+
module: string;
|
|
6
|
+
order: string;
|
|
7
|
+
success: boolean;
|
|
8
|
+
row: number;
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright 2019-2022 @subwallet/extension-base authors & contributors
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
export const GET_EVENT_LIST_API = 'https://{{chain}}.api.subscan.io/api/v2/scan/events';
|
|
5
|
+
export const GET_EXTRINSIC_PARAMS_API = 'https://{{chain}}.api.subscan.io/api/scan/extrinsic/params';
|
|
6
|
+
export const BASE_FETCH_ORDINAL_EVENT_DATA = {
|
|
7
|
+
event_id: 'Remarked',
|
|
8
|
+
module: 'system',
|
|
9
|
+
order: 'desc',
|
|
10
|
+
success: true,
|
|
11
|
+
row: 100
|
|
12
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseNftApi, HandleNftParams } from '@subwallet/extension-base/koni/api/nft/nft';
|
|
2
|
+
export default class OrdinalNftApi extends BaseNftApi {
|
|
3
|
+
subscanChain: string;
|
|
4
|
+
constructor(addresses: string[], chain: string, subscanChain: string);
|
|
5
|
+
handleNft(address: string, handleNftParams: HandleNftParams): Promise<void>;
|
|
6
|
+
handleNfts(params: HandleNftParams): Promise<void>;
|
|
7
|
+
fetchNfts(params: HandleNftParams): Promise<number>;
|
|
8
|
+
}
|