@rabby-wallet/rabby-api 0.7.27 → 0.7.29
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 +83 -2
- package/dist/index.js +48 -0
- package/dist/types.d.ts +30 -1
- 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 } 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 } from './types';
|
|
5
5
|
interface OpenApiStore {
|
|
6
6
|
host: string;
|
|
7
7
|
testnetHost?: string;
|
|
@@ -450,7 +450,8 @@ export declare class OpenApiService {
|
|
|
450
450
|
req_id?: string;
|
|
451
451
|
tx: Tx;
|
|
452
452
|
push_type: TxPushType;
|
|
453
|
-
is_gasless
|
|
453
|
+
is_gasless?: boolean;
|
|
454
|
+
is_gas_account?: boolean;
|
|
454
455
|
log_id: string;
|
|
455
456
|
low_gas_deadline?: number;
|
|
456
457
|
origin?: string;
|
|
@@ -829,5 +830,85 @@ export declare class OpenApiService {
|
|
|
829
830
|
};
|
|
830
831
|
data: DbkBridgeHistoryItem[];
|
|
831
832
|
}>;
|
|
833
|
+
getGasAccountSignText: (account_id: string) => Promise<{
|
|
834
|
+
text: string;
|
|
835
|
+
}>;
|
|
836
|
+
getGasAccountInfo: (params: {
|
|
837
|
+
sig: string;
|
|
838
|
+
id: string;
|
|
839
|
+
}) => Promise<{
|
|
840
|
+
account: {
|
|
841
|
+
id: string;
|
|
842
|
+
balance: number;
|
|
843
|
+
create_at: number;
|
|
844
|
+
nonce: number;
|
|
845
|
+
};
|
|
846
|
+
}>;
|
|
847
|
+
loginGasAccount: (params: {
|
|
848
|
+
sig: string;
|
|
849
|
+
account_id: string;
|
|
850
|
+
}) => Promise<{
|
|
851
|
+
success: boolean;
|
|
852
|
+
}>;
|
|
853
|
+
logoutGasAccount: (params: {
|
|
854
|
+
sig: string;
|
|
855
|
+
account_id: string;
|
|
856
|
+
}) => Promise<{
|
|
857
|
+
success: boolean;
|
|
858
|
+
}>;
|
|
859
|
+
getGasAccountTokenList: (id: string) => Promise<TokenItem[]>;
|
|
860
|
+
rechargeGasAccount: (params: {
|
|
861
|
+
sig: string;
|
|
862
|
+
account_id: string;
|
|
863
|
+
tx_id: string;
|
|
864
|
+
chain_id: string;
|
|
865
|
+
amount: number;
|
|
866
|
+
user_addr: string;
|
|
867
|
+
nonce: number;
|
|
868
|
+
}) => Promise<{
|
|
869
|
+
success: boolean;
|
|
870
|
+
}>;
|
|
871
|
+
withdrawGasAccount: (params: {
|
|
872
|
+
sig: string;
|
|
873
|
+
amount: number;
|
|
874
|
+
account_id: string;
|
|
875
|
+
}) => Promise<{
|
|
876
|
+
success: boolean;
|
|
877
|
+
}>;
|
|
878
|
+
getGasAccountHistory: (params: {
|
|
879
|
+
sig: string;
|
|
880
|
+
account_id: string;
|
|
881
|
+
start: number;
|
|
882
|
+
limit: number;
|
|
883
|
+
}) => Promise<{
|
|
884
|
+
recharge_list: {
|
|
885
|
+
amount: number;
|
|
886
|
+
chain_id: string;
|
|
887
|
+
create_at: number;
|
|
888
|
+
gas_account_id: string;
|
|
889
|
+
tx_id: string;
|
|
890
|
+
user_addr: string;
|
|
891
|
+
}[];
|
|
892
|
+
history_list: {
|
|
893
|
+
id: string;
|
|
894
|
+
chain_id: string;
|
|
895
|
+
create_at: number;
|
|
896
|
+
gas_cost_usd_value: number;
|
|
897
|
+
gas_account_id: string;
|
|
898
|
+
tx_id: string;
|
|
899
|
+
usd_value: number;
|
|
900
|
+
user_addr: string;
|
|
901
|
+
}[];
|
|
902
|
+
pagination: {
|
|
903
|
+
limit: number;
|
|
904
|
+
start: number;
|
|
905
|
+
total: number;
|
|
906
|
+
};
|
|
907
|
+
}>;
|
|
908
|
+
checkGasAccountTxs: (params: {
|
|
909
|
+
sig: string;
|
|
910
|
+
account_id: string;
|
|
911
|
+
tx_list: Tx[];
|
|
912
|
+
}) => Promise<GasAccountCheckResult>;
|
|
832
913
|
}
|
|
833
914
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1165,6 +1165,54 @@ export class OpenApiService {
|
|
|
1165
1165
|
});
|
|
1166
1166
|
return data;
|
|
1167
1167
|
});
|
|
1168
|
+
this.getGasAccountSignText = (account_id) => __awaiter(this, void 0, void 0, function* () {
|
|
1169
|
+
const { data } = yield this.request.get('/v1/gas_account/sign_text', {
|
|
1170
|
+
params: {
|
|
1171
|
+
account_id,
|
|
1172
|
+
},
|
|
1173
|
+
});
|
|
1174
|
+
return data;
|
|
1175
|
+
});
|
|
1176
|
+
this.getGasAccountInfo = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1177
|
+
const { data } = yield this.request.get('/v1/gas_account', {
|
|
1178
|
+
params: Object.assign({}, params),
|
|
1179
|
+
});
|
|
1180
|
+
return data;
|
|
1181
|
+
});
|
|
1182
|
+
this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1183
|
+
const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, params));
|
|
1184
|
+
return data;
|
|
1185
|
+
});
|
|
1186
|
+
this.logoutGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1187
|
+
const { data } = yield this.request.post('/v1/gas_account/logout', Object.assign({}, params));
|
|
1188
|
+
return data;
|
|
1189
|
+
});
|
|
1190
|
+
this.getGasAccountTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
|
|
1191
|
+
const { data } = yield this.request.get('/v1/user/recharge_token_list', {
|
|
1192
|
+
params: {
|
|
1193
|
+
id,
|
|
1194
|
+
},
|
|
1195
|
+
});
|
|
1196
|
+
return data;
|
|
1197
|
+
});
|
|
1198
|
+
this.rechargeGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1199
|
+
const { data } = yield this.request.post('/v1/gas_account/recharge', params);
|
|
1200
|
+
return data;
|
|
1201
|
+
});
|
|
1202
|
+
this.withdrawGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1203
|
+
const { data } = yield this.request.post('/v1/gas_account/withdraw', params);
|
|
1204
|
+
return data;
|
|
1205
|
+
});
|
|
1206
|
+
this.getGasAccountHistory = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1207
|
+
const { data } = yield this.request.get('/v1/gas_account/history', {
|
|
1208
|
+
params,
|
|
1209
|
+
});
|
|
1210
|
+
return data;
|
|
1211
|
+
});
|
|
1212
|
+
this.checkGasAccountTxs = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
1213
|
+
const { data } = yield this.request.post('/v1/gas_account/check_txs', params);
|
|
1214
|
+
return data;
|
|
1215
|
+
});
|
|
1168
1216
|
if (store instanceof Promise) {
|
|
1169
1217
|
store.then((resolvedStore) => {
|
|
1170
1218
|
this.store = resolvedStore;
|
package/dist/types.d.ts
CHANGED
|
@@ -872,6 +872,25 @@ export interface SwapOrderAction {
|
|
|
872
872
|
receiver: string | null;
|
|
873
873
|
expire_at: string | null;
|
|
874
874
|
}
|
|
875
|
+
export interface MaxPayTokenItem extends TokenItem {
|
|
876
|
+
max_amount: number;
|
|
877
|
+
max_raw_amount: string;
|
|
878
|
+
}
|
|
879
|
+
export interface SwapLimitPay {
|
|
880
|
+
pay_token: MaxPayTokenItem;
|
|
881
|
+
receive_token: TokenItem;
|
|
882
|
+
receiver: string;
|
|
883
|
+
}
|
|
884
|
+
export interface MultiSwapAction {
|
|
885
|
+
pay_token_list: TokenItem[];
|
|
886
|
+
receive_token_list: SwapReceiveToken[];
|
|
887
|
+
receiver: string;
|
|
888
|
+
}
|
|
889
|
+
export interface TransferOwnerAction {
|
|
890
|
+
description: string;
|
|
891
|
+
from_addr: string;
|
|
892
|
+
to_addr: string;
|
|
893
|
+
}
|
|
875
894
|
export interface SwapAction {
|
|
876
895
|
pay_token: TokenItem;
|
|
877
896
|
receive_token: SwapReceiveToken;
|
|
@@ -897,7 +916,7 @@ export declare type RevokeNFTCollectionAction = ApproveNFTCollectionAction;
|
|
|
897
916
|
export interface ParseTxResponse {
|
|
898
917
|
action: {
|
|
899
918
|
type: string;
|
|
900
|
-
data: SwapAction | ApproveAction | SendAction | SendNFTAction | ApproveNFTAction | RevokeNFTAction | ApproveNFTCollectionAction | RevokeNFTCollectionAction | RevokeTokenApproveAction | WrapTokenAction | UnWrapTokenAction | PushMultiSigAction | CrossSwapAction | CrossTokenAction | RevokePermit2Action | SwapOrderAction | null;
|
|
919
|
+
data: SwapAction | ApproveAction | SendAction | SendNFTAction | ApproveNFTAction | RevokeNFTAction | ApproveNFTCollectionAction | RevokeNFTCollectionAction | RevokeTokenApproveAction | WrapTokenAction | UnWrapTokenAction | PushMultiSigAction | CrossSwapAction | CrossTokenAction | RevokePermit2Action | SwapOrderAction | TransferOwnerAction | MultiSwapAction | SwapLimitPay | null;
|
|
901
920
|
};
|
|
902
921
|
contract_call?: {
|
|
903
922
|
func: string;
|
|
@@ -1339,4 +1358,14 @@ export interface ContractInfo {
|
|
|
1339
1358
|
edit: null | boolean;
|
|
1340
1359
|
};
|
|
1341
1360
|
}
|
|
1361
|
+
export interface GasAccountCheckResult {
|
|
1362
|
+
gas_account_cost: {
|
|
1363
|
+
total_cost: number;
|
|
1364
|
+
tx_cost: number;
|
|
1365
|
+
gas_cost: number;
|
|
1366
|
+
};
|
|
1367
|
+
is_gas_account: boolean;
|
|
1368
|
+
balance_is_enough: boolean;
|
|
1369
|
+
chain_not_support: boolean;
|
|
1370
|
+
}
|
|
1342
1371
|
export {};
|