@rabby-wallet/rabby-api 0.6.25 → 0.6.26

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
@@ -377,15 +377,15 @@ export interface GasLevel {
377
377
  estimated_seconds: number;
378
378
  base_fee: number;
379
379
  }
380
- export interface BalanceChange {
380
+ export interface BalanceChange<T = TokenItem, N = TransferingNFTItem> {
381
381
  error?: {
382
382
  code: number;
383
383
  msg: string;
384
384
  } | null;
385
- receive_nft_list: TransferingNFTItem[];
386
- receive_token_list: TokenItem[];
387
- send_nft_list: TransferingNFTItem[];
388
- send_token_list: TokenItem[];
385
+ receive_nft_list: N[];
386
+ receive_token_list: T[];
387
+ send_nft_list: N[];
388
+ send_token_list: T[];
389
389
  success: boolean;
390
390
  usd_value_change: number;
391
391
  }
@@ -534,6 +534,14 @@ export interface ExplainTxResponse {
534
534
  }[];
535
535
  };
536
536
  }
537
+ export interface LatestExplainTxResponse {
538
+ id: string;
539
+ tx_id: string;
540
+ block_height: number;
541
+ gas_used: number;
542
+ pre_exec_result: PreExecResult;
543
+ create_at: number;
544
+ }
537
545
  export interface RPCResponse<T> {
538
546
  result: T;
539
547
  id: number;
@@ -1019,6 +1027,7 @@ export interface TxRequest {
1019
1027
  create_at: number;
1020
1028
  low_gas_deadline?: number;
1021
1029
  is_finished: boolean;
1030
+ predict_packed_at?: number;
1022
1031
  }
1023
1032
  export interface MempoolCheckDetail {
1024
1033
  id: string;
@@ -1027,6 +1036,9 @@ export interface MempoolCheckDetail {
1027
1036
  check_at: string;
1028
1037
  check_success: boolean;
1029
1038
  rpc: string;
1039
+ name?: string;
1040
+ operator?: string;
1041
+ packed_rate?: number;
1030
1042
  }
1031
1043
  export interface JobResponse<T = any> {
1032
1044
  create_at: number;
@@ -1042,4 +1054,54 @@ export interface JobResponse<T = any> {
1042
1054
  status: 'pending' | 'running';
1043
1055
  } | null;
1044
1056
  }
1057
+ export interface PreExecResult {
1058
+ balance_change: BalanceChange;
1059
+ gas: {
1060
+ success?: boolean;
1061
+ error?: {
1062
+ code: number;
1063
+ msg: string;
1064
+ } | null;
1065
+ gas_used: number;
1066
+ gas_limit: number;
1067
+ };
1068
+ is_multisig: boolean;
1069
+ multisig?: any;
1070
+ pre_exec: {
1071
+ success: boolean;
1072
+ error?: {
1073
+ code: number;
1074
+ msg: string;
1075
+ } | null;
1076
+ };
1077
+ }
1078
+ export interface PendingTxItem {
1079
+ id: string;
1080
+ action_data: ParseTxResponse['action']['data'];
1081
+ action_type: ParseTxResponse['action']['type'];
1082
+ block_height?: number | null;
1083
+ gas_price?: number | null;
1084
+ gas_used?: number | null;
1085
+ pre_exec_at?: number | null;
1086
+ pre_exec_result?: Omit<PreExecResult, 'balance_change'> & {
1087
+ balance_change: BalanceChange<{
1088
+ chain: string;
1089
+ token_id: string;
1090
+ amount: number;
1091
+ }, {
1092
+ chain: string;
1093
+ token_id: string;
1094
+ amount: number;
1095
+ }>;
1096
+ };
1097
+ to_addr: string;
1098
+ to_addr_desc: {
1099
+ cex?: Cex | null;
1100
+ protocol?: {
1101
+ id: string;
1102
+ logo_url: string;
1103
+ name: string;
1104
+ };
1105
+ };
1106
+ }
1045
1107
  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.26",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"