@rabby-wallet/rabby-api 0.9.1 → 0.9.2-2.beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AxiosAdapter, AxiosRequestConfig } from 'axios';
2
2
  import { RateLimitedAxiosInstance } from 'axios-rate-limit';
3
3
  import { InitOptions, RabbyApiPlugin } from './plugins/intf';
4
- import { AddrDescResponse, BridgeAggregator, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, DbkBridgeHistoryItem, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, HistoryCurve, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, NodeStatus, NodeStatusDetail, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SupportedChain, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse } from './types';
4
+ import { AddrDescResponse, BridgeAggregator, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, DbkBridgeHistoryItem, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, HistoryCurve, LatestExplainTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, NodeStatus, NodeStatusDetail, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, PendingTxItem, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SupportedChain, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, TokenEntityDetail, TokenItemWithEntity, ProjectItem } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -44,6 +44,14 @@ export declare class OpenApiService {
44
44
  private _mountMethods;
45
45
  getRecommendChains: (address: string, origin: string) => Promise<ServerChain[]>;
46
46
  getTotalBalance: (address: string, isCore?: boolean) => Promise<TotalBalanceResponse>;
47
+ getTotalBalanceV2: ({ address, isCore, included_token_uuids, excluded_token_uuids, excluded_protocol_ids, excluded_chain_ids, }: {
48
+ address: string;
49
+ isCore: boolean;
50
+ included_token_uuids: string[];
51
+ excluded_token_uuids: string[];
52
+ excluded_protocol_ids: string[];
53
+ excluded_chain_ids: string[];
54
+ }) => Promise<TotalBalanceResponse>;
47
55
  getPendingCount: (address: string) => Promise<{
48
56
  total_count: number;
49
57
  chains: ChainWithPendingCount[];
@@ -70,10 +78,7 @@ export declare class OpenApiService {
70
78
  explainText: (origin: string, address: string, text: string) => Promise<{
71
79
  comment: string;
72
80
  }>;
73
- gasMarket: (options: {
74
- chainId: string;
75
- customGas?: number;
76
- }) => Promise<GasLevel[]>;
81
+ gasMarket: (chainId: string, customGas?: number) => Promise<GasLevel[]>;
77
82
  gasMarketV2: (options: {
78
83
  chainId: string;
79
84
  tx?: Tx;
@@ -89,6 +94,7 @@ export declare class OpenApiService {
89
94
  getToken: (id: string, chainId: string, tokenId: string) => Promise<TokenItem>;
90
95
  getCachedTokenList: (id: string) => Promise<TokenItem[]>;
91
96
  listToken: (id: string, chainId?: string, isAll?: boolean) => Promise<TokenItem[]>;
97
+ getTokenEntity: (id: string, chainId?: string) => Promise<TokenEntityDetail>;
92
98
  getHistoryTokenList: (params: {
93
99
  id: string;
94
100
  chainId?: string;
@@ -97,7 +103,7 @@ export declare class OpenApiService {
97
103
  }) => Promise<TokenItem[]>;
98
104
  customListToken: (uuids: string[], id: string) => Promise<TokenItem[]>;
99
105
  listChainAssets: (id: string) => Promise<AssetItem[]>;
100
- listNFT: (id: string, isAll?: boolean) => Promise<NFTItem[]>;
106
+ listNFT: (id: string, isAll?: boolean, sortByCredit?: boolean) => Promise<NFTItem[]>;
101
107
  listCollection: (params: {
102
108
  collection_ids: string;
103
109
  }) => Promise<Collection[]>;
@@ -112,6 +118,7 @@ export declare class OpenApiService {
112
118
  getAllTxHistory: (params: {
113
119
  id: string;
114
120
  start_time?: number;
121
+ page_count?: number;
115
122
  }, options?: Parameters<typeof this.asyncJob>[1]) => Promise<TxAllHistoryResult>;
116
123
  tokenPrice: (tokenName: string) => Promise<{
117
124
  change_percent: number;
@@ -165,6 +172,9 @@ export declare class OpenApiService {
165
172
  getGasStationChainBalance: (chain_id: string, addr: string) => Promise<{
166
173
  usd_value: number;
167
174
  }>;
175
+ getApprovalCount: (address: string) => Promise<{
176
+ total_asset_cnt: number;
177
+ }>;
168
178
  getGasStationTokenList: () => Promise<TokenItem[]>;
169
179
  explainTypedData: (user_addr: string, origin: string, data: any) => Promise<ExplainTypedDataResponse>;
170
180
  checkTypedData: (user_addr: string, origin: string, data: any) => Promise<SecurityCheckResponse>;
@@ -221,6 +231,11 @@ export declare class OpenApiService {
221
231
  start: string;
222
232
  limit: string;
223
233
  }) => Promise<SwapTradeList>;
234
+ getSwapTradeListV2: (params: {
235
+ user_addr: string;
236
+ limit: number;
237
+ start_time?: number;
238
+ }) => Promise<SwapTradeList>;
224
239
  postSwap: (params: {
225
240
  quote: {
226
241
  pay_token_id: string;
@@ -335,6 +350,9 @@ export declare class OpenApiService {
335
350
  hasTransfer: (chainId: string, from: string, to: string) => Promise<{
336
351
  has_transfer: boolean;
337
352
  }>;
353
+ hasTransferAllChain: (from: string, to: string) => Promise<{
354
+ has_transfer: boolean;
355
+ }>;
338
356
  isTokenContract: (chainId: string, id: string) => Promise<{
339
357
  is_token: boolean;
340
358
  }>;
@@ -467,8 +485,25 @@ export declare class OpenApiService {
467
485
  log_id: string;
468
486
  low_gas_deadline?: number;
469
487
  origin?: string;
488
+ sig?: string;
470
489
  }) => Promise<{
471
490
  req: TxRequest;
491
+ access_token?: string;
492
+ }>;
493
+ submitTxV2: (postData: {
494
+ req_id?: string;
495
+ tx: Tx;
496
+ push_type: TxPushType;
497
+ is_gasless?: boolean;
498
+ is_gas_account?: boolean;
499
+ log_id: string;
500
+ low_gas_deadline?: number;
501
+ origin?: string;
502
+ sig?: string;
503
+ txhash?: string;
504
+ }) => Promise<{
505
+ req: TxRequest;
506
+ access_token?: string;
472
507
  }>;
473
508
  getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
474
509
  getTxRequest: (id: string) => Promise<TxRequest>;
@@ -517,6 +552,7 @@ export declare class OpenApiService {
517
552
  chain_id?: string;
518
553
  start?: number;
519
554
  limit?: number;
555
+ match_id?: boolean;
520
556
  }) => Promise<{
521
557
  page: {
522
558
  limit: number;
@@ -858,12 +894,24 @@ export declare class OpenApiService {
858
894
  sig: string;
859
895
  id: string;
860
896
  }) => Promise<{
861
- account: {
862
- id: string;
863
- balance: number;
864
- create_at: number;
865
- nonce: number;
866
- };
897
+ account: GasAccountInfo;
898
+ }>;
899
+ getGasAccountInfoV2: (params: {
900
+ id: string;
901
+ }) => Promise<{
902
+ account: GasAccountInfo;
903
+ }>;
904
+ createGasAccountPayInfo: (postData: {
905
+ id: string;
906
+ }) => Promise<{
907
+ account: GasAccountInfo;
908
+ }>;
909
+ confirmIapOrder: (postData: {
910
+ transaction_id: string;
911
+ device_type: 'android' | 'ios';
912
+ product_id: string;
913
+ }) => Promise<{
914
+ req: TxRequest;
867
915
  }>;
868
916
  loginGasAccount: (params: {
869
917
  sig: string;
@@ -893,9 +941,16 @@ export declare class OpenApiService {
893
941
  sig: string;
894
942
  amount: number;
895
943
  account_id: string;
944
+ user_addr: string;
945
+ chain_id: string;
946
+ fee: number;
896
947
  }) => Promise<{
897
948
  success: boolean;
898
949
  }>;
950
+ getWithdrawList: (p: {
951
+ sig: string;
952
+ id: string;
953
+ }) => Promise<WithdrawListAddressItem[]>;
899
954
  getGasAccountHistory: (p: {
900
955
  sig: string;
901
956
  account_id: string;
@@ -910,6 +965,14 @@ export declare class OpenApiService {
910
965
  tx_id: string;
911
966
  user_addr: string;
912
967
  }[];
968
+ withdraw_list: {
969
+ amount: number;
970
+ chain_id: string;
971
+ create_at: number;
972
+ gas_account_id: string;
973
+ tx_id: string;
974
+ user_addr: string;
975
+ }[];
913
976
  history_list: {
914
977
  id: string;
915
978
  chain_id: string;
@@ -928,7 +991,7 @@ export declare class OpenApiService {
928
991
  };
929
992
  }>;
930
993
  checkGasAccountTxs: (p: {
931
- sig: string;
994
+ sig?: string;
932
995
  account_id: string;
933
996
  tx_list: Tx[];
934
997
  }) => Promise<GasAccountCheckResult>;
@@ -1001,5 +1064,94 @@ export declare class OpenApiService {
1001
1064
  }) => Promise<{
1002
1065
  success: boolean;
1003
1066
  }>;
1067
+ /**
1068
+ * @deprecated
1069
+ */
1070
+ getToken24hPrice: (params: {
1071
+ chain_id: string;
1072
+ id: string;
1073
+ }) => Promise<{
1074
+ time_at: number;
1075
+ price: number;
1076
+ }[]>;
1077
+ getTokenPriceCurve: (params: {
1078
+ chain_id: string;
1079
+ id: string;
1080
+ days: number | 1 | 7;
1081
+ }) => Promise<{
1082
+ time_at: number;
1083
+ price: number;
1084
+ }[]>;
1085
+ getTokenDatePrice: (params: {
1086
+ chain_id: string;
1087
+ id: string;
1088
+ }) => Promise<{
1089
+ date_at: string;
1090
+ price: number;
1091
+ }[]>;
1092
+ searchTokens: (params: {
1093
+ q: string;
1094
+ }) => Promise<TokenItem[]>;
1095
+ searchTokensV2: (params: {
1096
+ q: string;
1097
+ }) => Promise<TokenItemWithEntity[]>;
1098
+ batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1099
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1100
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1101
+ currency_code: string;
1102
+ })[]>;
1103
+ getBuyQuote: (params: {
1104
+ country_code: string;
1105
+ user_addr: string;
1106
+ usd_amount: string;
1107
+ currency_code: string;
1108
+ receive_token_uuid: string;
1109
+ }) => Promise<BuyQuoteItem[]>;
1110
+ getBuyWidgetUrl: (params: {
1111
+ country_code: string;
1112
+ user_addr: string;
1113
+ usd_amount: string;
1114
+ receive_token_uuid: string;
1115
+ service_provider: string;
1116
+ currency_code: string;
1117
+ redirect_url?: string;
1118
+ }) => Promise<{
1119
+ url: string;
1120
+ msg: number;
1121
+ }>;
1122
+ getBuyHistory: (params: {
1123
+ user_addr: string;
1124
+ start?: number;
1125
+ limit?: number;
1126
+ }) => Promise<BuyHistoryList>;
1127
+ getBuyPaymentMethods: (params: {
1128
+ currency_code: string;
1129
+ country_code: string;
1130
+ service_provider: string;
1131
+ }) => Promise<BuyPaymentMethod[]>;
1132
+ getBuyCurrencyList: () => Promise<{
1133
+ id: string;
1134
+ name: string;
1135
+ image_url: string;
1136
+ }[]>;
1137
+ getOfflineChainList: () => Promise<{
1138
+ id: string;
1139
+ offline_at: number;
1140
+ }[]>;
1141
+ isBlockedAddress: (id: string) => Promise<{
1142
+ is_blocked: boolean;
1143
+ }>;
1144
+ estimateGasUsd: ({ tx, origin, address, updateNonce, pending_tx_list, }: {
1145
+ tx: Tx;
1146
+ origin: string;
1147
+ address: string;
1148
+ updateNonce: boolean;
1149
+ pending_tx_list: Tx[];
1150
+ }) => Promise<{
1151
+ gas_used?: number;
1152
+ safe_gas_used?: number;
1153
+ }>;
1154
+ getCexSupportList: () => Promise<ProjectItem[]>;
1155
+ getChainRpc: () => Promise<ProjectItem[]>;
1004
1156
  }
1005
1157
  export {};
package/dist/index.js CHANGED
@@ -123,6 +123,17 @@ export class OpenApiService {
123
123
  });
124
124
  return data;
125
125
  });
126
+ this.getTotalBalanceV2 = ({ address, isCore = false, included_token_uuids = [], excluded_token_uuids = [], excluded_protocol_ids = [], excluded_chain_ids = [], }) => __awaiter(this, void 0, void 0, function* () {
127
+ const { data } = yield this.request.post('/v2/user/total_balance', {
128
+ id: address,
129
+ is_core: isCore,
130
+ included_token_uuids: included_token_uuids,
131
+ excluded_token_uuids: excluded_token_uuids,
132
+ excluded_protocol_ids: excluded_protocol_ids,
133
+ excluded_chain_ids: excluded_chain_ids,
134
+ });
135
+ return data;
136
+ });
126
137
  this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
127
138
  const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
128
139
  params: {
@@ -201,11 +212,11 @@ export class OpenApiService {
201
212
  });
202
213
  return data;
203
214
  });
204
- this.gasMarket = (options) => __awaiter(this, void 0, void 0, function* () {
215
+ this.gasMarket = (chainId, customGas) => __awaiter(this, void 0, void 0, function* () {
205
216
  const { data } = yield this.request.get('/v1/wallet/gas_market', {
206
217
  params: {
207
- chain_id: options.chainId,
208
- custom_price: options.customGas,
218
+ chain_id: chainId,
219
+ custom_price: customGas,
209
220
  },
210
221
  });
211
222
  return data;
@@ -287,6 +298,15 @@ export class OpenApiService {
287
298
  });
288
299
  return data;
289
300
  });
301
+ this.getTokenEntity = (id, chainId) => __awaiter(this, void 0, void 0, function* () {
302
+ const { data } = yield this.request.get('/v1/token/identity', {
303
+ params: {
304
+ id,
305
+ chain_id: chainId,
306
+ },
307
+ });
308
+ return data;
309
+ });
290
310
  this.getHistoryTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
291
311
  const { data } = yield this.request.get('/v1/user/history_token_list', {
292
312
  params: {
@@ -316,12 +336,16 @@ export class OpenApiService {
316
336
  });
317
337
  return data;
318
338
  });
319
- this.listNFT = (id, isAll = true) => __awaiter(this, void 0, void 0, function* () {
339
+ this.listNFT = (id, isAll = true, sortByCredit) => __awaiter(this, void 0, void 0, function* () {
320
340
  const { data } = yield this.request.get('/v1/user/nft_list', {
321
- params: {
341
+ params: Object.assign({
322
342
  id,
323
343
  is_all: isAll,
324
- },
344
+ }, sortByCredit
345
+ ? {
346
+ sort_by: 'credit_score',
347
+ }
348
+ : {}),
325
349
  });
326
350
  return data;
327
351
  });
@@ -379,6 +403,7 @@ export class OpenApiService {
379
403
  this.getSwapQuote = (params) => __awaiter(this, void 0, void 0, function* () {
380
404
  const { data } = yield this.request.get('/v1/wallet/swap_quote', {
381
405
  params,
406
+ timeout: 5000,
382
407
  });
383
408
  return data;
384
409
  });
@@ -416,6 +441,14 @@ export class OpenApiService {
416
441
  });
417
442
  return data;
418
443
  });
444
+ this.getApprovalCount = (address) => __awaiter(this, void 0, void 0, function* () {
445
+ const { data } = yield this.request.get('/v1/user/total_approval_asset_cnt', {
446
+ params: {
447
+ id: address,
448
+ },
449
+ });
450
+ return data;
451
+ });
419
452
  this.getGasStationTokenList = () => __awaiter(this, void 0, void 0, function* () {
420
453
  const { data } = yield this.request.get('/v1/wallet/gas_station_token_list');
421
454
  return data;
@@ -546,6 +579,12 @@ export class OpenApiService {
546
579
  });
547
580
  return data;
548
581
  });
582
+ this.getSwapTradeListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
583
+ const { data } = yield this.request.get('/v2/wallet/swap_trade_list', {
584
+ params,
585
+ });
586
+ return data;
587
+ });
549
588
  this.postSwap = (params) => __awaiter(this, void 0, void 0, function* () {
550
589
  const { data } = yield this.request.post('/v1/wallet/swap_trade', params);
551
590
  return data;
@@ -719,6 +758,18 @@ export class OpenApiService {
719
758
  from_addr: from,
720
759
  to_addr: to,
721
760
  },
761
+ timeout: 2000,
762
+ });
763
+ return data;
764
+ });
765
+ // 全链两个地址是否发生过转账
766
+ this.hasTransferAllChain = (from, to) => __awaiter(this, void 0, void 0, function* () {
767
+ const { data } = yield this.request.get('/v2/engine/addr/has_transfer', {
768
+ params: {
769
+ from_addr: from,
770
+ to_addr: to,
771
+ },
772
+ timeout: 2000,
722
773
  });
723
774
  return data;
724
775
  });
@@ -869,7 +920,17 @@ export class OpenApiService {
869
920
  return data;
870
921
  });
871
922
  this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
872
- const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, postData));
923
+ const { sig } = postData, rest = __rest(postData, ["sig"]);
924
+ const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
925
+ headers: sig ? { sig } : undefined,
926
+ });
927
+ return data;
928
+ });
929
+ this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
930
+ const { sig } = postData, rest = __rest(postData, ["sig"]);
931
+ const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
932
+ headers: sig ? { sig } : undefined,
933
+ });
873
934
  return data;
874
935
  });
875
936
  this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
@@ -1215,6 +1276,20 @@ export class OpenApiService {
1215
1276
  });
1216
1277
  return data;
1217
1278
  });
1279
+ this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
1280
+ const { data } = yield this.request.get('/v2/gas_account', {
1281
+ params,
1282
+ });
1283
+ return data;
1284
+ });
1285
+ this.createGasAccountPayInfo = (postData) => __awaiter(this, void 0, void 0, function* () {
1286
+ const { data } = yield this.request.post('/v2/gas_account/pay_info', postData);
1287
+ return data;
1288
+ });
1289
+ this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
1290
+ const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
1291
+ return data;
1292
+ });
1218
1293
  this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
1219
1294
  const { sig } = params, others = __rest(params, ["sig"]);
1220
1295
  const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
@@ -1259,6 +1334,16 @@ export class OpenApiService {
1259
1334
  });
1260
1335
  return data;
1261
1336
  });
1337
+ this.getWithdrawList = (p) => __awaiter(this, void 0, void 0, function* () {
1338
+ const { sig } = p, params = __rest(p, ["sig"]);
1339
+ const { data } = yield this.request.get('/v1/gas_account/withdraw_list', {
1340
+ params,
1341
+ headers: {
1342
+ sig,
1343
+ },
1344
+ });
1345
+ return data;
1346
+ });
1262
1347
  this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
1263
1348
  const { sig } = p, params = __rest(p, ["sig"]);
1264
1349
  const { data } = yield this.request.get('/v1/gas_account/history', {
@@ -1272,9 +1357,11 @@ export class OpenApiService {
1272
1357
  this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
1273
1358
  const { sig } = p, params = __rest(p, ["sig"]);
1274
1359
  const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
1275
- headers: {
1276
- sig,
1277
- },
1360
+ headers: sig
1361
+ ? {
1362
+ sig,
1363
+ }
1364
+ : undefined,
1278
1365
  });
1279
1366
  return data;
1280
1367
  });
@@ -1336,6 +1423,109 @@ export class OpenApiService {
1336
1423
  });
1337
1424
  return data;
1338
1425
  });
1426
+ /**
1427
+ * @deprecated
1428
+ */
1429
+ this.getToken24hPrice = (params) => __awaiter(this, void 0, void 0, function* () {
1430
+ const { data } = yield this.request.get('/v1/token/24h_price', {
1431
+ params,
1432
+ });
1433
+ return data;
1434
+ });
1435
+ this.getTokenPriceCurve = (params) => __awaiter(this, void 0, void 0, function* () {
1436
+ const { data } = yield this.request.get('/v1/token/price_curve', {
1437
+ params,
1438
+ });
1439
+ return data;
1440
+ });
1441
+ this.getTokenDatePrice = (params) => __awaiter(this, void 0, void 0, function* () {
1442
+ const { data } = yield this.request.get('/v1/token/date_price', {
1443
+ params,
1444
+ });
1445
+ return data;
1446
+ });
1447
+ this.searchTokens = (params) => __awaiter(this, void 0, void 0, function* () {
1448
+ const { data } = yield this.request.get('/v1/token/search', {
1449
+ params,
1450
+ });
1451
+ return data;
1452
+ });
1453
+ this.searchTokensV2 = (params) => __awaiter(this, void 0, void 0, function* () {
1454
+ const { data } = yield this.request.get('/v2/token/search', {
1455
+ params,
1456
+ });
1457
+ return data;
1458
+ });
1459
+ this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
1460
+ const { data } = yield this.request.get('/v1/token/list_by_uuids', {
1461
+ params: {
1462
+ uuids: Array.isArray(uuids) ? uuids.join(',') : uuids,
1463
+ },
1464
+ });
1465
+ return data;
1466
+ });
1467
+ this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
1468
+ const { data } = yield this.request.get('/v1/buy/supported_country_list');
1469
+ return data;
1470
+ });
1471
+ this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
1472
+ const { data } = yield this.request.get('/v1/buy/supported_token_list');
1473
+ return data;
1474
+ });
1475
+ this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
1476
+ const { data } = yield this.request.get('/v1/buy/quote', {
1477
+ params,
1478
+ });
1479
+ return data;
1480
+ });
1481
+ this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
1482
+ const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
1483
+ return data;
1484
+ });
1485
+ this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
1486
+ const { data } = yield this.request.get('/v1/buy/history', {
1487
+ params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
1488
+ });
1489
+ return data;
1490
+ });
1491
+ this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
1492
+ const { data } = yield this.request.get('/v1/buy/get_payment_method', {
1493
+ params,
1494
+ });
1495
+ return data;
1496
+ });
1497
+ this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
1498
+ const { data } = yield this.request.get('/v1/buy/supported_currency_list');
1499
+ return data;
1500
+ });
1501
+ this.getOfflineChainList = () => __awaiter(this, void 0, void 0, function* () {
1502
+ const { data } = yield this.request.get('/v1/chain/offline_list');
1503
+ return data;
1504
+ });
1505
+ this.isBlockedAddress = (id) => __awaiter(this, void 0, void 0, function* () {
1506
+ const { data } = yield this.request.get('/v1/engine/addr/is_blocked', {
1507
+ params: { id },
1508
+ });
1509
+ return data;
1510
+ });
1511
+ this.estimateGasUsd = ({ tx, origin, address, updateNonce = false, pending_tx_list = [], }) => __awaiter(this, void 0, void 0, function* () {
1512
+ const { data } = yield this.request.post('/v1/wallet/estimate_gas', {
1513
+ tx,
1514
+ user_addr: address,
1515
+ origin,
1516
+ update_nonce: updateNonce,
1517
+ pending_tx_list,
1518
+ });
1519
+ return data;
1520
+ });
1521
+ this.getCexSupportList = () => __awaiter(this, void 0, void 0, function* () {
1522
+ const { data } = yield this.request.get('/v1/cex/supported_list');
1523
+ return data;
1524
+ });
1525
+ this.getChainRpc = () => __awaiter(this, void 0, void 0, function* () {
1526
+ const { data } = yield this.request.get('/v1/chainrpc');
1527
+ return data;
1528
+ });
1339
1529
  if (store instanceof Promise) {
1340
1530
  store.then((resolvedStore) => {
1341
1531
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -93,6 +93,31 @@ export interface TotalBalanceResponse {
93
93
  error_code?: number;
94
94
  err_chain_ids?: string[];
95
95
  }
96
+ export interface TokenEntityDetail {
97
+ id: string;
98
+ chain: string;
99
+ token_id: string;
100
+ symbol: string;
101
+ domain_id: string;
102
+ fdv: number;
103
+ is_domain_verified: boolean;
104
+ relate_domain_ids: string[];
105
+ cmc_id: string;
106
+ coingecko_id: string;
107
+ bridge_ids: string[];
108
+ origin_token?: TokenItem;
109
+ listed_sites: {
110
+ name: string;
111
+ url: string;
112
+ logo_url: string;
113
+ }[];
114
+ cex_list: {
115
+ id: string;
116
+ site_url: string;
117
+ name: string;
118
+ logo_url: string;
119
+ }[];
120
+ }
96
121
  export interface TokenItem {
97
122
  content_type?: 'image' | 'image_url' | 'video_url' | 'audio_url' | undefined;
98
123
  content?: string | undefined;
@@ -103,6 +128,7 @@ export interface TokenItem {
103
128
  display_symbol: string | null;
104
129
  id: string;
105
130
  is_core: boolean;
131
+ credit_score?: number;
106
132
  is_verified: boolean;
107
133
  is_wallet: boolean;
108
134
  is_scam?: boolean;
@@ -120,6 +146,9 @@ export interface TokenItem {
120
146
  price_24h_change?: number | null;
121
147
  low_credit_score?: boolean;
122
148
  }
149
+ export interface TokenItemWithEntity extends TokenItem {
150
+ identity?: TokenEntityDetail;
151
+ }
123
152
  export interface TransferingNFTItem {
124
153
  chain: string;
125
154
  collection: {
@@ -258,14 +287,16 @@ export interface NFTItem {
258
287
  id: string;
259
288
  contract_id: string;
260
289
  inner_id: string;
261
- token_id: string;
290
+ token_id?: string;
262
291
  name: string;
263
292
  contract_name: string;
264
293
  description: string;
265
- usd_price: number;
294
+ usd_price?: number;
266
295
  amount: number;
267
296
  collection_id?: string;
268
- pay_token: {
297
+ collection_name?: string;
298
+ is_core?: boolean;
299
+ pay_token?: {
269
300
  id: string;
270
301
  name: string;
271
302
  symbol: string;
@@ -282,6 +313,7 @@ export interface NFTItem {
282
313
  collection?: Collection | null;
283
314
  is_erc1155?: boolean;
284
315
  is_erc721: boolean;
316
+ thumbnail_url?: string;
285
317
  }
286
318
  export interface Collection {
287
319
  id: string;
@@ -369,6 +401,7 @@ export interface TxHistoryResult {
369
401
  }
370
402
  export interface TxAllHistoryResult extends Omit<TxHistoryResult, 'token_dict'> {
371
403
  token_uuid_dict: Record<string, TokenItem>;
404
+ project_dict: TxHistoryResult['project_dict'];
372
405
  }
373
406
  export interface GasResult {
374
407
  estimated_gas_cost_usd_value: number;
@@ -821,6 +854,7 @@ export interface AddrDescResponse {
821
854
  born_at: number;
822
855
  is_danger: boolean | null;
823
856
  is_spam: boolean | null;
857
+ is_scam: boolean | null;
824
858
  name: string;
825
859
  };
826
860
  }
@@ -1189,6 +1223,7 @@ export interface ChainListItem {
1189
1223
  };
1190
1224
  explorer: string | null;
1191
1225
  rpc: null | string;
1226
+ rpc_list?: string[];
1192
1227
  }
1193
1228
  export interface HistoryCurve {
1194
1229
  create_at: number;
@@ -1380,4 +1415,76 @@ export interface ParseCommonResponse {
1380
1415
  contract_call_data: ParseTxResponse['contract_call'] | null;
1381
1416
  pre_exec?: PreExecResult['pre_exec'];
1382
1417
  }
1418
+ export interface RechargeChainItem {
1419
+ chain_id: string;
1420
+ withdraw_limit: number;
1421
+ withdraw_fee: number;
1422
+ l1_balance: number;
1423
+ }
1424
+ export interface WithdrawListAddressItem {
1425
+ recharge_addr: string;
1426
+ total_withdraw_limit: number;
1427
+ recharge_chain_list: RechargeChainItem[];
1428
+ }
1429
+ export interface BuyCountryItem {
1430
+ id: string;
1431
+ name: string;
1432
+ image_url: string;
1433
+ regions: null | {
1434
+ regionCode: string;
1435
+ name: string;
1436
+ };
1437
+ }
1438
+ export interface BuyServiceProvider {
1439
+ id: string;
1440
+ name: string;
1441
+ website_url: string;
1442
+ customer_support_url: string;
1443
+ image_url: string;
1444
+ logo_url: string;
1445
+ }
1446
+ export interface BuyQuoteItem {
1447
+ service_provider: BuyServiceProvider;
1448
+ token_amount: number;
1449
+ payment_method_type: string;
1450
+ }
1451
+ export interface BuyHistoryItem {
1452
+ id: string;
1453
+ user_addr: string;
1454
+ status: string;
1455
+ create_at: number;
1456
+ service_provider: BuyServiceProvider;
1457
+ service_provider_url: null | string;
1458
+ pay_usd_amount: number;
1459
+ pay_currency_code: string;
1460
+ payment_type: string;
1461
+ receive_chain_id: string;
1462
+ receive_tx_id: string;
1463
+ receive_token_id: string;
1464
+ receive_amount: number;
1465
+ receive_token: TokenItem;
1466
+ }
1467
+ export interface BuyHistoryList {
1468
+ pagination: {
1469
+ start: number;
1470
+ limit: number;
1471
+ total: number;
1472
+ };
1473
+ histories: BuyHistoryItem[];
1474
+ }
1475
+ export interface BuyPaymentMethod {
1476
+ id: string;
1477
+ name: string;
1478
+ type: string;
1479
+ logo_url: string;
1480
+ }
1481
+ export interface GasAccountInfo {
1482
+ id: string;
1483
+ balance: number;
1484
+ create_at: number;
1485
+ nonce: number;
1486
+ uuid: string;
1487
+ has_iap_order: boolean;
1488
+ no_register: boolean;
1489
+ }
1383
1490
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.9.1",
3
+ "version": "0.9.22.beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [