NEARIntentsAdapter
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / NEARIntentsAdapter
Class: NEARIntentsAdapter
Section titled “Class: 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.
Example
Section titled “Example”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 recipientconst prepared = await adapter.prepareSwap(intent, recipientMetaAddress)
// Get quoteconst quote = await adapter.getQuote(prepared)
// Execute (after depositing to depositAddress)const result = await adapter.trackSwap(quote.depositAddress)Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new NEARIntentsAdapter(
config?):NEARIntentsAdapter
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1788
Parameters
Section titled “Parameters”config?
Section titled “config?”Returns
Section titled “Returns”NEARIntentsAdapter
Methods
Section titled “Methods”getClient()
Section titled “getClient()”getClient():
OneClickClient
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1792
Get the underlying OneClick client
Returns
Section titled “Returns”prepareSwap()
Section titled “prepareSwap()”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.
Parameters
Section titled “Parameters”request
Section titled “request”Swap request parameters
recipientMetaAddress?
Section titled “recipientMetaAddress?”Recipient’s stealth meta-address (for privacy modes)
string | StealthMetaAddress
senderAddress?
Section titled “senderAddress?”string
Sender’s address for refunds
transparentRecipient?
Section titled “transparentRecipient?”string
Explicit recipient address for transparent mode (defaults to senderAddress)
Returns
Section titled “Returns”Promise<PreparedSwap>
Prepared swap with quote request
getQuote()
Section titled “getQuote()”getQuote(
prepared):Promise<OneClickQuoteResponse>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1811
Get a quote for a prepared swap
Parameters
Section titled “Parameters”prepared
Section titled “prepared”Prepared swap from prepareSwap()
Returns
Section titled “Returns”Promise<OneClickQuoteResponse>
Quote response with deposit address
getDryQuote()
Section titled “getDryQuote()”getDryQuote(
prepared):Promise<OneClickQuoteResponse>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1818
Get a dry quote (preview without deposit address)
Parameters
Section titled “Parameters”prepared
Section titled “prepared”Prepared swap
Returns
Section titled “Returns”Promise<OneClickQuoteResponse>
Quote preview
notifyDeposit()
Section titled “notifyDeposit()”notifyDeposit(
depositAddress,txHash,nearAccount?):Promise<void>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1826
Notify 1Click of deposit transaction
Parameters
Section titled “Parameters”depositAddress
Section titled “depositAddress”string
Deposit address from quote
txHash
Section titled “txHash”string
Deposit transaction hash
nearAccount?
Section titled “nearAccount?”string
NEAR account (if depositing from NEAR)
Returns
Section titled “Returns”Promise<void>
getStatus()
Section titled “getStatus()”getStatus(
depositAddress):Promise<OneClickStatusResponse>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1833
Get current swap status
Parameters
Section titled “Parameters”depositAddress
Section titled “depositAddress”string
Deposit address from quote
Returns
Section titled “Returns”Promise<OneClickStatusResponse>
Current status
waitForCompletion()
Section titled “waitForCompletion()”waitForCompletion(
depositAddress,options?):Promise<OneClickStatusResponse>
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1841
Wait for swap to complete
Parameters
Section titled “Parameters”depositAddress
Section titled “depositAddress”string
Deposit address from quote
options?
Section titled “options?”Polling options
interval?
Section titled “interval?”number
timeout?
Section titled “timeout?”number
onStatus?
Section titled “onStatus?”(status) => void
Returns
Section titled “Returns”Promise<OneClickStatusResponse>
Final status
initiateSwap()
Section titled “initiateSwap()”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:
- Prepares the swap with stealth address
- Gets a quote
- Returns all info needed for the user to deposit
Parameters
Section titled “Parameters”request
Section titled “request”Swap request parameters
recipientMetaAddress?
Section titled “recipientMetaAddress?”Recipient’s stealth meta-address
string | StealthMetaAddress
senderAddress?
Section titled “senderAddress?”string
Sender’s address for refunds
Returns
Section titled “Returns”Promise<SwapResult>
Swap result with deposit instructions
mapAsset()
Section titled “mapAsset()”mapAsset(
chain,symbol):string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1863
Convert SIP asset to Defuse asset identifier
Parameters
Section titled “Parameters”symbol
Section titled “symbol”string
Returns
Section titled “Returns”string
mapChainType()
Section titled “mapChainType()”mapChainType(
chain):string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1868
Convert SIP chain ID to blockchain type
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string
Deprecated
Section titled “Deprecated”Use getBlockchainType() instead. The 1Click API now uses ORIGIN_CHAIN/DESTINATION_CHAIN types.
getBlockchainType()
Section titled “getBlockchainType()”getBlockchainType(
chain):string
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1874
Get blockchain type for a chain (for address format validation)
Parameters
Section titled “Parameters”Returns
Section titled “Returns”string