@moveindustries/near-intents-sdk
v0.0.2
Published
Thin SDK: USDT/USDC -> Movement USDCx/MOVE over NEAR Intents 1Click.
Downloads
295
Readme
near-intents-sdk
A thin TypeScript SDK for moving USDT or USDC from a supported origin chain onto Movement (as USDCx or MOVE) over NEAR Intents. It wraps the official 1Click API client and pins the destination to Movement so callers can't accidentally land elsewhere. It orchestrates the transfer — quote, deposit address, status — and never holds keys.
Authentication
A 1Click JWT is optional — the full transfer works without one. Binding quote → deposit address → status tracking all succeed unauthenticated. Verified on mainnet: a Polygon USDC → Movement USDCx transfer completed end-to-end with no token set.
Pass a JWT only to waive NEAR's protocol fee — without one, NEAR auto-injects its appFees and takes a small cut of the swap — and for attributed rate limits instead of anonymous IP-based ones. Obtain one at the Partners Portal and pass it to configure({ jwt }); the SDK does not mint or refresh tokens.
A JWT is a secret, so in a browser don't ship it to the client. Front 1Click with a server-side proxy that injects the token and point the SDK at it with configure({ baseUrl: "/api/oneclick" }) (omit jwt — the proxy holds it). Without baseUrl the SDK calls 1Click directly.
Usage
import { configure, quoteDeposit, prepareDepositTx, submitDeposit, getStatus, isTerminal } from "@moveindustries/near-intents-sdk";
configure({ jwt: process.env.ONE_CLICK_JWT }); // jwt optional; omit configure() entirely to run token-free
// 1. Quote: USDC on Ethereum -> USDCx on Movement. Destination is pinned to Movement.
const res = await quoteDeposit({
originChain: "ethereum", // "ethereum" | "polygon" | "tron"
originAsset: "usdc", // "usdc" | "usdt" (tron is usdt-only)
destinationAsset: "usdcx", // "usdcx" | "move"
amount: "1000000", // 1.0 USDC, in the origin asset's smallest units
recipient: "0xYourMovementAddress",
refundTo: "0xYourEthereumAddress",
minAmountOut: "995000", // required floor in the destination asset's smallest units; throws if the quote's guaranteed output is lower. Pass "0" to opt out.
// slippageTolerance: 100, // basis points, defaults to 100 (1%); raise it for `destinationAsset: "move"`
});
const { depositAddress, amountOut, deadline } = res.quote;
// 2. (Optional) Build the unsigned deposit transfer; your wallet signs + broadcasts it.
const depositTx = prepareDepositTx("ethereum", "usdc", res);
// EVM: { family: "evm", to, value, data } Tron: { family: "tron", contractAddress, function, parameter }
// 3. (Optional) After broadcasting, hand 1Click the tx hash to speed up deposit detection.
await submitDeposit(depositAddress!, "0xYourDepositTxHash");
// 4. Read execution status. Poll on your own cadence until isTerminal(status).
const { status } = await getStatus(depositAddress!);
// isTerminal(status) is true for "SUCCESS" | "REFUNDED" | "FAILED"The SDK never signs, broadcasts, or holds keys — step 2 returns an unsigned transaction for your wallet.
Supported routes
Backed by Movement's own solver: origins Polygon, Ethereum, Tron (USDC + USDT; Tron is USDT-only) → USDCx or MOVE on Movement.
Install
npm i @moveindustries/near-intents-sdkPublished manually by a maintainer: bump the version, update CHANGELOG.md, then npm publish (which builds via prepublishOnly). See CHANGELOG.md for changes.
Tests
npm test— unit only, offline, no secrets.npm run test:live:noauth— adds a live dry quote against the real API (no JWT).npm run test:live:auth— adds an authenticated quote; requiresONE_CLICK_JWTin.env(fails if unset).
