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/relay.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_client.rb,
lib/mpp/methods/tempo/fee_payer_policy.rb,
lib/mpp/methods/tempo/fee_payer_envelope.rb

Defined Under Namespace

Modules: Attribution, Defaults, FeePayer, FeePayerPolicy, Keychain, Proof, Rpc, Schemas, Transaction Classes: Account, ChargeIntent, FeePayerClient, Relay, 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"
TRANSACTION_PENDING =
"transaction:pending"
TRANSACTION_VERIFIED =
"transaction:verified"
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, fee_payer_allowed_fee_tokens: nil, relay: nil) ⇒ Object

Factory function to create a configured TempoMethod.



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/mpp/methods/tempo/client_method.rb', line 252

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, fee_payer_allowed_fee_tokens: nil, relay: nil)
  rpc_url ||= chain_id ? Defaults.rpc_url_for_chain(chain_id) : Defaults::RPC_URL
  currency ||= Defaults.default_currency_for_chain(chain_id)

  if fee_payer == true
    raise ArgumentError, "fee_payer: true requires account:" unless 

    fee_payer = 
  end

  method = TempoMethod.new(
    account: ,
    fee_payer: FeePayerClient.resolve_optional(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,
    fee_payer_allowed_fee_tokens: fee_payer_allowed_fee_tokens,
    relay: Relay.resolve_optional(relay)
  )

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