@alphafi/alphafi-sdk 0.0.36 → 0.0.38
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 +130 -12
- package/dist/cjs/common/constants.d.ts +90 -0
- package/dist/cjs/common/constants.d.ts.map +1 -1
- package/dist/cjs/common/constants.js +67 -5
- package/dist/cjs/common/constants.js.map +1 -1
- package/dist/cjs/common/maps.d.ts +2 -0
- package/dist/cjs/common/maps.d.ts.map +1 -1
- package/dist/cjs/common/maps.js +94 -0
- package/dist/cjs/common/maps.js.map +1 -1
- package/dist/cjs/common/types.d.ts +2 -2
- package/dist/cjs/common/types.d.ts.map +1 -1
- package/dist/cjs/common/types.js.map +1 -1
- package/dist/cjs/getAllVaults.d.ts.map +1 -1
- package/dist/cjs/getAllVaults.js +5 -2
- package/dist/cjs/getAllVaults.js.map +1 -1
- package/dist/cjs/getVaultBalances.d.ts.map +1 -1
- package/dist/cjs/getVaultBalances.js +0 -1
- package/dist/cjs/getVaultBalances.js.map +1 -1
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +15 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.d.ts +3 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.d.ts.map +1 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.js +44 -0
- package/dist/cjs/sui-sdk/events/fetchCheckRatioEvents.js.map +1 -0
- package/dist/cjs/sui-sdk/events/fetchEvents.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/fetchEvents.js +41 -0
- package/dist/cjs/sui-sdk/events/fetchEvents.js.map +1 -1
- package/dist/cjs/sui-sdk/events/types.d.ts +9 -1
- package/dist/cjs/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/events/types.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaults.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/fetchUserVaults.js +4 -2
- package/dist/cjs/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts +4 -4
- package/dist/cjs/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/cjs/sui-sdk/functions/getReceipts.js +26 -28
- package/dist/cjs/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/cjs/transactions/alpha.d.ts +4 -0
- package/dist/cjs/transactions/alpha.d.ts.map +1 -0
- package/dist/cjs/transactions/alpha.js +104 -0
- package/dist/cjs/transactions/alpha.js.map +1 -0
- package/dist/cjs/transactions/bluefin.d.ts +15 -0
- package/dist/cjs/transactions/bluefin.d.ts.map +1 -0
- package/dist/cjs/transactions/bluefin.js +457 -0
- package/dist/cjs/transactions/bluefin.js.map +1 -0
- package/dist/cjs/transactions/bucket.d.ts +8 -0
- package/dist/cjs/transactions/bucket.d.ts.map +1 -0
- package/dist/cjs/transactions/bucket.js +131 -0
- package/dist/cjs/transactions/bucket.js.map +1 -0
- package/dist/cjs/transactions/cetus.d.ts +24 -0
- package/dist/cjs/transactions/cetus.d.ts.map +1 -0
- package/dist/cjs/transactions/cetus.js +552 -0
- package/dist/cjs/transactions/cetus.js.map +1 -0
- package/dist/cjs/transactions/collect_rewards.d.ts +3 -0
- package/dist/cjs/transactions/collect_rewards.d.ts.map +1 -0
- package/dist/cjs/transactions/collect_rewards.js +332 -0
- package/dist/cjs/transactions/collect_rewards.js.map +1 -0
- package/dist/cjs/transactions/deposit.d.ts +5 -0
- package/dist/cjs/transactions/deposit.d.ts.map +1 -0
- package/dist/cjs/transactions/deposit.js +57 -0
- package/dist/cjs/transactions/deposit.js.map +1 -0
- package/dist/cjs/transactions/navi.d.ts +9 -0
- package/dist/cjs/transactions/navi.d.ts.map +1 -0
- package/dist/cjs/transactions/navi.js +618 -0
- package/dist/cjs/transactions/navi.js.map +1 -0
- package/dist/cjs/transactions/withdraw.d.ts +6 -0
- package/dist/cjs/transactions/withdraw.d.ts.map +1 -0
- package/dist/cjs/transactions/withdraw.js +66 -0
- package/dist/cjs/transactions/withdraw.js.map +1 -0
- package/dist/cjs/transactions/zapDeposit.d.ts +1 -0
- package/dist/cjs/transactions/zapDeposit.d.ts.map +1 -0
- package/dist/cjs/transactions/zapDeposit.js +730 -0
- package/dist/cjs/transactions/zapDeposit.js.map +1 -0
- package/dist/esm/common/constants.d.ts +90 -0
- package/dist/esm/common/constants.d.ts.map +1 -1
- package/dist/esm/common/constants.js +67 -5
- package/dist/esm/common/constants.js.map +1 -1
- package/dist/esm/common/maps.d.ts +2 -0
- package/dist/esm/common/maps.d.ts.map +1 -1
- package/dist/esm/common/maps.js +94 -0
- package/dist/esm/common/maps.js.map +1 -1
- package/dist/esm/common/types.d.ts +2 -2
- package/dist/esm/common/types.d.ts.map +1 -1
- package/dist/esm/common/types.js.map +1 -1
- package/dist/esm/getAllVaults.d.ts.map +1 -1
- package/dist/esm/getAllVaults.js +5 -2
- package/dist/esm/getAllVaults.js.map +1 -1
- package/dist/esm/getVaultBalances.d.ts.map +1 -1
- package/dist/esm/getVaultBalances.js +0 -1
- package/dist/esm/getVaultBalances.js.map +1 -1
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.d.ts +3 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.d.ts.map +1 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.js +41 -0
- package/dist/esm/sui-sdk/events/fetchCheckRatioEvents.js.map +1 -0
- package/dist/esm/sui-sdk/events/fetchEvents.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/fetchEvents.js +41 -0
- package/dist/esm/sui-sdk/events/fetchEvents.js.map +1 -1
- package/dist/esm/sui-sdk/events/types.d.ts +9 -1
- package/dist/esm/sui-sdk/events/types.d.ts.map +1 -1
- package/dist/esm/sui-sdk/events/types.js.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaults.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/fetchUserVaults.js +4 -2
- package/dist/esm/sui-sdk/functions/fetchUserVaults.js.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts +4 -4
- package/dist/esm/sui-sdk/functions/getReceipts.d.ts.map +1 -1
- package/dist/esm/sui-sdk/functions/getReceipts.js +26 -28
- package/dist/esm/sui-sdk/functions/getReceipts.js.map +1 -1
- package/dist/esm/transactions/alpha.d.ts +4 -0
- package/dist/esm/transactions/alpha.d.ts.map +1 -0
- package/dist/esm/transactions/alpha.js +99 -0
- package/dist/esm/transactions/alpha.js.map +1 -0
- package/dist/esm/transactions/bluefin.d.ts +15 -0
- package/dist/esm/transactions/bluefin.d.ts.map +1 -0
- package/dist/esm/transactions/bluefin.js +450 -0
- package/dist/esm/transactions/bluefin.js.map +1 -0
- package/dist/esm/transactions/bucket.d.ts +8 -0
- package/dist/esm/transactions/bucket.d.ts.map +1 -0
- package/dist/esm/transactions/bucket.js +127 -0
- package/dist/esm/transactions/bucket.js.map +1 -0
- package/dist/esm/transactions/cetus.d.ts +24 -0
- package/dist/esm/transactions/cetus.d.ts.map +1 -0
- package/dist/esm/transactions/cetus.js +539 -0
- package/dist/esm/transactions/cetus.js.map +1 -0
- package/dist/esm/transactions/collect_rewards.d.ts +3 -0
- package/dist/esm/transactions/collect_rewards.d.ts.map +1 -0
- package/dist/esm/transactions/collect_rewards.js +329 -0
- package/dist/esm/transactions/collect_rewards.js.map +1 -0
- package/dist/esm/transactions/deposit.d.ts +5 -0
- package/dist/esm/transactions/deposit.d.ts.map +1 -0
- package/dist/esm/transactions/deposit.js +53 -0
- package/dist/esm/transactions/deposit.js.map +1 -0
- package/dist/esm/transactions/navi.d.ts +9 -0
- package/dist/esm/transactions/navi.d.ts.map +1 -0
- package/dist/esm/transactions/navi.js +614 -0
- package/dist/esm/transactions/navi.js.map +1 -0
- package/dist/esm/transactions/withdraw.d.ts +6 -0
- package/dist/esm/transactions/withdraw.d.ts.map +1 -0
- package/dist/esm/transactions/withdraw.js +61 -0
- package/dist/esm/transactions/withdraw.js.map +1 -0
- package/dist/esm/transactions/zapDeposit.d.ts +2 -0
- package/dist/esm/transactions/zapDeposit.d.ts.map +1 -0
- package/dist/esm/transactions/zapDeposit.js +730 -0
- package/dist/esm/transactions/zapDeposit.js.map +1 -0
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchEvents.js","sourceRoot":"","sources":["../../../../src/sui-sdk/events/fetchEvents.ts"],"names":[],"mappings":";;AAsBA,kCA2RC;AAjTD,4CAA4C;AAmB5C,kDAAgD;AAChD,4DAA2D;AAEpD,KAAK,UAAU,WAAW,CAC/B,MAAyB;IAEzB,MAAM,SAAS,GAAgB,EAAE,CAAC;IAClC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,WAAW,GAA+B,IAAI,CAAC;IAEnD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CACV,kFAAkF,CACnF,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,kBAAkB,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,6BAA6B;IACnF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CA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AAC;SACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;IACxC,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACxC,CAAC,CAAC","sourcesContent":["import { getSuiClient } from \"../client.js\";\nimport { EventId, PaginatedEvents } from \"@mysten/sui/client\";\nimport {\n AlphaLiquidityChangeEvent,\n AlphaAutoCompoundingEvent,\n CetusAutoCompoundingEvent,\n CetusLiquidityChangeEvent,\n EventNode,\n FetchEventsParams,\n LiquidityChangeEventNode,\n NaviAutoCompoundingEvent,\n NaviLoopAutoCompoundingEvent,\n NaviLiquidityChangeEvent,\n RebalanceEvent,\n AutoCompoundingEventNode,\n AlphaWithdrawV2Event,\n WithdrawV2EventNode,\n AfterTransactionEventNode,\n} from \"./types.js\";\nimport { poolInfo } from \"../../common/maps.js\";\nimport { conf, CONF_ENV } from \"../../common/constants.js\";\n\nexport async function fetchEvents(\n params: FetchEventsParams,\n): Promise<EventNode[]> {\n const allEvents: EventNode[] = [];\n let hasNextPage = true;\n let startCursor: EventId | null | undefined = null;\n\n if (params.eventTypes.length > 1) {\n console.warn(\n \"Multiple eventTypes not supported right now, pass only one element in the array.\",\n );\n }\n\n if (params.eventTypes.length < 1) {\n hasNextPage = false;\n }\n\n const now = Date.now();\n const twentyFourHoursAgo = now - 24 * 60 * 60 * 1000; // timestamp for 24 hours ago\n const startTime = params.startTime ? params.startTime : twentyFourHoursAgo;\n const endTime = params.endTime ? params.endTime : now;\n\n if (startTime >= endTime) {\n throw new Error(\"startTime must be less than endTime\");\n }\n\n const suiClient = getSuiClient();\n //const prevTS = 0;\n\n while (hasNextPage) {\n const result: PaginatedEvents = await suiClient.queryEvents({\n cursor: startCursor,\n order: \"descending\",\n query: {\n MoveEventType: params.eventTypes[0],\n },\n });\n\n const se = result.data;\n for (let i = 0; i < se.length; i++) {\n const suiEvent = se[i];\n\n if (Number(suiEvent.timestampMs) > endTime) {\n continue;\n }\n\n if (Number(suiEvent.timestampMs) < startTime) {\n hasNextPage = false; // Stop further pagination\n break; // Exit the loop\n }\n\n const suiEventJson = suiEvent.parsedJson as\n | CetusAutoCompoundingEvent\n | NaviAutoCompoundingEvent\n | NaviLoopAutoCompoundingEvent\n | RebalanceEvent\n | CetusLiquidityChangeEvent\n | AlphaLiquidityChangeEvent\n | NaviLiquidityChangeEvent\n | AlphaAutoCompoundingEvent\n | AlphaWithdrawV2Event\n | AfterTransactionEventNode;\n\n let eventNode: EventNode;\n\n if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"compound_amount_a\" in suiEventJson &&\n \"compound_amount_b\" in suiEventJson\n ) {\n // Handling CetusAutoCompoundingEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n compound_amount_a: BigInt(suiEventJson.compound_amount_a.toString()),\n compound_amount_b: BigInt(suiEventJson.compound_amount_b.toString()),\n current_liquidity: BigInt(suiEventJson.current_liquidity.toString()),\n fee_collected_a: BigInt(suiEventJson.fee_collected_a.toString()),\n fee_collected_b: BigInt(suiEventJson.fee_collected_b.toString()),\n free_balance_a: BigInt(suiEventJson.free_balance_a.toString()),\n free_balance_b: BigInt(suiEventJson.free_balance_b.toString()),\n investor_id: suiEventJson.investor_id,\n total_amount_a: BigInt(suiEventJson.total_amount_a.toString()),\n total_amount_b: BigInt(suiEventJson.total_amount_b.toString()),\n };\n\n // if (\n // eventNode.investor_id ===\n // \"0xd060e81548aee885bd3d37ae0caec181185be792bf45412e0d0acccd1e0174e6\"\n // ) {\n // console.log(\n // eventNode.timestamp,\n // (prevTS - eventNode.timestamp) / (1000 * 60),\n // );\n // prevTS = eventNode.timestamp;\n // }\n } else if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"compound_amount\" in suiEventJson\n ) {\n // Handling NaviAutoCompoundingEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n compound_amount: BigInt(suiEventJson.compound_amount.toString()),\n fee_collected: BigInt(suiEventJson.fee_collected.toString()),\n investor_id: suiEventJson.investor_id,\n location: suiEventJson.location,\n total_amount: BigInt(suiEventJson.total_amount.toString()),\n };\n if (\n \"cur_total_debt\" in suiEventJson &&\n \"accrued_interest\" in suiEventJson\n ) {\n const loopEvent: AutoCompoundingEventNode = {\n ...eventNode,\n cur_total_debt: BigInt(suiEventJson.cur_total_debt.toString()),\n accrued_interest: BigInt(suiEventJson.accrued_interest.toString()),\n };\n eventNode = loopEvent;\n }\n } else if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"amount\" in suiEventJson\n ) {\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n investor_id: conf[CONF_ENV].ALPHA_POOL,\n };\n } else if (\n isRebalanceEvent(suiEvent.type) &&\n \"lower_tick_after\" in suiEventJson\n ) {\n // Handling RebalanceEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n investor_id: suiEventJson.investor_id.toString(),\n lower_tick_after: suiEventJson.lower_tick_after.toString(),\n upper_tick_after: suiEventJson.upper_tick_after.toString(),\n sqrt_price_after: suiEventJson.sqrt_price_after.toString(),\n amount_a_before: suiEventJson.amount_a_before.toString(),\n amount_b_before: suiEventJson.amount_b_before.toString(),\n amount_a_after: suiEventJson.amount_a_after.toString(),\n amount_b_after: suiEventJson.amount_b_after.toString(),\n };\n } else if (\n isLiquidityChangeEvent(suiEvent.type) &&\n \"amount_a\" in suiEventJson\n ) {\n // Handling CetusLiquidityChangeEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount_a: suiEventJson.amount_a,\n amount_b: suiEventJson.amount_b,\n event_type: suiEventJson.event_type,\n fee_collected_a: suiEventJson.fee_collected_a,\n fee_collected_b: suiEventJson.fee_collected_b,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n total_amount_a: suiEventJson.total_amount_a,\n total_amount_b: suiEventJson.total_amount_b,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n } as LiquidityChangeEventNode;\n } else if (\n isLiquidityChangeEvent(suiEvent.type) &&\n \"amount\" in suiEventJson &&\n !(\"investor_id\" in suiEventJson) &&\n !(\"amount_withdrawn_from_locked\" in suiEventJson) &&\n !(\"xtokenSupply\" in suiEventJson)\n ) {\n // Handling NaviLiquidityChangeEvent and AlphaLiquidityChangeEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n event_type: suiEventJson.event_type,\n fee_collected: suiEventJson.fee_collected,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n } as LiquidityChangeEventNode;\n } else if (\n isWithdrawV2Event(suiEvent.type) &&\n \"amount_withdrawn_from_locked\" in suiEventJson\n ) {\n // Handling Alpha WithdrawV2 Events\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n amount_withdrawn_from_locked:\n suiEventJson.amount_withdrawn_from_locked,\n amount_withdrawn_from_unlocked:\n suiEventJson.amount_withdrawn_from_unlocked,\n fee_collected: suiEventJson.fee_collected,\n instant_withdraw_fee_collected:\n suiEventJson.instant_withdraw_fee_collected,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n } as WithdrawV2EventNode;\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"tokensInvested\" in suiEventJson &&\n !(\"liquidity\" in suiEventJson) &&\n !(\"amount\" in suiEventJson)\n ) {\n //handling alpha after transaction event\n if (suiEvent.id.eventSeq === \"0\") continue;\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: \"ALPHA\",\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xTokenSupply: suiEventJson.xTokenSupply,\n };\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"tokensInvested\" in suiEventJson &&\n \"liquidity\" in suiEventJson\n ) {\n //handling cetus after transaction event\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: undefined,\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xtokenSupply: suiEventJson.xtokenSupply,\n liquidity: suiEventJson.liquidity,\n };\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"amount\" in suiEventJson &&\n \"tokensInvested\" in suiEventJson\n ) {\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: undefined,\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xtokenSupply: suiEventJson.xtokenSupply,\n amount: suiEventJson.amount,\n };\n } else {\n console.error(\"event: \", suiEvent, \"json: \", suiEventJson);\n throw new Error(\"Unknown event type\");\n }\n\n allEvents.push(eventNode);\n }\n\n // If we set hasPreviousPage to false, exit the outer loop as well\n if (!hasNextPage) {\n break;\n }\n\n hasNextPage = result.hasNextPage;\n startCursor = result.nextCursor;\n }\n\n return allEvents;\n}\n\nconst isAutoCompoundingEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo).map((info) => {\n return info.autoCompoundingEventType;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isRebalanceEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .filter((info) => {\n return info.rebalanceEventType ? true : false;\n })\n .map((info) => {\n return info.rebalanceEventType as string;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isLiquidityChangeEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo).map((info) => {\n return info.liquidityChangeEventType;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isWithdrawV2Event = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .map((info) => {\n return info.withdrawV2EventType;\n })\n .filter((type) => type !== undefined);\n return eventTypes.includes(eventType);\n};\n\nconst isAfterTransactionEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .map((info) => {\n return info.afterTransactionEventType;\n })\n .filter((type) => type !== undefined);\n return eventTypes.includes(eventType);\n};\n"]}
|
|
1
|
+
{"version":3,"file":"fetchEvents.js","sourceRoot":"","sources":["../../../../src/sui-sdk/events/fetchEvents.ts"],"names":[],"mappings":";;AAqBA,kCAoUC;AAzVD,4CAA4C;AAkB5C,kDAAgD;AAChD,4DAA2D;AAEpD,KAAK,UAAU,WAAW,CAC/B,MAAyB;IAEzB,MAAM,SAAS,GAAgB,EAAE,CAAC;IAClC,IAAI,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,WAAW,GAA+B,IAAI,CAAC;IAEnD,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,IAAI,CACV,kFAAkF,CACnF,CAAC;IACJ,CAAC;IAED,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,WAAW,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACvB,MAAM,kBAAkB,GAAG,GAAG,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,6BAA6B;IACnF,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,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phaAutoCompoundingEvent,\n CetusAutoCompoundingEvent,\n CetusLiquidityChangeEvent,\n EventNode,\n FetchEventsParams,\n NaviAutoCompoundingEvent,\n NaviLoopAutoCompoundingEvent,\n NaviLiquidityChangeEvent,\n RebalanceEvent,\n AutoCompoundingEventNode,\n AlphaWithdrawV2Event,\n AfterTransactionEventNode,\n CheckRatioEvent,\n} from \"./types.js\";\nimport { poolInfo } from \"../../common/maps.js\";\nimport { conf, CONF_ENV } from \"../../common/constants.js\";\n\nexport async function fetchEvents(\n params: FetchEventsParams,\n): Promise<EventNode[]> {\n const allEvents: EventNode[] = [];\n let hasNextPage = true;\n let startCursor: EventId | null | undefined = null;\n\n if (params.eventTypes.length > 1) {\n console.warn(\n \"Multiple eventTypes not supported right now, pass only one element in the array.\",\n );\n }\n\n if (params.eventTypes.length < 1) {\n hasNextPage = false;\n }\n\n const now = Date.now();\n const twentyFourHoursAgo = now - 24 * 60 * 60 * 1000; // timestamp for 24 hours ago\n const startTime = params.startTime ? params.startTime : twentyFourHoursAgo;\n const endTime = params.endTime ? params.endTime : now;\n\n if (startTime >= endTime) {\n throw new Error(\"startTime must be less than endTime\");\n }\n\n const suiClient = getSuiClient();\n //const prevTS = 0;\n\n while (hasNextPage) {\n const result: PaginatedEvents = await suiClient.queryEvents({\n cursor: startCursor,\n order: \"descending\",\n query: {\n MoveEventType: params.eventTypes[0],\n },\n });\n\n const se = result.data;\n for (let i = 0; i < se.length; i++) {\n const suiEvent = se[i];\n\n if (Number(suiEvent.timestampMs) > endTime) {\n continue;\n }\n\n if (Number(suiEvent.timestampMs) < startTime) {\n hasNextPage = false; // Stop further pagination\n break; // Exit the loop\n }\n\n const suiEventJson = suiEvent.parsedJson as\n | CetusAutoCompoundingEvent\n | NaviAutoCompoundingEvent\n | NaviLoopAutoCompoundingEvent\n | RebalanceEvent\n | CetusLiquidityChangeEvent\n | AlphaLiquidityChangeEvent\n | NaviLiquidityChangeEvent\n | AlphaAutoCompoundingEvent\n | AlphaWithdrawV2Event\n | AfterTransactionEventNode // TODO: this needs to be changed to AfterTransactionEvent Eventually\n | CheckRatioEvent;\n\n let eventNode: EventNode;\n\n if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"compound_amount_a\" in suiEventJson &&\n \"compound_amount_b\" in suiEventJson\n ) {\n // Handling CetusAutoCompoundingEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n compound_amount_a: BigInt(suiEventJson.compound_amount_a.toString()),\n compound_amount_b: BigInt(suiEventJson.compound_amount_b.toString()),\n current_liquidity: BigInt(suiEventJson.current_liquidity.toString()),\n fee_collected_a: BigInt(suiEventJson.fee_collected_a.toString()),\n fee_collected_b: BigInt(suiEventJson.fee_collected_b.toString()),\n free_balance_a: BigInt(suiEventJson.free_balance_a.toString()),\n free_balance_b: BigInt(suiEventJson.free_balance_b.toString()),\n investor_id: suiEventJson.investor_id,\n total_amount_a: BigInt(suiEventJson.total_amount_a.toString()),\n total_amount_b: BigInt(suiEventJson.total_amount_b.toString()),\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n\n // if (\n // eventNode.investor_id ===\n // \"0xd060e81548aee885bd3d37ae0caec181185be792bf45412e0d0acccd1e0174e6\"\n // ) {\n // console.log(\n // eventNode.timestamp,\n // (prevTS - eventNode.timestamp) / (1000 * 60),\n // );\n // prevTS = eventNode.timestamp;\n // }\n } else if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"compound_amount\" in suiEventJson\n ) {\n // Handling NaviAutoCompoundingEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n compound_amount: BigInt(suiEventJson.compound_amount.toString()),\n fee_collected: BigInt(suiEventJson.fee_collected.toString()),\n investor_id: suiEventJson.investor_id,\n location: suiEventJson.location,\n total_amount: BigInt(suiEventJson.total_amount.toString()),\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n if (\n \"cur_total_debt\" in suiEventJson &&\n \"accrued_interest\" in suiEventJson\n ) {\n const loopEvent: AutoCompoundingEventNode = {\n ...eventNode,\n cur_total_debt: BigInt(suiEventJson.cur_total_debt.toString()),\n accrued_interest: BigInt(suiEventJson.accrued_interest.toString()),\n };\n eventNode = loopEvent;\n }\n } else if (\n isAutoCompoundingEvent(suiEvent.type) &&\n \"amount\" in suiEventJson\n ) {\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n investor_id: conf[CONF_ENV].ALPHA_POOL,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isRebalanceEvent(suiEvent.type) &&\n \"lower_tick_after\" in suiEventJson\n ) {\n // Handling RebalanceEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n investor_id: suiEventJson.investor_id.toString(),\n lower_tick_after: suiEventJson.lower_tick_after.toString(),\n upper_tick_after: suiEventJson.upper_tick_after.toString(),\n sqrt_price_after: suiEventJson.sqrt_price_after.toString(),\n amount_a_before: suiEventJson.amount_a_before.toString(),\n amount_b_before: suiEventJson.amount_b_before.toString(),\n amount_a_after: suiEventJson.amount_a_after.toString(),\n amount_b_after: suiEventJson.amount_b_after.toString(),\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isLiquidityChangeEvent(suiEvent.type) &&\n \"amount_a\" in suiEventJson\n ) {\n // Handling CetusLiquidityChangeEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount_a: suiEventJson.amount_a,\n amount_b: suiEventJson.amount_b,\n event_type: suiEventJson.event_type,\n fee_collected_a: suiEventJson.fee_collected_a,\n fee_collected_b: suiEventJson.fee_collected_b,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n total_amount_a: suiEventJson.total_amount_a,\n total_amount_b: suiEventJson.total_amount_b,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isLiquidityChangeEvent(suiEvent.type) &&\n \"amount\" in suiEventJson &&\n !(\"investor_id\" in suiEventJson) &&\n !(\"amount_withdrawn_from_locked\" in suiEventJson) &&\n !(\"xtokenSupply\" in suiEventJson)\n ) {\n // Handling NaviLiquidityChangeEvent and AlphaLiquidityChangeEvent\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n event_type: suiEventJson.event_type,\n fee_collected: suiEventJson.fee_collected,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isWithdrawV2Event(suiEvent.type) &&\n \"amount_withdrawn_from_locked\" in suiEventJson\n ) {\n // Handling Alpha WithdrawV2 Events\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n amount: suiEventJson.amount,\n amount_withdrawn_from_locked:\n suiEventJson.amount_withdrawn_from_locked,\n amount_withdrawn_from_unlocked:\n suiEventJson.amount_withdrawn_from_unlocked,\n fee_collected: suiEventJson.fee_collected,\n instant_withdraw_fee_collected:\n suiEventJson.instant_withdraw_fee_collected,\n pool_id: suiEventJson.pool_id,\n sender: suiEventJson.sender,\n tokens_invested: suiEventJson.tokens_invested,\n user_total_x_token_balance: suiEventJson.user_total_x_token_balance,\n x_token_supply: suiEventJson.x_token_supply,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"tokensInvested\" in suiEventJson &&\n !(\"liquidity\" in suiEventJson) &&\n !(\"amount\" in suiEventJson)\n ) {\n //handling alpha after transaction event\n if (suiEvent.id.eventSeq === \"0\") continue;\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: \"ALPHA\",\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xTokenSupply: suiEventJson.xTokenSupply,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"tokensInvested\" in suiEventJson &&\n \"liquidity\" in suiEventJson\n ) {\n //handling cetus after transaction event\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: undefined,\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xtokenSupply: suiEventJson.xtokenSupply,\n liquidity: suiEventJson.liquidity,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\n isAfterTransactionEvent(suiEvent.type) &&\n \"amount\" in suiEventJson &&\n \"tokensInvested\" in suiEventJson\n ) {\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n poolName: undefined,\n id: {\n eventSeq: Number(suiEvent.id.eventSeq),\n txDigest: suiEvent.id.txDigest,\n },\n tokensInvested: suiEventJson.tokensInvested,\n xtokenSupply: suiEventJson.xtokenSupply,\n amount: suiEventJson.amount,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else if (\"ratio\" in suiEventJson) {\n // Check Ratio - looping pools\n eventNode = {\n type: suiEvent.type,\n timestamp: Number(suiEvent.timestampMs),\n ratio: suiEventJson.ratio,\n txDigest: suiEvent.id.txDigest,\n eventSeq: Number(suiEvent.id.eventSeq),\n transactionModule: suiEvent.transactionModule,\n };\n } else {\n console.error(\"event: \", suiEvent, \"json: \", suiEventJson);\n throw new Error(\"Unknown event type\");\n }\n\n allEvents.push(eventNode);\n }\n\n // If we set hasPreviousPage to false, exit the outer loop as well\n if (!hasNextPage) {\n break;\n }\n\n hasNextPage = result.hasNextPage;\n startCursor = result.nextCursor;\n }\n\n return allEvents;\n}\n\nconst isAutoCompoundingEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo).map((info) => {\n return info.autoCompoundingEventType;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isRebalanceEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .filter((info) => {\n return info.rebalanceEventType ? true : false;\n })\n .map((info) => {\n return info.rebalanceEventType as string;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isLiquidityChangeEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo).map((info) => {\n return info.liquidityChangeEventType;\n });\n return eventTypes.includes(eventType);\n};\n\nconst isWithdrawV2Event = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .map((info) => {\n return info.withdrawV2EventType;\n })\n .filter((type) => type !== undefined);\n return eventTypes.includes(eventType);\n};\n\nconst isAfterTransactionEvent = (eventType: string) => {\n const eventTypes: string[] = Object.values(poolInfo)\n .map((info) => {\n return info.afterTransactionEventType;\n })\n .filter((type) => type !== undefined);\n return eventTypes.includes(eventType);\n};\n"]}
|
|
@@ -2,6 +2,9 @@ import { PoolName } from "../../common/types.js";
|
|
|
2
2
|
interface CommonEventAttributes {
|
|
3
3
|
type: string;
|
|
4
4
|
timestamp: number;
|
|
5
|
+
txDigest: string;
|
|
6
|
+
eventSeq: number;
|
|
7
|
+
transactionModule: string;
|
|
5
8
|
}
|
|
6
9
|
export interface CetusAutoCompoundingEvent {
|
|
7
10
|
compound_amount_a: bigint;
|
|
@@ -139,6 +142,9 @@ export type NaviPoolWithdrawEvent = {
|
|
|
139
142
|
recipient: string;
|
|
140
143
|
sender: string;
|
|
141
144
|
};
|
|
145
|
+
export interface CheckRatioEvent {
|
|
146
|
+
ratio: string;
|
|
147
|
+
}
|
|
142
148
|
export type AfterTransactionEventNode = (CetusAfterTransactionEvent & CommonEventAttributes & {
|
|
143
149
|
poolName: PoolName | undefined;
|
|
144
150
|
id: {
|
|
@@ -162,7 +168,8 @@ export type AutoCompoundingEventNode = (CetusAutoCompoundingEvent & CommonEventA
|
|
|
162
168
|
export type RebalanceEventNode = RebalanceEvent & CommonEventAttributes;
|
|
163
169
|
export type LiquidityChangeEventNode = (CetusLiquidityChangeEvent & CommonEventAttributes) | (NaviLiquidityChangeEvent & CommonEventAttributes) | (AlphaLiquidityChangeEvent & CommonEventAttributes);
|
|
164
170
|
export type WithdrawV2EventNode = AlphaWithdrawV2Event & CommonEventAttributes;
|
|
165
|
-
export type
|
|
171
|
+
export type CheckRatioEventNode = CheckRatioEvent & CommonEventAttributes;
|
|
172
|
+
export type EventNode = AutoCompoundingEventNode | RebalanceEventNode | LiquidityChangeEventNode | WithdrawV2EventNode | AfterTransactionEventNode | CheckRatioEventNode;
|
|
166
173
|
export type FetchAutoCompoundingEventsParams = {
|
|
167
174
|
startTime?: number;
|
|
168
175
|
endTime?: number;
|
|
@@ -174,6 +181,7 @@ export type FetchWithdrawV2EventsParams = {
|
|
|
174
181
|
startTime?: number;
|
|
175
182
|
endTime?: number;
|
|
176
183
|
};
|
|
184
|
+
export type FetchCheckRatioEventsParams = FetchAutoCompoundingEventsParams;
|
|
177
185
|
export type FetchEventsParams = {
|
|
178
186
|
eventTypes: string[];
|
|
179
187
|
startTime?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sui-sdk/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/sui-sdk/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,yBAAyB;IACxC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,wBAAwB;IACvC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,4BAA6B,SAAQ,wBAAwB;IAC5E,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,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ui-sdk/events/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PoolName } from \"../../common/types.js\";\n\ninterface CommonEventAttributes {\n type: string;\n timestamp: number;\n}\n\nexport interface CetusAutoCompoundingEvent {\n compound_amount_a: bigint;\n compound_amount_b: bigint;\n current_liquidity: bigint;\n fee_collected_a: bigint;\n fee_collected_b: bigint;\n free_balance_a: bigint;\n free_balance_b: bigint;\n investor_id: string;\n total_amount_a: bigint;\n total_amount_b: bigint;\n}\n\nexport interface NaviAutoCompoundingEvent {\n compound_amount: bigint;\n fee_collected: bigint;\n investor_id: string;\n location: number;\n total_amount: bigint;\n}\n\nexport interface NaviLoopAutoCompoundingEvent extends NaviAutoCompoundingEvent {\n cur_total_debt: bigint;\n accrued_interest: bigint;\n}\n\nexport interface RebalanceEvent {\n investor_id: string;\n lower_tick_after: string;\n upper_tick_after: string;\n sqrt_price_after: string;\n amount_a_before: string;\n amount_b_before: string;\n amount_a_after: string;\n amount_b_after: string;\n}\n\n//verify, this might be wrong, alphapool reward event is defined as alpha autocompounding event\nexport interface AlphaAutoCompoundingEvent {\n amount: string;\n investor_id: string;\n}\n\nexport interface CetusLiquidityChangeEvent {\n amount_a: string;\n amount_b: string;\n event_type: number;\n fee_collected_a: string;\n fee_collected_b: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n total_amount_a: string;\n total_amount_b: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface NaviLiquidityChangeEvent {\n amount: string;\n event_type: number;\n fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface AlphaLiquidityChangeEvent {\n amount: string;\n event_type: number;\n fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface AlphaWithdrawV2Event {\n amount: string;\n amount_withdrawn_from_locked: string;\n amount_withdrawn_from_unlocked: string;\n fee_collected: string;\n instant_withdraw_fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface CetusAfterTransactionEvent {\n liquidity: string;\n tokensInvested: string;\n xtokenSupply: string;\n}\nexport interface NaviAfterTransactionEvent {\n amount: string;\n tokensInvested: string;\n xtokenSupply: string;\n}\n\n// only event sequence non zero are after transaction\nexport interface AlphaBeforeAndAfterEvent {\n tokensInvested: string;\n xTokenSupply: string;\n}\n\nexport type CetusAddLiquidityEvent = {\n after_liquidity: string;\n amount_a: string;\n amount_b: string;\n liquidity: string;\n pool: string;\n position: string;\n tick_lower: { bits: number };\n tick_upper: { bits: number };\n};\nexport type CetusRemoveLiquidityEvent = {\n after_liquidity: string;\n amount_a: string;\n amount_b: string;\n liquidity: string;\n pool: string;\n position: string;\n tick_lower: { bits: number };\n tick_upper: { bits: number };\n};\n\nexport type NaviPoolDepositEvent = {\n amount: string;\n pool: string;\n sender: string;\n};\nexport type NaviPoolWithdrawEvent = {\n amount: string;\n pool: string;\n recipient: string;\n sender: string;\n};\n\nexport type AfterTransactionEventNode =\n | (CetusAfterTransactionEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n })\n | (NaviAfterTransactionEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n })\n | (AlphaBeforeAndAfterEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n });\n\nexport type AutoCompoundingEventNode =\n | (CetusAutoCompoundingEvent & CommonEventAttributes)\n | (NaviAutoCompoundingEvent & CommonEventAttributes)\n | (NaviLoopAutoCompoundingEvent & CommonEventAttributes)\n | (AlphaAutoCompoundingEvent & CommonEventAttributes);\n\nexport type RebalanceEventNode = RebalanceEvent & CommonEventAttributes;\n\nexport type LiquidityChangeEventNode =\n | (CetusLiquidityChangeEvent & CommonEventAttributes)\n | (NaviLiquidityChangeEvent & CommonEventAttributes)\n | (AlphaLiquidityChangeEvent & CommonEventAttributes);\n\nexport type WithdrawV2EventNode = AlphaWithdrawV2Event & CommonEventAttributes;\n\nexport type EventNode =\n | AutoCompoundingEventNode\n | RebalanceEventNode\n | LiquidityChangeEventNode\n | WithdrawV2EventNode\n | AfterTransactionEventNode;\n\nexport type FetchAutoCompoundingEventsParams = {\n startTime?: number;\n endTime?: number;\n poolNames?: PoolName[];\n};\n\nexport type FetchRebalanceEventsParams = FetchAutoCompoundingEventsParams;\n\nexport type FetchLiquidityChangeEventsParams = FetchAutoCompoundingEventsParams;\n\nexport type FetchWithdrawV2EventsParams = {\n startTime?: number;\n endTime?: number;\n};\n\nexport type FetchEventsParams = {\n eventTypes: string[];\n startTime?: number;\n endTime?: number;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/sui-sdk/events/types.ts"],"names":[],"mappings":"","sourcesContent":["import { PoolName } from \"../../common/types.js\";\n\ninterface CommonEventAttributes {\n type: string;\n timestamp: number;\n txDigest: string;\n eventSeq: number;\n transactionModule: string;\n}\n\nexport interface CetusAutoCompoundingEvent {\n compound_amount_a: bigint;\n compound_amount_b: bigint;\n current_liquidity: bigint;\n fee_collected_a: bigint;\n fee_collected_b: bigint;\n free_balance_a: bigint;\n free_balance_b: bigint;\n investor_id: string;\n total_amount_a: bigint;\n total_amount_b: bigint;\n}\n\nexport interface NaviAutoCompoundingEvent {\n compound_amount: bigint;\n fee_collected: bigint;\n investor_id: string;\n location: number;\n total_amount: bigint;\n}\n\nexport interface NaviLoopAutoCompoundingEvent extends NaviAutoCompoundingEvent {\n cur_total_debt: bigint;\n accrued_interest: bigint;\n}\n\nexport interface RebalanceEvent {\n investor_id: string;\n lower_tick_after: string;\n upper_tick_after: string;\n sqrt_price_after: string;\n amount_a_before: string;\n amount_b_before: string;\n amount_a_after: string;\n amount_b_after: string;\n}\n\n//verify, this might be wrong, alphapool reward event is defined as alpha autocompounding event\nexport interface AlphaAutoCompoundingEvent {\n amount: string;\n investor_id: string;\n}\n\nexport interface CetusLiquidityChangeEvent {\n amount_a: string;\n amount_b: string;\n event_type: number;\n fee_collected_a: string;\n fee_collected_b: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n total_amount_a: string;\n total_amount_b: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface NaviLiquidityChangeEvent {\n amount: string;\n event_type: number;\n fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface AlphaLiquidityChangeEvent {\n amount: string;\n event_type: number;\n fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface AlphaWithdrawV2Event {\n amount: string;\n amount_withdrawn_from_locked: string;\n amount_withdrawn_from_unlocked: string;\n fee_collected: string;\n instant_withdraw_fee_collected: string;\n pool_id: string;\n sender: string;\n tokens_invested: string;\n user_total_x_token_balance: string;\n x_token_supply: string;\n}\n\nexport interface CetusAfterTransactionEvent {\n liquidity: string;\n tokensInvested: string;\n xtokenSupply: string;\n}\nexport interface NaviAfterTransactionEvent {\n amount: string;\n tokensInvested: string;\n xtokenSupply: string;\n}\n\n// only event sequence non zero are after transaction\nexport interface AlphaBeforeAndAfterEvent {\n tokensInvested: string;\n xTokenSupply: string;\n}\n\nexport type CetusAddLiquidityEvent = {\n after_liquidity: string;\n amount_a: string;\n amount_b: string;\n liquidity: string;\n pool: string;\n position: string;\n tick_lower: { bits: number };\n tick_upper: { bits: number };\n};\nexport type CetusRemoveLiquidityEvent = {\n after_liquidity: string;\n amount_a: string;\n amount_b: string;\n liquidity: string;\n pool: string;\n position: string;\n tick_lower: { bits: number };\n tick_upper: { bits: number };\n};\n\nexport type NaviPoolDepositEvent = {\n amount: string;\n pool: string;\n sender: string;\n};\nexport type NaviPoolWithdrawEvent = {\n amount: string;\n pool: string;\n recipient: string;\n sender: string;\n};\n\nexport interface CheckRatioEvent {\n ratio: string;\n}\n\nexport type AfterTransactionEventNode =\n | (CetusAfterTransactionEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n })\n | (NaviAfterTransactionEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n })\n | (AlphaBeforeAndAfterEvent &\n CommonEventAttributes & {\n poolName: PoolName | undefined;\n id: { eventSeq: number; txDigest: string };\n });\n\nexport type AutoCompoundingEventNode =\n | (CetusAutoCompoundingEvent & CommonEventAttributes)\n | (NaviAutoCompoundingEvent & CommonEventAttributes)\n | (NaviLoopAutoCompoundingEvent & CommonEventAttributes)\n | (AlphaAutoCompoundingEvent & CommonEventAttributes);\n\nexport type RebalanceEventNode = RebalanceEvent & CommonEventAttributes;\n\nexport type LiquidityChangeEventNode =\n | (CetusLiquidityChangeEvent & CommonEventAttributes)\n | (NaviLiquidityChangeEvent & CommonEventAttributes)\n | (AlphaLiquidityChangeEvent & CommonEventAttributes);\n\nexport type WithdrawV2EventNode = AlphaWithdrawV2Event & CommonEventAttributes;\n\nexport type CheckRatioEventNode = CheckRatioEvent & CommonEventAttributes;\n\nexport type EventNode =\n | AutoCompoundingEventNode\n | RebalanceEventNode\n | LiquidityChangeEventNode\n | WithdrawV2EventNode\n | AfterTransactionEventNode\n | CheckRatioEventNode;\n\nexport type FetchAutoCompoundingEventsParams = {\n startTime?: number;\n endTime?: number;\n poolNames?: PoolName[];\n};\n\nexport type FetchRebalanceEventsParams = FetchAutoCompoundingEventsParams;\n\nexport type FetchLiquidityChangeEventsParams = FetchAutoCompoundingEventsParams;\n\nexport type FetchWithdrawV2EventsParams = {\n startTime?: number;\n endTime?: number;\n};\n\nexport type FetchCheckRatioEventsParams = FetchAutoCompoundingEventsParams;\n\nexport type FetchEventsParams = {\n eventTypes: string[];\n startTime?: number;\n endTime?: number;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUserVaults.d.ts","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/fetchUserVaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AAQnE,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"fetchUserVaults.d.ts","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/fetchUserVaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAuB,MAAM,gBAAgB,CAAC;AAQnE,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,YAAY,EAAE,CAAC,CA4CzB"}
|
|
@@ -12,7 +12,8 @@ async function fetchUserVaults(address) {
|
|
|
12
12
|
const name = receipt[0].content.fields.name;
|
|
13
13
|
let res = undefined;
|
|
14
14
|
if (maps_js_1.poolInfo[pool].parentProtocolName === "ALPHAFI" ||
|
|
15
|
-
maps_js_1.poolInfo[pool].parentProtocolName === "NAVI"
|
|
15
|
+
maps_js_1.poolInfo[pool].parentProtocolName === "NAVI" ||
|
|
16
|
+
maps_js_1.poolInfo[pool].parentProtocolName === "BUCKET") {
|
|
16
17
|
const coin = maps_js_1.singleAssetPoolCoinMap[pool].coin;
|
|
17
18
|
res = {
|
|
18
19
|
poolId: maps_js_1.poolInfo[pool].poolId,
|
|
@@ -23,7 +24,8 @@ async function fetchUserVaults(address) {
|
|
|
23
24
|
coinType: index_js_1.coinsList[coin].type,
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
|
-
else if (maps_js_1.poolInfo[pool].parentProtocolName === "CETUS"
|
|
27
|
+
else if (maps_js_1.poolInfo[pool].parentProtocolName === "CETUS" ||
|
|
28
|
+
maps_js_1.poolInfo[pool].parentProtocolName === "BLUEFIN") {
|
|
27
29
|
const coinA = maps_js_1.doubleAssetPoolCoinMap[pool].coin1;
|
|
28
30
|
const coinB = maps_js_1.doubleAssetPoolCoinMap[pool].coin2;
|
|
29
31
|
res = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchUserVaults.js","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/fetchUserVaults.ts"],"names":[],"mappings":";;AAQA,
|
|
1
|
+
{"version":3,"file":"fetchUserVaults.js","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/fetchUserVaults.ts"],"names":[],"mappings":";;AAQA,0CA8CC;AAtDD,6CAAmE;AACnE,kDAI8B;AAC9B,qDAA+C;AAExC,KAAK,UAAU,eAAe,CACnC,OAAe;IAEf,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,MAAM,OAAO,CAAC,GAAG,CACf,MAAM,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACvC,MAAM,OAAO,GAAG,MAAM,IAAA,4BAAW,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACxD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC;YAC5C,IAAI,GAAG,GAA6B,SAAS,CAAC;YAC9C,IACE,kBAAQ,CAAC,IAAI,CAAC,CAAC,kBAAkB,KAAK,SAAS;gBAC/C,kBAAQ,CAAC,IAAI,CAAC,CAAC,kBAAkB,KAAK,MAAM;gBAC5C,kBAAQ,CAAC,IAAI,CAAC,CAAC,kBAAkB,KAAK,QAAQ,EAC9C,CAAC;gBACD,MAAM,IAAI,GAAG,gCAAsB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC;gBAC/C,GAAG,GAAG;oBACJ,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC,MAAM;oBAC7B,QAAQ,EAAE,IAAgB;oBAC1B,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;oBACpC,QAAQ,EAAE,IAAI;oBACd,QAAQ,EAAE,oBAAS,CAAC,IAAI,CAAC,CAAC,IAAI;iBAC/B,CAAC;YACJ,CAAC;iBAAM,IACL,kBAAQ,CAAC,IAAI,CAAC,CAAC,kBAAkB,KAAK,OAAO;gBAC7C,kBAAQ,CAAC,IAAI,CAAC,CAAC,kBAAkB,KAAK,SAAS,EAC/C,CAAC;gBACD,MAAM,KAAK,GAAG,gCAAsB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;gBACjD,MAAM,KAAK,GAAG,gCAAsB,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;gBACjD,GAAG,GAAG;oBACJ,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC,MAAM;oBAC7B,QAAQ,EAAE,IAAgB;oBAC1B,WAAW,EAAE,IAAI;oBACjB,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI;oBACpC,SAAS,EAAE,KAAK;oBAChB,SAAS,EAAE,oBAAS,CAAC,KAAK,CAAC,CAAC,IAAI;oBAChC,SAAS,EAAE,KAAK;oBAChB,SAAS,EAAE,oBAAS,CAAC,KAAK,CAAC,CAAC,IAAI;iBACjC,CAAC;YACJ,CAAC;YACD,IAAI,GAAG;gBAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IACF,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import { AlphaFiVault, coinsList, PoolName } from \"../../index.js\";\nimport {\n singleAssetPoolCoinMap,\n doubleAssetPoolCoinMap,\n poolInfo,\n} from \"../../common/maps.js\";\nimport { getReceipts } from \"./getReceipts.js\";\n\nexport async function fetchUserVaults(\n address: string,\n): Promise<AlphaFiVault[]> {\n const vaultsArr: AlphaFiVault[] = [];\n await Promise.all(\n Object.keys(poolInfo).map(async (pool) => {\n const receipt = await getReceipts(pool, address, false);\n if (receipt.length > 0) {\n const name = receipt[0].content.fields.name;\n let res: AlphaFiVault | undefined = undefined;\n if (\n poolInfo[pool].parentProtocolName === \"ALPHAFI\" ||\n poolInfo[pool].parentProtocolName === \"NAVI\" ||\n poolInfo[pool].parentProtocolName === \"BUCKET\"\n ) {\n const coin = singleAssetPoolCoinMap[pool].coin;\n res = {\n poolId: poolInfo[pool].poolId,\n poolName: pool as PoolName,\n receiptName: name,\n receiptType: receipt[0].content.type,\n coinName: coin,\n coinType: coinsList[coin].type,\n };\n } else if (\n poolInfo[pool].parentProtocolName === \"CETUS\" ||\n poolInfo[pool].parentProtocolName === \"BLUEFIN\"\n ) {\n const coinA = doubleAssetPoolCoinMap[pool].coin1;\n const coinB = doubleAssetPoolCoinMap[pool].coin2;\n res = {\n poolId: poolInfo[pool].poolId,\n poolName: pool as PoolName,\n receiptName: name,\n receiptType: receipt[0].content.type,\n coinNameA: coinA,\n coinTypeA: coinsList[coinA].type,\n coinNameB: coinB,\n coinTypeB: coinsList[coinB].type,\n };\n }\n if (res) vaultsArr.push(res);\n }\n }),\n );\n return vaultsArr;\n}\n"]}
|
|
@@ -3,13 +3,13 @@ import { Decimal } from "decimal.js";
|
|
|
3
3
|
export declare function convertReceiptGQLToReceipt(receipts: ReceiptGQL[]): Receipt[];
|
|
4
4
|
export declare function getMultiReceipts(address: string): Promise<void>;
|
|
5
5
|
export declare function getReceipts(poolName: string, address: string, ignoreCache: boolean): Promise<Receipt[]>;
|
|
6
|
-
export declare function getPoolExchangeRate(poolName: PoolName, ignoreCache: boolean): Promise<Decimal
|
|
6
|
+
export declare function getPoolExchangeRate(poolName: PoolName, ignoreCache: boolean): Promise<Decimal>;
|
|
7
7
|
export declare function getMultiPool(): Promise<void>;
|
|
8
|
-
export declare function getPool(poolName: string, ignoreCache: boolean): Promise<PoolType | AlphaPoolType
|
|
8
|
+
export declare function getPool(poolName: string, ignoreCache: boolean): Promise<PoolType | AlphaPoolType>;
|
|
9
9
|
export declare function getMultiParentPool(): Promise<void>;
|
|
10
|
-
export declare function getParentPool(poolName: string, ignoreCache: boolean): Promise<CetusPoolType
|
|
10
|
+
export declare function getParentPool(poolName: string, ignoreCache: boolean): Promise<CetusPoolType>;
|
|
11
11
|
export declare function getMultiInvestor(): Promise<void>;
|
|
12
|
-
export declare function getInvestor(poolName: PoolName, ignoreCache: boolean): Promise<Investor
|
|
12
|
+
export declare function getInvestor(poolName: PoolName, ignoreCache: boolean): Promise<Investor>;
|
|
13
13
|
export declare function fetchVoloExchangeRate(): Promise<NaviVoloData>;
|
|
14
14
|
export declare function getCoinAmountsFromLiquidity(poolName: PoolName, liquidity: string, ignoreCache: boolean): Promise<[string, string]>;
|
|
15
15
|
export declare function multiGetNaviInvestor(poolNames: SingleAssetPoolNames[]): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReceipts.d.ts","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/getReceipts.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EAEb,YAAY,EACZ,oBAAoB,EACpB,aAAa,EAEb,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,QAAQ,EAGR,oBAAoB,EAEpB,UAAU,EAGX,MAAM,gBAAgB,CAAC;AAIxB,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,OAAO,EAAE,CAyE5E;AAKD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,iBA0BrD;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,OAAO,EAAE,CAAC,CAgEpB;AAED,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,OAAO,GACnB,OAAO,CAA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C/C,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA4B3B;AAED,wBAAsB,oBAAoB,CAAC,SAAS,EAAE,oBAAoB,EAAE;;;;;;;;;;;;;;;;;;GA8B3E"}
|
|
@@ -187,32 +187,30 @@ async function getPoolExchangeRate(poolName, ignoreCache) {
|
|
|
187
187
|
let pool;
|
|
188
188
|
try {
|
|
189
189
|
pool = await getPool(poolName, ignoreCache);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
throw new Error(`couldnt fetch investor object for pool: ${poolName}`);
|
|
200
|
-
}
|
|
201
|
-
tokensInvested = new decimal_js_1.Decimal(pool.content.fields.tokensInvested);
|
|
202
|
-
}
|
|
203
|
-
// Check for division by zero
|
|
204
|
-
if (xTokenSupply.eq(0)) {
|
|
205
|
-
console.error("Division by zero error: tokensInvested is zero.");
|
|
206
|
-
return undefined;
|
|
190
|
+
const xTokenSupply = new decimal_js_1.Decimal(pool.content.fields.xTokenSupply);
|
|
191
|
+
let tokensInvested = new decimal_js_1.Decimal(pool.content.fields.tokensInvested);
|
|
192
|
+
if (poolName == "ALPHA") {
|
|
193
|
+
tokensInvested = new decimal_js_1.Decimal(pool.content.fields.alpha_bal);
|
|
194
|
+
}
|
|
195
|
+
else if (maps_js_1.poolInfo[poolName].parentProtocolName == "CETUS") {
|
|
196
|
+
const investor = (await getInvestor(poolName, ignoreCache));
|
|
197
|
+
if (!investor) {
|
|
198
|
+
throw new Error(`couldnt fetch investor object for pool: ${poolName}`);
|
|
207
199
|
}
|
|
208
|
-
|
|
209
|
-
return poolExchangeRate;
|
|
200
|
+
tokensInvested = new decimal_js_1.Decimal(pool.content.fields.tokensInvested);
|
|
210
201
|
}
|
|
202
|
+
// Check for division by zero
|
|
203
|
+
if (xTokenSupply.eq(0)) {
|
|
204
|
+
console.error("Division by zero error: tokensInvested is zero.");
|
|
205
|
+
return new decimal_js_1.Decimal(0);
|
|
206
|
+
}
|
|
207
|
+
const poolExchangeRate = tokensInvested.div(xTokenSupply);
|
|
208
|
+
return poolExchangeRate;
|
|
211
209
|
}
|
|
212
|
-
catch (
|
|
213
|
-
console.log(`getPoolExchangeRate failed for poolName: ${poolName}, with error ${
|
|
210
|
+
catch (err) {
|
|
211
|
+
console.log(`getPoolExchangeRate failed for poolName: ${poolName}, with error ${err}`);
|
|
212
|
+
throw err;
|
|
214
213
|
}
|
|
215
|
-
return undefined;
|
|
216
214
|
}
|
|
217
215
|
const poolCache = new simpleCache_js_1.SimpleCache();
|
|
218
216
|
const poolPromiseCache = new simpleCache_js_1.SimpleCache();
|
|
@@ -272,9 +270,9 @@ async function getPool(poolName, ignoreCache) {
|
|
|
272
270
|
poolCache.set(cacheKey, poolData);
|
|
273
271
|
return poolData;
|
|
274
272
|
}
|
|
275
|
-
catch (
|
|
273
|
+
catch (err) {
|
|
276
274
|
console.error(`Error in getPool; poolName => ${poolName}`);
|
|
277
|
-
|
|
275
|
+
throw err;
|
|
278
276
|
}
|
|
279
277
|
finally {
|
|
280
278
|
// Remove the promise from the cache after it resolves
|
|
@@ -348,9 +346,9 @@ async function getParentPool(poolName, ignoreCache) {
|
|
|
348
346
|
cetusPoolCache.set(cacheKey, cetusPool);
|
|
349
347
|
return cetusPool;
|
|
350
348
|
}
|
|
351
|
-
catch (
|
|
349
|
+
catch (err) {
|
|
352
350
|
console.error(`getCetusPool failed for poolName: ${poolName}`);
|
|
353
|
-
|
|
351
|
+
throw err;
|
|
354
352
|
}
|
|
355
353
|
finally {
|
|
356
354
|
// Remove the promise from the cache after it resolves
|
|
@@ -431,9 +429,9 @@ async function getInvestor(poolName, ignoreCache) {
|
|
|
431
429
|
investorCache.set(cacheKey, cetusInvestor);
|
|
432
430
|
return cetusInvestor;
|
|
433
431
|
}
|
|
434
|
-
catch (
|
|
432
|
+
catch (err) {
|
|
435
433
|
console.error(`getInvestor failed for pool: ${poolName}`);
|
|
436
|
-
|
|
434
|
+
throw err;
|
|
437
435
|
}
|
|
438
436
|
finally {
|
|
439
437
|
// Remove the promise from the cache after it resolves
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getReceipts.js","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/getReceipts.ts"],"names":[],"mappings":";;AA4BA,gEAyEC;AAKD,4CA0BC;AAED,kCAoEC;AAED,kDAuCC;AAOD,oCAuBC;AAED,0BAmDC;AAOD,gDAuBC;AAED,sCAqDC;AAKD,4CAuBC;AAED,kCAwDC;AAED,sDAeC;AAED,kEAgCC;AAED,oDA8BC;;AAnkBD,6CAmBwB;AACxB,kDAAgD;AAChD,0EAA2E;AAC3E,0DAAuB;AACvB,2CAAqC;AACrC,4CAA4C;AAC5C,+DAAyD;AAEzD,SAAgB,0BAA0B,CAAC,QAAsB;IAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACnC,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,OAAO,EAAE;gBACP,QAAQ,EAAE,YAAY,EAAE,2DAA2D;gBACnF,IAAI,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI;gBAChC,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;gBAC5C,MAAM,EAAE;oBACN,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE;oBACpC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS;oBAC1C,0BAA0B,EAAE;wBAC1B,IAAI,EAAE,SAAS,EAAE,uBAAuB;wBACxC,MAAM,EAAE;4BACN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O,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAEM,KAAK,UAAU,oBAAoB,CAAC,SAAiC;IAC1E,MAAM,OAAO,GAIT,EAAE,CAAC;IACP,MAAM,eAAe,GAAa,EAAE,CAAC;IAErC,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,eAAe,CAAC,IAAI,CAAC,kBAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC;IACpE,CAAC;IACD,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAA,wBAAY,GAAE,CAAC;QACjC,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,eAAe,CAAC;YAC9C,GAAG,EAAE,eAAe;YACpB,OAAO,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE;SAC/B,CAAC,CAAC;QACH,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,IAA2C,CAAC;YACxE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;QACnC,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS;QACT,OAAO,CAAC,KAAK,CACX,6CAA6C,EAC7C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CACrB,CAAC;QACF,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;EAGE;AACF,gFAAgF","sourcesContent":["import { PaginatedObjectsResponse } from \"@mysten/sui/client\";\nimport {\n AlphaPoolType,\n CetusInvestor,\n NaviInvestor,\n CommonInvestorFields,\n CetusPoolType,\n CoinAmounts,\n PoolName,\n PoolType,\n Receipt,\n NaviVoloData,\n Investor,\n BluefinInvestor,\n BucketInvestor,\n SingleAssetPoolNames,\n fetchMultiReceipts,\n ReceiptGQL,\n cetusPoolMap,\n bluefinPoolMap,\n} from \"../../index.js\";\nimport { poolInfo } from \"../../common/maps.js\";\nimport { ClmmPoolUtil, TickMath } from \"@cetusprotocol/cetus-sui-clmm-sdk\";\nimport BN from \"bn.js\";\nimport { Decimal } from \"decimal.js\";\nimport { getSuiClient } from \"../client.js\";\nimport { SimpleCache } from \"../../utils/simpleCache.js\";\n\nexport function convertReceiptGQLToReceipt(receipts: ReceiptGQL[]): Receipt[] {\n const res = receipts.map((receipt) => {\n return {\n objectId: receipt.address,\n version: receipt.version,\n digest: receipt.digest,\n content: {\n dataType: \"moveObject\", // Assuming a fixed value as it's not available in ReceiptA\n type: receipt.contents.type.repr,\n hasPublicTransfer: receipt.hasPublicTransfer,\n fields: {\n id: { id: receipt.contents.json.id },\n image_url: receipt.contents.json.image_url,\n last_acc_reward_per_xtoken: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n contents:\n receipt.contents.json.last_acc_reward_per_xtoken.contents.map(\n (item) => ({\n type: \"unknown\", // Assuming fixed value\n fields: {\n value: item.value,\n key: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n name: item.key.name,\n },\n },\n },\n }),\n ),\n },\n },\n locked_balance: receipt.contents.json.locked_balance\n ? {\n type: \"unknown\", // Assuming fixed value\n fields: {\n head: receipt.contents.json.locked_balance.head,\n id: { id: receipt.contents.json.locked_balance.id },\n size: receipt.contents.json.locked_balance.size,\n tail: receipt.contents.json.locked_balance.tail,\n },\n }\n : undefined,\n name: receipt.contents.json.name,\n owner: receipt.contents.json.owner,\n pending_rewards: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n contents: receipt.contents.json.pending_rewards.contents.map(\n (item) => ({\n type: \"unknown\", // Assuming fixed value\n fields: {\n key: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n name: item.key.name,\n },\n },\n value: item.value,\n },\n }),\n ),\n },\n },\n pool_id: receipt.contents.json.pool_id,\n xTokenBalance: receipt.contents.json.xTokenBalance,\n unlocked_xtokens: receipt.contents.json.unlocked_xtokens ?? undefined,\n },\n },\n };\n });\n return res;\n}\n\nconst receiptsCache = new SimpleCache<Receipt[]>(3600000);\nconst receiptsPromiseCache = new SimpleCache<Promise<Receipt[]>>(3600000);\n\nexport async function getMultiReceipts(address: string) {\n try {\n const receiptMap = await fetchMultiReceipts(address);\n for (const pool of Object.keys(poolInfo)) {\n const cacheKey = `getReceipts-${poolInfo[pool].receiptName}-${address}`;\n let receipt: Receipt[] = [];\n if (receiptMap.has(poolInfo[pool].receiptName)) {\n receipt = convertReceiptGQLToReceipt(\n receiptMap.get(poolInfo[pool].receiptName) as ReceiptGQL[],\n );\n }\n receiptsCache.set(cacheKey, receipt);\n }\n } catch (error) {\n console.error(\"Error fetching receipts from graphQL:\", error);\n // get receipts individually\n const pools = Object.keys(poolInfo);\n const receiptPromises = pools.map((pool) => {\n return getReceipts(pool, address, true);\n });\n const receipts = await Promise.all(receiptPromises);\n receipts.forEach((receipt, index) => {\n const cacheKey = `getReceipts-${poolInfo[pools[index]].receiptName}-${address}`;\n receiptsCache.set(cacheKey, receipt);\n });\n }\n}\n\nexport async function getReceipts(\n poolName: string,\n address: string,\n ignoreCache: boolean,\n): Promise<Receipt[]> {\n const suiClient = getSuiClient();\n const receiptsCacheKey = `getReceipts-${poolInfo[poolName].receiptName}-${address}`;\n if (ignoreCache) {\n receiptsCache.delete(receiptsCacheKey);\n receiptsPromiseCache.delete(receiptsCacheKey);\n }\n const cachedResponse = receiptsCache.get(receiptsCacheKey);\n if (cachedResponse) {\n return cachedResponse;\n }\n //\n const nfts: Receipt[] = [];\n if (poolInfo[poolName].receiptType == \"\") {\n return nfts;\n }\n let cachedPromise = receiptsPromiseCache.get(receiptsCacheKey);\n if (!cachedPromise) {\n cachedPromise = (async (): Promise<Receipt[]> => {\n // const first_package = getConf().ALPHA_FIRST_PACKAGE_ID;\n let currentCursor: string | null | undefined = null;\n while (true) {\n const paginatedObjects: PaginatedObjectsResponse =\n await suiClient.getOwnedObjects({\n owner: address,\n cursor: currentCursor,\n filter: {\n // StructType: `${first_package}::${module}::Receipt`,\n StructType: poolInfo[poolName].receiptType,\n },\n options: {\n showContent: true,\n },\n });\n // Traverse the current page data and push to coins array\n paginatedObjects.data.forEach((obj) => {\n const o = obj.data as Receipt;\n if (o) {\n if (poolInfo[poolName].receiptName === o.content.fields.name) {\n nfts.push(o);\n }\n }\n });\n // Check if there's a next page\n if (paginatedObjects.hasNextPage && paginatedObjects.nextCursor) {\n currentCursor = paginatedObjects.nextCursor;\n } else {\n // No more pages available\n // console.log(\"No more receipts available.\");\n break;\n }\n }\n receiptsCache.set(receiptsCacheKey, nfts);\n receiptsPromiseCache.delete(receiptsCacheKey);\n return nfts;\n })().catch((error) => {\n receiptsPromiseCache.delete(receiptsCacheKey); // Remove the promise from cache\n throw error;\n });\n // const data = await cachedPromise;\n // console.log(\"received cached data\", data);\n receiptsPromiseCache.set(receiptsCacheKey, cachedPromise);\n }\n return cachedPromise;\n}\n\nexport async function getPoolExchangeRate(\n poolName: PoolName,\n ignoreCache: boolean,\n): Promise<Decimal | undefined> {\n let pool;\n try {\n pool = await getPool(poolName, ignoreCache);\n if (pool) {\n const xTokenSupply = new Decimal(pool.content.fields.xTokenSupply);\n let tokensInvested = new Decimal(pool.content.fields.tokensInvested);\n if (poolName == \"ALPHA\") {\n tokensInvested = new Decimal(pool.content.fields.alpha_bal);\n } else if (poolInfo[poolName].parentProtocolName == \"CETUS\") {\n const investor = (await getInvestor(\n poolName,\n ignoreCache,\n )) as CetusInvestor & CommonInvestorFields;\n if (!investor) {\n throw new Error(\n `couldnt fetch investor object for pool: ${poolName}`,\n );\n }\n tokensInvested = new Decimal(pool.content.fields.tokensInvested);\n }\n\n // Check for division by zero\n if (xTokenSupply.eq(0)) {\n console.error(\"Division by zero error: tokensInvested is zero.\");\n return undefined;\n }\n const poolExchangeRate = tokensInvested.div(xTokenSupply);\n return poolExchangeRate;\n }\n } catch (e) {\n console.log(\n `getPoolExchangeRate failed for poolName: ${poolName}, with error ${e}`,\n );\n }\n return undefined;\n}\n\nconst poolCache = new SimpleCache<PoolType | AlphaPoolType>();\nconst poolPromiseCache = new SimpleCache<\n Promise<PoolType | AlphaPoolType | undefined>\n>();\n\nexport async function getMultiPool() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].poolId !== \"\";\n });\n const poolIds = pools.map((pool) => {\n return poolInfo[pool].poolId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: poolIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const poolData = o[i].data as AlphaPoolType | PoolType;\n const cacheKey = `pool_${poolInfo[pools[i]].poolId}`;\n poolCache.set(cacheKey, poolData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getPool(\n poolName: string,\n ignoreCache: boolean,\n): Promise<PoolType | AlphaPoolType | undefined> {\n const suiClient = getSuiClient();\n const cacheKey = `pool_${poolInfo[poolName.toUpperCase()].poolId}`;\n\n if (ignoreCache) {\n poolCache.delete(cacheKey);\n poolPromiseCache.delete(cacheKey);\n }\n\n // Check if the pool is already in the cache\n const cachedPool = poolCache.get(cacheKey);\n if (cachedPool) {\n return cachedPool;\n }\n\n // Check if there is already a promise in the cache\n let poolPromise = poolPromiseCache.get(cacheKey);\n if (poolPromise) {\n return poolPromise;\n }\n // If not, create a new promise and cache it\n poolPromise = (async () => {\n try {\n const o = await suiClient.getObject({\n id: poolInfo[poolName].poolId,\n options: {\n showContent: true,\n },\n });\n\n const poolData =\n poolName === \"ALPHA\" ? (o.data as AlphaPoolType) : (o.data as PoolType);\n\n // Cache the pool object\n poolCache.set(cacheKey, poolData);\n return poolData;\n } catch (e) {\n console.error(`Error in getPool; poolName => ${poolName}`);\n return undefined;\n } finally {\n // Remove the promise from the cache after it resolves\n poolPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n poolPromiseCache.set(cacheKey, poolPromise);\n return poolPromise;\n}\n\nconst cetusPoolCache = new SimpleCache<CetusPoolType>();\nconst cetusPoolPromiseCache = new SimpleCache<\n Promise<CetusPoolType | undefined>\n>();\n\nexport async function getMultiParentPool() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].poolId !== \"\";\n });\n const poolIds = pools.map((pool) => {\n return poolInfo[pool].parentPoolId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: poolIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const poolData = o[i].data as CetusPoolType;\n const cacheKey = `pool_${poolInfo[pools[i]].parentPoolId}`;\n cetusPoolCache.set(cacheKey, poolData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getParentPool(\n poolName: string,\n ignoreCache: boolean,\n): Promise<CetusPoolType | undefined> {\n const suiClient = getSuiClient();\n const cacheKey = `pool_${cetusPoolMap[poolName.toUpperCase()]}`;\n if (ignoreCache) {\n cetusPoolCache.delete(cacheKey);\n cetusPoolPromiseCache.delete(cacheKey);\n }\n\n // Check if the pool is already in the cache\n const cachedPool = cetusPoolCache.get(cacheKey);\n if (cachedPool) {\n return cachedPool;\n }\n\n // Check if there is already a promise in the cache\n let cetusPoolPromise = cetusPoolPromiseCache.get(cacheKey);\n if (cetusPoolPromise) {\n return cetusPoolPromise;\n }\n // If not, create a new promise and cache it\n cetusPoolPromise = (async () => {\n try {\n const id = poolInfo[poolName]\n ? poolInfo[poolName].parentPoolId\n : cetusPoolMap[poolName]\n ? cetusPoolMap[poolName]\n : bluefinPoolMap[poolName];\n const o = await suiClient.getObject({\n id: id,\n options: {\n showContent: true,\n },\n });\n const cetusPool = o.data as CetusPoolType;\n\n // Cache the pool object\n cetusPoolCache.set(cacheKey, cetusPool);\n return cetusPool;\n } catch (e) {\n console.error(`getCetusPool failed for poolName: ${poolName}`);\n return undefined;\n } finally {\n // Remove the promise from the cache after it resolves\n cetusPoolPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n cetusPoolPromiseCache.set(cacheKey, cetusPoolPromise);\n return cetusPoolPromise;\n}\n\nconst investorCache = new SimpleCache<Investor>();\nconst investorPromiseCache = new SimpleCache<Promise<Investor | undefined>>();\n\nexport async function getMultiInvestor() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].investorId !== \"\";\n });\n const investorIds = pools.map((pool) => {\n return poolInfo[pool].investorId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: investorIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const investorData = o[i].data as Investor;\n const cacheKey = `investor_${poolInfo[pools[i]].investorId}`;\n investorCache.set(cacheKey, investorData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getInvestor(\n poolName: PoolName,\n ignoreCache: boolean,\n): Promise<Investor | undefined> {\n const suiClient = getSuiClient();\n const cacheKey = `investor_${poolInfo[poolName.toUpperCase()].investorId}`;\n if (ignoreCache) {\n investorCache.delete(cacheKey);\n investorPromiseCache.delete(cacheKey);\n }\n // Check if the investor is already in the cache\n const cachedInvestor = investorCache.get(cacheKey);\n if (cachedInvestor) {\n return cachedInvestor;\n }\n\n // Check if there is already a promise in the cache\n let cetusInvestorPromise = investorPromiseCache.get(cacheKey);\n if (cetusInvestorPromise) {\n return cetusInvestorPromise;\n }\n // If not, create a new promise and cache it\n cetusInvestorPromise = (async () => {\n try {\n const o = await suiClient.getObject({\n id: poolInfo[poolName.toUpperCase()].investorId,\n options: {\n showContent: true,\n },\n });\n let cetusInvestor;\n if (poolInfo[poolName].parentProtocolName == \"NAVI\") {\n cetusInvestor = o.data as NaviInvestor & CommonInvestorFields;\n } else if (poolInfo[poolName].parentProtocolName == \"BUCKET\") {\n cetusInvestor = o.data as BucketInvestor & CommonInvestorFields;\n } else if (poolInfo[poolName].parentProtocolName == \"BLUEFIN\") {\n cetusInvestor = o.data as BluefinInvestor & CommonInvestorFields;\n } else {\n cetusInvestor = o.data as CetusInvestor & CommonInvestorFields;\n }\n\n // Cache the investor object\n investorCache.set(cacheKey, cetusInvestor);\n return cetusInvestor;\n } catch (e) {\n console.error(`getInvestor failed for pool: ${poolName}`);\n return undefined;\n } finally {\n // Remove the promise from the cache after it resolves\n investorPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n investorPromiseCache.set(cacheKey, cetusInvestorPromise);\n return cetusInvestorPromise;\n}\n\nexport async function fetchVoloExchangeRate(): Promise<NaviVoloData> {\n const apiUrl = \"https://open-api.naviprotocol.io/api/volo/stats\";\n const NaviVoloDetails: NaviVoloData = await fetch(apiUrl)\n .then(async (response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const data = (await response.json()) as NaviVoloData; // Parse the JSON response\n return data;\n })\n .catch((error) => {\n console.log(\"failed to fetch Navi-volo details\", error);\n throw error;\n });\n return NaviVoloDetails;\n}\n\nexport async function getCoinAmountsFromLiquidity(\n poolName: PoolName,\n liquidity: string,\n ignoreCache: boolean,\n): Promise<[string, string]> {\n const clmmPool = await getParentPool(poolName, ignoreCache);\n const investor = (await getInvestor(poolName, ignoreCache)) as CetusInvestor &\n CommonInvestorFields;\n\n const upper_bound = 443636;\n let lower_tick = Number(investor!.content.fields.lower_tick);\n let upper_tick = Number(investor!.content.fields.upper_tick);\n\n if (lower_tick > upper_bound) {\n lower_tick = -~(lower_tick - 1);\n }\n if (upper_tick > upper_bound) {\n upper_tick = -~(upper_tick - 1);\n }\n if (clmmPool) {\n const liquidityInt = Math.floor(parseFloat(liquidity));\n const coin_amounts: CoinAmounts = ClmmPoolUtil.getCoinAmountFromLiquidity(\n new BN(`${liquidityInt}`),\n new BN(clmmPool.content.fields.current_sqrt_price),\n TickMath.tickIndexToSqrtPriceX64(lower_tick),\n TickMath.tickIndexToSqrtPriceX64(upper_tick),\n true,\n );\n return [coin_amounts.coinA.toString(), coin_amounts.coinB.toString()];\n } else {\n return [\"0\", \"0\"];\n }\n}\n\nexport async function multiGetNaviInvestor(poolNames: SingleAssetPoolNames[]) {\n const results: {\n [poolName in SingleAssetPoolNames]?:\n | (NaviInvestor & CommonInvestorFields)\n | undefined;\n } = {};\n const poolInvestorIds: string[] = [];\n\n for (const poolName of poolNames) {\n poolInvestorIds.push(poolInfo[poolName.toUpperCase()].investorId);\n }\n try {\n const suiClient = getSuiClient();\n const objects = await suiClient.multiGetObjects({\n ids: poolInvestorIds,\n options: { showContent: true },\n });\n for (let i = 0; i < objects.length; i++) {\n const investor = objects[i].data as NaviInvestor & CommonInvestorFields;\n results[poolNames[i]] = investor;\n }\n return results;\n } catch (err) {\n //improve\n console.error(\n \"multiGetNaviInvestor failed for poolNames: \",\n poolNames.join(\", \"),\n );\n throw err;\n }\n}\n\n/*\nfor the missing pools, add a promise, each of those promises waits for there respective object from a map, that map is populated all at once, \nproblem with concurrency\n*/\n// ask how to deal with this kind of probem with high concurrency anf throughput\n"]}
|
|
1
|
+
{"version":3,"file":"getReceipts.js","sourceRoot":"","sources":["../../../../src/sui-sdk/functions/getReceipts.ts"],"names":[],"mappings":";;AA4BA,gEAyEC;AAKD,4CA0BC;AAED,kCAoEC;AAED,kDAmCC;AAKD,oCAuBC;AAED,0BAmDC;AAKD,gDAuBC;AAED,sCAqDC;AAKD,4CAuBC;AAED,kCAwDC;AAED,sDAeC;AAED,kEAgCC;AAED,oDA8BC;;AA3jBD,6CAmBwB;AACxB,kDAAgD;AAChD,0EAA2E;AAC3E,0DAAuB;AACvB,2CAAqC;AACrC,4CAA4C;AAC5C,+DAAyD;AAEzD,SAAgB,0BAA0B,CAAC,QAAsB;IAC/D,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACnC,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,OAAO;YACzB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,MAAM,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AO,CAAC;IACjB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,SAAS;QACT,OAAO,CAAC,KAAK,CACX,6CAA6C,EAC7C,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CACrB,CAAC;QACF,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;EAGE;AACF,gFAAgF","sourcesContent":["import { PaginatedObjectsResponse } from \"@mysten/sui/client\";\nimport {\n AlphaPoolType,\n CetusInvestor,\n NaviInvestor,\n CommonInvestorFields,\n CetusPoolType,\n CoinAmounts,\n PoolName,\n PoolType,\n Receipt,\n NaviVoloData,\n Investor,\n BluefinInvestor,\n BucketInvestor,\n SingleAssetPoolNames,\n fetchMultiReceipts,\n ReceiptGQL,\n cetusPoolMap,\n bluefinPoolMap,\n} from \"../../index.js\";\nimport { poolInfo } from \"../../common/maps.js\";\nimport { ClmmPoolUtil, TickMath } from \"@cetusprotocol/cetus-sui-clmm-sdk\";\nimport BN from \"bn.js\";\nimport { Decimal } from \"decimal.js\";\nimport { getSuiClient } from \"../client.js\";\nimport { SimpleCache } from \"../../utils/simpleCache.js\";\n\nexport function convertReceiptGQLToReceipt(receipts: ReceiptGQL[]): Receipt[] {\n const res = receipts.map((receipt) => {\n return {\n objectId: receipt.address,\n version: receipt.version,\n digest: receipt.digest,\n content: {\n dataType: \"moveObject\", // Assuming a fixed value as it's not available in ReceiptA\n type: receipt.contents.type.repr,\n hasPublicTransfer: receipt.hasPublicTransfer,\n fields: {\n id: { id: receipt.contents.json.id },\n image_url: receipt.contents.json.image_url,\n last_acc_reward_per_xtoken: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n contents:\n receipt.contents.json.last_acc_reward_per_xtoken.contents.map(\n (item) => ({\n type: \"unknown\", // Assuming fixed value\n fields: {\n value: item.value,\n key: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n name: item.key.name,\n },\n },\n },\n }),\n ),\n },\n },\n locked_balance: receipt.contents.json.locked_balance\n ? {\n type: \"unknown\", // Assuming fixed value\n fields: {\n head: receipt.contents.json.locked_balance.head,\n id: { id: receipt.contents.json.locked_balance.id },\n size: receipt.contents.json.locked_balance.size,\n tail: receipt.contents.json.locked_balance.tail,\n },\n }\n : undefined,\n name: receipt.contents.json.name,\n owner: receipt.contents.json.owner,\n pending_rewards: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n contents: receipt.contents.json.pending_rewards.contents.map(\n (item) => ({\n type: \"unknown\", // Assuming fixed value\n fields: {\n key: {\n type: \"unknown\", // Assuming fixed value\n fields: {\n name: item.key.name,\n },\n },\n value: item.value,\n },\n }),\n ),\n },\n },\n pool_id: receipt.contents.json.pool_id,\n xTokenBalance: receipt.contents.json.xTokenBalance,\n unlocked_xtokens: receipt.contents.json.unlocked_xtokens ?? undefined,\n },\n },\n };\n });\n return res;\n}\n\nconst receiptsCache = new SimpleCache<Receipt[]>(3600000);\nconst receiptsPromiseCache = new SimpleCache<Promise<Receipt[]>>(3600000);\n\nexport async function getMultiReceipts(address: string) {\n try {\n const receiptMap = await fetchMultiReceipts(address);\n for (const pool of Object.keys(poolInfo)) {\n const cacheKey = `getReceipts-${poolInfo[pool].receiptName}-${address}`;\n let receipt: Receipt[] = [];\n if (receiptMap.has(poolInfo[pool].receiptName)) {\n receipt = convertReceiptGQLToReceipt(\n receiptMap.get(poolInfo[pool].receiptName) as ReceiptGQL[],\n );\n }\n receiptsCache.set(cacheKey, receipt);\n }\n } catch (error) {\n console.error(\"Error fetching receipts from graphQL:\", error);\n // get receipts individually\n const pools = Object.keys(poolInfo);\n const receiptPromises = pools.map((pool) => {\n return getReceipts(pool, address, true);\n });\n const receipts = await Promise.all(receiptPromises);\n receipts.forEach((receipt, index) => {\n const cacheKey = `getReceipts-${poolInfo[pools[index]].receiptName}-${address}`;\n receiptsCache.set(cacheKey, receipt);\n });\n }\n}\n\nexport async function getReceipts(\n poolName: string,\n address: string,\n ignoreCache: boolean,\n): Promise<Receipt[]> {\n const suiClient = getSuiClient();\n const receiptsCacheKey = `getReceipts-${poolInfo[poolName].receiptName}-${address}`;\n if (ignoreCache) {\n receiptsCache.delete(receiptsCacheKey);\n receiptsPromiseCache.delete(receiptsCacheKey);\n }\n const cachedResponse = receiptsCache.get(receiptsCacheKey);\n if (cachedResponse) {\n return cachedResponse;\n }\n //\n const nfts: Receipt[] = [];\n if (poolInfo[poolName].receiptType == \"\") {\n return nfts;\n }\n let cachedPromise = receiptsPromiseCache.get(receiptsCacheKey);\n if (!cachedPromise) {\n cachedPromise = (async (): Promise<Receipt[]> => {\n // const first_package = getConf().ALPHA_FIRST_PACKAGE_ID;\n let currentCursor: string | null | undefined = null;\n while (true) {\n const paginatedObjects: PaginatedObjectsResponse =\n await suiClient.getOwnedObjects({\n owner: address,\n cursor: currentCursor,\n filter: {\n // StructType: `${first_package}::${module}::Receipt`,\n StructType: poolInfo[poolName].receiptType,\n },\n options: {\n showContent: true,\n },\n });\n // Traverse the current page data and push to coins array\n paginatedObjects.data.forEach((obj) => {\n const o = obj.data as Receipt;\n if (o) {\n if (poolInfo[poolName].receiptName === o.content.fields.name) {\n nfts.push(o);\n }\n }\n });\n // Check if there's a next page\n if (paginatedObjects.hasNextPage && paginatedObjects.nextCursor) {\n currentCursor = paginatedObjects.nextCursor;\n } else {\n // No more pages available\n // console.log(\"No more receipts available.\");\n break;\n }\n }\n receiptsCache.set(receiptsCacheKey, nfts);\n receiptsPromiseCache.delete(receiptsCacheKey);\n return nfts;\n })().catch((error) => {\n receiptsPromiseCache.delete(receiptsCacheKey); // Remove the promise from cache\n throw error;\n });\n // const data = await cachedPromise;\n // console.log(\"received cached data\", data);\n receiptsPromiseCache.set(receiptsCacheKey, cachedPromise);\n }\n return cachedPromise;\n}\n\nexport async function getPoolExchangeRate(\n poolName: PoolName,\n ignoreCache: boolean,\n): Promise<Decimal> {\n let pool;\n try {\n pool = await getPool(poolName, ignoreCache);\n const xTokenSupply = new Decimal(pool.content.fields.xTokenSupply);\n let tokensInvested = new Decimal(pool.content.fields.tokensInvested);\n if (poolName == \"ALPHA\") {\n tokensInvested = new Decimal(pool.content.fields.alpha_bal);\n } else if (poolInfo[poolName].parentProtocolName == \"CETUS\") {\n const investor = (await getInvestor(\n poolName,\n ignoreCache,\n )) as CetusInvestor & CommonInvestorFields;\n if (!investor) {\n throw new Error(`couldnt fetch investor object for pool: ${poolName}`);\n }\n tokensInvested = new Decimal(pool.content.fields.tokensInvested);\n }\n\n // Check for division by zero\n if (xTokenSupply.eq(0)) {\n console.error(\"Division by zero error: tokensInvested is zero.\");\n return new Decimal(0);\n }\n const poolExchangeRate = tokensInvested.div(xTokenSupply);\n return poolExchangeRate;\n } catch (err) {\n console.log(\n `getPoolExchangeRate failed for poolName: ${poolName}, with error ${err}`,\n );\n throw err;\n }\n}\n\nconst poolCache = new SimpleCache<PoolType | AlphaPoolType>();\nconst poolPromiseCache = new SimpleCache<Promise<PoolType | AlphaPoolType>>();\n\nexport async function getMultiPool() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].poolId !== \"\";\n });\n const poolIds = pools.map((pool) => {\n return poolInfo[pool].poolId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: poolIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const poolData = o[i].data as AlphaPoolType | PoolType;\n const cacheKey = `pool_${poolInfo[pools[i]].poolId}`;\n poolCache.set(cacheKey, poolData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getPool(\n poolName: string,\n ignoreCache: boolean,\n): Promise<PoolType | AlphaPoolType> {\n const suiClient = getSuiClient();\n const cacheKey = `pool_${poolInfo[poolName.toUpperCase()].poolId}`;\n\n if (ignoreCache) {\n poolCache.delete(cacheKey);\n poolPromiseCache.delete(cacheKey);\n }\n\n // Check if the pool is already in the cache\n const cachedPool = poolCache.get(cacheKey);\n if (cachedPool) {\n return cachedPool;\n }\n\n // Check if there is already a promise in the cache\n let poolPromise = poolPromiseCache.get(cacheKey);\n if (poolPromise) {\n return poolPromise;\n }\n // If not, create a new promise and cache it\n poolPromise = (async () => {\n try {\n const o = await suiClient.getObject({\n id: poolInfo[poolName].poolId,\n options: {\n showContent: true,\n },\n });\n\n const poolData =\n poolName === \"ALPHA\" ? (o.data as AlphaPoolType) : (o.data as PoolType);\n\n // Cache the pool object\n poolCache.set(cacheKey, poolData);\n return poolData;\n } catch (err) {\n console.error(`Error in getPool; poolName => ${poolName}`);\n throw err;\n } finally {\n // Remove the promise from the cache after it resolves\n poolPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n poolPromiseCache.set(cacheKey, poolPromise);\n return poolPromise;\n}\n\nconst cetusPoolCache = new SimpleCache<CetusPoolType>();\nconst cetusPoolPromiseCache = new SimpleCache<Promise<CetusPoolType>>();\n\nexport async function getMultiParentPool() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].poolId !== \"\";\n });\n const poolIds = pools.map((pool) => {\n return poolInfo[pool].parentPoolId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: poolIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const poolData = o[i].data as CetusPoolType;\n const cacheKey = `pool_${poolInfo[pools[i]].parentPoolId}`;\n cetusPoolCache.set(cacheKey, poolData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getParentPool(\n poolName: string,\n ignoreCache: boolean,\n): Promise<CetusPoolType> {\n const suiClient = getSuiClient();\n const cacheKey = `pool_${cetusPoolMap[poolName.toUpperCase()]}`;\n if (ignoreCache) {\n cetusPoolCache.delete(cacheKey);\n cetusPoolPromiseCache.delete(cacheKey);\n }\n\n // Check if the pool is already in the cache\n const cachedPool = cetusPoolCache.get(cacheKey);\n if (cachedPool) {\n return cachedPool;\n }\n\n // Check if there is already a promise in the cache\n let cetusPoolPromise = cetusPoolPromiseCache.get(cacheKey);\n if (cetusPoolPromise) {\n return cetusPoolPromise;\n }\n // If not, create a new promise and cache it\n cetusPoolPromise = (async () => {\n try {\n const id = poolInfo[poolName]\n ? poolInfo[poolName].parentPoolId\n : cetusPoolMap[poolName]\n ? cetusPoolMap[poolName]\n : bluefinPoolMap[poolName];\n const o = await suiClient.getObject({\n id: id,\n options: {\n showContent: true,\n },\n });\n const cetusPool = o.data as CetusPoolType;\n\n // Cache the pool object\n cetusPoolCache.set(cacheKey, cetusPool);\n return cetusPool;\n } catch (err) {\n console.error(`getCetusPool failed for poolName: ${poolName}`);\n throw err;\n } finally {\n // Remove the promise from the cache after it resolves\n cetusPoolPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n cetusPoolPromiseCache.set(cacheKey, cetusPoolPromise);\n return cetusPoolPromise;\n}\n\nconst investorCache = new SimpleCache<Investor>();\nconst investorPromiseCache = new SimpleCache<Promise<Investor>>();\n\nexport async function getMultiInvestor() {\n let pools = Object.keys(poolInfo);\n pools = pools.filter((pool) => {\n return poolInfo[pool].investorId !== \"\";\n });\n const investorIds = pools.map((pool) => {\n return poolInfo[pool].investorId;\n });\n try {\n const o = await getSuiClient().multiGetObjects({\n ids: investorIds,\n options: {\n showContent: true,\n },\n });\n for (let i = 0; i < pools.length; i = i + 1) {\n const investorData = o[i].data as Investor;\n const cacheKey = `investor_${poolInfo[pools[i]].investorId}`;\n investorCache.set(cacheKey, investorData);\n }\n } catch (e) {\n console.error(`Error getting multiPools`);\n }\n}\n\nexport async function getInvestor(\n poolName: PoolName,\n ignoreCache: boolean,\n): Promise<Investor> {\n const suiClient = getSuiClient();\n const cacheKey = `investor_${poolInfo[poolName.toUpperCase()].investorId}`;\n if (ignoreCache) {\n investorCache.delete(cacheKey);\n investorPromiseCache.delete(cacheKey);\n }\n // Check if the investor is already in the cache\n const cachedInvestor = investorCache.get(cacheKey);\n if (cachedInvestor) {\n return cachedInvestor;\n }\n\n // Check if there is already a promise in the cache\n let cetusInvestorPromise = investorPromiseCache.get(cacheKey);\n if (cetusInvestorPromise) {\n return cetusInvestorPromise;\n }\n // If not, create a new promise and cache it\n cetusInvestorPromise = (async () => {\n try {\n const o = await suiClient.getObject({\n id: poolInfo[poolName.toUpperCase()].investorId,\n options: {\n showContent: true,\n },\n });\n let cetusInvestor;\n if (poolInfo[poolName].parentProtocolName == \"NAVI\") {\n cetusInvestor = o.data as NaviInvestor & CommonInvestorFields;\n } else if (poolInfo[poolName].parentProtocolName == \"BUCKET\") {\n cetusInvestor = o.data as BucketInvestor & CommonInvestorFields;\n } else if (poolInfo[poolName].parentProtocolName == \"BLUEFIN\") {\n cetusInvestor = o.data as BluefinInvestor & CommonInvestorFields;\n } else {\n cetusInvestor = o.data as CetusInvestor & CommonInvestorFields;\n }\n\n // Cache the investor object\n investorCache.set(cacheKey, cetusInvestor);\n return cetusInvestor;\n } catch (err) {\n console.error(`getInvestor failed for pool: ${poolName}`);\n throw err;\n } finally {\n // Remove the promise from the cache after it resolves\n investorPromiseCache.delete(cacheKey);\n }\n })();\n\n // Cache the promise\n investorPromiseCache.set(cacheKey, cetusInvestorPromise);\n return cetusInvestorPromise;\n}\n\nexport async function fetchVoloExchangeRate(): Promise<NaviVoloData> {\n const apiUrl = \"https://open-api.naviprotocol.io/api/volo/stats\";\n const NaviVoloDetails: NaviVoloData = await fetch(apiUrl)\n .then(async (response) => {\n if (!response.ok) {\n throw new Error(`HTTP error! status: ${response.status}`);\n }\n const data = (await response.json()) as NaviVoloData; // Parse the JSON response\n return data;\n })\n .catch((error) => {\n console.log(\"failed to fetch Navi-volo details\", error);\n throw error;\n });\n return NaviVoloDetails;\n}\n\nexport async function getCoinAmountsFromLiquidity(\n poolName: PoolName,\n liquidity: string,\n ignoreCache: boolean,\n): Promise<[string, string]> {\n const clmmPool = await getParentPool(poolName, ignoreCache);\n const investor = (await getInvestor(poolName, ignoreCache)) as CetusInvestor &\n CommonInvestorFields;\n\n const upper_bound = 443636;\n let lower_tick = Number(investor!.content.fields.lower_tick);\n let upper_tick = Number(investor!.content.fields.upper_tick);\n\n if (lower_tick > upper_bound) {\n lower_tick = -~(lower_tick - 1);\n }\n if (upper_tick > upper_bound) {\n upper_tick = -~(upper_tick - 1);\n }\n if (clmmPool) {\n const liquidityInt = Math.floor(parseFloat(liquidity));\n const coin_amounts: CoinAmounts = ClmmPoolUtil.getCoinAmountFromLiquidity(\n new BN(`${liquidityInt}`),\n new BN(clmmPool.content.fields.current_sqrt_price),\n TickMath.tickIndexToSqrtPriceX64(lower_tick),\n TickMath.tickIndexToSqrtPriceX64(upper_tick),\n true,\n );\n return [coin_amounts.coinA.toString(), coin_amounts.coinB.toString()];\n } else {\n return [\"0\", \"0\"];\n }\n}\n\nexport async function multiGetNaviInvestor(poolNames: SingleAssetPoolNames[]) {\n const results: {\n [poolName in SingleAssetPoolNames]?:\n | (NaviInvestor & CommonInvestorFields)\n | undefined;\n } = {};\n const poolInvestorIds: string[] = [];\n\n for (const poolName of poolNames) {\n poolInvestorIds.push(poolInfo[poolName.toUpperCase()].investorId);\n }\n try {\n const suiClient = getSuiClient();\n const objects = await suiClient.multiGetObjects({\n ids: poolInvestorIds,\n options: { showContent: true },\n });\n for (let i = 0; i < objects.length; i++) {\n const investor = objects[i].data as NaviInvestor & CommonInvestorFields;\n results[poolNames[i]] = investor;\n }\n return results;\n } catch (err) {\n //improve\n console.error(\n \"multiGetNaviInvestor failed for poolNames: \",\n poolNames.join(\", \"),\n );\n throw err;\n }\n}\n\n/*\nfor the missing pools, add a promise, each of those promises waits for there respective object from a map, that map is populated all at once, \nproblem with concurrency\n*/\n// ask how to deal with this kind of probem with high concurrency anf throughput\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Transaction } from "@mysten/sui/transactions";
|
|
2
|
+
export declare const depositAlphaTxb: (amount: string | number, address: string) => Promise<Transaction>;
|
|
3
|
+
export declare const withdrawAlphaTxb: (xTokens: string, withdrawFromLocked: boolean, address: string) => Promise<Transaction>;
|
|
4
|
+
//# sourceMappingURL=alpha.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alpha.d.ts","sourceRoot":"","sources":["../../../src/transactions/alpha.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,eAAe,WAClB,MAAM,GAAG,MAAM,WACd,MAAM,KACd,OAAO,CAAC,WAAW,CAiFrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAClB,MAAM,sBACK,OAAO,WAClB,MAAM,KACd,OAAO,CAAC,WAAW,CAqBrB,CAAC"}
|