@rabby-wallet/rabby-api 0.9.11 → 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 +59 -2
- package/dist/index.js +53 -4
- package/dist/types.d.ts +53 -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, 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;
|
|
@@ -481,6 +481,7 @@ export declare class OpenApiService {
|
|
|
481
481
|
log_id: string;
|
|
482
482
|
low_gas_deadline?: number;
|
|
483
483
|
origin?: string;
|
|
484
|
+
sig?: string;
|
|
484
485
|
}) => Promise<{
|
|
485
486
|
req: TxRequest;
|
|
486
487
|
}>;
|
|
@@ -879,6 +880,24 @@ export declare class OpenApiService {
|
|
|
879
880
|
nonce: number;
|
|
880
881
|
};
|
|
881
882
|
}>;
|
|
883
|
+
getGasAccountInfoV2: (params: {
|
|
884
|
+
id: string;
|
|
885
|
+
}) => Promise<{
|
|
886
|
+
account: {
|
|
887
|
+
id: string;
|
|
888
|
+
balance: number;
|
|
889
|
+
create_at: number;
|
|
890
|
+
nonce: number;
|
|
891
|
+
};
|
|
892
|
+
}>;
|
|
893
|
+
confirmIapOrder: (postData: {
|
|
894
|
+
user_id: string;
|
|
895
|
+
transaction_id: string;
|
|
896
|
+
device_type: 'android' | 'ios';
|
|
897
|
+
product_id: string;
|
|
898
|
+
}) => Promise<{
|
|
899
|
+
req: TxRequest;
|
|
900
|
+
}>;
|
|
882
901
|
loginGasAccount: (params: {
|
|
883
902
|
sig: string;
|
|
884
903
|
account_id: string;
|
|
@@ -957,7 +976,7 @@ export declare class OpenApiService {
|
|
|
957
976
|
};
|
|
958
977
|
}>;
|
|
959
978
|
checkGasAccountTxs: (p: {
|
|
960
|
-
sig
|
|
979
|
+
sig?: string;
|
|
961
980
|
account_id: string;
|
|
962
981
|
tx_list: Tx[];
|
|
963
982
|
}) => Promise<GasAccountCheckResult>;
|
|
@@ -1059,5 +1078,43 @@ export declare class OpenApiService {
|
|
|
1059
1078
|
q: string;
|
|
1060
1079
|
}) => Promise<TokenItem[]>;
|
|
1061
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
|
+
}[]>;
|
|
1062
1119
|
}
|
|
1063
1120
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -899,7 +899,10 @@ export class OpenApiService {
|
|
|
899
899
|
return data;
|
|
900
900
|
});
|
|
901
901
|
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
902
|
-
const {
|
|
902
|
+
const { sig } = postData, rest = __rest(postData, ["sig"]);
|
|
903
|
+
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, rest), {
|
|
904
|
+
headers: sig ? { sig } : undefined,
|
|
905
|
+
});
|
|
903
906
|
return data;
|
|
904
907
|
});
|
|
905
908
|
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1245,6 +1248,16 @@ export class OpenApiService {
|
|
|
1245
1248
|
});
|
|
1246
1249
|
return data;
|
|
1247
1250
|
});
|
|
1251
|
+
this.getGasAccountInfoV2 = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1252
|
+
const { data } = yield this.request.get('/v2/gas_account', {
|
|
1253
|
+
params,
|
|
1254
|
+
});
|
|
1255
|
+
return data;
|
|
1256
|
+
});
|
|
1257
|
+
this.confirmIapOrder = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
1258
|
+
const { data } = yield this.request.post('/v1/gas_account/confirm_iap_order', postData);
|
|
1259
|
+
return data;
|
|
1260
|
+
});
|
|
1248
1261
|
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1249
1262
|
const { sig } = params, others = __rest(params, ["sig"]);
|
|
1250
1263
|
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
|
|
@@ -1312,9 +1325,11 @@ export class OpenApiService {
|
|
|
1312
1325
|
this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
|
|
1313
1326
|
const { sig } = p, params = __rest(p, ["sig"]);
|
|
1314
1327
|
const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
|
|
1315
|
-
headers:
|
|
1316
|
-
|
|
1317
|
-
|
|
1328
|
+
headers: sig
|
|
1329
|
+
? {
|
|
1330
|
+
sig,
|
|
1331
|
+
}
|
|
1332
|
+
: undefined,
|
|
1318
1333
|
});
|
|
1319
1334
|
return data;
|
|
1320
1335
|
});
|
|
@@ -1411,6 +1426,40 @@ export class OpenApiService {
|
|
|
1411
1426
|
});
|
|
1412
1427
|
return data;
|
|
1413
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
|
+
});
|
|
1414
1463
|
if (store instanceof Promise) {
|
|
1415
1464
|
store.then((resolvedStore) => {
|
|
1416
1465
|
this.store = resolvedStore;
|
package/dist/types.d.ts
CHANGED
|
@@ -1076,6 +1076,7 @@ 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;
|
|
1079
1080
|
}
|
|
1080
1081
|
export interface MempoolCheckDetail {
|
|
1081
1082
|
id: string;
|
|
@@ -1395,4 +1396,56 @@ export interface WithdrawListAddressItem {
|
|
|
1395
1396
|
total_withdraw_limit: number;
|
|
1396
1397
|
recharge_chain_list: RechargeChainItem[];
|
|
1397
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
|
+
}
|
|
1398
1451
|
export {};
|