@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.
Files changed (317) hide show
  1. package/background/KoniTypes.d.ts +111 -69
  2. package/background/KoniTypes.js +19 -13
  3. package/background/errors/TransactionError.js +9 -0
  4. package/cjs/background/KoniTypes.js +20 -16
  5. package/cjs/background/errors/TransactionError.js +9 -0
  6. package/cjs/constants/index.js +19 -4
  7. package/cjs/koni/api/dotsama/balance.js +464 -0
  8. package/cjs/koni/api/nft/config.js +33 -23
  9. package/cjs/koni/api/nft/index.js +14 -0
  10. package/cjs/koni/api/nft/nft.js +1 -22
  11. package/cjs/koni/api/nft/ordinal_nft/constants.js +21 -0
  12. package/cjs/koni/api/nft/ordinal_nft/index.js +121 -0
  13. package/cjs/koni/api/nft/ordinal_nft/utils.js +41 -0
  14. package/cjs/koni/api/staking/bonding/amplitude.js +19 -16
  15. package/cjs/koni/api/staking/bonding/astar.js +11 -10
  16. package/cjs/koni/api/staking/bonding/index.js +4 -1
  17. package/cjs/koni/api/staking/bonding/paraChain.js +25 -23
  18. package/cjs/koni/api/staking/bonding/relayChain.js +48 -45
  19. package/cjs/koni/api/staking/bonding/utils.js +104 -86
  20. package/cjs/koni/api/staking/index.js +6 -5
  21. package/cjs/koni/api/staking/paraChain.js +6 -5
  22. package/cjs/koni/api/staking/relayChain.js +3 -2
  23. package/cjs/koni/api/yield/helper/utils.js +46 -0
  24. package/cjs/koni/background/cron.js +3 -21
  25. package/cjs/koni/background/handlers/Extension.js +368 -69
  26. package/cjs/koni/background/handlers/State.js +18 -12
  27. package/cjs/koni/background/handlers/index.js +4 -2
  28. package/cjs/koni/background/subscription.js +7 -104
  29. package/cjs/services/campaign-service/index.js +9 -6
  30. package/cjs/services/chain-service/constants.js +1 -16
  31. package/cjs/services/chain-service/index.js +6 -2
  32. package/cjs/services/chain-service/utils.js +7 -1
  33. package/cjs/services/earning-service/constants/chains.js +30 -0
  34. package/cjs/services/earning-service/constants/index.js +27 -0
  35. package/cjs/services/earning-service/constants/step.js +18 -0
  36. package/cjs/services/earning-service/handlers/base.js +262 -0
  37. package/cjs/services/earning-service/handlers/index.js +60 -0
  38. package/cjs/services/earning-service/handlers/lending/base.js +81 -0
  39. package/cjs/services/earning-service/handlers/lending/index.js +13 -0
  40. package/cjs/services/earning-service/handlers/lending/interlay.js +192 -0
  41. package/cjs/services/earning-service/handlers/liquid-staking/acala.js +240 -0
  42. package/cjs/services/earning-service/handlers/liquid-staking/base.js +97 -0
  43. package/cjs/services/earning-service/handlers/liquid-staking/bifrost-manta.js +140 -0
  44. package/cjs/services/earning-service/handlers/liquid-staking/bifrost.js +298 -0
  45. package/cjs/services/earning-service/handlers/liquid-staking/index.js +34 -0
  46. package/cjs/services/earning-service/handlers/liquid-staking/parallel.js +227 -0
  47. package/cjs/services/earning-service/handlers/liquid-staking/stella-swap.js +404 -0
  48. package/cjs/services/earning-service/handlers/native-staking/amplitude.js +434 -0
  49. package/cjs/services/earning-service/handlers/native-staking/astar.js +466 -0
  50. package/cjs/services/earning-service/handlers/native-staking/base-para.js +146 -0
  51. package/cjs/services/earning-service/handlers/native-staking/base.js +161 -0
  52. package/cjs/services/earning-service/handlers/native-staking/index.js +34 -0
  53. package/cjs/services/earning-service/handlers/native-staking/para-chain.js +390 -0
  54. package/cjs/services/earning-service/handlers/native-staking/relay-chain.js +567 -0
  55. package/cjs/services/earning-service/handlers/nomination-pool/index.js +566 -0
  56. package/cjs/services/earning-service/handlers/special.js +493 -0
  57. package/cjs/services/earning-service/service.js +733 -0
  58. package/cjs/services/earning-service/utils/index.js +128 -0
  59. package/cjs/services/event-service/index.js +5 -0
  60. package/cjs/services/keyring-service/index.js +14 -2
  61. package/cjs/services/migration-service/scripts/DeleteEarningData.js +21 -0
  62. package/cjs/services/migration-service/scripts/EnableEarningChains.js +21 -0
  63. package/cjs/services/migration-service/scripts/MigrateEthProvider.js +17 -0
  64. package/cjs/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  65. package/cjs/services/migration-service/scripts/MigratePioneerProvider.js +17 -0
  66. package/cjs/services/migration-service/scripts/MigrateProvider.js +29 -0
  67. package/cjs/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  68. package/cjs/services/migration-service/scripts/databases/MigrateEarningHistory.js +21 -0
  69. package/cjs/services/migration-service/scripts/databases/MigrateEarningVersion.js +21 -0
  70. package/cjs/services/migration-service/scripts/index.js +6 -1
  71. package/cjs/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +149 -0
  72. package/cjs/services/mint-campaign-service/campaigns/index.js +13 -0
  73. package/cjs/services/mint-campaign-service/constants.js +11 -0
  74. package/cjs/services/mint-campaign-service/index.js +18 -0
  75. package/cjs/services/notification-service/NotificationService.js +3 -2
  76. package/cjs/services/request-service/handler/PopupHandler.js +2 -3
  77. package/cjs/services/storage-service/DatabaseService.js +63 -0
  78. package/cjs/services/storage-service/databases/index.js +4 -0
  79. package/cjs/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  80. package/cjs/services/storage-service/db-stores/YieldPoolStore.js +36 -0
  81. package/cjs/services/storage-service/db-stores/YieldPositionStore.js +71 -0
  82. package/cjs/services/storage-service/index.js +241 -0
  83. package/cjs/services/subscan-service/index.js +16 -0
  84. package/cjs/services/transaction-service/event-parser/index.js +58 -0
  85. package/cjs/services/transaction-service/helpers/index.js +3 -1
  86. package/cjs/services/transaction-service/index.js +249 -75
  87. package/cjs/services/transaction-service/utils.js +1 -0
  88. package/cjs/types/campaigns/index.js +16 -0
  89. package/cjs/types/campaigns/unlock-dot.js +1 -0
  90. package/cjs/types/index.js +44 -0
  91. package/cjs/types/ordinal.js +1 -0
  92. package/cjs/types/transaction.js +1 -0
  93. package/cjs/types/yield/actions/index.js +27 -0
  94. package/cjs/types/yield/actions/join/index.js +38 -0
  95. package/cjs/types/yield/actions/join/step.js +47 -0
  96. package/cjs/types/yield/actions/join/submit.js +1 -0
  97. package/cjs/types/yield/actions/join/validate.js +16 -0
  98. package/cjs/types/yield/actions/others.js +1 -0
  99. package/cjs/types/yield/index.js +27 -0
  100. package/cjs/types/yield/info/account/index.js +49 -0
  101. package/cjs/types/yield/info/account/info.js +1 -0
  102. package/cjs/types/yield/info/account/reward.js +1 -0
  103. package/cjs/types/yield/info/account/target.js +32 -0
  104. package/cjs/types/yield/info/account/unstake.js +27 -0
  105. package/cjs/types/yield/info/base.js +41 -0
  106. package/cjs/types/yield/info/chain/index.js +27 -0
  107. package/cjs/types/yield/info/chain/info.js +1 -0
  108. package/cjs/types/yield/info/chain/target.js +1 -0
  109. package/cjs/types/yield/info/index.js +49 -0
  110. package/cjs/types/yield/info/pallet.js +15 -0
  111. package/cjs/types.js +1 -0
  112. package/cjs/utils/address.js +34 -0
  113. package/cjs/utils/environment.js +23 -28
  114. package/cjs/utils/fetchStaticCache.js +22 -0
  115. package/cjs/utils/fetchStaticData.js +2 -1
  116. package/cjs/utils/index.js +94 -10
  117. package/cjs/utils/keyring.js +57 -0
  118. package/cjs/utils/mv3.js +14 -0
  119. package/cjs/utils/number.js +6 -2
  120. package/cjs/utils/object.js +12 -0
  121. package/constants/index.d.ts +6 -1
  122. package/constants/index.js +6 -1
  123. package/koni/api/nft/config.js +33 -23
  124. package/koni/api/nft/index.js +15 -1
  125. package/koni/api/nft/nft.js +2 -23
  126. package/koni/api/nft/ordinal_nft/constants.d.ts +9 -0
  127. package/koni/api/nft/ordinal_nft/constants.js +12 -0
  128. package/koni/api/nft/ordinal_nft/index.d.ts +8 -0
  129. package/koni/api/nft/ordinal_nft/index.js +114 -0
  130. package/koni/api/nft/ordinal_nft/utils.d.ts +2 -0
  131. package/koni/api/nft/ordinal_nft/utils.js +33 -0
  132. package/koni/api/staking/bonding/amplitude.js +13 -10
  133. package/koni/api/staking/bonding/astar.js +9 -8
  134. package/koni/api/staking/bonding/index.d.ts +1 -1
  135. package/koni/api/staking/bonding/index.js +5 -1
  136. package/koni/api/staking/bonding/paraChain.js +12 -10
  137. package/koni/api/staking/bonding/relayChain.d.ts +2 -2
  138. package/koni/api/staking/bonding/relayChain.js +33 -30
  139. package/koni/api/staking/bonding/utils.d.ts +15 -38
  140. package/koni/api/staking/bonding/utils.js +85 -69
  141. package/koni/api/staking/index.js +2 -1
  142. package/koni/api/staking/paraChain.js +7 -6
  143. package/koni/api/staking/relayChain.js +4 -3
  144. package/koni/api/yield/helper/utils.d.ts +10 -0
  145. package/koni/api/yield/helper/utils.js +32 -0
  146. package/koni/background/cron.d.ts +0 -4
  147. package/koni/background/cron.js +4 -22
  148. package/koni/background/handlers/Extension.d.ts +17 -1
  149. package/koni/background/handlers/Extension.js +327 -30
  150. package/koni/background/handlers/State.d.ts +6 -1
  151. package/koni/background/handlers/State.js +17 -12
  152. package/koni/background/handlers/index.js +4 -2
  153. package/koni/background/subscription.d.ts +1 -6
  154. package/koni/background/subscription.js +8 -104
  155. package/package.json +326 -3
  156. package/services/campaign-service/index.js +9 -6
  157. package/services/chain-service/constants.d.ts +0 -12
  158. package/services/chain-service/constants.js +0 -14
  159. package/services/chain-service/index.js +6 -2
  160. package/services/chain-service/utils.d.ts +1 -0
  161. package/services/chain-service/utils.js +5 -1
  162. package/services/earning-service/constants/abis/compound_finance_v2_abi.json +1235 -0
  163. package/services/earning-service/constants/abis/st_liquid_token_abi.json +1355 -0
  164. package/services/earning-service/constants/chains.d.ts +15 -0
  165. package/services/earning-service/constants/chains.js +22 -0
  166. package/services/earning-service/constants/index.d.ts +2 -0
  167. package/services/earning-service/constants/index.js +5 -0
  168. package/services/earning-service/constants/step.d.ts +3 -0
  169. package/services/earning-service/constants/step.js +10 -0
  170. package/services/earning-service/handlers/base.d.ts +113 -0
  171. package/services/earning-service/handlers/base.js +256 -0
  172. package/services/earning-service/handlers/index.d.ts +5 -0
  173. package/services/earning-service/handlers/index.js +8 -0
  174. package/services/earning-service/handlers/lending/base.d.ts +8 -0
  175. package/services/earning-service/handlers/lending/base.js +73 -0
  176. package/services/earning-service/handlers/lending/index.d.ts +1 -0
  177. package/services/earning-service/handlers/lending/index.js +4 -0
  178. package/services/earning-service/handlers/lending/interlay.d.ts +24 -0
  179. package/services/earning-service/handlers/lending/interlay.js +184 -0
  180. package/services/earning-service/handlers/liquid-staking/acala.d.ts +27 -0
  181. package/services/earning-service/handlers/liquid-staking/acala.js +232 -0
  182. package/services/earning-service/handlers/liquid-staking/base.d.ts +11 -0
  183. package/services/earning-service/handlers/liquid-staking/base.js +89 -0
  184. package/services/earning-service/handlers/liquid-staking/bifrost.d.ts +46 -0
  185. package/services/earning-service/handlers/liquid-staking/bifrost.js +287 -0
  186. package/services/earning-service/handlers/liquid-staking/index.d.ts +4 -0
  187. package/services/earning-service/handlers/liquid-staking/index.js +7 -0
  188. package/services/earning-service/handlers/liquid-staking/parallel.d.ts +26 -0
  189. package/services/earning-service/handlers/liquid-staking/parallel.js +219 -0
  190. package/services/earning-service/handlers/liquid-staking/stella-swap.d.ts +34 -0
  191. package/services/earning-service/handlers/liquid-staking/stella-swap.js +394 -0
  192. package/services/earning-service/handlers/native-staking/amplitude.d.ts +22 -0
  193. package/services/earning-service/handlers/native-staking/amplitude.js +425 -0
  194. package/services/earning-service/handlers/native-staking/astar.d.ts +19 -0
  195. package/services/earning-service/handlers/native-staking/astar.js +456 -0
  196. package/services/earning-service/handlers/native-staking/base-para.d.ts +11 -0
  197. package/services/earning-service/handlers/native-staking/base-para.js +138 -0
  198. package/services/earning-service/handlers/native-staking/base.d.ts +21 -0
  199. package/services/earning-service/handlers/native-staking/base.js +152 -0
  200. package/services/earning-service/handlers/native-staking/index.d.ts +4 -0
  201. package/services/earning-service/handlers/native-staking/index.js +7 -0
  202. package/services/earning-service/handlers/native-staking/para-chain.d.ts +15 -0
  203. package/services/earning-service/handlers/native-staking/para-chain.js +382 -0
  204. package/services/earning-service/handlers/native-staking/relay-chain.d.ts +21 -0
  205. package/services/earning-service/handlers/native-staking/relay-chain.js +558 -0
  206. package/services/earning-service/handlers/nomination-pool/index.d.ts +36 -0
  207. package/services/earning-service/handlers/nomination-pool/index.js +556 -0
  208. package/services/earning-service/handlers/special.d.ts +64 -0
  209. package/services/earning-service/handlers/special.js +485 -0
  210. package/services/earning-service/service.d.ts +94 -0
  211. package/services/earning-service/service.js +722 -0
  212. package/services/earning-service/utils/index.d.ts +18 -0
  213. package/services/earning-service/utils/index.js +112 -0
  214. package/services/event-service/index.d.ts +2 -0
  215. package/services/event-service/index.js +5 -0
  216. package/services/event-service/types.d.ts +9 -0
  217. package/services/keyring-service/index.d.ts +2 -1
  218. package/services/keyring-service/index.js +14 -2
  219. package/services/migration-service/scripts/DeleteEarningData.d.ts +4 -0
  220. package/services/migration-service/scripts/DeleteEarningData.js +13 -0
  221. package/services/migration-service/scripts/EnableEarningChains.d.ts +4 -0
  222. package/services/migration-service/scripts/EnableEarningChains.js +13 -0
  223. package/services/migration-service/scripts/MigrateLedgerAccount.js +1 -1
  224. package/services/migration-service/scripts/MigrateTransactionHistory.js +1 -1
  225. package/services/migration-service/scripts/databases/MigrateEarningHistory.d.ts +4 -0
  226. package/services/migration-service/scripts/databases/MigrateEarningHistory.js +13 -0
  227. package/services/migration-service/scripts/databases/MigrateEarningVersion.d.ts +4 -0
  228. package/services/migration-service/scripts/databases/MigrateEarningVersion.js +13 -0
  229. package/services/migration-service/scripts/index.js +6 -1
  230. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.d.ts +13 -0
  231. package/services/mint-campaign-service/campaigns/UnlockDotCampaign.js +139 -0
  232. package/services/mint-campaign-service/campaigns/index.d.ts +1 -0
  233. package/services/mint-campaign-service/campaigns/index.js +4 -0
  234. package/services/mint-campaign-service/constants.d.ts +1 -0
  235. package/services/mint-campaign-service/constants.js +4 -0
  236. package/services/mint-campaign-service/index.d.ts +7 -0
  237. package/services/mint-campaign-service/index.js +11 -0
  238. package/services/notification-service/NotificationService.js +3 -2
  239. package/services/request-service/handler/PopupHandler.js +3 -4
  240. package/services/storage-service/DatabaseService.d.ts +22 -1
  241. package/services/storage-service/DatabaseService.js +63 -0
  242. package/services/storage-service/databases/index.d.ts +3 -1
  243. package/services/storage-service/databases/index.js +4 -0
  244. package/services/storage-service/db-stores/NominatorMetadata.js +3 -3
  245. package/services/storage-service/db-stores/YieldPoolStore.d.ts +10 -0
  246. package/services/storage-service/db-stores/YieldPoolStore.js +28 -0
  247. package/services/storage-service/db-stores/YieldPositionStore.d.ts +11 -0
  248. package/services/storage-service/db-stores/YieldPositionStore.js +63 -0
  249. package/services/subscan-service/index.d.ts +3 -2
  250. package/services/subscan-service/index.js +15 -0
  251. package/services/subscan-service/types.d.ts +20 -0
  252. package/services/transaction-service/event-parser/index.d.ts +3 -1
  253. package/services/transaction-service/event-parser/index.js +57 -1
  254. package/services/transaction-service/helpers/index.js +3 -1
  255. package/services/transaction-service/index.d.ts +6 -13
  256. package/services/transaction-service/index.js +247 -73
  257. package/services/transaction-service/types.d.ts +2 -0
  258. package/services/transaction-service/utils.js +1 -0
  259. package/types/campaigns/index.d.ts +1 -0
  260. package/types/campaigns/index.js +4 -0
  261. package/types/campaigns/unlock-dot.d.ts +71 -0
  262. package/types/campaigns/unlock-dot.js +1 -0
  263. package/types/index.d.ts +5 -0
  264. package/types/index.js +5 -1
  265. package/types/ordinal.d.ts +69 -0
  266. package/types/ordinal.js +1 -0
  267. package/types/transaction.d.ts +3 -0
  268. package/types/transaction.js +1 -0
  269. package/types/yield/actions/index.d.ts +2 -0
  270. package/types/yield/actions/index.js +5 -0
  271. package/types/yield/actions/join/index.d.ts +3 -0
  272. package/types/yield/actions/join/index.js +6 -0
  273. package/types/yield/actions/join/step.d.ts +95 -0
  274. package/types/yield/actions/join/step.js +46 -0
  275. package/types/yield/actions/join/submit.d.ts +58 -0
  276. package/types/yield/actions/join/submit.js +1 -0
  277. package/types/yield/actions/join/validate.d.ts +18 -0
  278. package/types/yield/actions/join/validate.js +10 -0
  279. package/types/yield/actions/others.d.ts +85 -0
  280. package/types/yield/actions/others.js +1 -0
  281. package/types/yield/index.d.ts +2 -0
  282. package/types/yield/index.js +5 -0
  283. package/types/yield/info/account/index.d.ts +4 -0
  284. package/types/yield/info/account/index.js +7 -0
  285. package/types/yield/info/account/info.d.ts +92 -0
  286. package/types/yield/info/account/info.js +1 -0
  287. package/types/yield/info/account/reward.d.ts +47 -0
  288. package/types/yield/info/account/reward.js +1 -0
  289. package/types/yield/info/account/target.d.ts +43 -0
  290. package/types/yield/info/account/target.js +27 -0
  291. package/types/yield/info/account/unstake.d.ts +31 -0
  292. package/types/yield/info/account/unstake.js +22 -0
  293. package/types/yield/info/base.d.ts +45 -0
  294. package/types/yield/info/base.js +36 -0
  295. package/types/yield/info/chain/index.d.ts +2 -0
  296. package/types/yield/info/chain/index.js +5 -0
  297. package/types/yield/info/chain/info.d.ts +252 -0
  298. package/types/yield/info/chain/info.js +1 -0
  299. package/types/yield/info/chain/target.d.ts +37 -0
  300. package/types/yield/info/chain/target.js +1 -0
  301. package/types/yield/info/index.d.ts +4 -0
  302. package/types/yield/info/index.js +7 -0
  303. package/types/yield/info/pallet.d.ts +143 -0
  304. package/types/yield/info/pallet.js +9 -0
  305. package/utils/environment.d.ts +9 -2
  306. package/utils/environment.js +14 -26
  307. package/utils/fetchStaticCache.d.ts +1 -0
  308. package/utils/fetchStaticCache.js +14 -0
  309. package/utils/fetchStaticData.js +2 -1
  310. package/utils/index.d.ts +5 -1
  311. package/utils/index.js +53 -3
  312. package/utils/mv3.d.ts +2 -0
  313. package/utils/mv3.js +6 -0
  314. package/utils/number.d.ts +2 -1
  315. package/utils/number.js +2 -1
  316. package/utils/object.d.ts +1 -0
  317. package/utils/object.js +6 -0
@@ -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.isMobile = exports.isEmptyArray = exports.isDef = exports.isAddressesEqual = void 0;
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 _environment = require("@subwallet/extension-base/utils/environment");
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 _environment2 = require("./environment");
106
- Object.keys(_environment2).forEach(function (key) {
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] === _environment2[key]) return;
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 _environment2[key];
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;
@@ -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;
@@ -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, formatter, metadata) => {
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
+ }
@@ -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 = 300000;
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';
@@ -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 = 300000;
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";
@@ -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 && !RuntimeInfo.protocol.startsWith('http')) {
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);
@@ -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
  }
@@ -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 { getRandomIpfsGateway } from '@subwallet/extension-base/koni/api/nft/config';
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
- if (!input || input.length === 0) {
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
+ }