Skip to content

Commit b61c383

Browse files
authored
Merge pull request #35 from Emurgo/denis/update-csl
Update csl
2 parents a712d08 + 8107560 commit b61c383

File tree

3 files changed

+16
-33
lines changed

3 files changed

+16
-33
lines changed

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.2.1",
44
"private": true,
55
"dependencies": {
6-
"@emurgo/cardano-serialization-lib-browser": "13.1.0",
6+
"@emurgo/cardano-serialization-lib-browser": "14.1.2",
77
"@emurgo/cip4-js": "^1.0.7",
88
"@material-tailwind/react": "^2.1.8",
99
"@testing-library/jest-dom": "^6.1.5",

src/components/cards/cip95BuildSignSubmitCard.js

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import React from 'react'
21
import {
32
getAddressFromBech32,
43
getCslUtxos,
54
getLargestFirstMultiAsset,
6-
getTransactionFromBytes,
75
getTransactionOutput,
86
getTransactionWitnessSetFromBytes,
97
getTxBuilder,
@@ -23,7 +21,7 @@ const Cip95BuildSignSubmitCard = (props) => {
2321
console.error(errorMessage)
2422
}
2523

26-
const buildSignSubmit = () => {
24+
const buildSignSubmit = async () => {
2725
onWaiting(true)
2826
try {
2927
// build Tx
@@ -58,33 +56,18 @@ const Cip95BuildSignSubmitCard = (props) => {
5856
const wasmUnsignedTransaction = txBuilder.build_tx()
5957
// sign Tx
6058
const unsignedTxHex = bytesToHex(wasmUnsignedTransaction.to_bytes())
61-
62-
api
63-
.signTx(unsignedTxHex)
64-
.then((witnessHex) => {
65-
const wasmUnsignedTransaction = getTransactionFromBytes(unsignedTxHex)
66-
const wasmWitnessSet = getTransactionWitnessSetFromBytes(witnessHex)
67-
const wasmSignedTransaction = getSignedTransaction(wasmUnsignedTransaction, wasmWitnessSet)
68-
const signedTxHex = bytesToHex(wasmSignedTransaction.to_bytes())
69-
70-
// submit tx
71-
api
72-
.submitTx(signedTxHex)
73-
.then((txId) => {
74-
onWaiting(false)
75-
console.log('The transaction is sent:', txId)
76-
})
77-
.catch((e) => {
78-
errorHappen(e)
79-
})
80-
})
81-
.catch((e) => {
82-
errorHappen(e)
83-
})
84-
85-
onWaiting(false)
59+
console.log('Unsigned Tx:', unsignedTxHex)
60+
const witnessHex = await api?.signTx(unsignedTxHex)
61+
const wasmWitnessSet = getTransactionWitnessSetFromBytes(witnessHex)
62+
const wasmSignedTransaction = getSignedTransaction(wasmUnsignedTransaction, wasmWitnessSet)
63+
const signedTxHex = bytesToHex(wasmSignedTransaction.to_bytes())
64+
console.log('Signed Tx:', signedTxHex)
65+
const txId = await api?.submitTx(signedTxHex)
66+
console.log('The transaction is sent:', txId)
8667
} catch (e) {
8768
errorHappen(e)
69+
} finally {
70+
onWaiting(false)
8871
}
8972
}
9073

0 commit comments

Comments
 (0)