From 4f8d13168a48652973772f246516167ef3aaf97a Mon Sep 17 00:00:00 2001 From: james Date: Thu, 3 Feb 2022 11:49:20 -0500 Subject: [PATCH] estimate_fee_for_transaction --- lib/fireblocks/api/transactions.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/fireblocks/api/transactions.rb b/lib/fireblocks/api/transactions.rb index 64c8df3..b21e731 100644 --- a/lib/fireblocks/api/transactions.rb +++ b/lib/fireblocks/api/transactions.rb @@ -102,6 +102,20 @@ def destination_payload(**kwargs) def get_transaction_by_id(id) Fireblocks::Request.get(path: "/v1/transactions/#{id}") end + + def estimate_fee_for_transaction(asset_id:, amount:, source_id:, destination:) + body = { + amount: amount, + assetId: asset_id, + source: { + type: VAULT_ACCOUNT, + id: source_id + }, + destination: destination + }.compact + + Fireblocks::Request.post(body: body.slice(*VALID_TRANSACTION_KEYS), path: '/v1/transactions/estimate_fee') + end end end end