@meshsdk/transaction 1.7.0 → 1.7.2

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.cjs CHANGED
@@ -114,7 +114,7 @@ var MeshTxBuilderCore = class {
114
114
  simpleScriptTxIn: {
115
115
  scriptSource: {
116
116
  type: "Provided",
117
- script: scriptCbor
117
+ scriptCode: scriptCbor
118
118
  }
119
119
  }
120
120
  };
@@ -191,33 +191,42 @@ var MeshTxBuilderCore = class {
191
191
  }
192
192
  return this;
193
193
  };
194
- // /**
195
- // * Native script - Set the reference input where it would also be spent in the transaction
196
- // * @param txHash The transaction hash of the reference UTxO
197
- // * @param txIndex The transaction index of the reference UTxO
198
- // * @param spendingScriptHash The script hash of the spending script
199
- // * @returns The MeshTxBuilder instance
200
- // */
201
- // simpleScriptTxInReference = (
202
- // txHash: string,
203
- // txIndex: number,
204
- // spendingScriptHash?: string
205
- // ) => {
206
- // if (!this.txInQueueItem) throw Error('Undefined input');
207
- // if (this.txInQueueItem.type === 'PubKey')
208
- // throw Error(
209
- // 'Spending tx in reference attempted to be called a non script input'
210
- // );
211
- // this.txInQueueItem.scriptTxIn.scriptSource = {
212
- // type: 'Inline',
213
- // txInInfo: {
214
- // txHash,
215
- // txIndex,
216
- // spendingScriptHash,
217
- // },
218
- // };
219
- // return this;
220
- // };
194
+ /**
195
+ * Native script - Set the reference input where it would also be spent in the transaction
196
+ * @param txHash The transaction hash of the reference UTxO
197
+ * @param txIndex The transaction index of the reference UTxO
198
+ * @param spendingScriptHash The script hash of the spending script
199
+ * @returns The MeshTxBuilder instance
200
+ */
201
+ simpleScriptTxInReference = (txHash, txIndex, spendingScriptHash, scriptSize) => {
202
+ if (!this.txInQueueItem) throw Error("Undefined input");
203
+ if (this.txInQueueItem.type === "Script") {
204
+ throw Error(
205
+ "simpleScriptTxInReference called on a plutus script, use spendingTxInReference instead"
206
+ );
207
+ }
208
+ if (this.txInQueueItem.type === "SimpleScript") {
209
+ throw Error(
210
+ "simpleScriptTxInReference called on a native script input that already has a script defined"
211
+ );
212
+ }
213
+ if (this.txInQueueItem.type === "PubKey") {
214
+ this.txInQueueItem = {
215
+ type: "SimpleScript",
216
+ txIn: this.txInQueueItem.txIn,
217
+ simpleScriptTxIn: {
218
+ scriptSource: {
219
+ type: "Inline",
220
+ txHash,
221
+ txIndex,
222
+ simpleScriptHash: spendingScriptHash,
223
+ scriptSize
224
+ }
225
+ }
226
+ };
227
+ }
228
+ return this;
229
+ };
221
230
  /**
222
231
  * Set the redeemer for the reference input to be spent in same transaction
223
232
  * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
package/dist/index.d.cts CHANGED
@@ -45,6 +45,14 @@ declare class MeshTxBuilderCore {
45
45
  * @returns The MeshTxBuilder instance
46
46
  */
47
47
  txInInlineDatumPresent: () => this;
48
+ /**
49
+ * Native script - Set the reference input where it would also be spent in the transaction
50
+ * @param txHash The transaction hash of the reference UTxO
51
+ * @param txIndex The transaction index of the reference UTxO
52
+ * @param spendingScriptHash The script hash of the spending script
53
+ * @returns The MeshTxBuilder instance
54
+ */
55
+ simpleScriptTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string, scriptSize?: string) => this;
48
56
  /**
49
57
  * Set the redeemer for the reference input to be spent in same transaction
50
58
  * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
package/dist/index.d.ts CHANGED
@@ -45,6 +45,14 @@ declare class MeshTxBuilderCore {
45
45
  * @returns The MeshTxBuilder instance
46
46
  */
47
47
  txInInlineDatumPresent: () => this;
48
+ /**
49
+ * Native script - Set the reference input where it would also be spent in the transaction
50
+ * @param txHash The transaction hash of the reference UTxO
51
+ * @param txIndex The transaction index of the reference UTxO
52
+ * @param spendingScriptHash The script hash of the spending script
53
+ * @returns The MeshTxBuilder instance
54
+ */
55
+ simpleScriptTxInReference: (txHash: string, txIndex: number, spendingScriptHash?: string, scriptSize?: string) => this;
48
56
  /**
49
57
  * Set the redeemer for the reference input to be spent in same transaction
50
58
  * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ var MeshTxBuilderCore = class {
80
80
  simpleScriptTxIn: {
81
81
  scriptSource: {
82
82
  type: "Provided",
83
- script: scriptCbor
83
+ scriptCode: scriptCbor
84
84
  }
85
85
  }
86
86
  };
@@ -157,33 +157,42 @@ var MeshTxBuilderCore = class {
157
157
  }
158
158
  return this;
159
159
  };
160
- // /**
161
- // * Native script - Set the reference input where it would also be spent in the transaction
162
- // * @param txHash The transaction hash of the reference UTxO
163
- // * @param txIndex The transaction index of the reference UTxO
164
- // * @param spendingScriptHash The script hash of the spending script
165
- // * @returns The MeshTxBuilder instance
166
- // */
167
- // simpleScriptTxInReference = (
168
- // txHash: string,
169
- // txIndex: number,
170
- // spendingScriptHash?: string
171
- // ) => {
172
- // if (!this.txInQueueItem) throw Error('Undefined input');
173
- // if (this.txInQueueItem.type === 'PubKey')
174
- // throw Error(
175
- // 'Spending tx in reference attempted to be called a non script input'
176
- // );
177
- // this.txInQueueItem.scriptTxIn.scriptSource = {
178
- // type: 'Inline',
179
- // txInInfo: {
180
- // txHash,
181
- // txIndex,
182
- // spendingScriptHash,
183
- // },
184
- // };
185
- // return this;
186
- // };
160
+ /**
161
+ * Native script - Set the reference input where it would also be spent in the transaction
162
+ * @param txHash The transaction hash of the reference UTxO
163
+ * @param txIndex The transaction index of the reference UTxO
164
+ * @param spendingScriptHash The script hash of the spending script
165
+ * @returns The MeshTxBuilder instance
166
+ */
167
+ simpleScriptTxInReference = (txHash, txIndex, spendingScriptHash, scriptSize) => {
168
+ if (!this.txInQueueItem) throw Error("Undefined input");
169
+ if (this.txInQueueItem.type === "Script") {
170
+ throw Error(
171
+ "simpleScriptTxInReference called on a plutus script, use spendingTxInReference instead"
172
+ );
173
+ }
174
+ if (this.txInQueueItem.type === "SimpleScript") {
175
+ throw Error(
176
+ "simpleScriptTxInReference called on a native script input that already has a script defined"
177
+ );
178
+ }
179
+ if (this.txInQueueItem.type === "PubKey") {
180
+ this.txInQueueItem = {
181
+ type: "SimpleScript",
182
+ txIn: this.txInQueueItem.txIn,
183
+ simpleScriptTxIn: {
184
+ scriptSource: {
185
+ type: "Inline",
186
+ txHash,
187
+ txIndex,
188
+ simpleScriptHash: spendingScriptHash,
189
+ scriptSize
190
+ }
191
+ }
192
+ };
193
+ }
194
+ return this;
195
+ };
187
196
  /**
188
197
  * Set the redeemer for the reference input to be spent in same transaction
189
198
  * @param redeemer The redeemer in Mesh Data type, JSON in raw constructor like format, or CBOR hex string
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshsdk/transaction",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",
@@ -34,9 +34,9 @@
34
34
  "typescript": "^5.3.3"
35
35
  },
36
36
  "dependencies": {
37
- "@meshsdk/common": "1.7.0",
38
- "@meshsdk/core-csl": "1.7.0",
39
- "@meshsdk/core-cst": "1.7.0",
37
+ "@meshsdk/common": "1.7.2",
38
+ "@meshsdk/core-csl": "1.7.2",
39
+ "@meshsdk/core-cst": "1.7.2",
40
40
  "json-bigint": "^1.0.0"
41
41
  },
42
42
  "prettier": "@meshsdk/configs/prettier",