Skip to content

Commit

Permalink
dev merge
Browse files Browse the repository at this point in the history
  • Loading branch information
michele-nuzzi committed Aug 25, 2023
2 parents 1ebfb4c + a12b05f commit ae47972
Show file tree
Hide file tree
Showing 115 changed files with 4,720 additions and 639 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@harmoniclabs/plu-ts",
"version": "0.4.4",
"version": "0.5.0",
"description": "An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -56,14 +56,14 @@
"@harmoniclabs/uint8array-utils": "^1.0.0",
"@harmoniclabs/pair": "^1.0.0",
"@harmoniclabs/bytestring": "^1.0.0",
"@harmoniclabs/cbor": "^1.1.1",
"@harmoniclabs/cbor": "^1.1.2",
"@harmoniclabs/plutus-data": "^1.0.0",
"@harmoniclabs/cardano-costmodels-ts": "^1.0.0",
"@harmoniclabs/plutus-machine": "^1.0.1",
"@harmoniclabs/uplc": "^1.0.0",
"@harmoniclabs/cardano-ledger-ts": "^0.1.0",
"@harmoniclabs/plu-ts-onchain": "^0.1.1",
"@harmoniclabs/plu-ts-offchain": "^0.1.3"
"@harmoniclabs/plutus-machine": "^1.0.2",
"@harmoniclabs/uplc": "^1.1.0",
"@harmoniclabs/cardano-ledger-ts": "^0.1.2",
"@harmoniclabs/plu-ts-onchain": "^0.2.0",
"@harmoniclabs/plu-ts-offchain": "^0.1.5"
},
"devDependencies": {
"@babel/preset-env": "^7.18.6",
Expand Down
8 changes: 4 additions & 4 deletions packages/offchain/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@harmoniclabs/plu-ts-offchain",
"version": "0.1.3",
"version": "0.1.5",
"description": "An embedded DSL for Cardano smart contracts creation coupled with a library for Cardano transactions, all in Typescript",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -64,9 +64,9 @@
"@harmoniclabs/cbor": "^1.1.1",
"@harmoniclabs/plutus-data": "^1.0.0",
"@harmoniclabs/cardano-costmodels-ts": "^1.0.0",
"@harmoniclabs/plutus-machine": "^1.0.1",
"@harmoniclabs/uplc": "^1.0.0",
"@harmoniclabs/cardano-ledger-ts": "^0.1.1"
"@harmoniclabs/plutus-machine": "^1.0.2",
"@harmoniclabs/uplc": "^1.1.0",
"@harmoniclabs/cardano-ledger-ts": "^0.1.2"
},
"devDependencies": {
"@babel/preset-env": "^7.18.6",
Expand Down
27 changes: 22 additions & 5 deletions packages/offchain/src/TxBuilder/TxBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,31 @@ function initTxBuild(
const withdrawRedeemers: TxRedeemer[] = [];

const scriptsToExec: ScriptToExecEntry[] = [];

/**
* needed in `getScriptDataHash` to understand whoich cost model to transform in language view
*/
let _hasV1Scripts = false;
/**
* needed in `getScriptDataHash` to understand whoich cost model to transform in language view
*/
let _hasV2Scripts = false;

function pushScriptToExec( idx: number, tag: TxRedeemerTag, script: Script, datum?: Data )
{
if( script.type !== ScriptType.NativeScript )
{

// keep track of exsisting csript versions
if( !_hasV1Scripts && script.type === "PlutusScriptV1" )
{
_hasV1Scripts = true;
}
if( !_hasV2Scripts && script.type === "PlutusScriptV2" )
{
_hasV2Scripts = true;
}

scriptsToExec.push({
index: idx,
rdmrTag: tag,
Expand All @@ -558,7 +578,6 @@ function initTxBuild(
})
}
}

function pushWitScript( script : Script ): void
{
const t = script.type;
Expand Down Expand Up @@ -693,7 +712,6 @@ function initTxBuild(
}));

pushScriptToExec( i, TxRedeemerTag.Spend, refScript, dat );

}
if( inputScript !== undefined )
{
Expand All @@ -720,7 +738,6 @@ function initTxBuild(
}));

pushScriptToExec( i, TxRedeemerTag.Spend, script, dat );

}

return new TxIn( utxo )
Expand Down Expand Up @@ -900,8 +917,8 @@ function initTxBuild(
const languageViews = costModelsToLanguageViewCbor(
this.protocolParamters.costModels,
{
mustHaveV1: plutusV1ScriptsWitnesses.length > 0,
mustHaveV2: plutusV2ScriptsWitnesses.length > 0
mustHaveV1: _hasV1Scripts,
mustHaveV2: _hasV2Scripts
}
).toBuffer();

Expand Down
2 changes: 2 additions & 0 deletions packages/offchain/src/__tests__/TxBuilder.build.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { fromAscii } from "@harmoniclabs/uint8array-utils";
import { TxBuilder } from "../TxBuilder"

test.todo("depends on onchain");


/*
jest.setTimeout(2_000_000)
Expand Down
Loading

0 comments on commit ae47972

Please sign in to comment.