Module: Mpp::Methods::Tempo

Defined in:
lib/mpp/methods/tempo.rb,
lib/mpp/methods/tempo/rpc.rb,
lib/mpp/methods/tempo/proof.rb,
lib/mpp/methods/tempo/account.rb,
lib/mpp/methods/tempo/intents.rb,
lib/mpp/methods/tempo/schemas.rb,
lib/mpp/methods/tempo/defaults.rb,
lib/mpp/methods/tempo/keychain.rb,
lib/mpp/methods/tempo/attribution.rb,
lib/mpp/methods/tempo/transaction.rb,
lib/mpp/methods/tempo/client_method.rb,
lib/mpp/methods/tempo/fee_payer_envelope.rb

Defined Under Namespace

Modules: Attribution, Defaults, FeePayer, Keychain, Proof, Rpc, Schemas, Transaction Classes: Account, ChargeIntent, TempoMethod, TransactionError

Constant Summary collapse

MAX_RECEIPT_RETRY_ATTEMPTS =
20
RECEIPT_RETRY_DELAY_SECONDS =
0.5
TRANSFER_SELECTOR =
"a9059cbb"
TRANSFER_WITH_MEMO_SELECTOR =
"95777d59"
TRANSFER_TOPIC =
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
TRANSFER_WITH_MEMO_TOPIC =
"0x57bc7354aa85aed339e000bccffabbc529466af35f0772c8f8ee1145927de7f0"
DEFAULT_GAS_LIMIT =
1_000_000
EXPIRING_NONCE_KEY =

U256::MAX

(1 << 256) - 1
FEE_PAYER_VALID_BEFORE_SECS =
25

Class Method Summary collapse

Class Method Details

.tempo(intents:, account: nil, fee_payer: nil, chain_id: nil, rpc_url: nil, root_account: nil, currency: nil, recipient: nil, decimals: 6, client_id: nil, expected_recipients: nil) ⇒ Object

Factory function to create a configured TempoMethod.



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/mpp/methods/tempo/client_method.rb', line 231

def self.tempo(intents:, account: nil, fee_payer: nil, chain_id: nil, rpc_url: nil,
  root_account: nil, currency: nil, recipient: nil, decimals: 6, client_id: nil,
  expected_recipients: nil)
  rpc_url ||= chain_id ? Defaults.rpc_url_for_chain(chain_id) : Defaults::RPC_URL
  currency ||= Defaults.default_currency_for_chain(chain_id)

  method = TempoMethod.new(
    account: ,
    fee_payer: fee_payer,
    rpc_url: rpc_url,
    chain_id: chain_id,
    root_account: ,
    currency: currency,
    recipient: recipient,
    decimals: decimals,
    client_id: client_id,
    expected_recipients: expected_recipients
  )

  intents.each_value do |intent|
    intent.rpc_url = rpc_url if intent.respond_to?(:rpc_url=) && intent.rpc_url.nil?
    intent.instance_variable_set(:@_method, method) if intent.respond_to?(:fee_payer)
  end
  method.intents = intents.dup
  method
end