@indigo-labs/indigo-sdk 0.2.4 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1501,49 +1501,6 @@ declare function spSub(a: SPInteger, b: SPInteger): SPInteger;
1501
1501
  declare function spMul(a: SPInteger, b: SPInteger): SPInteger;
1502
1502
  declare function spDiv(a: SPInteger, b: SPInteger): SPInteger;
1503
1503
 
1504
- declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1505
- declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1506
- declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1507
- declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1508
-
1509
- declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
1510
- stakingManagerNft: _lucid_evolution_lucid.TObject<{
1511
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1512
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1513
- }>;
1514
- stakingToken: _lucid_evolution_lucid.TObject<{
1515
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1516
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1517
- }>;
1518
- indyToken: _lucid_evolution_lucid.TObject<{
1519
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1520
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1521
- }>;
1522
- pollToken: _lucid_evolution_lucid.TObject<{
1523
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1524
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1525
- }>;
1526
- versionRecordToken: _lucid_evolution_lucid.TObject<{
1527
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1528
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1529
- }>;
1530
- collectorValHash: _lucid_evolution_lucid.TUnsafe<string>;
1531
- }>;
1532
- type StakingParams = Data.Static<typeof StakingParamsSchema>;
1533
- declare const StakingParams: StakingParams;
1534
- declare const StakingRedeemerSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TLiteral<"UpgradeVersion"> | _lucid_evolution_lucid.TObject<{
1535
- CreateStakingPosition: _lucid_evolution_lucid.TObject<{
1536
- creatorPkh: _lucid_evolution_lucid.TUnsafe<string>;
1537
- }>;
1538
- }> | _lucid_evolution_lucid.TLiteral<"UpdateTotalStake"> | _lucid_evolution_lucid.TLiteral<"Distribute"> | _lucid_evolution_lucid.TObject<{
1539
- AdjustStakedAmount: _lucid_evolution_lucid.TObject<{
1540
- adjustAmount: _lucid_evolution_lucid.TUnsafe<bigint>;
1541
- }>;
1542
- }> | _lucid_evolution_lucid.TLiteral<"Unstake"> | _lucid_evolution_lucid.TLiteral<"Lock">)[]>;
1543
- type StakingRedeemer = Data.Static<typeof StakingRedeemerSchema>;
1544
- declare function serialiseStakingRedeemer(redeemer: StakingRedeemer): Redeemer;
1545
- declare function castStakingParams(params: StakingParams): Data;
1546
-
1547
1504
  declare const StakingPosLockedAmtSchema: Core.TSchema.Map<Core.TSchema.Integer, Core.TSchema.Struct<{
1548
1505
  voteAmt: Core.TSchema.Integer;
1549
1506
  votingEnd: Core.TSchema.Integer;
@@ -1588,6 +1545,68 @@ declare function parseStakingPositionOrThrow(datum: string): StakingPosition;
1588
1545
  declare function parseStakingManagerDatum(datum: string): StakingManager;
1589
1546
  declare function serialiseStakingDatum(d: StakingDatum): string;
1590
1547
 
1548
+ type StakingPositionOutput = {
1549
+ utxo: UTxO;
1550
+ datum: StakingPosition;
1551
+ };
1552
+ type StakingManagerOutput = {
1553
+ utxo: UTxO;
1554
+ datum: StakingManager;
1555
+ };
1556
+ /**
1557
+ * Update the staking position locked amount. In case proposal's voting finished, unlock the amount.
1558
+ */
1559
+ declare function updateStakingLockedAmount(stakingPosLockedAmt: StakingPosLockedAmt, currentTime: bigint): StakingPosLockedAmt;
1560
+ declare function findStakingManagerByOutRef(stakingManagerRef: OutRef, lucid: LucidEvolution): Promise<StakingManagerOutput>;
1561
+ declare function findStakingManager(params: SystemParams, lucid: LucidEvolution): Promise<StakingManagerOutput>;
1562
+ declare function findStakingPositionByOutRef(stakingPositionRef: OutRef, lucid: LucidEvolution): Promise<StakingPositionOutput>;
1563
+ declare const rewardSnapshotPrecision: bigint;
1564
+ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalStake: bigint): bigint;
1565
+ declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
+
1567
+ declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1568
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
+ declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
+
1572
+ declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
1573
+ stakingManagerNft: _lucid_evolution_lucid.TObject<{
1574
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1575
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1576
+ }>;
1577
+ stakingToken: _lucid_evolution_lucid.TObject<{
1578
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1579
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1580
+ }>;
1581
+ indyToken: _lucid_evolution_lucid.TObject<{
1582
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1583
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1584
+ }>;
1585
+ pollToken: _lucid_evolution_lucid.TObject<{
1586
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1587
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1588
+ }>;
1589
+ versionRecordToken: _lucid_evolution_lucid.TObject<{
1590
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1591
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1592
+ }>;
1593
+ collectorValHash: _lucid_evolution_lucid.TUnsafe<string>;
1594
+ }>;
1595
+ type StakingParams = Data.Static<typeof StakingParamsSchema>;
1596
+ declare const StakingParams: StakingParams;
1597
+ declare const StakingRedeemerSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TLiteral<"UpgradeVersion"> | _lucid_evolution_lucid.TObject<{
1598
+ CreateStakingPosition: _lucid_evolution_lucid.TObject<{
1599
+ creatorPkh: _lucid_evolution_lucid.TUnsafe<string>;
1600
+ }>;
1601
+ }> | _lucid_evolution_lucid.TLiteral<"UpdateTotalStake"> | _lucid_evolution_lucid.TLiteral<"Distribute"> | _lucid_evolution_lucid.TObject<{
1602
+ AdjustStakedAmount: _lucid_evolution_lucid.TObject<{
1603
+ adjustAmount: _lucid_evolution_lucid.TUnsafe<bigint>;
1604
+ }>;
1605
+ }> | _lucid_evolution_lucid.TLiteral<"Unstake"> | _lucid_evolution_lucid.TLiteral<"Lock">)[]>;
1606
+ type StakingRedeemer = Data.Static<typeof StakingRedeemerSchema>;
1607
+ declare function serialiseStakingRedeemer(redeemer: StakingRedeemer): Redeemer;
1608
+ declare function castStakingParams(params: StakingParams): Data;
1609
+
1591
1610
  declare function startInterestOracle(initialUnitaryInterest: bigint, initialInterestRate: bigint, initialLastInterestUpdate: bigint, oracleParams: InterestOracleParams, lucid: LucidEvolution, interestTokenName?: string, withScriptRef?: boolean, refOutRef?: OutRef): Promise<[TxBuilder, AssetClass]>;
1592
1611
  declare function feedInterestOracle(params: InterestOracleParams, newInterestRate: bigint, lucid: LucidEvolution, assetClass?: AssetClass, utxo?: UTxO, scriptRef?: UTxO): Promise<TxBuilder>;
1593
1612
 
@@ -2192,4 +2211,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2192
2211
  */
2193
2212
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2194
2213
 
2195
- export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, 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 StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingRedeemer, type StartTime, type SystemParams, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, endProposal, executeProposal, feedInterestOracle, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, vote, withdrawCdp };
2214
+ export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, 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 StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
package/dist/index.d.ts CHANGED
@@ -1501,49 +1501,6 @@ declare function spSub(a: SPInteger, b: SPInteger): SPInteger;
1501
1501
  declare function spMul(a: SPInteger, b: SPInteger): SPInteger;
1502
1502
  declare function spDiv(a: SPInteger, b: SPInteger): SPInteger;
1503
1503
 
1504
- declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1505
- declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1506
- declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1507
- declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1508
-
1509
- declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
1510
- stakingManagerNft: _lucid_evolution_lucid.TObject<{
1511
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1512
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1513
- }>;
1514
- stakingToken: _lucid_evolution_lucid.TObject<{
1515
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1516
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1517
- }>;
1518
- indyToken: _lucid_evolution_lucid.TObject<{
1519
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1520
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1521
- }>;
1522
- pollToken: _lucid_evolution_lucid.TObject<{
1523
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1524
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1525
- }>;
1526
- versionRecordToken: _lucid_evolution_lucid.TObject<{
1527
- currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1528
- tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1529
- }>;
1530
- collectorValHash: _lucid_evolution_lucid.TUnsafe<string>;
1531
- }>;
1532
- type StakingParams = Data.Static<typeof StakingParamsSchema>;
1533
- declare const StakingParams: StakingParams;
1534
- declare const StakingRedeemerSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TLiteral<"UpgradeVersion"> | _lucid_evolution_lucid.TObject<{
1535
- CreateStakingPosition: _lucid_evolution_lucid.TObject<{
1536
- creatorPkh: _lucid_evolution_lucid.TUnsafe<string>;
1537
- }>;
1538
- }> | _lucid_evolution_lucid.TLiteral<"UpdateTotalStake"> | _lucid_evolution_lucid.TLiteral<"Distribute"> | _lucid_evolution_lucid.TObject<{
1539
- AdjustStakedAmount: _lucid_evolution_lucid.TObject<{
1540
- adjustAmount: _lucid_evolution_lucid.TUnsafe<bigint>;
1541
- }>;
1542
- }> | _lucid_evolution_lucid.TLiteral<"Unstake"> | _lucid_evolution_lucid.TLiteral<"Lock">)[]>;
1543
- type StakingRedeemer = Data.Static<typeof StakingRedeemerSchema>;
1544
- declare function serialiseStakingRedeemer(redeemer: StakingRedeemer): Redeemer;
1545
- declare function castStakingParams(params: StakingParams): Data;
1546
-
1547
1504
  declare const StakingPosLockedAmtSchema: Core.TSchema.Map<Core.TSchema.Integer, Core.TSchema.Struct<{
1548
1505
  voteAmt: Core.TSchema.Integer;
1549
1506
  votingEnd: Core.TSchema.Integer;
@@ -1588,6 +1545,68 @@ declare function parseStakingPositionOrThrow(datum: string): StakingPosition;
1588
1545
  declare function parseStakingManagerDatum(datum: string): StakingManager;
1589
1546
  declare function serialiseStakingDatum(d: StakingDatum): string;
1590
1547
 
1548
+ type StakingPositionOutput = {
1549
+ utxo: UTxO;
1550
+ datum: StakingPosition;
1551
+ };
1552
+ type StakingManagerOutput = {
1553
+ utxo: UTxO;
1554
+ datum: StakingManager;
1555
+ };
1556
+ /**
1557
+ * Update the staking position locked amount. In case proposal's voting finished, unlock the amount.
1558
+ */
1559
+ declare function updateStakingLockedAmount(stakingPosLockedAmt: StakingPosLockedAmt, currentTime: bigint): StakingPosLockedAmt;
1560
+ declare function findStakingManagerByOutRef(stakingManagerRef: OutRef, lucid: LucidEvolution): Promise<StakingManagerOutput>;
1561
+ declare function findStakingManager(params: SystemParams, lucid: LucidEvolution): Promise<StakingManagerOutput>;
1562
+ declare function findStakingPositionByOutRef(stakingPositionRef: OutRef, lucid: LucidEvolution): Promise<StakingPositionOutput>;
1563
+ declare const rewardSnapshotPrecision: bigint;
1564
+ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalStake: bigint): bigint;
1565
+ declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
+
1567
+ declare function openStakingPosition(amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1568
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
+ declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
+
1572
+ declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
1573
+ stakingManagerNft: _lucid_evolution_lucid.TObject<{
1574
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1575
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1576
+ }>;
1577
+ stakingToken: _lucid_evolution_lucid.TObject<{
1578
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1579
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1580
+ }>;
1581
+ indyToken: _lucid_evolution_lucid.TObject<{
1582
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1583
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1584
+ }>;
1585
+ pollToken: _lucid_evolution_lucid.TObject<{
1586
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1587
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1588
+ }>;
1589
+ versionRecordToken: _lucid_evolution_lucid.TObject<{
1590
+ currencySymbol: _lucid_evolution_lucid.TUnsafe<string>;
1591
+ tokenName: _lucid_evolution_lucid.TUnsafe<string>;
1592
+ }>;
1593
+ collectorValHash: _lucid_evolution_lucid.TUnsafe<string>;
1594
+ }>;
1595
+ type StakingParams = Data.Static<typeof StakingParamsSchema>;
1596
+ declare const StakingParams: StakingParams;
1597
+ declare const StakingRedeemerSchema: _lucid_evolution_lucid.TUnion<(_lucid_evolution_lucid.TLiteral<"UpgradeVersion"> | _lucid_evolution_lucid.TObject<{
1598
+ CreateStakingPosition: _lucid_evolution_lucid.TObject<{
1599
+ creatorPkh: _lucid_evolution_lucid.TUnsafe<string>;
1600
+ }>;
1601
+ }> | _lucid_evolution_lucid.TLiteral<"UpdateTotalStake"> | _lucid_evolution_lucid.TLiteral<"Distribute"> | _lucid_evolution_lucid.TObject<{
1602
+ AdjustStakedAmount: _lucid_evolution_lucid.TObject<{
1603
+ adjustAmount: _lucid_evolution_lucid.TUnsafe<bigint>;
1604
+ }>;
1605
+ }> | _lucid_evolution_lucid.TLiteral<"Unstake"> | _lucid_evolution_lucid.TLiteral<"Lock">)[]>;
1606
+ type StakingRedeemer = Data.Static<typeof StakingRedeemerSchema>;
1607
+ declare function serialiseStakingRedeemer(redeemer: StakingRedeemer): Redeemer;
1608
+ declare function castStakingParams(params: StakingParams): Data;
1609
+
1591
1610
  declare function startInterestOracle(initialUnitaryInterest: bigint, initialInterestRate: bigint, initialLastInterestUpdate: bigint, oracleParams: InterestOracleParams, lucid: LucidEvolution, interestTokenName?: string, withScriptRef?: boolean, refOutRef?: OutRef): Promise<[TxBuilder, AssetClass]>;
1592
1611
  declare function feedInterestOracle(params: InterestOracleParams, newInterestRate: bigint, lucid: LucidEvolution, assetClass?: AssetClass, utxo?: UTxO, scriptRef?: UTxO): Promise<TxBuilder>;
1593
1612
 
@@ -2192,4 +2211,4 @@ declare function calculateCollateralRatioFromLeverage(iasset: string, leverage:
2192
2211
  */
2193
2212
  declare function calculateLeverageFromCollateralRatio(iasset: string, collateralRatioPercentage: OnChainDecimal, baseCollateral: bigint, iassetPrice: OnChainDecimal, debtMintingFeePercentage: OnChainDecimal, redemptionReimbursementPercentage: OnChainDecimal, lrpParams: LrpParamsSP, allLrps: [UTxO, LRPDatum][]): number | undefined;
2194
2213
 
2195
- export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, 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 StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingRedeemer, type StartTime, type SystemParams, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, endProposal, executeProposal, feedInterestOracle, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, vote, withdrawCdp };
2214
+ export { type AccountAction, type AccountContent, AccountContentSchema, ActionReturnDatum, ActionReturnDatumSchema, type AddressCredential, type AddressCredentialOrDatum, AddressD, type AddressSP, AddressSchema, type Amount, type AssetClass, type AssetClassSP, AssetClassSchema, type AuthTokenPolicies, type CDPContent, CDPContentSchema, CDPCreatorParams, type CDPCreatorParamsSP, CDPCreatorRedeemer, type CDPDatum, CDPDatumSchema, type CDPFees, CDPFeesSchema, type CDPRedeemer, type CdpParams, type CdpParamsSP, type CollectorParamsSP, CredentialD, CredentialSchema, type CurrencySymbol, type DistributionParams, type EpochToScaleToSum, EpochToScaleToSumSchema, ExecuteDatum, ExecuteParams, type ExecuteParamsSP, type FeedInterestOracleRedeemer, FeedInterestOracleRedeemerSchema, type GovDatum, GovParams, type GovParamsSP, GovRedeemer, type IAssetContent, IAssetContentSchema, type IAssetOutput, IAssetPriceInfoSchema, type Input, type InterestOracleDatum, InterestOracleDatumSchema, type InterestOracleParams, InterestOracleParamsSchema, type LRPDatum, LRPDatumSchema, type LRPParams, LRPParamsSchema, type LRPRedeemer, LRPRedeemerSchema, type LrpOutput, type LrpParamsSP, MAX_REDEMPTIONS_WITH_CDP_OPEN, MIN_LRP_COLLATERAL_AMT, ONE_DAY, ONE_HOUR, ONE_SECOND, ONE_YEAR, type OracleAssetNft, OracleAssetNftSchema, type Output, type OutputReference, OutputReferenceSchema, PollManagerParams, type PollManagerParamsSP, PollManagerRedeemer, PollShardParams, type PollShardParamsSP, PollShardRedeemer, type PriceOracleDatum, PriceOracleDatumSchema, type PriceOracleParams, PriceOracleParamsSchema, type PriceOracleRedeemer, type PubKeyHash, 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 StabilityPoolSnapshot, StakeCredentialSchema, type StakingManager, type StakingManagerOutput, type StakingParamsSP, type StakingPosLockedAmt, type StakingPosition, type StakingPositionOutput, type StakingRedeemer, type StartTime, type SystemParams, type TokenName, type TreasuryParamsSP, type TreasuryWithdrawal, type TreasuryWithdrawalItem, TreasuryWithdrawalSchema, type ValidatorHashes, VerificationKeyHashSchema, type VersionRecordParams, VersionRecordTokenParams, type VoteOption, addrDetails, addressFromBech32, addressToBech32, adjust, adjustLrp, adjustSpAccount, adjustStakingPosition, adjustmentHelper, approximateLeverageRedemptions, assetClassToUnit, assetClassValueOf, balance, buildRedemptionsTx, burnCdp, calculateAdaReward, calculateCollateralRatioFromLeverage, calculateIAssetRedemptionAmt, calculateLeverageFromCollateralRatio, calculateMinCollateralCappedIAssetRedemptionAmt, calculateTotalAdaForRedemption, cancelLrp, castCDPCreatorParams, castCdpParams, castExecuteParams, castGovParams, castInterestOracleParams, castLrpParams, castPollManagerParams, castPollShardParams, castPriceOracleParams, castStabilityPoolParams, castStakingParams, castVersionRecordTokenParams, cdpCollateralRatioPercentage, claimLrp, closeCdp, closeSpAccount, closeStakingPosition, collectorFeeTx, createProposal, createScriptAddress, createShardsChunks, createSpAccount, depositCdp, distributeAda, distributeReward, endProposal, executeProposal, feedInterestOracle, findStakingManager, findStakingManagerByOutRef, findStakingPositionByOutRef, freezeCdp, fromSPInteger, fromSysParamsScriptCredential, fromSystemParamsAsset, fromSystemParamsScriptRef, getAccountFund, getAccountReward, getInlineDatumOrThrow, getRandomElement, getSumFromEpochToScaleToSum, initEpochToScaleToSumMap, initSpSnapshot, insertSorted, isAssetsZero, leverageCdpWithLrp, liquidateCdp, liquidationHelper, loadSystemParamsFromFile, loadSystemParamsFromUrl, lovelacesAmt, lrpRedeemableLovelacesInclReimb, matchSingle, mergeCdps, mergeShards, mintCdp, mkAssetsOf, mkCDPCreatorValidator, mkCDPCreatorValidatorFromSP, mkCdpValidatorFromSP, mkCollectorValidatorFromSP, mkExecuteValidator, mkExecuteValidatorFromSP, mkInterestOracleValidator, mkLovelacesOf, mkLrpValidator, mkLrpValidatorFromSP, mkPollManagerValidator, mkPollManagerValidatorFromSP, mkPollShardValidator, mkPollShardValidatorFromSP, mkSPInteger, mkTreasuryValidatorFromSP, mkVersionRecordTokenPolicy, mkVersionRegistryValidator, negateAssets, oneShotMintTx, openCdp, openLrp, openStakingPosition, parseAccountDatum, parseCdpDatum, parseCdpDatumOrThrow, parseExecuteDatum, parseExecuteDatumOrThrow, parseGovDatum, parseGovDatumOrThrow, parseIAssetDatum, parseIAssetDatumOrThrow, parseInterestOracleDatum, parseLrpDatum, parseLrpDatumOrThrow, parsePriceOracleDatum, parseSnapshotEpochToScaleToSumDatum, parseStabilityPoolDatum, parseStakingManagerDatum, parseStakingPosition, parseStakingPositionOrThrow, processSpRequest, randomLrpsSubsetSatisfyingTargetLovelaces, redeemCdp, redeemLrp, rewardSnapshotPrecision, runCreateScriptRefTx, runOneShotMintTx, scriptRef, serialiseCDPCreatorDatum, serialiseCDPCreatorRedeemer, serialiseCdpDatum, serialiseCdpRedeemer, serialiseExecuteDatum, serialiseFeedInterestOracleRedeemer, serialiseGovDatum, serialiseGovRedeemer, serialiseIAssetDatum, serialiseInterestOracleDatum, serialiseLrpDatum, serialiseLrpRedeemer, serialisePollManagerRedeemer, serialisePollShardRedeemer, serialisePriceOracleDatum, serialisePriceOracleRedeemer, serialiseStabilityPoolDatum, serialiseStabilityPoolRedeemer, serialiseStakingDatum, serialiseStakingRedeemer, setSumInEpochToScaleToSum, shuffle, spAdd, spDiv, spMul, spSub, startInterestOracle, summarizeActualLeverageRedemptions, toSystemParamsAsset, treasuryFeeTx, updatePoolSnapshotWithdrawalFee, updateStakingLockedAmount, vote, withdrawCdp };
package/dist/index.js CHANGED
@@ -94,6 +94,7 @@ __export(index_exports, {
94
94
  balance: () => balance,
95
95
  buildRedemptionsTx: () => buildRedemptionsTx,
96
96
  burnCdp: () => burnCdp,
97
+ calculateAdaReward: () => calculateAdaReward,
97
98
  calculateCollateralRatioFromLeverage: () => calculateCollateralRatioFromLeverage,
98
99
  calculateIAssetRedemptionAmt: () => calculateIAssetRedemptionAmt,
99
100
  calculateLeverageFromCollateralRatio: () => calculateLeverageFromCollateralRatio,
@@ -124,9 +125,13 @@ __export(index_exports, {
124
125
  createSpAccount: () => createSpAccount,
125
126
  depositCdp: () => depositCdp,
126
127
  distributeAda: () => distributeAda,
128
+ distributeReward: () => distributeReward,
127
129
  endProposal: () => endProposal,
128
130
  executeProposal: () => executeProposal,
129
131
  feedInterestOracle: () => feedInterestOracle,
132
+ findStakingManager: () => findStakingManager,
133
+ findStakingManagerByOutRef: () => findStakingManagerByOutRef,
134
+ findStakingPositionByOutRef: () => findStakingPositionByOutRef,
130
135
  freezeCdp: () => freezeCdp,
131
136
  fromSPInteger: () => fromSPInteger,
132
137
  fromSysParamsScriptCredential: () => fromSysParamsScriptCredential,
@@ -198,6 +203,7 @@ __export(index_exports, {
198
203
  randomLrpsSubsetSatisfyingTargetLovelaces: () => randomLrpsSubsetSatisfyingTargetLovelaces,
199
204
  redeemCdp: () => redeemCdp,
200
205
  redeemLrp: () => redeemLrp,
206
+ rewardSnapshotPrecision: () => rewardSnapshotPrecision,
201
207
  runCreateScriptRefTx: () => runCreateScriptRefTx,
202
208
  runOneShotMintTx: () => runOneShotMintTx,
203
209
  scriptRef: () => scriptRef,
@@ -232,6 +238,7 @@ __export(index_exports, {
232
238
  toSystemParamsAsset: () => toSystemParamsAsset,
233
239
  treasuryFeeTx: () => treasuryFeeTx,
234
240
  updatePoolSnapshotWithdrawalFee: () => updatePoolSnapshotWithdrawalFee,
241
+ updateStakingLockedAmount: () => updateStakingLockedAmount,
235
242
  vote: () => vote,
236
243
  withdrawCdp: () => withdrawCdp
237
244
  });
@@ -2878,6 +2885,9 @@ var rewardSnapshotPrecision = OCD_DECIMAL_UNIT * OCD_DECIMAL_UNIT;
2878
2885
  function distributeReward(snapshotAda, adaReward, totalStake) {
2879
2886
  return snapshotAda + adaReward * rewardSnapshotPrecision / totalStake;
2880
2887
  }
2888
+ function calculateAdaReward(currentSnapshotAda, oldSnapshotAda, existingIndyAmount) {
2889
+ return (currentSnapshotAda - oldSnapshotAda) * existingIndyAmount / rewardSnapshotPrecision;
2890
+ }
2881
2891
 
2882
2892
  // src/contracts/vesting/helpers.ts
2883
2893
  var import_ts_pattern10 = require("ts-pattern");
@@ -6146,6 +6156,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6146
6156
  balance,
6147
6157
  buildRedemptionsTx,
6148
6158
  burnCdp,
6159
+ calculateAdaReward,
6149
6160
  calculateCollateralRatioFromLeverage,
6150
6161
  calculateIAssetRedemptionAmt,
6151
6162
  calculateLeverageFromCollateralRatio,
@@ -6176,9 +6187,13 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6176
6187
  createSpAccount,
6177
6188
  depositCdp,
6178
6189
  distributeAda,
6190
+ distributeReward,
6179
6191
  endProposal,
6180
6192
  executeProposal,
6181
6193
  feedInterestOracle,
6194
+ findStakingManager,
6195
+ findStakingManagerByOutRef,
6196
+ findStakingPositionByOutRef,
6182
6197
  freezeCdp,
6183
6198
  fromSPInteger,
6184
6199
  fromSysParamsScriptCredential,
@@ -6250,6 +6265,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6250
6265
  randomLrpsSubsetSatisfyingTargetLovelaces,
6251
6266
  redeemCdp,
6252
6267
  redeemLrp,
6268
+ rewardSnapshotPrecision,
6253
6269
  runCreateScriptRefTx,
6254
6270
  runOneShotMintTx,
6255
6271
  scriptRef,
@@ -6284,6 +6300,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
6284
6300
  toSystemParamsAsset,
6285
6301
  treasuryFeeTx,
6286
6302
  updatePoolSnapshotWithdrawalFee,
6303
+ updateStakingLockedAmount,
6287
6304
  vote,
6288
6305
  withdrawCdp
6289
6306
  });
package/dist/index.mjs CHANGED
@@ -2675,6 +2675,9 @@ var rewardSnapshotPrecision = OCD_DECIMAL_UNIT * OCD_DECIMAL_UNIT;
2675
2675
  function distributeReward(snapshotAda, adaReward, totalStake) {
2676
2676
  return snapshotAda + adaReward * rewardSnapshotPrecision / totalStake;
2677
2677
  }
2678
+ function calculateAdaReward(currentSnapshotAda, oldSnapshotAda, existingIndyAmount) {
2679
+ return (currentSnapshotAda - oldSnapshotAda) * existingIndyAmount / rewardSnapshotPrecision;
2680
+ }
2678
2681
 
2679
2682
  // src/contracts/vesting/helpers.ts
2680
2683
  import { match as match10, P as P9 } from "ts-pattern";
@@ -6004,6 +6007,7 @@ export {
6004
6007
  balance,
6005
6008
  buildRedemptionsTx,
6006
6009
  burnCdp,
6010
+ calculateAdaReward,
6007
6011
  calculateCollateralRatioFromLeverage,
6008
6012
  calculateIAssetRedemptionAmt,
6009
6013
  calculateLeverageFromCollateralRatio,
@@ -6034,9 +6038,13 @@ export {
6034
6038
  createSpAccount,
6035
6039
  depositCdp,
6036
6040
  distributeAda,
6041
+ distributeReward,
6037
6042
  endProposal,
6038
6043
  executeProposal,
6039
6044
  feedInterestOracle,
6045
+ findStakingManager,
6046
+ findStakingManagerByOutRef,
6047
+ findStakingPositionByOutRef,
6040
6048
  freezeCdp,
6041
6049
  fromSPInteger,
6042
6050
  fromSysParamsScriptCredential,
@@ -6108,6 +6116,7 @@ export {
6108
6116
  randomLrpsSubsetSatisfyingTargetLovelaces,
6109
6117
  redeemCdp,
6110
6118
  redeemLrp,
6119
+ rewardSnapshotPrecision,
6111
6120
  runCreateScriptRefTx,
6112
6121
  runOneShotMintTx,
6113
6122
  scriptRef,
@@ -6142,6 +6151,7 @@ export {
6142
6151
  toSystemParamsAsset,
6143
6152
  treasuryFeeTx,
6144
6153
  updatePoolSnapshotWithdrawalFee,
6154
+ updateStakingLockedAmount,
6145
6155
  vote,
6146
6156
  withdrawCdp
6147
6157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigo-labs/indigo-sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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",
@@ -125,3 +125,11 @@ export function distributeReward(
125
125
  ): bigint {
126
126
  return snapshotAda + (adaReward * rewardSnapshotPrecision) / totalStake;
127
127
  }
128
+
129
+ export function calculateAdaReward(
130
+ currentSnapshotAda: bigint,
131
+ oldSnapshotAda: bigint,
132
+ existingIndyAmount: bigint,
133
+ ): bigint {
134
+ return ((currentSnapshotAda - oldSnapshotAda) * existingIndyAmount) / rewardSnapshotPrecision;
135
+ }
package/src/index.ts CHANGED
@@ -10,6 +10,7 @@ export * from './contracts/gov/transactions';
10
10
  export * from './contracts/gov/types';
11
11
  export * from './contracts/stability-pool/transactions';
12
12
  export * from './contracts/stability-pool/types-new';
13
+ export * from './contracts/staking/helpers';
13
14
  export * from './contracts/staking/transactions';
14
15
  export * from './contracts/staking/types';
15
16
  export * from './contracts/staking/types-new';