@rabby-wallet/rabby-api 0.6.22 → 0.6.23
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/README.md +3 -3
- package/dist/index.d.ts +22 -1
- package/dist/index.js +39 -0
- package/dist/types.d.ts +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Install
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install rabby-api @debank/common
|
|
6
|
+
npm install @rabby-wallet/rabby-api @debank/common
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
@@ -13,8 +13,8 @@ import { OpenApiService } from 'rabby-api';
|
|
|
13
13
|
|
|
14
14
|
const service = new OpenApiService({
|
|
15
15
|
store: {
|
|
16
|
-
host: 'https://api.rabby.io'
|
|
17
|
-
}
|
|
16
|
+
host: 'https://api.rabby.io',
|
|
17
|
+
},
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// init service
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosAdapter } from 'axios';
|
|
2
2
|
import { RateLimitedAxiosInstance } from 'axios-rate-limit';
|
|
3
|
-
import { AddrDescResponse, ApprovalStatus, AssetItem, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxHistoryResult, UsedChain } from './types';
|
|
3
|
+
import { AddrDescResponse, ApprovalStatus, AssetItem, CEXQuote, Cex, ChainWithPendingCount, Collection, CollectionList, CollectionWithFloorPrice, ComplexProtocol, ContractCredit, ExplainTxResponse, ExplainTypedDataResponse, GasLevel, GetTxResponse, MempoolCheckDetail, NFTApprovalResponse, NFTItem, ParseTextResponse, ParseTxResponse, ParseTypedDataResponse, Protocol, SecurityCheckResponse, ServerChain, SlippageStatus, Summary, SwapTradeList, TokenApproval, TokenItem, TotalBalanceResponse, Tx, TxHistoryResult, TxPushType, TxRequest, UsedChain } from './types';
|
|
4
4
|
interface OpenApiStore {
|
|
5
5
|
host: string;
|
|
6
6
|
testnetHost?: string;
|
|
@@ -325,6 +325,27 @@ export declare class OpenApiService {
|
|
|
325
325
|
}) => Promise<{
|
|
326
326
|
is_success: boolean;
|
|
327
327
|
}>;
|
|
328
|
+
gasSupportedPushType: (chainId: string) => Promise<{
|
|
329
|
+
low_gas: boolean;
|
|
330
|
+
mev: boolean;
|
|
331
|
+
}>;
|
|
332
|
+
submitTx: (postData: {
|
|
333
|
+
req_id?: string;
|
|
334
|
+
tx: Tx;
|
|
335
|
+
push_type: TxPushType;
|
|
336
|
+
low_gas_deadline?: number;
|
|
337
|
+
origin?: string;
|
|
338
|
+
}) => Promise<{
|
|
339
|
+
req: TxRequest;
|
|
340
|
+
}>;
|
|
341
|
+
getTxRequests: (ids: string | string[]) => Promise<TxRequest[]>;
|
|
342
|
+
withdrawTx: (reqId: string) => Promise<{
|
|
343
|
+
req: TxRequest;
|
|
344
|
+
}>;
|
|
345
|
+
retryPushTx: (reqId: string) => Promise<{
|
|
346
|
+
req: TxRequest;
|
|
347
|
+
}>;
|
|
348
|
+
mempoolChecks: (txId: string, chainId: string) => Promise<MempoolCheckDetail[]>;
|
|
328
349
|
walletSupportChain: (params: {
|
|
329
350
|
chain_id: string;
|
|
330
351
|
user_addr: string;
|
package/dist/index.js
CHANGED
|
@@ -741,6 +741,45 @@ export class OpenApiService {
|
|
|
741
741
|
const { data } = yield this.request.post('/v1/faucet/request', Object.assign({}, params));
|
|
742
742
|
return data;
|
|
743
743
|
});
|
|
744
|
+
this.gasSupportedPushType = (chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
745
|
+
const { data } = yield this.request.get('/v1/wallet/supported_push_type', Object.assign({ params: {
|
|
746
|
+
chain_id: chainId,
|
|
747
|
+
} }, this._getRequestOptions(chainId)));
|
|
748
|
+
return data;
|
|
749
|
+
});
|
|
750
|
+
this.submitTx = (postData) => __awaiter(this, void 0, void 0, function* () {
|
|
751
|
+
var _q;
|
|
752
|
+
const { data } = yield this.request.post('/v1/wallet/submit_tx', Object.assign({}, postData), this._getRequestOptions((_q = getChainByNetwork(postData.tx.chainId)) === null || _q === void 0 ? void 0 : _q.serverId));
|
|
753
|
+
return data;
|
|
754
|
+
});
|
|
755
|
+
this.getTxRequests = (ids) => __awaiter(this, void 0, void 0, function* () {
|
|
756
|
+
const { data } = yield this.request.get('/v1/wallet/get_tx_requests', {
|
|
757
|
+
params: {
|
|
758
|
+
ids: Array.isArray(ids) ? ids.join(',') : ids,
|
|
759
|
+
},
|
|
760
|
+
});
|
|
761
|
+
return data;
|
|
762
|
+
});
|
|
763
|
+
this.withdrawTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
764
|
+
const { data } = yield this.request.post('/v1/wallet/withdraw_tx', {
|
|
765
|
+
id: reqId,
|
|
766
|
+
});
|
|
767
|
+
return data;
|
|
768
|
+
});
|
|
769
|
+
this.retryPushTx = (reqId) => __awaiter(this, void 0, void 0, function* () {
|
|
770
|
+
const { data } = yield this.request.post('/v1/wallet/retry_push_tx', {
|
|
771
|
+
id: reqId,
|
|
772
|
+
});
|
|
773
|
+
return data;
|
|
774
|
+
});
|
|
775
|
+
this.mempoolChecks = (txId, chainId) => __awaiter(this, void 0, void 0, function* () {
|
|
776
|
+
var _r;
|
|
777
|
+
const { data } = yield this.request.get('/v1/wallet/mempool_checks', Object.assign({ params: {
|
|
778
|
+
tx_id: txId,
|
|
779
|
+
chain_id: chainId,
|
|
780
|
+
} }, this._getRequestOptions((_r = getChainByNetwork(chainId)) === null || _r === void 0 ? void 0 : _r.serverId)));
|
|
781
|
+
return data;
|
|
782
|
+
});
|
|
744
783
|
this.walletSupportChain = (params) => __awaiter(this, void 0, void 0, function* () {
|
|
745
784
|
const { data } = yield this.request.post('/v1/wallet/support_chain', params);
|
|
746
785
|
return data;
|
package/dist/types.d.ts
CHANGED
|
@@ -969,4 +969,28 @@ export interface ParseTextResponse {
|
|
|
969
969
|
data: CreateKeyAction | VerifyAddressAction;
|
|
970
970
|
} | null;
|
|
971
971
|
}
|
|
972
|
+
export declare type TxPushType = 'default' | 'low_gas' | 'mev';
|
|
973
|
+
export interface TxRequest {
|
|
974
|
+
id: string;
|
|
975
|
+
chain_id: string;
|
|
976
|
+
user_addr: string;
|
|
977
|
+
nonce: number;
|
|
978
|
+
signed_tx: Tx;
|
|
979
|
+
tx_id?: null | string;
|
|
980
|
+
push_type: TxPushType;
|
|
981
|
+
push_status?: 'success' | 'failed';
|
|
982
|
+
push_at?: number | null;
|
|
983
|
+
is_withdraw: boolean;
|
|
984
|
+
create_at: number;
|
|
985
|
+
low_gas_deadline?: number;
|
|
986
|
+
is_finished: boolean;
|
|
987
|
+
}
|
|
988
|
+
export interface MempoolCheckDetail {
|
|
989
|
+
id: string;
|
|
990
|
+
chain_id: string;
|
|
991
|
+
tx_id: string;
|
|
992
|
+
check_at: string;
|
|
993
|
+
check_success: boolean;
|
|
994
|
+
rpc: string;
|
|
995
|
+
}
|
|
972
996
|
export {};
|