@rabby-wallet/rabby-api 0.9.70-alpha.0 → 0.10.0-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/README.md +1 -1
- package/dist/index.d.ts +2 -6
- package/dist/index.js +0 -18
- package/dist/types.d.ts +1 -15
- package/dist/utils.d.ts +2 -6
- package/dist/utils.js +1 -18
- package/package.json +22 -24
package/README.md
CHANGED
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, WalletVersionInfoResponse, 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, TokenPriceListResponse, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, GasAccountBridgeSupportTokenList, GasAccountBridgeQuote, GasAccountBridgeCreateResponse, GasAccountRechargeStatus, TokenEntityDetail, TokenItemWithEntity, ProjectItem, CopyTradeTokenListResponse, CopyTradeRecentBuyListResponse, CopyTradePnlListResponse, AppChainListResponse,
|
|
4
|
+
import { AddrDescResponse, WalletVersionInfoResponse, 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, TokenPriceListResponse, TotalBalanceResponse, Tx, TxAllHistoryResult, TxHistoryResult, TxPushType, TxRequest, UsedChain, BridgeTokenPair, BridgeQuote, BridgeHistory, ContractInfo, GasAccountCheckResult, ParseCommonResponse, WithdrawListAddressItem, BuyCountryItem, BuyQuoteItem, BuyHistoryList, BuyPaymentMethod, GasAccountInfo, GasAccountBridgeSupportTokenList, GasAccountBridgeQuote, GasAccountBridgeCreateResponse, GasAccountRechargeStatus, TokenEntityDetail, TokenItemWithEntity, ProjectItem, CopyTradeTokenListResponse, CopyTradeRecentBuyListResponse, CopyTradePnlListResponse, AppChainListResponse, CopyTradeTokenListV2Response, CopyTradeRecentBuyListV2Response, CopyTradeTokenItemV2, CopyTradeSameToken, DefaultRPCRes, TokenDetailWithPriceCurve, GiftEligibilityItem, UserFeedbackItem, GetClientFeedbackMessagesParams, GetClientFeedbackMessagesResponse, GetClientFeedbackUnreadParams, GetClientFeedbackUnreadResponse, PostClientFeedbackMessageParams, PostClientFeedbackMessageResponse, UploadClientFeedbackParams, UploadClientFeedbackResponse, PerpTopToken, KlineDataItem, TokenMarketInfo, TokenHolderInfo, TokenSupplyInfo, MarketSummary, MarketTradingHistoryItem, TokenHolderSummary, TokenHolderItem, CurrencyItem, PerpBridgeQuote, LiquidityPoolItem, LiquidityPoolHistoryItem, NFTDetail, NFTTradingConfig, PrepareAcceptNFTOfferResponse, PrepareListingNFTResponse, CreateListingNFTOfferResponse, NFTListingResponse, MemeListResponse, TokenMarketCategoryListResponse, TokenMarketTokenListResponse, PerpTopTokenV3, PerpTopTokenCategory, StakingFilterListParams, StakingFilterListResponse, StakingPoolCurveParams, StakingPoolCurveResponse, StakingPoolListParams, StakingPoolListResponse, StakingPoolParams, StakingPoolResponse } from './types';
|
|
5
5
|
interface OpenApiStore {
|
|
6
6
|
host: string;
|
|
7
7
|
testnetHost?: string;
|
|
@@ -115,7 +115,6 @@ export declare class OpenApiService {
|
|
|
115
115
|
get24hTotalBalance: (address: string) => Promise<{
|
|
116
116
|
total_usd_value: number;
|
|
117
117
|
}>;
|
|
118
|
-
get24hTotalBalanceBatch: (ids: string[]) => Promise<TotalBalance24hBatchItem[]>;
|
|
119
118
|
getPendingCount: (address: string) => Promise<{
|
|
120
119
|
total_count: number;
|
|
121
120
|
chains: ChainWithPendingCount[];
|
|
@@ -999,9 +998,7 @@ export declare class OpenApiService {
|
|
|
999
998
|
to_token_id: string;
|
|
1000
999
|
slippage: string;
|
|
1001
1000
|
quote_key: string;
|
|
1002
|
-
}) => Promise<Tx
|
|
1003
|
-
order_data?: Record<string, unknown>;
|
|
1004
|
-
}>;
|
|
1001
|
+
}) => Promise<Tx>;
|
|
1005
1002
|
postBridgeHistory: (params: {
|
|
1006
1003
|
aggregator_id: string;
|
|
1007
1004
|
bridge_id: string;
|
|
@@ -1452,7 +1449,6 @@ export declare class OpenApiService {
|
|
|
1452
1449
|
}>;
|
|
1453
1450
|
getCexSupportList: () => Promise<ProjectItem[]>;
|
|
1454
1451
|
getAppChainList: (id: string) => Promise<AppChainListResponse>;
|
|
1455
|
-
getAppChainListBatch: (ids: string[]) => Promise<AppChainListBatchItem[]>;
|
|
1456
1452
|
checkCex: (postData: {
|
|
1457
1453
|
chain_id: string;
|
|
1458
1454
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -201,15 +201,6 @@ export class OpenApiService {
|
|
|
201
201
|
});
|
|
202
202
|
return data;
|
|
203
203
|
});
|
|
204
|
-
// ids: up to 10 addresses. Single-address failure returns error_code=1 and does not fail the batch.
|
|
205
|
-
this.get24hTotalBalanceBatch = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
206
|
-
const { data } = yield this.request.get('/v1/user/total_balance_24h/batch', {
|
|
207
|
-
params: {
|
|
208
|
-
ids: ids.join(','),
|
|
209
|
-
},
|
|
210
|
-
});
|
|
211
|
-
return data;
|
|
212
|
-
});
|
|
213
204
|
this.getPendingCount = (address) => __awaiter(this, void 0, void 0, function* () {
|
|
214
205
|
const { data } = yield this.request.get('/v1/wallet/pending_tx_count', {
|
|
215
206
|
params: {
|
|
@@ -1859,15 +1850,6 @@ export class OpenApiService {
|
|
|
1859
1850
|
});
|
|
1860
1851
|
return data;
|
|
1861
1852
|
});
|
|
1862
|
-
// ids: up to 10 addresses. Single-address failure returns error_code=1 and does not fail the batch.
|
|
1863
|
-
this.getAppChainListBatch = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
1864
|
-
const { data } = yield this.request.get('/v1/user/complex_app_list/batch', {
|
|
1865
|
-
params: {
|
|
1866
|
-
ids: ids.join(','),
|
|
1867
|
-
},
|
|
1868
|
-
});
|
|
1869
|
-
return data;
|
|
1870
|
-
});
|
|
1871
1853
|
this.checkCex = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1872
1854
|
const { data } = yield this.request.post('/v1/token/check_cex', postData);
|
|
1873
1855
|
return data;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { CHAINS_ENUM } from '@debank/common';
|
|
2
1
|
export interface WalletVersionInfo {
|
|
3
2
|
id: string;
|
|
4
3
|
level: number;
|
|
@@ -14,7 +13,7 @@ export interface Chain {
|
|
|
14
13
|
name: string;
|
|
15
14
|
hex: string;
|
|
16
15
|
logo: string;
|
|
17
|
-
enum:
|
|
16
|
+
enum: string;
|
|
18
17
|
serverId: string;
|
|
19
18
|
network: string;
|
|
20
19
|
nativeTokenSymbol: string;
|
|
@@ -1696,19 +1695,6 @@ export interface AppChainListResponse {
|
|
|
1696
1695
|
update_at: number;
|
|
1697
1696
|
}[];
|
|
1698
1697
|
}
|
|
1699
|
-
/** `/v1/user/total_balance_24h/batch` 单个地址结果。失败时只有 error_code=1,没有 total_usd_value。 */
|
|
1700
|
-
export interface TotalBalance24hBatchItem {
|
|
1701
|
-
id: string;
|
|
1702
|
-
error_code: number;
|
|
1703
|
-
total_usd_value?: number;
|
|
1704
|
-
}
|
|
1705
|
-
/** `/v1/user/complex_app_list/batch` 单个地址结果。失败时只有 error_code=1。 */
|
|
1706
|
-
export interface AppChainListBatchItem {
|
|
1707
|
-
id: string;
|
|
1708
|
-
error_code: number;
|
|
1709
|
-
apps?: AppChainItem[];
|
|
1710
|
-
error_apps?: AppChainListResponse['error_apps'];
|
|
1711
|
-
}
|
|
1712
1698
|
export declare type DefaultRPCRes = {
|
|
1713
1699
|
message: string;
|
|
1714
1700
|
status: string;
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AxiosRequestConfig } from 'axios';
|
|
3
|
-
export declare const getChain: (chainId?: string) => import("@debank/common").Chain | null;
|
|
4
|
-
export declare const getChainByNetwork: (network?: string | number) => import("@debank/common").Chain | null;
|
|
1
|
+
import { AxiosRequestConfig, GenericAbortSignal } from 'axios';
|
|
5
2
|
export declare const INITIAL_OPENAPI_URL = "https://api.rabby.io";
|
|
6
3
|
export declare const INITIAL_TESTNET_OPENAPI_URL = "https://api.testnet.rabby.io/";
|
|
7
|
-
export { CHAINS };
|
|
8
4
|
export declare function genSignParams(config: AxiosRequestConfig): {
|
|
9
5
|
method: any;
|
|
10
6
|
url: string;
|
|
11
7
|
params: Partial<any>;
|
|
12
8
|
};
|
|
13
|
-
export declare function sleep(ms?: number, signal?:
|
|
9
|
+
export declare function sleep(ms?: number, signal?: GenericAbortSignal): Promise<void>;
|
package/dist/utils.js
CHANGED
|
@@ -1,24 +1,7 @@
|
|
|
1
|
-
import { isNil,
|
|
2
|
-
import { CHAINS } from '@debank/common';
|
|
1
|
+
import { isNil, omitBy } from 'lodash';
|
|
3
2
|
import { decode } from 'qss';
|
|
4
|
-
const chainsDict = keyBy(CHAINS, 'serverId');
|
|
5
|
-
export const getChain = (chainId) => {
|
|
6
|
-
if (!chainId) {
|
|
7
|
-
return null;
|
|
8
|
-
}
|
|
9
|
-
return chainsDict[chainId];
|
|
10
|
-
};
|
|
11
|
-
const chainNetworkDict = keyBy(CHAINS, 'network');
|
|
12
|
-
export const getChainByNetwork = (network) => {
|
|
13
|
-
if (!network) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
network = network.toString();
|
|
17
|
-
return chainNetworkDict[network.startsWith('0x') ? +network : network];
|
|
18
|
-
};
|
|
19
3
|
export const INITIAL_OPENAPI_URL = 'https://api.rabby.io';
|
|
20
4
|
export const INITIAL_TESTNET_OPENAPI_URL = 'https://api.testnet.rabby.io/';
|
|
21
|
-
export { CHAINS };
|
|
22
5
|
export function genSignParams(config) {
|
|
23
6
|
var _a, _b, _c;
|
|
24
7
|
let params = omitBy((_a = config.params) !== null && _a !== void 0 ? _a : {}, isNil);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rabby-wallet/rabby-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-alpha.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -11,30 +11,29 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@rabby-wallet/rabby-sign": "0.4.0",
|
|
14
|
-
"axios": "
|
|
15
|
-
"axios-rate-limit": "
|
|
16
|
-
"eth-rpc-errors": "
|
|
17
|
-
"lodash": "
|
|
18
|
-
"qss": "
|
|
14
|
+
"axios": "0.35.0",
|
|
15
|
+
"axios-rate-limit": "1.3.0",
|
|
16
|
+
"eth-rpc-errors": "4.0.3",
|
|
17
|
+
"lodash": "4.18.1",
|
|
18
|
+
"qss": "2.0.3"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@babel/preset-env": "
|
|
22
|
-
"@
|
|
23
|
-
"@types/
|
|
24
|
-
"@types/
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"jest": "
|
|
30
|
-
"jest-
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"ts-
|
|
36
|
-
"
|
|
37
|
-
"typescript": "^4.8.3"
|
|
21
|
+
"@babel/preset-env": "7.19.1",
|
|
22
|
+
"@types/jest": "29.0.3",
|
|
23
|
+
"@types/lodash": "4.14.185",
|
|
24
|
+
"@types/node": "18.7.18",
|
|
25
|
+
"axios-mock-adapter": "1.21.2",
|
|
26
|
+
"babel-jest": "29.0.3",
|
|
27
|
+
"husky": "8.0.1",
|
|
28
|
+
"jest": "29.0.3",
|
|
29
|
+
"jest-environment-jsdom": "29.5.0",
|
|
30
|
+
"jest-mock-axios": "4.7.0-beta",
|
|
31
|
+
"lint-staged": "13.0.3",
|
|
32
|
+
"prettier": "2.7.1",
|
|
33
|
+
"rimraf": "3.0.2",
|
|
34
|
+
"ts-jest": "29.0.1",
|
|
35
|
+
"ts-node": "10.9.1",
|
|
36
|
+
"typescript": "4.8.3"
|
|
38
37
|
},
|
|
39
38
|
"scripts": {
|
|
40
39
|
"test": "jest --env=./test/jsdom-env-hack.js",
|
|
@@ -44,7 +43,6 @@
|
|
|
44
43
|
"prepare": "husky install"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
|
-
"@debank/common": "^0.3.9",
|
|
48
46
|
"@rabby-wallet/rabby-sign": ">= 0.3"
|
|
49
47
|
},
|
|
50
48
|
"author": "",
|