Skip to content

Commit

Permalink
Merge branch '53-consider-transaction-fee-while-getting-box-in-genera…
Browse files Browse the repository at this point in the history
…tetransaction' into 'dev'

consider transaction fee while selecting transaction input boxes

Closes #53

See merge request ergo/rosen-bridge/rosen-chains!57
  • Loading branch information
vorujack committed Sep 13, 2023
2 parents f876ed4 + 7e1cb17 commit 316e238
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion packages/chains/cardano/lib/CardanoChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class CardanoChain extends AbstractUtxoChain<CardanoUtxo> {
const requiredAssets = order
.map((order) => order.assets)
.reduce(ChainUtils.sumAssetBalance, {
nativeToken: this.getMinimumNativeToken(),
nativeToken: this.getMinimumNativeToken() + this.configs.fee,
tokens: [],
});

Expand Down
2 changes: 1 addition & 1 deletion packages/chains/cardano/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/cardano",
"version": "0.1.15",
"version": "0.1.16",
"description": "this project contains cardano chain for Rosen-bridge",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/chains/cardano/tests/CardanoChain.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('CardanoChain', () => {
const expectedRequiredAssets = structuredClone(
TestData.transaction1Order[0].assets
);
expectedRequiredAssets.nativeToken += minBoxValue;
expectedRequiredAssets.nativeToken += minBoxValue + configs.fee;
expect(getCovBoxesSpy).toHaveBeenCalledWith(
configs.lockAddress,
expectedRequiredAssets,
Expand Down
5 changes: 4 additions & 1 deletion packages/chains/ergo/lib/ErgoChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,10 @@ class ErgoChain extends AbstractUtxoChain<wasm.ErgoBox> {
0n,
true
),
{ nativeToken: this.getMinimumNativeToken(), tokens: [] }
{
nativeToken: this.getMinimumNativeToken() + this.configs.fee,
tokens: [],
}
);

// check if there are enough assets in address
Expand Down
2 changes: 1 addition & 1 deletion packages/chains/ergo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/ergo",
"version": "0.2.2",
"version": "0.2.3",
"description": "this project contains ergo chain for Rosen-bridge",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/networks/cardano-koios/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/cardano-koios-network",
"version": "0.1.15",
"version": "0.1.16",
"description": "cardano koios network package for rosen cardano chain",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand All @@ -25,7 +25,7 @@
"@rosen-bridge/rosen-extractor": "^0.1.11",
"@rosen-bridge/tokens": "^0.2.0",
"@rosen-chains/abstract-chain": "^0.1.15",
"@rosen-chains/cardano": "^0.1.15",
"@rosen-chains/cardano": "^0.1.16",
"@rosen-clients/cardano-koios": "^1.0.3",
"json-bigint": "^1.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/networks/ergo-explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/ergo-explorer-network",
"version": "0.1.17",
"version": "0.1.18",
"description": "ergo explorer network package for rosen ergo chain",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"@rosen-bridge/rosen-extractor": "^0.1.11",
"@rosen-bridge/tokens": "^0.2.0",
"@rosen-chains/abstract-chain": "^0.1.15",
"@rosen-chains/ergo": "^0.2.2",
"@rosen-chains/ergo": "^0.2.3",
"@rosen-clients/ergo-explorer": "^1.0.2",
"ergo-lib-wasm-nodejs": "^0.24.0",
"it-all": "^3.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/networks/ergo-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rosen-chains/ergo-node-network",
"version": "0.1.19",
"version": "0.1.20",
"description": "ergo node network package for rosen ergo chain",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand All @@ -24,7 +24,7 @@
"@rosen-bridge/rosen-extractor": "^0.1.11",
"@rosen-bridge/tokens": "^0.2.0",
"@rosen-chains/abstract-chain": "^0.1.15",
"@rosen-chains/ergo": "^0.2.2",
"@rosen-chains/ergo": "^0.2.3",
"@rosen-clients/ergo-node": "^1.0.3",
"ergo-lib-wasm-nodejs": "^0.24.0",
"it-all": "^3.0.1",
Expand Down

0 comments on commit 316e238

Please sign in to comment.