MPP.Methods.NearIntents (mpp v0.15.0)

Copy Markdown View Source

NEAR Intents charge method backed by the 1Click Swap API.

The method accepts only type="hash" credentials. It verifies an origin deposit, waits for 1Click to reach a terminal settlement state, and returns a receipt only after the merchant's destination delivery reaches SUCCESS.

quote/1 requests the executable EXACT_OUTPUT quote whose single-use deposit address becomes the charge recipient. Its result contains the amount, currency, recipient, and method_config values needed by MPP.Plug, plus the provider quote deadline that bounds challenge expiry.

Direct origin-RPC verification is enabled for EVM origins by setting "origin_rpc_url". Other origins use the specification's 1Click status observation mode: the presented hash must be one of the backend-observed origin transactions for the deposit address.

Configuration

  • "origin_network" — source CAIP-2 network
  • "destination_network" — merchant CAIP-2 network
  • "destination_asset" — merchant CAIP-19 asset
  • "destination_recipient" — merchant destination address
  • "amount_out" — exact destination amount in base units
  • "min_amount_in" — minimum accepted origin deposit in base units
  • "refund_to" — origin-chain refund address bound into the challenge
  • "quote_deadline" — executable quote deadline returned by 1Click
  • "one_click_url" — optional API base URL
  • "one_click_jwt" — optional partner JWT; never exposed in challenges
  • "origin_rpc_url" — optional EVM origin RPC URL
  • "origin_req_options" — optional Req options for origin RPC
  • "poll_timeout_ms" — optional settlement poll ceiling
  • "poll_interval_ms" — optional status poll interval
  • "store" — optional atomic store implementing MPP.Tempo.Store.update/3; defaults to MPP.Tempo.ConCacheStore

API Functions

FunctionArityDescriptionParam Kinds
verify2Verify an origin deposit and await terminal NEAR Intents settlement.-
quote1Request a wet EXACT_OUTPUT 1Click quote and return MPP method options.-
challenge_method_details1Return the public NEAR Intents settlement fields for the 402 challenge.-
validate_config!1Validate required NEAR Intents route and store configuration.-
credential_types0Return the only accepted NEAR Intents credential type: hash.-
method_name0Return the NEAR Intents payment method identifier.-

Summary

Functions

Return the public NEAR Intents settlement fields for the 402 challenge.

Return the only accepted NEAR Intents credential type: hash.

Return the NEAR Intents payment method identifier.

Requests an executable 1Click quote.

Validate required NEAR Intents route and store configuration.

Verify an origin deposit and await terminal NEAR Intents settlement.

Types

quote_result()

@type quote_result() :: %{
  amount: String.t(),
  currency: String.t(),
  recipient: String.t(),
  expires_at: String.t(),
  method_config: map()
}

Functions

challenge_method_details(charge)

@spec challenge_method_details(MPP.Method.intent()) :: map() | nil
@spec challenge_method_details(MPP.Intents.Charge.t()) :: map()

Return the public NEAR Intents settlement fields for the 402 challenge.

# descripex:contract
%{}

credential_types()

@spec credential_types() :: [String.t()]
@spec credential_types() :: [String.t()]

Return the only accepted NEAR Intents credential type: hash.

# descripex:contract
%{}

method_name()

@spec method_name() :: String.t()

Return the NEAR Intents payment method identifier.

# descripex:contract
%{}

quote(parameters)

@spec quote(map()) :: {:ok, quote_result()} | {:error, term()}

Requests an executable 1Click quote.

The input uses CAIP identifiers for the MPP challenge and explicit 1Click asset IDs at the provider boundary. The returned map can be passed into a dynamically built MPP.Plug configuration.

validate_config!(config)

@spec validate_config!(map()) :: :ok
@spec validate_config!(map()) :: :ok

Validate required NEAR Intents route and store configuration.

# descripex:contract
%{}

verify(payload, charge)

@spec verify(map(), MPP.Intents.Charge.t()) ::
  {:ok, MPP.Receipt.t()} | {:error, MPP.Errors.t()}

Verify an origin deposit and await terminal NEAR Intents settlement.

# descripex:contract
%{}