Skip to content

Commit

Permalink
feat(lockAda): change initial point for tx validity calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeusgr committed Jun 1, 2023
1 parent 6b5bb80 commit c5f7c26
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lockAda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export const lockAda = async (

const validatorAddress = Address.fromValidatorHash(validatorHash);
const benAddr = bob.address;
const emulatorDate = 1677108984000; // from src/preprod.json
const networkParamsFile = await fs.readFile('./src/preprod.json', 'utf8');
const networkParams = new NetworkParams(JSON.parse(networkParamsFile.toString()));
const emulatorDate = Number(await networkParams.slotToTime(0n));
const deadline = new Date(emulatorDate + duration);
const benPkh = bob.pubKeyHash;
const ownerPkh = alice.pubKeyHash;
Expand Down Expand Up @@ -100,9 +102,6 @@ export const lockAda = async (
// Add the destination address and the amount of Ada to lock including a datum
tx.addOutput(new TxOutput(validatorAddress, lockedVal, inlineDatum));

// beforeAll?
const networkParamsFile = await fs.readFile('./src/preprod.json', 'utf8');
const networkParams = new NetworkParams(JSON.parse(networkParamsFile.toString()));

await tx.finalize(networkParams, alice.address);
const txId = await network.submitTx(tx);
Expand Down

0 comments on commit c5f7c26

Please sign in to comment.