Skip to content

NEARIntentsAdapter

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / NEARIntentsAdapter

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1783

NEAR Intents Adapter

Provides privacy-preserving cross-chain swaps via NEAR 1Click API.

const adapter = new NEARIntentsAdapter({
jwtToken: process.env.NEAR_INTENTS_JWT,
})
// Or with custom asset mappings (e.g., testnet)
const testnetAdapter = new NEARIntentsAdapter({
jwtToken: process.env.NEAR_INTENTS_JWT,
assetMappings: {
'near:testUSDC': 'near:testnet:usdc.test',
},
})
// Prepare a swap with stealth recipient
const prepared = await adapter.prepareSwap(intent, recipientMetaAddress)
// Get quote
const quote = await adapter.getQuote(prepared)
// Execute (after depositing to depositAddress)
const result = await adapter.trackSwap(quote.depositAddress)

new NEARIntentsAdapter(config?): NEARIntentsAdapter

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1788

NEARIntentsAdapterConfig

NEARIntentsAdapter

getClient(): OneClickClient

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1792

Get the underlying OneClick client

OneClickClient


prepareSwap(request, recipientMetaAddress?, senderAddress?, transparentRecipient?): Promise<PreparedSwap>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1804

Prepare a swap request

For shielded/compliant modes, generates a stealth address for the recipient.

SwapRequest

Swap request parameters

Recipient’s stealth meta-address (for privacy modes)

string | StealthMetaAddress

string

Sender’s address for refunds

string

Explicit recipient address for transparent mode (defaults to senderAddress)

Promise<PreparedSwap>

Prepared swap with quote request


getQuote(prepared): Promise<OneClickQuoteResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1811

Get a quote for a prepared swap

PreparedSwap

Prepared swap from prepareSwap()

Promise<OneClickQuoteResponse>

Quote response with deposit address


getDryQuote(prepared): Promise<OneClickQuoteResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1818

Get a dry quote (preview without deposit address)

PreparedSwap

Prepared swap

Promise<OneClickQuoteResponse>

Quote preview


notifyDeposit(depositAddress, txHash, nearAccount?): Promise<void>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1826

Notify 1Click of deposit transaction

string

Deposit address from quote

string

Deposit transaction hash

string

NEAR account (if depositing from NEAR)

Promise<void>


getStatus(depositAddress): Promise<OneClickStatusResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1833

Get current swap status

string

Deposit address from quote

Promise<OneClickStatusResponse>

Current status


waitForCompletion(depositAddress, options?): Promise<OneClickStatusResponse>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1841

Wait for swap to complete

string

Deposit address from quote

Polling options

number

number

(status) => void

Promise<OneClickStatusResponse>

Final status


initiateSwap(request, recipientMetaAddress?, senderAddress?): Promise<SwapResult>

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1859

Execute a full swap flow

This is a convenience method that:

  1. Prepares the swap with stealth address
  2. Gets a quote
  3. Returns all info needed for the user to deposit

SwapRequest

Swap request parameters

Recipient’s stealth meta-address

string | StealthMetaAddress

string

Sender’s address for refunds

Promise<SwapResult>

Swap result with deposit instructions


mapAsset(chain, symbol): string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1863

Convert SIP asset to Defuse asset identifier

ChainId

string

string


mapChainType(chain): string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1868

Convert SIP chain ID to blockchain type

ChainId

string

Use getBlockchainType() instead. The 1Click API now uses ORIGIN_CHAIN/DESTINATION_CHAIN types.


getBlockchainType(chain): string

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1874

Get blockchain type for a chain (for address format validation)

ChainId

string