MoralisWeb3Api.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602
  1. "use strict";
  2. var _Object$keys2 = require("@babel/runtime-corejs3/core-js-stable/object/keys");
  3. var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
  4. var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
  5. var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
  6. var _forEachInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
  7. var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
  8. var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
  9. var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
  10. var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
  11. _Object$defineProperty(exports, "__esModule", {
  12. value: true
  13. });
  14. exports.default = void 0;
  15. var _regenerator = _interopRequireDefault(require("@babel/runtime-corejs3/regenerator"));
  16. var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
  17. var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
  18. var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
  19. var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
  20. var _stringify = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/json/stringify"));
  21. var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
  22. var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
  23. var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
  24. var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
  25. function ownKeys(object, enumerableOnly) {
  26. var keys = _Object$keys2(object);
  27. if (_Object$getOwnPropertySymbols) {
  28. var symbols = _Object$getOwnPropertySymbols(object);
  29. enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) {
  30. return _Object$getOwnPropertyDescriptor(object, sym).enumerable;
  31. })), keys.push.apply(keys, symbols);
  32. }
  33. return keys;
  34. }
  35. function _objectSpread(target) {
  36. for (var i = 1; i < arguments.length; i++) {
  37. var _context44, _context45;
  38. var source = null != arguments[i] ? arguments[i] : {};
  39. i % 2 ? _forEachInstanceProperty2(_context44 = ownKeys(Object(source), !0)).call(_context44, function (key) {
  40. (0, _defineProperty2.default)(target, key, source[key]);
  41. }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty2(_context45 = ownKeys(Object(source))).call(_context45, function (key) {
  42. _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key));
  43. });
  44. }
  45. return target;
  46. }
  47. /**
  48. * Automatically generated code, via genWeb3API.js
  49. * Do not modify manually
  50. */
  51. var axios = require('axios');
  52. var Web3Api = /*#__PURE__*/function () {
  53. function Web3Api() {
  54. (0, _classCallCheck2.default)(this, Web3Api);
  55. }
  56. (0, _createClass2.default)(Web3Api, null, [{
  57. key: "initialize",
  58. value: function (_ref) {
  59. var apiKey = _ref.apiKey,
  60. serverUrl = _ref.serverUrl,
  61. _ref$Moralis = _ref.Moralis,
  62. Moralis = _ref$Moralis === void 0 ? null : _ref$Moralis;
  63. if (!serverUrl && !apiKey) {
  64. throw new Error('Web3Api.initialize failed: initialize with apiKey or serverUrl');
  65. }
  66. if (apiKey) this.apiKey = apiKey;
  67. if (serverUrl) this.serverUrl = serverUrl;
  68. this.Moralis = Moralis;
  69. }
  70. }, {
  71. key: "getBody",
  72. value: function (params, bodyParams) {
  73. var _this = this;
  74. if (!params || !bodyParams || !bodyParams.length) {
  75. return undefined;
  76. }
  77. var body = {};
  78. (0, _forEach.default)(bodyParams).call(bodyParams, function (_ref2) {
  79. var key = _ref2.key,
  80. type = _ref2.type,
  81. required = _ref2.required;
  82. if (params[key] === undefined) {
  83. if (required) throw new Error("param ".concat(key, " is required!"));
  84. } else if (type === _this.BodyParamTypes.setBody) {
  85. body = params[key];
  86. } else {
  87. body[key] = params[key];
  88. } // remove the param so it doesn't also get added as a query param
  89. delete params[key];
  90. });
  91. return body;
  92. }
  93. }, {
  94. key: "getParameterizedUrl",
  95. value: function (url, params) {
  96. var _context;
  97. if (!(0, _keys.default)(params).length) return url; // find url params, they start with :
  98. var requiredParams = (0, _filter.default)(_context = url.split('/')).call(_context, function (s) {
  99. return s && (0, _includes.default)(s).call(s, ':');
  100. });
  101. if (!requiredParams.length) return url;
  102. var parameterizedUrl = url;
  103. (0, _forEach.default)(requiredParams).call(requiredParams, function (p) {
  104. // strip the : and replace with param value
  105. var key = p.substr(1);
  106. var value = params[key];
  107. if (!value) {
  108. throw new Error("required param ".concat(key, " not provided"));
  109. }
  110. parameterizedUrl = parameterizedUrl.replace(p, value); // remove required param from param list
  111. // so it doesn't become part of the query params
  112. delete params[key];
  113. });
  114. return parameterizedUrl;
  115. }
  116. }, {
  117. key: "getApiRateLimitInfo",
  118. value: function (headers) {
  119. return {
  120. 'x-rate-limit-limit': headers['x-rate-limit-limit'],
  121. 'x-rate-limit-remaining-ttl': headers['x-rate-limit-remaining-ttl'],
  122. 'x-rate-limit-used': headers['x-rate-limit-used'],
  123. 'x-rate-limit-remaining-ip-ttl': headers['x-rate-limit-remaining-ip-ttl'],
  124. 'x-rate-limit-ip-used': headers['x-rate-limit-ip-used']
  125. };
  126. }
  127. }, {
  128. key: "getApiErrorMessage",
  129. value: function (error, url) {
  130. var _error$response, _error$response$data;
  131. return (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : (_error$response$data = _error$response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.message) || (error === null || error === void 0 ? void 0 : error.message) || (error === null || error === void 0 ? void 0 : error.toString()) || "Web3 API error while calling ".concat(url);
  132. }
  133. }, {
  134. key: "fetch",
  135. value: function () {
  136. var _fetch = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_ref3) {
  137. var endpoint, providedParams, params, _this$Moralis, User, account, user;
  138. return _regenerator.default.wrap(function (_context2) {
  139. while (1) {
  140. switch (_context2.prev = _context2.next) {
  141. case 0:
  142. endpoint = _ref3.endpoint, providedParams = _ref3.params; // Make a shallow copy to prevent modification of original params
  143. params = _objectSpread({}, providedParams);
  144. if (this.Moralis) {
  145. _this$Moralis = this.Moralis, User = _this$Moralis.User, account = _this$Moralis.account;
  146. user = User.current();
  147. if (!params.address) {
  148. if (user) {
  149. params.address = user.get('ethAddress');
  150. } else if (account) {
  151. params.address = account;
  152. }
  153. }
  154. }
  155. if (this.apiKey) {
  156. _context2.next = 5;
  157. break;
  158. }
  159. return _context2.abrupt("return", this.fetchFromServer(endpoint.name, params));
  160. case 5:
  161. return _context2.abrupt("return", this.fetchFromApi(endpoint, params));
  162. case 6:
  163. case "end":
  164. return _context2.stop();
  165. }
  166. }
  167. }, _callee, this);
  168. }));
  169. return function () {
  170. return _fetch.apply(this, arguments);
  171. };
  172. }()
  173. }, {
  174. key: "fetchFromApi",
  175. value: function () {
  176. var _fetchFromApi = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(endpoint, params) {
  177. var _endpoint$method, method, url, bodyParams, parameterizedUrl, body, response, _error$response2, status, headers, data, msg;
  178. return _regenerator.default.wrap(function (_context3) {
  179. while (1) {
  180. switch (_context3.prev = _context3.next) {
  181. case 0:
  182. _endpoint$method = endpoint.method, method = _endpoint$method === void 0 ? 'GET' : _endpoint$method, url = endpoint.url, bodyParams = endpoint.bodyParams;
  183. _context3.prev = 1;
  184. parameterizedUrl = this.getParameterizedUrl(url, params);
  185. body = this.getBody(params, bodyParams);
  186. _context3.next = 6;
  187. return axios(this.baseURL + parameterizedUrl, {
  188. params: params,
  189. method: method,
  190. body: body,
  191. headers: {
  192. Accept: 'application/json',
  193. 'Content-Type': 'application/json',
  194. 'x-api-key': this.apiKey
  195. }
  196. });
  197. case 6:
  198. response = _context3.sent;
  199. return _context3.abrupt("return", response.data);
  200. case 10:
  201. _context3.prev = 10;
  202. _context3.t0 = _context3["catch"](1);
  203. _error$response2 = _context3.t0.response, status = _error$response2.status, headers = _error$response2.headers, data = _error$response2.data;
  204. if (status === 429) {
  205. msg = "This Moralis Server is rate-limited because of the plan restrictions. See the details about the current rate and throttle limits: ".concat((0, _stringify.default)(this.getApiRateLimitInfo(headers)));
  206. } else {
  207. msg = this.getApiErrorMessage(_context3.t0, url);
  208. }
  209. throw new Error(msg);
  210. case 15:
  211. case "end":
  212. return _context3.stop();
  213. }
  214. }
  215. }, _callee2, this, [[1, 10]]);
  216. }));
  217. return function () {
  218. return _fetchFromApi.apply(this, arguments);
  219. };
  220. }()
  221. }, {
  222. key: "fetchFromServer",
  223. value: function () {
  224. var _fetchFromServer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(name, options) {
  225. var http, user, response, _error$response3, _error$response3$data;
  226. return _regenerator.default.wrap(function (_context4) {
  227. while (1) {
  228. switch (_context4.prev = _context4.next) {
  229. case 0:
  230. if (this.serverUrl) {
  231. _context4.next = 2;
  232. break;
  233. }
  234. throw new Error('Web3Api not initialized, run Moralis.start() first');
  235. case 2:
  236. _context4.prev = 2;
  237. http = axios.create({
  238. baseURL: this.serverUrl
  239. });
  240. if (!options.chain) options.chain = 'eth';
  241. user = this.Moralis.User.current();
  242. if (user) {
  243. options._SessionToken = user.attributes.sessionToken;
  244. options._ApplicationId = this.Moralis.applicationId;
  245. }
  246. _context4.next = 9;
  247. return http.post("/functions/".concat(name), options, {
  248. headers: {
  249. Accept: 'application/json',
  250. 'Content-Type': 'application/json'
  251. }
  252. });
  253. case 9:
  254. response = _context4.sent;
  255. return _context4.abrupt("return", response.data.result);
  256. case 13:
  257. _context4.prev = 13;
  258. _context4.t0 = _context4["catch"](2);
  259. if (!((_error$response3 = _context4.t0.response) !== null && _error$response3 !== void 0 && (_error$response3$data = _error$response3.data) !== null && _error$response3$data !== void 0 && _error$response3$data.error)) {
  260. _context4.next = 17;
  261. break;
  262. }
  263. throw new Error(_context4.t0.response.data.error);
  264. case 17:
  265. throw _context4.t0;
  266. case 18:
  267. case "end":
  268. return _context4.stop();
  269. }
  270. }
  271. }, _callee3, this, [[2, 13]]);
  272. }));
  273. return function () {
  274. return _fetchFromServer.apply(this, arguments);
  275. };
  276. }()
  277. }]);
  278. return Web3Api;
  279. }();
  280. (0, _defineProperty2.default)(Web3Api, "baseURL", 'https://deep-index.moralis.io/api/v2');
  281. (0, _defineProperty2.default)(Web3Api, "BodyParamTypes", {
  282. setBody: 'set body',
  283. property: 'property'
  284. });
  285. (0, _defineProperty2.default)(Web3Api, "native", {
  286. getBlock: function () {
  287. var _getBlock = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
  288. var options,
  289. _args4 = arguments;
  290. return _regenerator.default.wrap(function (_context5) {
  291. while (1) {
  292. switch (_context5.prev = _context5.next) {
  293. case 0:
  294. options = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : {};
  295. return _context5.abrupt("return", Web3Api.fetch({
  296. endpoint: {
  297. "method": "GET",
  298. "group": "native",
  299. "name": "getBlock",
  300. "url": "/block/:block_number_or_hash"
  301. },
  302. params: options
  303. }));
  304. case 2:
  305. case "end":
  306. return _context5.stop();
  307. }
  308. }
  309. }, _callee4);
  310. }));
  311. return function () {
  312. return _getBlock.apply(this, arguments);
  313. };
  314. }(),
  315. getDateToBlock: function () {
  316. var _getDateToBlock = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
  317. var options,
  318. _args5 = arguments;
  319. return _regenerator.default.wrap(function (_context6) {
  320. while (1) {
  321. switch (_context6.prev = _context6.next) {
  322. case 0:
  323. options = _args5.length > 0 && _args5[0] !== undefined ? _args5[0] : {};
  324. return _context6.abrupt("return", Web3Api.fetch({
  325. endpoint: {
  326. "method": "GET",
  327. "group": "native",
  328. "name": "getDateToBlock",
  329. "url": "/dateToBlock"
  330. },
  331. params: options
  332. }));
  333. case 2:
  334. case "end":
  335. return _context6.stop();
  336. }
  337. }
  338. }, _callee5);
  339. }));
  340. return function () {
  341. return _getDateToBlock.apply(this, arguments);
  342. };
  343. }(),
  344. getLogsByAddress: function () {
  345. var _getLogsByAddress = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
  346. var options,
  347. _args6 = arguments;
  348. return _regenerator.default.wrap(function (_context7) {
  349. while (1) {
  350. switch (_context7.prev = _context7.next) {
  351. case 0:
  352. options = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : {};
  353. return _context7.abrupt("return", Web3Api.fetch({
  354. endpoint: {
  355. "method": "GET",
  356. "group": "native",
  357. "name": "getLogsByAddress",
  358. "url": "/:address/logs"
  359. },
  360. params: options
  361. }));
  362. case 2:
  363. case "end":
  364. return _context7.stop();
  365. }
  366. }
  367. }, _callee6);
  368. }));
  369. return function () {
  370. return _getLogsByAddress.apply(this, arguments);
  371. };
  372. }(),
  373. getNFTTransfersByBlock: function () {
  374. var _getNFTTransfersByBlock = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
  375. var options,
  376. _args7 = arguments;
  377. return _regenerator.default.wrap(function (_context8) {
  378. while (1) {
  379. switch (_context8.prev = _context8.next) {
  380. case 0:
  381. options = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
  382. return _context8.abrupt("return", Web3Api.fetch({
  383. endpoint: {
  384. "method": "GET",
  385. "group": "native",
  386. "name": "getNFTTransfersByBlock",
  387. "url": "/block/:block_number_or_hash/nft/transfers"
  388. },
  389. params: options
  390. }));
  391. case 2:
  392. case "end":
  393. return _context8.stop();
  394. }
  395. }
  396. }, _callee7);
  397. }));
  398. return function () {
  399. return _getNFTTransfersByBlock.apply(this, arguments);
  400. };
  401. }(),
  402. getTransaction: function () {
  403. var _getTransaction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
  404. var options,
  405. _args8 = arguments;
  406. return _regenerator.default.wrap(function (_context9) {
  407. while (1) {
  408. switch (_context9.prev = _context9.next) {
  409. case 0:
  410. options = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
  411. return _context9.abrupt("return", Web3Api.fetch({
  412. endpoint: {
  413. "method": "GET",
  414. "group": "native",
  415. "name": "getTransaction",
  416. "url": "/transaction/:transaction_hash"
  417. },
  418. params: options
  419. }));
  420. case 2:
  421. case "end":
  422. return _context9.stop();
  423. }
  424. }
  425. }, _callee8);
  426. }));
  427. return function () {
  428. return _getTransaction.apply(this, arguments);
  429. };
  430. }(),
  431. getContractEvents: function () {
  432. var _getContractEvents = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
  433. var options,
  434. _args9 = arguments;
  435. return _regenerator.default.wrap(function (_context10) {
  436. while (1) {
  437. switch (_context10.prev = _context10.next) {
  438. case 0:
  439. options = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : {};
  440. return _context10.abrupt("return", Web3Api.fetch({
  441. endpoint: {
  442. "method": "POST",
  443. "group": "native",
  444. "name": "getContractEvents",
  445. "url": "/:address/events",
  446. "bodyParams": [{
  447. "key": "data",
  448. "type": "set body",
  449. "required": false
  450. }]
  451. },
  452. params: options
  453. }));
  454. case 2:
  455. case "end":
  456. return _context10.stop();
  457. }
  458. }
  459. }, _callee9);
  460. }));
  461. return function () {
  462. return _getContractEvents.apply(this, arguments);
  463. };
  464. }(),
  465. runContractFunction: function () {
  466. var _runContractFunction = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
  467. var options,
  468. _args10 = arguments;
  469. return _regenerator.default.wrap(function (_context11) {
  470. while (1) {
  471. switch (_context11.prev = _context11.next) {
  472. case 0:
  473. options = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : {};
  474. return _context11.abrupt("return", Web3Api.fetch({
  475. endpoint: {
  476. "method": "POST",
  477. "group": "native",
  478. "name": "runContractFunction",
  479. "url": "/:address/function",
  480. "bodyParams": [{
  481. "key": "abi",
  482. "type": "property",
  483. "required": true
  484. }, {
  485. "key": "params",
  486. "type": "property",
  487. "required": false
  488. }]
  489. },
  490. params: options
  491. }));
  492. case 2:
  493. case "end":
  494. return _context11.stop();
  495. }
  496. }
  497. }, _callee10);
  498. }));
  499. return function () {
  500. return _runContractFunction.apply(this, arguments);
  501. };
  502. }()
  503. });
  504. (0, _defineProperty2.default)(Web3Api, "account", {
  505. getTransactions: function () {
  506. var _getTransactions = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
  507. var options,
  508. _args11 = arguments;
  509. return _regenerator.default.wrap(function (_context12) {
  510. while (1) {
  511. switch (_context12.prev = _context12.next) {
  512. case 0:
  513. options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
  514. return _context12.abrupt("return", Web3Api.fetch({
  515. endpoint: {
  516. "method": "GET",
  517. "group": "account",
  518. "name": "getTransactions",
  519. "url": "/:address"
  520. },
  521. params: options
  522. }));
  523. case 2:
  524. case "end":
  525. return _context12.stop();
  526. }
  527. }
  528. }, _callee11);
  529. }));
  530. return function () {
  531. return _getTransactions.apply(this, arguments);
  532. };
  533. }(),
  534. getNativeBalance: function () {
  535. var _getNativeBalance = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
  536. var options,
  537. _args12 = arguments;
  538. return _regenerator.default.wrap(function (_context13) {
  539. while (1) {
  540. switch (_context13.prev = _context13.next) {
  541. case 0:
  542. options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
  543. return _context13.abrupt("return", Web3Api.fetch({
  544. endpoint: {
  545. "method": "GET",
  546. "group": "account",
  547. "name": "getNativeBalance",
  548. "url": "/:address/balance"
  549. },
  550. params: options
  551. }));
  552. case 2:
  553. case "end":
  554. return _context13.stop();
  555. }
  556. }
  557. }, _callee12);
  558. }));
  559. return function () {
  560. return _getNativeBalance.apply(this, arguments);
  561. };
  562. }(),
  563. getTokenBalances: function () {
  564. var _getTokenBalances = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
  565. var options,
  566. _args13 = arguments;
  567. return _regenerator.default.wrap(function (_context14) {
  568. while (1) {
  569. switch (_context14.prev = _context14.next) {
  570. case 0:
  571. options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
  572. return _context14.abrupt("return", Web3Api.fetch({
  573. endpoint: {
  574. "method": "GET",
  575. "group": "account",
  576. "name": "getTokenBalances",
  577. "url": "/:address/erc20"
  578. },
  579. params: options
  580. }));
  581. case 2:
  582. case "end":
  583. return _context14.stop();
  584. }
  585. }
  586. }, _callee13);
  587. }));
  588. return function () {
  589. return _getTokenBalances.apply(this, arguments);
  590. };
  591. }(),
  592. getTokenTransfers: function () {
  593. var _getTokenTransfers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14() {
  594. var options,
  595. _args14 = arguments;
  596. return _regenerator.default.wrap(function (_context15) {
  597. while (1) {
  598. switch (_context15.prev = _context15.next) {
  599. case 0:
  600. options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
  601. return _context15.abrupt("return", Web3Api.fetch({
  602. endpoint: {
  603. "method": "GET",
  604. "group": "account",
  605. "name": "getTokenTransfers",
  606. "url": "/:address/erc20/transfers"
  607. },
  608. params: options
  609. }));
  610. case 2:
  611. case "end":
  612. return _context15.stop();
  613. }
  614. }
  615. }, _callee14);
  616. }));
  617. return function () {
  618. return _getTokenTransfers.apply(this, arguments);
  619. };
  620. }(),
  621. getNFTs: function () {
  622. var _getNFTs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
  623. var options,
  624. _args15 = arguments;
  625. return _regenerator.default.wrap(function (_context16) {
  626. while (1) {
  627. switch (_context16.prev = _context16.next) {
  628. case 0:
  629. options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
  630. return _context16.abrupt("return", Web3Api.fetch({
  631. endpoint: {
  632. "method": "GET",
  633. "group": "account",
  634. "name": "getNFTs",
  635. "url": "/:address/nft"
  636. },
  637. params: options
  638. }));
  639. case 2:
  640. case "end":
  641. return _context16.stop();
  642. }
  643. }
  644. }, _callee15);
  645. }));
  646. return function () {
  647. return _getNFTs.apply(this, arguments);
  648. };
  649. }(),
  650. getNFTTransfers: function () {
  651. var _getNFTTransfers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
  652. var options,
  653. _args16 = arguments;
  654. return _regenerator.default.wrap(function (_context17) {
  655. while (1) {
  656. switch (_context17.prev = _context17.next) {
  657. case 0:
  658. options = _args16.length > 0 && _args16[0] !== undefined ? _args16[0] : {};
  659. return _context17.abrupt("return", Web3Api.fetch({
  660. endpoint: {
  661. "method": "GET",
  662. "group": "account",
  663. "name": "getNFTTransfers",
  664. "url": "/:address/nft/transfers"
  665. },
  666. params: options
  667. }));
  668. case 2:
  669. case "end":
  670. return _context17.stop();
  671. }
  672. }
  673. }, _callee16);
  674. }));
  675. return function () {
  676. return _getNFTTransfers.apply(this, arguments);
  677. };
  678. }(),
  679. getNFTsForContract: function () {
  680. var _getNFTsForContract = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
  681. var options,
  682. _args17 = arguments;
  683. return _regenerator.default.wrap(function (_context18) {
  684. while (1) {
  685. switch (_context18.prev = _context18.next) {
  686. case 0:
  687. options = _args17.length > 0 && _args17[0] !== undefined ? _args17[0] : {};
  688. return _context18.abrupt("return", Web3Api.fetch({
  689. endpoint: {
  690. "method": "GET",
  691. "group": "account",
  692. "name": "getNFTsForContract",
  693. "url": "/:address/nft/:token_address"
  694. },
  695. params: options
  696. }));
  697. case 2:
  698. case "end":
  699. return _context18.stop();
  700. }
  701. }
  702. }, _callee17);
  703. }));
  704. return function () {
  705. return _getNFTsForContract.apply(this, arguments);
  706. };
  707. }()
  708. });
  709. (0, _defineProperty2.default)(Web3Api, "token", {
  710. getTokenMetadata: function () {
  711. var _getTokenMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18() {
  712. var options,
  713. _args18 = arguments;
  714. return _regenerator.default.wrap(function (_context19) {
  715. while (1) {
  716. switch (_context19.prev = _context19.next) {
  717. case 0:
  718. options = _args18.length > 0 && _args18[0] !== undefined ? _args18[0] : {};
  719. return _context19.abrupt("return", Web3Api.fetch({
  720. endpoint: {
  721. "method": "GET",
  722. "group": "token",
  723. "name": "getTokenMetadata",
  724. "url": "/erc20/metadata"
  725. },
  726. params: options
  727. }));
  728. case 2:
  729. case "end":
  730. return _context19.stop();
  731. }
  732. }
  733. }, _callee18);
  734. }));
  735. return function () {
  736. return _getTokenMetadata.apply(this, arguments);
  737. };
  738. }(),
  739. getNFTTrades: function () {
  740. var _getNFTTrades = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
  741. var options,
  742. _args19 = arguments;
  743. return _regenerator.default.wrap(function (_context20) {
  744. while (1) {
  745. switch (_context20.prev = _context20.next) {
  746. case 0:
  747. options = _args19.length > 0 && _args19[0] !== undefined ? _args19[0] : {};
  748. return _context20.abrupt("return", Web3Api.fetch({
  749. endpoint: {
  750. "method": "GET",
  751. "group": "token",
  752. "name": "getNFTTrades",
  753. "url": "/nft/:address/trades"
  754. },
  755. params: options
  756. }));
  757. case 2:
  758. case "end":
  759. return _context20.stop();
  760. }
  761. }
  762. }, _callee19);
  763. }));
  764. return function () {
  765. return _getNFTTrades.apply(this, arguments);
  766. };
  767. }(),
  768. getNFTLowestPrice: function () {
  769. var _getNFTLowestPrice = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20() {
  770. var options,
  771. _args20 = arguments;
  772. return _regenerator.default.wrap(function (_context21) {
  773. while (1) {
  774. switch (_context21.prev = _context21.next) {
  775. case 0:
  776. options = _args20.length > 0 && _args20[0] !== undefined ? _args20[0] : {};
  777. return _context21.abrupt("return", Web3Api.fetch({
  778. endpoint: {
  779. "method": "GET",
  780. "group": "token",
  781. "name": "getNFTLowestPrice",
  782. "url": "/nft/:address/lowestprice"
  783. },
  784. params: options
  785. }));
  786. case 2:
  787. case "end":
  788. return _context21.stop();
  789. }
  790. }
  791. }, _callee20);
  792. }));
  793. return function () {
  794. return _getNFTLowestPrice.apply(this, arguments);
  795. };
  796. }(),
  797. getTokenMetadataBySymbol: function () {
  798. var _getTokenMetadataBySymbol = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
  799. var options,
  800. _args21 = arguments;
  801. return _regenerator.default.wrap(function (_context22) {
  802. while (1) {
  803. switch (_context22.prev = _context22.next) {
  804. case 0:
  805. options = _args21.length > 0 && _args21[0] !== undefined ? _args21[0] : {};
  806. return _context22.abrupt("return", Web3Api.fetch({
  807. endpoint: {
  808. "method": "GET",
  809. "group": "token",
  810. "name": "getTokenMetadataBySymbol",
  811. "url": "/erc20/metadata/symbols"
  812. },
  813. params: options
  814. }));
  815. case 2:
  816. case "end":
  817. return _context22.stop();
  818. }
  819. }
  820. }, _callee21);
  821. }));
  822. return function () {
  823. return _getTokenMetadataBySymbol.apply(this, arguments);
  824. };
  825. }(),
  826. getTokenPrice: function () {
  827. var _getTokenPrice = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee22() {
  828. var options,
  829. _args22 = arguments;
  830. return _regenerator.default.wrap(function (_context23) {
  831. while (1) {
  832. switch (_context23.prev = _context23.next) {
  833. case 0:
  834. options = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
  835. return _context23.abrupt("return", Web3Api.fetch({
  836. endpoint: {
  837. "method": "GET",
  838. "group": "token",
  839. "name": "getTokenPrice",
  840. "url": "/erc20/:address/price"
  841. },
  842. params: options
  843. }));
  844. case 2:
  845. case "end":
  846. return _context23.stop();
  847. }
  848. }
  849. }, _callee22);
  850. }));
  851. return function () {
  852. return _getTokenPrice.apply(this, arguments);
  853. };
  854. }(),
  855. getTokenAddressTransfers: function () {
  856. var _getTokenAddressTransfers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23() {
  857. var options,
  858. _args23 = arguments;
  859. return _regenerator.default.wrap(function (_context24) {
  860. while (1) {
  861. switch (_context24.prev = _context24.next) {
  862. case 0:
  863. options = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
  864. return _context24.abrupt("return", Web3Api.fetch({
  865. endpoint: {
  866. "method": "GET",
  867. "group": "token",
  868. "name": "getTokenAddressTransfers",
  869. "url": "/erc20/:address/transfers"
  870. },
  871. params: options
  872. }));
  873. case 2:
  874. case "end":
  875. return _context24.stop();
  876. }
  877. }
  878. }, _callee23);
  879. }));
  880. return function () {
  881. return _getTokenAddressTransfers.apply(this, arguments);
  882. };
  883. }(),
  884. getTokenAllowance: function () {
  885. var _getTokenAllowance = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee24() {
  886. var options,
  887. _args24 = arguments;
  888. return _regenerator.default.wrap(function (_context25) {
  889. while (1) {
  890. switch (_context25.prev = _context25.next) {
  891. case 0:
  892. options = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
  893. return _context25.abrupt("return", Web3Api.fetch({
  894. endpoint: {
  895. "method": "GET",
  896. "group": "token",
  897. "name": "getTokenAllowance",
  898. "url": "/erc20/:address/allowance"
  899. },
  900. params: options
  901. }));
  902. case 2:
  903. case "end":
  904. return _context25.stop();
  905. }
  906. }
  907. }, _callee24);
  908. }));
  909. return function () {
  910. return _getTokenAllowance.apply(this, arguments);
  911. };
  912. }(),
  913. searchNFTs: function () {
  914. var _searchNFTs = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee25() {
  915. var options,
  916. _args25 = arguments;
  917. return _regenerator.default.wrap(function (_context26) {
  918. while (1) {
  919. switch (_context26.prev = _context26.next) {
  920. case 0:
  921. options = _args25.length > 0 && _args25[0] !== undefined ? _args25[0] : {};
  922. return _context26.abrupt("return", Web3Api.fetch({
  923. endpoint: {
  924. "method": "GET",
  925. "group": "token",
  926. "name": "searchNFTs",
  927. "url": "/nft/search"
  928. },
  929. params: options
  930. }));
  931. case 2:
  932. case "end":
  933. return _context26.stop();
  934. }
  935. }
  936. }, _callee25);
  937. }));
  938. return function () {
  939. return _searchNFTs.apply(this, arguments);
  940. };
  941. }(),
  942. getNftTransfersFromToBlock: function () {
  943. var _getNftTransfersFromToBlock = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee26() {
  944. var options,
  945. _args26 = arguments;
  946. return _regenerator.default.wrap(function (_context27) {
  947. while (1) {
  948. switch (_context27.prev = _context27.next) {
  949. case 0:
  950. options = _args26.length > 0 && _args26[0] !== undefined ? _args26[0] : {};
  951. return _context27.abrupt("return", Web3Api.fetch({
  952. endpoint: {
  953. "method": "GET",
  954. "group": "token",
  955. "name": "getNftTransfersFromToBlock",
  956. "url": "/nft/transfers"
  957. },
  958. params: options
  959. }));
  960. case 2:
  961. case "end":
  962. return _context27.stop();
  963. }
  964. }
  965. }, _callee26);
  966. }));
  967. return function () {
  968. return _getNftTransfersFromToBlock.apply(this, arguments);
  969. };
  970. }(),
  971. getAllTokenIds: function () {
  972. var _getAllTokenIds = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee27() {
  973. var options,
  974. _args27 = arguments;
  975. return _regenerator.default.wrap(function (_context28) {
  976. while (1) {
  977. switch (_context28.prev = _context28.next) {
  978. case 0:
  979. options = _args27.length > 0 && _args27[0] !== undefined ? _args27[0] : {};
  980. return _context28.abrupt("return", Web3Api.fetch({
  981. endpoint: {
  982. "method": "GET",
  983. "group": "token",
  984. "name": "getAllTokenIds",
  985. "url": "/nft/:address"
  986. },
  987. params: options
  988. }));
  989. case 2:
  990. case "end":
  991. return _context28.stop();
  992. }
  993. }
  994. }, _callee27);
  995. }));
  996. return function () {
  997. return _getAllTokenIds.apply(this, arguments);
  998. };
  999. }(),
  1000. getContractNFTTransfers: function () {
  1001. var _getContractNFTTransfers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee28() {
  1002. var options,
  1003. _args28 = arguments;
  1004. return _regenerator.default.wrap(function (_context29) {
  1005. while (1) {
  1006. switch (_context29.prev = _context29.next) {
  1007. case 0:
  1008. options = _args28.length > 0 && _args28[0] !== undefined ? _args28[0] : {};
  1009. return _context29.abrupt("return", Web3Api.fetch({
  1010. endpoint: {
  1011. "method": "GET",
  1012. "group": "token",
  1013. "name": "getContractNFTTransfers",
  1014. "url": "/nft/:address/transfers"
  1015. },
  1016. params: options
  1017. }));
  1018. case 2:
  1019. case "end":
  1020. return _context29.stop();
  1021. }
  1022. }
  1023. }, _callee28);
  1024. }));
  1025. return function () {
  1026. return _getContractNFTTransfers.apply(this, arguments);
  1027. };
  1028. }(),
  1029. getNFTOwners: function () {
  1030. var _getNFTOwners = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee29() {
  1031. var options,
  1032. _args29 = arguments;
  1033. return _regenerator.default.wrap(function (_context30) {
  1034. while (1) {
  1035. switch (_context30.prev = _context30.next) {
  1036. case 0:
  1037. options = _args29.length > 0 && _args29[0] !== undefined ? _args29[0] : {};
  1038. return _context30.abrupt("return", Web3Api.fetch({
  1039. endpoint: {
  1040. "method": "GET",
  1041. "group": "token",
  1042. "name": "getNFTOwners",
  1043. "url": "/nft/:address/owners"
  1044. },
  1045. params: options
  1046. }));
  1047. case 2:
  1048. case "end":
  1049. return _context30.stop();
  1050. }
  1051. }
  1052. }, _callee29);
  1053. }));
  1054. return function () {
  1055. return _getNFTOwners.apply(this, arguments);
  1056. };
  1057. }(),
  1058. getNFTMetadata: function () {
  1059. var _getNFTMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee30() {
  1060. var options,
  1061. _args30 = arguments;
  1062. return _regenerator.default.wrap(function (_context31) {
  1063. while (1) {
  1064. switch (_context31.prev = _context31.next) {
  1065. case 0:
  1066. options = _args30.length > 0 && _args30[0] !== undefined ? _args30[0] : {};
  1067. return _context31.abrupt("return", Web3Api.fetch({
  1068. endpoint: {
  1069. "method": "GET",
  1070. "group": "token",
  1071. "name": "getNFTMetadata",
  1072. "url": "/nft/:address/metadata"
  1073. },
  1074. params: options
  1075. }));
  1076. case 2:
  1077. case "end":
  1078. return _context31.stop();
  1079. }
  1080. }
  1081. }, _callee30);
  1082. }));
  1083. return function () {
  1084. return _getNFTMetadata.apply(this, arguments);
  1085. };
  1086. }(),
  1087. reSyncMetadata: function () {
  1088. var _reSyncMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee31() {
  1089. var options,
  1090. _args31 = arguments;
  1091. return _regenerator.default.wrap(function (_context32) {
  1092. while (1) {
  1093. switch (_context32.prev = _context32.next) {
  1094. case 0:
  1095. options = _args31.length > 0 && _args31[0] !== undefined ? _args31[0] : {};
  1096. return _context32.abrupt("return", Web3Api.fetch({
  1097. endpoint: {
  1098. "method": "GET",
  1099. "group": "token",
  1100. "name": "reSyncMetadata",
  1101. "url": "/nft/:address/:token_id/metadata/resync"
  1102. },
  1103. params: options
  1104. }));
  1105. case 2:
  1106. case "end":
  1107. return _context32.stop();
  1108. }
  1109. }
  1110. }, _callee31);
  1111. }));
  1112. return function () {
  1113. return _reSyncMetadata.apply(this, arguments);
  1114. };
  1115. }(),
  1116. syncNFTContract: function () {
  1117. var _syncNFTContract = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee32() {
  1118. var options,
  1119. _args32 = arguments;
  1120. return _regenerator.default.wrap(function (_context33) {
  1121. while (1) {
  1122. switch (_context33.prev = _context33.next) {
  1123. case 0:
  1124. options = _args32.length > 0 && _args32[0] !== undefined ? _args32[0] : {};
  1125. return _context33.abrupt("return", Web3Api.fetch({
  1126. endpoint: {
  1127. "method": "PUT",
  1128. "group": "token",
  1129. "name": "syncNFTContract",
  1130. "url": "/nft/:address/sync"
  1131. },
  1132. params: options
  1133. }));
  1134. case 2:
  1135. case "end":
  1136. return _context33.stop();
  1137. }
  1138. }
  1139. }, _callee32);
  1140. }));
  1141. return function () {
  1142. return _syncNFTContract.apply(this, arguments);
  1143. };
  1144. }(),
  1145. getTokenIdMetadata: function () {
  1146. var _getTokenIdMetadata = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee33() {
  1147. var options,
  1148. _args33 = arguments;
  1149. return _regenerator.default.wrap(function (_context34) {
  1150. while (1) {
  1151. switch (_context34.prev = _context34.next) {
  1152. case 0:
  1153. options = _args33.length > 0 && _args33[0] !== undefined ? _args33[0] : {};
  1154. return _context34.abrupt("return", Web3Api.fetch({
  1155. endpoint: {
  1156. "method": "GET",
  1157. "group": "token",
  1158. "name": "getTokenIdMetadata",
  1159. "url": "/nft/:address/:token_id"
  1160. },
  1161. params: options
  1162. }));
  1163. case 2:
  1164. case "end":
  1165. return _context34.stop();
  1166. }
  1167. }
  1168. }, _callee33);
  1169. }));
  1170. return function () {
  1171. return _getTokenIdMetadata.apply(this, arguments);
  1172. };
  1173. }(),
  1174. getTokenIdOwners: function () {
  1175. var _getTokenIdOwners = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee34() {
  1176. var options,
  1177. _args34 = arguments;
  1178. return _regenerator.default.wrap(function (_context35) {
  1179. while (1) {
  1180. switch (_context35.prev = _context35.next) {
  1181. case 0:
  1182. options = _args34.length > 0 && _args34[0] !== undefined ? _args34[0] : {};
  1183. return _context35.abrupt("return", Web3Api.fetch({
  1184. endpoint: {
  1185. "method": "GET",
  1186. "group": "token",
  1187. "name": "getTokenIdOwners",
  1188. "url": "/nft/:address/:token_id/owners"
  1189. },
  1190. params: options
  1191. }));
  1192. case 2:
  1193. case "end":
  1194. return _context35.stop();
  1195. }
  1196. }
  1197. }, _callee34);
  1198. }));
  1199. return function () {
  1200. return _getTokenIdOwners.apply(this, arguments);
  1201. };
  1202. }(),
  1203. getWalletTokenIdTransfers: function () {
  1204. var _getWalletTokenIdTransfers = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee35() {
  1205. var options,
  1206. _args35 = arguments;
  1207. return _regenerator.default.wrap(function (_context36) {
  1208. while (1) {
  1209. switch (_context36.prev = _context36.next) {
  1210. case 0:
  1211. options = _args35.length > 0 && _args35[0] !== undefined ? _args35[0] : {};
  1212. return _context36.abrupt("return", Web3Api.fetch({
  1213. endpoint: {
  1214. "method": "GET",
  1215. "group": "token",
  1216. "name": "getWalletTokenIdTransfers",
  1217. "url": "/nft/:address/:token_id/transfers"
  1218. },
  1219. params: options
  1220. }));
  1221. case 2:
  1222. case "end":
  1223. return _context36.stop();
  1224. }
  1225. }
  1226. }, _callee35);
  1227. }));
  1228. return function () {
  1229. return _getWalletTokenIdTransfers.apply(this, arguments);
  1230. };
  1231. }()
  1232. });
  1233. (0, _defineProperty2.default)(Web3Api, "resolve", {
  1234. resolveDomain: function () {
  1235. var _resolveDomain = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee36() {
  1236. var options,
  1237. _args36 = arguments;
  1238. return _regenerator.default.wrap(function (_context37) {
  1239. while (1) {
  1240. switch (_context37.prev = _context37.next) {
  1241. case 0:
  1242. options = _args36.length > 0 && _args36[0] !== undefined ? _args36[0] : {};
  1243. return _context37.abrupt("return", Web3Api.fetch({
  1244. endpoint: {
  1245. "method": "GET",
  1246. "group": "resolve",
  1247. "name": "resolveDomain",
  1248. "url": "/resolve/:domain"
  1249. },
  1250. params: options
  1251. }));
  1252. case 2:
  1253. case "end":
  1254. return _context37.stop();
  1255. }
  1256. }
  1257. }, _callee36);
  1258. }));
  1259. return function () {
  1260. return _resolveDomain.apply(this, arguments);
  1261. };
  1262. }(),
  1263. resolveAddress: function () {
  1264. var _resolveAddress = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee37() {
  1265. var options,
  1266. _args37 = arguments;
  1267. return _regenerator.default.wrap(function (_context38) {
  1268. while (1) {
  1269. switch (_context38.prev = _context38.next) {
  1270. case 0:
  1271. options = _args37.length > 0 && _args37[0] !== undefined ? _args37[0] : {};
  1272. return _context38.abrupt("return", Web3Api.fetch({
  1273. endpoint: {
  1274. "method": "GET",
  1275. "group": "resolve",
  1276. "name": "resolveAddress",
  1277. "url": "/resolve/:address/reverse"
  1278. },
  1279. params: options
  1280. }));
  1281. case 2:
  1282. case "end":
  1283. return _context38.stop();
  1284. }
  1285. }
  1286. }, _callee37);
  1287. }));
  1288. return function () {
  1289. return _resolveAddress.apply(this, arguments);
  1290. };
  1291. }()
  1292. });
  1293. (0, _defineProperty2.default)(Web3Api, "defi", {
  1294. getPairReserves: function () {
  1295. var _getPairReserves = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee38() {
  1296. var options,
  1297. _args38 = arguments;
  1298. return _regenerator.default.wrap(function (_context39) {
  1299. while (1) {
  1300. switch (_context39.prev = _context39.next) {
  1301. case 0:
  1302. options = _args38.length > 0 && _args38[0] !== undefined ? _args38[0] : {};
  1303. return _context39.abrupt("return", Web3Api.fetch({
  1304. endpoint: {
  1305. "method": "GET",
  1306. "group": "defi",
  1307. "name": "getPairReserves",
  1308. "url": "/:pair_address/reserves"
  1309. },
  1310. params: options
  1311. }));
  1312. case 2:
  1313. case "end":
  1314. return _context39.stop();
  1315. }
  1316. }
  1317. }, _callee38);
  1318. }));
  1319. return function () {
  1320. return _getPairReserves.apply(this, arguments);
  1321. };
  1322. }(),
  1323. getPairAddress: function () {
  1324. var _getPairAddress = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee39() {
  1325. var options,
  1326. _args39 = arguments;
  1327. return _regenerator.default.wrap(function (_context40) {
  1328. while (1) {
  1329. switch (_context40.prev = _context40.next) {
  1330. case 0:
  1331. options = _args39.length > 0 && _args39[0] !== undefined ? _args39[0] : {};
  1332. return _context40.abrupt("return", Web3Api.fetch({
  1333. endpoint: {
  1334. "method": "GET",
  1335. "group": "defi",
  1336. "name": "getPairAddress",
  1337. "url": "/:token0_address/:token1_address/pairAddress"
  1338. },
  1339. params: options
  1340. }));
  1341. case 2:
  1342. case "end":
  1343. return _context40.stop();
  1344. }
  1345. }
  1346. }, _callee39);
  1347. }));
  1348. return function () {
  1349. return _getPairAddress.apply(this, arguments);
  1350. };
  1351. }()
  1352. });
  1353. (0, _defineProperty2.default)(Web3Api, "storage", {
  1354. uploadFolder: function () {
  1355. var _uploadFolder = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee40() {
  1356. var options,
  1357. _args40 = arguments;
  1358. return _regenerator.default.wrap(function (_context41) {
  1359. while (1) {
  1360. switch (_context41.prev = _context41.next) {
  1361. case 0:
  1362. options = _args40.length > 0 && _args40[0] !== undefined ? _args40[0] : {};
  1363. return _context41.abrupt("return", Web3Api.fetch({
  1364. endpoint: {
  1365. "method": "POST",
  1366. "group": "storage",
  1367. "name": "uploadFolder",
  1368. "url": "/ipfs/uploadFolder",
  1369. "bodyParams": [{
  1370. "key": "data",
  1371. "type": "set body",
  1372. "required": false
  1373. }]
  1374. },
  1375. params: options
  1376. }));
  1377. case 2:
  1378. case "end":
  1379. return _context41.stop();
  1380. }
  1381. }
  1382. }, _callee40);
  1383. }));
  1384. return function () {
  1385. return _uploadFolder.apply(this, arguments);
  1386. };
  1387. }()
  1388. });
  1389. (0, _defineProperty2.default)(Web3Api, "info", {
  1390. web3ApiVersion: function () {
  1391. var _web3ApiVersion = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee41() {
  1392. var options,
  1393. _args41 = arguments;
  1394. return _regenerator.default.wrap(function (_context42) {
  1395. while (1) {
  1396. switch (_context42.prev = _context42.next) {
  1397. case 0:
  1398. options = _args41.length > 0 && _args41[0] !== undefined ? _args41[0] : {};
  1399. return _context42.abrupt("return", Web3Api.fetch({
  1400. endpoint: {
  1401. "method": "GET",
  1402. "group": "info",
  1403. "name": "web3ApiVersion",
  1404. "url": "/web3/version"
  1405. },
  1406. params: options
  1407. }));
  1408. case 2:
  1409. case "end":
  1410. return _context42.stop();
  1411. }
  1412. }
  1413. }, _callee41);
  1414. }));
  1415. return function () {
  1416. return _web3ApiVersion.apply(this, arguments);
  1417. };
  1418. }(),
  1419. endpointWeights: function () {
  1420. var _endpointWeights = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee42() {
  1421. var options,
  1422. _args42 = arguments;
  1423. return _regenerator.default.wrap(function (_context43) {
  1424. while (1) {
  1425. switch (_context43.prev = _context43.next) {
  1426. case 0:
  1427. options = _args42.length > 0 && _args42[0] !== undefined ? _args42[0] : {};
  1428. return _context43.abrupt("return", Web3Api.fetch({
  1429. endpoint: {
  1430. "method": "GET",
  1431. "group": "info",
  1432. "name": "endpointWeights",
  1433. "url": "/info/endpointWeights"
  1434. },
  1435. params: options
  1436. }));
  1437. case 2:
  1438. case "end":
  1439. return _context43.stop();
  1440. }
  1441. }
  1442. }, _callee42);
  1443. }));
  1444. return function () {
  1445. return _endpointWeights.apply(this, arguments);
  1446. };
  1447. }()
  1448. });
  1449. var _default = Web3Api;
  1450. exports.default = _default;