API Integration

Only needs to be done once

If computations are performed off-chain (ex. to calculate airdrop rewards), then teams can integrate with the Passport API.

The protocol backend will just need to pass along the user address and the Passport API will return the primitives requested or a composable LoyaltyScore V2.

The Passport web2 backend currently provides three API endpoints:

GET /scores/{terra_address}

This endpoint takes a terra address and returns the counts of some wallet behaviors and a composable loyalty score. Please see Example: Anchor Rewards Boost for how the composable score is calculated here.

# list of return scores 
address_age
num_transactions
voting_balance
staked_token_count
staked_token_percentage
claimed_token_count
claimed_token_percentage
total_token_count

GET /raw_primitives/{terra_address}

Currently this endpoint returns 11 raw primitive scores listed below:

# list of raw primitives 
claimed_token_counts
staked_token_counts
swapped_in_token_counts
swapped_out_token_counts
transfer_in_token_counts
transfer_out_token_counts
unstaked_token_counts
voting_token_counts
provide_liquidity_counts
transaction_counts
wallet_age

GET /raw_primitives_proof/{terra_address}

This endpoint returns a merkle tree proof of the returned primitives in addition to the raw primitive scores. Protocols need to request API key from Passport team to be able to query it. More of this endpoint can be found in Smart Contract Integration.

Endpoint query example

// Example requests in Python:
import requests

// scores
url = 'https://<passport_url>/scores/terra1l8wglwvuz5f8vywzzw8k5eq5qnqy853j0wxq80'
response = requests.get(url)

// raw_primitives
url = 'https://<passport_url>/raw_primitives/terra1l8wglwvuz5f8vywzzw8k5eq5qnqy853j0wxq80'
response = requests.get(url)

Last updated