@rabby-wallet/rabby-api 0.6.27 → 0.6.29-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AxiosAdapter, AxiosRequestConfig } from 'axios';
2
2
  import { RateLimitedAxiosInstance } from 'axios-rate-limit';
3
- import { AddrDescResponse, ApprovalStatus, AssetItem, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
3
+ import { AddrDescResponse, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
4
4
  interface OpenApiStore {
5
5
  host: string;
6
6
  testnetHost?: string;
@@ -387,5 +387,14 @@ export declare class OpenApiService {
387
387
  is_success: boolean;
388
388
  count: number;
389
389
  }>;
390
+ searchDapp: (params: {
391
+ q: string;
392
+ }) => Promise<BasicDappInfo[]>;
393
+ getDappsInfo: (params: {
394
+ ids: string[];
395
+ }) => Promise<BasicDappInfo[]>;
396
+ getHotDapps: (params?: {
397
+ limit: number;
398
+ }) => Promise<BasicDappInfo[]>;
390
399
  }
391
400
  export {};
package/dist/index.js CHANGED
@@ -7,11 +7,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
- import * as sign from '@rabby-wallet/rabby-sign/umd/sign-wasm-rabby';
10
+ // import * as sign from '@rabby-wallet/rabby-sign/umd/sign-wasm-rabby';
11
11
  import axios from 'axios';
12
12
  import rateLimit from 'axios-rate-limit';
13
13
  import { ethErrors } from 'eth-rpc-errors';
14
- import { CHAINS, SIGN_HDS, genSignParams, getChain, getChainByNetwork, sleep, } from './utils';
14
+ import { CHAINS, genSignParams, getChain, getChainByNetwork, sleep, } from './utils';
15
15
  import { ASYNC_JOB_RETRY_DELAY, ASYNC_JOB_TIMEOUT } from './const';
16
16
  import { omit } from 'lodash';
17
17
  const maxRPS = 500;
@@ -42,8 +42,8 @@ export class OpenApiService {
42
42
  throw ethErrors.provider.disconnected();
43
43
  });
44
44
  this.init = (hf) => __awaiter(this, void 0, void 0, function* () {
45
+ // await sign.lW(hf);
45
46
  var _e;
46
- yield sign.lW(hf);
47
47
  const request = axios.create({
48
48
  baseURL: this.store.host,
49
49
  adapter: this.adapter,
@@ -55,12 +55,12 @@ export class OpenApiService {
55
55
  // sign after rateLimit, timestamp is the latest
56
56
  request.interceptors.request.use((config) => {
57
57
  const { method, url, params } = genSignParams(config);
58
- const res = sign.cattleGsW(params, method, url);
59
- config.headers = config.headers || {};
60
- config.headers[SIGN_HDS[0]] = encodeURIComponent(res.ts);
61
- config.headers[SIGN_HDS[1]] = encodeURIComponent(res.nonce);
62
- config.headers[SIGN_HDS[2]] = encodeURIComponent(res.version);
63
- config.headers[SIGN_HDS[3]] = encodeURIComponent(res.signature);
58
+ // const res = sign.cattleGsW(params, method, url);
59
+ // config.headers = config.headers || {};
60
+ // config.headers[SIGN_HDS[0]] = encodeURIComponent(res.ts);
61
+ // config.headers[SIGN_HDS[1]] = encodeURIComponent(res.nonce);
62
+ // config.headers[SIGN_HDS[2]] = encodeURIComponent(res.version);
63
+ // config.headers[SIGN_HDS[3]] = encodeURIComponent(res.signature);
64
64
  return config;
65
65
  });
66
66
  this.request = rateLimit(request, { maxRPS });
@@ -831,6 +831,18 @@ export class OpenApiService {
831
831
  const { data } = yield this.request.post('/v1/wallet/support_selector', params);
832
832
  return data;
833
833
  });
834
+ this.searchDapp = (params) => __awaiter(this, void 0, void 0, function* () {
835
+ const { data } = yield this.request.get('/v1/dapp/search', { params });
836
+ return data;
837
+ });
838
+ this.getDappsInfo = (params) => __awaiter(this, void 0, void 0, function* () {
839
+ const { data } = yield this.request.get('/v1/dapp/list', { params });
840
+ return data;
841
+ });
842
+ this.getHotDapps = (params) => __awaiter(this, void 0, void 0, function* () {
843
+ const { data } = yield this.request.get('/v1/dapp/hot_list', { params });
844
+ return data;
845
+ });
834
846
  if (store instanceof Promise) {
835
847
  store.then((resolvedStore) => {
836
848
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -1029,6 +1029,8 @@ export interface TxRequest {
1029
1029
  low_gas_deadline?: number;
1030
1030
  is_finished: boolean;
1031
1031
  predict_packed_at?: number;
1032
+ predict_err_code?: number;
1033
+ push_at_list?: number[];
1032
1034
  }
1033
1035
  export interface MempoolCheckDetail {
1034
1036
  id: string;
@@ -1105,4 +1107,12 @@ export interface PendingTxItem {
1105
1107
  };
1106
1108
  };
1107
1109
  }
1110
+ export interface BasicDappInfo {
1111
+ id: string;
1112
+ name: string;
1113
+ logo_url: string | null;
1114
+ description: string;
1115
+ user_range: string;
1116
+ tags: string[];
1117
+ }
1108
1118
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.6.27",
3
+ "version": "0.6.29-alpha.0",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"