@reyaxyz/common 0.136.0 → 0.138.0
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/services/getSocketAddresses.js +12 -22
- package/dist/services/getSocketAddresses.js.map +1 -1
- package/dist/transactions/executeTransaction.js +45 -4
- package/dist/transactions/executeTransaction.js.map +1 -1
- package/dist/types/services/getSocketAddresses.d.ts +32 -2
- package/dist/types/services/getSocketAddresses.d.ts.map +1 -1
- package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -9
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils/network.d.ts +1 -1
- package/dist/types/utils/network.d.ts.map +1 -1
- package/dist/types/utils/token/batch-token-getters.d.ts +22 -0
- package/dist/types/utils/token/batch-token-getters.d.ts.map +1 -0
- package/dist/types/utils/token/index.d.ts +6 -0
- package/dist/types/utils/token/index.d.ts.map +1 -0
- package/dist/types/utils/token/token-getters.d.ts +23 -0
- package/dist/types/utils/token/token-getters.d.ts.map +1 -0
- package/dist/types/utils/token/token-info-getters.d.ts +6 -0
- package/dist/types/utils/token/token-info-getters.d.ts.map +1 -0
- package/dist/types/utils/token/token-info.d.ts +3 -0
- package/dist/types/utils/token/token-info.d.ts.map +1 -0
- package/dist/types/utils/token/utils.d.ts +7 -0
- package/dist/types/utils/token/utils.d.ts.map +1 -0
- package/dist/types.js.map +1 -1
- package/dist/utils/network.js +2 -0
- package/dist/utils/network.js.map +1 -1
- package/dist/utils/token/batch-token-getters.js +175 -0
- package/dist/utils/token/batch-token-getters.js.map +1 -0
- package/dist/utils/token/index.js +22 -0
- package/dist/utils/token/index.js.map +1 -0
- package/dist/utils/token/token-getters.js +104 -0
- package/dist/utils/token/token-getters.js.map +1 -0
- package/dist/utils/token/token-info-getters.js +49 -0
- package/dist/utils/token/token-info-getters.js.map +1 -0
- package/dist/utils/{token-info.js → token/token-info.js} +1 -1
- package/dist/utils/token/token-info.js.map +1 -0
- package/dist/utils/token/utils.js +46 -0
- package/dist/utils/token/utils.js.map +1 -0
- package/package.json +2 -2
- package/src/services/getSocketAddresses.ts +3 -23
- package/src/transactions/executeTransaction.ts +51 -1
- package/src/types.ts +1 -11
- package/src/utils/network.ts +5 -2
- package/src/utils/token/batch-token-getters.ts +111 -0
- package/src/utils/token/index.ts +5 -0
- package/src/utils/token/token-getters.ts +71 -0
- package/src/utils/token/token-info-getters.ts +84 -0
- package/src/utils/{token-info.ts → token/token-info.ts} +1 -1
- package/src/utils/token/utils.ts +49 -0
- package/dist/types/utils/token-info.d.ts +0 -3
- package/dist/types/utils/token-info.d.ts.map +0 -1
- package/dist/types/utils/token.d.ts +0 -49
- package/dist/types/utils/token.d.ts.map +0 -1
- package/dist/utils/token-info.js.map +0 -1
- package/dist/utils/token.js +0 -340
- package/dist/utils/token.js.map +0 -1
- package/src/utils/token.ts +0 -317
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["types.ts"],"names":[],"mappings":";;;AAiCA,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8DAAkB,CAAA;IAClB,gEAAqB,CAAA;AACvB,CAAC,EAHW,WAAW,2BAAX,WAAW,QAGtB;AAED,IAAY,iBAYX;AAZD,WAAY,iBAAiB;IAC3B,UAAU;IACV,+EAAmB,CAAA;IACnB,oEAAc,CAAA;IACd,+EAAoB,CAAA;IACpB,2EAAmB,CAAA;IACnB,0EAAkB,CAAA;IAClB,UAAU;IACV,+EAAqB,CAAA;IACrB,oFAAwB,CAAA;IACxB,0EAAoB,CAAA;IACpB,sFAA0B,CAAA;AAC5B,CAAC,EAZW,iBAAiB,iCAAjB,iBAAiB,QAY5B;AAED,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,wCAAmB,CAAA;IACnB,2CAAsB,CAAA;IACtB,+CAA0B,CAAA;IAC1B,8CAAyB,CAAA;IACzB,uCAAkB,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AAuXD,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,0CAAsB,CAAA;IACtB,8CAA0B,CAAA;IAC1B,6CAAyB,CAAA;IACzB,sCAAkB,CAAA;IAClB,yCAAqB,CAAA;IACrB,oCAAgB,CAAA;AAClB,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B","sourcesContent":["import { Signer } from 'ethers';\n\nexport type Address = Lowercase<string>;\nexport type TokenName = Uppercase<string>;\n\n// -- Markets --\nexport type MarketOrderInfo = {\n counterpartyAccountIds: number[];\n exchangeId: number;\n};\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n fundingRateAnnualized: number;\n description: string;\n orderInfo: MarketOrderInfo;\n tickSizeDecimals: number;\n minOrderSize: number;\n minOrderSizeBase: number;\n baseSpacing: number;\n};\n\nexport enum ReyaChainId {\n reyaNetwork = 1729,\n reyaCronos = 89346161,\n}\n\nexport enum MoneyInOutChainId {\n // mainnet\n ethereumMainnet = 1,\n opMainnet = 10,\n polygonMainnet = 137,\n arbitrumOne = 42161,\n baseMainnet = 8453,\n // testnet\n polygonMumbai = 80001,\n arbitrumSepolia = 421614,\n opSepolia = 11155420,\n ethereumSepolia = 11155111,\n}\n\nexport enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n id: string;\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n}\n\n// -- Account --\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'long' | 'short';\n\nexport type CollateralEntity = {\n token: string;\n percentage: number;\n balance: number;\n balanceRUSD: number;\n exchangeRate: number;\n exchangeRateChange24HPercentage: number;\n};\n\nexport type MarginAccountEntity = {\n id: number;\n name: string;\n marginRatioHealth: 'danger' | 'healthy' | 'warning';\n marginRatioPercentage: number;\n totalBalance: number;\n totalBalanceUnderlyingAsset: string;\n totalBalanceChange24HPercentage: 5;\n livePnL: number;\n livePnLUnderlyingAsset: string;\n realizedPnL: number;\n realizedPnLUnderlyingAsset: string;\n realizedPnlHistoryTotal: number;\n totalPositionsCount: number;\n collaterals: CollateralEntity[];\n positions: PositionEntity[];\n};\n\nexport type PositionEntity = {\n id: number;\n side: Side;\n size: number;\n base: number;\n price: number;\n markPrice: number;\n orderStatus: Status;\n realisedPnl: number;\n unrealisedPnl: number;\n liquidationPrice: number;\n fundingRate: number;\n market: MarketEntity;\n account: {\n name: MarginAccountEntity['name'];\n id: MarginAccountEntity['id'];\n };\n tradeXpBoost: number;\n};\n\nexport type TradingHistoryEntity = {\n id: number;\n price: number;\n priceUnderlyingToken: string;\n size: number;\n sizeUnderlyingToken: string;\n timestampMillisecondsUTC: number;\n};\n\nexport type OrderType = 'market';\n\nexport type PositionHistoryType =\n | 'long-trade'\n | 'short-trade'\n | 'long-liquidation'\n | 'short-liquidation';\n\nexport type PositionHistoryEntity = {\n id: number;\n action: PositionHistoryType;\n orderType: OrderType;\n base: number;\n executionPrice: number;\n realisedPnl?: number | null;\n fees: number;\n timestamp: number;\n market: MarketEntity;\n};\n\nexport type LpPoolEntity = {\n id: number;\n name: string;\n description: string;\n longDescription: string;\n readMoreLink: string;\n currentAPY: number;\n apyChange24H: number;\n tokenAddress: Address;\n token: string;\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferFromMAToPoolAmount: number;\n minTransferFromPoolToMAAmount: number;\n stepSize: number;\n allowedChainsForLiquidity: MoneyInOutChainId[];\n moneyInOutConfiguration: MoneyInOutConfiguration;\n};\n\nexport type MoneyInOutConfiguration = {\n [key in MoneyInOutChainId]?: {\n minWithdrawAmount?: number;\n };\n};\n\nexport type MoneyInOutConfigurationPerTokenName = {\n [key in TokenName]?: MoneyInOutConfiguration;\n};\n\nexport type LpWithdrawBalanceEntity = {\n withdrawableBalance: number;\n poolSharePrice: number;\n accountShareBalance: number;\n};\n\nexport type TransactionHistoryType = 'deposit' | 'withdrawal';\n\nexport type LpTransactionHistoryEntity = {\n id: number;\n type: TransactionHistoryType;\n token: string;\n amount: number;\n transactionLink: string;\n timestamp: number;\n};\n\nexport type LpPositionEntity = {\n id: number;\n capitalInvested: number;\n currentBalance: number;\n pnl: number;\n lpPool: LpPoolEntity;\n};\n\nexport type MarginAccountTransactionHistoryType =\n | 'deposit'\n | 'withdrawal'\n | 'transfer'\n | 'auto_exchange';\n\nexport type MarginAccountTransactionStatus = 'confirmed' | 'pending';\n\nexport type MarginAccountTransactionHistoryEntity = {\n id: number;\n type: MarginAccountTransactionHistoryType;\n token: string;\n amount: number;\n transactionLink: string;\n status: MarginAccountTransactionStatus;\n timestamp: number;\n};\n\nexport type TokenEntity = {\n name: TokenName;\n address: Address;\n};\n// --- Lp Pool Balance ---\nexport enum LpBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\nexport type GetLpPoolBalanceChartDataResult = {\n data: {\n timestampInMs: number;\n value: number;\n }[];\n tvl: number;\n tvlChangePercentage: number;\n apy: number;\n apyChangePercentage: number;\n};\n\n// - LP Account Performance -\nexport type GetLpPoolPerformanceChartDataResult = {\n capitalInvestedData: {\n timestampInMs: number;\n value: number;\n }[];\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n capitalInvested: number;\n capitalInvestedChangePercentage: number;\n};\n\nexport type SocketTokenConnectors = {\n deposit: Address;\n withdraw: Address;\n};\n\nexport type GetSocketConnectorsParams = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n};\n\nexport type GetSocketControllerParams = {\n reyaChainId: ReyaChainId;\n tokenName: TokenName;\n};\n\nexport type GetSocketVaultParams = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n};\n\nexport type GetMoneyInOutChainIdFromReyaConnectorParams = {\n reyaChainId: ReyaChainId;\n tokenName: TokenName;\n socketConnector: Address;\n};\n\nexport type GetSocketBridgeTimeParams = {\n moneyInOutChainId: MoneyInOutChainId;\n};\n\nexport type GetSocketBridgeTimeResult = {\n bridgeTimeInMS: number;\n};\n\nexport type SocketDepositFeesEntry = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n fees: bigint;\n};\n\nexport type SocketWithdrawFeesEntry = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n fees: bigint;\n};\n\nexport type SocketDepositFees = {\n fees: bigint;\n feesInUnderlyingToken: number;\n underlyingTokenName: TokenName;\n};\n\nexport type SocketWithdrawFees = {\n fees: bigint;\n feesInUnderlyingToken: number;\n underlyingTokenName: TokenName;\n};\n\nexport type GetSocketWithdrawFeesParams = {\n reyaChainId: ReyaChainId;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type GetSocketWithdrawFeesResult = {\n fees: number;\n};\n\n// --- Margin Account Balance ---\nexport enum MarginAccountBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\nexport type GetMarginAccountBalanceChartDataResult = {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\n// --- Margin Account Collaterals Balance ---\nexport enum MarginAccountCollateralsBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\nexport type GetMarginAccountCollateralsBalanceChartDataResult = {\n data: {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n token: string;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\nexport type OwnerMetadataEntity = {\n address: Address;\n coreSigNonce: number;\n poolSigNonce: number;\n};\n\nexport type GetAllMarginAccountsBalanceChartDataResult = {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\nexport enum AllMarginAccountsBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\n// --- Funding Rate History ----\nexport enum FundingRateHistoryGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\nexport type GetFundingRateChartDataResult = {\n fundingRateData: {\n timestampInMs: number;\n value: number;\n }[];\n fundingRate: number;\n};\n\nexport type GetERC20AllowanceParams = {\n walletAddress: string;\n tokenAddress: LpPoolEntity['tokenAddress'];\n spenderAddress: string;\n subject: Signer;\n};\n\nexport type DepthSimulationState = {\n spotPrice: number;\n maxOrderSizeLong: number;\n maxOrderSizeShort: number;\n netExposure: number;\n};\n\nexport type GetLpPoolDepthChartSimulationDataResult = DepthSimulationState;\n\nexport type SignatureData = {\n signature: string;\n timestamp: number;\n walletAddress: Address;\n version: string;\n};\n\nexport type SaveSignatureResult = {\n signatureSavedSuccessfully: boolean;\n};\n\n// --- Community ----\nexport type VoteDetailsEntity = {\n id: number;\n startDate: number; // timestamp in UTC milliseconds\n endDate: number; // timestamp in UTC milliseconds\n percentageToPass: number; // Example: 4%\n yesCount: number;\n noCount: number;\n voteCountToPass: number; // Example: 1453\n slug: string;\n title: string;\n // Free text, each newline represents paragraph. UI splits by \\n atm to keep stuff simple\n description: string;\n};\n\nexport type VoteContractDetailsEntity = {\n id: number;\n contractAddress: Address;\n};\n\nexport type VoteStatusEntity = {\n votingPower: number;\n hasVoted: boolean;\n};\n\n// --- XP ----\nexport type XPEntity = {\n value: number;\n valueTimestampMilliseconds: number;\n rate: number;\n};\n\nexport type GetAccountLGEStatusParams = {\n address: string; // wallet address\n};\n\nexport type GetAccountLGEStatusResult = {\n xp: XPEntity;\n currentBoost: number;\n deposited: number;\n // TODO: deprecate once UI and API are released\n currentTVL: number;\n // TODO: deprecate once UI and API are released\n currentLiquidity: number;\n};\n\nexport type GetAccountTradingXPParams = {\n address: string; // wallet address\n};\n\nexport type GetAccountTradingXPResult = {\n xp: XPEntity;\n currentBoost: number;\n openBase: number;\n};\n\nexport type GetLGEBoostRateParams = void;\n\nexport type GetLGEBoostRateResult = {\n boostRate: number;\n // 0 - 100\n boostRateProgressPercentage: number;\n};\n\nexport type GetLpTvlResult = {\n currentTVL: number;\n currentLiquidity: number;\n};\n\nexport type LeaderboardEntity = {\n address: string;\n currentBoost: number;\n liquidityXp: number;\n // current rank for user (fish, whale, shrimp)\n rank: number;\n // leaderboard ranking 1,2,3...1230,...\n ranking: number;\n tradingXp: number;\n referralXp: number;\n voltzXp: number;\n totalXp: XPEntity;\n};\n\nexport type Rank = {\n rankNumber: number;\n rankLetter: string;\n rankName: string;\n};\n\nexport type LeaderboardEntityV2 = {\n address: string;\n currentBoost: number;\n liquidityXp: number;\n // current rank for user (fish, whale, shrimp)\n rank: Rank;\n promotion: 'rankUp' | 'rankDown' | 'stale';\n // leaderboard ranking 1,2,3...1230,...\n ranking: number;\n tradingXp: number;\n referralXp: number;\n voltzXp: number;\n totalXp: XPEntity;\n weeklyXp: number;\n};\n\nexport type UserLeaderboardDataEntity = LeaderboardEntity & {\n claimedRank: number;\n currentRankPoints: number;\n nextRankPoints: number;\n nftStatus: 'collected' | 'notCollected' | 'burnt' | 'minted' | null;\n};\n\nexport type UserLeaderboardDataV2Entity = LeaderboardEntityV2 & {\n claimedRank: number;\n currentRankPoints: number;\n nextRankPoints: number;\n totalNfts: number;\n claimedNfts: number;\n nftStatus: 'collected' | 'notCollected' | 'burnt' | 'minted' | null;\n timeUntilRankingEvent: number;\n openInterest: number;\n deposit: number;\n lgeBoost: number;\n extraBoost: number;\n tradingBoost: number;\n};\n\nexport type GetLeaderboardParams = {\n page: number;\n perPage: number;\n};\n\nexport type GetLeaderboardByRankParams = GetLeaderboardParams & {\n rankNumber: number;\n};\n\nexport type GetLeaderboardResult = {\n data: LeaderboardEntity[];\n updateTimestampMilliseconds: number;\n totalCount: number;\n};\n\nexport type GetLeaderboardByRankResult = {\n data: LeaderboardEntityV2[];\n updateTimestampMilliseconds: number;\n totalCount: number;\n};\n\nexport type ClaimRankParams = {\n address: string;\n};\n\nexport type ClaimRankResult = {\n success: boolean;\n};\n\nexport type GetUserLeaderboardDataParams = {\n address: string;\n};\n\nexport type GetUserLeaderboardDataV2Params = GetUserLeaderboardDataParams;\n\nexport type GetUserLeaderboardDataResult = UserLeaderboardDataEntity;\n\nexport type GetUserLeaderboardDataV2Result = UserLeaderboardDataV2Entity;\n\nexport type GetUserGameStatusParams = { address: string };\n\nexport type GetUserGameStatusResult = {\n bodyId: string;\n status: 'notStarted' | 'notLockedIn' | 'lockedIn' | 'expired';\n boostRate: number;\n nextBoostStartTimestampMilliseconds: number;\n};\n\nexport type GenerateGameBoostRateParams = { address: string; bodyId: string };\n\nexport type GenerateGameBoostRateResult = { boostRate: number };\n\nexport type LockGameBoostRateParams = { address: string };\n\nexport type LockGameBoostRateResult = void;\n\nexport type GetWalletReferralDetailsParams = {\n address: string;\n};\n\nexport type GetWalletReferralDetailsResult = {\n totalReferralsCount: number;\n totalReferralXP: number;\n};\n\nexport type GetWalletReferralCodeParams = {\n address: string;\n};\n\nexport type GetWalletReferralCodeResult = {\n referralCode: string;\n};\n\nexport type GetLockGameBoostTwitterUrlParams = {\n lockedInBoost: number;\n referralURL: string;\n};\n\nexport type GetLockGameBoostTwitterUrlResult = {\n tweetURL: string;\n};\n\nexport type GetReferralTwitterUrlParams = {\n referralURL: string;\n};\n\nexport type GetReferralTwitterUrlResult = {\n tweetURL: string;\n};\n\nexport type GetTradingRandomBoostParams = {\n address: string;\n marketId: number;\n};\n\nexport type GetTradingRandomBoostResult = {\n boost: number;\n};\n\nexport type GetUserTradingXpParams = {\n address: string;\n};\n\nexport type TokenEntityWithMinValue = TokenEntity & {\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferAmount: number;\n};\n\nexport type TokenInfo = {\n name: TokenName;\n address: Address;\n decimals: number;\n isRUSDUnderlying: boolean;\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferAmount: number;\n whitelistedWalletOnly?: boolean;\n};\n\n// --- TOS ----\n\nexport type TRMRiskAssessment = {\n accountExternalId: string;\n address: string;\n addressRiskIndicators: TMRRiskIndicator[];\n addressSubmitted: string;\n chain: string;\n entities: unknown[];\n trmAppUrl: string;\n};\n\nexport type TMRRiskIndicator = {\n category: string;\n categoryId: string;\n categoryRiskScoreLevel: number;\n categoryRiskScoreLevelLabel: string;\n incomingVolumeUsd: string;\n outgoingVolumeUsd: string;\n riskType: string;\n totalVolumeUsd: string;\n};\n\n// todo: deprecate after 1st tac client is deprecated\nexport type ToSVersionDetails = {\n text: string;\n version: string;\n creationTimestamp: number; // in MS\n};\n\nexport type ToSProductVersionDetails = {\n shortText: string;\n longText: string;\n version: string;\n creationTimestamp: number; // in MS\n product: string;\n};\n\nexport type SocketBridgeTransactionPoolStatus =\n | 'pending'\n | 'confirmed'\n | 'failed';\n\nexport type IpInfo = {\n ip: string;\n hostname: string;\n city: string;\n region: string;\n country: string;\n loc: string;\n org: string;\n postal: string;\n timezone: string;\n privacy: {\n vpn: boolean;\n proxy: boolean;\n tor: boolean;\n relay: boolean;\n hosting: boolean;\n service: string;\n };\n countryCode: string;\n countryFlag: {\n emoji: string;\n unicode: string;\n };\n countryFlagURL: string;\n countryCurrency: {\n code: string;\n symbol: string;\n };\n continent: {\n code: string;\n name: string;\n };\n isEU: boolean;\n};\n\nexport interface CandleMessage {\n /** Stringified JSON object of all events to be streamed. */\n contents: string;\n /** Clob pair id of the Candle message. */\n\n clobPairId: string;\n /** Resolution of the candle update. */\n\n resolution: string;\n /** Version of the websocket message. */\n\n version: string;\n}\n\nexport enum CandleResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\nexport type TransactionExecutionMetadata = {\n accountName?: string;\n accountId?: number;\n marketId?: number;\n destinationType?: 'pool' | 'account';\n action?: 'matchOrder' | 'closeOrder';\n};\n\nexport type TransactionExecutionOutput = {\n txHash: string;\n accountId?: string | null;\n coreSigNonce?: string | null;\n poolSigNonce?: string | null;\n miscellaneous?: {\n tradeXpBoost?: number;\n xpNftAwarded?: boolean;\n };\n};\n\nexport type BurnNFTParams = {\n address: string;\n};\n\n// TODO: please fix implementation - we don't need boolean, void is fine\nexport type BurnNFTResult = boolean;\n"]}
|
|
1
|
+
{"version":3,"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AA;IACtB,yHAAyB,CAAA;IACzB,wHAA6B,CAAA;IAC7B,2HAAkC,CAAA;IAClC,8HAAoC,CAAA;IACpC,6HAAoC,CAAA;AACtC,CAAC,EAPW,0CAA0C,0DAA1C,0CAA0C,QAOrD;AA6BD,IAAY,mCAOX;AAPD,WAAY,mCAAmC;IAC7C,6GAAsB,CAAA;IACtB,2GAAyB,CAAA;IACzB,0GAA6B,CAAA;IAC7B,6GAAkC,CAAA;IAClC,gHAAoC,CAAA;IACpC,+GAAoC,CAAA;AACtC,CAAC,EAPW,mCAAmC,mDAAnC,mCAAmC,QAO9C;AAED,gCAAgC;AAChC,IAAY,6BAOX;AAPD,WAAY,6BAA6B;IACvC,iGAAsB,CAAA;IACtB,+FAAyB,CAAA;IACzB,8FAA6B,CAAA;IAC7B,iGAAkC,CAAA;IAClC,oGAAoC,CAAA;IACpC,mGAAoC,CAAA;AACtC,CAAC,EAPW,6BAA6B,6CAA7B,6BAA6B,QAOxC;AAoXD,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,0CAAsB,CAAA;IACtB,8CAA0B,CAAA;IAC1B,6CAAyB,CAAA;IACzB,sCAAkB,CAAA;IAClB,yCAAqB,CAAA;IACrB,oCAAgB,CAAA;AAClB,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B","sourcesContent":["export type Address = Lowercase<string>;\nexport type TokenName = Uppercase<string>;\n\n// -- Markets --\nexport type MarketOrderInfo = {\n counterpartyAccountIds: number[];\n exchangeId: number;\n};\n\nexport type MarketEntity = {\n id: number;\n ticker: string;\n underlyingAsset: string;\n quoteToken: string;\n markPrice: number;\n isActive: boolean;\n maxLeverage: number;\n volume24H: number;\n priceChange24H: number;\n priceChange24HPercentage: number;\n openInterest: number;\n fundingRate: number;\n fundingRateAnnualized: number;\n description: string;\n orderInfo: MarketOrderInfo;\n tickSizeDecimals: number;\n minOrderSize: number;\n minOrderSizeBase: number;\n baseSpacing: number;\n};\n\nexport enum ReyaChainId {\n reyaNetwork = 1729,\n reyaCronos = 89346161,\n}\n\nexport enum MoneyInOutChainId {\n // mainnet\n ethereumMainnet = 1,\n opMainnet = 10,\n polygonMainnet = 137,\n arbitrumOne = 42161,\n baseMainnet = 8453,\n // testnet\n polygonMumbai = 80001,\n arbitrumSepolia = 421614,\n opSepolia = 11155420,\n ethereumSepolia = 11155111,\n}\n\nexport enum CandlesResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\n// -- Candles --\nexport interface Candle {\n id: string;\n startedAt: string;\n ticker: string;\n resolution: CandlesResolution;\n low: string;\n high: string;\n open: string;\n close: string;\n baseTokenVolume: string;\n usdVolume: string;\n trades: number;\n startingOpenInterest: string;\n}\n\n// -- Account --\n\nexport type Status = 'OPEN' | 'CLOSED' | 'LIQUIDATED' | 'FILLED';\nexport type Side = 'long' | 'short';\n\nexport type CollateralEntity = {\n token: string;\n percentage: number;\n balance: number;\n balanceRUSD: number;\n exchangeRate: number;\n exchangeRateChange24HPercentage: number;\n};\n\nexport type MarginAccountEntity = {\n id: number;\n name: string;\n marginRatioHealth: 'danger' | 'healthy' | 'warning';\n marginRatioPercentage: number;\n totalBalance: number;\n totalBalanceUnderlyingAsset: string;\n totalBalanceChange24HPercentage: 5;\n livePnL: number;\n livePnLUnderlyingAsset: string;\n realizedPnL: number;\n realizedPnLUnderlyingAsset: string;\n realizedPnlHistoryTotal: number;\n totalPositionsCount: number;\n collaterals: CollateralEntity[];\n positions: PositionEntity[];\n};\n\nexport type PositionEntity = {\n id: number;\n side: Side;\n size: number;\n base: number;\n price: number;\n markPrice: number;\n orderStatus: Status;\n realisedPnl: number;\n unrealisedPnl: number;\n liquidationPrice: number;\n fundingRate: number;\n market: MarketEntity;\n account: {\n name: MarginAccountEntity['name'];\n id: MarginAccountEntity['id'];\n };\n tradeXpBoost: number;\n};\n\nexport type TradingHistoryEntity = {\n id: number;\n price: number;\n priceUnderlyingToken: string;\n size: number;\n sizeUnderlyingToken: string;\n timestampMillisecondsUTC: number;\n};\n\nexport type OrderType = 'market';\n\nexport type PositionHistoryType =\n | 'long-trade'\n | 'short-trade'\n | 'long-liquidation'\n | 'short-liquidation';\n\nexport type PositionHistoryEntity = {\n id: number;\n action: PositionHistoryType;\n orderType: OrderType;\n base: number;\n executionPrice: number;\n realisedPnl?: number | null;\n fees: number;\n timestamp: number;\n market: MarketEntity;\n};\n\nexport type LpPoolEntity = {\n id: number;\n name: string;\n description: string;\n longDescription: string;\n readMoreLink: string;\n currentAPY: number;\n apyChange24H: number;\n tokenAddress: Address;\n token: string;\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferFromMAToPoolAmount: number;\n minTransferFromPoolToMAAmount: number;\n stepSize: number;\n allowedChainsForLiquidity: MoneyInOutChainId[];\n moneyInOutConfiguration: MoneyInOutConfiguration;\n};\n\nexport type MoneyInOutConfiguration = {\n [key in MoneyInOutChainId]?: {\n minWithdrawAmount?: number;\n };\n};\n\nexport type MoneyInOutConfigurationPerTokenName = {\n [key in TokenName]?: MoneyInOutConfiguration;\n};\n\nexport type LpWithdrawBalanceEntity = {\n withdrawableBalance: number;\n poolSharePrice: number;\n accountShareBalance: number;\n};\n\nexport type TransactionHistoryType = 'deposit' | 'withdrawal';\n\nexport type LpTransactionHistoryEntity = {\n id: number;\n type: TransactionHistoryType;\n token: string;\n amount: number;\n transactionLink: string;\n timestamp: number;\n};\n\nexport type LpPositionEntity = {\n id: number;\n capitalInvested: number;\n currentBalance: number;\n pnl: number;\n lpPool: LpPoolEntity;\n};\n\nexport type MarginAccountTransactionHistoryType =\n | 'deposit'\n | 'withdrawal'\n | 'transfer'\n | 'auto_exchange';\n\nexport type MarginAccountTransactionStatus = 'confirmed' | 'pending';\n\nexport type MarginAccountTransactionHistoryEntity = {\n id: number;\n type: MarginAccountTransactionHistoryType;\n token: string;\n amount: number;\n transactionLink: string;\n status: MarginAccountTransactionStatus;\n timestamp: number;\n};\n\nexport type TokenEntity = {\n name: TokenName;\n address: Address;\n};\n// --- Lp Pool Balance ---\nexport enum LpBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\nexport type GetLpPoolBalanceChartDataResult = {\n data: {\n timestampInMs: number;\n value: number;\n }[];\n tvl: number;\n tvlChangePercentage: number;\n apy: number;\n apyChangePercentage: number;\n};\n\n// - LP Account Performance -\nexport type GetLpPoolPerformanceChartDataResult = {\n capitalInvestedData: {\n timestampInMs: number;\n value: number;\n }[];\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n capitalInvested: number;\n capitalInvestedChangePercentage: number;\n};\n\nexport type SocketTokenConnectors = {\n deposit: Address;\n withdraw: Address;\n};\n\nexport type GetSocketConnectorsParams = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n};\n\nexport type GetSocketVaultParams = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n};\n\nexport type GetMoneyInOutChainIdFromReyaConnectorParams = {\n reyaChainId: ReyaChainId;\n tokenName: TokenName;\n socketConnector: Address;\n};\n\nexport type GetSocketBridgeTimeParams = {\n moneyInOutChainId: MoneyInOutChainId;\n};\n\nexport type GetSocketBridgeTimeResult = {\n bridgeTimeInMS: number;\n};\n\nexport type SocketDepositFeesEntry = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n fees: bigint;\n};\n\nexport type SocketWithdrawFeesEntry = {\n moneyInOutChainId: MoneyInOutChainId;\n tokenName: TokenName;\n fees: bigint;\n};\n\nexport type SocketDepositFees = {\n fees: bigint;\n feesInUnderlyingToken: number;\n underlyingTokenName: TokenName;\n};\n\nexport type SocketWithdrawFees = {\n fees: bigint;\n feesInUnderlyingToken: number;\n underlyingTokenName: TokenName;\n};\n\nexport type GetSocketWithdrawFeesParams = {\n reyaChainId: ReyaChainId;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type GetSocketWithdrawFeesResult = {\n fees: number;\n};\n\n// --- Margin Account Balance ---\nexport enum MarginAccountBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\nexport type GetMarginAccountBalanceChartDataResult = {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\n// --- Margin Account Collaterals Balance ---\nexport enum MarginAccountCollateralsBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\nexport type GetMarginAccountCollateralsBalanceChartDataResult = {\n data: {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n token: string;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\nexport type OwnerMetadataEntity = {\n address: Address;\n coreSigNonce: number;\n poolSigNonce: number;\n};\n\nexport type GetAllMarginAccountsBalanceChartDataResult = {\n balanceData: {\n timestampInMs: number;\n value: number;\n }[];\n balance: number;\n balanceChangePercentage: number;\n};\n\nexport enum AllMarginAccountsBalanceGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\n\n// --- Funding Rate History ----\nexport enum FundingRateHistoryGranularity {\n ONE_MINUTE = 60 * 1000,\n ONE_HOUR = 60 * 60 * 1000,\n ONE_DAY = 24 * 60 * 60 * 1000,\n ONE_WEEK = 7 * 24 * 60 * 60 * 1000,\n ONE_MONTH = 30 * 24 * 60 * 60 * 1000,\n ONE_YEAR = 365 * 24 * 60 * 60 * 1000,\n}\nexport type GetFundingRateChartDataResult = {\n fundingRateData: {\n timestampInMs: number;\n value: number;\n }[];\n fundingRate: number;\n};\n\nexport type GetBalancesForBridgeArgs = {\n walletAddress: string;\n};\n\nexport type DepthSimulationState = {\n spotPrice: number;\n maxOrderSizeLong: number;\n maxOrderSizeShort: number;\n netExposure: number;\n};\n\nexport type GetLpPoolDepthChartSimulationDataResult = DepthSimulationState;\n\nexport type SignatureData = {\n signature: string;\n timestamp: number;\n walletAddress: Address;\n version: string;\n};\n\nexport type SaveSignatureResult = {\n signatureSavedSuccessfully: boolean;\n};\n\n// --- Community ----\nexport type VoteDetailsEntity = {\n id: number;\n startDate: number; // timestamp in UTC milliseconds\n endDate: number; // timestamp in UTC milliseconds\n percentageToPass: number; // Example: 4%\n yesCount: number;\n noCount: number;\n voteCountToPass: number; // Example: 1453\n slug: string;\n title: string;\n // Free text, each newline represents paragraph. UI splits by \\n atm to keep stuff simple\n description: string;\n};\n\nexport type VoteContractDetailsEntity = {\n id: number;\n contractAddress: Address;\n};\n\nexport type VoteStatusEntity = {\n votingPower: number;\n hasVoted: boolean;\n};\n\n// --- XP ----\nexport type XPEntity = {\n value: number;\n valueTimestampMilliseconds: number;\n rate: number;\n};\n\nexport type GetAccountLGEStatusParams = {\n address: string; // wallet address\n};\n\nexport type GetAccountLGEStatusResult = {\n xp: XPEntity;\n currentBoost: number;\n deposited: number;\n // TODO: deprecate once UI and API are released\n currentTVL: number;\n // TODO: deprecate once UI and API are released\n currentLiquidity: number;\n};\n\nexport type GetAccountTradingXPParams = {\n address: string; // wallet address\n};\n\nexport type GetAccountTradingXPResult = {\n xp: XPEntity;\n currentBoost: number;\n openBase: number;\n};\n\nexport type GetLGEBoostRateParams = void;\n\nexport type GetLGEBoostRateResult = {\n boostRate: number;\n // 0 - 100\n boostRateProgressPercentage: number;\n};\n\nexport type GetLpTvlResult = {\n currentTVL: number;\n currentLiquidity: number;\n};\n\nexport type LeaderboardEntity = {\n address: string;\n currentBoost: number;\n liquidityXp: number;\n // current rank for user (fish, whale, shrimp)\n rank: number;\n // leaderboard ranking 1,2,3...1230,...\n ranking: number;\n tradingXp: number;\n referralXp: number;\n voltzXp: number;\n totalXp: XPEntity;\n};\n\nexport type Rank = {\n rankNumber: number;\n rankLetter: string;\n rankName: string;\n};\n\nexport type LeaderboardEntityV2 = {\n address: string;\n currentBoost: number;\n liquidityXp: number;\n // current rank for user (fish, whale, shrimp)\n rank: Rank;\n promotion: 'rankUp' | 'rankDown' | 'stale';\n // leaderboard ranking 1,2,3...1230,...\n ranking: number;\n tradingXp: number;\n referralXp: number;\n voltzXp: number;\n totalXp: XPEntity;\n weeklyXp: number;\n};\n\nexport type UserLeaderboardDataEntity = LeaderboardEntity & {\n claimedRank: number;\n currentRankPoints: number;\n nextRankPoints: number;\n nftStatus: 'collected' | 'notCollected' | 'burnt' | 'minted' | null;\n};\n\nexport type UserLeaderboardDataV2Entity = LeaderboardEntityV2 & {\n claimedRank: number;\n currentRankPoints: number;\n nextRankPoints: number;\n totalNfts: number;\n claimedNfts: number;\n nftStatus: 'collected' | 'notCollected' | 'burnt' | 'minted' | null;\n timeUntilRankingEvent: number;\n openInterest: number;\n deposit: number;\n lgeBoost: number;\n extraBoost: number;\n tradingBoost: number;\n};\n\nexport type GetLeaderboardParams = {\n page: number;\n perPage: number;\n};\n\nexport type GetLeaderboardByRankParams = GetLeaderboardParams & {\n rankNumber: number;\n};\n\nexport type GetLeaderboardResult = {\n data: LeaderboardEntity[];\n updateTimestampMilliseconds: number;\n totalCount: number;\n};\n\nexport type GetLeaderboardByRankResult = {\n data: LeaderboardEntityV2[];\n updateTimestampMilliseconds: number;\n totalCount: number;\n};\n\nexport type ClaimRankParams = {\n address: string;\n};\n\nexport type ClaimRankResult = {\n success: boolean;\n};\n\nexport type GetUserLeaderboardDataParams = {\n address: string;\n};\n\nexport type GetUserLeaderboardDataV2Params = GetUserLeaderboardDataParams;\n\nexport type GetUserLeaderboardDataResult = UserLeaderboardDataEntity;\n\nexport type GetUserLeaderboardDataV2Result = UserLeaderboardDataV2Entity;\n\nexport type GetUserGameStatusParams = { address: string };\n\nexport type GetUserGameStatusResult = {\n bodyId: string;\n status: 'notStarted' | 'notLockedIn' | 'lockedIn' | 'expired';\n boostRate: number;\n nextBoostStartTimestampMilliseconds: number;\n};\n\nexport type GenerateGameBoostRateParams = { address: string; bodyId: string };\n\nexport type GenerateGameBoostRateResult = { boostRate: number };\n\nexport type LockGameBoostRateParams = { address: string };\n\nexport type LockGameBoostRateResult = void;\n\nexport type GetWalletReferralDetailsParams = {\n address: string;\n};\n\nexport type GetWalletReferralDetailsResult = {\n totalReferralsCount: number;\n totalReferralXP: number;\n};\n\nexport type GetWalletReferralCodeParams = {\n address: string;\n};\n\nexport type GetWalletReferralCodeResult = {\n referralCode: string;\n};\n\nexport type GetLockGameBoostTwitterUrlParams = {\n lockedInBoost: number;\n referralURL: string;\n};\n\nexport type GetLockGameBoostTwitterUrlResult = {\n tweetURL: string;\n};\n\nexport type GetReferralTwitterUrlParams = {\n referralURL: string;\n};\n\nexport type GetReferralTwitterUrlResult = {\n tweetURL: string;\n};\n\nexport type GetTradingRandomBoostParams = {\n address: string;\n marketId: number;\n};\n\nexport type GetTradingRandomBoostResult = {\n boost: number;\n};\n\nexport type GetUserTradingXpParams = {\n address: string;\n};\n\nexport type TokenEntityWithMinValue = TokenEntity & {\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferAmount: number;\n};\n\nexport type TokenInfo = {\n name: TokenName;\n address: Address;\n decimals: number;\n isRUSDUnderlying: boolean;\n minDepositAmount: number;\n minWithdrawAmount: number;\n minTransferAmount: number;\n whitelistedWalletOnly?: boolean;\n};\n\n// --- TOS ----\n\nexport type TRMRiskAssessment = {\n accountExternalId: string;\n address: string;\n addressRiskIndicators: TMRRiskIndicator[];\n addressSubmitted: string;\n chain: string;\n entities: unknown[];\n trmAppUrl: string;\n};\n\nexport type TMRRiskIndicator = {\n category: string;\n categoryId: string;\n categoryRiskScoreLevel: number;\n categoryRiskScoreLevelLabel: string;\n incomingVolumeUsd: string;\n outgoingVolumeUsd: string;\n riskType: string;\n totalVolumeUsd: string;\n};\n\n// todo: deprecate after 1st tac client is deprecated\nexport type ToSVersionDetails = {\n text: string;\n version: string;\n creationTimestamp: number; // in MS\n};\n\nexport type ToSProductVersionDetails = {\n shortText: string;\n longText: string;\n version: string;\n creationTimestamp: number; // in MS\n product: string;\n};\n\nexport type SocketBridgeTransactionPoolStatus =\n | 'pending'\n | 'confirmed'\n | 'failed';\n\nexport type IpInfo = {\n ip: string;\n hostname: string;\n city: string;\n region: string;\n country: string;\n loc: string;\n org: string;\n postal: string;\n timezone: string;\n privacy: {\n vpn: boolean;\n proxy: boolean;\n tor: boolean;\n relay: boolean;\n hosting: boolean;\n service: string;\n };\n countryCode: string;\n countryFlag: {\n emoji: string;\n unicode: string;\n };\n countryFlagURL: string;\n countryCurrency: {\n code: string;\n symbol: string;\n };\n continent: {\n code: string;\n name: string;\n };\n isEU: boolean;\n};\n\nexport interface CandleMessage {\n /** Stringified JSON object of all events to be streamed. */\n contents: string;\n /** Clob pair id of the Candle message. */\n\n clobPairId: string;\n /** Resolution of the candle update. */\n\n resolution: string;\n /** Version of the websocket message. */\n\n version: string;\n}\n\nexport enum CandleResolution {\n ONE_MINUTE = '1MIN',\n FIVE_MINUTES = '5MINS',\n FIFTEEN_MINUTES = '15MINS',\n THIRTY_MINUTES = '30MINS',\n ONE_HOUR = '1HOUR',\n FOUR_HOURS = '4HOURS',\n ONE_DAY = '1DAY',\n}\n\nexport type TransactionExecutionMetadata = {\n accountName?: string;\n accountId?: number;\n marketId?: number;\n destinationType?: 'pool' | 'account';\n action?: 'matchOrder' | 'closeOrder';\n};\n\nexport type TransactionExecutionOutput = {\n txHash: string;\n accountId?: string | null;\n coreSigNonce?: string | null;\n poolSigNonce?: string | null;\n miscellaneous?: {\n tradeXpBoost?: number;\n xpNftAwarded?: boolean;\n };\n};\n\nexport type BurnNFTParams = {\n address: string;\n};\n\n// TODO: please fix implementation - we don't need boolean, void is fine\nexport type BurnNFTResult = boolean;\n"]}
|
package/dist/utils/network.js
CHANGED
|
@@ -64,6 +64,7 @@ exports.chainIdToExplorerURL = (_a = {},
|
|
|
64
64
|
_a[types_1.ReyaChainId.reyaCronos] = 'https://reya-cronos.blockscout.com',
|
|
65
65
|
_a);
|
|
66
66
|
exports.ChainRpcUrls = (_b = {},
|
|
67
|
+
_b[types_1.ReyaChainId.reyaNetwork] = ['https://rpc.reya.network'],
|
|
67
68
|
_b[types_1.MoneyInOutChainId.ethereumMainnet] = [
|
|
68
69
|
'https://mainnet.gateway.tenderly.co',
|
|
69
70
|
'https://eth.llamarpc.com',
|
|
@@ -105,6 +106,7 @@ exports.ChainRpcUrls = (_b = {},
|
|
|
105
106
|
'https://base.gateway.tenderly.co/2LHAD54IBvgXiVQdhE9mIF',
|
|
106
107
|
],
|
|
107
108
|
// Add the rest of the mainnet URLs above
|
|
109
|
+
_b[types_1.ReyaChainId.reyaCronos] = ['https://rpc.reya-cronos.gelato.digital'],
|
|
108
110
|
_b[types_1.MoneyInOutChainId.polygonMumbai] = [
|
|
109
111
|
'https://polygon-mumbai.gateway.tenderly.co',
|
|
110
112
|
'https://polygon-mumbai-bor-rpc.publicnode.com',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"/","sources":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4D;KAC7D;IACD,GAAC,yBAAiB,CAAC,WAAW,IAAG;QAC/B,8BAA8B;QAC9B,+BAA+B;QAC/B,uEAAuE;QACvE,uEAAuE;QACvE,uEAAuE;QACvE,6DAA6D;KAC9D;IACD,GAAC,yBAAiB,CAAC,WAAW,IAAG;QAC/B,0BAA0B;QAC1B,2BAA2B;QAC3B,wEAAwE;QACxE,wEAAwE;QACxE,wEAAwE;QACxE,yDAAyD;KAC1D;IACD,yCAAyC;IAEzC,GAAC,yBAAiB,CAAC,aAAa,IAAG;QACjC,4CAA4C;QAC5C,+CAA+C;QAC/C,mEAAmE;KACpE;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,wCAAwC;QACxC,2DAA2D;QAC3D,qEAAqE;KACtE;IACD,GAAC,yBAAiB,CAAC,SAAS,IAAG;QAC7B,6BAA6B;QAC7B,wDAAwD;QACxD,qEAAqE;KACtE;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,qCAAqC;QACrC,wDAAwD;QACxD,4DAA4D;KAC7D;QAED;AAEW,QAAA,mBAAmB;IAC9B,UAAU;IACV,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;IAC3E,GAAC,yBAAiB,CAAC,SAAS,IAAG,sCAAsC;IACrE,GAAC,yBAAiB,CAAC,cAAc,IAC/B,0CAA0C;IAC5C,GAAC,yBAAiB,CAAC,WAAW,IAAG,sCAAsC;IACvE,GAAC,yBAAiB,CAAC,WAAW,IAAG,uCAAuC;IACxE,UAAU;IACV,GAAC,yBAAiB,CAAC,aAAa,IAAG,yCAAyC;IAC5E,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;IAC3E,GAAC,yBAAiB,CAAC,SAAS,IAAG,sCAAsC;IACrE,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;QAC3E","sourcesContent":["import { MoneyInOutChainId, ReyaChainId } from '../types';\n\nexport function getReyaNetwork(env: 'production' | 'test'): ReyaChainId {\n if (env === 'production') return ReyaChainId.reyaNetwork;\n if (env === 'test') return ReyaChainId.reyaCronos;\n\n throw new Error('Unknown env for getReyaNetwork');\n}\n\nexport function getMoneyInOutNetworks(\n env: 'production' | 'test',\n): MoneyInOutChainId[] {\n if (env === 'production')\n return [\n MoneyInOutChainId.ethereumMainnet,\n MoneyInOutChainId.opMainnet,\n MoneyInOutChainId.polygonMainnet,\n MoneyInOutChainId.arbitrumOne,\n MoneyInOutChainId.baseMainnet,\n ];\n\n if (env === 'test')\n return [\n MoneyInOutChainId.ethereumSepolia,\n MoneyInOutChainId.opSepolia,\n MoneyInOutChainId.arbitrumSepolia,\n MoneyInOutChainId.polygonMumbai,\n ];\n\n throw new Error('Unknown env for getMoneyInOutNetworks');\n}\n\nexport function getReyaNetworkFromMoneyInOutChainId(\n moneyInOutChainId: MoneyInOutChainId,\n): ReyaChainId {\n if (getMoneyInOutNetworks('production').includes(moneyInOutChainId)) {\n return getReyaNetwork('production');\n }\n if (getMoneyInOutNetworks('test').includes(moneyInOutChainId)) {\n return getReyaNetwork('test');\n }\n\n throw new Error(\n `Unknown money in out network in getReyaNetworkFromMoneyInOutChainId: ${moneyInOutChainId}`,\n );\n}\n\nexport function getMoneyInOutNetworksFromReyaChainId(\n reyaChainId: ReyaChainId,\n): MoneyInOutChainId[] {\n if (getReyaNetwork('production') === reyaChainId) {\n return getMoneyInOutNetworks('production');\n }\n if (getReyaNetwork('test') === reyaChainId) {\n return getMoneyInOutNetworks('test');\n }\n\n throw new Error(\n `Unknown money in out network in getMoneyInOutNetworksFromReyaChainId: ${reyaChainId}`,\n );\n}\n\nexport const chainIdToExplorerURL: {\n [key in MoneyInOutChainId | ReyaChainId]: string;\n} = {\n [MoneyInOutChainId.ethereumMainnet]: 'https://etherscan.io',\n [MoneyInOutChainId.opMainnet]: 'https://optimistic.etherscan.io',\n [MoneyInOutChainId.polygonMainnet]: 'https://polygonscan.com',\n [MoneyInOutChainId.arbitrumOne]: 'https://arbiscan.io',\n [MoneyInOutChainId.baseMainnet]: 'https://basescan.org',\n [MoneyInOutChainId.polygonMumbai]: 'https://mumbai.polygonscan.com',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://sepolia.arbiscan.io',\n [MoneyInOutChainId.opSepolia]: 'https://sepolia-optimism.etherscan.io',\n [MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.etherscan.io',\n [ReyaChainId.reyaNetwork]: 'https://explorer.reya.network',\n [ReyaChainId.reyaCronos]: 'https://reya-cronos.blockscout.com',\n};\n\nexport const ChainRpcUrls: { [key in MoneyInOutChainId]: string[] } = {\n [MoneyInOutChainId.ethereumMainnet]: [\n 'https://mainnet.gateway.tenderly.co',\n 'https://eth.llamarpc.com',\n 'https://eth-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://eth-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://eth-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://mainnet.gateway.tenderly.co/69U6LoF0URUv5CfuIU7FdL',\n ],\n [MoneyInOutChainId.opMainnet]: [\n 'https://mainnet.optimism.io',\n 'https://optimism.llamarpc.com',\n 'https://opt-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://opt-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://opt-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://optimism.gateway.tenderly.co/69LkAPTI3LODcBAdtz9wQC',\n ],\n [MoneyInOutChainId.polygonMainnet]: [\n 'https://polygon-rpc.com',\n 'https://gateway.tenderly.co/public/polygon',\n 'https://polygon-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://polygon-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://polygon-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://polygon.gateway.tenderly.co/7Qw4fTY4kf3v02LjJjWyvZ',\n ],\n [MoneyInOutChainId.arbitrumOne]: [\n 'https://arb1.arbitrum.io/rpc',\n 'https://arbitrum.llamarpc.com',\n 'https://arb-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://arb-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://arb-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://arbitrum.gateway.tenderly.co/1wQGK6nNPTbSc7asucAbzA',\n ],\n [MoneyInOutChainId.baseMainnet]: [\n 'https://mainnet.base.org',\n 'https://base.llamarpc.com',\n 'https://base-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://base-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://base-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://base.gateway.tenderly.co/2LHAD54IBvgXiVQdhE9mIF',\n ],\n // Add the rest of the mainnet URLs above\n\n [MoneyInOutChainId.polygonMumbai]: [\n 'https://polygon-mumbai.gateway.tenderly.co',\n 'https://polygon-mumbai-bor-rpc.publicnode.com',\n 'https://polygon-mumbai.gateway.tenderly.co/6U1NVClWKWhHljBJ9yk7zm',\n ],\n [MoneyInOutChainId.arbitrumSepolia]: [\n 'https://sepolia-rollup.arbitrum.io/rpc',\n 'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',\n 'https://arbitrum-sepolia.gateway.tenderly.co/4YMRN8fKu2SV1JSNsGlbMZ',\n ],\n [MoneyInOutChainId.opSepolia]: [\n 'https://sepolia.optimism.io',\n 'https://optimism-sepolia.blockpi.network/v1/rpc/public',\n 'https://optimism-sepolia.gateway.tenderly.co/2nXBEGPk57CotvTJMjIMK7',\n ],\n [MoneyInOutChainId.ethereumSepolia]: [\n 'https://sepolia.gateway.tenderly.co',\n 'https://ethereum-sepolia.blockpi.network/v1/rpc/public',\n 'https://sepolia.gateway.tenderly.co/1u2yZV1rdVLpgOeHwD1Z8M',\n ],\n // Add the rest of the testnet URLs above\n};\n\nexport const AlchemyChainRpcUrls: { [key in MoneyInOutChainId]: string } = {\n // mainnet\n [MoneyInOutChainId.ethereumMainnet]: 'https://eth-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.opMainnet]: 'https://opt-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.polygonMainnet]:\n 'https://polygon-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumOne]: 'https://arb-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.g.alchemy.com/v2',\n // testnet\n [MoneyInOutChainId.polygonMumbai]: 'https://polygon-mumbai.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://arb-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.opSepolia]: 'https://opt-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.ethereumSepolia]: 'https://eth-sepolia.g.alchemy.com/v2',\n};\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":";;;;AAAA,kCAA0D;AAE1D,SAAgB,cAAc,CAAC,GAA0B;IACvD,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,mBAAW,CAAC,WAAW,CAAC;IACzD,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,mBAAW,CAAC,UAAU,CAAC;IAElD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AALD,wCAKC;AAED,SAAgB,qBAAqB,CACnC,GAA0B;IAE1B,IAAI,GAAG,KAAK,Y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AAyC;IACzC,GAAC,mBAAW,CAAC,UAAU,IAAG,CAAC,wCAAwC,CAAC;IACpE,GAAC,yBAAiB,CAAC,aAAa,IAAG;QACjC,4CAA4C;QAC5C,+CAA+C;QAC/C,mEAAmE;KACpE;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,wCAAwC;QACxC,2DAA2D;QAC3D,qEAAqE;KACtE;IACD,GAAC,yBAAiB,CAAC,SAAS,IAAG;QAC7B,6BAA6B;QAC7B,wDAAwD;QACxD,qEAAqE;KACtE;IACD,GAAC,yBAAiB,CAAC,eAAe,IAAG;QACnC,qCAAqC;QACrC,wDAAwD;QACxD,4DAA4D;KAC7D;QAED;AAEW,QAAA,mBAAmB;IAC9B,UAAU;IACV,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;IAC3E,GAAC,yBAAiB,CAAC,SAAS,IAAG,sCAAsC;IACrE,GAAC,yBAAiB,CAAC,cAAc,IAC/B,0CAA0C;IAC5C,GAAC,yBAAiB,CAAC,WAAW,IAAG,sCAAsC;IACvE,GAAC,yBAAiB,CAAC,WAAW,IAAG,uCAAuC;IACxE,UAAU;IACV,GAAC,yBAAiB,CAAC,aAAa,IAAG,yCAAyC;IAC5E,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;IAC3E,GAAC,yBAAiB,CAAC,SAAS,IAAG,sCAAsC;IACrE,GAAC,yBAAiB,CAAC,eAAe,IAAG,sCAAsC;QAC3E","sourcesContent":["import { MoneyInOutChainId, ReyaChainId } from '../types';\n\nexport function getReyaNetwork(env: 'production' | 'test'): ReyaChainId {\n if (env === 'production') return ReyaChainId.reyaNetwork;\n if (env === 'test') return ReyaChainId.reyaCronos;\n\n throw new Error('Unknown env for getReyaNetwork');\n}\n\nexport function getMoneyInOutNetworks(\n env: 'production' | 'test',\n): MoneyInOutChainId[] {\n if (env === 'production')\n return [\n MoneyInOutChainId.ethereumMainnet,\n MoneyInOutChainId.opMainnet,\n MoneyInOutChainId.polygonMainnet,\n MoneyInOutChainId.arbitrumOne,\n MoneyInOutChainId.baseMainnet,\n ];\n\n if (env === 'test')\n return [\n MoneyInOutChainId.ethereumSepolia,\n MoneyInOutChainId.opSepolia,\n MoneyInOutChainId.arbitrumSepolia,\n MoneyInOutChainId.polygonMumbai,\n ];\n\n throw new Error('Unknown env for getMoneyInOutNetworks');\n}\n\nexport function getReyaNetworkFromMoneyInOutChainId(\n moneyInOutChainId: MoneyInOutChainId,\n): ReyaChainId {\n if (getMoneyInOutNetworks('production').includes(moneyInOutChainId)) {\n return getReyaNetwork('production');\n }\n if (getMoneyInOutNetworks('test').includes(moneyInOutChainId)) {\n return getReyaNetwork('test');\n }\n\n throw new Error(\n `Unknown money in out network in getReyaNetworkFromMoneyInOutChainId: ${moneyInOutChainId}`,\n );\n}\n\nexport function getMoneyInOutNetworksFromReyaChainId(\n reyaChainId: ReyaChainId,\n): MoneyInOutChainId[] {\n if (getReyaNetwork('production') === reyaChainId) {\n return getMoneyInOutNetworks('production');\n }\n if (getReyaNetwork('test') === reyaChainId) {\n return getMoneyInOutNetworks('test');\n }\n\n throw new Error(\n `Unknown money in out network in getMoneyInOutNetworksFromReyaChainId: ${reyaChainId}`,\n );\n}\n\nexport const chainIdToExplorerURL: {\n [key in MoneyInOutChainId | ReyaChainId]: string;\n} = {\n [MoneyInOutChainId.ethereumMainnet]: 'https://etherscan.io',\n [MoneyInOutChainId.opMainnet]: 'https://optimistic.etherscan.io',\n [MoneyInOutChainId.polygonMainnet]: 'https://polygonscan.com',\n [MoneyInOutChainId.arbitrumOne]: 'https://arbiscan.io',\n [MoneyInOutChainId.baseMainnet]: 'https://basescan.org',\n [MoneyInOutChainId.polygonMumbai]: 'https://mumbai.polygonscan.com',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://sepolia.arbiscan.io',\n [MoneyInOutChainId.opSepolia]: 'https://sepolia-optimism.etherscan.io',\n [MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.etherscan.io',\n [ReyaChainId.reyaNetwork]: 'https://explorer.reya.network',\n [ReyaChainId.reyaCronos]: 'https://reya-cronos.blockscout.com',\n};\n\nexport const ChainRpcUrls: {\n [key in MoneyInOutChainId | ReyaChainId]: string[];\n} = {\n [ReyaChainId.reyaNetwork]: ['https://rpc.reya.network'],\n [MoneyInOutChainId.ethereumMainnet]: [\n 'https://mainnet.gateway.tenderly.co',\n 'https://eth.llamarpc.com',\n 'https://eth-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://eth-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://eth-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://mainnet.gateway.tenderly.co/69U6LoF0URUv5CfuIU7FdL',\n ],\n [MoneyInOutChainId.opMainnet]: [\n 'https://mainnet.optimism.io',\n 'https://optimism.llamarpc.com',\n 'https://opt-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://opt-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://opt-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://optimism.gateway.tenderly.co/69LkAPTI3LODcBAdtz9wQC',\n ],\n [MoneyInOutChainId.polygonMainnet]: [\n 'https://polygon-rpc.com',\n 'https://gateway.tenderly.co/public/polygon',\n 'https://polygon-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://polygon-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://polygon-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://polygon.gateway.tenderly.co/7Qw4fTY4kf3v02LjJjWyvZ',\n ],\n [MoneyInOutChainId.arbitrumOne]: [\n 'https://arb1.arbitrum.io/rpc',\n 'https://arbitrum.llamarpc.com',\n 'https://arb-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://arb-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://arb-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://arbitrum.gateway.tenderly.co/1wQGK6nNPTbSc7asucAbzA',\n ],\n [MoneyInOutChainId.baseMainnet]: [\n 'https://mainnet.base.org',\n 'https://base.llamarpc.com',\n 'https://base-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://base-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://base-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://base.gateway.tenderly.co/2LHAD54IBvgXiVQdhE9mIF',\n ],\n // Add the rest of the mainnet URLs above\n [ReyaChainId.reyaCronos]: ['https://rpc.reya-cronos.gelato.digital'],\n [MoneyInOutChainId.polygonMumbai]: [\n 'https://polygon-mumbai.gateway.tenderly.co',\n 'https://polygon-mumbai-bor-rpc.publicnode.com',\n 'https://polygon-mumbai.gateway.tenderly.co/6U1NVClWKWhHljBJ9yk7zm',\n ],\n [MoneyInOutChainId.arbitrumSepolia]: [\n 'https://sepolia-rollup.arbitrum.io/rpc',\n 'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',\n 'https://arbitrum-sepolia.gateway.tenderly.co/4YMRN8fKu2SV1JSNsGlbMZ',\n ],\n [MoneyInOutChainId.opSepolia]: [\n 'https://sepolia.optimism.io',\n 'https://optimism-sepolia.blockpi.network/v1/rpc/public',\n 'https://optimism-sepolia.gateway.tenderly.co/2nXBEGPk57CotvTJMjIMK7',\n ],\n [MoneyInOutChainId.ethereumSepolia]: [\n 'https://sepolia.gateway.tenderly.co',\n 'https://ethereum-sepolia.blockpi.network/v1/rpc/public',\n 'https://sepolia.gateway.tenderly.co/1u2yZV1rdVLpgOeHwD1Z8M',\n ],\n // Add the rest of the testnet URLs above\n};\n\nexport const AlchemyChainRpcUrls: { [key in MoneyInOutChainId]: string } = {\n // mainnet\n [MoneyInOutChainId.ethereumMainnet]: 'https://eth-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.opMainnet]: 'https://opt-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.polygonMainnet]:\n 'https://polygon-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumOne]: 'https://arb-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.g.alchemy.com/v2',\n // testnet\n [MoneyInOutChainId.polygonMumbai]: 'https://polygon-mumbai.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://arb-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.opSepolia]: 'https://opt-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.ethereumSepolia]: 'https://eth-sepolia.g.alchemy.com/v2',\n};\n"]}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getERC20AllowanceBatch = exports.getERC20BalanceBatch = exports.getETHBalanceBatch = void 0;
|
|
40
|
+
var ethers_1 = require("ethers");
|
|
41
|
+
var network_1 = require("../network");
|
|
42
|
+
var retry_1 = require("../retry");
|
|
43
|
+
var utils_1 = require("./utils");
|
|
44
|
+
var getETHBalanceBatch = function (_a) {
|
|
45
|
+
var walletAddress = _a.walletAddress, chain = _a.chain;
|
|
46
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
var rpcUrls, lastError, _loop_1, _i, rpcUrls_1, url, state_1;
|
|
48
|
+
return __generator(this, function (_b) {
|
|
49
|
+
switch (_b.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
rpcUrls = network_1.ChainRpcUrls[chain];
|
|
52
|
+
if (!rpcUrls || rpcUrls.length === 0) {
|
|
53
|
+
throw new Error('No RPC URLs configured for the chain: ' + chain);
|
|
54
|
+
}
|
|
55
|
+
lastError = null;
|
|
56
|
+
_loop_1 = function (url) {
|
|
57
|
+
var provider_1, currentBalance, error_1;
|
|
58
|
+
return __generator(this, function (_c) {
|
|
59
|
+
switch (_c.label) {
|
|
60
|
+
case 0:
|
|
61
|
+
_c.trys.push([0, 2, , 3]);
|
|
62
|
+
provider_1 = new ethers_1.ethers.JsonRpcProvider(url);
|
|
63
|
+
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
64
|
+
return provider_1.getBalance(ethers_1.ethers.getAddress(walletAddress));
|
|
65
|
+
})];
|
|
66
|
+
case 1:
|
|
67
|
+
currentBalance = _c.sent();
|
|
68
|
+
return [2 /*return*/, { value: (0, utils_1.descale)(18)(currentBalance) }];
|
|
69
|
+
case 2:
|
|
70
|
+
error_1 = _c.sent();
|
|
71
|
+
lastError = error_1;
|
|
72
|
+
return [3 /*break*/, 3];
|
|
73
|
+
case 3: return [2 /*return*/];
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
77
|
+
_i = 0, rpcUrls_1 = rpcUrls;
|
|
78
|
+
_b.label = 1;
|
|
79
|
+
case 1:
|
|
80
|
+
if (!(_i < rpcUrls_1.length)) return [3 /*break*/, 4];
|
|
81
|
+
url = rpcUrls_1[_i];
|
|
82
|
+
return [5 /*yield**/, _loop_1(url)];
|
|
83
|
+
case 2:
|
|
84
|
+
state_1 = _b.sent();
|
|
85
|
+
if (typeof state_1 === "object")
|
|
86
|
+
return [2 /*return*/, state_1.value];
|
|
87
|
+
_b.label = 3;
|
|
88
|
+
case 3:
|
|
89
|
+
_i++;
|
|
90
|
+
return [3 /*break*/, 1];
|
|
91
|
+
case 4: throw new Error('All RPC URLs failed; last error: ' + lastError);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
exports.getETHBalanceBatch = getETHBalanceBatch;
|
|
97
|
+
var getERC20BalanceBatch = function (_a) {
|
|
98
|
+
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, chain = _a.chain;
|
|
99
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
100
|
+
var rpcUrls, lastError, _i, rpcUrls_2, url, provider, token, currentBalance, error_2;
|
|
101
|
+
return __generator(this, function (_b) {
|
|
102
|
+
switch (_b.label) {
|
|
103
|
+
case 0:
|
|
104
|
+
rpcUrls = network_1.ChainRpcUrls[chain];
|
|
105
|
+
if (!rpcUrls || rpcUrls.length === 0) {
|
|
106
|
+
throw new Error('No RPC URLs configured for the chain: ' + chain);
|
|
107
|
+
}
|
|
108
|
+
lastError = null;
|
|
109
|
+
_i = 0, rpcUrls_2 = rpcUrls;
|
|
110
|
+
_b.label = 1;
|
|
111
|
+
case 1:
|
|
112
|
+
if (!(_i < rpcUrls_2.length)) return [3 /*break*/, 6];
|
|
113
|
+
url = rpcUrls_2[_i];
|
|
114
|
+
_b.label = 2;
|
|
115
|
+
case 2:
|
|
116
|
+
_b.trys.push([2, 4, , 5]);
|
|
117
|
+
provider = new ethers_1.ethers.JsonRpcProvider(url);
|
|
118
|
+
token = (0, utils_1.getERC20TokenContract)(tokenAddress, provider);
|
|
119
|
+
return [4 /*yield*/, token.balanceOf(walletAddress)];
|
|
120
|
+
case 3:
|
|
121
|
+
currentBalance = _b.sent();
|
|
122
|
+
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
123
|
+
case 4:
|
|
124
|
+
error_2 = _b.sent();
|
|
125
|
+
lastError = error_2;
|
|
126
|
+
return [3 /*break*/, 5];
|
|
127
|
+
case 5:
|
|
128
|
+
_i++;
|
|
129
|
+
return [3 /*break*/, 1];
|
|
130
|
+
case 6: throw new Error('All RPC URLs failed; last error: ' + lastError);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
exports.getERC20BalanceBatch = getERC20BalanceBatch;
|
|
136
|
+
var getERC20AllowanceBatch = function (_a) {
|
|
137
|
+
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, spenderAddress = _a.spenderAddress, chain = _a.chain;
|
|
138
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
139
|
+
var rpcUrls, lastError, _i, rpcUrls_3, url, provider, token, currentBalance, error_3;
|
|
140
|
+
return __generator(this, function (_b) {
|
|
141
|
+
switch (_b.label) {
|
|
142
|
+
case 0:
|
|
143
|
+
rpcUrls = network_1.ChainRpcUrls[chain];
|
|
144
|
+
if (!rpcUrls || rpcUrls.length === 0) {
|
|
145
|
+
throw new Error('No RPC URLs configured for the chain: ' + chain);
|
|
146
|
+
}
|
|
147
|
+
lastError = null;
|
|
148
|
+
_i = 0, rpcUrls_3 = rpcUrls;
|
|
149
|
+
_b.label = 1;
|
|
150
|
+
case 1:
|
|
151
|
+
if (!(_i < rpcUrls_3.length)) return [3 /*break*/, 6];
|
|
152
|
+
url = rpcUrls_3[_i];
|
|
153
|
+
_b.label = 2;
|
|
154
|
+
case 2:
|
|
155
|
+
_b.trys.push([2, 4, , 5]);
|
|
156
|
+
provider = new ethers_1.ethers.JsonRpcProvider(url);
|
|
157
|
+
token = (0, utils_1.getERC20TokenContract)(tokenAddress, provider);
|
|
158
|
+
return [4 /*yield*/, token.allowance(walletAddress, spenderAddress)];
|
|
159
|
+
case 3:
|
|
160
|
+
currentBalance = _b.sent();
|
|
161
|
+
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
162
|
+
case 4:
|
|
163
|
+
error_3 = _b.sent();
|
|
164
|
+
lastError = error_3;
|
|
165
|
+
return [3 /*break*/, 5];
|
|
166
|
+
case 5:
|
|
167
|
+
_i++;
|
|
168
|
+
return [3 /*break*/, 1];
|
|
169
|
+
case 6: throw new Error('All RPC URLs failed; last error: ' + lastError);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
exports.getERC20AllowanceBatch = getERC20AllowanceBatch;
|
|
175
|
+
//# sourceMappingURL=batch-token-getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-token-getters.js","sourceRoot":"/","sources":["utils/token/batch-token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAEhC,sCAA0C;AAC1C,kCAA8C;AAC9C,iCAAyD;AAsBlD,IAAM,kBAAkB,GAAG,UAAO,EAGhB;QAFvB,aAAa,mBAAA,EACb,KAAK,WAAA;;;;;;oBAEC,OAAO,GAAG,sBAAY,CAAC,KAAK,CAAC,CAAC;oBACpC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACrC,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,KAAK,CAAC,CAAC;oBACpE,CAAC;oBAEG,SAAS,GAAG,IAAI,CAAC;wCAEV,GAAG;;;;;;oCAEJ,aAAW,IAAI,eAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAA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;;oBARJ,IAAO,CAAA;;wBAYzB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC;;;;CAClE,CAAC;AA1BW,QAAA,oBAAoB,wBA0B/B;AAEK,IAAM,sBAAsB,GAAG,UAAO,EAMhB;QAL3B,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,cAAc,oBAAA,EACd,KAAK,WAAA;;;;;;oBAEC,OAAO,GAAG,sBAAY,CAAC,KAAK,CAAC,CAAC;oBACpC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACrC,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,KAAK,CAAC,CAAC;oBACpE,CAAC;oBAEG,SAAS,GAAG,IAAI,CAAC;0BAEI,EAAP,mBAAO;;;yBAAP,CAAA,qBAAO,CAAA;oBAAd,GAAG;;;;oBAEJ,QAAQ,GAAG,IAAI,eAAM,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;oBAC3C,KAAK,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;oBACrC,qBAAM,KAAK,CAAC,SAAS,CAC1C,aAAa,EACb,cAAc,CACf,EAAA;;oBAHK,cAAc,GAAG,SAGtB;oBAED,sBAAO,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,cAAc,CAAC,EAAC;;;oBAE9C,SAAS,GAAG,OAAK,CAAC;;;oBAXJ,IAAO,CAAA;;wBAezB,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,SAAS,CAAC,CAAC;;;;CAClE,CAAC;AA9BW,QAAA,sBAAsB,0BA8BjC","sourcesContent":["import { ethers } from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../../types';\nimport { ChainRpcUrls } from '../network';\nimport { exponentialBackoff } from '../retry';\nimport { descale, getERC20TokenContract } from './utils';\n\nexport type GetETHBalanceBatchArgs = {\n walletAddress: string;\n chain: MoneyInOutChainId | ReyaChainId;\n};\n\nexport type GetERC20BalanceBatchArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n chain: MoneyInOutChainId | ReyaChainId;\n};\n\nexport type GetERC20AllowanceBatchArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n spenderAddress: string;\n chain: MoneyInOutChainId | ReyaChainId;\n};\n\nexport const getETHBalanceBatch = async ({\n walletAddress,\n chain,\n}: GetETHBalanceBatchArgs): Promise<number> => {\n const rpcUrls = ChainRpcUrls[chain];\n if (!rpcUrls || rpcUrls.length === 0) {\n throw new Error('No RPC URLs configured for the chain: ' + chain);\n }\n\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const currentBalance = await exponentialBackoff(() =>\n provider.getBalance(ethers.getAddress(walletAddress)),\n );\n return descale(18)(currentBalance);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n};\n\nexport const getERC20BalanceBatch = async ({\n tokenAddress,\n tokenDecimals,\n walletAddress,\n chain,\n}: GetERC20BalanceBatchArgs): Promise<number> => {\n const rpcUrls = ChainRpcUrls[chain];\n if (!rpcUrls || rpcUrls.length === 0) {\n throw new Error('No RPC URLs configured for the chain: ' + chain);\n }\n\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const token = getERC20TokenContract(tokenAddress, provider);\n const currentBalance = await token.balanceOf(walletAddress);\n\n return descale(tokenDecimals)(currentBalance);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n};\n\nexport const getERC20AllowanceBatch = async ({\n tokenAddress,\n tokenDecimals,\n walletAddress,\n spenderAddress,\n chain,\n}: GetERC20AllowanceBatchArgs): Promise<number> => {\n const rpcUrls = ChainRpcUrls[chain];\n if (!rpcUrls || rpcUrls.length === 0) {\n throw new Error('No RPC URLs configured for the chain: ' + chain);\n }\n\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const token = getERC20TokenContract(tokenAddress, provider);\n const currentBalance = await token.allowance(\n walletAddress,\n spenderAddress,\n );\n\n return descale(tokenDecimals)(currentBalance);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n};\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./token-getters"), exports);
|
|
18
|
+
__exportStar(require("./batch-token-getters"), exports);
|
|
19
|
+
__exportStar(require("./token-info-getters"), exports);
|
|
20
|
+
__exportStar(require("./utils"), exports);
|
|
21
|
+
__exportStar(require("./token-info"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["utils/token/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,wDAAsC;AACtC,uDAAqC;AACrC,0CAAwB;AACxB,+CAA6B","sourcesContent":["export * from './token-getters';\nexport * from './batch-token-getters';\nexport * from './token-info-getters';\nexport * from './utils';\nexport * from './token-info';\n"]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.getETHBalance = exports.getERC20Balance = exports.getERC20Allowance = void 0;
|
|
40
|
+
var ethers_1 = require("ethers");
|
|
41
|
+
var retry_1 = require("../retry");
|
|
42
|
+
var utils_1 = require("./utils");
|
|
43
|
+
var getERC20Allowance = function (_a) {
|
|
44
|
+
var walletAddress = _a.walletAddress, tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, spenderAddress = _a.spenderAddress, subject = _a.subject;
|
|
45
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
46
|
+
var tokenContract, allowance;
|
|
47
|
+
return __generator(this, function (_b) {
|
|
48
|
+
switch (_b.label) {
|
|
49
|
+
case 0:
|
|
50
|
+
tokenContract = (0, utils_1.getERC20TokenContract)(tokenAddress, subject);
|
|
51
|
+
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
52
|
+
return tokenContract.allowance(walletAddress, spenderAddress);
|
|
53
|
+
})];
|
|
54
|
+
case 1:
|
|
55
|
+
allowance = _b.sent();
|
|
56
|
+
return [2 /*return*/, BigInt(allowance) > (0, utils_1.scale)(tokenDecimals)(Number.MAX_SAFE_INTEGER)
|
|
57
|
+
? Number.MAX_SAFE_INTEGER
|
|
58
|
+
: (0, utils_1.descale)(tokenDecimals)(allowance)];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
exports.getERC20Allowance = getERC20Allowance;
|
|
64
|
+
var getERC20Balance = function (_a) {
|
|
65
|
+
var tokenAddress = _a.tokenAddress, tokenDecimals = _a.tokenDecimals, walletAddress = _a.walletAddress, subject = _a.subject;
|
|
66
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
67
|
+
var token, currentBalance;
|
|
68
|
+
return __generator(this, function (_b) {
|
|
69
|
+
switch (_b.label) {
|
|
70
|
+
case 0:
|
|
71
|
+
token = (0, utils_1.getERC20TokenContract)(tokenAddress, subject);
|
|
72
|
+
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
73
|
+
return token.balanceOf(walletAddress);
|
|
74
|
+
})];
|
|
75
|
+
case 1:
|
|
76
|
+
currentBalance = _b.sent();
|
|
77
|
+
return [2 /*return*/, (0, utils_1.descale)(tokenDecimals)(currentBalance)];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
exports.getERC20Balance = getERC20Balance;
|
|
83
|
+
var getETHBalance = function (_a) {
|
|
84
|
+
var walletAddress = _a.walletAddress, subject = _a.subject;
|
|
85
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
86
|
+
var provider, currentBalance;
|
|
87
|
+
return __generator(this, function (_b) {
|
|
88
|
+
switch (_b.label) {
|
|
89
|
+
case 0:
|
|
90
|
+
provider = subject.provider;
|
|
91
|
+
if (!provider)
|
|
92
|
+
throw new Error("User's provider not found");
|
|
93
|
+
return [4 /*yield*/, (0, retry_1.exponentialBackoff)(function () {
|
|
94
|
+
return provider.getBalance(ethers_1.ethers.getAddress(walletAddress));
|
|
95
|
+
})];
|
|
96
|
+
case 1:
|
|
97
|
+
currentBalance = _b.sent();
|
|
98
|
+
return [2 /*return*/, (0, utils_1.descale)(18)(currentBalance)];
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
exports.getETHBalance = getETHBalance;
|
|
104
|
+
//# sourceMappingURL=token-getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-getters.js","sourceRoot":"/","sources":["utils/token/token-getters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgC;AAChC,kCAA8C;AAE9C,iCAAgE;AAsBzD,IAAM,iBAAiB,GAAG,UAAO,EAMhB;QALtB,aAAa,mBAAA,EACb,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,cAAc,oBAAA,EACd,OAAO,aAAA;;;;;;oBAED,aAAa,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;oBAEjD,qBAAM,IAAA,0BAAkB,EAAC;4BACzC,OAAA,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,cAAc,CAAC;wBAAtD,CAAsD,CACvD,EAAA;;oBAFK,SAAS,GAAG,SAEjB;oBAED,sBAAO,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,aAAK,EAAC,aAAa,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;4BACtE,CAAC,CAAC,MAAM,CAAC,gBAAgB;4BACzB,CAAC,CAAC,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,SAAS,CAAC,EAAC;;;;CACvC,CAAC;AAhBW,QAAA,iBAAiB,qBAgB5B;AAEK,IAAM,eAAe,GAAG,UAAO,EAKhB;QAJpB,YAAY,kBAAA,EACZ,aAAa,mBAAA,EACb,aAAa,mBAAA,EACb,OAAO,aAAA;;;;;;oBAED,KAAK,GAAG,IAAA,6BAAqB,EAAC,YAAY,EAAE,OAAO,CAAC,CAAC;oBAEpC,qBAAM,IAAA,0BAAkB,EAAC;4BAC9C,OAAA,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC;wBAA9B,CAA8B,CAC/B,EAAA;;oBAFK,cAAc,GAAG,SAEtB;oBAED,sBAAO,IAAA,eAAO,EAAC,aAAa,CAAC,CAAC,cAAc,CAAC,EAAC;;;;CAC/C,CAAC;AAbW,QAAA,eAAe,mBAa1B;AAEK,IAAM,aAAa,GAAG,UAAO,EAGhB;QAFlB,aAAa,mBAAA,EACb,OAAO,aAAA;;;;;;oBAED,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;oBAClC,IAAI,CAAC,QAAQ;wBAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAErC,qBAAM,IAAA,0BAAkB,EAAC;4BAC9C,OAAA,QAAQ,CAAC,UAAU,CAAC,eAAM,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;wBAArD,CAAqD,CACtD,EAAA;;oBAFK,cAAc,GAAG,SAEtB;oBAED,sBAAO,IAAA,eAAO,EAAC,EAAE,CAAC,CAAC,cAAc,CAAC,EAAC;;;;CACpC,CAAC;AAZW,QAAA,aAAa,iBAYxB","sourcesContent":["import { ethers } from 'ethers';\nimport { exponentialBackoff } from '../retry';\nimport { LpPoolEntity } from '../../types';\nimport { getERC20TokenContract, scale, descale } from './utils';\n\nexport type GetERC20BalanceArgs = {\n tokenAddress: string;\n tokenDecimals: number;\n walletAddress: string;\n subject: ethers.Signer | ethers.Provider;\n};\n\nexport type GetETHBalanceArgs = {\n walletAddress: string;\n subject: ethers.Signer | ethers.Provider;\n};\n\nexport type GetERC20AllowanceArgs = {\n walletAddress: string;\n tokenAddress: LpPoolEntity['tokenAddress'];\n tokenDecimals: number;\n spenderAddress: string;\n subject: ethers.Signer;\n};\n\nexport const getERC20Allowance = async ({\n walletAddress,\n tokenAddress,\n tokenDecimals,\n spenderAddress,\n subject,\n}: GetERC20AllowanceArgs): Promise<number> => {\n const tokenContract = getERC20TokenContract(tokenAddress, subject);\n\n const allowance = await exponentialBackoff(() =>\n tokenContract.allowance(walletAddress, spenderAddress),\n );\n\n return BigInt(allowance) > scale(tokenDecimals)(Number.MAX_SAFE_INTEGER)\n ? Number.MAX_SAFE_INTEGER\n : descale(tokenDecimals)(allowance);\n};\n\nexport const getERC20Balance = async ({\n tokenAddress,\n tokenDecimals,\n walletAddress,\n subject,\n}: GetERC20BalanceArgs): Promise<number> => {\n const token = getERC20TokenContract(tokenAddress, subject);\n\n const currentBalance = await exponentialBackoff(() =>\n token.balanceOf(walletAddress),\n );\n\n return descale(tokenDecimals)(currentBalance);\n};\n\nexport const getETHBalance = async ({\n walletAddress,\n subject,\n}: GetETHBalanceArgs): Promise<number> => {\n const provider = subject.provider;\n if (!provider) throw new Error(\"User's provider not found\");\n\n const currentBalance = await exponentialBackoff(() =>\n provider.getBalance(ethers.getAddress(walletAddress)),\n );\n\n return descale(18)(currentBalance);\n};\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRUSDUnderlyingTokenInfo = exports.getTokenInfosByChain = exports.getTokenInfoByName = exports.getTokenInfoByAddress = void 0;
|
|
4
|
+
var token_info_1 = require("./token-info");
|
|
5
|
+
var utils_1 = require("./utils");
|
|
6
|
+
var getTokenInfoByAddress = function (tokenAddressParam, chainId) {
|
|
7
|
+
var tokenAddress = typeof tokenAddressParam === 'string'
|
|
8
|
+
? (0, utils_1.convertToAddress)(tokenAddressParam)
|
|
9
|
+
: tokenAddressParam;
|
|
10
|
+
if (chainId) {
|
|
11
|
+
var tokenInfo = token_info_1.TOKEN_INFO[chainId].find(function (tokenInfo) { return tokenInfo.address === tokenAddress; });
|
|
12
|
+
if (!tokenInfo) {
|
|
13
|
+
throw new Error("getTokenInfoByAddress: no token info found [chainId ".concat(chainId, ", token address ").concat(tokenAddress, "]"));
|
|
14
|
+
}
|
|
15
|
+
return tokenInfo;
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
for (var chainId_1 in token_info_1.TOKEN_INFO) {
|
|
19
|
+
var tokenInfos = token_info_1.TOKEN_INFO[chainId_1];
|
|
20
|
+
var tokenInfo = tokenInfos.find(function (tokenInfo) { return tokenInfo.address === tokenAddress; });
|
|
21
|
+
if (tokenInfo) {
|
|
22
|
+
return tokenInfo;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
throw new Error("getTokenInfoByAddress: no token info found [token address ".concat(tokenAddress, "]"));
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.getTokenInfoByAddress = getTokenInfoByAddress;
|
|
29
|
+
var getTokenInfoByName = function (tokenName, chainId) {
|
|
30
|
+
var tokenInfo = token_info_1.TOKEN_INFO[chainId].find(function (tokenInfo) { return tokenInfo.name === tokenName; });
|
|
31
|
+
if (!tokenInfo) {
|
|
32
|
+
throw new Error("getTokenInfoByName: no token info found [chain id ".concat(chainId, ", token name ").concat(tokenName, "]"));
|
|
33
|
+
}
|
|
34
|
+
return tokenInfo;
|
|
35
|
+
};
|
|
36
|
+
exports.getTokenInfoByName = getTokenInfoByName;
|
|
37
|
+
var getTokenInfosByChain = function (chainId) {
|
|
38
|
+
return token_info_1.TOKEN_INFO[chainId];
|
|
39
|
+
};
|
|
40
|
+
exports.getTokenInfosByChain = getTokenInfosByChain;
|
|
41
|
+
var getRUSDUnderlyingTokenInfo = function (chainId) {
|
|
42
|
+
var tokenInfo = token_info_1.TOKEN_INFO[chainId].find(function (tokenInfo) { return tokenInfo.isRUSDUnderlying === true; });
|
|
43
|
+
if (!tokenInfo) {
|
|
44
|
+
throw new Error("getRUSDUnderlyingTokenInfo: no token info found [chain id ".concat(chainId, "]"));
|
|
45
|
+
}
|
|
46
|
+
return tokenInfo;
|
|
47
|
+
};
|
|
48
|
+
exports.getRUSDUnderlyingTokenInfo = getRUSDUnderlyingTokenInfo;
|
|
49
|
+
//# sourceMappingURL=token-info-getters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-info-getters.js","sourceRoot":"/","sources":["utils/token/token-info-getters.ts"],"names":[],"mappings":";;;AAAA,2CAA0C;AAQ1C,iCAA2C;AAEpC,IAAM,qBAAqB,GAAG,UACnC,iBAAmC,EACnC,OAAyC;IAEzC,IAAM,YAAY,GAChB,OAAO,iBAAiB,KAAK,QAAQ;QACnC,CAAC,CAAC,IAAA,wBAAgB,EAAC,iBAAiB,CAAC;QACrC,CAAC,CAAC,iBAAiB,CAAC;IAExB,IAAI,OAAO,EAAE,CAAC;QACZ,IAAM,SAAS,GAAG,uBAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CACxC,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,OAAO,KAAK,YAAY,EAAlC,CAAkC,CAClD,CAAC;QACF,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,8DAAuD,OAAO,6BAAmB,YAAY,MAAG,CACjG,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;SAAM,CAAC;QACN,KAAK,IAAM,SAAO,IAAI,uBAAU,EAAE,CAAC;YACjC,IAAM,UAAU,GACd,uBAAU,CAAC,SAA6C,CAAC,CAAC;YAC5D,IAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAC/B,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,OAAO,KAAK,YAAY,EAAlC,CAAkC,CAClD,CAAC;YACF,IAAI,SAAS,EAAE,CAAC;gBACd,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QACD,MAAM,IAAI,KAAK,CACb,oEAA6D,YAAY,MAAG,CAC7E,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAlCW,QAAA,qBAAqB,yBAkChC;AAEK,IAAM,kBAAkB,GAAG,UAChC,SAAoB,EACpB,OAAwC;IAExC,IAAM,SAAS,GAAG,uBAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CACxC,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,IAAI,KAAK,SAAS,EAA5B,CAA4B,CAC5C,CAAC;IAEF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,4DAAqD,OAAO,0BAAgB,SAAS,MAAG,CACzF,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAfW,QAAA,kBAAkB,sBAe7B;AAEK,IAAM,oBAAoB,GAAG,UAClC,OAAwC;IAExC,OAAO,uBAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B;AAEK,IAAM,0BAA0B,GAAG,UACxC,OAAwC;IAExC,IAAM,SAAS,GAAG,uBAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CACxC,UAAC,SAAS,IAAK,OAAA,SAAS,CAAC,gBAAgB,KAAK,IAAI,EAAnC,CAAmC,CACnD,CAAC;IAEF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,oEAA6D,OAAO,MAAG,CACxE,CAAC;IACJ,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAdW,QAAA,0BAA0B,8BAcrC","sourcesContent":["import { TOKEN_INFO } from './token-info';\nimport {\n Address,\n MoneyInOutChainId,\n ReyaChainId,\n TokenInfo,\n TokenName,\n} from '../../types';\nimport { convertToAddress } from './utils';\n\nexport const getTokenInfoByAddress = (\n tokenAddressParam: Address | string,\n chainId?: ReyaChainId | MoneyInOutChainId,\n): TokenInfo => {\n const tokenAddress =\n typeof tokenAddressParam === 'string'\n ? convertToAddress(tokenAddressParam)\n : tokenAddressParam;\n\n if (chainId) {\n const tokenInfo = TOKEN_INFO[chainId].find(\n (tokenInfo) => tokenInfo.address === tokenAddress,\n );\n if (!tokenInfo) {\n throw new Error(\n `getTokenInfoByAddress: no token info found [chainId ${chainId}, token address ${tokenAddress}]`,\n );\n }\n return tokenInfo;\n } else {\n for (const chainId in TOKEN_INFO) {\n const tokenInfos =\n TOKEN_INFO[chainId as unknown as keyof typeof TOKEN_INFO];\n const tokenInfo = tokenInfos.find(\n (tokenInfo) => tokenInfo.address === tokenAddress,\n );\n if (tokenInfo) {\n return tokenInfo;\n }\n }\n throw new Error(\n `getTokenInfoByAddress: no token info found [token address ${tokenAddress}]`,\n );\n }\n};\n\nexport const getTokenInfoByName = (\n tokenName: TokenName,\n chainId: ReyaChainId | MoneyInOutChainId,\n): TokenInfo => {\n const tokenInfo = TOKEN_INFO[chainId].find(\n (tokenInfo) => tokenInfo.name === tokenName,\n );\n\n if (!tokenInfo) {\n throw new Error(\n `getTokenInfoByName: no token info found [chain id ${chainId}, token name ${tokenName}]`,\n );\n }\n\n return tokenInfo;\n};\n\nexport const getTokenInfosByChain = (\n chainId: ReyaChainId | MoneyInOutChainId,\n): TokenInfo[] => {\n return TOKEN_INFO[chainId];\n};\n\nexport const getRUSDUnderlyingTokenInfo = (\n chainId: ReyaChainId | MoneyInOutChainId,\n): TokenInfo => {\n const tokenInfo = TOKEN_INFO[chainId].find(\n (tokenInfo) => tokenInfo.isRUSDUnderlying === true,\n );\n\n if (!tokenInfo) {\n throw new Error(\n `getRUSDUnderlyingTokenInfo: no token info found [chain id ${chainId}]`,\n );\n }\n\n return tokenInfo;\n};\n"]}
|
|
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
13
13
|
var _a;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.TOKEN_INFO = void 0;
|
|
16
|
-
var types_1 = require("
|
|
16
|
+
var types_1 = require("../../types");
|
|
17
17
|
var defaultTokenThresholds = {
|
|
18
18
|
minDepositAmount: 10,
|
|
19
19
|
minWithdrawAmount: 10,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-info.js","source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AAQ,EAAE,EAAE,EACZ,gBAAgB,EAAE,KAAK,IACpB,sBAAsB;4BAGzB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,4CAA4C,EACrD,QAAQ,EAAE,EAAE,EACZ,gBAAgB,EAAE,KAAK,IACpB,sBAAsB,KACzB,gBAAgB,EAAE,IAAI,EACtB,iBAAiB,EAAE,IAAI,EACvB,iBAAiB,EAAE,IAAI;mBAGvB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,4CAA4C,EACrD,QAAQ,EAAE,CAAC,EACX,gBAAgB,EAAE,KAAK,IACpB,sBAAsB;KAE5B;QACD","sourcesContent":["import { MoneyInOutChainId, ReyaChainId, TokenInfo } from '../../types';\n\nconst defaultTokenThresholds: Pick<\n TokenInfo,\n 'minDepositAmount' | 'minWithdrawAmount' | 'minTransferAmount'\n> = {\n minDepositAmount: 10,\n minWithdrawAmount: 10,\n minTransferAmount: 10,\n};\n\nexport const TOKEN_INFO: Record<ReyaChainId | MoneyInOutChainId, TokenInfo[]> =\n {\n /* ------------------------------------------------------ */\n /* MAINNET */\n /* ------------------------------------------------------ */\n [ReyaChainId.reyaNetwork]: [\n {\n name: 'RUSD',\n address: '0xa9f32a851b1800742e47725da54a09a7ef2556a3',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDC',\n address: '0x3b860c0b53f2e8bd5264aa7c3451d41263c933f2',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0x6b48c2e6a32077ec17e8ba0d98ffc676dfab1a30',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n [MoneyInOutChainId.ethereumMainnet]: [\n {\n name: 'USDC',\n address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n minWithdrawAmount: 28,\n },\n {\n name: 'WETH',\n address: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',\n decimals: 18,\n isRUSDUnderlying: false,\n whitelistedWalletOnly: true,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n [MoneyInOutChainId.opMainnet]: [\n {\n name: 'USDC.E',\n address: '0x7f5c764cbc14f9669b88837ca1490cca17c31607',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n minWithdrawAmount: 10,\n },\n {\n name: 'WETH',\n address: '0x4200000000000000000000000000000000000006',\n decimals: 18,\n isRUSDUnderlying: false,\n whitelistedWalletOnly: true,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n [MoneyInOutChainId.polygonMainnet]: [\n {\n name: 'USDC.E',\n address: '0x2791bca1f2de4661ed88a30c99a7a9449aa84174',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n minWithdrawAmount: 10,\n },\n {\n name: 'WETH',\n address: '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619',\n decimals: 18,\n isRUSDUnderlying: false,\n whitelistedWalletOnly: true,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n [MoneyInOutChainId.arbitrumOne]: [\n {\n name: 'USDC.E',\n address: '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n minWithdrawAmount: 10,\n },\n {\n name: 'WETH',\n address: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1',\n decimals: 18,\n isRUSDUnderlying: false,\n whitelistedWalletOnly: true,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n [MoneyInOutChainId.baseMainnet]: [\n {\n name: 'USDC',\n address: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n minWithdrawAmount: 10,\n },\n {\n name: 'WETH',\n address: '0x4200000000000000000000000000000000000006',\n decimals: 18,\n isRUSDUnderlying: false,\n whitelistedWalletOnly: true,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n ],\n\n /* ------------------------------------------------------ */\n /* TESTNET */\n /* ------------------------------------------------------ */\n [ReyaChainId.reyaCronos]: [\n {\n name: 'RUSD',\n address: '0x26ee9dfb27f12990d90ec003af7c5e9c19ea2a4c',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDC',\n address: '0x1b700a40a0707dd5f0bc31cbc57d730558e5714d',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDT',\n address: '0x9ade781dacbd220f0161d98f496a2982b231a9d6',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'DAI',\n address: '0x733299259c45726ee1bfc9bd0deeba58e48a1853',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0xc123b7aeb9d2b2e8a035217d5c29e317c91842e2',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n {\n name: 'WBTC',\n address: '0xd382e2f0df859ff9e82f963dcad1aaee939c5e4f',\n decimals: 8,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n ],\n [MoneyInOutChainId.polygonMumbai]: [\n {\n name: 'USDC',\n address: '0xd9edcc943ed9729b08e52bb1e110fe43d1930773',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDT',\n address: '0x4f8ecb190b9ef36113127d97c7f9300875b6563f',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'DAI',\n address: '0x35479b023e508ee9a7b533dbb5b516bb6875f937',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0x6c7a28f6ae2d245b0130520b112fa3544a06d9ae',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n {\n name: 'WBTC',\n address: '0x92c7a51bd507736ac0dda48b5f35a4aad0c2bb4d',\n decimals: 8,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n ],\n [MoneyInOutChainId.arbitrumSepolia]: [\n {\n name: 'USDC',\n address: '0x8537307810fc40f4073a12a38554d4ff78efff41',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDT',\n address: '0x66dfb9987c36c4be232156e70b085f664367599a',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'DAI',\n address: '0x9a573b27d7298c6e2f4d2d4a41c37a0c8af6acca',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0x565810cbfa3cf1390963e5afa2fb953795686339',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n {\n name: 'WBTC',\n address: '0x1019958c2bd43b882a4e1349337a32ef9563fc4d',\n decimals: 8,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n ],\n [MoneyInOutChainId.opSepolia]: [\n {\n name: 'USDC',\n address: '0x6d290609b3f5f02d52f28d97c75a443ed8564cbf',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDT',\n address: '0x2d1aba6fabae80bf5c1c9ea433aae9030e07cb22',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'DAI',\n address: '0xdc0258dc3db980090e97ebf4f1fd9cc3c5ad5894',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0x2b42affd4b7c14d9b7c2579229495c052672ccd3',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n {\n name: 'WBTC',\n address: '0xfc5cc93d85861ac82d89fc2d3e56315540e9c8a7',\n decimals: 8,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n ],\n [MoneyInOutChainId.ethereumSepolia]: [\n {\n name: 'USDC',\n address: '0x565810cbfa3cf1390963e5afa2fb953795686339',\n decimals: 6,\n isRUSDUnderlying: true,\n ...defaultTokenThresholds,\n },\n {\n name: 'USDT',\n address: '0xb4130e87a180b9448286b291331aee8a9c154a3a',\n decimals: 6,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'DAI',\n address: '0x255745e5c7ae620b7f523f5e4a0ead37660ec5d6',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n {\n name: 'WETH',\n address: '0x771d1ae208377453d478df08bbc38034f72ac833',\n decimals: 18,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n minDepositAmount: 0.01,\n minWithdrawAmount: 0.01,\n minTransferAmount: 0.01,\n },\n {\n name: 'WBTC',\n address: '0x94beff5da6201cb2c8f489196fd970b3df5aa32a',\n decimals: 8,\n isRUSDUnderlying: false,\n ...defaultTokenThresholds,\n },\n ],\n };\n"]}
|