Data Models
15 min
these models mirror the public types and serializers used by the current @primevault/js api sdk optional properties are marked with ? unless explicitly stated otherwise, ids and decimal amounts are strings cursor list response transaction, vault, contact, and bank account list methods return the same cursor envelope interface cursorlistresponse\<t> { results t\[]; nextcursor? string | null; hasnext? boolean; } transfer parties enum transferpartytype { contact = "contact", vault = "vault", external address = "external address", external bank account = "external bank account", bank account = "bank account", } interface transferpartydata { type transferpartytype | string; id? string; suborgid? string; name? string; address? string; provider? string; bankdetails? bankdetails; chain? string; paymentrail? string; } interface bankdetails { bankaccountid? string; bankname? string; beneficiaryname? string; accountname? string; accountnumber? string; accountnumbermasked? string; routingnumber? string; paymentrail? string; bankaddress? string; swiftcode? string; swiftbic? string; iban? string; country? string; } party type identification vault , contact , bank account use the organization scoped resource id external address use address and chain ; do not put the address in id external bank account use the applicable bankdetails and payment rail fields suborgid is the party's explicit sub organization scope never substitute a similarly named party from another scope asset and chain interface asset { name string; symbol string; blockchain string; logourl? string; details? unknown; } interface chaindata { value string; label string; logo string; } details is chain specific use symbol plus blockchain to identify an asset representation vault enum vaulttype { exchange = "exchange", default = "default", gas = "gas", } interface vault { id string; orgid string; suborgid? string; vaultname string; vaulttype vaulttype; wallets array<{ id string; blockchain string; address? string; publickey? string; }>; signers? array<{ id string; firstname string; lastname string; email string; }>; viewers array<{ id string; firstname? string; lastname? string; email? string; }>; walletsgenerated boolean; createdat string; updatedat string; isdeleted boolean; } walletsgenerated is the readiness signal after creation and approval contact enum contactstatus { pending = "pending", approved = "approved", declined = "declined", } interface contact { id string; orgid string; suborgid? string; name string; blockchain string; address string; status contactstatus; issmartcontractaddress boolean; tags? string\[]; createdbyid string; issanctioned boolean; externalid? string; createdat string; updatedat string; isdeleted boolean; assetlist? string\[]; } bank account enum bankaccountstatus { pending = "pending", approved = "approved", declined = "declined", } interface bankaccount { id string; orgid string; suborgid? string; orgentityid string; createdbyid string; createdat string; updatedat string; isdeleted boolean; status bankaccountstatus; accountnumber? string; accountname? string; routingnumber? string; clientbankaccountid? string; paymentmethod? string; bankname? string; streetline? string; city? string; state? string; postalcode? string; country? string; } bank account fields can contain sensitive financial data avoid including them in application logs or analytics payloads transaction interface transaction { id string; orgid string; vaultid string; status transactionstatus | string; transactiontype transactiontype | string; category transactioncategory | string; subcategory transactionsubcategory | string; createdat string; updatedat string; isdeleted boolean; amount string; txhash? string; error? string; externalid? string; createdbyid? string; fees? fees; memo? string; txnsignature? string; txnsignaturedata? record\<string, unknown>; output? transactionoutput; amountinusd? string; nonce? number; dappid? string; source? transactionsourcedata; destination? transactionsourcedata; intent? transactionintentrequest; quoteresponse? quoteresponseitem; depositinstructions? depositinstructions; operations? transactionoperation\[]; balancechanges? transactionoperationbalancechanges | null; blockchain? string; asset? string; / deprecated use destination address / toaddress? string; / deprecated use destination name / toaddressname? string; / deprecated use destination id / tovaultid? string; / deprecated use source address / sourceaddress? string; } transaction enums enum transactiontype { incoming = "incoming", outgoing = "outgoing", } enum transactioncategory { transfer = "transfer", swap = "swap", token transfer = "token transfer", token approval = "token approval", contract call = "contract call", stake = "stake", revoke token allowance = "revoke token allowance", on ramp = "on ramp", off ramp = "off ramp", delegate resource = "delegate resource", } enum transactionsubcategory { incoming transfer = "incoming transfer", external transfer = "external transfer", internal transfer = "internal transfer", limit trade = "limit trade", market trade = "market trade", approve token allowance = "approve token allowance", custom message = "custom message", contract call = "contract call", stake = "stake", unstake = "unstake", claim = "claim", on ramp = "on ramp", off ramp = "off ramp", } enum transactionstatus { draft = "draft", pending = "pending", approved = "approved", completed = "completed", failed = "failed", declined = "declined", submitted = "submitted", signed = "signed", waiting confirmation = "waiting confirmation", } transaction operations and balance changes enum transactionoperationtype { deposit = "deposit", trade = "trade", transfer = "transfer", withdraw = "withdraw", } enum transactionoperationstatus { pending = "pending", processing = "processing", completed = "completed", failed = "failed", skipped = "skipped", cancelled = "cancelled", reversed = "reversed", } interface transactionoperationbalancechange { party transferpartydata | null; asset string; amount string; chain? string; paymentrail? string; } interface transactionoperationbalancechanges { changes transactionoperationbalancechange\[]; } interface transactionoperation { source transferpartydata | null; destination transferpartydata | null; balancechanges transactionoperationbalancechanges | null; sequence number; type transactionoperationtype | string; status transactionoperationstatus | string; provider? string; } use operation sequence to preserve workflow order operation level balancechanges describes that leg; top level transaction balancechanges describes the aggregate transaction view when present intent and quote interface routeaccountdata { provider string; id string; } interface transactionintentrequest { source? transferpartydata; destination? transferpartydata; routeaccounts? routeaccountdata\[]; fromasset? string; fromamount? string; fromchain? string; frompaymentrail? string; toasset? string; toamount? string; tochain? string; topaymentrail? string; } interface fees { amount string; asset string; amountinfiat? string; } interface quoteresponseitem { quoteid string; suborgid? string; rate? string; fees? fees; finalfromamount? string; finaltoamount? string; sourcename? string; } interface quoteresponse { quotes quoteresponseitem\[]; } a quote response is an object containing quotes ; it is not a bare array persist the selected quoteid for execution deposit instructions interface depositinstructions { type? transferpartytype | string; paymentrail? string; bankdetails? bankdetails; asset? string; address? string; chain? string; } intent driven transactions can return deposit instructions for the funding leg follow the returned rail, asset, address, and chain exactly fees and balances interface feedata { expectedfeeinasset string; asset string; expectedfeeinusd string; basefee? string; priorityfee? string; } interface estimatedfeeresponse { high feedata; medium feedata; low feedata; } interface balanceresponse { \[asset string] { \[chain string] string; }; } interface detailedbalance { symbol string; balance string; name? string; chain? string; tokenaddress? string; balanceinusd? string; price? string; } type detailedbalanceresponse = detailedbalance\[]; approval models enum approvalaction { approve = "approve", reject = "reject", decline = "reject", } interface getapprovalmessageresponse { approvalid string; message string; changerequestid? string; entityid? string; } interface approvalactionresponse { success boolean; status? string; id? string; entityid? string; } webhook event envelope interface webhookevent { event \| "transaction status changed" \| "transaction operation status changed"; version "2 0 0"; eventid string; data { transaction? transaction; transactionoperation? transactionoperation; }; }