@rabby-wallet/rabby-api 0.7.21 → 0.7.23-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, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, 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 } from './types';
4
+ import { AddrDescResponse, BridgeAggregator, ApprovalStatus, AssetItem, BasicDappInfo, CEXQuote, Cex, ChainListItem, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, 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 } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -118,6 +118,7 @@ export declare class OpenApiService {
118
118
  pay_token_raw_amount: string;
119
119
  receive_token_id: string;
120
120
  slippage?: string | number;
121
+ fee?: boolean;
121
122
  }) => Promise<{
122
123
  receive_token_raw_amount: number;
123
124
  dex_approve_to: string;
@@ -250,6 +251,19 @@ export declare class OpenApiService {
250
251
  }) => Promise<{
251
252
  is_gasless: boolean;
252
253
  desc?: string;
254
+ promotion?: {
255
+ id: string;
256
+ contract_id: string;
257
+ chain_id: string;
258
+ config: {
259
+ button_text: string;
260
+ before_click_text: string;
261
+ after_click_text: string;
262
+ logo: string;
263
+ theme_color: string;
264
+ dark_color: string;
265
+ };
266
+ };
253
267
  }>;
254
268
  parseTx: ({ chainId, tx, origin, addr, }: {
255
269
  chainId: string;
@@ -710,5 +724,54 @@ export declare class OpenApiService {
710
724
  addr: string;
711
725
  web3_id: string;
712
726
  }>;
727
+ getBridgeSupportChain: () => Promise<string[]>;
728
+ getBridgeAggregatorList: () => Promise<BridgeAggregator[]>;
729
+ getBridgePairList: (params: {
730
+ aggregator_ids: string[];
731
+ to_chain_id: string;
732
+ user_addr: string;
733
+ }) => Promise<BridgeTokenPair[]>;
734
+ getBridgeQuoteList: (params: {
735
+ aggregator_ids: string;
736
+ user_addr: string;
737
+ from_chain_id: string;
738
+ from_token_id: string;
739
+ from_token_raw_amount: string;
740
+ to_chain_id: string;
741
+ to_token_id: string;
742
+ }) => Promise<Omit<BridgeQuote, 'tx'>[]>;
743
+ getBridgeQuote: (params: {
744
+ aggregator_id: string;
745
+ bridge_id: string;
746
+ user_addr: string;
747
+ from_chain_id: string;
748
+ from_token_id: string;
749
+ from_token_raw_amount: string;
750
+ to_chain_id: string;
751
+ to_token_id: string;
752
+ }) => Promise<BridgeQuote>;
753
+ getBridgeHistoryList: (params: {
754
+ user_addr: string;
755
+ start: number;
756
+ limit: number;
757
+ }) => Promise<{
758
+ history_list: BridgeHistory[];
759
+ total_cnt: number;
760
+ }>;
761
+ postBridgeHistory: (params: {
762
+ aggregator_id: string;
763
+ bridge_id: string;
764
+ from_chain_id: string;
765
+ from_token_id: string;
766
+ from_token_amount: string | number;
767
+ to_chain_id: string;
768
+ to_token_id: string;
769
+ to_token_amount: string | number;
770
+ tx_id: string;
771
+ tx: Tx;
772
+ rabby_fee: number;
773
+ }) => Promise<{
774
+ success: boolean;
775
+ }>;
713
776
  }
714
777
  export {};
package/dist/index.js CHANGED
@@ -1079,6 +1079,42 @@ export class OpenApiService {
1079
1079
  });
1080
1080
  return data;
1081
1081
  });
1082
+ this.getBridgeSupportChain = () => __awaiter(this, void 0, void 0, function* () {
1083
+ const { data } = yield this.request.get('/v1/bridge/supported_chains');
1084
+ return data;
1085
+ });
1086
+ this.getBridgeAggregatorList = () => __awaiter(this, void 0, void 0, function* () {
1087
+ const { data } = yield this.request.get('/v1/bridge/list');
1088
+ return data;
1089
+ });
1090
+ this.getBridgePairList = (params) => __awaiter(this, void 0, void 0, function* () {
1091
+ const { data } = yield this.request.get('/v1/bridge/pair_list', {
1092
+ params: Object.assign(Object.assign({}, params), { aggregator_ids: params.aggregator_ids.join(',') }),
1093
+ });
1094
+ return data;
1095
+ });
1096
+ this.getBridgeQuoteList = (params) => __awaiter(this, void 0, void 0, function* () {
1097
+ const { data } = yield this.request.get('/v1/bridge/quote_list', {
1098
+ params,
1099
+ });
1100
+ return data;
1101
+ });
1102
+ this.getBridgeQuote = (params) => __awaiter(this, void 0, void 0, function* () {
1103
+ const { data } = yield this.request.get('/v1/bridge/quote', {
1104
+ params,
1105
+ });
1106
+ return data;
1107
+ });
1108
+ this.getBridgeHistoryList = (params) => __awaiter(this, void 0, void 0, function* () {
1109
+ const { data } = yield this.request.get('/v1/bridge/history_list', {
1110
+ params,
1111
+ });
1112
+ return data;
1113
+ });
1114
+ this.postBridgeHistory = (params) => __awaiter(this, void 0, void 0, function* () {
1115
+ const { data } = yield this.request.post('/v1/bridge/history', params);
1116
+ return data;
1117
+ });
1082
1118
  if (store instanceof Promise) {
1083
1119
  store.then((resolvedStore) => {
1084
1120
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -1229,4 +1229,78 @@ export interface NodeStatusDetail {
1229
1229
  rabby_rpc: NodeServiceData[];
1230
1230
  rabby_data_service: NodeServiceData[];
1231
1231
  }
1232
+ interface BridgeItem {
1233
+ id: string;
1234
+ name: string;
1235
+ logo_url: string;
1236
+ }
1237
+ export interface BridgeAggregator {
1238
+ id: string;
1239
+ name: string;
1240
+ logo_url: string;
1241
+ bridge_list: BridgeItem[];
1242
+ }
1243
+ export interface BridgeTokenPair {
1244
+ aggregator_id: string;
1245
+ from_token: TokenItem;
1246
+ to_token: TokenItem;
1247
+ from_token_amount: number;
1248
+ from_token_raw_amount_hex_str: string;
1249
+ from_token_usd_value: number;
1250
+ }
1251
+ export interface BridgeQuote {
1252
+ aggregator: Exclude<BridgeAggregator, 'bridge_list'>;
1253
+ bridge_id: string;
1254
+ bridge: BridgeItem;
1255
+ to_token_amount: number;
1256
+ to_token_raw_amount: number;
1257
+ to_token_raw_amount_hex_str: string;
1258
+ gas_fee: {
1259
+ raw_amount_hex_str: string;
1260
+ usd_value: number;
1261
+ };
1262
+ protocol_fee: {
1263
+ raw_amount_hex_str: string;
1264
+ usd_value: number;
1265
+ };
1266
+ rabby_fee: {
1267
+ raw_amount_hex_str: string;
1268
+ usd_value: number;
1269
+ };
1270
+ duration: number;
1271
+ routePath: string;
1272
+ approve_contract_id: string;
1273
+ tx: {
1274
+ chainId: number;
1275
+ data: string;
1276
+ from: string;
1277
+ gasLimit: string;
1278
+ gasPrice: string;
1279
+ to: string;
1280
+ value: string;
1281
+ };
1282
+ }
1283
+ export interface BridgeHistory {
1284
+ aggregator: Exclude<BridgeAggregator, 'bridge_list'>;
1285
+ bridge: BridgeItem;
1286
+ from_token: TokenItem;
1287
+ to_token: TokenItem;
1288
+ quote: {
1289
+ pay_token_amount: number;
1290
+ receive_token_amount: number;
1291
+ };
1292
+ actual: {
1293
+ pay_token_amount: number;
1294
+ receive_token_amount: number;
1295
+ };
1296
+ detail_url: string;
1297
+ status: 'pending' | 'completed';
1298
+ create_at: number;
1299
+ from_gas: {
1300
+ native_token: TokenItem;
1301
+ gas_amount: number;
1302
+ usd_gas_fee: number;
1303
+ gas_price: number;
1304
+ };
1305
+ }
1232
1306
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.7.21",
3
+ "version": "0.7.23-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [