@rabby-wallet/rabby-api 0.9.24-beta.0 → 0.9.25-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 +25 -1
- package/dist/index.js +28 -2
- package/dist/types.d.ts +48 -0
- package/package.json +2 -2
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 } 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 } from './types';
|
|
5
5
|
interface OpenApiStore {
|
|
6
6
|
host: string;
|
|
7
7
|
testnetHost?: string;
|
|
@@ -1054,6 +1054,16 @@ export declare class OpenApiService {
|
|
|
1054
1054
|
aggregator_id: string;
|
|
1055
1055
|
}[]>;
|
|
1056
1056
|
getBridgeSupportChainV2: () => Promise<string[]>;
|
|
1057
|
+
submitFeedback: ({ text, usage, }: {
|
|
1058
|
+
text: string;
|
|
1059
|
+
/**
|
|
1060
|
+
* @description 'usage' is used to submit feedback on rate scene.
|
|
1061
|
+
* by default, it means 'uninstall' scene.
|
|
1062
|
+
*/
|
|
1063
|
+
usage?: "rate" | undefined;
|
|
1064
|
+
}) => Promise<{
|
|
1065
|
+
success: boolean;
|
|
1066
|
+
}>;
|
|
1057
1067
|
uninstalledFeedback: ({ text, }: {
|
|
1058
1068
|
text: string;
|
|
1059
1069
|
}) => Promise<{
|
|
@@ -1090,6 +1100,20 @@ export declare class OpenApiService {
|
|
|
1090
1100
|
searchTokensV2: (params: {
|
|
1091
1101
|
q: string;
|
|
1092
1102
|
}) => Promise<TokenItemWithEntity[]>;
|
|
1103
|
+
getCopyTradingChainList: () => Promise<string[]>;
|
|
1104
|
+
getCopyTradingTokenList: (params: {
|
|
1105
|
+
chain_id: string;
|
|
1106
|
+
limit: number;
|
|
1107
|
+
start_time: number;
|
|
1108
|
+
}) => Promise<CopyTradeTokenListResponse>;
|
|
1109
|
+
getCopyTradingRecentBuyList: (params: {
|
|
1110
|
+
chain_id: string;
|
|
1111
|
+
token_id: string;
|
|
1112
|
+
limit: number;
|
|
1113
|
+
}) => Promise<CopyTradeRecentBuyListResponse>;
|
|
1114
|
+
getCopyTradingPnlList: (params: {
|
|
1115
|
+
user_addr: string;
|
|
1116
|
+
}) => Promise<CopyTradePnlListResponse>;
|
|
1093
1117
|
batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
|
|
1094
1118
|
getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
|
|
1095
1119
|
getBuySupportedTokenList: () => Promise<(TokenItem & {
|
package/dist/index.js
CHANGED
|
@@ -1417,11 +1417,14 @@ export class OpenApiService {
|
|
|
1417
1417
|
const { data } = yield this.request.get('/v2/bridge/supported_chains');
|
|
1418
1418
|
return data;
|
|
1419
1419
|
});
|
|
1420
|
+
this.submitFeedback = ({ text, usage, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1421
|
+
const { data } = yield this.request.post('v1/feedback', Object.assign({ text }, (usage && { usage })));
|
|
1422
|
+
return data;
|
|
1423
|
+
});
|
|
1420
1424
|
this.uninstalledFeedback = ({ text, }) => __awaiter(this, void 0, void 0, function* () {
|
|
1421
|
-
|
|
1425
|
+
return this.submitFeedback({
|
|
1422
1426
|
text,
|
|
1423
1427
|
});
|
|
1424
|
-
return data;
|
|
1425
1428
|
});
|
|
1426
1429
|
/**
|
|
1427
1430
|
* @deprecated
|
|
@@ -1456,6 +1459,29 @@ export class OpenApiService {
|
|
|
1456
1459
|
});
|
|
1457
1460
|
return data;
|
|
1458
1461
|
});
|
|
1462
|
+
// resp arr of chain_id
|
|
1463
|
+
this.getCopyTradingChainList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1464
|
+
const { data } = yield this.request.get('/v1/copytrading/chain_list');
|
|
1465
|
+
return data;
|
|
1466
|
+
});
|
|
1467
|
+
this.getCopyTradingTokenList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1468
|
+
const { data } = yield this.request.get('/v1/copytrading/token/list', {
|
|
1469
|
+
params,
|
|
1470
|
+
});
|
|
1471
|
+
return data;
|
|
1472
|
+
});
|
|
1473
|
+
this.getCopyTradingRecentBuyList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1474
|
+
const { data } = yield this.request.get('/v1/copytrading/recent_buy/list', {
|
|
1475
|
+
params,
|
|
1476
|
+
});
|
|
1477
|
+
return data;
|
|
1478
|
+
});
|
|
1479
|
+
this.getCopyTradingPnlList = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1480
|
+
const { data } = yield this.request.get('/v1/copytrading/smart_money/pnl/list', {
|
|
1481
|
+
params,
|
|
1482
|
+
});
|
|
1483
|
+
return data;
|
|
1484
|
+
});
|
|
1459
1485
|
this.batchQueryTokens = (uuids) => __awaiter(this, void 0, void 0, function* () {
|
|
1460
1486
|
const { data } = yield this.request.get('/v1/token/list_by_uuids', {
|
|
1461
1487
|
params: {
|
package/dist/types.d.ts
CHANGED
|
@@ -73,6 +73,44 @@ export interface Tx {
|
|
|
73
73
|
s?: string;
|
|
74
74
|
v?: string;
|
|
75
75
|
}
|
|
76
|
+
export interface CopyTradeTokenItem extends TokenItem {
|
|
77
|
+
fdv: number | null;
|
|
78
|
+
buy_amount_24h: number;
|
|
79
|
+
buy_usd_value_24h: number;
|
|
80
|
+
price_curve_24h: {
|
|
81
|
+
time_at: number;
|
|
82
|
+
price: number;
|
|
83
|
+
}[];
|
|
84
|
+
create_at: number;
|
|
85
|
+
}
|
|
86
|
+
export interface CopyTradeTokenListResponse {
|
|
87
|
+
token_list: CopyTradeTokenItem[];
|
|
88
|
+
}
|
|
89
|
+
export interface CopyTradeRecentBuyItem {
|
|
90
|
+
id: string;
|
|
91
|
+
user_addr: string;
|
|
92
|
+
user_addr_pnl: {
|
|
93
|
+
id: string;
|
|
94
|
+
profit_usd_value: number;
|
|
95
|
+
};
|
|
96
|
+
chain_id: string;
|
|
97
|
+
token_id: string;
|
|
98
|
+
token_amount: number;
|
|
99
|
+
action: string;
|
|
100
|
+
buy_usd_value: number;
|
|
101
|
+
create_at: number;
|
|
102
|
+
}
|
|
103
|
+
export interface CopyTradeRecentBuyListResponse {
|
|
104
|
+
recent_buy_list: CopyTradeRecentBuyItem[];
|
|
105
|
+
total: number;
|
|
106
|
+
}
|
|
107
|
+
export interface CopyTradePnlItem extends TokenItem {
|
|
108
|
+
profit_usd_value: number;
|
|
109
|
+
protocol_id?: string;
|
|
110
|
+
}
|
|
111
|
+
export interface CopyTradePnlListResponse {
|
|
112
|
+
pnl_list: CopyTradePnlItem[];
|
|
113
|
+
}
|
|
76
114
|
export interface Eip1559Tx {
|
|
77
115
|
chainId: number;
|
|
78
116
|
data: string;
|
|
@@ -362,17 +400,20 @@ export interface TxHistoryItem {
|
|
|
362
400
|
amount: number;
|
|
363
401
|
from_addr: string;
|
|
364
402
|
token_id: string;
|
|
403
|
+
price?: number;
|
|
365
404
|
}[];
|
|
366
405
|
sends: {
|
|
367
406
|
amount: number;
|
|
368
407
|
to_addr: string;
|
|
369
408
|
token_id: string;
|
|
409
|
+
price?: number;
|
|
370
410
|
}[];
|
|
371
411
|
time_at: number;
|
|
372
412
|
token_approve: {
|
|
373
413
|
spender: string;
|
|
374
414
|
token_id: string;
|
|
375
415
|
value: number;
|
|
416
|
+
price?: number;
|
|
376
417
|
} | null;
|
|
377
418
|
tx: {
|
|
378
419
|
eth_gas_fee: number;
|
|
@@ -1213,6 +1254,7 @@ export interface SupportedChain {
|
|
|
1213
1254
|
is_disabled: boolean;
|
|
1214
1255
|
explorer_host: string;
|
|
1215
1256
|
block_interval: number;
|
|
1257
|
+
severity?: number;
|
|
1216
1258
|
}
|
|
1217
1259
|
export interface ChainListItem {
|
|
1218
1260
|
chain_id: number;
|
|
@@ -1359,6 +1401,12 @@ export interface BridgeHistory {
|
|
|
1359
1401
|
detail_url: string;
|
|
1360
1402
|
status: 'pending' | 'completed';
|
|
1361
1403
|
create_at: number;
|
|
1404
|
+
from_tx: {
|
|
1405
|
+
tx_id: string;
|
|
1406
|
+
};
|
|
1407
|
+
to_tx: {
|
|
1408
|
+
tx_id?: string;
|
|
1409
|
+
};
|
|
1362
1410
|
from_gas: {
|
|
1363
1411
|
native_token: TokenItem;
|
|
1364
1412
|
gas_amount: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabby-wallet/rabby-api",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.25-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"typescript": "^4.8.3"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
|
-
"test": "jest
|
|
40
|
+
"test": "jest --env=./test/jsdom-env-hack.js",
|
|
41
41
|
"build": "rimraf dist && tsc",
|
|
42
42
|
"preversion": "npm run build",
|
|
43
43
|
"prepublishOnly": "npm run build && npm run test",
|