From 19d1a20fac832c56c407538d977b70bcbab07d35 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Mon, 2 Dec 2024 16:46:37 +0800 Subject: [PATCH 1/7] bump sidan csl --- package-lock.json | 41 ++++++++++++++++++++--------- packages/mesh-core-csl/package.json | 4 +-- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/package-lock.json b/package-lock.json index cc0882b0..d6d6306d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13986,14 +13986,16 @@ } }, "node_modules/@sidan-lab/sidan-csl-rs-browser": { - "version": "0.9.6", - "resolved": "https://registry.npmjs.org/@sidan-lab/sidan-csl-rs-browser/-/sidan-csl-rs-browser-0.9.6.tgz", - "integrity": "sha512-j7McPV7iYzBXeiuKcJdQ5gwtM/8bRuAUm3qQiOaDbvmcslOQ3XPdIfyijdAYvQQ1GcdpW9O6QV3sANs7wKsRzQ==" + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/@sidan-lab/sidan-csl-rs-browser/-/sidan-csl-rs-browser-0.9.7.tgz", + "integrity": "sha512-n44j0Us281S7xSar/7cUm0uFlvWRonVASKWYED/6GvP26HQh4rWKTj+Xvn0qPRm1dxfb8gwKgnImtpwuyezzyg==", + "license": "Apache-2.0" }, "node_modules/@sidan-lab/sidan-csl-rs-nodejs": { - "version": "0.9.6", - "resolved": "https://registry.npmjs.org/@sidan-lab/sidan-csl-rs-nodejs/-/sidan-csl-rs-nodejs-0.9.6.tgz", - "integrity": "sha512-jz6WB7O8cVyMVxW+NNEg8Qm++Yh1BBDN5uF17BQjvcARn/dIGj3y9CLZCwlMCydhAHEFw2cJe+zkrhyIJxGWpw==" + "version": "0.9.7", + "resolved": "https://registry.npmjs.org/@sidan-lab/sidan-csl-rs-nodejs/-/sidan-csl-rs-nodejs-0.9.7.tgz", + "integrity": "sha512-SqwYu4ebIeOo8soFznUoKnQxmT6k32efNnMqFzURDg0KZcr0kOkB2L2zc1P9SNh09witqW4I+tUYXzr0CT+Gpg==", + "license": "Apache-2.0" }, "node_modules/@silentbot1/nat-api": { "version": "0.4.7", @@ -17506,6 +17508,7 @@ "version": "3.9.0", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true, "funding": [ { "type": "github", @@ -21265,7 +21268,8 @@ "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", - "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==" + "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", + "dev": true }, "node_modules/html-escaper": { "version": "2.0.2", @@ -22957,7 +22961,8 @@ "node_modules/json-parse-even-better-errors": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==" + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true }, "node_modules/json-schema-traverse": { "version": "0.4.1", @@ -24452,6 +24457,7 @@ "version": "4.2.8", "resolved": "https://registry.npmjs.org/minipass/-/minipass-4.2.8.tgz", "integrity": "sha512-fNzuVyifolSLFL4NzpF+wEF4qrgqaaKX0haXPQEdQ7NKAN+WecoKMHV09YcuL/DHxrUsYQOK3MiuDf7Ip2OXfQ==", + "dev": true, "engines": { "node": ">=8" } @@ -24922,6 +24928,7 @@ "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", + "dev": true, "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", @@ -24933,6 +24940,7 @@ "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, "bin": { "semver": "bin/semver" } @@ -30322,6 +30330,7 @@ "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", "integrity": "sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==", + "dev": true, "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" @@ -30330,12 +30339,14 @@ "node_modules/spdx-exceptions": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", - "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==", + "dev": true }, "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", + "dev": true, "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" @@ -30344,7 +30355,8 @@ "node_modules/spdx-license-ids": { "version": "3.0.20", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.20.tgz", - "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==" + "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==", + "dev": true }, "node_modules/speed-limiter": { "version": "1.0.2", @@ -32636,6 +32648,7 @@ "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", + "dev": true, "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" @@ -33561,6 +33574,7 @@ "version": "4.0.2", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, "dependencies": { "imurmurhash": "^0.1.4", "signal-exit": "^3.0.7" @@ -33572,7 +33586,8 @@ "node_modules/write-file-atomic/node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true }, "node_modules/ws": { "version": "7.5.10", @@ -33861,8 +33876,8 @@ "license": "Apache-2.0", "dependencies": { "@meshsdk/common": "1.7.22", - "@sidan-lab/sidan-csl-rs-browser": "0.9.6", - "@sidan-lab/sidan-csl-rs-nodejs": "0.9.6", + "@sidan-lab/sidan-csl-rs-browser": "0.9.7", + "@sidan-lab/sidan-csl-rs-nodejs": "0.9.7", "@types/base32-encoding": "^1.0.2", "base32-encoding": "^1.0.0", "bech32": "^2.0.0", diff --git a/packages/mesh-core-csl/package.json b/packages/mesh-core-csl/package.json index 0de375d8..e58a5c32 100644 --- a/packages/mesh-core-csl/package.json +++ b/packages/mesh-core-csl/package.json @@ -40,8 +40,8 @@ }, "dependencies": { "@meshsdk/common": "1.7.22", - "@sidan-lab/sidan-csl-rs-browser": "0.9.6", - "@sidan-lab/sidan-csl-rs-nodejs": "0.9.6", + "@sidan-lab/sidan-csl-rs-browser": "0.9.7", + "@sidan-lab/sidan-csl-rs-nodejs": "0.9.7", "@types/base32-encoding": "^1.0.2", "base32-encoding": "^1.0.0", "bech32": "^2.0.0", From 06f5d287db2d6fcfb0bc8a89e4aa4b90d109b863 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Mon, 2 Dec 2024 16:47:39 +0800 Subject: [PATCH 2/7] update evaluator logic --- .../mesh-core-csl/src/utils/transaction.ts | 103 ++++++--- .../test/offline-providers/evaluator.test.ts | 197 ++++++++++++++++-- 2 files changed, 252 insertions(+), 48 deletions(-) diff --git a/packages/mesh-core-csl/src/utils/transaction.ts b/packages/mesh-core-csl/src/utils/transaction.ts index a7b68e9e..166dbd67 100644 --- a/packages/mesh-core-csl/src/utils/transaction.ts +++ b/packages/mesh-core-csl/src/utils/transaction.ts @@ -1,13 +1,50 @@ +import { + Action, + Budget, + Network, + RedeemerTagType, + UTxO, +} from "@meshsdk/common"; + import { csl, deserializeTx } from "../deser"; import { parseWasmResult } from "../wasm"; -import { UTxO, Network, Action, Budget, RedeemerTagType } from "@meshsdk/common"; -type RedeemerTagWasm = "cert" | "mint" | "reward" | "spend" | "vote" | "propose"; -type ActionWasm = { +type RedeemerTagWasm = + | "cert" + | "mint" + | "reward" + | "spend" + | "vote" + | "propose"; +type ActionWasm = + | { + success: SuccessAction; + } + | { + error: ErrorAction; + }; +type SuccessAction = { + index: number; + budget: BudgetWasm; + tag: RedeemerTagWasm; +}; +type ErrorAction = { index: number; budget: BudgetWasm; tag: RedeemerTagWasm; + errorMessage: string; + logs: string[]; }; +function isSuccessAction( + action: ActionWasm, +): action is { success: SuccessAction } { + return (action as { success: SuccessAction }).success !== undefined; +} + +function isErrorAction(action: ActionWasm): action is { error: ErrorAction } { + return (action as { error: ErrorAction }).error !== undefined; +} + type BudgetWasm = { mem: number; steps: number; @@ -27,61 +64,77 @@ export const signTransaction = (txHex: string, signingKeys: string[]) => { return parseWasmResult(result); }; -export const evaluateTransaction = (txHex: string, resolvedUtxos: UTxO[], network: Network): Omit[] => { +export const evaluateTransaction = ( + txHex: string, + resolvedUtxos: UTxO[], + network: Network, +): Omit[] => { const additionalTxs = csl.JsVecString.new(); const mappedUtxos = csl.JsVecString.new(); for (const utxo of resolvedUtxos) { mappedUtxos.add(JSON.stringify(utxo)); } - const result = csl.evaluate_tx_scripts_js(txHex, mappedUtxos, additionalTxs, network); + const result = csl.evaluate_tx_scripts_js( + txHex, + mappedUtxos, + additionalTxs, + network, + ); const unwrappedResult = parseWasmResult(result); - try { - const actions = JSON.parse(unwrappedResult) as ActionWasm[]; - return actions.map(mapAction); - } catch (e) { - throw new Error("Cannot parse result from evaluate_tx_scripts_js. Expected Action[] type"); - } -} -const mapAction = (action: ActionWasm): Omit => { + const actions = JSON.parse(unwrappedResult) as ActionWasm[]; + const parsedActions: SuccessAction[] = actions.map((action) => { + if (isSuccessAction(action)) { + return action.success; + } else if (isErrorAction(action)) { + throw new Error(JSON.stringify(action.error)); + } + throw new Error("Invalid action type found"); + }); + return parsedActions.map(mapAction); +}; + +const mapAction = (action: SuccessAction): Omit => { return { index: action.index, budget: mapBudget(action.budget), tag: mapRedeemerTag(action.tag), }; -} +}; const mapBudget = (budget: BudgetWasm): Budget => { return { mem: budget.mem, steps: budget.steps, }; -} +}; const mapRedeemerTag = (tag: RedeemerTagWasm): RedeemerTagType => { switch (tag) { case "cert": - return "CERT" + return "CERT"; case "mint": - return "MINT" + return "MINT"; case "reward": - return "REWARD" + return "REWARD"; case "spend": - return "SPEND" + return "SPEND"; case "vote": - return "VOTE" + return "VOTE"; case "propose": - return "PROPOSE" + return "PROPOSE"; default: throw new Error(`Unknown RedeemerTag: ${tag}`); } -} +}; -export const getTransactionInputs = (txHex: string): { +export const getTransactionInputs = ( + txHex: string, +): { txHash: string; index: number; }[] => { - const inputs = [] + const inputs = []; const deserializedTx = deserializeTx(txHex); const body = deserializedTx.body(); const cslInputs = body.inputs(); @@ -114,4 +167,4 @@ export const getTransactionInputs = (txHex: string): { } return inputs; -} +}; diff --git a/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts b/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts index 7c02f6fa..9e0fdc3b 100644 --- a/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts +++ b/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts @@ -1,5 +1,5 @@ -import { OfflineFetcher } from "@meshsdk/provider"; import { OfflineEvaluator } from "@meshsdk/core-csl"; +import { OfflineFetcher } from "@meshsdk/provider"; describe("Offline Evaluator", () => { let evaluator: OfflineEvaluator; @@ -11,33 +11,184 @@ describe("Offline Evaluator", () => { }); it("should successfully evaluate correct tx", async () => { - const txHex = "84a900818258205de23a200f136e657307bc69173dddaf38b446bd7242a50f5bf255e329018b65030182a300581d70eafce55e4f0e057b495f77d8019577c56ae1fe188dc7e6d63f4f93b801821a001e8480a1581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bda14001028201d81858b4d8799f582461666461373264392d383039332d343330332d623030652d3233616362323934313432661a06acfc00d8799fd8799f581c5e0abc8c791c220b8c56e729cb77e95c03c7bd27971896dda0ac2368ffd8799fd8799fd8799f581cc8fdacb82c1cec476d444f559c28f4b75ddb6f483fe20427683a661affffffff1b0000019223dc5f75d8799fd8799f58205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961aff00ff01ff825839005e0abc8c791c220b8c56e729cb77e95c03c7bd27971896dda0ac2368c8fdacb82c1cec476d444f559c28f4b75ddb6f483fe20427683a661a1a15a2ae54021a000d5ab0031a0442ee8109a1581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bda140010b5820c131e4b612c1a50ddcb739f58185148a26c6beaa198d036f5f9e4e8c7d458de20d8382582002345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da80082582002345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8058258201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441020e81581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6c128382582066b7282bad1aef9ba0a99f06e618d651d232d4788f0d2ee2d22db22a62391033008258205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961a008258201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a44100a10581840100d8799fd8799f58205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961aff00ff821a006acfc01ab2d05e00f5f6"; - const utxo_1 = { input: { outputIndex: 3, txHash: "5de23a200f136e657307bc69173dddaf38b446bd7242a50f5bf255e329018b65" }, output: { address: "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", amount: [{ unit: "lovelace", quantity: "365858180" }], scriptHash: undefined } }; - const utxo_2 = { input: { outputIndex: 0, txHash: "02345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8" }, output: { address: "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", amount: [{ unit: "lovelace", quantity: "5000000" }], scriptHash: undefined } }; - const utxo_3 = { input: { outputIndex: 5, txHash: "02345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8" }, output: { address: "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", amount: [{ unit: "lovelace", quantity: "5000000" }], scriptHash: undefined } }; - const utxo_4 = { input: { outputIndex: 0, txHash: "1c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441" }, output: { address: "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", amount: [{ unit: "lovelace", quantity: "123000000" }], scriptHash: undefined } }; - const utxo_5 = { input: { outputIndex: 2, txHash: "1c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441" }, output: { address: "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", amount: [{ unit: "lovelace", quantity: "5000000" }], scriptHash: undefined } }; - const utxo_6 = { input: { outputIndex: 0, txHash: "66b7282bad1aef9ba0a99f06e618d651d232d4788f0d2ee2d22db22a62391033" }, output: { address: "addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds", amount: [{ unit: "lovelace", quantity: "26000000" }], scriptHash: "32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd", scriptRef: "8202590eca590ec701000033232323232323223223232322533300832323232323232323232323232323232323232323232323232323232323232323232323232323232325333031302d30323754002264a66606460540022a666064666018910103313333000063758601660686ea8c080c0d0dd50158a9998191998050031bac301130343754604060686ea80acdd61810181a1baa30203034375405626666444464646464a666074606c60766ea80044c8c8c8c8c8c8c94ccc10402854ccc10402454ccc10401854ccc10400c54ccc10400840045280a5014a0294052819192999821181f0008b0a999821181d000899b89375a608e60886ea8008dd6982398241824182418221baa0061630423754002605c60846ea8c114c118c108dd50059980f99baf301a30413754006605a60826ea8059240132496e74656e7420646174756d2073686f756c6420636f6e7461696e20616c6c206d61746368696e6720726566732075736564003301e3375e605860806ea8010c084c100dd50092493f496e74656e7420746f6b656e2073686f756c64206f6e6c7920657665722062652073656e7420746f20696e74656e74207370656e64696e672073637269707400533303d3039303e37540022646464646464646464646464a666098609e0042646493182280218178038b18268009826801182580098258011bad3049001304900230470013047002375a608a002608a0046086002607e6ea800458cc0640092401264f7574707574206d75737420636f6e7461696e20736f6d6520696e6c696e656420646174756d003301b3024301c323300100137566036607c6ea8008894ccc10000452f5c0264666444646600200200644a66608c0022006264660906e9ccc120dd4803198241822800998241823000a5eb80cc00c00cc128008c120004dd7181f8009bab304000133003003304400230420014901224f6e6c792061646120616c6c6f776564207769746820696e74656e7420746f6b656e00303f303c37540022ca6660780062980103d87a80001302d3303d303e0034bd701980c1818181380124812e4f6e6c7920612073696e676c65206f7574707574207769746820696e74656e7420746f6b656e20616c6c6f77656400330173375e6e98c04c00cdd31991299981c9818a4000297adef6c6013232330010014bd6f7b63011299981f80089982019bb0375200a6e9800d2f5bded8c0264646464a66608066e400240084cc110cdd81ba9009374c00e00a2a66608066e3c0240084cc110cdd81ba9009374c00e00626608866ec0dd48011ba600133006006003375660820066eb8c0fc008c10c008c104004c8cc0040052f5bded8c044a66607c00226607e66ec0dd4801a610101004bd6f7b630099191919299981f99b90007002133043337606ea401d3010101000051533303f3371e00e00426608666ec0dd4803a61010100003133043337606ea4008dd4000998030030019bad3040003375c607c004608400460800026eb8c094c0e4dd50029bae30163039375400a9212b4f6e6c7920612073696e676c6520696e74656e7420746f6b656e2073686f756c64206265206d696e74656400330280032302f3330153756602c60726ea8004dd71812981c9baa005375c602c60726ea8014c098cc0d8dd48021981b2610140004bd701bac301530343754604060686ea80acdd59806981a1baa302030343754056606e607060706070607060706070607060686ea8c080c0d0dd50158a5014a02a66606466e2000520001533303233300c488103313838000063758601660686ea8c080c0d0dd501589998050031bac301130343754604060686ea80acdd61810181a1baa302030343754056294058dd6981b18199baa00116533303030283301501500113301b0014890014c103d87a8000325333030302830313754002297adef6c6013756606a60646ea8004cc064c02cdd5980518189baa301d3031375405000264a66605e605660606ea80044dd7181a18189baa00116300d3030375404ea66605a6052605c6ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc108c1140084c8c8c8c8c8c8c926302b00b302a00c302a00d302900e302700f303b010533303f303b3040375402226464a666088608e004264931981b000919181798228011bae3043001163756608a00260826ea80445858c10c004c10c008dd698208009820801181f800981f801181e800981e801181d800981d801181c800981c801181b800981b801181a800981a801181980098179baa00116300f302e3754004a666056604e60586ea80044c8c8c8c8c8c94ccc0d0c0dc0084c8c926301a00430190051630350013035002303300130330023031001302d37540022c6600e601260586ea800524011e436f6c642072656620646174756d206d75737420626520696e6c696e6564003232533302b323300100102a22533303000114a0264a66605c64604e66601a6eacc038c0c4dd5180718189baa005375c603a60626ea8004dd7180718189baa001303300214a2266006006002606600220022ca666054604c60566ea80044c0bcc0b0dd50008b198069bac3008302b3754602e60566ea8088098888c94ccc0b14ccc0b0c090c0b4dd519808001980598171baa0041614a2200229414ccc0acc09cc0b0dd519807800980518169baa0031614a24605a605c605c605c605c605c605c605c605c00244464660020026464a6660586050605a6ea80044c0c4c0b8dd50008992999816981498171baa00113032302f37540022c6603e00491010130003301e0010053756603060586ea8c060c0b0dd5001912999815981398161baa001132323300100100522533303100114a0264a66605e66e3cdd7181a0010020a511330030030013034001375c6060605a6ea80044c8cdc49bad30313032001301b3301e375860620024660080080026eb0c0c0c0b4dd5000918159816181618161816000919198008008011129998150008a5eb7bdb1804c8c8c8c94ccc0accdc8a45000021533302b3371e9101000021003100513302f337606ea4008dd3000998030030019bab302c003375c6054004605c00460580024464a66604c601e604e6ea80044c0acc0a0dd50008b180418139baa002222325333026301e302737540022900009bad302b3028375400264a66604c603c604e6ea8004530103d87a80001330113756605660506ea8004008cc03c00c0088c09cc0a0004894ccc0880085288b18008009129998118008a40002602266004004604c002460466048604800244646600200200644a666046002298103d87a80001323253330223375e602060486ea80080144c058cc0980092f5c0266008008002604e004604a00244a66604000229000098071980100118118009299980d980b980e1baa0011323232325333022302500213232498c94ccc084c0740044c8c94ccc098c0a40084c9263019001163027001302337540062a66604260320022a66604860466ea800c526161630213754004602c0062c604600260460046042002603a6ea80045894ccc068c058c06cdd5000899191919299981098120010a4c2c6eb8c088004c088008dd71810000980e1baa00116232533301a301600113232533301f3022002149858dd71810000980e1baa0021533301a301200113232533301f3022002132498c05c00458c080004c070dd50010a99980d180180089919299980f981100109924c60240022c604000260386ea800854ccc068cdc3a400c00226464a66603e60440042649319299980e980c800899192999811181280109924c602a0022c6046002603e6ea800854ccc074c0540044c8c94ccc088c0940084c9263015001163023001301f37540042a66603a600c002264646464a666048604e00426493180b8018b1bae302500130250023023001301f37540042a66603a66e1d200600113232323253330243027002149858dd7181280098128011bae3023001301f37540042a66603a66e1d200800113232323253330243027002149858dd6981280098128011bae3023001301f37540042a66603a66e1d200a00115333020301f37540042930b0a99980e99b874803000454ccc080c07cdd50010a4c2c2c603a6ea800458c080004c070dd50010b180d1baa001370e900211191980080080191299980e8008a60103d87a8000132323232533301e3372200e0042a66603c66e3c01c0084c048cc088dd3000a5eb80530103d87a80001330060060033756603e0066eb8c074008c084008c07c00488c8cc00400400c894ccc0700045300103d87a8000132323232533301d3372200e0042a66603a66e3c01c0084c044cc084dd4000a5eb80530103d87a8000133006006003375a603c0066eb8c070008c080008c078004c00400488c94ccc058c0480044c8c94ccc06cc07800852616375c603800260306ea800854ccc058c0380044c8c94ccc06cc0780084c926323232533301e3021002132498cc04000c8cc02402400458dd6980f800980f8011bac301d001163758603800260306ea800858c058dd50009180c000980080091299980a8008a4000260066600400460300026e01200222323300100100322533301500114bd7009919299980a180280109980c00119802002000899802002000980c801180b80091191980080080191299980a0008a6103d87a800013232323253330153372200e0042a66602a66e3c01c0084c024cc0640052f5c0298103d87a80001330060060033016003375c60280046030004602c0026e95200022323300100100322533301200114984c8cc00c00cc058008c00cc0500048c94ccc030c0200044c8c94ccc044c0500084c9263005001163012001300e37540042a66601860080022646464646464a66602a60300042930b1bad30160013016002375a602800260280046eb4c048004c038dd50010b18061baa001232533300b30070011323253330103013002149858dd7180880098069baa0021533300b30030011323253330103013002149858dd7180880098069baa00216300b37540026e1d200214984d958c00400c94ccc018c008c01cdd50008991919192999806980800109924ca666014600c60166ea800c4c8c94ccc03cc04800852616375c602000260186ea800c5858dd698070009807001180600098041baa00116370e90001bac0015734aae7555cf2ab9f5740ae855d12601259fd8799f581c55871db8a58f10fddf48b92029827d168271e785646af257de85486c40ffff0001" } }; - const utxo_7 = { input: { outputIndex: 0, txHash: "5f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961a" }, output: { address: "addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds", amount: [{ unit: "lovelace", quantity: "4000000" }, { unit: "55871db8a58f10fddf48b92029827d168271e785646af257de85486c", quantity: "1" }], dataHash: "a5a21bf7d9119e01f8cf04316dba1d9cdcacd998430728fdb938de8dad4b6c1f", "plutusData": "d8799fd8799f581c0eb1e4ef980b3c308edd7b3ab64990d5240e5230286038cae5c634cdffd8799f581c1fdf3668220c08618b4f2e5e7cc54f70ca4b11fd2b6a3fbe678235f1ffd8799fd8799fa14130d8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffffd8799fd8799f58201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441ff00ffd8799fd87a9f581ceafce55e4f0e057b495f77d8019577c56ae1fe188dc7e6d63f4f93b8ffd87a80ffd8799f581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd40ffd8799f581cdbde35dec305604c1c8a596437802fd5e3468c8e92ce1781203e7bb74455534441ffd8799fd87a9f581c10fcea52f80dbc6e499106b02894173a2e60d21c6b3d1fe881d9495dffd87a80ffd8799fd8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffd87a80ff1903e801ffff", scriptHash: undefined } }; + const txHex = + "84a900818258205de23a200f136e657307bc69173dddaf38b446bd7242a50f5bf255e329018b65030182a300581d70eafce55e4f0e057b495f77d8019577c56ae1fe188dc7e6d63f4f93b801821a001e8480a1581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bda14001028201d81858b4d8799f582461666461373264392d383039332d343330332d623030652d3233616362323934313432661a06acfc00d8799fd8799f581c5e0abc8c791c220b8c56e729cb77e95c03c7bd27971896dda0ac2368ffd8799fd8799fd8799f581cc8fdacb82c1cec476d444f559c28f4b75ddb6f483fe20427683a661affffffff1b0000019223dc5f75d8799fd8799f58205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961aff00ff01ff825839005e0abc8c791c220b8c56e729cb77e95c03c7bd27971896dda0ac2368c8fdacb82c1cec476d444f559c28f4b75ddb6f483fe20427683a661a1a15a2ae54021a000d5ab0031a0442ee8109a1581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bda140010b5820c131e4b612c1a50ddcb739f58185148a26c6beaa198d036f5f9e4e8c7d458de20d8382582002345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da80082582002345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8058258201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441020e81581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6c128382582066b7282bad1aef9ba0a99f06e618d651d232d4788f0d2ee2d22db22a62391033008258205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961a008258201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a44100a10581840100d8799fd8799f58205f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961aff00ff821a006acfc01ab2d05e00f5f6"; + const utxo_1 = { + input: { + outputIndex: 3, + txHash: + "5de23a200f136e657307bc69173dddaf38b446bd7242a50f5bf255e329018b65", + }, + output: { + address: + "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", + amount: [{ unit: "lovelace", quantity: "365858180" }], + scriptHash: undefined, + }, + }; + const utxo_2 = { + input: { + outputIndex: 0, + txHash: + "02345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8", + }, + output: { + address: + "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", + amount: [{ unit: "lovelace", quantity: "5000000" }], + scriptHash: undefined, + }, + }; + const utxo_3 = { + input: { + outputIndex: 5, + txHash: + "02345ff40e1b8730434571b8b4749ad084b2cd582aa8997fa7416be8b76c7da8", + }, + output: { + address: + "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", + amount: [{ unit: "lovelace", quantity: "5000000" }], + scriptHash: undefined, + }, + }; + const utxo_4 = { + input: { + outputIndex: 0, + txHash: + "1c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441", + }, + output: { + address: + "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", + amount: [{ unit: "lovelace", quantity: "123000000" }], + scriptHash: undefined, + }, + }; + const utxo_5 = { + input: { + outputIndex: 2, + txHash: + "1c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441", + }, + output: { + address: + "addr_test1qrsaqj54nyedfg74tye8743tkrclgnfztj6z937g50q0fwv6vwcuvc9guftgju6xav470f6da9guk8t3nn46wd34z43s99hwxv", + amount: [{ unit: "lovelace", quantity: "5000000" }], + scriptHash: undefined, + }, + }; + const utxo_6 = { + input: { + outputIndex: 0, + txHash: + "66b7282bad1aef9ba0a99f06e618d651d232d4788f0d2ee2d22db22a62391033", + }, + output: { + address: + "addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds", + amount: [{ unit: "lovelace", quantity: "26000000" }], + scriptHash: "32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd", + scriptRef: + "8202590eca590ec701000033232323232323223223232322533300832323232323232323232323232323232323232323232323232323232323232323232323232323232325333031302d30323754002264a66606460540022a666064666018910103313333000063758601660686ea8c080c0d0dd50158a9998191998050031bac301130343754604060686ea80acdd61810181a1baa30203034375405626666444464646464a666074606c60766ea80044c8c8c8c8c8c8c94ccc10402854ccc10402454ccc10401854ccc10400c54ccc10400840045280a5014a0294052819192999821181f0008b0a999821181d000899b89375a608e60886ea8008dd6982398241824182418221baa0061630423754002605c60846ea8c114c118c108dd50059980f99baf301a30413754006605a60826ea8059240132496e74656e7420646174756d2073686f756c6420636f6e7461696e20616c6c206d61746368696e6720726566732075736564003301e3375e605860806ea8010c084c100dd50092493f496e74656e7420746f6b656e2073686f756c64206f6e6c7920657665722062652073656e7420746f20696e74656e74207370656e64696e672073637269707400533303d3039303e37540022646464646464646464646464a666098609e0042646493182280218178038b18268009826801182580098258011bad3049001304900230470013047002375a608a002608a0046086002607e6ea800458cc0640092401264f7574707574206d75737420636f6e7461696e20736f6d6520696e6c696e656420646174756d003301b3024301c323300100137566036607c6ea8008894ccc10000452f5c0264666444646600200200644a66608c0022006264660906e9ccc120dd4803198241822800998241823000a5eb80cc00c00cc128008c120004dd7181f8009bab304000133003003304400230420014901224f6e6c792061646120616c6c6f776564207769746820696e74656e7420746f6b656e00303f303c37540022ca6660780062980103d87a80001302d3303d303e0034bd701980c1818181380124812e4f6e6c7920612073696e676c65206f7574707574207769746820696e74656e7420746f6b656e20616c6c6f77656400330173375e6e98c04c00cdd31991299981c9818a4000297adef6c6013232330010014bd6f7b63011299981f80089982019bb0375200a6e9800d2f5bded8c0264646464a66608066e400240084cc110cdd81ba9009374c00e00a2a66608066e3c0240084cc110cdd81ba9009374c00e00626608866ec0dd48011ba600133006006003375660820066eb8c0fc008c10c008c104004c8cc0040052f5bded8c044a66607c00226607e66ec0dd4801a610101004bd6f7b630099191919299981f99b90007002133043337606ea401d3010101000051533303f3371e00e00426608666ec0dd4803a61010100003133043337606ea4008dd4000998030030019bad3040003375c607c004608400460800026eb8c094c0e4dd50029bae30163039375400a9212b4f6e6c7920612073696e676c6520696e74656e7420746f6b656e2073686f756c64206265206d696e74656400330280032302f3330153756602c60726ea8004dd71812981c9baa005375c602c60726ea8014c098cc0d8dd48021981b2610140004bd701bac301530343754604060686ea80acdd59806981a1baa302030343754056606e607060706070607060706070607060686ea8c080c0d0dd50158a5014a02a66606466e2000520001533303233300c488103313838000063758601660686ea8c080c0d0dd501589998050031bac301130343754604060686ea80acdd61810181a1baa302030343754056294058dd6981b18199baa00116533303030283301501500113301b0014890014c103d87a8000325333030302830313754002297adef6c6013756606a60646ea8004cc064c02cdd5980518189baa301d3031375405000264a66605e605660606ea80044dd7181a18189baa00116300d3030375404ea66605a6052605c6ea80044c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c8c94ccc108c1140084c8c8c8c8c8c8c926302b00b302a00c302a00d302900e302700f303b010533303f303b3040375402226464a666088608e004264931981b000919181798228011bae3043001163756608a00260826ea80445858c10c004c10c008dd698208009820801181f800981f801181e800981e801181d800981d801181c800981c801181b800981b801181a800981a801181980098179baa00116300f302e3754004a666056604e60586ea80044c8c8c8c8c8c94ccc0d0c0dc0084c8c926301a00430190051630350013035002303300130330023031001302d37540022c6600e601260586ea800524011e436f6c642072656620646174756d206d75737420626520696e6c696e6564003232533302b323300100102a22533303000114a0264a66605c64604e66601a6eacc038c0c4dd5180718189baa005375c603a60626ea8004dd7180718189baa001303300214a2266006006002606600220022ca666054604c60566ea80044c0bcc0b0dd50008b198069bac3008302b3754602e60566ea8088098888c94ccc0b14ccc0b0c090c0b4dd519808001980598171baa0041614a2200229414ccc0acc09cc0b0dd519807800980518169baa0031614a24605a605c605c605c605c605c605c605c605c00244464660020026464a6660586050605a6ea80044c0c4c0b8dd50008992999816981498171baa00113032302f37540022c6603e00491010130003301e0010053756603060586ea8c060c0b0dd5001912999815981398161baa001132323300100100522533303100114a0264a66605e66e3cdd7181a0010020a511330030030013034001375c6060605a6ea80044c8cdc49bad30313032001301b3301e375860620024660080080026eb0c0c0c0b4dd5000918159816181618161816000919198008008011129998150008a5eb7bdb1804c8c8c8c94ccc0accdc8a45000021533302b3371e9101000021003100513302f337606ea4008dd3000998030030019bab302c003375c6054004605c00460580024464a66604c601e604e6ea80044c0acc0a0dd50008b180418139baa002222325333026301e302737540022900009bad302b3028375400264a66604c603c604e6ea8004530103d87a80001330113756605660506ea8004008cc03c00c0088c09cc0a0004894ccc0880085288b18008009129998118008a40002602266004004604c002460466048604800244646600200200644a666046002298103d87a80001323253330223375e602060486ea80080144c058cc0980092f5c0266008008002604e004604a00244a66604000229000098071980100118118009299980d980b980e1baa0011323232325333022302500213232498c94ccc084c0740044c8c94ccc098c0a40084c9263019001163027001302337540062a66604260320022a66604860466ea800c526161630213754004602c0062c604600260460046042002603a6ea80045894ccc068c058c06cdd5000899191919299981098120010a4c2c6eb8c088004c088008dd71810000980e1baa00116232533301a301600113232533301f3022002149858dd71810000980e1baa0021533301a301200113232533301f3022002132498c05c00458c080004c070dd50010a99980d180180089919299980f981100109924c60240022c604000260386ea800854ccc068cdc3a400c00226464a66603e60440042649319299980e980c800899192999811181280109924c602a0022c6046002603e6ea800854ccc074c0540044c8c94ccc088c0940084c9263015001163023001301f37540042a66603a600c002264646464a666048604e00426493180b8018b1bae302500130250023023001301f37540042a66603a66e1d200600113232323253330243027002149858dd7181280098128011bae3023001301f37540042a66603a66e1d200800113232323253330243027002149858dd6981280098128011bae3023001301f37540042a66603a66e1d200a00115333020301f37540042930b0a99980e99b874803000454ccc080c07cdd50010a4c2c2c603a6ea800458c080004c070dd50010b180d1baa001370e900211191980080080191299980e8008a60103d87a8000132323232533301e3372200e0042a66603c66e3c01c0084c048cc088dd3000a5eb80530103d87a80001330060060033756603e0066eb8c074008c084008c07c00488c8cc00400400c894ccc0700045300103d87a8000132323232533301d3372200e0042a66603a66e3c01c0084c044cc084dd4000a5eb80530103d87a8000133006006003375a603c0066eb8c070008c080008c078004c00400488c94ccc058c0480044c8c94ccc06cc07800852616375c603800260306ea800854ccc058c0380044c8c94ccc06cc0780084c926323232533301e3021002132498cc04000c8cc02402400458dd6980f800980f8011bac301d001163758603800260306ea800858c058dd50009180c000980080091299980a8008a4000260066600400460300026e01200222323300100100322533301500114bd7009919299980a180280109980c00119802002000899802002000980c801180b80091191980080080191299980a0008a6103d87a800013232323253330153372200e0042a66602a66e3c01c0084c024cc0640052f5c0298103d87a80001330060060033016003375c60280046030004602c0026e95200022323300100100322533301200114984c8cc00c00cc058008c00cc0500048c94ccc030c0200044c8c94ccc044c0500084c9263005001163012001300e37540042a66601860080022646464646464a66602a60300042930b1bad30160013016002375a602800260280046eb4c048004c038dd50010b18061baa001232533300b30070011323253330103013002149858dd7180880098069baa0021533300b30030011323253330103013002149858dd7180880098069baa00216300b37540026e1d200214984d958c00400c94ccc018c008c01cdd50008991919192999806980800109924ca666014600c60166ea800c4c8c94ccc03cc04800852616375c602000260186ea800c5858dd698070009807001180600098041baa00116370e90001bac0015734aae7555cf2ab9f5740ae855d12601259fd8799f581c55871db8a58f10fddf48b92029827d168271e785646af257de85486c40ffff0001", + }, + }; + const utxo_7 = { + input: { + outputIndex: 0, + txHash: + "5f759f3527a47632735470586a7ab2fbee4b4aa8b6504d52d52bc62fa8ec961a", + }, + output: { + address: + "addr_test1qp0q40yv0ywzyzuv2mnjnjmha9wq83aay7t339ka5zkzx6xglkktstqua3rk63z02kwz3a9hthdk7jplugzzw6p6vcdqa39gds", + amount: [ + { unit: "lovelace", quantity: "4000000" }, + { + unit: "55871db8a58f10fddf48b92029827d168271e785646af257de85486c", + quantity: "1", + }, + ], + dataHash: + "a5a21bf7d9119e01f8cf04316dba1d9cdcacd998430728fdb938de8dad4b6c1f", + plutusData: + "d8799fd8799f581c0eb1e4ef980b3c308edd7b3ab64990d5240e5230286038cae5c634cdffd8799f581c1fdf3668220c08618b4f2e5e7cc54f70ca4b11fd2b6a3fbe678235f1ffd8799fd8799fa14130d8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffffd8799fd8799f58201c4ef054932bafcb4a59810f31fa0ed001d6611066938d1a1aef1d1237c0a441ff00ffd8799fd87a9f581ceafce55e4f0e057b495f77d8019577c56ae1fe188dc7e6d63f4f93b8ffd87a80ffd8799f581c32b7e3d552b2b18cb9bf1a39e6e1ce75f62c084f2b917a44c071a3bd40ffd8799f581cdbde35dec305604c1c8a596437802fd5e3468c8e92ce1781203e7bb74455534441ffd8799fd87a9f581c10fcea52f80dbc6e499106b02894173a2e60d21c6b3d1fe881d9495dffd87a80ffd8799fd8799f581cc6aa7af71f8ba577246149edf075d2edd9daa63980b7ca176799af6cffd87a80ff1903e801ffff", + scriptHash: undefined, + }, + }; fetcher.addUTxOs([utxo_1, utxo_2, utxo_3, utxo_4, utxo_5, utxo_6, utxo_7]); const res = await evaluator.evaluateTx(txHex); - expect(res).toStrictEqual( - [ - { - index: 0, - tag: "MINT", - budget: { - mem: 508703, - steps: 164980381, - } - } - ] - ) + expect(res).toStrictEqual([ + { + index: 0, + tag: "MINT", + budget: { + mem: 508703, + steps: 164980381, + }, + }, + ]); }); it("should fail evaluating incorrect tx", async () => { - const res = await evaluator.evaluateTx("84a900818258205de23a200f136e657307bc69173dddaf38b446bd7242a50f5bf255").catch(() => "error"); - expect(res).toBe("error"); + fetcher.addUTxOs([ + { + input: { + outputIndex: 0, + txHash: + "47ce1b14c0599bb377a3c73c20973e49adbd10e5090129879b068ca0aa4216c2", + }, + output: { + address: + "addr_test1qql3kkt57ncf7zt5hej4un8ff79z6zra7dut08hnj9kzdv437u94wweqf3nftw8kd6mw03uv2hk7jscqyn47cm74lpwsju87pd", + amount: [ + { + quantity: "9979468933", + unit: "lovelace", + }, + { + quantity: "1", + unit: "0f6b02150cbcc7fedafa388abcc41635a9443afb860100099ba40f076d657368", + }, + ], + }, + }, + { + input: { + outputIndex: 0, + txHash: + "6213898aa37d5e585721f4ebdd16da2ac6cd9cd0e81318906dfeea3ebdf9f157", + }, + output: { + address: + "addr_test1qql3kkt57ncf7zt5hej4un8ff79z6zra7dut08hnj9kzdv437u94wweqf3nftw8kd6mw03uv2hk7jscqyn47cm74lpwsju87pd", + amount: [ + { + quantity: "20000000", + unit: "lovelace", + }, + ], + }, + }, + ]); + + const res = await evaluator + .evaluateTx( + "84a700d901028182582047ce1b14c0599bb377a3c73c20973e49adbd10e5090129879b068ca0aa4216c2000181825839003f1b5974f4f09f0974be655e4ce94f8a2d087df378b79ef3916c26b2b1f70b573b204c6695b8f66eb6e7c78c55ede9430024ebec6fd5f85d821b0000000252c63160a2581c0f6b02150cbcc7fedafa388abcc41635a9443afb860100099ba40f07a1446d65736801581cf1c9053e4e03414fc37092d0155682f96d20770afc13a07f00f057ffa14001021a000c6b250758207564366f82807a253ef1f25af3f04486ac49ecd7fb631da76a713b32580994d709a1581cf1c9053e4e03414fc37092d0155682f96d20770afc13a07f00f057ffa140010b582001208ac891cd1aefe984b233bb0f9c4ece236b172c279d14d4940a483d68ccb00dd90102818258206213898aa37d5e585721f4ebdd16da2ac6cd9cd0e81318906dfeea3ebdf9f15700a207d901028158a0589e01010032323232323225333002323232323253330073370e900018049baa00113253300949010f5468697320697320612074726163650016375c601660146ea800454cc02124010f5468697320697320612074726163650016300a300b003300900230080023008001300537540022930a99801a491856616c696461746f722072657475726e65642066616c736500136565734ae7155ceaab9e5742ae8905a182010082d8799f446d657368ff821a006acfc01ab2d05e00f5a11902d1a178386631633930353365346530333431346663333730393264303135353638326639366432303737306166633133613037663030663035376666a1646d657368a46b6465736372697074696f6e783254686973204e465420776173206d696e746564206279204d657368202868747470733a2f2f6d6573686a732e6465762f292e65696d6167657835697066733a2f2f516d527a6963705265757477436b4d36616f74754b6a4572464355443231334470775071364279757a4d4a617561696d656469615479706569696d6167652f6a7067646e616d656a4d65736820546f6b656e", + ) + .catch((e) => { + return e; + }); + expect(res).toBeInstanceOf(Error); + expect(res.message).toBe( + JSON.stringify({ + index: 0, + budget: { mem: 550, steps: 1203691 }, + tag: "mint", + errorMessage: "the validator crashed / exited prematurely", + logs: ["This is a trace"], + }), + ); }); }); From e1f10a18f7a52c8f8e665bf74946fabc979a5793 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Mon, 2 Dec 2024 17:13:11 +0800 Subject: [PATCH 3/7] add set fee support --- .../mesh-common/src/types/transaction-builder/index.ts | 1 + packages/mesh-core-csl/src/core/adaptor/index.ts | 4 +++- .../src/mesh-tx-builder/tx-builder-core.ts | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/mesh-common/src/types/transaction-builder/index.ts b/packages/mesh-common/src/types/transaction-builder/index.ts index f2f51773..f3a8e37a 100644 --- a/packages/mesh-common/src/types/transaction-builder/index.ts +++ b/packages/mesh-common/src/types/transaction-builder/index.ts @@ -37,6 +37,7 @@ export type MeshTxBuilderBody = { strategy: UtxoSelectionStrategy; includeTxFees: boolean; }; + fee?: string; network: Network | number[][]; }; diff --git a/packages/mesh-core-csl/src/core/adaptor/index.ts b/packages/mesh-core-csl/src/core/adaptor/index.ts index ac76e4c8..1169f94a 100644 --- a/packages/mesh-core-csl/src/core/adaptor/index.ts +++ b/packages/mesh-core-csl/src/core/adaptor/index.ts @@ -2,11 +2,11 @@ import { MeshTxBuilderBody, validityRangeToObj } from "@meshsdk/common"; import { certificateToObj } from "./certificate"; import { mintItemToObj } from "./mint"; +import { networkToObj } from "./network"; import { outputToObj } from "./output"; import { collateralTxInToObj, txInToObj } from "./txIn"; import { voteToObj } from "./vote"; import { withdrawalToObj } from "./withdrawal"; -import { networkToObj } from "./network"; export const meshTxBuilderBodyToObj = ({ inputs, @@ -22,6 +22,7 @@ export const meshTxBuilderBodyToObj = ({ signingKey, withdrawals, votes, + fee, network, }: MeshTxBuilderBody) => { return { @@ -38,6 +39,7 @@ export const meshTxBuilderBodyToObj = ({ signingKey: signingKey, withdrawals: withdrawals.map(withdrawalToObj), votes: votes.map(voteToObj), + fee, network: networkToObj(network), }; }; diff --git a/packages/mesh-transaction/src/mesh-tx-builder/tx-builder-core.ts b/packages/mesh-transaction/src/mesh-tx-builder/tx-builder-core.ts index 617304c0..5f5cb2c3 100644 --- a/packages/mesh-transaction/src/mesh-tx-builder/tx-builder-core.ts +++ b/packages/mesh-transaction/src/mesh-tx-builder/tx-builder-core.ts @@ -1469,6 +1469,16 @@ export class MeshTxBuilderCore { return this; }; + /** + * Sets a specific fee for the transaction to use + * @param fee The specified fee + * @returns The MeshTxBuilder instance + */ + setFee = (fee: string) => { + this.meshTxBuilderBody.fee = fee; + return this; + } + /** * Sets the network to use, this is mainly to know the cost models to be used to calculate script integrity hash * @param network The specific network this transaction is being built for ("testnet" | "preview" | "preprod" | "mainnet") From de08b73f4bb58d08c69c8659f012f235946cc3d6 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Mon, 2 Dec 2024 17:13:17 +0800 Subject: [PATCH 4/7] add test for set fee --- .../test/mesh-tx-builder/tx.test.ts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/packages/mesh-transaction/test/mesh-tx-builder/tx.test.ts b/packages/mesh-transaction/test/mesh-tx-builder/tx.test.ts index db4e72f7..8f39f789 100644 --- a/packages/mesh-transaction/test/mesh-tx-builder/tx.test.ts +++ b/packages/mesh-transaction/test/mesh-tx-builder/tx.test.ts @@ -14,6 +14,49 @@ import { import { MeshTxBuilder } from "@meshsdk/transaction"; describe("MeshTxBuilder transactions", () => { + it("Basic send tx", () => { + let mesh = new MeshTxBuilder({ verbose: true }); + let txHex = mesh + .txIn( + "2cb57168ee66b68bd04a0d595060b546edf30c04ae1031b883c9ac797967dd85", + 3, + [{ unit: "lovelace", quantity: "9891607895" }], + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + ) + .txOut( + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + [{ unit: "lovelace", quantity: "2000000" }], + ) + .changeAddress( + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + ) + .completeSync(); + + expect(txHex !== "").toBeTruthy(); + }); + + it("Basic send tx with set fee", () => { + let mesh = new MeshTxBuilder(); + let txHex = mesh + .txIn( + "2cb57168ee66b68bd04a0d595060b546edf30c04ae1031b883c9ac797967dd85", + 3, + [{ unit: "lovelace", quantity: "9891607895" }], + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + ) + .txOut( + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + [{ unit: "lovelace", quantity: "2000000" }], + ) + .changeAddress( + "addr_test1vru4e2un2tq50q4rv6qzk7t8w34gjdtw3y2uzuqxzj0ldrqqactxh", + ) + .setFee("5000000") + .completeSync(); + + expect(txHex !== "").toBeTruthy(); + }); + it("Adding embedded datum should produce correct tx cbor", () => { let mesh = new MeshTxBuilder(); From 798922e4918114b38958dbfe6a5619c8d45012a1 Mon Sep 17 00:00:00 2001 From: twwu123 Date: Mon, 2 Dec 2024 17:40:14 +0800 Subject: [PATCH 5/7] return error actions as a list instead --- packages/mesh-core-csl/src/utils/transaction.ts | 16 +++++++++++----- .../test/offline-providers/evaluator.test.ts | 4 ++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/mesh-core-csl/src/utils/transaction.ts b/packages/mesh-core-csl/src/utils/transaction.ts index 166dbd67..3dbdc5a6 100644 --- a/packages/mesh-core-csl/src/utils/transaction.ts +++ b/packages/mesh-core-csl/src/utils/transaction.ts @@ -83,15 +83,21 @@ export const evaluateTransaction = ( const unwrappedResult = parseWasmResult(result); const actions = JSON.parse(unwrappedResult) as ActionWasm[]; - const parsedActions: SuccessAction[] = actions.map((action) => { + let parsedSuccessActions: SuccessAction[] = []; + let parsedErrorActions: ErrorAction[] = []; + actions.map((action) => { if (isSuccessAction(action)) { - return action.success; + parsedSuccessActions.push(action.success); } else if (isErrorAction(action)) { - throw new Error(JSON.stringify(action.error)); + parsedErrorActions.push(action.error); + } else { + throw new Error("Invalid action type found"); } - throw new Error("Invalid action type found"); }); - return parsedActions.map(mapAction); + if (parsedErrorActions.length > 0) { + throw new Error(JSON.stringify(parsedErrorActions)); + } + return parsedSuccessActions.map(mapAction); }; const mapAction = (action: SuccessAction): Omit => { diff --git a/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts b/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts index 9e0fdc3b..865b391a 100644 --- a/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts +++ b/packages/mesh-core-csl/test/offline-providers/evaluator.test.ts @@ -182,13 +182,13 @@ describe("Offline Evaluator", () => { }); expect(res).toBeInstanceOf(Error); expect(res.message).toBe( - JSON.stringify({ + JSON.stringify([{ index: 0, budget: { mem: 550, steps: 1203691 }, tag: "mint", errorMessage: "the validator crashed / exited prematurely", logs: ["This is a trace"], - }), + }]), ); }); }); From c09560166bb35407b6cc46583d6d85fcfb56fc52 Mon Sep 17 00:00:00 2001 From: "Hong Jing (Jingles)" Date: Mon, 2 Dec 2024 20:55:03 +0800 Subject: [PATCH 6/7] setfee docs and bump version --- .../src/pages/apis/txbuilder/basics/index.tsx | 3 +++ packages/mesh-common/package.json | 2 +- packages/mesh-contract/package.json | 8 ++++---- packages/mesh-core-csl/package.json | 6 +++--- packages/mesh-core-cst/package.json | 4 ++-- packages/mesh-core/package.json | 16 ++++++++-------- packages/mesh-provider/package.json | 6 +++--- packages/mesh-react/package.json | 8 ++++---- packages/mesh-svelte/package.json | 4 ++-- packages/mesh-transaction/package.json | 8 ++++---- packages/mesh-wallet/package.json | 10 +++++----- scripts/mesh-cli/package.json | 2 +- 12 files changed, 40 insertions(+), 37 deletions(-) diff --git a/apps/playground/src/pages/apis/txbuilder/basics/index.tsx b/apps/playground/src/pages/apis/txbuilder/basics/index.tsx index 62d79334..a9270397 100644 --- a/apps/playground/src/pages/apis/txbuilder/basics/index.tsx +++ b/apps/playground/src/pages/apis/txbuilder/basics/index.tsx @@ -14,6 +14,7 @@ import TxbuilderInitializeTxbuilder from "./initialize-txbuilder"; import TxbuilderMultisig from "./multisig"; import TxbuilderMultisigNativeScript from "./multisig-native-script"; import TxbuilderSendValues from "./send-values"; +import TxbuilderSetFee from "./set-fee"; import TxbuilderSetNetwork from "./set-network"; import TxbuilderSetRequiredSigners from "./set-required-signers"; import TxbuilderSetTime from "./set-time"; @@ -30,6 +31,7 @@ const ReactPage: NextPage = () => { { label: "Set required signers", to: "requiredSigners" }, { label: "Set time", to: "setTime" }, { label: "Set network", to: "setNetwork" }, + { label: "Set fee", to: "setFee" }, ]; return ( @@ -81,6 +83,7 @@ const ReactPage: NextPage = () => { + ); diff --git a/packages/mesh-common/package.json b/packages/mesh-common/package.json index 9d335828..6e4de9e9 100644 --- a/packages/mesh-common/package.json +++ b/packages/mesh-common/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/common", - "version": "1.7.22", + "version": "1.7.23", "description": "Contains constants, types and interfaces used across the SDK and different serialization libraries", "main": "./dist/index.cjs", "browser": "./dist/index.js", diff --git a/packages/mesh-contract/package.json b/packages/mesh-contract/package.json index cd93d5fe..3847e8fa 100644 --- a/packages/mesh-contract/package.json +++ b/packages/mesh-contract/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/contract", - "version": "1.7.22", + "version": "1.7.23", "description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -34,9 +34,9 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", - "@meshsdk/core": "1.7.22", - "@meshsdk/core-csl": "1.7.22" + "@meshsdk/common": "1.7.23", + "@meshsdk/core": "1.7.23", + "@meshsdk/core-csl": "1.7.23" }, "prettier": "@meshsdk/configs/prettier", "publishConfig": { diff --git a/packages/mesh-core-csl/package.json b/packages/mesh-core-csl/package.json index e58a5c32..0a0386ed 100644 --- a/packages/mesh-core-csl/package.json +++ b/packages/mesh-core-csl/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core-csl", - "version": "1.7.22", + "version": "1.7.23", "description": "Types and utilities functions between Mesh and cardano-serialization-lib", "main": "./dist/index.cjs", "module": "./dist/index.js", @@ -31,7 +31,7 @@ }, "devDependencies": { "@meshsdk/configs": "*", - "@meshsdk/provider": "1.7.22", + "@meshsdk/provider": "1.7.23", "@types/json-bigint": "^1.0.4", "eslint": "^8.57.0", "ts-jest": "^29.1.4", @@ -39,7 +39,7 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", + "@meshsdk/common": "1.7.23", "@sidan-lab/sidan-csl-rs-browser": "0.9.7", "@sidan-lab/sidan-csl-rs-nodejs": "0.9.7", "@types/base32-encoding": "^1.0.2", diff --git a/packages/mesh-core-cst/package.json b/packages/mesh-core-cst/package.json index 9cc455a3..ea34caf5 100644 --- a/packages/mesh-core-cst/package.json +++ b/packages/mesh-core-cst/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core-cst", - "version": "1.7.22", + "version": "1.7.23", "description": "Types and utilities functions between Mesh and cardano-js-sdk", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -42,7 +42,7 @@ "@harmoniclabs/cbor": "1.3.0", "@harmoniclabs/plutus-data": "1.2.4", "@harmoniclabs/uplc": "1.2.4", - "@meshsdk/common": "1.7.22", + "@meshsdk/common": "1.7.23", "@stricahq/bip32ed25519": "^1.1.0", "@stricahq/cbors": "^1.0.3", "pbkdf2": "^3.1.2" diff --git a/packages/mesh-core/package.json b/packages/mesh-core/package.json index fd2b8099..dd5c419f 100644 --- a/packages/mesh-core/package.json +++ b/packages/mesh-core/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/core", - "version": "1.7.22", + "version": "1.7.23", "description": "Mesh SDK Core - https://meshjs.dev/", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -33,13 +33,13 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", - "@meshsdk/core-csl": "1.7.22", - "@meshsdk/core-cst": "1.7.22", - "@meshsdk/provider": "1.7.22", - "@meshsdk/react": "1.7.22", - "@meshsdk/transaction": "1.7.22", - "@meshsdk/wallet": "1.7.22" + "@meshsdk/common": "1.7.23", + "@meshsdk/core-csl": "1.7.23", + "@meshsdk/core-cst": "1.7.23", + "@meshsdk/provider": "1.7.23", + "@meshsdk/react": "1.7.23", + "@meshsdk/transaction": "1.7.23", + "@meshsdk/wallet": "1.7.23" }, "prettier": "@meshsdk/configs/prettier", "publishConfig": { diff --git a/packages/mesh-provider/package.json b/packages/mesh-provider/package.json index 21881147..c2f85deb 100644 --- a/packages/mesh-provider/package.json +++ b/packages/mesh-provider/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/provider", - "version": "1.7.22", + "version": "1.7.23", "description": "Blockchain data providers - https://meshjs.dev/providers", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -34,8 +34,8 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", - "@meshsdk/core-cst": "1.7.22", + "@meshsdk/common": "1.7.23", + "@meshsdk/core-cst": "1.7.23", "@utxorpc/sdk": "0.6.2", "@utxorpc/spec": "0.10.1", "axios": "^1.7.2" diff --git a/packages/mesh-react/package.json b/packages/mesh-react/package.json index bbd143dd..b57b4783 100644 --- a/packages/mesh-react/package.json +++ b/packages/mesh-react/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/react", - "version": "1.7.22", + "version": "1.7.23", "description": "React component library - https://meshjs.dev/react", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -29,9 +29,9 @@ }, "dependencies": { "@fabianbormann/cardano-peer-connect": "^1.2.18", - "@meshsdk/common": "1.7.22", - "@meshsdk/transaction": "1.7.22", - "@meshsdk/wallet": "1.7.22", + "@meshsdk/common": "1.7.23", + "@meshsdk/transaction": "1.7.23", + "@meshsdk/wallet": "1.7.23", "@radix-ui/react-dialog": "^1.1.2", "@radix-ui/react-dropdown-menu": "^2.1.2", "@radix-ui/react-icons": "^1.3.2", diff --git a/packages/mesh-svelte/package.json b/packages/mesh-svelte/package.json index 6be89065..cfbc62b5 100644 --- a/packages/mesh-svelte/package.json +++ b/packages/mesh-svelte/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/svelte", - "version": "0.0.5", + "version": "1.7.23", "description": "Svelte component library - https://meshjs.dev/svelte", "type": "module", "exports": { @@ -26,7 +26,7 @@ "dev": "vite dev" }, "dependencies": { - "@meshsdk/core": "1.7.22" + "@meshsdk/core": "1.7.23" }, "devDependencies": { "@meshsdk/configs": "*", diff --git a/packages/mesh-transaction/package.json b/packages/mesh-transaction/package.json index 64991cae..046f2753 100644 --- a/packages/mesh-transaction/package.json +++ b/packages/mesh-transaction/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/transaction", - "version": "1.7.22", + "version": "1.7.23", "description": "Transactions - https://meshjs.dev/apis/transaction", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -35,9 +35,9 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", - "@meshsdk/core-csl": "1.7.22", - "@meshsdk/core-cst": "1.7.22", + "@meshsdk/common": "1.7.23", + "@meshsdk/core-csl": "1.7.23", + "@meshsdk/core-cst": "1.7.23", "json-bigint": "^1.0.0" }, "prettier": "@meshsdk/configs/prettier", diff --git a/packages/mesh-wallet/package.json b/packages/mesh-wallet/package.json index 9d2a0082..2acbba73 100644 --- a/packages/mesh-wallet/package.json +++ b/packages/mesh-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@meshsdk/wallet", - "version": "1.7.22", + "version": "1.7.23", "description": "Wallets - https://meshjs.dev/apis/wallets", "main": "./dist/index.cjs", "browser": "./dist/index.js", @@ -35,10 +35,10 @@ "typescript": "^5.3.3" }, "dependencies": { - "@meshsdk/common": "1.7.22", - "@meshsdk/core-csl": "1.7.22", - "@meshsdk/core-cst": "1.7.22", - "@meshsdk/transaction": "1.7.22", + "@meshsdk/common": "1.7.23", + "@meshsdk/core-csl": "1.7.23", + "@meshsdk/core-cst": "1.7.23", + "@meshsdk/transaction": "1.7.23", "@nufi/dapp-client-cardano": "0.3.5", "@nufi/dapp-client-core": "0.3.5" }, diff --git a/scripts/mesh-cli/package.json b/scripts/mesh-cli/package.json index 282d52ed..4e118787 100644 --- a/scripts/mesh-cli/package.json +++ b/scripts/mesh-cli/package.json @@ -3,7 +3,7 @@ "description": "A quick and easy way to bootstrap your dApps on Cardano using Mesh.", "homepage": "https://meshjs.dev", "author": "MeshJS", - "version": "1.7.22", + "version": "1.7.23", "license": "Apache-2.0", "type": "module", "main": "./dist/index.cjs", From bd59db0e5ff972024ca4edd178956c7afc731a54 Mon Sep 17 00:00:00 2001 From: "Hong Jing (Jingles)" Date: Mon, 2 Dec 2024 20:55:14 +0800 Subject: [PATCH 7/7] Create set-fee.tsx --- .../pages/apis/txbuilder/basics/set-fee.tsx | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 apps/playground/src/pages/apis/txbuilder/basics/set-fee.tsx diff --git a/apps/playground/src/pages/apis/txbuilder/basics/set-fee.tsx b/apps/playground/src/pages/apis/txbuilder/basics/set-fee.tsx new file mode 100644 index 00000000..8e5002cb --- /dev/null +++ b/apps/playground/src/pages/apis/txbuilder/basics/set-fee.tsx @@ -0,0 +1,29 @@ +import TwoColumnsScroll from "~/components/sections/two-columns-scroll"; +import Codeblock from "~/components/text/codeblock"; + +export default function TxbuilderSetFee() { + return ( + + ); +} + +function Left() { + let code1 = ``; + code1 += `const unsignedTx = await txBuilder\n`; + code1 += ` .txOut(...)\n`; + code1 += ` .changeAddress(...)\n`; + code1 += ` .setFee("0")\n`; + code1 += ` .complete();\n`; + + return ( + <> +

Set the fee for the transaction.

+ +

+ The following shows a simple example of building a transaction to send + values with UTxO selection: +

+ + + ); +}