diff --git a/src/burn.ts b/src/burn.ts index 714232b..363c4cc 100644 --- a/src/burn.ts +++ b/src/burn.ts @@ -2,7 +2,6 @@ import { Address, Assets, createClient, - Data, ScriptHash, Transaction, TransactionHash, @@ -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) }) diff --git a/src/distribute.ts b/src/distribute.ts index e3cce78..4845aac 100644 --- a/src/distribute.ts +++ b/src/distribute.ts @@ -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, @@ -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, }) @@ -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]), @@ -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) }); }; const createBlackholeAddress = ( @@ -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({ diff --git a/src/nft.ts b/src/nft.ts index e20c722..883de56 100644 --- a/src/nft.ts +++ b/src/nft.ts @@ -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, []), }), script, }) diff --git a/src/zero.ts b/src/zero.ts index 5d4ff10..4638991 100644 --- a/src/zero.ts +++ b/src/zero.ts @@ -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, @@ -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] }) @@ -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) }) @@ -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) }); }; program.parseAsync(process.argv);