@rabby-wallet/rabby-api 0.9.11 → 0.9.12-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 } 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 } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -1059,5 +1059,30 @@ export declare class OpenApiService {
1059
1059
  q: string;
1060
1060
  }) => Promise<TokenItem[]>;
1061
1061
  batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1062
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1063
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1064
+ currency_code: string;
1065
+ })[]>;
1066
+ getBuyQuote: (params: {
1067
+ country_code: string;
1068
+ user_addr: string;
1069
+ usd_amount: string;
1070
+ receive_token_uuid: string;
1071
+ }) => Promise<BuyQuoteItem[]>;
1072
+ getBuyWidgetUrl: (params: {
1073
+ country_code: string;
1074
+ user_addr: string;
1075
+ usd_amount: string;
1076
+ receive_token_uuid: string;
1077
+ service_provider: string;
1078
+ }) => Promise<{
1079
+ url: string;
1080
+ msg: number;
1081
+ }>;
1082
+ getBuyHistory: (params: {
1083
+ user_addr: string;
1084
+ start?: number;
1085
+ limit?: number;
1086
+ }) => Promise<BuyHistoryList>;
1062
1087
  }
1063
1088
  export {};
package/dist/index.js CHANGED
@@ -1411,6 +1411,30 @@ export class OpenApiService {
1411
1411
  });
1412
1412
  return data;
1413
1413
  });
1414
+ this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
1415
+ const { data } = yield this.request.get('/v1/buy/supported_country_list');
1416
+ return data;
1417
+ });
1418
+ this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
1419
+ const { data } = yield this.request.get('/v1/buy/supported_token_list');
1420
+ return data;
1421
+ });
1422
+ this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
1423
+ const { data } = yield this.request.get('/v1/buy/quote', {
1424
+ params,
1425
+ });
1426
+ return data;
1427
+ });
1428
+ this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
1429
+ const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
1430
+ return data;
1431
+ });
1432
+ this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
1433
+ const { data } = yield this.request.get('/v1/buy/history', {
1434
+ params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
1435
+ });
1436
+ return data;
1437
+ });
1414
1438
  if (store instanceof Promise) {
1415
1439
  store.then((resolvedStore) => {
1416
1440
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -1395,4 +1395,43 @@ export interface WithdrawListAddressItem {
1395
1395
  total_withdraw_limit: number;
1396
1396
  recharge_chain_list: RechargeChainItem[];
1397
1397
  }
1398
+ export interface BuyCountryItem {
1399
+ id: string;
1400
+ name: string;
1401
+ image_url: string;
1402
+ regions: null | {
1403
+ regionCode: string;
1404
+ name: string;
1405
+ };
1406
+ }
1407
+ export interface BuyQuoteItem {
1408
+ service_provider: {
1409
+ id: string;
1410
+ name: string;
1411
+ website_url: string;
1412
+ customer_support_url: string;
1413
+ image_url: string;
1414
+ logo_url: string;
1415
+ };
1416
+ token_amount: number;
1417
+ payment_method_type: string;
1418
+ }
1419
+ export interface BuyHistoryList {
1420
+ pagination: {
1421
+ start: number;
1422
+ limit: number;
1423
+ total: number;
1424
+ };
1425
+ histories: {
1426
+ user_addr: string;
1427
+ status: 'pending' | 'success' | 'failed';
1428
+ create_at: number;
1429
+ service_provider: string;
1430
+ pay_usd_amount: number;
1431
+ payment_type: string;
1432
+ receive_tx_id: string;
1433
+ receive_chain_id: string;
1434
+ receive_token: TokenItem;
1435
+ }[];
1436
+ }
1398
1437
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.9.11",
3
+ "version": "0.9.12-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [