@reyaxyz/common 0.336.0 → 0.338.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/dist/incentives-api-types.js.map +1 -1
- package/dist/transactions/executeTransaction.js +1 -1
- package/dist/transactions/executeTransaction.js.map +1 -1
- package/dist/types/incentives-api-types.d.ts +2 -6
- package/dist/types/incentives-api-types.d.ts.map +1 -1
- package/dist/types/transactions/executeTransaction.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/incentives-api-types.ts +5 -11
- package/src/transactions/executeTransaction.ts +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incentives-api-types.js","sourceRoot":"/","sources":["incentives-api-types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AddressParam,\n ApiEndpoint,\n ApiInfiniteListEndpoint,\n ApiListEndpoint,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\nimport { Rank, RankTrading } from './types';\n\nexport type PointsBreakdown = {\n totalPoints: number;\n tradingPoints: number;\n stakingPoints: number;\n signalPoints: number;\n rank: number;\n};\n\nexport type IncentivesUserPointsData = {\n weekly: PointsBreakdown;\n total: PointsBreakdown;\n};\n\nexport type IncentivesUserRanks = {\n walletAddress: string;\n tradingRank: RankTrading;\n stakingRank: Rank;\n};\n\nexport type IncentivesUserBoosts = {\n walletAddress: string;\n tradingBoost: number;\n stakingBoost: number;\n loyaltyBoost: number;\n};\n\nexport type IncentivesUserSummaryData = {\n walletAddress: string;\n points: IncentivesUserPointsData;\n ranks: Omit<IncentivesUserRanks, 'walletAddress'>;\n boosts: Omit<IncentivesUserBoosts, 'walletAddress'>;\n};\n\nexport type IncentivesLeaderBoardEntry = {\n rank: number;\n walletAddress: string;\n totalPoints: number;\n tradingPoints: number;\n stakingPoints: number;\n signalPoints: number;\n isCurrentUser?: boolean;\n};\n\nexport type IncentivesRankingHistoryEntry = {\n week: number;\n createdAt: Date;\n tradingRank: RankTrading;\n stakingRank: Rank;\n tradingPoints: number;\n stakingPoints: number;\n};\n\nexport type IncentivesPointsHistoryEntry = {\n walletAddress: string;\n totalXpOG: number;\n totalXpOGRanked: number;\n liquidityReferralXpOG: number;\n liquidityXpOG: number;\n rankMultiplierOG: number;\n rankOG: Rank;\n stakingPointsOG: number;\n liquidityReferralXpSeason1: number;\n liquidityXpSeason1: number;\n liquidityXpSeason1Ranked: number;\n rankMultiplierSeason1: number;\n rankSeason1: Rank;\n stakingPointsSeason1: number;\n tradingReferralXpSeason1: number;\n tradingXpSeason1: number;\n tradingXpSeason1Ranked: number;\n tradingRankMultiplierSeason1: number;\n tradingRankSeason1: RankTrading;\n tradingPointsSeason1: number;\n liquidityReferralXpSeason2: number;\n liquidityXpSeason2: number;\n rankSeason2: Rank;\n stakingPointsSeason2: number;\n tradingReferralXpSeason2: number;\n tradingXpSeason2: number;\n tradingRankSeason2: RankTrading;\n tradingPointsSeason2: number;\n totalLiquidityXp: number;\n totalLiquidityReferralXp: number;\n totalTradingXp: number;\n totalTradingReferralXp: number;\n totalXp: number;\n totalPoints: number;\n};\n\nexport type LeaderBoardParams = { type: 'weekly' | 'total' };\n\nexport type TradingCompetitionRoundParams = { round: number };\n\nexport type TradingCompetitionUserSummaryData
|
|
1
|
+
{"version":3,"file":"incentives-api-types.js","sourceRoot":"/","sources":["incentives-api-types.ts"],"names":[],"mappings":"","sourcesContent":["import {\n AddressParam,\n ApiEndpoint,\n ApiInfiniteListEndpoint,\n ApiListEndpoint,\n PaginatedQueryParams,\n Stringified,\n} from './api-types';\nimport { Rank, RankTrading } from './types';\n\nexport type PointsBreakdown = {\n totalPoints: number;\n tradingPoints: number;\n stakingPoints: number;\n signalPoints: number;\n rank: number;\n};\n\nexport type IncentivesUserPointsData = {\n weekly: PointsBreakdown;\n total: PointsBreakdown;\n};\n\nexport type IncentivesUserRanks = {\n walletAddress: string;\n tradingRank: RankTrading;\n stakingRank: Rank;\n};\n\nexport type IncentivesUserBoosts = {\n walletAddress: string;\n tradingBoost: number;\n stakingBoost: number;\n loyaltyBoost: number;\n};\n\nexport type IncentivesUserSummaryData = {\n walletAddress: string;\n points: IncentivesUserPointsData;\n ranks: Omit<IncentivesUserRanks, 'walletAddress'>;\n boosts: Omit<IncentivesUserBoosts, 'walletAddress'>;\n};\n\nexport type IncentivesLeaderBoardEntry = {\n rank: number;\n walletAddress: string;\n totalPoints: number;\n tradingPoints: number;\n stakingPoints: number;\n signalPoints: number;\n isCurrentUser?: boolean;\n};\n\nexport type IncentivesRankingHistoryEntry = {\n week: number;\n createdAt: Date;\n tradingRank: RankTrading;\n stakingRank: Rank;\n tradingPoints: number;\n stakingPoints: number;\n};\n\nexport type IncentivesPointsHistoryEntry = {\n walletAddress: string;\n totalXpOG: number;\n totalXpOGRanked: number;\n liquidityReferralXpOG: number;\n liquidityXpOG: number;\n rankMultiplierOG: number;\n rankOG: Rank;\n stakingPointsOG: number;\n liquidityReferralXpSeason1: number;\n liquidityXpSeason1: number;\n liquidityXpSeason1Ranked: number;\n rankMultiplierSeason1: number;\n rankSeason1: Rank;\n stakingPointsSeason1: number;\n tradingReferralXpSeason1: number;\n tradingXpSeason1: number;\n tradingXpSeason1Ranked: number;\n tradingRankMultiplierSeason1: number;\n tradingRankSeason1: RankTrading;\n tradingPointsSeason1: number;\n liquidityReferralXpSeason2: number;\n liquidityXpSeason2: number;\n rankSeason2: Rank;\n stakingPointsSeason2: number;\n tradingReferralXpSeason2: number;\n tradingXpSeason2: number;\n tradingRankSeason2: RankTrading;\n tradingPointsSeason2: number;\n totalLiquidityXp: number;\n totalLiquidityReferralXp: number;\n totalTradingXp: number;\n totalTradingReferralXp: number;\n totalXp: number;\n totalPoints: number;\n};\n\nexport type LeaderBoardParams = { type: 'weekly' | 'total' };\n\nexport type TradingCompetitionRoundParams = { round: number };\n\nexport type TradingCompetitionUserSummaryData = {\n realizedPnl: number;\n eligible: boolean;\n position: number | null;\n};\n\nexport type TradingCompetitionLeaderboardEntry = {\n walletAddress: string;\n realizedPnl: number;\n position: number;\n};\n\nexport type IncentivesApiSource = {\n 'incentives/points': ApiEndpoint<\n {\n total: number;\n weekly: number;\n },\n never\n >;\n\n 'incentives/leaderBoard/:type': ApiInfiniteListEndpoint<\n IncentivesLeaderBoardEntry,\n LeaderBoardParams,\n PaginatedQueryParams\n >;\n\n 'incentives/wallet/:address': ApiEndpoint<\n IncentivesUserSummaryData,\n AddressParam\n >;\n\n 'incentives/wallet/:address/referralsLeaderBoard/:type': ApiListEndpoint<\n IncentivesLeaderBoardEntry,\n AddressParam & LeaderBoardParams\n >;\n\n 'incentives/wallet/:address/leaderBoard/:type': ApiEndpoint<\n IncentivesLeaderBoardEntry,\n AddressParam & LeaderBoardParams\n >;\n\n 'incentives/wallet/:address/ranksHistory': ApiListEndpoint<\n IncentivesRankingHistoryEntry,\n AddressParam\n >;\n\n 'incentives/wallet/:address/signalPoints': ApiListEndpoint<\n {\n createdAt: Date;\n points: number;\n reason: string;\n },\n AddressParam\n >;\n\n 'incentives/wallet/:address/pointsHistory': ApiEndpoint<\n IncentivesPointsHistoryEntry,\n AddressParam\n >;\n\n 'incentives/tradingCompetition/:round': ApiEndpoint<\n {\n entries: TradingCompetitionLeaderboardEntry[];\n refreshedAt: number;\n },\n TradingCompetitionRoundParams\n >;\n\n 'incentives/wallet/:address/tradingCompetition/:round': ApiEndpoint<\n TradingCompetitionUserSummaryData,\n AddressParam & TradingCompetitionRoundParams\n >;\n};\n\nexport type IncentivesApi = {\n [K in keyof IncentivesApiSource]: {\n params: IncentivesApiSource[K]['params'];\n query: IncentivesApiSource[K]['query'];\n response: Stringified<IncentivesApiSource[K]['response']>;\n };\n};\n"]}
|
|
@@ -181,7 +181,7 @@ function estimateGasExternalChains(signer, data, value, chainId, targetContract)
|
|
|
181
181
|
case 5:
|
|
182
182
|
decodedError = _a.sent();
|
|
183
183
|
reason = customReasonMapper(decodedError);
|
|
184
|
-
console.error("Error simulating external transaction with value ".concat(value, ", account address ").concat(accountAddress, ", reason ").concat(decodedError === null || decodedError === void 0 ? void 0 : decodedError.name, " ").concat(decodedError, " ").concat(error_3));
|
|
184
|
+
console.error("Error simulating external transaction with value ".concat(value, ", account address ").concat(accountAddress, ", reason ").concat(decodedError === null || decodedError === void 0 ? void 0 : decodedError.name, " ").concat(JSON.stringify(decodedError), " ").concat(error_3));
|
|
185
185
|
throw new Error(reason);
|
|
186
186
|
case 6:
|
|
187
187
|
if (Object.values(types_1.ReyaChainId).includes(chainId)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAMgB;AAChB,kCAA0D;AAC1D,yDAA+D;AAC/D,kDAAyC;AACzC,2DAAmD;AAEnD,yCAA2C;AAC3C,kCAAmD;AACnD,iCAAmC;AAEnC,IAAM,oBAAoB;IACxB,GAAC,mBAAW,CAAC,WAAW,IACtB,2DAA2D;IAC7D,GAAC,mBAAW,CAAC,UAAU,IACrB,yEAAyE;OAC5E,CAAC;AAQF,IAAM,YAAY,GAAG,kCAAY,CAAC,MAAM,CAAC,CAAC,iBAAG,CAAC,CAAC,CAAC;AAEhD,SAAsB,WAAW,CAC/B,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;wBAQd,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAEhD,sBAAO,uBAAuB,CAC5B,cAAc,EACd,IAAI,EACJ,KAAK,EACL,OAAO,EACP,cAAc,CACf,EAAC;;;;CACH;AAtBD,kCAsBC;AAED,mDAAmD;AACnD,SAAsB,uBAAuB,CAC3C,cAAsB,EACtB,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;;oBAQ/B,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAY,CAAC,CAAC,QAAQ,CAC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\n Network,\n Signer,\n} from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../types';\nimport { ContractType, getAddress } from './contractAddresses';\nimport { abi } from './abis/Errors.json';\nimport { ErrorDecoder } from 'ethers-decode-error';\nimport type { DecodedError } from 'ethers-decode-error';\nimport { getGasBuffer } from './txHelpers';\nimport { getPublicRpcUrlsOrThrow } from '../utils';\nimport { Interface } from 'ethers';\n\nconst reyaChainIdRPCMapper: { [key: number]: string } = {\n [ReyaChainId.reyaNetwork]:\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n [ReyaChainId.reyaCronos]:\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n};\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\nconst errorDecoder = ErrorDecoder.create([abi]);\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n return estimateGasGivenAddress(\n accountAddress,\n data,\n value,\n chainId,\n targetContract,\n );\n}\n\n// TODO: deprecate this when /executeGelato is gone\nexport async function estimateGasGivenAddress(\n accountAddress: string,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const network = new Network('Reya', chainId);\n const provider = new JsonRpcProvider(\n reyaChainIdRPCMapper[chainId],\n network,\n {\n staticNetwork: network,\n pollingInterval: 50,\n },\n );\n await provider.call(tx);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function estimateGasFromTxAndChainId(\n chainId: ReyaChainId | MoneyInOutChainId,\n tx: ethers.TransactionRequest,\n): Promise<bigint> {\n const rpcUrls = getPublicRpcUrlsOrThrow(chainId);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const estimation = await provider.estimateGas(tx);\n return addGasBuffer(estimation);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n}\n\nasync function estimateGasExternalChains(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating external transaction with value ${value}, account address ${accountAddress}, reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGasExternalChains(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\nconst customReasonMapper = ({ name, reason }: DecodedError): string => {\n switch (name) {\n case 'SignatureInvalid':\n return `Invalid signature. Please refresh page and try again`;\n case 'StalePriceDetected':\n return `Price not updated, please try again a bit later`;\n case 'SmallOrderSize':\n return `Order size below minimum`;\n case 'DustyOrderSize':\n return `Order amount is not divisible by trade size spacing`;\n case 'AccountBelowIM':\n return `Account below required margin`;\n default:\n // This handles the non-custom errors\n return reason ?? 'Error executing transaction';\n }\n};\n\nfunction addGasBuffer(estimation: bigint): bigint {\n return (estimation * BigInt(120)) / BigInt(100);\n}\n\nexport async function decodeErrorBytes(returnData: string): Promise<string> {\n const INTERFACE = new Interface(abi);\n const decodedError = INTERFACE.parseError(returnData);\n console.log(decodedError);\n return `${decodedError?.name}: ${decodedError?.args}` || 'Error not found';\n}\n"]}
|
|
1
|
+
{"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["transactions/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAMgB;AAChB,kCAA0D;AAC1D,yDAA+D;AAC/D,kDAAyC;AACzC,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gB;YACnB,OAAO,qDAAqD,CAAC;QAC/D,KAAK,gBAAgB;YACnB,OAAO,+BAA+B,CAAC;QACzC;YACE,qCAAqC;YACrC,OAAO,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,6BAA6B,CAAC;IACnD,CAAC;AACH,CAAC,CAAC;AAEF,SAAS,YAAY,CAAC,UAAkB;IACtC,OAAO,CAAC,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC;AAED,SAAsB,gBAAgB,CAAC,UAAkB;;;;YACjD,SAAS,GAAG,IAAI,kBAAS,CAAC,iBAAG,CAAC,CAAC;YAC/B,YAAY,GAAG,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACtD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAC1B,sBAAO,UAAG,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,eAAK,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,CAAE,IAAI,iBAAiB,EAAC;;;CAC5E;AALD,4CAKC","sourcesContent":["import {\n ethers,\n JsonRpcProvider,\n JsonRpcSigner,\n Network,\n Signer,\n} from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId } from '../types';\nimport { ContractType, getAddress } from './contractAddresses';\nimport { abi } from './abis/Errors.json';\nimport { ErrorDecoder } from 'ethers-decode-error';\nimport type { DecodedError } from 'ethers-decode-error';\nimport { getGasBuffer } from './txHelpers';\nimport { getPublicRpcUrlsOrThrow } from '../utils';\nimport { Interface } from 'ethers';\n\nconst reyaChainIdRPCMapper: { [key: number]: string } = {\n [ReyaChainId.reyaNetwork]:\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n [ReyaChainId.reyaCronos]:\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n};\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\nconst errorDecoder = ErrorDecoder.create([abi]);\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n return estimateGasGivenAddress(\n accountAddress,\n data,\n value,\n chainId,\n targetContract,\n );\n}\n\n// TODO: deprecate this when /executeGelato is gone\nexport async function estimateGasGivenAddress(\n accountAddress: string,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n\n const tx = {\n from: accountAddress, // @todo Update with relayer address\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const network = new Network('Reya', chainId);\n const provider = new JsonRpcProvider(\n reyaChainIdRPCMapper[chainId],\n network,\n {\n staticNetwork: network,\n pollingInterval: 50,\n },\n );\n await provider.call(tx);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating transaction account address ${accountAddress} reason ${decodedError?.name} ${decodedError} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function estimateGasFromTxAndChainId(\n chainId: ReyaChainId | MoneyInOutChainId,\n tx: ethers.TransactionRequest,\n): Promise<bigint> {\n const rpcUrls = getPublicRpcUrlsOrThrow(chainId);\n let lastError = null;\n\n for (const url of rpcUrls) {\n try {\n const provider = new ethers.JsonRpcProvider(url);\n const estimation = await provider.estimateGas(tx);\n return addGasBuffer(estimation);\n } catch (error) {\n lastError = error;\n }\n }\n\n throw new Error('All RPC URLs failed; last error: ' + lastError);\n}\n\nasync function estimateGasExternalChains(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<\n Transaction & {\n gasLimit: bigint;\n maxPriorityFeePerGas?: bigint;\n maxFeePerGas?: bigint;\n }\n> {\n const accountAddress = await signer.getAddress();\n\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n let gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit if fails to get estimate\n\n try {\n const gasEstimate = await signer.estimateGas(tx);\n gasLimit = getGasBuffer(gasEstimate);\n } catch (error) {\n const decodedError = await errorDecoder.decode(error);\n const reason = customReasonMapper(decodedError);\n console.error(\n `Error simulating external transaction with value ${value}, account address ${accountAddress}, reason ${decodedError?.name} ${JSON.stringify(\n decodedError,\n )} ${error}`,\n );\n throw new Error(reason);\n }\n\n if (Object.values(ReyaChainId).includes(chainId as ReyaChainId)) {\n const maxPriorityFeePerGas: bigint = BigInt('0');\n const maxFeePerGas: bigint = BigInt('100000000');\n return { ...tx, gasLimit, maxPriorityFeePerGas, maxFeePerGas };\n }\n\n return { ...tx, gasLimit };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGasExternalChains(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\nconst customReasonMapper = ({ name, reason }: DecodedError): string => {\n switch (name) {\n case 'SignatureInvalid':\n return `Invalid signature. Please refresh page and try again`;\n case 'StalePriceDetected':\n return `Price not updated, please try again a bit later`;\n case 'SmallOrderSize':\n return `Order size below minimum`;\n case 'DustyOrderSize':\n return `Order amount is not divisible by trade size spacing`;\n case 'AccountBelowIM':\n return `Account below required margin`;\n default:\n // This handles the non-custom errors\n return reason ?? 'Error executing transaction';\n }\n};\n\nfunction addGasBuffer(estimation: bigint): bigint {\n return (estimation * BigInt(120)) / BigInt(100);\n}\n\nexport async function decodeErrorBytes(returnData: string): Promise<string> {\n const INTERFACE = new Interface(abi);\n const decodedError = INTERFACE.parseError(returnData);\n console.log(decodedError);\n return `${decodedError?.name}: ${decodedError?.args}` || 'Error not found';\n}\n"]}
|
|
@@ -89,11 +89,8 @@ export type TradingCompetitionRoundParams = {
|
|
|
89
89
|
};
|
|
90
90
|
export type TradingCompetitionUserSummaryData = {
|
|
91
91
|
realizedPnl: number;
|
|
92
|
-
eligible:
|
|
93
|
-
|
|
94
|
-
realizedPnl: number;
|
|
95
|
-
eligible: true;
|
|
96
|
-
position: number;
|
|
92
|
+
eligible: boolean;
|
|
93
|
+
position: number | null;
|
|
97
94
|
};
|
|
98
95
|
export type TradingCompetitionLeaderboardEntry = {
|
|
99
96
|
walletAddress: string;
|
|
@@ -118,7 +115,6 @@ export type IncentivesApiSource = {
|
|
|
118
115
|
'incentives/wallet/:address/pointsHistory': ApiEndpoint<IncentivesPointsHistoryEntry, AddressParam>;
|
|
119
116
|
'incentives/tradingCompetition/:round': ApiEndpoint<{
|
|
120
117
|
entries: TradingCompetitionLeaderboardEntry[];
|
|
121
|
-
totalCount: number;
|
|
122
118
|
refreshedAt: number;
|
|
123
119
|
}, TradingCompetitionRoundParams>;
|
|
124
120
|
'incentives/wallet/:address/tradingCompetition/:round': ApiEndpoint<TradingCompetitionUserSummaryData, AddressParam & TradingCompetitionRoundParams>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incentives-api-types.d.ts","sourceRoot":"/","sources":["incentives-api-types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,eAAe,CAAC;IACxB,KAAK,EAAE,eAAe,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,IAAI,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,wBAAwB,CAAC;IACjC,KAAK,EAAE,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAClD,MAAM,EAAE,IAAI,CAAC,oBAAoB,EAAE,eAAe,CAAC,CAAC;CACrD,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;I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,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,6CAkBtC;AAuBD,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAK1E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.338.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "pnpm@8.3.1",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "79cb06bed6febe7022434ffd971117230e59dccf"
|
|
48
48
|
}
|
|
@@ -101,16 +101,11 @@ export type LeaderBoardParams = { type: 'weekly' | 'total' };
|
|
|
101
101
|
|
|
102
102
|
export type TradingCompetitionRoundParams = { round: number };
|
|
103
103
|
|
|
104
|
-
export type TradingCompetitionUserSummaryData =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
| {
|
|
110
|
-
realizedPnl: number;
|
|
111
|
-
eligible: true;
|
|
112
|
-
position: number;
|
|
113
|
-
};
|
|
104
|
+
export type TradingCompetitionUserSummaryData = {
|
|
105
|
+
realizedPnl: number;
|
|
106
|
+
eligible: boolean;
|
|
107
|
+
position: number | null;
|
|
108
|
+
};
|
|
114
109
|
|
|
115
110
|
export type TradingCompetitionLeaderboardEntry = {
|
|
116
111
|
walletAddress: string;
|
|
@@ -170,7 +165,6 @@ export type IncentivesApiSource = {
|
|
|
170
165
|
'incentives/tradingCompetition/:round': ApiEndpoint<
|
|
171
166
|
{
|
|
172
167
|
entries: TradingCompetitionLeaderboardEntry[];
|
|
173
|
-
totalCount: number;
|
|
174
168
|
refreshedAt: number;
|
|
175
169
|
},
|
|
176
170
|
TradingCompetitionRoundParams
|
|
@@ -167,7 +167,9 @@ async function estimateGasExternalChains(
|
|
|
167
167
|
const decodedError = await errorDecoder.decode(error);
|
|
168
168
|
const reason = customReasonMapper(decodedError);
|
|
169
169
|
console.error(
|
|
170
|
-
`Error simulating external transaction with value ${value}, account address ${accountAddress}, reason ${decodedError?.name} ${
|
|
170
|
+
`Error simulating external transaction with value ${value}, account address ${accountAddress}, reason ${decodedError?.name} ${JSON.stringify(
|
|
171
|
+
decodedError,
|
|
172
|
+
)} ${error}`,
|
|
171
173
|
);
|
|
172
174
|
throw new Error(reason);
|
|
173
175
|
}
|