Simulate a deposit to a deposit address
/ sandbox/ test-helpers/ uda/ depositsIt answers
404environment_not_sandboxagainst a live environment.A test helper moves money on the simulated chains, and a live environment's money is on real ones.
Send money to one of the environment's universal deposit addresses from outside, on a simulated chain, and answer
201at once with theSimulationrecording it, stillrunning. The chain includes the transfer, Stridge observes it, and the deposit settles the waysettlementandbridgechose; the simulation follows, and itscausednames the deposit, settlement and routing as they appear. Read it back withGET /sandbox/simulations/{simulation_id}, whosewaitblocks until it gets there.The body is facts plus levers.
The facts,
network_id,assetandamount, are what the payer did and are always concrete. An underpaid, overpaid, wrong-network, wrong-asset or dust deposit is one of these stated to be so:GET /sandbox/test-helpers/options?uda_id=…expands each preset into facts for this address, andpresetnames the one they came from. A network the address is not payable on, or an asset it does not accept, is simulated rather than refused, because what Stridge does with it is the thing being tested; only an asset the network itself does not carry is refused. Stridge detects such a payment and settles none of it: the simulation completes with the deposit alone incaused, and no settlement or routing is made. The body is held to its schema: a member it does not declare answers400parameter_unknown, a missing one422parameter_missingand one outside its schema422parameter_invalid, each naming it. Auda_idthe environment does not hold, or one with no address on the network, answers404resource_missing; a network the sandbox does not simulate404network_not_simulated; an unknown asset, a malformed amount, an unknown outcome or preset422parameter_invalidnaming it.
Show 3 more detailsShow fewer details
An asset the address does not accept takes no levers.
Which assets it accepts on each network is the address's
accepted_assetsin options. A deposit in any other asset has no settlement to succeed, fail or retry and no leg to bridge, so it is sent withsettlementandbridgeleft out, and its simulation completes withoutcome: "asset not accepted"once Stridge records the deposit. Statingsettlementorbridgefor one answers422asset_not_accepted, its message naming the assets the address does accept on that network;settlement: "success"beside thewrong_assetpreset is taken as omitted. On a network the address is not payable on, abridgeanswers422parameter_invalidnamingbridge.The key is required: a request without
Idempotency-Keyanswers400header_invalid, as does one longer than 255 characters. The sameIdempotency-Keywith the same body answers the first201, and spends nothing from the budget; the same key with another body answers400idempotency_key_reused, and one still in flight409idempotency_key_in_use.Each call spends one from the environment's simulation budget, which options reports. An exhausted budget answers
429simulation_budget_exhaustedwith the rate-limit headers andRetry-After.While a reset of the environment is running, the call answers
409environment_resetting. While the sandbox is still being provisioned, before it is ready for its first call, the call answers409environment_provisioning, which clears on its own, so a client retries it shortly.
Header parameters
- X-Stridge-Environmentstring <uuid>optional
Which environment the request acts inside, on an operation a session and an API key both call. Learn more
Show full descriptionShow less
It is required under a person's session, exactly as
EnvironmentHeaderdescribes: a session request that omits it answers400withenvironment required, and one naming an environment the caller holds no membership of answers404.An API key names its own environment, so a request made with one omits this header. A key request that sends it answers
400withenvironment header not accepted, whatever it names, rather than having the header ignored: a header that is silently ignored hides the integration bug that sent it. - Idempotency-Keystringrequired
A caller-chosen key making this request safe to retry, and required here: an operation that takes this form changes something a blind retry must never change twice. A request without one answers
400header_invalidnamingIdempotency-Key(Idempotency-Key is required). Learn moreShow full descriptionShow less
The same key with the same parameters returns the first result, status and body both, and does nothing a second time. So a retry after a dropped connection is safe whether or not the first attempt landed. The parameters are compared as parsed, not as bytes: the query with its names sorted and the JSON body decoded, so member order, spacing and escaping never make two requests differ, while any changed value does.
What is remembered is the answer of an attempt that began execution, success or failure, a
500included. A refusal made before execution is not remembered, so a retry with the same key runs afresh once its cause is fixed: a validation error (400,422), a409conflict, a429, a403step_up_required, and any answer carryingRetry-After. An answer whose body is larger than 64 KiB is not remembered either, and an operation may say that its500is not; a retry of either runs the request again. What the first attempt did stands, so a create that took a unique value answers that value's conflict on the retry: a payout whose first attempt took itsreference_idanswers409payout_reference_taken.The same key with different parameters answers
400withidempotency key replayed with a different body: a key names one request, and reusing it for another is a client bug rather than a retry. A replay while the first request is still in flight answers409at once witha request with this idempotency key is still in flight, and the remedy is to retry once the first has answered.Keys are scoped to the environment the request acts inside, and to its reset: one environment's key never answers another environment's request, and a key used before a sandbox reset runs afresh after it.
Request body
- uda_idstring <uuid>required
The deposit address paid, as the
Deposit addressesfamily names it. - network_idstringrequired
The chain the payer sends on, as the
networksofGET /sandbox/test-helpers/optionsname it. A chain the address is not payable on is a fact like any other: it is simulated, and what Stridge makes of it is the outcome.Show full descriptionShow less
Stridge detects the deposit there, as it does one in an asset the address does not accept, and settles none of it.
The asset a deposit is made in: the chain's own gas asset,
{ "native": true }, or a token named by its contract,{ "token": "0x…" }. Exactly one of the two members is stated, so an empty object and one stating both are refused.- nativebooleanrequiredenum true
Stated only as
true.
- nativebooleanrequiredenum true
- amountstringrequired
How much is sent, in the asset's base units, as a decimal string of digits. A decimal point, a sign or an exponent answers
422withmalformed amount. - settlementobject
What happens when Stridge settles the deposit.
failis a settlement that fails for good;retry_then_successfails once and succeeds on Stridge's retry. Omitted, it succeeds.Show full descriptionShow less
A deposit in an asset the address does not accept on the network has no settlement, so none is chosen for it: the asset is not among the address's
accepted_assetsinGET /sandbox/test-helpers/options. Omitted, the deposit is sent and the echoedrequeststates nosettlement. Stated, it answers422withasset not accepted by the uda, exceptsuccessbeside thewrong_assetpreset, which is what a form sends for that preset and is taken as omitted. - bridgeobject
What the bridge does with the cross-chain leg: fill it, fail it, refund it to the source chain, or leave it in flight.
Show full descriptionShow less
It is stated only for an address whose settlement crosses chains; on one that settles on the chain it was paid on, it answers
422withbridge outcome needs a cross-chain route, and on a deposit in an asset the address does not accept on the network,422withasset not accepted by the uda. Omitted, a cross-chain leg completes. - presetstring
The preset these facts were expanded from, as
GET /sandbox/test-helpers/optionslists it, recorded on the simulation. It changes nothing that is simulated: the facts are what is simulated. The valid values are the contract'sTestHelperPresetId, the list options serves.Show full descriptionShow less
A value options does not list for a UDA deposit answers
422withunknown preset.
Responses
The lever was pulled. The simulation is running, or already further along where the world was quick; a replay of the same idempotent request answers this same body again.
- idstring <uuid>required
The simulation's own identifier, the one
GET /sandbox/simulations/{simulation_id}reads it back by and a chain transaction'scaused_by.run_idnames. - objectstringrequiredenum simulation
What this object is, so a payload read on its own says so.
- environment_idstring <uuid>required
The sandbox the simulation ran in.
- livemodebooleanrequiredenum false
Always
false: nothing is simulated in a live environment. It is carried for the reason every environment-scoped object carries it, so a simulation read on its own says which side of the boundary it came from. - kindstringrequired
Which helper was called, one of
SimulationKind's values. The set is open: a helper added later answers its own kind, and a client meeting a kind it does not know shows it as the server names it rather than refusing the simulation. - presetstring | nullrequired
The preset the request named, or
nullwhere it named none.
Show 9 more fieldsShow fewer fields
- requestobjectrequired
The facts and levers the helper was called with, defaults filled in. Its members are the request body of the helper
kindnames; forpayout_releaseandpayout_fail, which take no body, it is{ "payout_id": … }. - statestringrequiredenum running · observed · completed · failed · expired
Where the simulation has got to.
runningis a lever pulled and nothing observed yet;observedis Stridge having recorded the first product object the pull produced;completedis the flow having reached its terminal state.Show full descriptionShow less
The other two are the simulation's own failures rather than the flow's.
A failure the caller chose is
completed, notfailed. A deposit whose settlement was chosen to fail, or a payout chosen to fail, is a simulation that did exactly what it was asked, and it completes when the failure has played out.failedis the simulation itself unable to finish: the simulated world refused the pull, or it did not play out in time, anderrorsays which.expiredis a simulation issued at an olderreset_epochthan the environment's current one. A reset withdraws what a simulation in flight had armed, so one caught by a reset never completes; a read waiting on it across the reset is answeredexpired, and once the reset has destroyed it the simulation answers404like every other object of the emptied world. The transaction the lever put on a simulated chain, or
nullbefore one exists, and for a simulation the world refused before it put one there.- network_idstringrequired
- hashstringrequired
The transaction's hash, which the sandbox explorer shows.
Every Stridge object the flow produced so far, in the order they appeared.
- objectstringrequired
The contract's resource name:
deposit,settlement,routing,payoutortransfer. The set is open: a client meeting a name it does not know renders the id without a link. - idstringrequired
The object's own identifier, in its family's own format.
- statusstring | nullrequired
The object's own
statuswhen the simulation last saw it, ornullfor an object that has none. The object's own read is the authority; this is what the simulation observed. - event_typestring | nullrequired
The most recent webhook event recorded for the object, one of the webhook event types this reference documents, or
nullwhile none has been.
- objectstringrequired
- epochinteger <int32>required
The environment's
reset_epochwhen the simulation was created. A reset that moves the environment past it expires the simulation. - errorstring | nullrequired
Why a
failedsimulation failed,nullin every other state:world refusedwhen the simulated world would not carry the pull out,timed outwhen it did not play out in the time the world allows. A failure the caller chose is never here. - outcomestring | nullrequired
Why a
completedsimulation stopped short of a settlement,nullwhere the flow ran its course and in every state butcompleted.Show full descriptionShow less
asset not acceptedis a UDA deposit in an asset the address does not accept on the network: Stridge records the deposit and settles none of it, and the simulation completes as soon as the deposit is recorded.not settledis a UDA deposit Stridge recorded and settled nothing of for another reason, such as a sender it suppresses or a payment no route carries, once a grace has passed.not recordedis a deposit below its asset's minimum on the network, which Stridge never recorded. The set is open: a client meeting a value it does not know shows it as the server names it. - created_atstring <date-time>required
RFC3339 UTC timestamp,
Zsuffixed. When the helper was called. It is the default sort, newest first. - updated_atstring <date-time>required
RFC3339 UTC timestamp,
Zsuffixed. Whenstate,chainorcausedlast changed.
Errors
The error.code values this operation can return. Each one links to its entry in the error catalogue, which explains the cause and the fix.
- 400body_invalidInvalid request body
- 400environment_requiredEnvironment required
- 400header_invalidInvalid header
- 400idempotency_key_reusedIdempotency key reused
- 400422parameter_invalidInvalid parameter
- 400parameter_unknownUnknown parameter
- 401api_key_not_acceptedAPI key not accepted
- 401authentication_requiredAuthentication required
- 401publishable_key_not_acceptedPublishable key not accepted
- 401token_invalidInvalid or expired token
- 403membership_suspendedMembership suspended
- 403permission_deniedPermission denied
- 404environment_not_foundEnvironment not found
- 404environment_not_sandboxNot a sandbox environment
- 404network_not_simulatedNetwork not simulated
- 404resource_missingNo such object
- 409environment_provisioningEnvironment provisioning
- 409environment_resettingEnvironment resetting
- 409idempotency_key_in_useIdempotency key in use
- 413body_too_largeRequest body too large
- 415media_type_unsupportedUnsupported media type
- 422asset_not_acceptedAsset not accepted
- 422parameter_missingMissing parameter
- 429rate_limitedToo many requests
- 429simulation_budget_exhaustedSimulation budget exhausted