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

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, GasAccountInfo } from './types';
5
5
  interface OpenApiStore {
6
6
  host: string;
7
7
  testnetHost?: string;
@@ -484,6 +484,7 @@ export declare class OpenApiService {
484
484
  sig?: string;
485
485
  }) => Promise<{
486
486
  req: TxRequest;
487
+ access_token?: string;
487
488
  }>;
488
489
  getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
489
490
  getTxRequest: (id: string) => Promise<TxRequest>;
@@ -873,22 +874,12 @@ export declare class OpenApiService {
873
874
  sig: string;
874
875
  id: string;
875
876
  }) => Promise<{
876
- account: {
877
- id: string;
878
- balance: number;
879
- create_at: number;
880
- nonce: number;
881
- };
877
+ account: GasAccountInfo;
882
878
  }>;
883
879
  getGasAccountInfoV2: (params: {
884
880
  id: string;
885
881
  }) => Promise<{
886
- account: {
887
- id: string;
888
- balance: number;
889
- create_at: number;
890
- nonce: number;
891
- };
882
+ account: GasAccountInfo;
892
883
  }>;
893
884
  confirmIapOrder: (postData: {
894
885
  user_id: string;
@@ -1078,5 +1069,43 @@ export declare class OpenApiService {
1078
1069
  q: string;
1079
1070
  }) => Promise<TokenItem[]>;
1080
1071
  batchQueryTokens: (uuids: string | string[]) => Promise<TokenItem[]>;
1072
+ getBuySupportedCountryList: () => Promise<BuyCountryItem[]>;
1073
+ getBuySupportedTokenList: () => Promise<(TokenItem & {
1074
+ currency_code: string;
1075
+ })[]>;
1076
+ getBuyQuote: (params: {
1077
+ country_code: string;
1078
+ user_addr: string;
1079
+ usd_amount: string;
1080
+ currency_code: string;
1081
+ receive_token_uuid: string;
1082
+ }) => Promise<BuyQuoteItem[]>;
1083
+ getBuyWidgetUrl: (params: {
1084
+ country_code: string;
1085
+ user_addr: string;
1086
+ usd_amount: string;
1087
+ receive_token_uuid: string;
1088
+ service_provider: string;
1089
+ currency_code: string;
1090
+ redirect_url?: string;
1091
+ }) => Promise<{
1092
+ url: string;
1093
+ msg: number;
1094
+ }>;
1095
+ getBuyHistory: (params: {
1096
+ user_addr: string;
1097
+ start?: number;
1098
+ limit?: number;
1099
+ }) => Promise<BuyHistoryList>;
1100
+ getBuyPaymentMethods: (params: {
1101
+ currency_code: string;
1102
+ country_code: string;
1103
+ service_provider: string;
1104
+ }) => Promise<BuyPaymentMethod[]>;
1105
+ getBuyCurrencyList: () => Promise<{
1106
+ id: string;
1107
+ name: string;
1108
+ image_url: string;
1109
+ }[]>;
1081
1110
  }
1082
1111
  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
@@ -1076,7 +1076,6 @@ export interface TxRequest {
1076
1076
  predict_packed_at?: number;
1077
1077
  predict_err_code?: number;
1078
1078
  push_at_list?: number[];
1079
- access_token?: string;
1080
1079
  }
1081
1080
  export interface MempoolCheckDetail {
1082
1081
  id: string;
@@ -1396,4 +1395,64 @@ export interface WithdrawListAddressItem {
1396
1395
  total_withdraw_limit: number;
1397
1396
  recharge_chain_list: RechargeChainItem[];
1398
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 BuyServiceProvider {
1408
+ id: string;
1409
+ name: string;
1410
+ website_url: string;
1411
+ customer_support_url: string;
1412
+ image_url: string;
1413
+ logo_url: string;
1414
+ }
1415
+ export interface BuyQuoteItem {
1416
+ service_provider: BuyServiceProvider;
1417
+ token_amount: number;
1418
+ payment_method_type: string;
1419
+ }
1420
+ export interface BuyHistoryItem {
1421
+ id: string;
1422
+ user_addr: string;
1423
+ status: string;
1424
+ create_at: number;
1425
+ service_provider: BuyServiceProvider;
1426
+ service_provider_url: null | string;
1427
+ pay_usd_amount: number;
1428
+ pay_currency_code: string;
1429
+ payment_type: string;
1430
+ receive_chain_id: string;
1431
+ receive_tx_id: string;
1432
+ receive_token_id: string;
1433
+ receive_amount: number;
1434
+ receive_token: TokenItem;
1435
+ }
1436
+ export interface BuyHistoryList {
1437
+ pagination: {
1438
+ start: number;
1439
+ limit: number;
1440
+ total: number;
1441
+ };
1442
+ histories: BuyHistoryItem[];
1443
+ }
1444
+ export interface BuyPaymentMethod {
1445
+ id: string;
1446
+ name: string;
1447
+ type: string;
1448
+ logo_url: string;
1449
+ }
1450
+ export interface GasAccountInfo {
1451
+ id: string;
1452
+ balance: number;
1453
+ create_at: number;
1454
+ nonce: number;
1455
+ uuid: string;
1456
+ has_iap_order: boolean;
1457
+ }
1399
1458
  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.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [