@rabby-wallet/rabby-api 0.7.28 → 0.7.30

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 } 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: boolean;
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: (p: {
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: (p: {
872
+ sig: string;
873
+ amount: number;
874
+ account_id: string;
875
+ }) => Promise<{
876
+ success: boolean;
877
+ }>;
878
+ getGasAccountHistory: (p: {
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: (p: {
909
+ sig: string;
910
+ account_id: string;
911
+ tx_list: Tx[];
912
+ }) => Promise<GasAccountCheckResult>;
832
913
  }
833
914
  export {};
package/dist/index.js CHANGED
@@ -18,6 +18,17 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
18
18
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
19
19
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
20
20
  };
21
+ var __rest = (this && this.__rest) || function (s, e) {
22
+ var t = {};
23
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
24
+ t[p] = s[p];
25
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
26
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
27
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
28
+ t[p[i]] = s[p[i]];
29
+ }
30
+ return t;
31
+ };
21
32
  var _OpenApiService_adapter, _OpenApiService_plugin, _OpenApiService_clientName, _OpenApiService_clientVersion;
22
33
  import axios from 'axios';
23
34
  import rateLimit from 'axios-rate-limit';
@@ -1165,6 +1176,87 @@ export class OpenApiService {
1165
1176
  });
1166
1177
  return data;
1167
1178
  });
1179
+ this.getGasAccountSignText = (account_id) => __awaiter(this, void 0, void 0, function* () {
1180
+ const { data } = yield this.request.get('/v1/gas_account/sign_text', {
1181
+ params: {
1182
+ account_id,
1183
+ },
1184
+ });
1185
+ return data;
1186
+ });
1187
+ this.getGasAccountInfo = (params) => __awaiter(this, void 0, void 0, function* () {
1188
+ const { sig } = params, others = __rest(params, ["sig"]);
1189
+ const { data } = yield this.request.get('/v1/gas_account', {
1190
+ params: Object.assign({}, others),
1191
+ headers: {
1192
+ sig,
1193
+ },
1194
+ });
1195
+ return data;
1196
+ });
1197
+ this.loginGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
1198
+ const { sig } = params, others = __rest(params, ["sig"]);
1199
+ const { data } = yield this.request.post('/v1/gas_account/login', Object.assign({}, others), {
1200
+ headers: {
1201
+ sig,
1202
+ },
1203
+ });
1204
+ return data;
1205
+ });
1206
+ this.logoutGasAccount = (params) => __awaiter(this, void 0, void 0, function* () {
1207
+ const { sig } = params, others = __rest(params, ["sig"]);
1208
+ const { data } = yield this.request.post('/v1/gas_account/logout', Object.assign({}, others), {
1209
+ headers: {
1210
+ sig,
1211
+ },
1212
+ });
1213
+ return data;
1214
+ });
1215
+ this.getGasAccountTokenList = (id) => __awaiter(this, void 0, void 0, function* () {
1216
+ const { data } = yield this.request.get('/v1/user/recharge_token_list', {
1217
+ params: {
1218
+ id,
1219
+ },
1220
+ });
1221
+ return data;
1222
+ });
1223
+ this.rechargeGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
1224
+ const { sig } = p, params = __rest(p, ["sig"]);
1225
+ const { data } = yield this.request.post('/v1/gas_account/recharge', params, {
1226
+ headers: {
1227
+ sig,
1228
+ },
1229
+ });
1230
+ return data;
1231
+ });
1232
+ this.withdrawGasAccount = (p) => __awaiter(this, void 0, void 0, function* () {
1233
+ const { sig } = p, params = __rest(p, ["sig"]);
1234
+ const { data } = yield this.request.post('/v1/gas_account/withdraw', params, {
1235
+ headers: {
1236
+ sig,
1237
+ },
1238
+ });
1239
+ return data;
1240
+ });
1241
+ this.getGasAccountHistory = (p) => __awaiter(this, void 0, void 0, function* () {
1242
+ const { sig } = p, params = __rest(p, ["sig"]);
1243
+ const { data } = yield this.request.get('/v1/gas_account/history', {
1244
+ params,
1245
+ headers: {
1246
+ sig,
1247
+ },
1248
+ });
1249
+ return data;
1250
+ });
1251
+ this.checkGasAccountTxs = (p) => __awaiter(this, void 0, void 0, function* () {
1252
+ const { sig } = p, params = __rest(p, ["sig"]);
1253
+ const { data } = yield this.request.post('/v1/gas_account/check_txs', params, {
1254
+ headers: {
1255
+ sig,
1256
+ },
1257
+ });
1258
+ return data;
1259
+ });
1168
1260
  if (store instanceof Promise) {
1169
1261
  store.then((resolvedStore) => {
1170
1262
  this.store = resolvedStore;
package/dist/types.d.ts CHANGED
@@ -1358,4 +1358,14 @@ export interface ContractInfo {
1358
1358
  edit: null | boolean;
1359
1359
  };
1360
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
+ }
1361
1371
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rabby-wallet/rabby-api",
3
- "version": "0.7.28",
3
+ "version": "0.7.30",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [