@rabby-wallet/rabby-api 0.9.26-beta.2 → 0.9.27-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, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, TokenEntityDetail, TokenItemWithEntity, ProjectItem, CopyTradeTokenListResponse, CopyTradeRecentBuyListResponse, CopyTradePnlListResponse, AppChainListResponse } 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, CopyTradeTokenListResponse, CopyTradeRecentBuyListResponse, CopyTradePnlListResponse, AppChainListResponse, CopyTradeTokenListV2Response, CopyTradeRecentBuyListV2Response, CopyTradeTokenItemV2, CopyTradeSameToken, DefaultRPCRes } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -500,6 +500,35 @@ export declare class OpenApiService {
500
500
  req: TxRequest;
501
501
  access_token?: string;
502
502
  }>;
503
+ submitTxV2: (postData: {
504
+ frontend_push_result?: {
505
+ success: true;
506
+ has_pushed: true;
507
+ raw_tx: string;
508
+ url: string;
509
+ return_tx_id: string;
510
+ } | {
511
+ success: false;
512
+ has_pushed: true;
513
+ url: string;
514
+ error_msg: string;
515
+ };
516
+ backend_push_require: {
517
+ gas_type: 'gas_account' | 'gasless' | null;
518
+ };
519
+ context: {
520
+ tx: Tx;
521
+ origin?: string;
522
+ log_id: string;
523
+ };
524
+ mev_share_model: 'user' | 'rabby';
525
+ sig?: string;
526
+ }) => Promise<{
527
+ tx_id?: string;
528
+ access_token?: string;
529
+ err?: string;
530
+ }>;
531
+ getDefaultRPCs: () => Promise<DefaultRPCRes>;
503
532
  getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
504
533
  getTxRequest: (id: string) => Promise<TxRequest>;
505
534
  withdrawTx: (reqId: string) => Promise<{
@@ -1106,11 +1135,33 @@ export declare class OpenApiService {
1106
1135
  limit: number;
1107
1136
  start_time: number;
1108
1137
  }) => Promise<CopyTradeTokenListResponse>;
1138
+ getCopyTradingTokenListV2: (params: {
1139
+ chain_id: string;
1140
+ limit: number;
1141
+ cursor: string;
1142
+ order_by: 'price_change' | 'buy_address_count' | 'token_create_at';
1143
+ order?: 'asc' | 'desc';
1144
+ time_range?: '24h' | '7d' | '30d';
1145
+ }) => Promise<CopyTradeTokenListV2Response>;
1109
1146
  getCopyTradingRecentBuyList: (params: {
1110
1147
  chain_id: string;
1111
1148
  token_id: string;
1112
1149
  limit: number;
1113
1150
  }) => Promise<CopyTradeRecentBuyListResponse>;
1151
+ getCopyTradingRecentBuyListV2: (params: {
1152
+ chain_id: string;
1153
+ token_id: string;
1154
+ limit: number;
1155
+ cursor: string;
1156
+ }) => Promise<CopyTradeRecentBuyListV2Response>;
1157
+ getCopyTradingDetail: (params: {
1158
+ chain_id: string;
1159
+ token_id: string;
1160
+ }) => Promise<CopyTradeTokenItemV2>;
1161
+ getCopyTradingSameName: (params: {
1162
+ chain_id: string;
1163
+ token_id: string;
1164
+ }) => Promise<CopyTradeSameToken[]>;
1114
1165
  getCopyTradingPnlList: (params: {
1115
1166
  user_addr: string;
1116
1167
  }) => Promise<CopyTradePnlListResponse>;
@@ -1172,5 +1223,12 @@ export declare class OpenApiService {
1172
1223
  }>;
1173
1224
  getCexSupportList: () => Promise<ProjectItem[]>;
1174
1225
  getAppChainList: (id: string) => Promise<AppChainListResponse>;
1226
+ checkCex: (postData: {
1227
+ chain_id: string;
1228
+ id: string;
1229
+ cex_id: string;
1230
+ }) => Promise<{
1231
+ success: boolean;
1232
+ }>;
1175
1233
  }
1176
1234
  export {};
package/dist/index.js CHANGED
@@ -933,6 +933,17 @@ export class OpenApiService {
933
933
  });
934
934
  return data;
935
935
  });
936
+ this.submitTxV2 = (postData) => __awaiter(this, void 0, void 0, function* () {
937
+ const { sig } = postData, rest = __rest(postData, ["sig"]);
938
+ const { data } = yield this.request.post('/v2/wallet/submit_tx', Object.assign({}, rest), {
939
+ headers: sig ? { sig } : undefined,
940
+ });
941
+ return data;
942
+ });
943
+ this.getDefaultRPCs = () => __awaiter(this, void 0, void 0, function* () {
944
+ const { data } = yield this.request.get('/v1/chainrpc');
945
+ return data;
946
+ });
936
947
  this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
937
948
  const { data } = yield this.request.get('/v1/wallet/get_tx_requests', {
938
949
  params: {
@@ -1470,12 +1481,36 @@ export class OpenApiService {
1470
1481
  });
1471
1482
  return data;
1472
1483
  });
1484
+ this.getCopyTradingTokenListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
1485
+ const { data } = yield this.request.get('/v2/copytrading/token/list', {
1486
+ params,
1487
+ });
1488
+ return data;
1489
+ });
1473
1490
  this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
1474
1491
  const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
1475
1492
  params,
1476
1493
  });
1477
1494
  return data;
1478
1495
  });
1496
+ this.getCopyTradingRecentBuyListV2 = (params) => __awaiter(this, void 0, void 0, function* () {
1497
+ const { data } = yield this.request.get('/v2/copytrading/recent_buy/list', {
1498
+ params,
1499
+ });
1500
+ return data;
1501
+ });
1502
+ this.getCopyTradingDetail = (params) => __awaiter(this, void 0, void 0, function* () {
1503
+ const { data } = yield this.request.get('/v2/copytrading/token/detail', {
1504
+ params,
1505
+ });
1506
+ return data;
1507
+ });
1508
+ this.getCopyTradingSameName = (params) => __awaiter(this, void 0, void 0, function* () {
1509
+ const { data } = yield this.request.get('/v1/token/same_name', {
1510
+ params,
1511
+ });
1512
+ return data;
1513
+ });
1479
1514
  this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
1480
1515
  const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
1481
1516
  params,
@@ -1554,6 +1589,10 @@ export class OpenApiService {
1554
1589
  });
1555
1590
  return data;
1556
1591
  });
1592
+ this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
1593
+ const { data } = yield this.request.post('/v1/token/check_cex', postData);
1594
+ return data;
1595
+ });
1557
1596
  if (store instanceof Promise) {
1558
1597
  store.then((resolvedStore) => {
1559
1598
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -86,6 +86,25 @@ export interface CopyTradeTokenItem extends TokenItem {
86
86
  export interface CopyTradeTokenListResponse {
87
87
  token_list: CopyTradeTokenItem[];
88
88
  }
89
+ export interface CopyTradeTokenItemV2 extends CopyTradeTokenItem {
90
+ buy_address_count: number;
91
+ token_create_at: number;
92
+ liquidity: number;
93
+ buy_amount: number;
94
+ buy_usd_value: number;
95
+ pnl_usd_value: number;
96
+ }
97
+ export interface CopyTradeTokenListV2Response {
98
+ token_list: CopyTradeTokenItemV2[];
99
+ pagination: {
100
+ limit: number;
101
+ has_next: boolean;
102
+ next_cursor: string;
103
+ };
104
+ }
105
+ export interface CopyTradeSameToken extends TokenItem {
106
+ liquidity: number;
107
+ }
89
108
  export interface CopyTradeRecentBuyItem {
90
109
  id: string;
91
110
  user_addr: string;
@@ -104,6 +123,28 @@ export interface CopyTradeRecentBuyListResponse {
104
123
  recent_buy_list: CopyTradeRecentBuyItem[];
105
124
  total: number;
106
125
  }
126
+ export interface CopyTradeRecentBuyItemV2 {
127
+ user_addr: string;
128
+ current_balance: number;
129
+ buy_usd_value: number;
130
+ buy_amount: number;
131
+ buy_price: number;
132
+ sell_usd_value: number;
133
+ sell_amount: number;
134
+ sell_price: number;
135
+ pnl_usd_value: number;
136
+ realized_pnl_usd_value: number;
137
+ unrealized_pnl_usd_value: number;
138
+ last_buy_at: string;
139
+ }
140
+ export interface CopyTradeRecentBuyListV2Response {
141
+ recent_buy_list: CopyTradeRecentBuyItemV2[];
142
+ pagination: {
143
+ limit: number;
144
+ has_next: boolean;
145
+ next_cursor: string;
146
+ };
147
+ }
107
148
  export interface CopyTradePnlItem extends TokenItem {
108
149
  profit_usd_value: number;
109
150
  protocol_id?: string;
@@ -990,11 +1031,14 @@ export interface PushMultiSigAction {
990
1031
  multisig_id: string;
991
1032
  }
992
1033
  export declare type RevokeNFTCollectionAction = ApproveNFTCollectionAction;
1034
+ export declare type MultiAction = TransactionAction[];
1035
+ export declare type TransactionActionDataItem = SwapAction | ApproveAction | SendAction | SendNFTAction | ApproveNFTAction | RevokeNFTAction | ApproveNFTCollectionAction | RevokeNFTCollectionAction | RevokeTokenApproveAction | WrapTokenAction | UnWrapTokenAction | PushMultiSigAction | CrossSwapAction | CrossTokenAction | RevokePermit2Action | SwapOrderAction | TransferOwnerAction | MultiSwapAction | SwapLimitPay | MultiAction | null;
1036
+ export interface TransactionAction {
1037
+ type: string;
1038
+ data: TransactionActionDataItem;
1039
+ }
993
1040
  export interface ParseTxResponse {
994
- action: {
995
- type: string;
996
- data: SwapAction | ApproveAction | SendAction | SendNFTAction | ApproveNFTAction | RevokeNFTAction | ApproveNFTCollectionAction | RevokeNFTCollectionAction | RevokeTokenApproveAction | WrapTokenAction | UnWrapTokenAction | PushMultiSigAction | CrossSwapAction | CrossTokenAction | RevokePermit2Action | SwapOrderAction | TransferOwnerAction | MultiSwapAction | SwapLimitPay | null;
997
- };
1041
+ action: TransactionAction;
998
1042
  contract_call?: {
999
1043
  func: string;
1000
1044
  contract: {
@@ -1012,7 +1056,7 @@ export interface CollectionWithFloorPrice {
1012
1056
  name: string;
1013
1057
  floor_price: number;
1014
1058
  }
1015
- export declare type TypedDataActionName = 'permit1_approve_token' | 'swap_token_order' | 'permit2_approve_token' | 'sell_nft_order' | 'sign_multisig' | 'buy_nft_order' | 'create_key' | 'verify_address' | 'sell_nft_list_order' | 'permit2_approve_token_list' | 'create_cobo_safe' | 'submit_safe_role_modification' | 'submit_delegated_address_modification' | 'submit_token_approval_modification' | 'send_token' | 'permit1_revoke_token' | 'swap_order' | 'approve_nft';
1059
+ export declare type TypedDataActionName = 'permit1_approve_token' | 'swap_token_order' | 'permit2_approve_token' | 'sell_nft_order' | 'sign_multisig' | 'buy_nft_order' | 'create_key' | 'verify_address' | 'sell_nft_list_order' | 'permit2_approve_token_list' | 'create_cobo_safe' | 'submit_safe_role_modification' | 'submit_delegated_address_modification' | 'submit_token_approval_modification' | 'send_token' | 'permit1_revoke_token' | 'swap_order' | 'approve_nft' | 'multi_actions';
1016
1060
  export interface BuyNFTOrderAction {
1017
1061
  expire_at: string;
1018
1062
  pay_token: TokenItem;
@@ -1096,12 +1140,14 @@ export interface SubmitTokenApprovalModificationAction {
1096
1140
  logo_url: string;
1097
1141
  };
1098
1142
  }
1143
+ export declare type TypeDataActionDataItem = SellNFTOrderAction | BuyNFTOrderAction | SwapTokenOrderAction | PermitAction | Permit2Action | SignMultiSigActions | CreateKeyAction | VerifyAddressAction | BatchSellNFTOrderAction | BatchPermit2Action | CreateCoboSafeAction | SubmitSafeRoleModificationAction | SubmitDelegatedAddressModificationAction | SubmitTokenApprovalModificationAction | SendAction | SwapOrderAction | RevokeTokenApproveAction | ApproveNFTAction | MultiAction;
1144
+ export interface TypeDataActionItem {
1145
+ type: TypedDataActionName;
1146
+ expire_at?: number;
1147
+ data: TypeDataActionDataItem;
1148
+ }
1099
1149
  export interface ParseTypedDataResponse {
1100
- action: {
1101
- type: TypedDataActionName;
1102
- expire_at?: number;
1103
- data: SellNFTOrderAction | BuyNFTOrderAction | SwapTokenOrderAction | PermitAction | Permit2Action | SignMultiSigActions | CreateKeyAction | VerifyAddressAction | BatchSellNFTOrderAction | BatchPermit2Action | CreateCoboSafeAction | SubmitSafeRoleModificationAction | SubmitDelegatedAddressModificationAction | SubmitTokenApprovalModificationAction | SendAction | SwapOrderAction | RevokeTokenApproveAction | ApproveNFTAction;
1104
- } | null;
1150
+ action: TypeDataActionItem | null;
1105
1151
  log_id: string;
1106
1152
  }
1107
1153
  export declare type TextActionName = 'create_key' | 'verify_address';
@@ -1550,4 +1596,14 @@ export interface AppChainListResponse {
1550
1596
  apps: AppChainItem[];
1551
1597
  error_app_ids: string[];
1552
1598
  }
1599
+ export declare type DefaultRPCRes = {
1600
+ message: string;
1601
+ status: string;
1602
+ rpcs: RPCDefaultItem[];
1603
+ };
1604
+ declare type RPCDefaultItem = {
1605
+ chainId: string;
1606
+ rpcUrl: string[];
1607
+ txPushToRPC: boolean;
1608
+ };
1553
1609
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.9.26-beta.2",
3
+ "version": "0.9.27-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [