@indigo-labs/indigo-sdk 0.2.8 → 0.2.10

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
@@ -1565,8 +1565,8 @@ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalS
1565
1565
  declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
1566
 
1567
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>;
1568
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
1570
  declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
1571
 
1572
1572
  declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
package/dist/index.d.ts CHANGED
@@ -1565,8 +1565,8 @@ declare function distributeReward(snapshotAda: bigint, adaReward: bigint, totalS
1565
1565
  declare function calculateAdaReward(currentSnapshotAda: bigint, oldSnapshotAda: bigint, existingIndyAmount: bigint): bigint;
1566
1566
 
1567
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>;
1568
+ declare function adjustStakingPosition(stakingPositionRef: OutRef, amount: bigint, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1569
+ declare function closeStakingPosition(stakingPositionRef: OutRef, params: SystemParams, lucid: LucidEvolution, currentSlot: number, stakingManagerRef?: OutRef): Promise<TxBuilder>;
1570
1570
  declare function distributeAda(stakingManagerRef: OutRef, collectorRefs: OutRef[], params: SystemParams, lucid: LucidEvolution): Promise<TxBuilder>;
1571
1571
 
1572
1572
  declare const StakingParamsSchema: _lucid_evolution_lucid.TObject<{
package/dist/index.js CHANGED
@@ -4785,10 +4785,9 @@ async function openStakingPosition(amount, params, lucid, stakingManagerRef) {
4785
4785
  }
4786
4786
  ).addSignerKey(pkh.hash);
4787
4787
  }
4788
- async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, stakingManagerRef) {
4788
+ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, currentSlot, stakingManagerRef) {
4789
4789
  const network = lucid.config().network;
4790
- const currentSlot = lucid.currentSlot();
4791
- const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot);
4790
+ const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot) - ONE_SECOND;
4792
4791
  const stakingPositionOut = await findStakingPositionByOutRef(
4793
4792
  stakingPositionRef,
4794
4793
  lucid
@@ -4847,10 +4846,9 @@ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid,
4847
4846
  }
4848
4847
  ).addSignerKey((0, import_lucid35.toHex)(stakingPositionOut.datum.owner));
4849
4848
  }
4850
- async function closeStakingPosition(stakingPositionRef, params, lucid, stakingManagerRef) {
4849
+ async function closeStakingPosition(stakingPositionRef, params, lucid, currentSlot, stakingManagerRef) {
4851
4850
  const network = lucid.config().network;
4852
- const currentSlot = lucid.currentSlot();
4853
- const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot);
4851
+ const currentTime = (0, import_lucid35.slotToUnixTime)(network, currentSlot) - ONE_SECOND;
4854
4852
  const stakingPositionOut = await findStakingPositionByOutRef(
4855
4853
  stakingPositionRef,
4856
4854
  lucid
package/dist/index.mjs CHANGED
@@ -4603,10 +4603,9 @@ async function openStakingPosition(amount, params, lucid, stakingManagerRef) {
4603
4603
  }
4604
4604
  ).addSignerKey(pkh.hash);
4605
4605
  }
4606
- async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, stakingManagerRef) {
4606
+ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid, currentSlot, stakingManagerRef) {
4607
4607
  const network = lucid.config().network;
4608
- const currentSlot = lucid.currentSlot();
4609
- const currentTime = slotToUnixTime5(network, currentSlot);
4608
+ const currentTime = slotToUnixTime5(network, currentSlot) - ONE_SECOND;
4610
4609
  const stakingPositionOut = await findStakingPositionByOutRef(
4611
4610
  stakingPositionRef,
4612
4611
  lucid
@@ -4665,10 +4664,9 @@ async function adjustStakingPosition(stakingPositionRef, amount, params, lucid,
4665
4664
  }
4666
4665
  ).addSignerKey(toHex2(stakingPositionOut.datum.owner));
4667
4666
  }
4668
- async function closeStakingPosition(stakingPositionRef, params, lucid, stakingManagerRef) {
4667
+ async function closeStakingPosition(stakingPositionRef, params, lucid, currentSlot, stakingManagerRef) {
4669
4668
  const network = lucid.config().network;
4670
- const currentSlot = lucid.currentSlot();
4671
- const currentTime = slotToUnixTime5(network, currentSlot);
4669
+ const currentTime = slotToUnixTime5(network, currentSlot) - ONE_SECOND;
4672
4670
  const stakingPositionOut = await findStakingPositionByOutRef(
4673
4671
  stakingPositionRef,
4674
4672
  lucid
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@indigo-labs/indigo-sdk",
3
- "version": "0.2.8",
3
+ "version": "0.2.10",
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",
@@ -33,6 +33,7 @@ import { matchSingle } from '../../utils/utils';
33
33
  import { serialiseStakingRedeemer } from './types';
34
34
  import { serialiseCollectorRedeemer } from '../collector/types';
35
35
  import { mkLovelacesOf } from '../../utils/value-helpers';
36
+ import { ONE_SECOND } from '../../utils/time-helpers';
36
37
 
37
38
  export async function openStakingPosition(
38
39
  amount: bigint,
@@ -120,12 +121,11 @@ export async function adjustStakingPosition(
120
121
  amount: bigint,
121
122
  params: SystemParams,
122
123
  lucid: LucidEvolution,
124
+ currentSlot: number,
123
125
  stakingManagerRef?: OutRef,
124
126
  ): Promise<TxBuilder> {
125
-
126
127
  const network = lucid.config().network!;
127
- const currentSlot = lucid.currentSlot();
128
- const currentTime = slotToUnixTime(network, currentSlot);
128
+ const currentTime = slotToUnixTime(network, currentSlot) - ONE_SECOND;
129
129
 
130
130
  const stakingPositionOut = await findStakingPositionByOutRef(
131
131
  stakingPositionRef,
@@ -214,11 +214,11 @@ export async function closeStakingPosition(
214
214
  stakingPositionRef: OutRef,
215
215
  params: SystemParams,
216
216
  lucid: LucidEvolution,
217
+ currentSlot: number,
217
218
  stakingManagerRef?: OutRef,
218
219
  ): Promise<TxBuilder> {
219
220
  const network = lucid.config().network!;
220
- const currentSlot = lucid.currentSlot();
221
- const currentTime = slotToUnixTime(network, currentSlot);
221
+ const currentTime = slotToUnixTime(network, currentSlot) - ONE_SECOND;
222
222
 
223
223
  const stakingPositionOut = await findStakingPositionByOutRef(
224
224
  stakingPositionRef,