Near Chain and its assets
SwapKit provides comprehensive support for NEAR Chain, enabling seamless swaps for both native NEAR tokens and NEP-141 tokens.
Supported Token Types
SwapKit's NEAR integration supports two primary token types:
Native NEAR Token
The native NEAR protocol token used for transaction fees, staking, and governance. In SwapKit, this is represented as NEAR.NEAR
.
NEP-141 Tokens
NEAR's fungible token standard, equivalent to Ethereum's ERC-20. This includes:
Wrapped NEAR (wNEAR) for DeFi interactions
Bridged assets from other chains (ETH, wBTC, USDC, USDT)
Native NEAR ecosystem tokens (DeFi, meme tokens, and project tokens)
Tokens created through platforms like Meme Cooking
Fetching Available NEAR Assets
Using the Provider Endpoint
To retrieve the complete list of tradeable NEAR assets, use the /tokens
endpoint with a GET
request to https://api.swapkit.dev/tokens?provider=NEAR
You can see the /tokens
endpoint explained in detail here.
Each token in the response includes:
identifier: The SwapKit asset identifier (e.g.,
NEAR.NEAR
,NEAR.wNEAR-wrap.near
)address: The NEAR contract address (empty string for native NEAR)
decimals: Token precision
symbol/ticker: Token symbols
logoURI: Token logo for UI display
extensions: Additional metadata including the NEP-141 provider ID
Token Identification
NEAR tokens follow SwapKit's standard identifier format:
Native NEAR:
NEAR.NEAR
NEP-141 Tokens:
NEAR.[TICKER]-[CONTRACT_ADDRESS]
Example:
NEAR.wNEAR-wrap.near
Example:
NEAR.USDC-17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1
Executing Swaps
Understanding NEAR wallet addresses
NEAR supports two address formats:
Implicit accounts: 64-character hexadecimal addresses (like the example above)
Named accounts: Human-readable names (e.g.,
alice.near
)
Both formats are accepted in SwapKit's API.
Getting a Quote
Use the /quote
endpoint to retrieve swap rates and routing information like you would for any other token. It can be a cross-chain swap or a single-chain Near Chain swap.
Example request payload - NEAR to AVAX:
{
"sellAsset": "NEAR.NEAR",
"buyAsset": "AVAX.AVAX",
"sellAmount": "10",
"sourceAddress": "5c33c6218d47e00ef229f60da78d0897e1ee9665312550b8afd5f9c7bc6957d2",
"destinationAddress": "0x0a4c79cE84202b03e95B7a692E5D728d83C44c76",
"slippage": 3
}
Quote Response
The quote response will include all the data you find in any other SwapKit quote. When using the "includeTx": True
flag, the API also returns the necessary transaction payload that you can build the transaction with.
Executing the Swap
Swaps originating on Near Chain use the simplified deposit format that Near uses for any other chain. Tokens are transfered to an address without the need to include transaction data or to approve the tokens beforehand.
Best Practices
Address Validation
Verify addresses before submitting:
NEAR implicit addresses are 64 hexadecimal characters
Named accounts end in
.near
,.tg
or other registered TLDDestination addresses must be valid for the target chain
Token Decimals
NEAR uses 24 decimals for its native token, while NEP-141 tokens may use different decimal places. Always check the decimals
field from the provider endpoint and adjust amounts accordingly.
Amount Formatting
When specifying sellAmount
, use the base unit value:
For 10 NEAR: Use "10" (not "10000000000000000000000000")
SwapKit handles decimal conversion based on token metadata
Common Use Cases
Acquiring NEAR
Swap from any supported asset to NEAR for:
Paying transaction fees
Staking with validators
Participating in NEAR governance
Using NEAR dApps
Trading NEP-141 Tokens
Access NEAR's DeFi ecosystem by swapping for:
Wrapped assets (wNEAR, wBTC, ETH)
Stablecoins (USDC, USDT)
Ecosystem tokens (AURORA, Meta Pool, SWEAT)
Error Handling
Common errors:
Verify your NEAR address follows implicit (hex) or named account format
Ensure you have enough NEAR/NEP-141 tokens plus gas fees
Verify the token identifier matches the provider endpoint format
Additional Resources
NEAR Protocol Documentation: https://docs.near.org
NEP-141 Token Standard: https://nomicon.io/Standards/Tokens/FungibleToken
NEAR Wallets: https://wallet.near.org/
NEAR Explorer: https://nearblocks.io
For support or questions about NEAR integration don't hesitate to contact us directly.
Last updated