Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/burn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import {
Address,
Assets,
createClient,
Data,
ScriptHash,
Transaction,
TransactionHash,
Expand Down Expand Up @@ -76,7 +75,6 @@ const program = new Command()
.newTx(wallet.utxos)
.mintAssets({
assets: Assets.fromRecord({ [token]: amount * -1n }),
redeemer: new Data.Constr({ index: 0n, fields: [] }),
})
.readFrom({ referenceInputs: [refScript] })
.setValidity({ to: BigInt(Date.now() + expiresIn) })
Comment thread
SynthLuvr marked this conversation as resolved.
Expand Down
19 changes: 10 additions & 9 deletions src/distribute.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { readFileSync } from "fs";
import { password } from "@inquirer/prompts";
import { PlutusV2 } from "@evolution-sdk/evolution/PlutusV2";
import { PlutusV3 } from "@evolution-sdk/evolution/PlutusV3";
import {
Address,
Assets,
Expand Down Expand Up @@ -105,7 +105,7 @@ const program = new Command()
address: blackholeAddr,
assets: Assets.fromLovelace(2000000n),
datum: new InlineDatum.InlineDatum({
data: new Data.Constr({ index: 0n, fields: [] }),
data: Data.constr(0n, []),
}),
script,
})
Comment thread
SynthLuvr marked this conversation as resolved.
Expand Down Expand Up @@ -156,7 +156,6 @@ const program = new Command()
for (const [j, token] of tokens.entries()) {
mintBuilder.mintAssets({
assets: Assets.fromRecord({ [token]: 1n }),
redeemer: new Data.Constr({ index: 0n, fields: [] }),
});
mintBuilder.payToAddress({
address: Address.fromBech32(addrs[j]),
Comment thread
SynthLuvr marked this conversation as resolved.
Expand Down Expand Up @@ -219,12 +218,14 @@ const Addresses = (network: "Mainnet" | "Preprod" | "Preview") =>
return lines;
});

const createScript = (plutus: string, ref: UTxO.UTxO): PlutusV2 => {
const scriptHex = UPLC.applyParamsToScript(plutus, [
TransactionHash.toBytes(ref.transactionId),
]);
const createScript = (plutus: string, ref: UTxO.UTxO): PlutusV3 => {
const scriptHex = UPLC.applySingleCborEncoding(
UPLC.applyParamsToScript(plutus, [
TransactionHash.toBytes(ref.transactionId),
])
);

return new PlutusV2({ bytes: hexToBytes(scriptHex) });
return new PlutusV3({ bytes: hexToBytes(scriptHex) });
};
Comment thread
SynthLuvr marked this conversation as resolved.

const createBlackholeAddress = (
Expand All @@ -237,7 +238,7 @@ const createBlackholeAddress = (
const footer = "0048810014984d9595cd01";

const scriptHex = `${header}${body}${footer}`;
const script = new PlutusV2({ bytes: hexToBytes(scriptHex) });
const script = new PlutusV3({ bytes: hexToBytes(scriptHex) });
const scriptHash = ScriptHash.fromScript(script);

return new Address.Address({
Expand Down
2 changes: 1 addition & 1 deletion src/nft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const program = new Command()
address: blackholeAddr,
assets: Assets.fromLovelace(2000000n),
datum: new InlineDatum.InlineDatum({
data: new Data.Constr({ index: 0n, fields: [] }),
data: Data.constr(0n, []),
}),
Comment thread
SynthLuvr marked this conversation as resolved.
script,
Comment thread
SynthLuvr marked this conversation as resolved.
})
Expand Down
19 changes: 9 additions & 10 deletions src/zero.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { PlutusV2 } from "@evolution-sdk/evolution/PlutusV2";
import { PlutusV3 } from "@evolution-sdk/evolution/PlutusV3";
import {
Address,
Assets,
createClient,
Data,
ScriptHash,
TransactionHash,
UPLC,
Expand Down Expand Up @@ -64,7 +63,6 @@ const program = new Command()
.newTx(wallet.utxos)
.mintAssets({
assets: Assets.fromRecord({ [token]: 1n }),
redeemer: new Data.Constr({ index: 0n, fields: [] }),
})
.attachScript({ script })
.collectFrom({ inputs: [ref] })
Comment thread
SynthLuvr marked this conversation as resolved.
Expand All @@ -79,7 +77,6 @@ const program = new Command()
.newTx(mintChain.available)
.mintAssets({
assets: Assets.fromRecord({ [token]: -1n }),
redeemer: new Data.Constr({ index: 0n, fields: [] }),
})
.attachScript({ script })
.setValidity({ to: BigInt(Date.now() + expiresIn) })
Comment thread
SynthLuvr marked this conversation as resolved.
Expand All @@ -93,13 +90,15 @@ const program = new Command()
console.log(`\nCreated token: ${token}`);
});

const createScript = (plutus: string, ref: UTxO.UTxO): PlutusV2 => {
const scriptHex = UPLC.applyParamsToScript(plutus, [
TransactionHash.toBytes(ref.transactionId),
ref.index,
]);
const createScript = (plutus: string, ref: UTxO.UTxO): PlutusV3 => {
const scriptHex = UPLC.applySingleCborEncoding(
UPLC.applyParamsToScript(plutus, [
TransactionHash.toBytes(ref.transactionId),
ref.index,
])
);

return new PlutusV2({ bytes: hexToBytes(scriptHex) });
return new PlutusV3({ bytes: hexToBytes(scriptHex) });
};
Comment thread
SynthLuvr marked this conversation as resolved.

program.parseAsync(process.argv);