Skip to content

Commit

Permalink
chore: upgrade to chang-ready CSL 13
Browse files Browse the repository at this point in the history
  • Loading branch information
slowbackspace committed Dec 6, 2024
1 parent 66bbfee commit 96de954
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 161 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- Upgraded cardano-serialization-lib to Chang-compatible release (v12)
- Upgraded cardano-serialization-lib to Chang-compatible release (v13)
- All set types are now serialized with a tag "258", which will become mandatory after the next hard fork (HF)

## [2.2.1] - 2023-11-29

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fivebinaries/coin-selection",
"version": "2.2.1",
"version": "3.0.0-beta.0",
"description": "",
"keywords": [
"coin selection"
Expand Down Expand Up @@ -48,8 +48,8 @@
"typescript-eslint": "^8.8.0"
},
"dependencies": {
"@emurgo/cardano-serialization-lib-browser": "^12.1.0",
"@emurgo/cardano-serialization-lib-nodejs": "12.1.0"
"@emurgo/cardano-serialization-lib-browser": "^13.2.0",
"@emurgo/cardano-serialization-lib-nodejs": "13.2.0"
},
"packageManager": "[email protected]"
}
9 changes: 6 additions & 3 deletions src/methods/largestFirst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ export const largestFirst = (

txBuilder.set_fee(totalFeesAmount);
const txBody = txBuilder.build();
const txHash = Buffer.from(
CardanoWasm.hash_transaction(txBody).to_bytes(),
).toString('hex');

const txHash = CardanoWasm.FixedTransaction.new_from_body_bytes(
txBody.to_bytes(),
)
.transaction_hash()
.to_hex();
const txBodyHex = Buffer.from(txBody.to_bytes()).toString('hex');

const totalSpent = totalUserOutputsAmount.checked_add(totalFeesAmount);
Expand Down
8 changes: 5 additions & 3 deletions src/methods/randomImprove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,11 @@ export const randomImprove = (

txBuilder.set_fee(fee);
const txBody = txBuilder.build();
const txHash = Buffer.from(
CardanoWasm.hash_transaction(txBody).to_bytes(),
).toString('hex');
const txHash = CardanoWasm.FixedTransaction.new_from_body_bytes(
txBody.to_bytes(),
)
.transaction_hash()
.to_hex();
const txBodyHex = Buffer.from(txBody.to_bytes()).toString('hex');

// reorder inputs to match order within tx
Expand Down
254 changes: 127 additions & 127 deletions tests/methods/fixtures/largestFirst.ts

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions tests/methods/fixtures/randomImprove.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ export const nonFinalCompose = [
'ec8fdf616242f430855ad7477acda53395eb30c295f5a7ef038712578877375b5a2f00353c9c5cc88c7ff18e71dc08724d90fc238213b789c0b02438e336be07',
options: {},
result: {
totalSpent: '168053',
fee: '168053',
totalSpent: '168317',
fee: '168317',
},
},
{
Expand All @@ -158,8 +158,8 @@ export const nonFinalCompose = [
'ec8fdf616242f430855ad7477acda53395eb30c295f5a7ef038712578877375b5a2f00353c9c5cc88c7ff18e71dc08724d90fc238213b789c0b02438e336be07',
options: {},
result: {
totalSpent: '2168053',
fee: '168053',
totalSpent: '2168317',
fee: '168317',
},
},
{
Expand Down Expand Up @@ -188,8 +188,8 @@ export const nonFinalCompose = [
'ec8fdf616242f430855ad7477acda53395eb30c295f5a7ef038712578877375b5a2f00353c9c5cc88c7ff18e71dc08724d90fc238213b789c0b02438e336be07',
options: {},
result: {
totalSpent: '6174301',
fee: '174301',
totalSpent: '6174565',
fee: '174565',
},
},
];
Expand Down Expand Up @@ -294,8 +294,8 @@ export const coinSelection = [
'ec8fdf616242f430855ad7477acda53395eb30c295f5a7ef038712578877375b5a2f00353c9c5cc88c7ff18e71dc08724d90fc238213b789c0b02438e336be07',
options: {},
result: {
totalSpent: '2884313',
fee: '194717',
totalSpent: '2884577',
fee: '194981',
inputs: UTXO_REAL_SAME_POLICY,
outputs: [
// external
Expand Down Expand Up @@ -327,7 +327,7 @@ export const coinSelection = [
// change
{
isChange: true,
amount: '699786705',
amount: '699786441',
address:
'addr_test1qq43pzxxgfdvffrw6jnrej9840nuylaykv7uzcy56t02xv8m2tfs2k368ger3n3pngluz0lympuh65rzarw5vux862dszv2e9w',
assets: [
Expand Down
4 changes: 2 additions & 2 deletions tests/utils/trezor/fixtures/sign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const sign = [
},
],
signedTx:
'84a4008382582018cc7d96f92d506dd112d101c8e33a80d0258f6b7b1aabd676e0a4ee6af08943008258201e8ba20994b708f668784eadc5a583ef090998545ebd0b357cca1098bf4112ce00825820c1654e963a73c12eea189a521fa994c8ef2d12efcfbceceb5e0e80a48988a3f601018282583900b52332e05067c86346bbf650afc120e443114358606f7e70c45542bfd7bd25149cb78c6085ca07e881870ca2dff95287e33f9edefd9b1f0d1a0016e36082583900a99f2c10c266cf5cf289f32b6b429cded9b94fe037dd0bcde73e408ca271492bbb4cf84ad488cf85b84c3b960d5ca912e93cd70cac2ae60b821a00203c89a1581c2bd1de9a0ede8302f7b860792d4fcfa9a34cafa6d0cc54d20e5b5374a1445345414c01021a0002c749031a03e2a117a10083825820687d090fa9ea2ca54ab7a881202031c02a78595bd023e7e145d174e4aeb35d365840456b0c26401f2a0a55c5273a9fd1380074a4e231c6ff531c1dccbce886632ba3d9d331f67935182563c57496b89ff1251995efd23b8506f1bed194210472d400825820b236a3556ad2a2be78339cd520c8c784d1b3e54fc77935f4e96183eeddf701ab5840ee4a17f8b2d37d4e1edc309c9c44b08edc94920fac36fe675f88245153948533dc6d8c24744cdd6327027477649aa06e3824c0dc3aa6cbcb1246440c29a2860082582005d3360b3af91ec66ff5ab77b9f40f568b1f5a24fd7350019f5a50a67c883e645840a943f85e313cc907f1bc1d31b0c2cc0160c44232eb6b2cda44568cc690821d6a02a0632e864d4ef26828efd28719cb4dd63e9400dc0c0e6d7a8dccc7a414db0ef5f6',
txHash: '2c83d970d818ed4a09d11105ab061e8ba9a8e52e0e411f3e0f48af2a5958056d',
'84a400d901028382582018cc7d96f92d506dd112d101c8e33a80d0258f6b7b1aabd676e0a4ee6af08943008258201e8ba20994b708f668784eadc5a583ef090998545ebd0b357cca1098bf4112ce00825820c1654e963a73c12eea189a521fa994c8ef2d12efcfbceceb5e0e80a48988a3f601018282583900b52332e05067c86346bbf650afc120e443114358606f7e70c45542bfd7bd25149cb78c6085ca07e881870ca2dff95287e33f9edefd9b1f0d1a0016e36082583900a99f2c10c266cf5cf289f32b6b429cded9b94fe037dd0bcde73e408ca271492bbb4cf84ad488cf85b84c3b960d5ca912e93cd70cac2ae60b821a00203c89a1581c2bd1de9a0ede8302f7b860792d4fcfa9a34cafa6d0cc54d20e5b5374a1445345414c01021a0002c749031a03e2a117a100d9010283825820687d090fa9ea2ca54ab7a881202031c02a78595bd023e7e145d174e4aeb35d365840456b0c26401f2a0a55c5273a9fd1380074a4e231c6ff531c1dccbce886632ba3d9d331f67935182563c57496b89ff1251995efd23b8506f1bed194210472d400825820b236a3556ad2a2be78339cd520c8c784d1b3e54fc77935f4e96183eeddf701ab5840ee4a17f8b2d37d4e1edc309c9c44b08edc94920fac36fe675f88245153948533dc6d8c24744cdd6327027477649aa06e3824c0dc3aa6cbcb1246440c29a2860082582005d3360b3af91ec66ff5ab77b9f40f568b1f5a24fd7350019f5a50a67c883e645840a943f85e313cc907f1bc1d31b0c2cc0160c44232eb6b2cda44568cc690821d6a02a0632e864d4ef26828efd28719cb4dd63e9400dc0c0e6d7a8dccc7a414db0ef5f6',
txHash: '0690e4c93d5f5f2c3379f113bdca1bc26db8364f422549f99f94ae3a597c716b',
},
];
8 changes: 5 additions & 3 deletions tests/utils/trezor/sign.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ describe('trezor sign utils', () => {
const tx = CardanoWasm.Transaction.from_bytes(
Buffer.from(signedTx, 'hex'),
);
const txhash = Buffer.from(
CardanoWasm.hash_transaction(tx.body()).to_bytes(),
).toString('hex');
const txhash = CardanoWasm.FixedTransaction.new_from_body_bytes(
tx.body().to_bytes(),
)
.transaction_hash()
.to_hex();

// just sanity check, signing shouldn't change the hash
expect(txhash).toBe(f.txHash);
Expand Down
20 changes: 10 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -940,17 +940,17 @@ __metadata:
languageName: node
linkType: hard

"@emurgo/cardano-serialization-lib-browser@npm:^12.1.0":
version: 12.1.0
resolution: "@emurgo/cardano-serialization-lib-browser@npm:12.1.0"
checksum: 10/70ef63f6d34e49987740c06254b9abc405f646aac0ef1f18e201fead51ff3a862b5e0142e9cd4dbfe59c8b5e2b64ae7b8f3be3a860ece5fc6283bdcffa65d56e
"@emurgo/cardano-serialization-lib-browser@npm:^13.2.0":
version: 13.2.0
resolution: "@emurgo/cardano-serialization-lib-browser@npm:13.2.0"
checksum: 10/f60f47b7df9e1e783302921d9f225696d09e01b124a75dd8672effae17acdd42779da66a068c923261aabead52ac7aae9426ef13c875f48b5ef7b9d629b8b993
languageName: node
linkType: hard

"@emurgo/cardano-serialization-lib-nodejs@npm:12.1.0":
version: 12.1.0
resolution: "@emurgo/cardano-serialization-lib-nodejs@npm:12.1.0"
checksum: 10/cf1f07468cf60af873375368e9d4b2d605758835de56fb314879230f11086c1474426ab2b540a218ed447f40005cc9c49f7f7f47e2d331d10d2c12140ede0737
"@emurgo/cardano-serialization-lib-nodejs@npm:13.2.0":
version: 13.2.0
resolution: "@emurgo/cardano-serialization-lib-nodejs@npm:13.2.0"
checksum: 10/b8483dd74ec902da607f0ee00259674ba1794784fafd322948043dd4dfdbddecc81f6546fc98c9a57810639f91110cf76be7755a138a3506af6233954cfe449e
languageName: node
linkType: hard

Expand Down Expand Up @@ -1034,8 +1034,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@fivebinaries/coin-selection@workspace:."
dependencies:
"@emurgo/cardano-serialization-lib-browser": "npm:^12.1.0"
"@emurgo/cardano-serialization-lib-nodejs": "npm:12.1.0"
"@emurgo/cardano-serialization-lib-browser": "npm:^13.2.0"
"@emurgo/cardano-serialization-lib-nodejs": "npm:13.2.0"
"@eslint/js": "npm:^9.11.1"
"@swc-node/jest": "npm:^1.8.12"
"@swc/core": "npm:1.7.26"
Expand Down

0 comments on commit 96de954

Please sign in to comment.