@rabby-wallet/rabby-api 0.9.58-beta.2 → 0.9.58
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 +82 -1
- package/dist/index.js +71 -0
- package/dist/types.d.ts +36 -0
- package/package.json +1 -1
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, TokenPriceListResponse, 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, TokenDetailWithPriceCurve, GiftEligibilityItem, UserFeedbackItem, PerpTopToken, KlineDataItem, TokenMarketInfo, TokenHolderInfo, TokenSupplyInfo, MarketSummary, MarketTradingHistoryItem, TokenHolderSummary, TokenHolderItem, CurrencyItem, PerpBridgeQuote, LiquidityPoolItem, LiquidityPoolHistoryItem, NFTDetail, NFTTradingConfig, PrepareAcceptNFTOfferResponse, PrepareListingNFTResponse, CreateListingNFTOfferResponse, NFTListingResponse, MemeListResponse, TokenMarketCategoryListResponse, TokenMarketTokenListResponse } 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, 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, PerpTopToken, KlineDataItem, TokenMarketInfo, TokenHolderInfo, TokenSupplyInfo, MarketSummary, MarketTradingHistoryItem, TokenHolderSummary, TokenHolderItem, CurrencyItem, PerpBridgeQuote, LiquidityPoolItem, LiquidityPoolHistoryItem, NFTDetail, NFTTradingConfig, PrepareAcceptNFTOfferResponse, PrepareListingNFTResponse, CreateListingNFTOfferResponse, NFTListingResponse, MemeListResponse, TokenMarketCategoryListResponse, TokenMarketTokenListResponse } from './types';
|
|
5
5
|
interface OpenApiStore {
|
|
6
6
|
host: string;
|
|
7
7
|
testnetHost?: string;
|
|
@@ -23,6 +23,44 @@ declare type VersionPrefix = 'v1' | 'v2';
|
|
|
23
23
|
declare type ApiOptions<V extends VersionPrefix | void = VersionPrefix> = {
|
|
24
24
|
restfulPrefix?: V;
|
|
25
25
|
};
|
|
26
|
+
declare type GnosisRequestOptions = {
|
|
27
|
+
txServiceUrl: string;
|
|
28
|
+
};
|
|
29
|
+
declare type GnosisSafeRequestOptions = GnosisRequestOptions & {
|
|
30
|
+
safeAddress: string;
|
|
31
|
+
};
|
|
32
|
+
declare type GnosisPostTransactionOptions = GnosisSafeRequestOptions & {
|
|
33
|
+
data: Record<string, any>;
|
|
34
|
+
};
|
|
35
|
+
declare type GnosisConfirmTransactionOptions = GnosisRequestOptions & {
|
|
36
|
+
safeTransactionHash: string;
|
|
37
|
+
data: Record<string, any>;
|
|
38
|
+
};
|
|
39
|
+
declare type GnosisSafeTxGasOptions = GnosisSafeRequestOptions & {
|
|
40
|
+
safeTxData: {
|
|
41
|
+
to: string;
|
|
42
|
+
value?: string;
|
|
43
|
+
data?: string | null;
|
|
44
|
+
operation?: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
declare type GnosisGetSafeMessagesOptions = GnosisSafeRequestOptions & {
|
|
48
|
+
options?: Record<string, any>;
|
|
49
|
+
};
|
|
50
|
+
declare type GnosisAddSafeMessageOptions = GnosisSafeRequestOptions & {
|
|
51
|
+
data: {
|
|
52
|
+
message: string | Record<string, any>;
|
|
53
|
+
signature: string;
|
|
54
|
+
safeAppId?: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
declare type GnosisGetSafeMessageOptions = GnosisRequestOptions & {
|
|
58
|
+
messageHash: string;
|
|
59
|
+
};
|
|
60
|
+
declare type GnosisAddSafeMessageSignatureOptions = GnosisRequestOptions & {
|
|
61
|
+
messageHash: string;
|
|
62
|
+
signature: string;
|
|
63
|
+
};
|
|
26
64
|
export declare class OpenApiService {
|
|
27
65
|
#private;
|
|
28
66
|
store: OpenApiStore;
|
|
@@ -43,6 +81,23 @@ export declare class OpenApiService {
|
|
|
43
81
|
}) => Promise<any>) | (() => Promise<never>);
|
|
44
82
|
init: (options?: string | InitOptions) => Promise<void>;
|
|
45
83
|
initSync(options?: InitOptions): void;
|
|
84
|
+
getSafePendingTransactions: ({ txServiceUrl, safeAddress, nonce, }: GnosisRequestOptions & {
|
|
85
|
+
safeAddress: string;
|
|
86
|
+
} & {
|
|
87
|
+
nonce: number;
|
|
88
|
+
}) => Promise<{
|
|
89
|
+
results: any[];
|
|
90
|
+
}>;
|
|
91
|
+
postSafeTransactions: ({ txServiceUrl, safeAddress, data, }: GnosisPostTransactionOptions) => Promise<void>;
|
|
92
|
+
getSafeInfo: ({ txServiceUrl, safeAddress, }: GnosisSafeRequestOptions) => Promise<any>;
|
|
93
|
+
confirmSafeTransaction: ({ txServiceUrl, safeTransactionHash, data, }: GnosisConfirmTransactionOptions) => Promise<void>;
|
|
94
|
+
getSafeTxGas: ({ txServiceUrl, safeAddress, safeTxData, }: GnosisSafeTxGasOptions) => Promise<string | undefined>;
|
|
95
|
+
getSafeMessages: ({ txServiceUrl, safeAddress, options, }: GnosisGetSafeMessagesOptions) => Promise<{
|
|
96
|
+
results: any[];
|
|
97
|
+
}>;
|
|
98
|
+
addSafeMessage: ({ txServiceUrl, safeAddress, data, }: GnosisAddSafeMessageOptions) => Promise<void>;
|
|
99
|
+
getSafeMessage: ({ txServiceUrl, messageHash, }: GnosisGetSafeMessageOptions) => Promise<any>;
|
|
100
|
+
addSafeMessageSignature: ({ txServiceUrl, messageHash, signature, }: GnosisAddSafeMessageSignatureOptions) => Promise<void>;
|
|
46
101
|
asyncJob: <T = any>(url: string, options?: AxiosRequestConfig & {
|
|
47
102
|
retryDelay?: number;
|
|
48
103
|
}) => Promise<T>;
|
|
@@ -1033,6 +1088,32 @@ export declare class OpenApiService {
|
|
|
1033
1088
|
success: boolean;
|
|
1034
1089
|
}>;
|
|
1035
1090
|
getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
|
|
1091
|
+
getGasAccountBridgeSupportTokenList: () => Promise<GasAccountBridgeSupportTokenList>;
|
|
1092
|
+
getGasAccountBridgeQuote: (params: {
|
|
1093
|
+
user_addr: string;
|
|
1094
|
+
from_chain_id: string;
|
|
1095
|
+
from_token_id: string;
|
|
1096
|
+
from_token_raw_amount: string | number;
|
|
1097
|
+
slippage?: number;
|
|
1098
|
+
}) => Promise<GasAccountBridgeQuote>;
|
|
1099
|
+
createGasAccountBridgeRecharge: (p: {
|
|
1100
|
+
sig: string;
|
|
1101
|
+
gas_account_id: string;
|
|
1102
|
+
user_addr: string;
|
|
1103
|
+
from_chain_id: string;
|
|
1104
|
+
from_token_id: string;
|
|
1105
|
+
from_token_amount: number;
|
|
1106
|
+
from_usd_value: number;
|
|
1107
|
+
tx_id: string;
|
|
1108
|
+
}) => Promise<GasAccountBridgeCreateResponse>;
|
|
1109
|
+
getGasAccountBridgeStatus: (params: {
|
|
1110
|
+
from_chain_id: string;
|
|
1111
|
+
tx_id: string;
|
|
1112
|
+
} | {
|
|
1113
|
+
transaction_id: string;
|
|
1114
|
+
product_id: string;
|
|
1115
|
+
device_type: 'android' | 'ios';
|
|
1116
|
+
}) => Promise<GasAccountRechargeStatus>;
|
|
1036
1117
|
rechargeGasAccount: (p: {
|
|
1037
1118
|
sig: string;
|
|
1038
1119
|
account_id: string;
|
package/dist/index.js
CHANGED
|
@@ -89,6 +89,52 @@ export class OpenApiService {
|
|
|
89
89
|
yield ((_d = (_c = __classPrivateFieldGet(this, _OpenApiService_plugin, "f")).onInitiateAsync) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign({}, options)));
|
|
90
90
|
this.initSync(Object.assign({}, options));
|
|
91
91
|
});
|
|
92
|
+
this.getSafePendingTransactions = ({ txServiceUrl, safeAddress, nonce, }) => __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/`, {
|
|
94
|
+
params: {
|
|
95
|
+
executed: false,
|
|
96
|
+
nonce__gte: nonce,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
return data;
|
|
100
|
+
});
|
|
101
|
+
this.postSafeTransactions = ({ txServiceUrl, safeAddress, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/`, data);
|
|
103
|
+
});
|
|
104
|
+
this.getSafeInfo = ({ txServiceUrl, safeAddress, }) => __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/`);
|
|
106
|
+
return data;
|
|
107
|
+
});
|
|
108
|
+
this.confirmSafeTransaction = ({ txServiceUrl, safeTransactionHash, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
109
|
+
yield this.request.post(`${txServiceUrl}/v1/multisig-transactions/${safeTransactionHash}/confirmations/`, data);
|
|
110
|
+
});
|
|
111
|
+
this.getSafeTxGas = ({ txServiceUrl, safeAddress, safeTxData, }) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
const { data } = yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/multisig-transactions/estimations/`, {
|
|
113
|
+
to: safeTxData.to,
|
|
114
|
+
value: safeTxData.value || '0',
|
|
115
|
+
data: safeTxData.data,
|
|
116
|
+
operation: safeTxData.operation,
|
|
117
|
+
});
|
|
118
|
+
return data === null || data === void 0 ? void 0 : data.safeTxGas;
|
|
119
|
+
});
|
|
120
|
+
this.getSafeMessages = ({ txServiceUrl, safeAddress, options, }) => __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/safes/${safeAddress}/messages/`, {
|
|
122
|
+
params: options,
|
|
123
|
+
});
|
|
124
|
+
return data;
|
|
125
|
+
});
|
|
126
|
+
this.addSafeMessage = ({ txServiceUrl, safeAddress, data, }) => __awaiter(this, void 0, void 0, function* () {
|
|
127
|
+
yield this.request.post(`${txServiceUrl}/v1/safes/${safeAddress}/messages/`, data);
|
|
128
|
+
});
|
|
129
|
+
this.getSafeMessage = ({ txServiceUrl, messageHash, }) => __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
const { data } = yield this.request.get(`${txServiceUrl}/v1/messages/${messageHash}/`);
|
|
131
|
+
return data;
|
|
132
|
+
});
|
|
133
|
+
this.addSafeMessageSignature = ({ txServiceUrl, messageHash, signature, }) => __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
yield this.request.post(`${txServiceUrl}/v1/messages/${messageHash}/signatures/`, {
|
|
135
|
+
signature,
|
|
136
|
+
});
|
|
137
|
+
});
|
|
92
138
|
this.asyncJob = (url, options) => {
|
|
93
139
|
const _option = Object.assign({ timeout: ASYNC_JOB_TIMEOUT, retryDelay: ASYNC_JOB_RETRY_DELAY }, options);
|
|
94
140
|
const startTime = +new Date();
|
|
@@ -1424,6 +1470,31 @@ export class OpenApiService {
|
|
|
1424
1470
|
});
|
|
1425
1471
|
return data;
|
|
1426
1472
|
});
|
|
1473
|
+
this.getGasAccountBridgeSupportTokenList = () => __awaiter(this, void 0, void 0, function* () {
|
|
1474
|
+
const { data } = yield this.request.get('/v1/gas_account/bridge/support_token');
|
|
1475
|
+
return data;
|
|
1476
|
+
});
|
|
1477
|
+
this.getGasAccountBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1478
|
+
const { data } = yield this.request.get('/v1/gas_account/bridge/quote', {
|
|
1479
|
+
params,
|
|
1480
|
+
});
|
|
1481
|
+
return data;
|
|
1482
|
+
});
|
|
1483
|
+
this.createGasAccountBridgeRecharge = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1484
|
+
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1485
|
+
const { data } = yield this.request.post('/v1/gas_account/bridge/create', params, {
|
|
1486
|
+
headers: {
|
|
1487
|
+
sig,
|
|
1488
|
+
},
|
|
1489
|
+
});
|
|
1490
|
+
return data;
|
|
1491
|
+
});
|
|
1492
|
+
this.getGasAccountBridgeStatus = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1493
|
+
const { data } = yield this.request.get('/v1/gas_account/recharge/status', {
|
|
1494
|
+
params,
|
|
1495
|
+
});
|
|
1496
|
+
return data;
|
|
1497
|
+
});
|
|
1427
1498
|
this.rechargeGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1428
1499
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1429
1500
|
const { data } = yield this.request.post('/v1/gas_account/recharge', params, {
|
package/dist/types.d.ts
CHANGED
|
@@ -1757,6 +1757,42 @@ export interface PerpBridgeQuote {
|
|
|
1757
1757
|
};
|
|
1758
1758
|
duration: number;
|
|
1759
1759
|
}
|
|
1760
|
+
export interface GasAccountBridgeToken {
|
|
1761
|
+
chain_id: string;
|
|
1762
|
+
token_id: string;
|
|
1763
|
+
}
|
|
1764
|
+
export interface GasAccountBridgeSupportTokenList {
|
|
1765
|
+
wallet_tokens: GasAccountBridgeToken[];
|
|
1766
|
+
hyperliquid_tokens: GasAccountBridgeToken[];
|
|
1767
|
+
}
|
|
1768
|
+
export interface GasAccountBridgeFee {
|
|
1769
|
+
raw_amount_hex_str: string;
|
|
1770
|
+
usd_value: number;
|
|
1771
|
+
}
|
|
1772
|
+
export interface GasAccountBridgeInfo {
|
|
1773
|
+
logo_url: string;
|
|
1774
|
+
}
|
|
1775
|
+
export interface GasAccountBridgeQuote {
|
|
1776
|
+
bridge_id: string;
|
|
1777
|
+
bridge: GasAccountBridgeInfo;
|
|
1778
|
+
to_token_raw_amount: number;
|
|
1779
|
+
to_token_raw_amount_hex_str: string;
|
|
1780
|
+
to_token_amount: number;
|
|
1781
|
+
approve_contract_id: string;
|
|
1782
|
+
protocol_fee: GasAccountBridgeFee;
|
|
1783
|
+
rabby_fee: GasAccountBridgeFee;
|
|
1784
|
+
gas_fee: GasAccountBridgeFee;
|
|
1785
|
+
duration: number;
|
|
1786
|
+
tx: Tx;
|
|
1787
|
+
}
|
|
1788
|
+
export interface GasAccountBridgeCreateResponse {
|
|
1789
|
+
success: boolean;
|
|
1790
|
+
id: string;
|
|
1791
|
+
}
|
|
1792
|
+
export declare type GasAccountRechargeStatus = {
|
|
1793
|
+
status: 'pending' | 'success' | 'failed';
|
|
1794
|
+
type: 'bridge|wallet|iap';
|
|
1795
|
+
};
|
|
1760
1796
|
export declare type MarketSummaryItem = {
|
|
1761
1797
|
price?: {
|
|
1762
1798
|
open?: number;
|