Skip to content

Commit 142cec0

Browse files
authored
refactor: submit uses cbor bytes (#58)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent dc10dda commit 142cec0

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
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
@@ -15,7 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@cardano-foundation/cardano-connect-with-wallet": "^0.2.14",
18-
"@harmoniclabs/cardano-ledger-ts": "^0.4.0-dev15",
18+
"@harmoniclabs/cardano-ledger-ts": "^0.4.0-dev16",
1919
"@tailwindcss/vite": "^4.1.10",
2020
"@tanstack/react-query": "^5.83.0",
2121
"react": "^19.1.0",

src/api/client.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,19 @@ export function getClientProfile(request: ClientProfileRequest): Promise<string>
139139

140140
export function submitTransaction(signedTxCbor: string): Promise<string> {
141141
const url = `${API_BASE_URL}/tx/submit`
142-
142+
143+
var arr = [];
144+
for (var i = 0, len = signedTxCbor.length; i < len; i+=2) {
145+
arr.push(parseInt(signedTxCbor.substr(i,2),16));
146+
}
147+
const bodyBytes = new Uint8Array(arr);
143148
return fetch(url, {
144149
method: 'POST',
145150
headers: {
146151
'Content-Type': 'application/cbor',
147152
'accept': 'application/json',
148153
},
149-
body: signedTxCbor,
154+
body: bodyBytes,
150155
}).then(async (response) => {
151156
if (!response.ok) {
152157
const errorText = await response.text()
@@ -155,4 +160,4 @@ export function submitTransaction(signedTxCbor: string): Promise<string> {
155160

156161
return response.text()
157162
})
158-
}
163+
}

0 commit comments

Comments
 (0)