@indigo-labs/indigo-sdk 0.5.3 → 0.5.5

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 CHANGED
@@ -12,10 +12,7 @@ npm install @indigo-labs/indigo-sdk
12
12
 
13
13
  ## Deployment to npmjs
14
14
 
15
- First build:
16
- `pnpm run build`
17
-
18
- Then update the version with either of the following:
15
+ Update the version with either of the following:
19
16
 
20
17
  ```
21
18
  pnpm version patch # 1.0.0 → 1.0.1
@@ -23,7 +20,7 @@ pnpm version minor # 1.0.0 → 1.1.0
23
20
  pnpm version major # 1.0.0 → 2.0.0
24
21
  ```
25
22
 
26
- Publish:
23
+ Publish (builds thanks to prepublish hook):
27
24
  `pnpm publish --access public`
28
25
 
29
26
  ## Development
package/dist/index.d.mts CHANGED
@@ -1,8 +1,12 @@
1
1
  import * as _lucid_evolution_lucid from '@lucid-evolution/lucid';
2
2
  import { Data, UTxO, Credential, OutRef, LucidEvolution, TxBuilder, Assets, WithdrawalValidator, SpendingValidator, MintingPolicy, Address, PolicyId, Network, ScriptHash, ProtocolParameters, OutputDatum, Script, Datum } from '@lucid-evolution/lucid';
3
+ export { _lucid_evolution_lucid as Lucid };
3
4
  import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
5
+ import * as cardanoOffchainCommon from '@3rd-eye-labs/cardano-offchain-common';
6
+ export { cardanoOffchainCommon as OffchainCommon };
4
7
  import * as Core from '@evolution-sdk/evolution';
5
8
  import { TSchema, Schema, Data as Data$1 } from '@evolution-sdk/evolution';
9
+ export { Core as Evo };
6
10
  import { option, ord } from 'fp-ts';
7
11
  import * as effect_Schema from 'effect/Schema';
8
12
  import { Schema as Schema$1 } from 'effect';
@@ -817,6 +821,12 @@ declare function rationalSub(a: Rational, b: Rational): Rational;
817
821
  declare function rationalMul(a: Rational, b: Rational): Rational;
818
822
  declare function rationalDiv(a: Rational, b: Rational): Rational;
819
823
  declare function rationalToFloat(a: Rational): number;
824
+ /**
825
+ * This is a lossy conversion, the precision determines the number
826
+ * of decimal places that will be retained. Additionally, use of floats
827
+ * causes some additional imprecisions.
828
+ */
829
+ declare function numberToRational(num: number, precision?: number): Rational;
820
830
 
821
831
  /**
822
832
  * Amount of iasset equal in value to the given number of collateral amount.
@@ -3648,7 +3658,7 @@ declare function processSpRequest(stabilityPoolUtxo: UTxO, accountUtxo: UTxO, iA
3648
3658
  /**
3649
3659
  * For performance provide only the ones related to the pool's iAsset.
3650
3660
  */
3651
- allE2s2sSnapshotOrefs: OutRef[], sysParams: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3661
+ allE2s2sSnapshotOrefs: OutRef[], sysParams: SystemParams, lucid: LucidEvolution, currentSlot?: number): Promise<TxBuilder>;
3652
3662
  declare function createE2s2sSnapshots(stabilityPoolOref: OutRef, sysParams: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3653
3663
  declare function annulRequest(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3654
3664
 
@@ -4742,4 +4752,4 @@ declare function mkAuthTokenPolicy(ac: AssetClass, tn: string): MintingPolicy;
4742
4752
 
4743
4753
  declare const alwaysFailValidator: SpendingValidator;
4744
4754
 
4745
- export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type PSMProcessingConfig, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, type SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StableswapInfo, type StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderInfo, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectPriceFeedIds, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, derivePythPrice, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateMinOrderOutputLovelaces, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findAdminInterestCollectors, findAllInterestCollectors, findAllTreasuryUtxos, findAllTreasuryUtxosWithNonAdaAsset, findCollateralAsset, findE2s2sSnapshots, findIAsset, findRandomCdpCreator, findRandomNonAdminInterestCollector, findRandomTreasuryUtxo, findRandomTreasuryUtxoWithAsset, findRandomTreasuryUtxoWithOnlyAda, findRelevantE2s2sIdxs, findStabilityPool, findStabilityPoolAccount, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, pickValidSatisfiableOrders, processSpRequest, psmOrderType, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summariseOrder, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
4755
+ export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type PSMProcessingConfig, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, type SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StableswapInfo, type StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderInfo, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectPriceFeedIds, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, derivePythPrice, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateMinOrderOutputLovelaces, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findAdminInterestCollectors, findAllInterestCollectors, findAllTreasuryUtxos, findAllTreasuryUtxosWithNonAdaAsset, findCollateralAsset, findE2s2sSnapshots, findIAsset, findRandomCdpCreator, findRandomNonAdminInterestCollector, findRandomTreasuryUtxo, findRandomTreasuryUtxoWithAsset, findRandomTreasuryUtxoWithOnlyAda, findRelevantE2s2sIdxs, findStabilityPool, findStabilityPoolAccount, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, numberToRational, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, pickValidSatisfiableOrders, processSpRequest, psmOrderType, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summariseOrder, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  import * as _lucid_evolution_lucid from '@lucid-evolution/lucid';
2
2
  import { Data, UTxO, Credential, OutRef, LucidEvolution, TxBuilder, Assets, WithdrawalValidator, SpendingValidator, MintingPolicy, Address, PolicyId, Network, ScriptHash, ProtocolParameters, OutputDatum, Script, Datum } from '@lucid-evolution/lucid';
3
+ export { _lucid_evolution_lucid as Lucid };
3
4
  import { AssetClass } from '@3rd-eye-labs/cardano-offchain-common';
5
+ import * as cardanoOffchainCommon from '@3rd-eye-labs/cardano-offchain-common';
6
+ export { cardanoOffchainCommon as OffchainCommon };
4
7
  import * as Core from '@evolution-sdk/evolution';
5
8
  import { TSchema, Schema, Data as Data$1 } from '@evolution-sdk/evolution';
9
+ export { Core as Evo };
6
10
  import { option, ord } from 'fp-ts';
7
11
  import * as effect_Schema from 'effect/Schema';
8
12
  import { Schema as Schema$1 } from 'effect';
@@ -817,6 +821,12 @@ declare function rationalSub(a: Rational, b: Rational): Rational;
817
821
  declare function rationalMul(a: Rational, b: Rational): Rational;
818
822
  declare function rationalDiv(a: Rational, b: Rational): Rational;
819
823
  declare function rationalToFloat(a: Rational): number;
824
+ /**
825
+ * This is a lossy conversion, the precision determines the number
826
+ * of decimal places that will be retained. Additionally, use of floats
827
+ * causes some additional imprecisions.
828
+ */
829
+ declare function numberToRational(num: number, precision?: number): Rational;
820
830
 
821
831
  /**
822
832
  * Amount of iasset equal in value to the given number of collateral amount.
@@ -3648,7 +3658,7 @@ declare function processSpRequest(stabilityPoolUtxo: UTxO, accountUtxo: UTxO, iA
3648
3658
  /**
3649
3659
  * For performance provide only the ones related to the pool's iAsset.
3650
3660
  */
3651
- allE2s2sSnapshotOrefs: OutRef[], sysParams: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3661
+ allE2s2sSnapshotOrefs: OutRef[], sysParams: SystemParams, lucid: LucidEvolution, currentSlot?: number): Promise<TxBuilder>;
3652
3662
  declare function createE2s2sSnapshots(stabilityPoolOref: OutRef, sysParams: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3653
3663
  declare function annulRequest(accountUtxo: UTxO, params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
3654
3664
 
@@ -4742,4 +4752,4 @@ declare function mkAuthTokenPolicy(ac: AssetClass, tn: string): MintingPolicy;
4742
4752
 
4743
4753
  declare const alwaysFailValidator: SpendingValidator;
4744
4754
 
4745
- export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type PSMProcessingConfig, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, type SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StableswapInfo, type StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderInfo, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectPriceFeedIds, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, derivePythPrice, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateMinOrderOutputLovelaces, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findAdminInterestCollectors, findAllInterestCollectors, findAllTreasuryUtxos, findAllTreasuryUtxosWithNonAdaAsset, findCollateralAsset, findE2s2sSnapshots, findIAsset, findRandomCdpCreator, findRandomNonAdminInterestCollector, findRandomTreasuryUtxo, findRandomTreasuryUtxoWithAsset, findRandomTreasuryUtxoWithOnlyAda, findRelevantE2s2sIdxs, findStabilityPool, findStabilityPoolAccount, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, pickValidSatisfiableOrders, processSpRequest, psmOrderType, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summariseOrder, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
4755
+ export { type AccountAction, type AccountContent, AccountContentSchema, type ActionReturnDatum, type AddCollateralAsssetContent, type AddressCredential, type AddressCredentialOrDatum, type AddressSP, AikenIntervalIntervalBound, AikenIntervalIntervalBoundType, type Amount, type AssetClassD, type AssetClassSP, AssetClassSchema, type AssetInfo, type AssetSnapshot, type AssetState, type AuthTokenPolicies, BASE_MAX_EXECUTION_FEE, BASE_MAX_TX_FEE, BigIntOrd, type CDPContent, CDPCreatorParams, type CDPCreatorParamsSP, type CDPDatum, CardanoTransactionValidityRange, type CdpParams, type CdpParamsSP, type CdpRedeemParams, type CdpRedeemParamsSP, type CdpRedeemer, type CollateralAssetContent, type CollateralAssetInfo, type CollateralAssetOutput, type CollectorParamsSP, type CollectorRedeemer, CollectorRedeemerSchema, CredentialD, CredentialSchema, type CurrencySymbolSP, DEFAULT_INIT_OPTIONS, type DerivedPythPrice, type DerivedPythPriceSP, DerivedPythPriceSchema, type E2S2SIndex, type E2S2SIndicesPerAsset, type EpochToScaleKey, type EpochToScaleToSumEntry, type ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type Feed, type FindE2S2SIdxResult, type GovDatum, GovParams, type GovParamsSP, type GovRedeemer, type IAssetContent, type IAssetDatum, type IAssetOutput, type IAssetParamsSP, type IAssetPriceInfo, IAssetPriceInfoSchema, type IAssetRedeemer, IAssetScriptParams, INIT_TOKEN_NAMES, type IndigoOracleNftParam, type InitialAssetParam, type InitialCollateralAssetParam, type InitialStablepoolParam, type InitializeOptions, type Input, type InterestCollectionDatum, type InterestCollectionParams, type InterestCollectionParamsSP, InterestCollectionParamsSchema, type InterestCollectionRedeemer, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type InterestOracleRedeemer, MAX_BUY_ROB_REDEMPTIONS_COUNT, MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET, MAX_E2S2S_ENTRIES_COUNT, MAX_REDEMPTIONS_WITH_CDP_OPEN, MAX_SELL_ROB_REDEMPTIONS_COUNT, MIN_ROB_COLLATERAL_AMT, type MarketSession, type ModifyStableswapPoolContent, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OneShotParams, OneShotParamsSchema, type OracleIdx, OracleIdxSchema, type Output, PRICE_UPDATE_MAGIC, type PSMProcessingConfig, type ParsedOutput, type PollDatum, type PollManagerContent, PollManagerParams, type PollManagerParamsSP, type PollManagerRedeemer, type PollShardContent, PollShardParams, type PollShardParamsSP, type PollShardRedeemer, type PollStatus, type PriceOracleDatum, type PriceOracleParam, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PriceUpdate, type ProcessRequestAccountContent, type ProposalContent, ProposalContentSchema, type ProposeAssetContent, type ProposeStableswapPoolContent, type ProtocolParams, ProtocolParamsSchema, type PubKeyHash, type PythConfig, type PythConfiguration, type PythFeedConfig, type PythFeedParams, type PythFeedParamsSP, type PythFeedRedeemer, type PythMessageParts, type PythOracleParam, type PythPriceConfigurationSP, type PythStateDatum, type PythUpdatesRedeemer, type Rational, RationalSchema, type RedeemCdpWithdrawalRedeemer, type RobDatum, type RobOrderType, type RobOutput, type RobParams, type RobParamsSP, RobParamsSchema, type RobRedeemer, SOLANA_FORMAT_MAGIC, type SPInteger, SPIntegerSchema, type ScriptCredential, type ScriptOutput, type ScriptRef, type ScriptReference, type ScriptReferences, type SnapshotEpochToScaleToSumContent, SnapshotEpochToScaleToSumContentSchema, type StabilityPoolContent, StabilityPoolContentSchema, StabilityPoolDatumSchema, StabilityPoolParams, type StabilityPoolParamsSP, type StabilityPoolRedeemer, StabilityPoolRedeemerSchema, type StableswapInfo, type StableswapOrderDatum, StableswapOrderDatumSchema, type StableswapOrderInfo, type StableswapOrderRedeemer, type StableswapOutputDatum, type StableswapParamsSP, type StableswapPoolContent, StakeCredential, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type StateSnapshot, type SumSnapshot, type SystemParams, type TokenNameSP, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type UpgradePaths, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, adjustCdp, adjustPriceToDecimals, adjustRob, adjustStakingPosition, alwaysFailValidator, annulRequest, approximateLeverageRedemptions, attachOracle, balance, batchCollectInterest, batchProcessStableswapOrders, bigintMax, bigintMin, buildRedemptionsTx, burnCdp, calculateAccruedInterest, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculatePurchaseAmtWhenRobBuyOrder, calculatePurchaseAmtWhenRobSellOrder, calculateSpendAmtWhenRobBuyOrder, calculateSpendAmtWhenRobSellOrder, calculateTotalCollateralForRedemption, calculateUnitaryInterest, calculateUnitaryInterestSinceOracleLastUpdated, cancelRob, cancelStableswapOrder, castCDPCreatorParams, castCdpParams, castCdpRedeemParams, castExecuteParams, castGovParams, castInterestCollectionParams, castInterestOracleParams, castOneShotParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castRobParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimRob, closeCdp, closeStakingPosition, collectInterestTx, collectPriceFeedIds, collectorFeeTx, createDestinationDatum, createE2s2sSnapshots, createProcessRequestAccountRedeemer, createProposal, createScriptAddress, createShardsChunks, createStableswapOrder, decodePriceUpdate, decodePythMessage, depositCdp, deriveAuthToken, derivePythPrice, distributeAda, distributeInterest, distributeReward, divideOnChainCompatible, encodePriceUpdate, encodePythMessage, encodeSignedPythMessage, endProposal, estimateMinOrderOutputLovelaces, estimateUtxoMinLovelace, executeProposal, feedInterestOracle, feedPriceOracleTx, findAdminInterestCollectors, findAllInterestCollectors, findAllTreasuryUtxos, findAllTreasuryUtxosWithNonAdaAsset, findCollateralAsset, findE2s2sSnapshots, findIAsset, findRandomCdpCreator, findRandomNonAdminInterestCollector, findRandomTreasuryUtxo, findRandomTreasuryUtxoWithAsset, findRandomTreasuryUtxoWithOnlyAda, findRelevantE2s2sIdxs, findStabilityPool, findStabilityPoolAccount, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromDataDerivedPythPrice, fromDecimal, fromSPInteger, fromSysParamsCredential, fromSysParamsDerivedPythPrice, fromSysParamsPythFeedParams, fromSysParamsStakeCredential, fromSystemParamsAsset, fromSystemParamsAssetLucid, fromSystemParamsScriptRef, getAssetClassComparisonStr, getInlineDatumOrThrow, getPythFeedConfig, getUpdatedAccountDeposit, handleOracleForCollateralAsset, iassetValueOfCollateral, init, initCDPCreator, initCollector, initGovernance, initInterestCollector, initPythConfig, initScriptRef, initSpState, initStakingManager, initSumVal, initTreasury, initializeAsset, insertSorted, isBuyOrderFullyRedeemed, isFullyRedeemed, isSameEpochToScaleKey, leverageCdpWithRob, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, matchSingle, mergeCdps, mergeShards, mintAuthTokenDirect, mintCdp, mintOneTimeAsset, mintOneTimeToken, mkAuthTokenPolicy, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpRedeemValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkGovValidator, mkGovValidatorFromSP, mkIAssetTokenPolicy, mkIAssetValidatorFromSP, mkInterestCollectionValidator, mkInterestCollectionValidatorFromSP, mkInterestOracleValidator, mkOneShotPolicy, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkPriceOracleValidator, mkPythFeedValidator, mkRobValidator, mkRobValidatorFromSP, mkSPInteger, mkStabilityPoolAddr, mkStabilityPoolValidator, mkStabilityPoolValidatorFromSP, mkStableswapValidator, mkStableswapValidatorFromSP, mkStakingValidatorFromSP, mkTreasuryAddr, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, numberToRational, oneShotMintTx, openCdp, openRob, openStakingPosition, parseAccountDatum, parseAccountDatumOrThrow, parseCdpDatum, parseCdpDatumOrThrow, parseCdpRedeemer, parseCdpRedeemerOrThrow, parseCollateralAssetDatum, parseCollateralAssetDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestCollectionDatum, parseInterestOracleDatum, parsePollManager, parsePollManagerOrThrow, parsePollShard, parsePollShardOrThrow, parsePollShardRedeemer, parsePollShardRedeemerOrThrow, parsePriceOracleDatum, parsePythStateDatum, parseRobDatum, parseRobDatumOrThrow, parseRobRedeemer, parseRobRedeemerOrThrow, parseSnapshotEpochToScaleToSumDatum, parseSnapshotEpochToScaleToSumDatumOrThrow, parseStabilityPoolDatum, parseStabilityPoolDatumOrThrow, parseStabilityPoolRedeemer, parseStabilityPoolRedeemerOrThrow, parseStableswapOrderDatum, parseStableswapOrderDatumOrThrow, parseStableswapOrderRedeemer, parseStableswapOrderRedeemerOrThrow, parseStableswapPoolDatum, parseStableswapPoolDatumOrThrow, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, parseStakingRedeemer, parseStakingRedeemerOrThrow, partitionEpochToScaleToSums, pickValidSatisfiableOrders, processSpRequest, psmOrderType, randomRobsSubsetSatisfyingTargetCollateral, rationalAdd, rationalCeil, rationalDiv, rationalFloor, rationalFromInt, rationalMul, rationalNegate, rationalSub, rationalToFloat, rationalZero, redeemCdp, redeemRob, repsertReadonlyArr, repsertWithReadonlyArr, requestSpAccountAdjustment, requestSpAccountClosure, requestSpAccountCreation, rewardSnapshotPrecision, rewardsPerAsset, robAmtToSpend, robBuyOrderFilledAssets, robBuyOrderSummary, robCollateralAmtToSpend, robIAssetAmtToSpend, robSellOrderFilledAssets, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseActionReturnDatum, serialiseCdpDatum, serialiseCdpRedeemer, serialiseCollectorRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseIAssetRedeemer, serialiseInterestCollectionDatum, serialiseInterestCollectionRedeemer, serialiseInterestOracleDatum, serialisePollDatum, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialisePythFeedParams, serialisePythFeedRedeemer, serialisePythStateDatum, serialisePythUpdatesRedeemer, serialiseRedeemCdpWithdrawalRedeemer, serialiseRobDatum, serialiseRobRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStableswapOrderDatum, serialiseStableswapOrderRedeemer, serialiseStableswapOutputDatum, serialiseStableswapPoolDatum, serialiseStakingDatum, serialiseStakingRedeemer, shuffle, signersAllOf, spAdd, spDiv, spMul, spSub, spZeroNegatives, startInterestOracle, startPriceOracleTx, submitTx, sum, summariseOrder, summarizeActualLeverageRedemptions, toAssetClassFromLucid, toDataDerivedPythPrice, toSystemParamsAsset, treasuryCollect, treasuryFeeTx, treasuryMerge, treasuryPrepareWithdrawal, treasurySplit, updateAccount, updatePermissions, updatePoolStateWhenWithdrawalFee, updateStableswapPoolFees, updateStakingLockedAmount, vote, withdrawCdp, zeroNegatives };
package/dist/index.js CHANGED
@@ -44,6 +44,7 @@ __export(index_exports, {
44
44
  CredentialSchema: () => CredentialSchema,
45
45
  DEFAULT_INIT_OPTIONS: () => DEFAULT_INIT_OPTIONS,
46
46
  DerivedPythPriceSchema: () => DerivedPythPriceSchema,
47
+ Evo: () => Evo,
47
48
  ExecuteParams: () => ExecuteParams,
48
49
  GovParams: () => GovParams,
49
50
  IAssetPriceInfoSchema: () => IAssetPriceInfoSchema,
@@ -52,6 +53,7 @@ __export(index_exports, {
52
53
  InterestCollectionParamsSchema: () => InterestCollectionParamsSchema,
53
54
  InterestOracleDatumSchema: () => InterestOracleDatumSchema,
54
55
  InterestOracleParamsSchema: () => InterestOracleParamsSchema,
56
+ Lucid: () => Lucid,
55
57
  MAX_BUY_ROB_REDEMPTIONS_COUNT: () => MAX_BUY_ROB_REDEMPTIONS_COUNT,
56
58
  MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET: () => MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET,
57
59
  MAX_E2S2S_ENTRIES_COUNT: () => MAX_E2S2S_ENTRIES_COUNT,
@@ -62,6 +64,7 @@ __export(index_exports, {
62
64
  ONE_HOUR: () => ONE_HOUR,
63
65
  ONE_SECOND: () => ONE_SECOND,
64
66
  ONE_YEAR: () => ONE_YEAR,
67
+ OffchainCommon: () => OffchainCommon,
65
68
  OneShotParamsSchema: () => OneShotParamsSchema,
66
69
  OracleIdxSchema: () => OracleIdxSchema,
67
70
  PRICE_UPDATE_MAGIC: () => PRICE_UPDATE_MAGIC,
@@ -261,6 +264,7 @@ __export(index_exports, {
261
264
  mkTreasuryValidatorFromSP: () => mkTreasuryValidatorFromSP,
262
265
  mkVersionRecordTokenPolicy: () => mkVersionRecordTokenPolicy,
263
266
  mkVersionRegistryValidator: () => mkVersionRegistryValidator,
267
+ numberToRational: () => numberToRational,
264
268
  oneShotMintTx: () => oneShotMintTx,
265
269
  openCdp: () => openCdp,
266
270
  openRob: () => openRob,
@@ -407,6 +411,9 @@ __export(index_exports, {
407
411
  zeroNegatives: () => zeroNegatives
408
412
  });
409
413
  module.exports = __toCommonJS(index_exports);
414
+ var Lucid = __toESM(require("@lucid-evolution/lucid"));
415
+ var OffchainCommon = __toESM(require("@3rd-eye-labs/cardano-offchain-common"));
416
+ var Evo = __toESM(require("@evolution-sdk/evolution"));
410
417
 
411
418
  // src/contracts/cdp/transactions.ts
412
419
  var import_lucid12 = require("@lucid-evolution/lucid");
@@ -506,6 +513,12 @@ function rationalDiv(a, b) {
506
513
  function rationalToFloat(a) {
507
514
  return Number(a.numerator) / Number(a.denominator);
508
515
  }
516
+ function numberToRational(num, precision = 10 ** 12) {
517
+ return {
518
+ numerator: BigInt(Math.floor(num * precision)),
519
+ denominator: BigInt(precision)
520
+ };
521
+ }
509
522
 
510
523
  // src/contracts/pyth-feed/types.ts
511
524
  var PythConfigurationSchema = import_evolution2.TSchema.Struct({
@@ -8310,8 +8323,9 @@ async function requestSpAccountClosure(accountUtxo, sysParams, lucid, maxTxFee =
8310
8323
  )
8311
8324
  ).addSignerKey((0, import_lucid47.toHex)(oldAccountDatum.owner));
8312
8325
  }
8313
- async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, txFee) {
8314
- const currentTime = BigInt(lucid.slotToUnixTime(lucid.currentSlot()));
8326
+ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, txFee, currentSlot) {
8327
+ const slot = currentSlot !== void 0 ? currentSlot : lucid.currentSlot();
8328
+ const currentTime = BigInt(lucid.slotToUnixTime(slot));
8315
8329
  const stabilityPoolScriptRef = (0, import_cardano_offchain_common24.matchSingle)(
8316
8330
  await lucid.utxosByOutRef([
8317
8331
  fromSystemParamsScriptRef(
@@ -8327,7 +8341,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
8327
8341
  getInlineDatumOrThrow(stabilityPoolUtxo)
8328
8342
  );
8329
8343
  const baseRefInputs = [iAssetUtxo, stabilityPoolScriptRef];
8330
- const validFrom = lucid.slotToUnixTime(lucid.currentSlot() - 1);
8344
+ const validFrom = lucid.slotToUnixTime(slot - 1);
8331
8345
  const tx = lucid.newTx().validFrom(validFrom).validTo(validFrom + sysParams.stabilityPoolParams.accountProcessingBiasMs).readFrom(baseRefInputs).collectFrom([stabilityPoolUtxo], {
8332
8346
  kind: "selected",
8333
8347
  inputs: [stabilityPoolUtxo, accountUtxo],
@@ -8699,7 +8713,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
8699
8713
  }).exhaustive();
8700
8714
  return tx;
8701
8715
  }
8702
- async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid) {
8716
+ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, currentSlot) {
8703
8717
  const draftTx = processSpRequestAuxiliary(
8704
8718
  stabilityPoolUtxo,
8705
8719
  accountUtxo,
@@ -8708,7 +8722,8 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
8708
8722
  sysParams,
8709
8723
  lucid,
8710
8724
  // Placeholder transation fee
8711
- 1n
8725
+ 1n,
8726
+ currentSlot
8712
8727
  );
8713
8728
  const fee = (await (await draftTx).complete()).toTransaction().body().fee();
8714
8729
  return processSpRequestAuxiliary(
@@ -8718,7 +8733,8 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
8718
8733
  allE2s2sSnapshotOrefs,
8719
8734
  sysParams,
8720
8735
  lucid,
8721
- fee
8736
+ fee,
8737
+ currentSlot
8722
8738
  );
8723
8739
  }
8724
8740
  async function createE2s2sSnapshots(stabilityPoolOref, sysParams, lucid) {
@@ -12085,6 +12101,7 @@ async function updateStableswapPoolFees(stableswapPoolOutRef, stableswapFeeOutRe
12085
12101
  CredentialSchema,
12086
12102
  DEFAULT_INIT_OPTIONS,
12087
12103
  DerivedPythPriceSchema,
12104
+ Evo,
12088
12105
  ExecuteParams,
12089
12106
  GovParams,
12090
12107
  IAssetPriceInfoSchema,
@@ -12093,6 +12110,7 @@ async function updateStableswapPoolFees(stableswapPoolOutRef, stableswapFeeOutRe
12093
12110
  InterestCollectionParamsSchema,
12094
12111
  InterestOracleDatumSchema,
12095
12112
  InterestOracleParamsSchema,
12113
+ Lucid,
12096
12114
  MAX_BUY_ROB_REDEMPTIONS_COUNT,
12097
12115
  MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET,
12098
12116
  MAX_E2S2S_ENTRIES_COUNT,
@@ -12103,6 +12121,7 @@ async function updateStableswapPoolFees(stableswapPoolOutRef, stableswapFeeOutRe
12103
12121
  ONE_HOUR,
12104
12122
  ONE_SECOND,
12105
12123
  ONE_YEAR,
12124
+ OffchainCommon,
12106
12125
  OneShotParamsSchema,
12107
12126
  OracleIdxSchema,
12108
12127
  PRICE_UPDATE_MAGIC,
@@ -12302,6 +12321,7 @@ async function updateStableswapPoolFees(stableswapPoolOutRef, stableswapFeeOutRe
12302
12321
  mkTreasuryValidatorFromSP,
12303
12322
  mkVersionRecordTokenPolicy,
12304
12323
  mkVersionRegistryValidator,
12324
+ numberToRational,
12305
12325
  oneShotMintTx,
12306
12326
  openCdp,
12307
12327
  openRob,
package/dist/index.mjs CHANGED
@@ -1,3 +1,8 @@
1
+ // src/index.ts
2
+ import * as Lucid from "@lucid-evolution/lucid";
3
+ import * as OffchainCommon from "@3rd-eye-labs/cardano-offchain-common";
4
+ import * as Evo from "@evolution-sdk/evolution";
5
+
1
6
  // src/contracts/cdp/transactions.ts
2
7
  import {
3
8
  addAssets as addAssets6,
@@ -109,6 +114,12 @@ function rationalDiv(a, b) {
109
114
  function rationalToFloat(a) {
110
115
  return Number(a.numerator) / Number(a.denominator);
111
116
  }
117
+ function numberToRational(num, precision = 10 ** 12) {
118
+ return {
119
+ numerator: BigInt(Math.floor(num * precision)),
120
+ denominator: BigInt(precision)
121
+ };
122
+ }
112
123
 
113
124
  // src/contracts/pyth-feed/types.ts
114
125
  var PythConfigurationSchema = TSchema2.Struct({
@@ -8098,8 +8109,9 @@ async function requestSpAccountClosure(accountUtxo, sysParams, lucid, maxTxFee =
8098
8109
  )
8099
8110
  ).addSignerKey(toHex12(oldAccountDatum.owner));
8100
8111
  }
8101
- async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, txFee) {
8102
- const currentTime = BigInt(lucid.slotToUnixTime(lucid.currentSlot()));
8112
+ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, txFee, currentSlot) {
8113
+ const slot = currentSlot !== void 0 ? currentSlot : lucid.currentSlot();
8114
+ const currentTime = BigInt(lucid.slotToUnixTime(slot));
8103
8115
  const stabilityPoolScriptRef = matchSingle5(
8104
8116
  await lucid.utxosByOutRef([
8105
8117
  fromSystemParamsScriptRef(
@@ -8115,7 +8127,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
8115
8127
  getInlineDatumOrThrow(stabilityPoolUtxo)
8116
8128
  );
8117
8129
  const baseRefInputs = [iAssetUtxo, stabilityPoolScriptRef];
8118
- const validFrom = lucid.slotToUnixTime(lucid.currentSlot() - 1);
8130
+ const validFrom = lucid.slotToUnixTime(slot - 1);
8119
8131
  const tx = lucid.newTx().validFrom(validFrom).validTo(validFrom + sysParams.stabilityPoolParams.accountProcessingBiasMs).readFrom(baseRefInputs).collectFrom([stabilityPoolUtxo], {
8120
8132
  kind: "selected",
8121
8133
  inputs: [stabilityPoolUtxo, accountUtxo],
@@ -8487,7 +8499,7 @@ async function processSpRequestAuxiliary(stabilityPoolUtxo, accountUtxo, iAssetU
8487
8499
  }).exhaustive();
8488
8500
  return tx;
8489
8501
  }
8490
- async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid) {
8502
+ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE2s2sSnapshotOrefs, sysParams, lucid, currentSlot) {
8491
8503
  const draftTx = processSpRequestAuxiliary(
8492
8504
  stabilityPoolUtxo,
8493
8505
  accountUtxo,
@@ -8496,7 +8508,8 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
8496
8508
  sysParams,
8497
8509
  lucid,
8498
8510
  // Placeholder transation fee
8499
- 1n
8511
+ 1n,
8512
+ currentSlot
8500
8513
  );
8501
8514
  const fee = (await (await draftTx).complete()).toTransaction().body().fee();
8502
8515
  return processSpRequestAuxiliary(
@@ -8506,7 +8519,8 @@ async function processSpRequest(stabilityPoolUtxo, accountUtxo, iAssetUtxo, allE
8506
8519
  allE2s2sSnapshotOrefs,
8507
8520
  sysParams,
8508
8521
  lucid,
8509
- fee
8522
+ fee,
8523
+ currentSlot
8510
8524
  );
8511
8525
  }
8512
8526
  async function createE2s2sSnapshots(stabilityPoolOref, sysParams, lucid) {
@@ -11999,6 +12013,7 @@ export {
11999
12013
  CredentialSchema,
12000
12014
  DEFAULT_INIT_OPTIONS,
12001
12015
  DerivedPythPriceSchema,
12016
+ Evo,
12002
12017
  ExecuteParams,
12003
12018
  GovParams,
12004
12019
  IAssetPriceInfoSchema,
@@ -12007,6 +12022,7 @@ export {
12007
12022
  InterestCollectionParamsSchema,
12008
12023
  InterestOracleDatumSchema,
12009
12024
  InterestOracleParamsSchema,
12025
+ Lucid,
12010
12026
  MAX_BUY_ROB_REDEMPTIONS_COUNT,
12011
12027
  MAX_COLLATERAL_ASSETS_COUNT_PER_IASSET,
12012
12028
  MAX_E2S2S_ENTRIES_COUNT,
@@ -12017,6 +12033,7 @@ export {
12017
12033
  ONE_HOUR,
12018
12034
  ONE_SECOND,
12019
12035
  ONE_YEAR,
12036
+ OffchainCommon,
12020
12037
  OneShotParamsSchema,
12021
12038
  OracleIdxSchema,
12022
12039
  PRICE_UPDATE_MAGIC,
@@ -12216,6 +12233,7 @@ export {
12216
12233
  mkTreasuryValidatorFromSP,
12217
12234
  mkVersionRecordTokenPolicy,
12218
12235
  mkVersionRegistryValidator,
12236
+ numberToRational,
12219
12237
  oneShotMintTx,
12220
12238
  openCdp,
12221
12239
  openRob,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigo-labs/indigo-sdk",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Indigo SDK for interacting with Indigo endpoints via lucid-evolution",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -67,6 +67,7 @@
67
67
  "format": "npx prettier --write src/ tests/",
68
68
  "format:check": "npx prettier --check src/ tests/",
69
69
  "test": "vitest run",
70
- "lint-staged": "lint-staged"
70
+ "lint-staged": "lint-staged",
71
+ "release": "pnpm build && pnpm publish --access public"
71
72
  }
72
73
  }
package/src/index.ts CHANGED
@@ -1,3 +1,9 @@
1
+ // Reexports
2
+ export * as Lucid from '@lucid-evolution/lucid';
3
+ export * as OffchainCommon from '@3rd-eye-labs/cardano-offchain-common';
4
+ export * as Evo from '@evolution-sdk/evolution';
5
+
6
+ // SDK exports
1
7
  export * from './contracts/cdp/transactions';
2
8
  export * from './contracts/cdp/helpers';
3
9
  export * from './contracts/cdp/types';
@@ -59,3 +59,18 @@ export function rationalDiv(a: Rational, b: Rational): Rational {
59
59
  export function rationalToFloat(a: Rational): number {
60
60
  return Number(a.numerator) / Number(a.denominator);
61
61
  }
62
+
63
+ /**
64
+ * This is a lossy conversion, the precision determines the number
65
+ * of decimal places that will be retained. Additionally, use of floats
66
+ * causes some additional imprecisions.
67
+ */
68
+ export function numberToRational(
69
+ num: number,
70
+ precision: number = 10 ** 12,
71
+ ): Rational {
72
+ return {
73
+ numerator: BigInt(Math.floor(num * precision)),
74
+ denominator: BigInt(precision),
75
+ };
76
+ }