@rabby-wallet/rabby-api 0.9.12-alpha.0 → 0.9.12-alpha.1

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, BuyPaymentMethod } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -1078,5 +1078,43 @@ export declare class OpenApiService {
1078
1078
  q: string;
1079
1079
  }) => Promise<TokenItem[]>;
1080
1080
  batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1081
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1082
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1083
+ currency_code: string;
1084
+ })[]>;
1085
+ getBuyQuote: (params: {
1086
+ country_code: string;
1087
+ user_addr: string;
1088
+ usd_amount: string;
1089
+ currency_code: string;
1090
+ receive_token_uuid: string;
1091
+ }) => Promise<BuyQuoteItem[]>;
1092
+ getBuyWidgetUrl: (params: {
1093
+ country_code: string;
1094
+ user_addr: string;
1095
+ usd_amount: string;
1096
+ receive_token_uuid: string;
1097
+ service_provider: string;
1098
+ currency_code: string;
1099
+ redirect_url?: string;
1100
+ }) => Promise<{
1101
+ url: string;
1102
+ msg: number;
1103
+ }>;
1104
+ getBuyHistory: (params: {
1105
+ user_addr: string;
1106
+ start?: number;
1107
+ limit?: number;
1108
+ }) => Promise<BuyHistoryList>;
1109
+ getBuyPaymentMethods: (params: {
1110
+ currency_code: string;
1111
+ country_code: string;
1112
+ service_provider: string;
1113
+ }) => Promise<BuyPaymentMethod[]>;
1114
+ getBuyCurrencyList: () => Promise<{
1115
+ id: string;
1116
+ name: string;
1117
+ image_url: string;
1118
+ }[]>;
1081
1119
  }
1082
1120
  export {};
package/dist/index.js CHANGED
@@ -1426,6 +1426,40 @@ export class OpenApiService {
1426
1426
  });
1427
1427
  return data;
1428
1428
  });
1429
+ this.getBuySupportedCountryList = () => __awaiter(this, void 0, void 0, function* () {
1430
+ const { data } = yield this.request.get('/v1/buy/supported_country_list');
1431
+ return data;
1432
+ });
1433
+ this.getBuySupportedTokenList = () => __awaiter(this, void 0, void 0, function* () {
1434
+ const { data } = yield this.request.get('/v1/buy/supported_token_list');
1435
+ return data;
1436
+ });
1437
+ this.getBuyQuote = (params) => __awaiter(this, void 0, void 0, function* () {
1438
+ const { data } = yield this.request.get('/v1/buy/quote', {
1439
+ params,
1440
+ });
1441
+ return data;
1442
+ });
1443
+ this.getBuyWidgetUrl = (params) => __awaiter(this, void 0, void 0, function* () {
1444
+ const { data } = yield this.request.get('/v1/buy/get_widget_url', { params });
1445
+ return data;
1446
+ });
1447
+ this.getBuyHistory = (params) => __awaiter(this, void 0, void 0, function* () {
1448
+ const { data } = yield this.request.get('/v1/buy/history', {
1449
+ params: Object.assign(Object.assign({}, params), { start: params.start || 0, limit: params.limit || 20 }),
1450
+ });
1451
+ return data;
1452
+ });
1453
+ this.getBuyPaymentMethods = (params) => __awaiter(this, void 0, void 0, function* () {
1454
+ const { data } = yield this.request.get('/v1/buy/get_payment_method', {
1455
+ params,
1456
+ });
1457
+ return data;
1458
+ });
1459
+ this.getBuyCurrencyList = () => __awaiter(this, void 0, void 0, function* () {
1460
+ const { data } = yield this.request.get('/v1/buy/supported_currency_list');
1461
+ return data;
1462
+ });
1429
1463
  if (store instanceof Promise) {
1430
1464
  store.then((resolvedStore) => {
1431
1465
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -1396,4 +1396,56 @@ export interface WithdrawListAddressItem {
1396
1396
  total_withdraw_limit: number;
1397
1397
  recharge_chain_list: RechargeChainItem[];
1398
1398
  }
1399
+ export interface BuyCountryItem {
1400
+ id: string;
1401
+ name: string;
1402
+ image_url: string;
1403
+ regions: null | {
1404
+ regionCode: string;
1405
+ name: string;
1406
+ };
1407
+ }
1408
+ export interface BuyServiceProvider {
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
+ export interface BuyQuoteItem {
1417
+ service_provider: BuyServiceProvider;
1418
+ token_amount: number;
1419
+ payment_method_type: string;
1420
+ }
1421
+ export interface BuyHistoryItem {
1422
+ id: string;
1423
+ user_addr: string;
1424
+ status: string;
1425
+ create_at: number;
1426
+ service_provider: BuyServiceProvider;
1427
+ service_provider_url: null | string;
1428
+ pay_usd_amount: number;
1429
+ pay_currency_code: string;
1430
+ payment_type: string;
1431
+ receive_chain_id: string;
1432
+ receive_tx_id: string;
1433
+ receive_token_id: string;
1434
+ receive_amount: number;
1435
+ receive_token: TokenItem;
1436
+ }
1437
+ export interface BuyHistoryList {
1438
+ pagination: {
1439
+ start: number;
1440
+ limit: number;
1441
+ total: number;
1442
+ };
1443
+ histories: BuyHistoryItem[];
1444
+ }
1445
+ export interface BuyPaymentMethod {
1446
+ id: string;
1447
+ name: string;
1448
+ type: string;
1449
+ logo_url: string;
1450
+ }
1399
1451
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.9.12-alpha.0",
3
+ "version": "0.9.12-alpha.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [