Module: MixinBot::API::Payment

Included in:
MixinBot::API
Defined in:
lib/mixin_bot/api/payment.rb

Instance Method Summary collapse

Instance Method Details

#safe_pay_url(**kwargs) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mixin_bot/api/payment.rb', line 6

def safe_pay_url(**kwargs)
  members = kwargs[:members]
  threshold = kwargs[:threshold]
  asset_id = kwargs[:asset_id]
  amount = kwargs[:amount]
  memo = kwargs[:memo] || ''
  trace_id = kwargs[:trace_id] || SecureRandom.uuid

  mix_address = MixinBot.utils.build_mix_address(members:, threshold:)

  "https://mixin.one/pay/#{mix_address}?amount=#{amount}&asset=#{asset_id}&memo=#{memo}&trace=#{trace_id}"
end