Skip to content

Commit de64120

Browse files
authored
feat: add tx as fee parameter (#19)
This is needed by Sui currency
1 parent 9ab5c9f commit de64120

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

lib/bitgo_client/v2.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ def address(wallet_id, address, coin_code: :tbtc, logger: nil)
3333
client.request("#{base_path}/#{coin_code}/wallet/#{wallet_id}/address/#{address}", logger: logger)
3434
end
3535

36-
def fee(coin_code: :tbtc, logger: nil)
37-
client.request("#{base_path}/#{coin_code}/tx/fee", logger: logger)
36+
def fee(coin_code: :tbtc, logger: nil, tx: nil)
37+
query_string = build_query_string(tx: tx)
38+
39+
client.request("#{base_path}/#{coin_code}/tx/fee?#{query_string}", logger: logger)
3840
end
3941

4042
def get_transfer(wallet_id, transfer_id, coin_code: :tbtc, logger: nil)

spec/bitgo_client/v2_spec.rb

+11-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
api.fee
182182

183183
expect(client).to have_received(:request)
184-
.with("#{api.base_path}/tbtc/tx/fee", logger: nil)
184+
.with("#{api.base_path}/tbtc/tx/fee?", logger: nil)
185185
end
186186
end
187187

@@ -190,7 +190,16 @@
190190
api.fee(coin_code: :xxx)
191191

192192
expect(client).to have_received(:request)
193-
.with("#{api.base_path}/xxx/tx/fee", logger: nil)
193+
.with("#{api.base_path}/xxx/tx/fee?", logger: nil)
194+
end
195+
end
196+
197+
context "with specific params" do
198+
it "calls client request with the correct path" do
199+
api.fee(coin_code: :tsui, tx: "some_tx")
200+
201+
expect(client).to have_received(:request)
202+
.with("#{api.base_path}/tsui/tx/fee?tx=some_tx", logger: nil)
194203
end
195204
end
196205
end

0 commit comments

Comments
 (0)