@rabby-wallet/rabby-api 0.6.25 → 0.6.27

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, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
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';
4
4
  interface OpenApiStore {
5
5
  host: string;
6
6
  testnetHost?: string;
@@ -346,13 +346,23 @@ export declare class OpenApiService {
346
346
  req: TxRequest;
347
347
  }>;
348
348
  getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
349
+ getTxRequest: (id: string) => Promise<TxRequest>;
349
350
  withdrawTx: (reqId: string) => Promise<{
350
351
  req: TxRequest;
351
352
  }>;
352
353
  retryPushTx: (reqId: string) => Promise<{
353
354
  req: TxRequest;
354
355
  }>;
355
- mempoolChecks: (txId: string, chainId: string) => Promise<MempoolCheckDetail[]>;
356
+ mempoolChecks: (txId: string, chainId: string, node_info?: boolean) => Promise<MempoolCheckDetail[]>;
357
+ getPendingTxList: (params: {
358
+ chain_id: string;
359
+ }, options?: Parameters<typeof this.asyncJob>[1]) => Promise<{
360
+ pending_tx_list: PendingTxItem[];
361
+ token_dict: Record<string, TokenItem | NFTItem>;
362
+ }>;
363
+ getLatestPreExec: (params: {
364
+ id: string;
365
+ }) => Promise<LatestExplainTxResponse>;
356
366
  walletSupportChain: (params: {
357
367
  chain_id: string;
358
368
  user_addr: string;
package/dist/index.js CHANGED
@@ -779,6 +779,14 @@ export class OpenApiService {
779
779
  });
780
780
  return data;
781
781
  });
782
+ this.getTxRequest = (id) => __awaiter(this, void 0, void 0, function* () {
783
+ const { data } = yield this.request.get('/v1/wallet/get_tx_request', {
784
+ params: {
785
+ id,
786
+ },
787
+ });
788
+ return data;
789
+ });
782
790
  this.withdrawTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
783
791
  const { data } = yield this.request.post('/v1/wallet/withdraw_tx', {
784
792
  id: reqId,
@@ -791,14 +799,26 @@ export class OpenApiService {
791
799
  });
792
800
  return data;
793
801
  });
794
- this.mempoolChecks = (txId, chainId) => __awaiter(this, void 0, void 0, function* () {
802
+ this.mempoolChecks = (txId, chainId, node_info) => __awaiter(this, void 0, void 0, function* () {
795
803
  var _r;
796
804
  const { data } = yield this.request.get('/v1/wallet/mempool_checks', Object.assign({ params: {
797
805
  tx_id: txId,
798
806
  chain_id: chainId,
807
+ node_info: node_info ? 1 : 0,
799
808
  } }, this._getRequestOptions((_r = getChainByNetwork(chainId)) === null || _r === void 0 ? void 0 : _r.serverId)));
800
809
  return data;
801
810
  });
811
+ this.getPendingTxList = (params, options) => __awaiter(this, void 0, void 0, function* () {
812
+ var _s;
813
+ const data = yield this.asyncJob('/v1/wallet/get_pending_tx_list', Object.assign(Object.assign({ params }, this._getRequestOptions((_s = getChainByNetwork(params.chain_id)) === null || _s === void 0 ? void 0 : _s.serverId)), options));
814
+ return data;
815
+ });
816
+ this.getLatestPreExec = (params) => __awaiter(this, void 0, void 0, function* () {
817
+ const { data } = yield this.request.get('/v1/wallet/get_latest_pre_exec', {
818
+ params,
819
+ });
820
+ return data;
821
+ });
802
822
  this.walletSupportChain = (params) => __awaiter(this, void 0, void 0, function* () {
803
823
  const { data } = yield this.request.post('/v1/wallet/support_chain', params);
804
824
  return data;
package/dist/types.d.ts CHANGED
@@ -375,17 +375,18 @@ export interface GasLevel {
375
375
  price: number;
376
376
  front_tx_count: number;
377
377
  estimated_seconds: number;
378
+ priority_price: number | null;
378
379
  base_fee: number;
379
380
  }
380
- export interface BalanceChange {
381
+ export interface BalanceChange<T = TokenItem, N = TransferingNFTItem> {
381
382
  error?: {
382
383
  code: number;
383
384
  msg: string;
384
385
  } | null;
385
- receive_nft_list: TransferingNFTItem[];
386
- receive_token_list: TokenItem[];
387
- send_nft_list: TransferingNFTItem[];
388
- send_token_list: TokenItem[];
386
+ receive_nft_list: N[];
387
+ receive_token_list: T[];
388
+ send_nft_list: N[];
389
+ send_token_list: T[];
389
390
  success: boolean;
390
391
  usd_value_change: number;
391
392
  }
@@ -534,6 +535,14 @@ export interface ExplainTxResponse {
534
535
  }[];
535
536
  };
536
537
  }
538
+ export interface LatestExplainTxResponse {
539
+ id: string;
540
+ tx_id: string;
541
+ block_height: number;
542
+ gas_used: number;
543
+ pre_exec_result: PreExecResult;
544
+ create_at: number;
545
+ }
537
546
  export interface RPCResponse<T> {
538
547
  result: T;
539
548
  id: number;
@@ -1019,6 +1028,7 @@ export interface TxRequest {
1019
1028
  create_at: number;
1020
1029
  low_gas_deadline?: number;
1021
1030
  is_finished: boolean;
1031
+ predict_packed_at?: number;
1022
1032
  }
1023
1033
  export interface MempoolCheckDetail {
1024
1034
  id: string;
@@ -1027,6 +1037,9 @@ export interface MempoolCheckDetail {
1027
1037
  check_at: string;
1028
1038
  check_success: boolean;
1029
1039
  rpc: string;
1040
+ name?: string;
1041
+ operator?: string;
1042
+ packed_rate?: number;
1030
1043
  }
1031
1044
  export interface JobResponse<T = any> {
1032
1045
  create_at: number;
@@ -1042,4 +1055,54 @@ export interface JobResponse<T = any> {
1042
1055
  status: 'pending' | 'running';
1043
1056
  } | null;
1044
1057
  }
1058
+ export interface PreExecResult {
1059
+ balance_change: BalanceChange;
1060
+ gas: {
1061
+ success?: boolean;
1062
+ error?: {
1063
+ code: number;
1064
+ msg: string;
1065
+ } | null;
1066
+ gas_used: number;
1067
+ gas_limit: number;
1068
+ };
1069
+ is_multisig: boolean;
1070
+ multisig?: any;
1071
+ pre_exec: {
1072
+ success: boolean;
1073
+ error?: {
1074
+ code: number;
1075
+ msg: string;
1076
+ } | null;
1077
+ };
1078
+ }
1079
+ export interface PendingTxItem {
1080
+ id: string;
1081
+ action_data: ParseTxResponse['action']['data'];
1082
+ action_type: ParseTxResponse['action']['type'];
1083
+ block_height?: number | null;
1084
+ gas_price?: number | null;
1085
+ gas_used?: number | null;
1086
+ pre_exec_at?: number | null;
1087
+ pre_exec_result?: Omit<PreExecResult, 'balance_change'> & {
1088
+ balance_change: BalanceChange<{
1089
+ chain: string;
1090
+ token_id: string;
1091
+ amount: number;
1092
+ }, {
1093
+ chain: string;
1094
+ token_id: string;
1095
+ amount: number;
1096
+ }>;
1097
+ };
1098
+ to_addr: string;
1099
+ to_addr_desc: {
1100
+ cex?: Cex | null;
1101
+ protocol?: {
1102
+ id: string;
1103
+ logo_url: string;
1104
+ name: string;
1105
+ };
1106
+ };
1107
+ }
1045
1108
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"