@ercworldio/blockchain-shared 1.0.2-dev.6 → 1.0.2-dev.8

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.
@@ -507,7 +507,9 @@
507
507
  "overflow_treasury_receiver": "TWA4NYYdVtnb7iZfmyruC5MefsFdw84iZu",
508
508
  "overflow_threshold_decimal": 100000,
509
509
  "min_funding_wallet_balance_usd": 5,
510
- "allowed_receivers": []
510
+ "allowed_receivers": [
511
+ "TWA4NYYdVtnb7iZfmyruC5MefsFdw84iZu"
512
+ ]
511
513
  },
512
514
  "rpcMetadata": {
513
515
  "rpcBaseUrl": "https://rpc.ankr.com/premium-http/tron",
@@ -63,6 +63,7 @@ export declare const ErrorMessages: {
63
63
  readonly ONLY_NATIVE_WITHDRAWAL: "Only native tokens can be withdrawn";
64
64
  readonly RENT_ENERGY_API_ERROR: "Encountered error when calling rent API";
65
65
  readonly INSUFFICIENT_ENERGY_WALLET_BALANCE: "Rent energy wallet has insufficient balance";
66
+ readonly RENT_ENERGY_MIN_WITHDRAWAL_ERROR: "Minimum withdrawal of 50TRX required.";
66
67
  };
67
68
  export declare const ErrorCodes: {
68
69
  readonly INTERNAL_SERVER: "error.internal_server_error";
@@ -122,6 +123,7 @@ export declare const ErrorCodes: {
122
123
  readonly ONLY_NATIVE_WITHDRAWAL: "error.only_native_withdrawal";
123
124
  readonly RENT_ENERGY_API_ERROR: "error.rent_enegy_api_error";
124
125
  readonly INSUFFICIENT_ENERGY_WALLET_BALANCE: "error.insufficient_energy_wallet_balance";
126
+ readonly RENT_ENERGY_MIN_WITHDRAWAL_ERROR: "error.rent_energy_min_withdrawal_error";
125
127
  };
126
128
  export type ErrorCode = typeof ErrorCodes[keyof typeof ErrorCodes];
127
129
  export interface ErrorCodeEntry {
@@ -205,6 +207,7 @@ declare class BaseErrors {
205
207
  OnlyNativeWithdrawal(): "Only native tokens can be withdrawn";
206
208
  RentEnergyApiError(): "Encountered error when calling rent API";
207
209
  InsufficientRentEnergyWalletBalance(): "Rent energy wallet has insufficient balance";
210
+ RentEnergyMinWithdrawalError(): "Minimum withdrawal of 50TRX required.";
208
211
  /** Handler methods */
209
212
  handle_error: (error: any, source_method: string) => ErrorHandlerResponse;
210
213
  get_error_code_base: (message: string) => ErrorCodeEntry | null;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors/errors.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqFtB,2BAA2B;;;;IAK3B,sBAAsB;;;;;;;;CAUhB,CAAC;AAEX,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,OAAO,UAAU,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEnE,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,CAAC;CACzB;AAED,UAAU,oBAAoB;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,cAAc;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC7B,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;CACjB;AAGD,cAAM,UAAU;IACL,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAQX;IAED,yDAAyD;IAClD,YAAY,CAAC,CAAC,CAAC,EAAE,GAAG;IACpB,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG;IACxB,YA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G,EAAE,EAAE,CAAC,EAAE,GAAG;IACjC,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG;IACvB,mBAAmB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC3B,mBAAmB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC3B,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC9B,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG;IAChB,iBAAiB,CAAC,CAAC,CAAC,EAAE,GAAG;IACzB,gBAAgB;IAChB,sBAAsB;IACtB,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG;IACvB,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC9B,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG;IACrB,eAAe,CAAC,CAAC,CAAC,EAAE,GAAG;IACvB,oBAAoB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC5B,mBAAmB,CAAC,CAAC,CAAC,EAAE,GAAG;IAC3B,cAAc,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,MAAM;IAC/B,yBAAyB,CAAC,CAAC,CAAC,EAAE,GAAG;IACjC,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAAG;IACxB,aAAa,CAAC,CAAC,CAAC,EAAE,GAAG;IACrB,yBAAyB;IACzB,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,oBAAoB;IACpB,kBAAkB;IAClB,mCAAmC;IACnC,4BAA4B;IAEnC,sBAAsB;IACf,YAAY,GAAI,OAAO,GAAG,EAAE,eAAe,MAAM,KAAG,oBAAoB,CAuB9E;IAEM,mBAAmB,GAAI,SAAS,MAAM,KAAG,cAAc,GAAG,IAAI,CAmCpE;CACJ;AAED,eAAe,UAAU,CAAC"}
@@ -101,6 +101,7 @@ exports.ErrorMessages = {
101
101
  ONLY_NATIVE_WITHDRAWAL: `Only native tokens can be withdrawn`, // 400
102
102
  RENT_ENERGY_API_ERROR: `Encountered error when calling rent API`, // 500
103
103
  INSUFFICIENT_ENERGY_WALLET_BALANCE: `Rent energy wallet has insufficient balance`,
104
+ RENT_ENERGY_MIN_WITHDRAWAL_ERROR: `Minimum withdrawal of 50TRX required.`,
104
105
  };
105
106
  exports.ErrorCodes = {
106
107
  INTERNAL_SERVER: 'error.internal_server_error',
@@ -166,6 +167,7 @@ exports.ErrorCodes = {
166
167
  ONLY_NATIVE_WITHDRAWAL: `error.only_native_withdrawal`,
167
168
  RENT_ENERGY_API_ERROR: `error.rent_enegy_api_error`,
168
169
  INSUFFICIENT_ENERGY_WALLET_BALANCE: `error.insufficient_energy_wallet_balance`,
170
+ RENT_ENERGY_MIN_WITHDRAWAL_ERROR: `error.rent_energy_min_withdrawal_error`,
169
171
  };
170
172
  class BaseErrors {
171
173
  constructor() {
@@ -267,6 +269,8 @@ class BaseErrors {
267
269
  return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.RENT_ENERGY_API_ERROR });
268
270
  if (message.includes(exports.ErrorMessages.INSUFFICIENT_ENERGY_WALLET_BALANCE))
269
271
  return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.INSUFFICIENT_ENERGY_WALLET_BALANCE });
272
+ if (message.includes(exports.ErrorMessages.RENT_ENERGY_MIN_WITHDRAWAL_ERROR))
273
+ return Object.assign(Object.assign({}, this.codes[400]), { error_code: exports.ErrorCodes.RENT_ENERGY_MIN_WITHDRAWAL_ERROR });
270
274
  return null;
271
275
  };
272
276
  }
@@ -333,5 +337,7 @@ class BaseErrors {
333
337
  ;
334
338
  InsufficientRentEnergyWalletBalance() { return exports.ErrorMessages.INSUFFICIENT_ENERGY_WALLET_BALANCE; }
335
339
  ;
340
+ RentEnergyMinWithdrawalError() { return exports.ErrorMessages.RENT_ENERGY_MIN_WITHDRAWAL_ERROR; }
341
+ ;
336
342
  }
337
343
  exports.default = BaseErrors;
@@ -0,0 +1,17 @@
1
+ import { BlockchainType, NetworkConfig, PaymentToken } from "../../interfaces";
2
+ export interface ValidateWithdrawFundingPayload {
3
+ blockchain: BlockchainType;
4
+ chain_id: number;
5
+ receiver: string;
6
+ token: string;
7
+ amount: number;
8
+ network: NetworkConfig;
9
+ payment_token: PaymentToken;
10
+ wallet_type: WalletType;
11
+ }
12
+ export declare enum WalletType {
13
+ FUNDING = "funding",
14
+ RENT_ENERGY = "rent-energy",
15
+ ESCROW = "escrow"
16
+ }
17
+ //# sourceMappingURL=bo_withdrawal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bo_withdrawal.d.ts","sourceRoot":"","sources":["../../../src/services/types/bo_withdrawal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE/E,MAAM,WAAW,8BAA8B;IAC3C,UAAU,EAAE,cAAc,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,aAAa,CAAC;IACvB,aAAa,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,UAAU,CAAC;CAC3B;AAGD,oBAAY,UAAU;IAClB,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,MAAM,WAAW;CACpB"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WalletType = void 0;
4
+ var WalletType;
5
+ (function (WalletType) {
6
+ WalletType["FUNDING"] = "funding";
7
+ WalletType["RENT_ENERGY"] = "rent-energy";
8
+ WalletType["ESCROW"] = "escrow";
9
+ })(WalletType || (exports.WalletType = WalletType = {}));
@@ -13,4 +13,5 @@ export * from "./withdrawal_manager";
13
13
  export * from "./balance_service";
14
14
  export * from "./chain_manager";
15
15
  export * from './quicknode';
16
+ export * from "./bo_withdrawal";
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
@@ -29,3 +29,4 @@ __exportStar(require("./withdrawal_manager"), exports);
29
29
  __exportStar(require("./balance_service"), exports);
30
30
  __exportStar(require("./chain_manager"), exports);
31
31
  __exportStar(require("./quicknode"), exports);
32
+ __exportStar(require("./bo_withdrawal"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ercworldio/blockchain-shared",
3
- "version": "1.0.2-dev.6",
3
+ "version": "1.0.2-dev.8",
4
4
  "description": "Shared library for blockchain projects",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",