Class: Filecoin::Types::StartDealParams

Inherits:
Object
  • Object
show all
Defined in:
lib/filecoin/types/start_deal_params.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, wallet: nil, miner:, epoch_price:, min_blocks_duration: nil, deal_start_epoch: nil) ⇒ StartDealParams

Returns a new instance of StartDealParams.



6
7
8
9
10
11
12
13
# File 'lib/filecoin/types/start_deal_params.rb', line 6

def initialize(data:, wallet: nil, miner:, epoch_price:, min_blocks_duration: nil, deal_start_epoch: nil)
  @data = data
  @wallet = wallet || Filecoin.config.default_wallet
  @miner = miner
  @epoch_price = epoch_price
  @min_blocks_duration = min_blocks_duration
  @deal_start_epoch = deal_start_epoch
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def data
  @data
end

#deal_start_epochObject (readonly)

Returns the value of attribute deal_start_epoch.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def deal_start_epoch
  @deal_start_epoch
end

#epoch_priceObject (readonly)

Returns the value of attribute epoch_price.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def epoch_price
  @epoch_price
end

#min_blocks_durationObject (readonly)

Returns the value of attribute min_blocks_duration.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def min_blocks_duration
  @min_blocks_duration
end

#minerObject (readonly)

Returns the value of attribute miner.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def miner
  @miner
end

#walletObject (readonly)

Returns the value of attribute wallet.



4
5
6
# File 'lib/filecoin/types/start_deal_params.rb', line 4

def wallet
  @wallet
end

Instance Method Details

#as_jsonObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/filecoin/types/start_deal_params.rb', line 15

def as_json
  hash = {
    "Data" => data.as_json,
    "Wallet" => wallet,
    "Miner" => miner,
    "EpochPrice" => epoch_price.to_s,
  }

  hash["MinBlocksDuration"] = min_blocks_duration unless min_blocks_duration.nil?
  hash["DealStartEpoch"] = deal_start_epoch unless deal_start_epoch.nil?

  hash
end