@indigo-labs/indigo-sdk 0.2.5 → 0.2.7
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 +63 -44
- package/dist/index.d.ts +63 -44
- package/dist/index.js +23 -1
- package/dist/index.mjs +16 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/utils/lucid-utils.ts +5 -1
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
|
});
|
|
@@ -276,7 +283,12 @@ function getInlineDatumOrThrow(utxo) {
|
|
|
276
283
|
}
|
|
277
284
|
async function addrDetails(lucid) {
|
|
278
285
|
const addr = await lucid.wallet().address();
|
|
279
|
-
|
|
286
|
+
let stakeCredential = void 0;
|
|
287
|
+
try {
|
|
288
|
+
stakeCredential = (0, import_lucid2.stakeCredentialOf)(addr);
|
|
289
|
+
} catch (_) {
|
|
290
|
+
}
|
|
291
|
+
return [(0, import_lucid2.paymentCredentialOf)(addr), stakeCredential];
|
|
280
292
|
}
|
|
281
293
|
function createScriptAddress(network, scriptHash, stakeCredential) {
|
|
282
294
|
return (0, import_lucid2.credentialToAddress)(
|
|
@@ -2878,6 +2890,9 @@ var rewardSnapshotPrecision = OCD_DECIMAL_UNIT * OCD_DECIMAL_UNIT;
|
|
|
2878
2890
|
function distributeReward(snapshotAda, adaReward, totalStake) {
|
|
2879
2891
|
return snapshotAda + adaReward * rewardSnapshotPrecision / totalStake;
|
|
2880
2892
|
}
|
|
2893
|
+
function calculateAdaReward(currentSnapshotAda, oldSnapshotAda, existingIndyAmount) {
|
|
2894
|
+
return (currentSnapshotAda - oldSnapshotAda) * existingIndyAmount / rewardSnapshotPrecision;
|
|
2895
|
+
}
|
|
2881
2896
|
|
|
2882
2897
|
// src/contracts/vesting/helpers.ts
|
|
2883
2898
|
var import_ts_pattern10 = require("ts-pattern");
|
|
@@ -6146,6 +6161,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
|
|
|
6146
6161
|
balance,
|
|
6147
6162
|
buildRedemptionsTx,
|
|
6148
6163
|
burnCdp,
|
|
6164
|
+
calculateAdaReward,
|
|
6149
6165
|
calculateCollateralRatioFromLeverage,
|
|
6150
6166
|
calculateIAssetRedemptionAmt,
|
|
6151
6167
|
calculateLeverageFromCollateralRatio,
|
|
@@ -6176,9 +6192,13 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
|
|
|
6176
6192
|
createSpAccount,
|
|
6177
6193
|
depositCdp,
|
|
6178
6194
|
distributeAda,
|
|
6195
|
+
distributeReward,
|
|
6179
6196
|
endProposal,
|
|
6180
6197
|
executeProposal,
|
|
6181
6198
|
feedInterestOracle,
|
|
6199
|
+
findStakingManager,
|
|
6200
|
+
findStakingManagerByOutRef,
|
|
6201
|
+
findStakingPositionByOutRef,
|
|
6182
6202
|
freezeCdp,
|
|
6183
6203
|
fromSPInteger,
|
|
6184
6204
|
fromSysParamsScriptCredential,
|
|
@@ -6250,6 +6270,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
|
|
|
6250
6270
|
randomLrpsSubsetSatisfyingTargetLovelaces,
|
|
6251
6271
|
redeemCdp,
|
|
6252
6272
|
redeemLrp,
|
|
6273
|
+
rewardSnapshotPrecision,
|
|
6253
6274
|
runCreateScriptRefTx,
|
|
6254
6275
|
runOneShotMintTx,
|
|
6255
6276
|
scriptRef,
|
|
@@ -6284,6 +6305,7 @@ async function leverageCdpWithLrp(leverage, baseCollateral, priceOracleOutRef, i
|
|
|
6284
6305
|
toSystemParamsAsset,
|
|
6285
6306
|
treasuryFeeTx,
|
|
6286
6307
|
updatePoolSnapshotWithdrawalFee,
|
|
6308
|
+
updateStakingLockedAmount,
|
|
6287
6309
|
vote,
|
|
6288
6310
|
withdrawCdp
|
|
6289
6311
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -47,7 +47,12 @@ function getInlineDatumOrThrow(utxo) {
|
|
|
47
47
|
}
|
|
48
48
|
async function addrDetails(lucid) {
|
|
49
49
|
const addr = await lucid.wallet().address();
|
|
50
|
-
|
|
50
|
+
let stakeCredential = void 0;
|
|
51
|
+
try {
|
|
52
|
+
stakeCredential = stakeCredentialOf(addr);
|
|
53
|
+
} catch (_) {
|
|
54
|
+
}
|
|
55
|
+
return [paymentCredentialOf(addr), stakeCredential];
|
|
51
56
|
}
|
|
52
57
|
function createScriptAddress(network, scriptHash, stakeCredential) {
|
|
53
58
|
return credentialToAddress(
|
|
@@ -2675,6 +2680,9 @@ var rewardSnapshotPrecision = OCD_DECIMAL_UNIT * OCD_DECIMAL_UNIT;
|
|
|
2675
2680
|
function distributeReward(snapshotAda, adaReward, totalStake) {
|
|
2676
2681
|
return snapshotAda + adaReward * rewardSnapshotPrecision / totalStake;
|
|
2677
2682
|
}
|
|
2683
|
+
function calculateAdaReward(currentSnapshotAda, oldSnapshotAda, existingIndyAmount) {
|
|
2684
|
+
return (currentSnapshotAda - oldSnapshotAda) * existingIndyAmount / rewardSnapshotPrecision;
|
|
2685
|
+
}
|
|
2678
2686
|
|
|
2679
2687
|
// src/contracts/vesting/helpers.ts
|
|
2680
2688
|
import { match as match10, P as P9 } from "ts-pattern";
|
|
@@ -6004,6 +6012,7 @@ export {
|
|
|
6004
6012
|
balance,
|
|
6005
6013
|
buildRedemptionsTx,
|
|
6006
6014
|
burnCdp,
|
|
6015
|
+
calculateAdaReward,
|
|
6007
6016
|
calculateCollateralRatioFromLeverage,
|
|
6008
6017
|
calculateIAssetRedemptionAmt,
|
|
6009
6018
|
calculateLeverageFromCollateralRatio,
|
|
@@ -6034,9 +6043,13 @@ export {
|
|
|
6034
6043
|
createSpAccount,
|
|
6035
6044
|
depositCdp,
|
|
6036
6045
|
distributeAda,
|
|
6046
|
+
distributeReward,
|
|
6037
6047
|
endProposal,
|
|
6038
6048
|
executeProposal,
|
|
6039
6049
|
feedInterestOracle,
|
|
6050
|
+
findStakingManager,
|
|
6051
|
+
findStakingManagerByOutRef,
|
|
6052
|
+
findStakingPositionByOutRef,
|
|
6040
6053
|
freezeCdp,
|
|
6041
6054
|
fromSPInteger,
|
|
6042
6055
|
fromSysParamsScriptCredential,
|
|
@@ -6108,6 +6121,7 @@ export {
|
|
|
6108
6121
|
randomLrpsSubsetSatisfyingTargetLovelaces,
|
|
6109
6122
|
redeemCdp,
|
|
6110
6123
|
redeemLrp,
|
|
6124
|
+
rewardSnapshotPrecision,
|
|
6111
6125
|
runCreateScriptRefTx,
|
|
6112
6126
|
runOneShotMintTx,
|
|
6113
6127
|
scriptRef,
|
|
@@ -6142,6 +6156,7 @@ export {
|
|
|
6142
6156
|
toSystemParamsAsset,
|
|
6143
6157
|
treasuryFeeTx,
|
|
6144
6158
|
updatePoolSnapshotWithdrawalFee,
|
|
6159
|
+
updateStakingLockedAmount,
|
|
6145
6160
|
vote,
|
|
6146
6161
|
withdrawCdp
|
|
6147
6162
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indigo-labs/indigo-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
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",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"author": "3rd Eye Labs",
|
|
41
41
|
"license": "MIT",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@3rd-eye-labs/cardano-offchain-common": "^1.1.
|
|
43
|
+
"@3rd-eye-labs/cardano-offchain-common": "^1.1.8",
|
|
44
44
|
"@evolution-sdk/evolution": "^0.2.5",
|
|
45
45
|
"@harmoniclabs/crypto": "^0.3.0",
|
|
46
46
|
"@lucid-evolution/lucid": "^0.4.29",
|
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';
|
package/src/utils/lucid-utils.ts
CHANGED
|
@@ -39,7 +39,11 @@ export async function addrDetails(
|
|
|
39
39
|
lucid: LucidEvolution,
|
|
40
40
|
): Promise<[Credential, Credential | undefined]> {
|
|
41
41
|
const addr = await lucid.wallet().address();
|
|
42
|
-
|
|
42
|
+
let stakeCredential = undefined;
|
|
43
|
+
try {
|
|
44
|
+
stakeCredential = stakeCredentialOf(addr);
|
|
45
|
+
} catch (_) {}
|
|
46
|
+
return [paymentCredentialOf(addr), stakeCredential];
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
export function createScriptAddress(
|