Models

class polaris.models.Asset[source]

Asset(id, created, modified, code, issuer, significant_decimals, deposit_enabled, deposit_fee_fixed, deposit_fee_percent, deposit_min_amount, deposit_max_amount, withdrawal_enabled, withdrawal_fee_fixed, withdrawal_fee_percent, withdrawal_min_amount, withdrawal_max_amount, send_fee_fixed, send_fee_percent, send_min_amount, send_max_amount, distribution_seed, sep24_enabled, sep6_enabled, sep31_enabled, sep38_enabled, symbol)

property asset_identification_format

SEP-38 asset identification format

code

The asset code as defined on the Stellar network.

deposit_enabled

True if deposit for this asset is supported.

deposit_fee_fixed

Optional fixed (base) fee for deposit. In units of the deposited asset. This is in addition to any fee_percent. Omit if there is no fee or the fee schedule is complex.

deposit_fee_percent

Optional percentage fee for deposit. In percentage points. This is in addition to any fee_fixed. Omit if there is no fee or the fee schedule is complex.

deposit_max_amount

Optional maximum amount. No limit if not specified.

deposit_min_amount

Optional minimum amount. No limit if not specified.

property distribution_account

The Stellar public key derived from Asset.distribution_seed

distribution_seed

The distribution stellar account secret key. The value is stored in the database using Fernet symmetric encryption, and only decrypted when in the Asset object is in memory.

issuer

The issuing Stellar account address.

send_fee_fixed

Optional fixed (base) fee for sending this asset in units of this asset. This is in addition to any send_fee_percent. If null, fee_fixed will not be displayed in SEP31 /info response.

send_fee_percent

Optional percentage fee for sending this asset in percentage points. This is in addition to any send_fee_fixed. If null, fee_percent will not be displayed in SEP31 /info response.

send_max_amount

Optional maximum amount. No limit if not specified.

send_min_amount

Optional minimum amount. No limit if not specified.

sep24_enabled

True if this asset is transferable via SEP-24

sep31_enabled

True if this asset is transferable via SEP-31

sep38_enabled

True if this asset is exchangeable via SEP-38

sep6_enabled

True if this asset is transferable via SEP-6

significant_decimals

The number of decimal places Polaris should save when collecting input amounts

symbol

The symbol used in HTML pages when displaying amounts of this asset

withdrawal_enabled

True if withdrawal for this asset is supported.

withdrawal_fee_fixed

Optional fixed (base) fee for withdraw. In units of the withdrawn asset. This is in addition to any fee_percent.

withdrawal_fee_percent

Optional percentage fee for withdraw in percentage points. This is in addition to any fee_fixed.

withdrawal_max_amount

Optional maximum amount. No limit if not specified.

withdrawal_min_amount

Optional minimum amount. No limit if not specified.

class polaris.models.Transaction[source]

Transaction(id, paging_token, stellar_account, muxed_account, account_memo, asset, quote, kind, status, status_eta, status_message, stellar_transaction_id, external_transaction_id, amount_in, amount_expected, amount_out, amount_fee, fee_asset, started_at, completed_at, from_address, to_address, required_info_updates, required_info_message, memo, memo_type, receiving_anchor_account, refunded, protocol, pending_signatures, envelope_xdr, channel_seed, claimable_balance_supported, claimable_balance_id, more_info_url, on_change_callback, pending_execution_attempt, client_domain)

KIND = <class 'model_utils.choices.Choices'>

Choices object for the kind of transaction

MEMO_TYPES = <class 'model_utils.choices.Choices'>

Type for the memo. Can be either hash, id, or text

PROTOCOL = <class 'model_utils.choices.Choices'>

Values for protocol column

account_memo

The ID (64-bit integer) memo identifying the user of the shared Stellar account authenticated via SEP-10 that initiated this transaction. If this column value is not null, Transaction.muxed_account will be null.

amount_expected

Amount the client specified would be sent to the anchor at the start of a transaction. Note that Transaction.amount_in can differ from this field after funds have been received. Until then, the fields will match. This field makes it possible to check if the amount sent to the anchor matches the amount the client initially specified in an API request or form.

amount_fee

Amount of fee charged by anchor.

amount_in

Amount received by anchor at start of transaction as a string with up to 7 decimals. Excludes any fees charged before the anchor received the funds.

amount_out

Amount sent by anchor to user at end of transaction as a string with up to 7 decimals. Excludes amount converted to XLM to fund account and any external fees.

asset

The Django foreign key to the associated Asset

channel_seed

A keypair of the account used when sending SEP-6 or SEP-24 deposit transactions to Transaction.to_address, if present. This is only used for transactions requiring signatures Polaris cannot add itself.

claimable_balance_id

The ID of the claimable balance used to send funds to the user. This column will be None if claimable_balance_supported is False or if the transaction has not yet been submitted to the Stellar network.

claimable_balance_supported

claimable_balance_supported is a boolean to indicate if the wallet supports the SEP24 requirements for handeling claimable balance deposits.

client_domain

The hostname of the client application that requested this transaction on behalf of the user. The SIGNING_KEY on https://client_domain/.well-known/stellar.toml signed the challenge transaction used to obtain the authentication token necessary to request this transaction, effectively allowing requests including the authentication token to be attributed to it.

completed_at

Completion date and time of transaction. Assigned null for in-progress transactions.

envelope_xdr

The base64-encoded XDR blob that can be deserialized to inspect and sign the encoded transaction.

external_transaction_id

(optional) ID of transaction on external network that either started the deposit or completed the withdrawal.

fee_asset

The string representing the asset in which the fee is charged. The string must be formatted using SEP-38’s Asset Identification Format, and is only necessary for transactions using different on and off-chain assets.

from_address

Sent from address, perhaps BTC, IBAN, or bank account.

id

Unique, anchor-generated id for the deposit/withdrawal.

kind

The character field for the available KIND choices.

memo

(optional) Value of memo to attach to transaction, for hash this should be base64-encoded.

memo_type

(optional) Type of memo that anchor should attach to the Stellar payment transaction, one of text, id or hash.

property message

Human readable explanation of transaction status

more_info_url

A URL that is opened by wallets after the interactive flow is complete. It can include banking information for users to start deposits, the status of the transaction, or any other information the user might need to know about the transaction.

muxed_account

The muxed (M…) account authenticated via SEP-10 that initiated this transaction. If this column value is not null, Transaction.stellar_account is derived from this value and Transaction.account_memo will be null.

on_change_callback

A URL that the anchor should POST a JSON message to when the status property of the transaction created as a result of this request changes.

paging_token

The token to be used as a cursor for querying before or after this transaction

pending_execution_attempt

An internal column used to ensure transactions are not retrieved from the database and executed by different processes running the same command, specifically process_pending_deposits and execute_outgoing_transactions.

pending_signatures

Boolean for whether or not non-Polaris signatures are needed for this transaction’s envelope.

protocol

Either ‘sep6’, ‘sep24’, or ‘sep31’

receiving_anchor_account

Stellar account to send payment or withdrawal funds to

refunded

True if the transaction was refunded, false otherwise.

required_info_message

(SEP31) (optional) A human readable message indicating any errors that require updated information from the sender

required_info_updates

(SEP31) (optional) A set of fields that require an update from the sender, in the same format as described in /info.

started_at

Start date and time of transaction.

status

Choices field for processing status of deposit, withdrawal, & send.

SEP-6 & SEP-24 Statuses:

  • completed

    deposit/withdrawal fully completed

  • pending_external

    deposit/withdrawal has been submitted to external network, but is not yet confirmed. This is the status when waiting on Bitcoin or other external crypto network to complete a transaction, or when waiting on a bank transfer.

  • pending_anchor

    deposit/withdrawal is being processed internally by anchor.

  • pending_stellar

    deposit/withdrawal operation has been submitted to Stellar network, but is not yet confirmed.

  • pending_trust

    the user must add a trust-line for the asset for the deposit to complete.

  • pending_user

    the user must take additional action before the deposit / withdrawal can complete.

  • pending_user_transfer_start

    the user has not yet initiated their transfer to the anchor. This is the necessary first step in any deposit or withdrawal flow.

  • incomplete

    there is not yet enough information for this transaction to be initiated. Perhaps the user has not yet entered necessary info in an interactive flow.

  • no_market

    could not complete deposit because no satisfactory asset/XLM market was available to create the account.

  • too_small

    deposit/withdrawal size less than min_amount.

  • too_large

    deposit/withdrawal size exceeded max_amount.

  • error

    catch-all for any error not enumerated above.

SEP-31 Statuses:

  • pending_sender

    awaiting payment to be initiated by sending anchor.

  • pending_stellar

    transaction has been submitted to Stellar network, but is not yet confirmed.

  • pending_transaction_info_update

    transaction details must be updated to successfully execute transaction off-chain

  • pending_customer_info_update

    customer (SEP-12) information must be updated to facilitate transactions

  • pending_receiver

    payment is being processed by the receiving anchor.

  • pending_external

    payment has been submitted to external network, but is not yet confirmed.

  • completed

    deposit/withdrawal fully completed.

  • error

    catch-all for any error not enumerated above.

status_eta

(optional) Estimated number of seconds until a status change is expected.

status_message

A message stored in association to the current status for debugging

stellar_account

The Stellar (G…) account authenticated via SEP-10 that initiated this transaction. Note that if Transaction.muxed_account is not null, this column’s value is derived from the muxed account.

stellar_transaction_id

transaction_id on Stellar network of the transfer that either completed the deposit or started the withdrawal.

to_address

Sent to address (perhaps BTC, IBAN, or bank account in the case of a withdrawal or send, Stellar or muxed address in the case of a deposit).

class polaris.models.Quote[source]

Quote(id, stellar_account, account_memo, muxed_account, type, sell_asset, buy_asset, sell_amount, buy_amount, price, expires_at, sell_delivery_method, buy_delivery_method, country_code, requested_expire_after)

TYPE = <class 'model_utils.choices.Choices'>

Choices for type.

account_memo

The ID (64-bit integer) memo identifying the user of the shared Stellar account authenticated via SEP-10 when this Quote was created. If this column value is not null, Quote.muxed_account will be null.

buy_amount

The amount of buy_asset the client would like to purchase with sell_asset.

buy_asset

The asset the client would like to receive for some amount of sell_asset.

buy_delivery_method

One of the name values specified by the buy_delivery_methods array.

country_code

The ISO 3166-1 alpha-3 code of the user’s current address.

expires_at

The expiration time of the quote. Null if type is Quote.TYPE.indicative.

id

The unique ID for the quote.

muxed_account

The muxed (M…) account authenticated via SEP-10 when this Quote was created. If this column value is not null, Quote.stellar_account is derived from this value and Quote.account_memo will be null.

price

The price offered by the anchor for one unit of buy_asset in terms of sell_asset.

requested_expire_after

The requested expiration date from the client.

sell_amount

The amount of sell_asset the client would exchange for buy_asset.

sell_asset

The asset the client would like to sell. Ex. USDC:G…, iso4217:ARS

sell_delivery_method

One of the name values specified by the sell_delivery_methods array.

stellar_account

The Stellar (G…) account authenticated via SEP-10 when this Quote was created. Note that if Quote.muxed_account is not null, this column’s value is derived from the muxed account.

type

The type of quote. Firm quotes have a non-null price and expiration, indicative quotes may have a null price and expiration.

class polaris.models.ExchangePair[source]

ExchangePair(id, buy_asset, sell_asset)

buy_asset

The asset the client can purchase with sell_asset using SEP-38’s Asset Identification Format.

sell_asset

The asset the client can provide in exchange for buy_asset using SEP-38’s Asset Identification Format.

class polaris.models.OffChainAsset[source]

OffChainAsset(id, scheme, identifier, significant_decimals, country_codes, symbol)

country_codes

A comma-separated list of ISO 3166-1 alpha-3 codes of the countries where the anchor supports delivery of this asset.

delivery_methods

The list of delivery methods support for collecting and receiving this asset

identifier

The identifier of the off-chain asset as defined by SEP-38’s Asset Identification Format.

scheme

The scheme of the off-chain asset as defined by SEP-38’s Asset Identification Format.

significant_decimals

The number of decimal places Polaris should preserve when collecting & calculating amounts.

symbol

The symbol to use when displaying amounts of this asset

class polaris.models.DeliveryMethod[source]

DeliveryMethod(id, type, name, description)

TYPE = <class 'model_utils.choices.Choices'>

The types of delivery methods.

description

The human-readable description of the deliver method, to be used in SEP-38 response bodies.

name

The name of the delivery method, to be used in SEP-38 request and response bodies.

type

The type of delivery method. Sell methods describe how a client can deliver funds to the anchor. Buy methods describe how a client can receive or collect funds from the anchor.