Skip to content

Commit

Permalink
fixed sponsored tx gas coins
Browse files Browse the repository at this point in the history
  • Loading branch information
bonkman22 committed Oct 10, 2024
1 parent 776567f commit a4706f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hop.ag/sdk",
"version": "3.3.2",
"version": "3.3.3",
"description": "Official Hop SDK to access Hop Aggregator",
"type": "module",
"main": "dist/cjs/index.js",
Expand Down
24 changes: 12 additions & 12 deletions src/sdk/routes/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,19 @@ export async function fetchTx(
Trade amount: ${params.trade.amount_in.amount}`
)
}
}

// gas coins
if(!params.sponsored) {
if (params.trade.amount_in.token != "0x2::sui::SUI") {
let fetched_gas_coins = await fetchCoins(
client,
params.sui_address,
"0x2::sui::SUI",
);
gas_coins = fetched_gas_coins.filter((struct) => struct.amount != "0").map((struct) => struct.object_id);
} else {
gas_coins = user_input_coins.filter((struct) => struct.amount != "0").map((struct) => struct.object_id);
}
// gas coins
if(!params.sponsored) {
if (params.trade.amount_in.token != "0x2::sui::SUI") {
let fetched_gas_coins = await fetchCoins(
client,
params.sui_address,
"0x2::sui::SUI",
);
gas_coins = fetched_gas_coins.filter((struct) => struct.amount != "0").map((struct) => struct.object_id);
} else {
gas_coins = user_input_coins.filter((struct) => struct.amount != "0").map((struct) => struct.object_id);
}
}

Expand Down

0 comments on commit a4706f6

Please sign in to comment.