@reyaxyz/common 0.271.0 → 0.272.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/README.md +1 -1
- package/dist/trading-api-types.js.map +1 -1
- package/dist/transactions/executeTransaction.js +14 -52
- package/dist/transactions/executeTransaction.js.map +1 -1
- package/dist/types/trading-api-types.d.ts +0 -9
- package/dist/types/trading-api-types.d.ts.map +1 -1
- package/dist/types/transactions/executeTransaction.d.ts +0 -5
- package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
- package/dist/types/utils/consts.d.ts +0 -1
- package/dist/types/utils/consts.d.ts.map +1 -1
- package/dist/utils/consts.js +1 -6
- package/dist/utils/consts.js.map +1 -1
- package/package.json +2 -2
- package/src/trading-api-types.ts +0 -17
- package/src/transactions/executeTransaction.ts +17 -53
- package/src/utils/consts.ts +0 -5
package/README.md
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
|
|
7
7
|
| Statements | Branches | Functions | Lines |
|
|
8
8
|
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
|
|
9
|
-
|  |  |  |  |
|
|
10
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAmBa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { AssetPair } from './types';\n\nexport type PaginatedQueryParams = {\n before: string;\n after: string;\n limit: string;\n direction: 'asc' | 'desc';\n};\n\nexport type PaginatedQueryMeta = {\n limit: number;\n count: number;\n before: bigint | null | undefined;\n after: bigint | null | undefined;\n};\n\nexport type Decimal = 'fake-decimal';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype CandleResolution = '1' | '5' | '15' | '30' | '60' | '240' | '1D';\n\ntype Candle = {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n assetPairId: AssetPair;\n resolution: CandleResolution;\n};\n\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n order_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n type: string;\n processed: boolean;\n transaction_hash: string;\n r_pnl: Decimal | null;\n price_variation_pnl: Decimal | null;\n funding_pnl: Decimal | null;\n average_entry_price: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n source: string | null;\n unique_id: bigint | null;\n created_at: Date;\n};\n\ntype Position = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n realized_pnl_latest_snapshot: Decimal | null;\n average_entry_price_off_chain_tracker: Decimal | null;\n funding_value_off_chain_tracker: Decimal | null;\n last_price: Decimal | null;\n position_data_last_price_data_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype ConditionalOrder = {\n id: string;\n account_id: Decimal;\n market_id: Decimal;\n order_type: string;\n is_long: boolean;\n trigger_price: number;\n order_base: Decimal;\n exchange_id: bigint;\n inputs: string;\n counterparty_account_id: bigint;\n reya_chain_id: bigint;\n deadline: bigint;\n signer_address: string;\n nonce: Decimal;\n signature: string;\n status: string;\n creation_timestamp_ms: bigint;\n last_update_timestamp_ms: bigint;\n transaction_hash: string | null;\n};\n\ntype Swap = {\n id: string;\n account_id: Decimal;\n token_in: string;\n token_out: string;\n amount_in: Decimal;\n amount_out: Decimal;\n executed_amount_out: Decimal;\n transaction_hash: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype Market = {\n id: Decimal;\n ticker: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n longOI: number;\n shortOI: number;\n availableLong: number;\n availableShort: number;\n marketPriceDeviation: number;\n riskBlockId: number;\n rootCollateralPoolId: number;\n description: string;\n name: string;\n quoteTokenId: string;\n tickSizeDecimals: number;\n underlyingAssetId: string;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n priority: number;\n};\n\ntype Account = {\n account_id: Decimal;\n name: string;\n status: AccountStatus;\n updated_timestamp_ms: Decimal;\n source: string | null;\n};\n\ntype Price = {\n block_number: Decimal;\n unique_id: bigint | null;\n contract_id: string;\n price: Decimal | null;\n round_id: Decimal | null;\n timestamp: Decimal;\n};\n\ntype AccountBalance = {\n account_id: number | null;\n collateral: string | null;\n balance?: Decimal | null;\n delta?: Decimal | null;\n};\n\ntype AutoExchange = {\n id: string;\n liquidated_account_id: Decimal | null;\n liquidator_account_id: Decimal | null;\n requested_quote_amount: Decimal | null;\n collateral_out_address: string | null;\n collateral_in_address: string | null;\n collateral_amount_to_liquidator: Decimal | null;\n quote_amount_to_insurance_fund: Decimal | null;\n quote_amount_to_account: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint | null;\n};\n\ntype Leverage = {\n accountId: Decimal;\n marketId: Decimal;\n leverage: number;\n createdAt: Date;\n updatedAt: Date;\n};\n\ntype WalletStats = {\n volume_14d: Decimal;\n};\n\n// TODO: align types across trading api\nexport type MarketPrices = {\n marketId: string;\n poolPrice: number;\n pegPrice: number;\n timestamp: number;\n};\n\nexport type TradingApiEndpoint<\n Response,\n Params,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response;\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response[];\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiInfiniteListEndpointResponse<Response> = {\n data: Response[];\n meta: PaginatedQueryMeta;\n};\n\nexport type TradingApiInfiniteListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = PaginatedQueryParams,\n> = {\n params: Params;\n query: Query;\n response: TradingApiInfiniteListEndpointResponse<Response>;\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\ntype AddressParam = {\n address: string;\n};\n\nexport type TradingApiSource = {\n 'poolBalance/:poolId': TradingApiEndpoint<\n {\n id: number;\n timestamp: bigint;\n pool_id: number;\n value: Decimal;\n apy: Decimal;\n share_price: Decimal;\n share_price_index: Decimal;\n } | null,\n {\n poolId?: string;\n }\n >;\n 'wallet/:address/leverages': TradingApiListEndpoint<\n Leverage,\n { address: string },\n 'accountLeveragePerMarket'\n >;\n 'markets/configuration': TradingApiListEndpoint<{\n market_id: Decimal;\n risk_matrix_index: Decimal | null;\n max_open_base: Decimal | null;\n velocity_multiplier: Decimal | null;\n minimum_order_base: Decimal | null;\n base_spacing: Decimal | null;\n price_spacing: Decimal | null;\n oracle_node_id: string | null;\n mtm_window: Decimal | null;\n dutch_config_lambda: Decimal | null;\n dutch_config_min_base: Decimal | null;\n slippage_params_phi: Decimal | null;\n slippage_params_beta: Decimal | null;\n depth_factor: Decimal | null;\n max_exposure_factor: Decimal | null;\n max_p_slippage: Decimal | null;\n price_spread: Decimal | null;\n volatility_index_multiplier: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/storage': TradingApiListEndpoint<{\n market_id: Decimal;\n quote_collateral: string | null;\n instrument_address: string | null;\n name: string | null;\n risk_block_id: Decimal | null;\n collateral_pool_id: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/trackers': TradingApiListEndpoint<{\n market_data_id: Decimal;\n passive_pool_id: Decimal | null;\n pool_account_id: Decimal | null;\n quote_token: string | null;\n quote_token_decimals: Decimal | null;\n last_funding_velocity: Decimal | null;\n last_funding_timestamp: Decimal | null;\n last_mtm_price: Decimal | null;\n last_mtm_timestamp: Decimal | null;\n long_trackers_funding_value: Decimal | null;\n last_funding_rate: Decimal | null;\n long_trackers_base_multiplier: Decimal | null;\n long_trackers_adl_unwind_price: Decimal | null;\n short_trackers_funding_value: Decimal | null;\n short_trackers_base_multiplier: Decimal | null;\n short_trackers_adl_unwind_price: Decimal | null;\n open_interest: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'wallet/:address/positions': TradingApiListEndpoint<\n Position,\n AddressParam,\n 'position_raw'\n >;\n 'wallet/:address/conditionalOrders': TradingApiListEndpoint<\n ConditionalOrder,\n AddressParam,\n 'ConditionalOrders'\n >;\n assets: TradingApiListEndpoint<{\n address: string;\n name: string;\n short: string;\n createdAt: Date;\n updatedAt: Date;\n asset_price_contract_id: string | null;\n asset_price_usdc_contract_id: string | null;\n decimals: number;\n }>;\n prices: TradingApiListEndpoint<Price>;\n 'wallet/:address/accounts': TradingApiListEndpoint<\n Account,\n AddressParam,\n 'accountProfile'\n >;\n 'wallet/:address/accounts/tiers': TradingApiListEndpoint<\n {\n market_id: Decimal;\n account_id: Decimal;\n tier_id: Decimal | null;\n },\n AddressParam\n >;\n 'wallet/:address/accounts/balances': TradingApiListEndpoint<\n AccountBalance,\n AddressParam,\n 'account_balances'\n >;\n 'wallet/:address/autoExchange': TradingApiInfiniteListEndpoint<\n AutoExchange,\n AddressParam,\n 'auto_exchange'\n >;\n 'wallet/:address/swaps': TradingApiInfiniteListEndpoint<\n Swap,\n AddressParam,\n 'swaps'\n >;\n 'market/:marketId/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n marketId: string;\n },\n 'order_history'\n >;\n // TODO: also layer in an endpoint for market prices\n 'market/:marketId/prices': TradingApiEndpoint<\n MarketPrices | null,\n {\n marketId: string;\n },\n 'marketPrices',\n MarketPrices\n >;\n 'wallet/:address/balanceHistory/:timestamp': TradingApiListEndpoint<\n {\n timestamp: number;\n balance: number;\n },\n {\n address: string;\n timestamp: string;\n }\n >;\n 'wallet/:address/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n },\n 'order_history'\n >;\n 'wallet/:address/orders/:type': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n type?: string;\n },\n 'order_history'\n >;\n riskMatrices: TradingApiListEndpoint<\n {\n blockId: Decimal;\n matrix: string[][];\n },\n {\n poolId: string;\n }\n >;\n markets: TradingApiListEndpoint<Market>;\n tierFees: TradingApiListEndpoint<{\n market_id: Decimal;\n tier_id: Decimal;\n fee_parameter: Decimal | null;\n }>;\n collateralConfiguration: TradingApiListEndpoint<{\n collateral_pool_id: Decimal;\n collateral_address: string;\n price_haircut: Decimal | null;\n auto_exchange_discount: Decimal | null;\n oracle_node_id: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'candle/:assetPairId/:resolution': TradingApiEndpoint<\n Candle | null,\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n 'storkPriceCandle',\n Candle\n >;\n 'candles/:assetPairId/:resolution': TradingApiEndpoint<\n {\n t: number[];\n o: number[];\n h: number[];\n l: number[];\n c: number[];\n },\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n never,\n never,\n {\n to: string;\n from: string;\n countBack?: string;\n }\n >;\n feeTierParameters: TradingApiListEndpoint<{\n tier_id: Decimal;\n taker_fee: Decimal;\n maker_fee: Decimal;\n volume: Decimal;\n }>;\n globalFeeParameters: TradingApiEndpoint<\n {\n og_discount: Decimal;\n referee_discount: Decimal;\n referrer_rebate: Decimal;\n affiliate_referrer_rebate: Decimal;\n },\n never\n >;\n 'wallet/:address/configuration': TradingApiEndpoint<\n {\n tier_id: Decimal;\n og_status: boolean;\n affiliate_status: boolean;\n referee_status: boolean;\n main_account_id: Decimal;\n },\n {\n address: string;\n }\n >;\n 'wallet/:address/stats': TradingApiEndpoint<\n WalletStats,\n {\n address: string;\n }\n >;\n};\n\nexport type Stringified<T, D = Decimal> = T extends D | bigint | Date\n ? string\n : T extends (infer U)[]\n ? Stringified<U, D>[]\n : { [K in keyof T]: Stringified<T[K], D> };\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\n};\n\nexport type TradingApi = {\n [K in keyof TradingApiSource as K]: {\n params: TradingApiSource[K]['params'];\n query: TradingApiSource[K]['query'];\n response: Stringified<TradingApiSource[K]['response']>;\n replication: Stringified<TradingApiSource[K]['replication']>;\n };\n};\n\ntype ReplicationModel = string | never;\n\nexport type GenericReplicationMessage<T, model extends ReplicationModel> =\n | {\n model: model;\n result: T;\n operation: 'create' | 'update' | 'upsert' | 'delete';\n }\n | {\n model: model;\n result: T[];\n operation: 'updateMany';\n };\n\ntype account_collateral_balance_entries = {\n id: string;\n account_id: Decimal | null;\n collateral: string | null;\n amount: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype account_owner_updated_snapshot = {\n account_id: Decimal;\n transaction_hash: string;\n new_owner: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype ReplicationMessage =\n // Extract the union of all `replication` values from TradingApiSource\n | Exclude<TradingApiSource[keyof TradingApiSource]['replication'], never>\n // add messages that do not exists in TradingApiSource\n | GenericReplicationMessage<\n account_owner_updated_snapshot,\n 'account_owner_updated_snapshot'\n >\n | GenericReplicationMessage<\n account_collateral_balance_entries,\n 'account_collateral_balance_entries'\n >;\n\nexport type Replication = {\n [K in ReplicationMessage as `replication:${K['model']}`]: Extract<\n ReplicationMessage,\n { model: K['model'] }\n >;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"trading-api-types.js","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":";;;AAmBa,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;CACjB,CAAC","sourcesContent":["import { ParamsDictionary, Query } from 'express-serve-static-core';\nimport { AssetPair } from './types';\n\nexport type PaginatedQueryParams = {\n before: string;\n after: string;\n limit: string;\n direction: 'asc' | 'desc';\n};\n\nexport type PaginatedQueryMeta = {\n limit: number;\n count: number;\n before: bigint | null | undefined;\n after: bigint | null | undefined;\n};\n\nexport type Decimal = 'fake-decimal';\n\nexport const AccountStatusValues = {\n OPEN: 'OPEN',\n CLOSED: 'CLOSED',\n};\n\nexport type AccountStatus =\n (typeof AccountStatusValues)[keyof typeof AccountStatusValues];\n\ntype CandleResolution = '1' | '5' | '15' | '30' | '60' | '240' | '1D';\n\ntype Candle = {\n time: number;\n open: number;\n high: number;\n low: number;\n close: number;\n assetPairId: AssetPair;\n resolution: CandleResolution;\n};\n\ntype Order = {\n id: string;\n market_id: Decimal | null;\n account_id: Decimal | null;\n order_base: Decimal | null;\n fee: Decimal | null;\n price: Decimal | null;\n type: string;\n processed: boolean;\n transaction_hash: string;\n r_pnl: Decimal | null;\n price_variation_pnl: Decimal | null;\n funding_pnl: Decimal | null;\n average_entry_price: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n source: string | null;\n unique_id: bigint | null;\n created_at: Date;\n};\n\ntype Position = {\n market_id: Decimal;\n account_id: Decimal;\n base: Decimal | null;\n realized_pnl: Decimal | null;\n realized_pnl_latest_snapshot: Decimal | null;\n average_entry_price_off_chain_tracker: Decimal | null;\n funding_value_off_chain_tracker: Decimal | null;\n last_price: Decimal | null;\n position_data_last_price_data_timestamp: Decimal | null;\n funding_value: Decimal | null;\n base_multiplier: Decimal | null;\n adl_unwind_price: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype ConditionalOrder = {\n id: string;\n account_id: Decimal;\n market_id: Decimal;\n order_type: string;\n is_long: boolean;\n trigger_price: number;\n order_base: Decimal;\n exchange_id: bigint;\n inputs: string;\n counterparty_account_id: bigint;\n reya_chain_id: bigint;\n deadline: bigint;\n signer_address: string;\n nonce: Decimal;\n signature: string;\n status: string;\n creation_timestamp_ms: bigint;\n last_update_timestamp_ms: bigint;\n transaction_hash: string | null;\n};\n\ntype Swap = {\n id: string;\n account_id: Decimal;\n token_in: string;\n token_out: string;\n amount_in: Decimal;\n amount_out: Decimal;\n executed_amount_out: Decimal;\n transaction_hash: string;\n block_timestamp: Decimal;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype Market = {\n id: Decimal;\n ticker: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n longOI: number;\n shortOI: number;\n availableLong: number;\n availableShort: number;\n marketPriceDeviation: number;\n riskBlockId: number;\n rootCollateralPoolId: number;\n description: string;\n name: string;\n quoteTokenId: string;\n tickSizeDecimals: number;\n underlyingAssetId: string;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n priority: number;\n};\n\ntype Account = {\n account_id: Decimal;\n name: string;\n status: AccountStatus;\n updated_timestamp_ms: Decimal;\n source: string | null;\n};\n\ntype Price = {\n block_number: Decimal;\n unique_id: bigint | null;\n contract_id: string;\n price: Decimal | null;\n round_id: Decimal | null;\n timestamp: Decimal;\n};\n\ntype AccountBalance = {\n account_id: number | null;\n collateral: string | null;\n balance?: Decimal | null;\n delta?: Decimal | null;\n};\n\ntype AutoExchange = {\n id: string;\n liquidated_account_id: Decimal | null;\n liquidator_account_id: Decimal | null;\n requested_quote_amount: Decimal | null;\n collateral_out_address: string | null;\n collateral_in_address: string | null;\n collateral_amount_to_liquidator: Decimal | null;\n quote_amount_to_insurance_fund: Decimal | null;\n quote_amount_to_account: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n transaction_hash: string;\n unique_id: bigint | null;\n};\n\ntype Leverage = {\n accountId: Decimal;\n marketId: Decimal;\n leverage: number;\n createdAt: Date;\n updatedAt: Date;\n};\n\ntype WalletStats = {\n volume_14d: Decimal;\n};\n\nexport type TradingApiEndpoint<\n Response,\n Params,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response;\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = never,\n> = {\n params: Params;\n query: Query;\n response: Response[];\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\nexport type TradingApiInfiniteListEndpointResponse<Response> = {\n data: Response[];\n meta: PaginatedQueryMeta;\n};\n\nexport type TradingApiInfiniteListEndpoint<\n Response,\n Params = never,\n ReplicationTable extends ReplicationModel = never,\n Replication = Response,\n Query = PaginatedQueryParams,\n> = {\n params: Params;\n query: Query;\n response: TradingApiInfiniteListEndpointResponse<Response>;\n replication: ReplicationTable extends never\n ? never\n : GenericReplicationMessage<Replication, ReplicationTable>;\n};\n\ntype AddressParam = {\n address: string;\n};\n\nexport type TradingApiSource = {\n 'poolBalance/:poolId': TradingApiEndpoint<\n {\n id: number;\n timestamp: bigint;\n pool_id: number;\n value: Decimal;\n apy: Decimal;\n share_price: Decimal;\n share_price_index: Decimal;\n } | null,\n {\n poolId?: string;\n }\n >;\n 'wallet/:address/leverages': TradingApiListEndpoint<\n Leverage,\n { address: string },\n 'accountLeveragePerMarket'\n >;\n 'markets/configuration': TradingApiListEndpoint<{\n market_id: Decimal;\n risk_matrix_index: Decimal | null;\n max_open_base: Decimal | null;\n velocity_multiplier: Decimal | null;\n minimum_order_base: Decimal | null;\n base_spacing: Decimal | null;\n price_spacing: Decimal | null;\n oracle_node_id: string | null;\n mtm_window: Decimal | null;\n dutch_config_lambda: Decimal | null;\n dutch_config_min_base: Decimal | null;\n slippage_params_phi: Decimal | null;\n slippage_params_beta: Decimal | null;\n depth_factor: Decimal | null;\n max_exposure_factor: Decimal | null;\n max_p_slippage: Decimal | null;\n price_spread: Decimal | null;\n volatility_index_multiplier: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/storage': TradingApiListEndpoint<{\n market_id: Decimal;\n quote_collateral: string | null;\n instrument_address: string | null;\n name: string | null;\n risk_block_id: Decimal | null;\n collateral_pool_id: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'markets/trackers': TradingApiListEndpoint<{\n market_data_id: Decimal;\n passive_pool_id: Decimal | null;\n pool_account_id: Decimal | null;\n quote_token: string | null;\n quote_token_decimals: Decimal | null;\n last_funding_velocity: Decimal | null;\n last_funding_timestamp: Decimal | null;\n last_mtm_price: Decimal | null;\n last_mtm_timestamp: Decimal | null;\n long_trackers_funding_value: Decimal | null;\n last_funding_rate: Decimal | null;\n long_trackers_base_multiplier: Decimal | null;\n long_trackers_adl_unwind_price: Decimal | null;\n short_trackers_funding_value: Decimal | null;\n short_trackers_base_multiplier: Decimal | null;\n short_trackers_adl_unwind_price: Decimal | null;\n open_interest: Decimal | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'wallet/:address/positions': TradingApiListEndpoint<\n Position,\n AddressParam,\n 'position_raw'\n >;\n 'wallet/:address/conditionalOrders': TradingApiListEndpoint<\n ConditionalOrder,\n AddressParam,\n 'ConditionalOrders'\n >;\n assets: TradingApiListEndpoint<{\n address: string;\n name: string;\n short: string;\n createdAt: Date;\n updatedAt: Date;\n asset_price_contract_id: string | null;\n asset_price_usdc_contract_id: string | null;\n decimals: number;\n }>;\n prices: TradingApiListEndpoint<Price>;\n 'wallet/:address/accounts': TradingApiListEndpoint<\n Account,\n AddressParam,\n 'accountProfile'\n >;\n 'wallet/:address/accounts/tiers': TradingApiListEndpoint<\n {\n market_id: Decimal;\n account_id: Decimal;\n tier_id: Decimal | null;\n },\n AddressParam\n >;\n 'wallet/:address/accounts/balances': TradingApiListEndpoint<\n AccountBalance,\n AddressParam,\n 'account_balances'\n >;\n 'wallet/:address/autoExchange': TradingApiInfiniteListEndpoint<\n AutoExchange,\n AddressParam,\n 'auto_exchange'\n >;\n 'wallet/:address/swaps': TradingApiInfiniteListEndpoint<\n Swap,\n AddressParam,\n 'swaps'\n >;\n 'market/:marketId/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n marketId: string;\n },\n 'order_history'\n >;\n 'wallet/:address/balanceHistory/:timestamp': TradingApiListEndpoint<\n {\n timestamp: number;\n balance: number;\n },\n {\n address: string;\n timestamp: string;\n }\n >;\n 'wallet/:address/orders': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n },\n 'order_history'\n >;\n 'wallet/:address/orders/:type': TradingApiInfiniteListEndpoint<\n Order,\n {\n address: string;\n type?: string;\n },\n 'order_history'\n >;\n riskMatrices: TradingApiListEndpoint<\n {\n blockId: Decimal;\n matrix: string[][];\n },\n {\n poolId: string;\n }\n >;\n markets: TradingApiListEndpoint<Market>;\n tierFees: TradingApiListEndpoint<{\n market_id: Decimal;\n tier_id: Decimal;\n fee_parameter: Decimal | null;\n }>;\n collateralConfiguration: TradingApiListEndpoint<{\n collateral_pool_id: Decimal;\n collateral_address: string;\n price_haircut: Decimal | null;\n auto_exchange_discount: Decimal | null;\n oracle_node_id: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n }>;\n 'candle/:assetPairId/:resolution': TradingApiEndpoint<\n Candle | null,\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n 'storkPriceCandle',\n Candle\n >;\n 'candles/:assetPairId/:resolution': TradingApiEndpoint<\n {\n t: number[];\n o: number[];\n h: number[];\n l: number[];\n c: number[];\n },\n {\n resolution: CandleResolution;\n assetPairId: AssetPair;\n },\n never,\n never,\n {\n to: string;\n from: string;\n countBack?: string;\n }\n >;\n feeTierParameters: TradingApiListEndpoint<{\n tier_id: Decimal;\n taker_fee: Decimal;\n maker_fee: Decimal;\n volume: Decimal;\n }>;\n globalFeeParameters: TradingApiEndpoint<\n {\n og_discount: Decimal;\n referee_discount: Decimal;\n referrer_rebate: Decimal;\n affiliate_referrer_rebate: Decimal;\n },\n never\n >;\n 'wallet/:address/configuration': TradingApiEndpoint<\n {\n tier_id: Decimal;\n og_status: boolean;\n affiliate_status: boolean;\n referee_status: boolean;\n main_account_id: Decimal;\n },\n {\n address: string;\n }\n >;\n 'wallet/:address/stats': TradingApiEndpoint<\n WalletStats,\n {\n address: string;\n }\n >;\n};\n\nexport type Stringified<T, D = Decimal> = T extends D | bigint | Date\n ? string\n : T extends (infer U)[]\n ? Stringified<U, D>[]\n : { [K in keyof T]: Stringified<T[K], D> };\n\nexport type Req<P = ParamsDictionary, ReqQuery = Query> = {\n params: P;\n query: ReqQuery;\n};\n\nexport type TradingApi = {\n [K in keyof TradingApiSource as K]: {\n params: TradingApiSource[K]['params'];\n query: TradingApiSource[K]['query'];\n response: Stringified<TradingApiSource[K]['response']>;\n replication: Stringified<TradingApiSource[K]['replication']>;\n };\n};\n\ntype ReplicationModel = string | never;\n\nexport type GenericReplicationMessage<T, model extends ReplicationModel> =\n | {\n model: model;\n result: T;\n operation: 'create' | 'update' | 'upsert' | 'delete';\n }\n | {\n model: model;\n result: T[];\n operation: 'updateMany';\n };\n\ntype account_collateral_balance_entries = {\n id: string;\n account_id: Decimal | null;\n collateral: string | null;\n amount: Decimal | null;\n transaction_hash: string;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype account_owner_updated_snapshot = {\n account_id: Decimal;\n transaction_hash: string;\n new_owner: string | null;\n block_timestamp: Decimal | null;\n block_number: Decimal;\n unique_id: bigint | null;\n};\n\ntype ReplicationMessage =\n // Extract the union of all `replication` values from TradingApiSource\n | Exclude<TradingApiSource[keyof TradingApiSource]['replication'], never>\n // add messages that do not exists in TradingApiSource\n | GenericReplicationMessage<\n account_owner_updated_snapshot,\n 'account_owner_updated_snapshot'\n >\n | GenericReplicationMessage<\n account_collateral_balance_entries,\n 'account_collateral_balance_entries'\n >;\n\nexport type Replication = {\n [K in ReplicationMessage as `replication:${K['model']}`]: Extract<\n ReplicationMessage,\n { model: K['model'] }\n >;\n};\n"]}
|
|
@@ -48,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
};
|
|
49
49
|
var _a;
|
|
50
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.decodeErrorBytes = exports.executeTransaction = exports.
|
|
51
|
+
exports.decodeErrorBytes = exports.executeTransaction = exports.estimateGasFromTxAndChainId = exports.estimateGasGivenAddress = exports.estimateGas = exports.reyaChainIdRPCMapper = void 0;
|
|
52
52
|
var ethers_1 = require("ethers");
|
|
53
53
|
var types_1 = require("../types");
|
|
54
54
|
var contractAddresses_1 = require("./contractAddresses");
|
|
@@ -78,7 +78,7 @@ function estimateGas(signer, data, value, chainId, targetContract) {
|
|
|
78
78
|
exports.estimateGas = estimateGas;
|
|
79
79
|
function estimateGasGivenAddress(accountAddress, data, value, chainId, targetContract) {
|
|
80
80
|
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
-
var contractAddress, tx, gasLimit, provider, error_1, decodedError, reason, maxPriorityFeePerGas, maxFeePerGas;
|
|
81
|
+
var contractAddress, tx, gasLimit, network, provider, error_1, decodedError, reason, maxPriorityFeePerGas, maxFeePerGas;
|
|
82
82
|
return __generator(this, function (_a) {
|
|
83
83
|
switch (_a.label) {
|
|
84
84
|
case 0:
|
|
@@ -90,7 +90,11 @@ function estimateGasGivenAddress(accountAddress, data, value, chainId, targetCon
|
|
|
90
90
|
_a.label = 1;
|
|
91
91
|
case 1:
|
|
92
92
|
_a.trys.push([1, 3, , 5]);
|
|
93
|
-
|
|
93
|
+
network = new ethers_1.Network('Reya', chainId);
|
|
94
|
+
provider = new ethers_1.JsonRpcProvider(exports.reyaChainIdRPCMapper[chainId], network, {
|
|
95
|
+
staticNetwork: network,
|
|
96
|
+
pollingInterval: 50,
|
|
97
|
+
});
|
|
94
98
|
return [4 /*yield*/, provider.call(tx)];
|
|
95
99
|
case 2:
|
|
96
100
|
_a.sent();
|
|
@@ -149,51 +153,9 @@ function estimateGasFromTxAndChainId(chainId, tx) {
|
|
|
149
153
|
});
|
|
150
154
|
}
|
|
151
155
|
exports.estimateGasFromTxAndChainId = estimateGasFromTxAndChainId;
|
|
152
|
-
function estimateGasWithoutHardcoding(signer, data, value, chainId, targetContract) {
|
|
153
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
154
|
-
var accountAddress, contractAddress, tx, gasLimit, provider, estimation, error_3, decodedError, reason, maxPriorityFeePerGas, maxFeePerGas;
|
|
155
|
-
return __generator(this, function (_a) {
|
|
156
|
-
switch (_a.label) {
|
|
157
|
-
case 0: return [4 /*yield*/, signer.getAddress()];
|
|
158
|
-
case 1:
|
|
159
|
-
accountAddress = _a.sent();
|
|
160
|
-
contractAddress = Object.values(contractAddresses_1.ContractType).includes(targetContract)
|
|
161
|
-
? (0, contractAddresses_1.getAddress)(chainId, targetContract)
|
|
162
|
-
: targetContract;
|
|
163
|
-
tx = __assign({ from: accountAddress, to: contractAddress, data: data }, (value && value !== '0' ? { value: value } : {}));
|
|
164
|
-
gasLimit = BigInt('5000000');
|
|
165
|
-
_a.label = 2;
|
|
166
|
-
case 2:
|
|
167
|
-
_a.trys.push([2, 4, , 6]);
|
|
168
|
-
provider = ethers_1.ethers.getDefaultProvider(exports.reyaChainIdRPCMapper[chainId]);
|
|
169
|
-
return [4 /*yield*/, provider.estimateGas(tx)];
|
|
170
|
-
case 3:
|
|
171
|
-
estimation = _a.sent();
|
|
172
|
-
gasLimit = addGasBuffer(estimation);
|
|
173
|
-
return [3 /*break*/, 6];
|
|
174
|
-
case 4:
|
|
175
|
-
error_3 = _a.sent();
|
|
176
|
-
return [4 /*yield*/, errorDecoder.decode(error_3)];
|
|
177
|
-
case 5:
|
|
178
|
-
decodedError = _a.sent();
|
|
179
|
-
reason = customReasonMapper(decodedError);
|
|
180
|
-
console.error("Error simulating transaction account address ".concat(accountAddress, " reason ").concat(decodedError === null || decodedError === void 0 ? void 0 : decodedError.name, " ").concat(decodedError, " ").concat(error_3));
|
|
181
|
-
throw new Error(reason);
|
|
182
|
-
case 6:
|
|
183
|
-
if (Object.values(types_1.ReyaChainId).includes(chainId)) {
|
|
184
|
-
maxPriorityFeePerGas = BigInt('0');
|
|
185
|
-
maxFeePerGas = BigInt('100000000');
|
|
186
|
-
return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit, maxPriorityFeePerGas: maxPriorityFeePerGas, maxFeePerGas: maxFeePerGas })];
|
|
187
|
-
}
|
|
188
|
-
return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit })];
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
exports.estimateGasWithoutHardcoding = estimateGasWithoutHardcoding;
|
|
194
156
|
function estimateGasExternalChains(signer, data, value, chainId, targetContract) {
|
|
195
157
|
return __awaiter(this, void 0, void 0, function () {
|
|
196
|
-
var accountAddress, contractAddress, tx, gasLimit, gasEstimate,
|
|
158
|
+
var accountAddress, contractAddress, tx, gasLimit, gasEstimate, error_3, decodedError, reason, maxPriorityFeePerGas, maxFeePerGas;
|
|
197
159
|
return __generator(this, function (_a) {
|
|
198
160
|
switch (_a.label) {
|
|
199
161
|
case 0: return [4 /*yield*/, signer.getAddress()];
|
|
@@ -213,12 +175,12 @@ function estimateGasExternalChains(signer, data, value, chainId, targetContract)
|
|
|
213
175
|
gasLimit = (0, txHelpers_1.getGasBuffer)(gasEstimate);
|
|
214
176
|
return [3 /*break*/, 6];
|
|
215
177
|
case 4:
|
|
216
|
-
|
|
217
|
-
return [4 /*yield*/, errorDecoder.decode(
|
|
178
|
+
error_3 = _a.sent();
|
|
179
|
+
return [4 /*yield*/, errorDecoder.decode(error_3)];
|
|
218
180
|
case 5:
|
|
219
181
|
decodedError = _a.sent();
|
|
220
182
|
reason = customReasonMapper(decodedError);
|
|
221
|
-
console.error("Error simulating external transaction account address ".concat(accountAddress, " reason ").concat(decodedError === null || decodedError === void 0 ? void 0 : decodedError.name, " ").concat(decodedError, " ").concat(
|
|
183
|
+
console.error("Error simulating external transaction account address ".concat(accountAddress, " reason ").concat(decodedError === null || decodedError === void 0 ? void 0 : decodedError.name, " ").concat(decodedError, " ").concat(error_3));
|
|
222
184
|
throw new Error(reason);
|
|
223
185
|
case 6:
|
|
224
186
|
if (Object.values(types_1.ReyaChainId).includes(chainId)) {
|
|
@@ -233,7 +195,7 @@ function estimateGasExternalChains(signer, data, value, chainId, targetContract)
|
|
|
233
195
|
}
|
|
234
196
|
function executeTransaction(signer, data, value, chainId, targetContract) {
|
|
235
197
|
return __awaiter(this, void 0, void 0, function () {
|
|
236
|
-
var txData, txResponse, txReceipt,
|
|
198
|
+
var txData, txResponse, txReceipt, error_4;
|
|
237
199
|
return __generator(this, function (_a) {
|
|
238
200
|
switch (_a.label) {
|
|
239
201
|
case 0: return [4 /*yield*/, estimateGasExternalChains(signer, data, value, chainId, targetContract)];
|
|
@@ -250,8 +212,8 @@ function executeTransaction(signer, data, value, chainId, targetContract) {
|
|
|
250
212
|
txReceipt = _a.sent();
|
|
251
213
|
return [2 /*return*/, txReceipt];
|
|
252
214
|
case 5:
|
|
253
|
-
|
|
254
|
-
console.warn(
|
|
215
|
+
error_4 = _a.sent();
|
|
216
|
+
console.warn(error_4);
|
|
255
217
|
throw new Error('Transaction Execution Error');
|
|
256
218
|
case 6: return [2 /*return*/];
|
|
257
219
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;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,IAAI,UAAA,EAAE,MAAM,YAAA;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,kBAAkB;YACrB,OAAO,sDAAsD,CAAC;QAChE,KAAK,oBAAoB;YACvB,OAAO,iDAAiD,CAAC;QAC3D,KAAK,gBAAgB;YACnB,OAAO,0BAA0B,CAAC;QACpC,KAAK,gBAAgB;YACnB,OAAO,qDAAqD,CAAC;QAC/D,KAAK,gBAAgB;YACnB,OAAO,+BAA+B,CAAC;QACzC;YACE,qCAAqC;YACrC,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,6BAA6B,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAEF,SAAS,YAAY,CAAC,UAAkB;IACtC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,SAAsB,gBAAgB,CAAC,UAAkB;;;;YACjD,SAAS,GAAG,IAAI,kBAAS,CAAC,iBAAG,CAAC,CAAC;YAC/B,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC1B,sBAAO,UAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,eAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAE,IAAI,iBAAiB,EAAC;;;CAC5E;AALD,4CAKC","sourcesContent":["import { ethers, JsonRpcSigner, Signer } from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../types';\nimport { ContractType, getAddress } from './contractAddresses';\nimport { abi } from './abis/Errors.json';\nimport { ErrorDecoder } from 'ethers-decode-error';\nimport type { DecodedError } from 'ethers-decode-error';\nimport { getGasBuffer } from './txHelpers';\nimport { getPublicRpcUrlsOrThrow } from '../utils';\nimport { Interface } from 'ethers';\n\nexport const reyaChainIdRPCMapper: { [key: number]: string } = {\n [ReyaChainId.reyaNetwork]:\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n [ReyaChainId.reyaCronos]:\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n};\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\nconst errorDecoder = ErrorDecoder.create([abi]);\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n return estimateGasGivenAddress(\n accountAddress,\n data,\n value,\n chainId,\n targetContract,\n );\n}\n\nexport async function estimateGasGivenAddress(\n accountAddress: string,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const provider = ethers.getDefaultProvider(reyaChainIdRPCMapper[chainId]);\n await provider.call(tx);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function estimateGasFromTxAndChainId(\n chainId: ReyaChainId | MoneyInOutChainId,\n tx: ethers.TransactionRequest,\n): Promise<bigint> {\n const rpcUrls = getPublicRpcUrlsOrThrow(chainId);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const estimation = await provider.estimateGas(tx);\n return addGasBuffer(estimation);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n}\n\nexport async function estimateGasWithoutHardcoding(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const provider = ethers.getDefaultProvider(reyaChainIdRPCMapper[chainId]);\n const estimation = await provider.estimateGas(tx);\n gasLimit = addGasBuffer(estimation);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nasync function estimateGasExternalChains(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating external transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGasExternalChains(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\nconst customReasonMapper = ({ name, reason }: DecodedError): string => {\n switch (name) {\n case 'SignatureInvalid':\n return `Invalid signature. Please refresh page and try again`;\n case 'StalePriceDetected':\n return `Price not updated, please try again a bit later`;\n case 'SmallOrderSize':\n return `Order size below minimum`;\n case 'DustyOrderSize':\n return `Order amount is not divisible by trade size spacing`;\n case 'AccountBelowIM':\n return `Account below required margin`;\n default:\n // This handles the non-custom errors\n return reason ?? 'Error executing transaction';\n }\n};\n\nfunction addGasBuffer(estimation: bigint): bigint {\n return (estimation * BigInt(120)) / BigInt(100);\n}\n\nexport async function decodeErrorBytes(returnData: string): Promise<string> {\n const INTERFACE = new Interface(abi);\n const decodedError = INTERFACE.parseError(returnData);\n console.log(decodedError);\n return `${decodedError?.name}: ${decodedError?.args}` || 'Error not found';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAMgB;AAChB,kCAA0D;AAC1D,yDAA+D;AAC/D,kDAAyC;AACzC,2DAAmD;AAEnD,yCAA2C;AAC3C,kCAAmD;AACnD,iCAAmC;AAEtB,QAAA,oBAAoB;IAC/B,GAAC,mBAAW,CAAC,WAAW,IACtB,2DAA2D;IAC7D,GAAC,mBAAW,CAAC,UAAU,IACrB,yEAAyE;QAC3E;AAQF,IAAM,YAAY,GAAG,kCAAY,CAAC,MAAM,CAAC,CAAC,iBAAG,CAAC,CAAC,CAAC;AAEhD,SAAsB,WAAW,CAC/B,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;wBAQd,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAEhD,sBAAO,uBAAuB,CAC5B,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,cAAc,CACf,EAAC;;;;CACH;AAtBD,kCAsBC;AAED,SAAsB,uBAAuB,CAC3C,cAAsB,EACtB,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;;oBAQ/B,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAY,CAAC,CAAC,QAAQ,CAC1D,cAA8B,CAC/B;wBACC,CAAC,CAAC,IAAA,8BAAU,EAAC,OAAO,EAAE,cAA8B,CAAC;wBACrD,C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O,CAAC,IAAI,CAAC,OAAK,CAAC,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;;CAElD;AAvBD,gDAuBC;AACD,IAAM,kBAAkB,GAAG,UAAC,EAA8B;QAA5B,IAAI,UAAA,EAAE,MAAM,YAAA;IACxC,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,kBAAkB;YACrB,OAAO,sDAAsD,CAAC;QAChE,KAAK,oBAAoB;YACvB,OAAO,iDAAiD,CAAC;QAC3D,KAAK,gBAAgB;YACnB,OAAO,0BAA0B,CAAC;QACpC,KAAK,gBAAgB;YACnB,OAAO,qDAAqD,CAAC;QAC/D,KAAK,gBAAgB;YACnB,OAAO,+BAA+B,CAAC;QACzC;YACE,qCAAqC;YACrC,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,6BAA6B,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAEF,SAAS,YAAY,CAAC,UAAkB;IACtC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,SAAsB,gBAAgB,CAAC,UAAkB;;;;YACjD,SAAS,GAAG,IAAI,kBAAS,CAAC,iBAAG,CAAC,CAAC;YAC/B,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC1B,sBAAO,UAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,eAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAE,IAAI,iBAAiB,EAAC;;;CAC5E;AALD,4CAKC","sourcesContent":["import {\n ethers,\n JsonRpcProvider,\n JsonRpcSigner,\n Network,\n Signer,\n} from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../types';\nimport { ContractType, getAddress } from './contractAddresses';\nimport { abi } from './abis/Errors.json';\nimport { ErrorDecoder } from 'ethers-decode-error';\nimport type { DecodedError } from 'ethers-decode-error';\nimport { getGasBuffer } from './txHelpers';\nimport { getPublicRpcUrlsOrThrow } from '../utils';\nimport { Interface } from 'ethers';\n\nexport const reyaChainIdRPCMapper: { [key: number]: string } = {\n [ReyaChainId.reyaNetwork]:\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n [ReyaChainId.reyaCronos]:\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n};\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\nconst errorDecoder = ErrorDecoder.create([abi]);\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n return estimateGasGivenAddress(\n accountAddress,\n data,\n value,\n chainId,\n targetContract,\n );\n}\n\nexport async function estimateGasGivenAddress(\n accountAddress: string,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const network = new Network('Reya', chainId);\n const provider = new JsonRpcProvider(\n reyaChainIdRPCMapper[chainId],\n network,\n {\n staticNetwork: network,\n pollingInterval: 50,\n },\n );\n await provider.call(tx);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function estimateGasFromTxAndChainId(\n chainId: ReyaChainId | MoneyInOutChainId,\n tx: ethers.TransactionRequest,\n): Promise<bigint> {\n const rpcUrls = getPublicRpcUrlsOrThrow(chainId);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const estimation = await provider.estimateGas(tx);\n return addGasBuffer(estimation);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n}\n\nasync function estimateGasExternalChains(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating external transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGasExternalChains(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\nconst customReasonMapper = ({ name, reason }: DecodedError): string => {\n switch (name) {\n case 'SignatureInvalid':\n return `Invalid signature. Please refresh page and try again`;\n case 'StalePriceDetected':\n return `Price not updated, please try again a bit later`;\n case 'SmallOrderSize':\n return `Order size below minimum`;\n case 'DustyOrderSize':\n return `Order amount is not divisible by trade size spacing`;\n case 'AccountBelowIM':\n return `Account below required margin`;\n default:\n // This handles the non-custom errors\n return reason ?? 'Error executing transaction';\n }\n};\n\nfunction addGasBuffer(estimation: bigint): bigint {\n return (estimation * BigInt(120)) / BigInt(100);\n}\n\nexport async function decodeErrorBytes(returnData: string): Promise<string> {\n const INTERFACE = new Interface(abi);\n const decodedError = INTERFACE.parseError(returnData);\n console.log(decodedError);\n return `${decodedError?.name}: ${decodedError?.args}` || 'Error not found';\n}\n"]}
|
|
@@ -171,12 +171,6 @@ type Leverage = {
|
|
|
171
171
|
type WalletStats = {
|
|
172
172
|
volume_14d: Decimal;
|
|
173
173
|
};
|
|
174
|
-
export type MarketPrices = {
|
|
175
|
-
marketId: string;
|
|
176
|
-
poolPrice: number;
|
|
177
|
-
pegPrice: number;
|
|
178
|
-
timestamp: number;
|
|
179
|
-
};
|
|
180
174
|
export type TradingApiEndpoint<Response, Params, ReplicationTable extends ReplicationModel = never, Replication = Response, Query = never> = {
|
|
181
175
|
params: Params;
|
|
182
176
|
query: Query;
|
|
@@ -298,9 +292,6 @@ export type TradingApiSource = {
|
|
|
298
292
|
'market/:marketId/orders': TradingApiInfiniteListEndpoint<Order, {
|
|
299
293
|
marketId: string;
|
|
300
294
|
}, 'order_history'>;
|
|
301
|
-
'market/:marketId/prices': TradingApiEndpoint<MarketPrices | null, {
|
|
302
|
-
marketId: string;
|
|
303
|
-
}, 'marketPrices', MarketPrices>;
|
|
304
295
|
'wallet/:address/balanceHistory/:timestamp': TradingApiListEndpoint<{
|
|
305
296
|
timestamp: number;
|
|
306
297
|
balance: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trading-api-types.d.ts","sourceRoot":"/","sources":["trading-api-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,cAAc,CAAC;AAErC,eAAO,MAAM,mBAAmB;;;CAG/B,CAAC;AAEF,MAAM,MAAM,aAAa,GACvB,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,KAAK,gBAAgB,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;AAE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|
}>;
|
|
23
23
|
export declare function estimateGasFromTxAndChainId(chainId: ReyaChainId | MoneyInOutChainId, tx: ethers.TransactionRequest): Promise<bigint>;
|
|
24
|
-
export declare function estimateGasWithoutHardcoding(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
|
|
25
|
-
gasLimit: bigint;
|
|
26
|
-
maxPriorityFeePerGas?: bigint;
|
|
27
|
-
maxFeePerGas?: bigint;
|
|
28
|
-
}>;
|
|
29
24
|
export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<ethers.TransactionReceipt | null>;
|
|
30
25
|
export declare function decodeErrorBytes(returnData: string): Promise<string>;
|
|
31
26
|
//# sourceMappingURL=executeTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EAEN,aAAa,EAEb,MAAM,EACP,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAc,MAAM,qBAAqB,CAAC;AAQ/D,eAAO,MAAM,oBAAoB,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAKzD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,CACR,WAAW,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CAUA;AAED,wBAAsB,uBAAuB,CAC3C,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,CACR,WAAW,GAAG;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CACF,CA2CA;AAED,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,WAAW,GAAG,iBAAiB,EACxC,EAAE,EAAE,MAAM,CAAC,kBAAkB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAejB;AAoDD,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,6CAkBtC;AAuBD,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1E"}
|
|
@@ -2,7 +2,6 @@ import { ConditionalOrderType, ConditionalOrderTypeName, Rank, RankTrading, Asse
|
|
|
2
2
|
export declare const MAX_UINT128: number;
|
|
3
3
|
export declare const API_TIMEOUT: number;
|
|
4
4
|
export declare const ONE_DAY_IN_SECONDS: number;
|
|
5
|
-
export declare const getMarketPricesRedisKey: (marketId: string) => string;
|
|
6
5
|
export declare const getCurrentCandleRedisKey: (assetPairId: AssetPair) => string;
|
|
7
6
|
export declare const CHANNEL_NAME: "redis-pub-sub";
|
|
8
7
|
export declare const WHITELISTED_WALLETS: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,IAAI,EACJ,WAAW,EACX,SAAS,EACV,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,WAAW,EAAE,MAAa,CAAC;AAExC,eAAO,MAAM,kBAAkB,EAAE,MAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,IAAI,EACJ,WAAW,EACX,SAAS,EACV,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,WAAW,QAAe,CAAC;AACxC,eAAO,MAAM,WAAW,EAAE,MAAa,CAAC;AAExC,eAAO,MAAM,kBAAkB,EAAE,MAAqB,CAAC;AAEvD,eAAO,MAAM,wBAAwB,gBAAiB,SAAS,WAC7B,CAAC;AAKnC,eAAO,MAAM,YAAY,iBAA2B,CAAC;AAErD,eAAO,MAAM,mBAAmB,UAkB/B,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAwDtC,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAiBrD,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAC5C,oBAAoB,EACpB,wBAAwB,CAKzB,CAAC;AAEF,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,qBAAqB,KAAK,CAAC;AAExC,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAQlD,CAAC;AAEF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA+D1D,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAEgB,CAAC;AAE9E,eAAO,MAAM,eAAe,gBAA6C,CAAC;AAC1E,eAAO,MAAM,8BAA8B,QAAqB,CAAC;AACjE,eAAO,MAAM,yBAAyB,MAAM,CAAC"}
|
package/dist/utils/consts.js
CHANGED
|
@@ -12,16 +12,11 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
};
|
|
13
13
|
var _a;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.SOCKET_EMPTY_PAYLOAD_SIZE = exports.SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = exports.getAllMarketIds = exports.marketIdToAssetPairMapper = exports.marketAssetPairIdMapper = exports.SPECIAL_TIER_THRESHOLD = exports.VOLUME_TIER_MAP = exports.TRADING_LOTTERY_BOOST = exports.INSTANT_TRADING_RATE_XP = exports.conditionalOrderTypeNames = exports.RANKS_TRADING = exports.RANKS = exports.WHITELISTED_WALLETS = exports.CHANNEL_NAME = exports.getCurrentCandleRedisKey = exports.
|
|
15
|
+
exports.SOCKET_EMPTY_PAYLOAD_SIZE = exports.SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = exports.getAllMarketIds = exports.marketIdToAssetPairMapper = exports.marketAssetPairIdMapper = exports.SPECIAL_TIER_THRESHOLD = exports.VOLUME_TIER_MAP = exports.TRADING_LOTTERY_BOOST = exports.INSTANT_TRADING_RATE_XP = exports.conditionalOrderTypeNames = exports.RANKS_TRADING = exports.RANKS = exports.WHITELISTED_WALLETS = exports.CHANNEL_NAME = exports.getCurrentCandleRedisKey = exports.ONE_DAY_IN_SECONDS = exports.API_TIMEOUT = exports.MAX_UINT128 = void 0;
|
|
16
16
|
var types_1 = require("../types");
|
|
17
17
|
exports.MAX_UINT128 = Math.pow(2, 128) - 1;
|
|
18
18
|
exports.API_TIMEOUT = 2500;
|
|
19
19
|
exports.ONE_DAY_IN_SECONDS = 60 * 60 * 24;
|
|
20
|
-
// Redis Key Value Store Keys
|
|
21
|
-
var getMarketPricesRedisKey = function (marketId) {
|
|
22
|
-
return "market:".concat(marketId, ":prices");
|
|
23
|
-
};
|
|
24
|
-
exports.getMarketPricesRedisKey = getMarketPricesRedisKey;
|
|
25
20
|
var getCurrentCandleRedisKey = function (assetPairId) {
|
|
26
21
|
return "candles:".concat(assetPairId, ":current");
|
|
27
22
|
};
|
package/dist/utils/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAMkB;AAEL,QAAA,WAAW,GAAG,SAAA,CAAC,EAAI,GAAG,CAAA,GAAG,CAAC,CAAC;AAC3B,QAAA,WAAW,GAAW,IAAI,CAAC;AAE3B,QAAA,kBAAkB,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"/","sources":["utils/consts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,kCAMkB;AAEL,QAAA,WAAW,GAAG,SAAA,CAAC,EAAI,GAAG,CAAA,GAAG,CAAC,CAAC;AAC3B,QAAA,WAAW,GAAW,IAAI,CAAC;AAE3B,QAAA,kBAAkB,GAAW,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEhD,IAAM,wBAAwB,GAAG,UAAC,WAAsB;IAC7D,OAAA,kBAAW,WAAW,aAAU;AAAhC,CAAgC,CAAC;AADtB,QAAA,wBAAwB,4BACF;AAEnC,wBAAwB;AAExB,uCAAuC;AAC1B,QAAA,YAAY,GAAG,eAAwB,CAAC;AAExC,QAAA,mBAAmB,GAAG;IACjC,4CAA4C;IAC5C,4CAA4C;IAC5C,4CAA4C;IAC5C,4C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AU,EAAE,IAAI;IAChB,SAAS,EAAE,IAAI;IACf,SAAS,EAAE,IAAI;CAChB,CAAC;AAEW,QAAA,yBAAyB,GAA2B,MAAM,CAAC,IAAI,CAC1E,+BAAuB,CACxB,CAAC,MAAM,CAAC,UAAC,GAAG,EAAE,GAAG;;IAAK,OAAA,uBAAM,GAAG,gBAAG,+BAAuB,CAAC,GAAG,CAAC,IAAG,GAAG,OAAG;AAAjD,CAAiD,EAAE,EAAE,CAAC,CAAC;AAEvE,IAAM,eAAe,GAAG,cAAM,OAAA,MAAM,CAAC,IAAI,CAAC,+BAAuB,CAAC,EAApC,CAAoC,CAAC;AAA7D,QAAA,eAAe,mBAA8C;AAC7D,QAAA,8BAA8B,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AACpD,QAAA,yBAAyB,GAAG,GAAG,CAAC","sourcesContent":["import {\n ConditionalOrderType,\n ConditionalOrderTypeName,\n Rank,\n RankTrading,\n AssetPair,\n} from '../types';\n\nexport const MAX_UINT128 = 2 ** 128 - 1;\nexport const API_TIMEOUT: number = 2500;\n\nexport const ONE_DAY_IN_SECONDS: number = 60 * 60 * 24;\n\nexport const getCurrentCandleRedisKey = (assetPairId: AssetPair) =>\n `candles:${assetPairId}:current`;\n\n// Redis PubSub Channels\n\n// TODO: bring the rest in here as well\nexport const CHANNEL_NAME = 'redis-pub-sub' as const;\n\nexport const WHITELISTED_WALLETS = [\n '0xE116e2c0c2B0e7cd88060F06e2b2D7981Ef897ef',\n '0xb9db1789e8998eEDB6a53348Fe57Dcd080405cD4',\n '0x9A47F123916fC4745aCC6868D88450DC6056d335',\n '0x8d24B1663E80B4d1aB85e6B710Cd9178e475fd60',\n '0x1A0E5AbE817FDC9C000176183FA54e4B86940a83',\n '0x2b38d2d4FEcf085Eb7552607b5A5D631180015D6',\n '0xFcC63268172cDcf1Ae6D9dC572a10d0De7303C92',\n '0xDa0aA49cA0ca58939b76BaeCDcbfDb04b40CF6e8',\n '0xe33340635435BCA1E7686af89971D23525b2d8F8',\n '0xF8F6B70a36f4398f0853a311dC6699Aba8333Cc1', // internal dev account for testing\n '0x564aa5a2e98bdfcb876e8bcce129c18b6f052a0d',\n '0xaE173a960084903b1d278Ff9E3A81DeD82275556',\n '0x7aa47a9737395ae9e98E8b25aC97ee04b205dC22',\n '0xfd4295c1a0b07e6b706f0ab83dc9eb461b7f17b3', // input from simon\n '0x2fa11ef008c4b585ccf0a76861794ac7ae5a3a67', // brokoli\n '0x423063ed854736ae151B79032e4275AB57245173',\n '0xb89b383C26c2514907b6De5B6df96b2d97f425eC',\n];\n\nexport const RANKS: Record<number, Rank> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n rankLetter: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Alpha',\n rankLetter: 'α',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Beta',\n rankLetter: 'β',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Gamma',\n rankLetter: 'γ',\n },\n 4: {\n rankNumber: 4,\n rankName: 'Delta',\n rankLetter: 'δ',\n },\n 5: {\n rankNumber: 5,\n rankName: 'Epsilon',\n rankLetter: 'ε',\n },\n 6: {\n rankNumber: 6,\n rankName: 'Zeta',\n rankLetter: 'ζ',\n },\n 7: {\n rankNumber: 7,\n rankName: 'Eta',\n rankLetter: 'η',\n },\n 8: {\n rankNumber: 8,\n rankName: 'Theta',\n rankLetter: 'θ',\n },\n 9: {\n rankNumber: 9,\n rankName: 'Iota',\n rankLetter: 'ι',\n },\n 10: {\n rankNumber: 10,\n rankName: 'Kappa',\n rankLetter: 'κ',\n },\n};\n\nexport const RANKS_TRADING: Record<number, RankTrading> = {\n 0: {\n rankNumber: 0,\n rankName: '',\n },\n 1: {\n rankNumber: 1,\n rankName: 'Heracles',\n },\n 2: {\n rankNumber: 2,\n rankName: 'Perseus',\n },\n 3: {\n rankNumber: 3,\n rankName: 'Achilles',\n },\n};\n\nexport const conditionalOrderTypeNames: Record<\n ConditionalOrderType,\n ConditionalOrderTypeName\n> = {\n [ConditionalOrderType.STOP_LOSS]: 'Stop Loss',\n [ConditionalOrderType.TAKE_PROFIT]: 'Take Profit',\n [ConditionalOrderType.LIMIT_ORDER]: 'Limit Order',\n};\n\nexport const INSTANT_TRADING_RATE_XP = 2;\nexport const TRADING_LOTTERY_BOOST = 10;\n\nexport const VOLUME_TIER_MAP: Record<number, number> = {\n 0: 0, // Tier 0: $0 volume\n 1: 100_000, // Tier 1: $100,000 volume\n 2: 1_000_000, // Tier 2: $1,000,000 volume\n 3: 10_000_000, // Tier 3: $10,000,000 volume\n 4: 100_000_000, // Tier 4: $100,000,000 volume\n 5: 500_000_000, // Tier 5: $500,000,000 volume\n 6: 1_000_000_000, // Tier 6: $1,000,000,000 volume\n};\n\nexport const SPECIAL_TIER_THRESHOLD = 100;\n\nexport const marketAssetPairIdMapper: Record<string, string> = {\n ETHUSDMARK: '1',\n BTCUSDMARK: '2',\n SOLUSDMARK: '3',\n ARBUSDMARK: '4',\n OPUSDMARK: '5',\n AVAXUSDMARK: '6',\n MKRUSDMARK: '7',\n LINKUSDMARK: '8',\n AAVEUSDMARK: '9',\n CRVUSDMARK: '10',\n UNIUSDMARK: '11',\n SUIUSDMARK: '12',\n TIAUSDMARK: '13',\n SEIUSDMARK: '14',\n ZROUSDMARK: '15',\n XRPUSDMARK: '16',\n WIFUSDMARK: '17',\n '1000PEPEUSDMARK': '18',\n POPCATUSDMARK: '19',\n DOGEUSDMARK: '20',\n '1000SHIBUSDMARK': '21',\n '1000BONKUSDMARK': '22',\n APTUSDMARK: '23',\n BNBUSDMARK: '24',\n JTOUSDMARK: '25',\n ADAUSDMARK: '26',\n LDOUSDMARK: '27',\n POLUSDMARK: '28',\n NEARUSDMARK: '29',\n FTMUSD: '30',\n ENAUSDMARK: '31',\n EIGENUSDMARK: '32',\n PENDLEUSDMARK: '33',\n GOATUSDMARK: '34',\n GRASSUSDMARK: '35',\n '1000NEIROUSDMARK': '36',\n DOTUSDMARK: '37',\n LTCUSDMARK: '38',\n PYTHUSDMARK: '39',\n JUPUSDMARK: '40',\n PENGUUSDMARK: '41',\n TRUMPUSDMARK: '42',\n HYPEUSDMARK: '43',\n VIRTUALUSDMARK: '44',\n AI16ZUSDMARK: '45',\n AIXBTUSDMARK: '46',\n SUSDMARK: '47',\n FARTCOINUSDMARK: '48',\n GRIFFAINUSDMARK: '49',\n WLDUSDMARK: '50',\n ATOMUSDMARK: '51',\n APEUSDMARK: '52',\n TONUSDMARK: '53',\n ONDOUSDMARK: '54',\n TRXUSDMARK: '55',\n INJUSDMARK: '56',\n MOVEUSDMARK: '57',\n BERAUSDMARK: '58',\n LAYERUSDMARK: '59',\n TAOUSDMARK: '60',\n IPUSDMARK: '61',\n MEUSDMARK: '62',\n};\n\nexport const marketIdToAssetPairMapper: Record<string, string> = Object.keys(\n marketAssetPairIdMapper,\n).reduce((acc, key) => ({ ...acc, [marketAssetPairIdMapper[key]]: key }), {});\n\nexport const getAllMarketIds = () => Object.keys(marketAssetPairIdMapper);\nexport const SOCKET_BRIDGE_IN_MSG_GAS_LIMIT = BigInt('20000000');\nexport const SOCKET_EMPTY_PAYLOAD_SIZE = 160;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.272.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "pnpm@8.3.1",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "8403731000f5e23d0b6565b99bed33e47b052a33"
|
|
48
48
|
}
|
package/src/trading-api-types.ts
CHANGED
|
@@ -191,14 +191,6 @@ type WalletStats = {
|
|
|
191
191
|
volume_14d: Decimal;
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
-
// TODO: align types across trading api
|
|
195
|
-
export type MarketPrices = {
|
|
196
|
-
marketId: string;
|
|
197
|
-
poolPrice: number;
|
|
198
|
-
pegPrice: number;
|
|
199
|
-
timestamp: number;
|
|
200
|
-
};
|
|
201
|
-
|
|
202
194
|
export type TradingApiEndpoint<
|
|
203
195
|
Response,
|
|
204
196
|
Params,
|
|
@@ -385,15 +377,6 @@ export type TradingApiSource = {
|
|
|
385
377
|
},
|
|
386
378
|
'order_history'
|
|
387
379
|
>;
|
|
388
|
-
// TODO: also layer in an endpoint for market prices
|
|
389
|
-
'market/:marketId/prices': TradingApiEndpoint<
|
|
390
|
-
MarketPrices | null,
|
|
391
|
-
{
|
|
392
|
-
marketId: string;
|
|
393
|
-
},
|
|
394
|
-
'marketPrices',
|
|
395
|
-
MarketPrices
|
|
396
|
-
>;
|
|
397
380
|
'wallet/:address/balanceHistory/:timestamp': TradingApiListEndpoint<
|
|
398
381
|
{
|
|
399
382
|
timestamp: number;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ethers,
|
|
3
|
+
JsonRpcProvider,
|
|
4
|
+
JsonRpcSigner,
|
|
5
|
+
Network,
|
|
6
|
+
Signer,
|
|
7
|
+
} from 'ethers';
|
|
2
8
|
import { MoneyInOutChainId, ReyaChainId } from '../types';
|
|
3
9
|
import { ContractType, getAddress } from './contractAddresses';
|
|
4
10
|
import { abi } from './abis/Errors.json';
|
|
@@ -76,7 +82,15 @@ export async function estimateGasGivenAddress(
|
|
|
76
82
|
const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate
|
|
77
83
|
|
|
78
84
|
try {
|
|
79
|
-
const
|
|
85
|
+
const network = new Network('Reya', chainId);
|
|
86
|
+
const provider = new JsonRpcProvider(
|
|
87
|
+
reyaChainIdRPCMapper[chainId],
|
|
88
|
+
network,
|
|
89
|
+
{
|
|
90
|
+
staticNetwork: network,
|
|
91
|
+
pollingInterval: 50,
|
|
92
|
+
},
|
|
93
|
+
);
|
|
80
94
|
await provider.call(tx);
|
|
81
95
|
} catch (error) {
|
|
82
96
|
const decodedError = await errorDecoder.decode(error);
|
|
@@ -116,57 +130,6 @@ export async function estimateGasFromTxAndChainId(
|
|
|
116
130
|
throw new Error('All RPC URLs failed; last error: ' + lastError);
|
|
117
131
|
}
|
|
118
132
|
|
|
119
|
-
export async function estimateGasWithoutHardcoding(
|
|
120
|
-
signer: Signer | JsonRpcSigner,
|
|
121
|
-
data: string,
|
|
122
|
-
value: string,
|
|
123
|
-
chainId: number,
|
|
124
|
-
targetContract: ContractType | string,
|
|
125
|
-
): Promise<
|
|
126
|
-
Transaction & {
|
|
127
|
-
gasLimit: bigint;
|
|
128
|
-
maxPriorityFeePerGas?: bigint;
|
|
129
|
-
maxFeePerGas?: bigint;
|
|
130
|
-
}
|
|
131
|
-
> {
|
|
132
|
-
const accountAddress = await signer.getAddress();
|
|
133
|
-
|
|
134
|
-
const contractAddress = Object.values(ContractType).includes(
|
|
135
|
-
targetContract as ContractType,
|
|
136
|
-
)
|
|
137
|
-
? getAddress(chainId, targetContract as ContractType)
|
|
138
|
-
: targetContract;
|
|
139
|
-
const tx = {
|
|
140
|
-
from: accountAddress, // @todo Update with relayer address
|
|
141
|
-
to: contractAddress,
|
|
142
|
-
data,
|
|
143
|
-
...(value && value !== '0' ? { value: value } : {}),
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate
|
|
147
|
-
|
|
148
|
-
try {
|
|
149
|
-
const provider = ethers.getDefaultProvider(reyaChainIdRPCMapper[chainId]);
|
|
150
|
-
const estimation = await provider.estimateGas(tx);
|
|
151
|
-
gasLimit = addGasBuffer(estimation);
|
|
152
|
-
} catch (error) {
|
|
153
|
-
const decodedError = await errorDecoder.decode(error);
|
|
154
|
-
const reason = customReasonMapper(decodedError);
|
|
155
|
-
console.error(
|
|
156
|
-
`Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,
|
|
157
|
-
);
|
|
158
|
-
throw new Error(reason);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {
|
|
162
|
-
const maxPriorityFeePerGas: bigint = BigInt('0');
|
|
163
|
-
const maxFeePerGas: bigint = BigInt('100000000');
|
|
164
|
-
return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return { ...tx, gasLimit };
|
|
168
|
-
}
|
|
169
|
-
|
|
170
133
|
async function estimateGasExternalChains(
|
|
171
134
|
signer: Signer | JsonRpcSigner,
|
|
172
135
|
data: string,
|
|
@@ -216,6 +179,7 @@ async function estimateGasExternalChains(
|
|
|
216
179
|
|
|
217
180
|
return { ...tx, gasLimit };
|
|
218
181
|
}
|
|
182
|
+
|
|
219
183
|
export async function executeTransaction(
|
|
220
184
|
signer: Signer | JsonRpcSigner,
|
|
221
185
|
data: string,
|
package/src/utils/consts.ts
CHANGED
|
@@ -11,11 +11,6 @@ export const API_TIMEOUT: number = 2500;
|
|
|
11
11
|
|
|
12
12
|
export const ONE_DAY_IN_SECONDS: number = 60 * 60 * 24;
|
|
13
13
|
|
|
14
|
-
// Redis Key Value Store Keys
|
|
15
|
-
|
|
16
|
-
export const getMarketPricesRedisKey = (marketId: string) =>
|
|
17
|
-
`market:${marketId}:prices`;
|
|
18
|
-
|
|
19
14
|
export const getCurrentCandleRedisKey = (assetPairId: AssetPair) =>
|
|
20
15
|
`candles:${assetPairId}:current`;
|
|
21
16
|
|