bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 33쪽 중 6쪽
document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions/by_version/{txn_version}","method":"get"}]} webhooks={[]} hasHead={false} />
# Get transactions
URL: /api/node/get_transactions
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Retrieve on-chain committed transactions. The page size and start ledger version
can be provided to get a specific sequence of transactions.
If the version has been pruned, then a 410 will be returned.
To retrieve a pending transaction, use /transactions/by\_hash.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions","method":"get"}]} webhooks={[]} hasHead={false} />
# Check basic node health
URL: /api/node/healthy
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
By default this endpoint just checks that it can get the latest ledger
info and then returns 200.
If the duration\_secs param is provided, this endpoint will return a
200 if the following condition is true:
`server_latest_ledger_info_timestamp >= server_current_time_timestamp - duration_secs`
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/-/healthy","method":"get"}]} webhooks={[]} hasHead={false} />
# Simulate transaction
URL: /api/node/simulate_transaction
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
The output of the transaction will have the exact transaction outputs and events that running
an actual signed transaction would have. However, it will not have the associated state
hashes, as they are not updated in storage. This can be used to estimate the maximum gas
units for a submitted transaction.
To use this, you must:
* Create a SignedTransaction with a zero-padded signature.
* Submit a SubmitTransactionRequest containing a UserTransactionRequest containing that signature.
To use this endpoint with BCS, you must submit a SignedTransaction
encoded as BCS. See SignedTransaction in types/src/transaction/mod.rs.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions/simulate","method":"post"}]} webhooks={[]} hasHead={false} />
# Show OpenAPI explorer
URL: /api/node/spec
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Provides a UI that you can use to explore the API. You can also
retrieve the API directly at `/spec.yaml` and `/spec.json`.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/spec","method":"get"}]} webhooks={[]} hasHead={false} />
# Submit batch transactions
URL: /api/node/submit_batch_transactions
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
This allows you to submit multiple transactions. The response has three outcomes:
1. All transactions succeed, and it will return a 202
2. Some transactions succeed, and it will return the failed transactions and a 206
3. No transactions succeed, and it will also return the failed transactions and a 206
To submit a transaction as JSON, you must submit a SubmitTransactionRequest.
To build this request, do the following:
1. Encode the transaction as BCS. If you are using a language that has
native BCS support, make sure to use that library. If not, you may take
advantage of /transactions/encode\_submission. When using this
endpoint, make sure you trust the node you're talking to, as it is
possible they could manipulate your request.
2. Sign the encoded transaction and use it to create a TransactionSignature.
3. Submit the request. Make sure to use the "application/json" Content-Type.
To submit a transaction as BCS, you must submit a SignedTransaction
encoded as BCS. See SignedTransaction in types/src/transaction/mod.rs.
Make sure to use the `application/x.aptos.signed_transaction+bcs` Content-Type.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions/batch","method":"post"}]} webhooks={[]} hasHead={false} />
# Submit transaction
URL: /api/node/submit_transaction
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
This endpoint accepts transaction submissions in two formats.
To submit a transaction as JSON, you must submit a SubmitTransactionRequest.
To build this request, do the following:
1. Encode the transaction as BCS. If you are using a language that has
native BCS support, make sure of that library. If not, you may take
advantage of /transactions/encode\_submission. When using this
endpoint, make sure you trust the node you're talking to, as it is
possible they could manipulate your request.
2. Sign the encoded transaction and use it to create a TransactionSignature.
3. Submit the request. Make sure to use the "application/json" Content-Type.
To submit a transaction as BCS, you must submit a SignedTransaction
encoded as BCS. See SignedTransaction in types/src/transaction/mod.rs.
Make sure to use the `application/x.aptos.signed_transaction+bcs` Content-Type.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions","method":"post"}]} webhooks={[]} hasHead={false} />
# Execute view function of a module
URL: /api/node/view
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Execute the Move function with the given parameters and return its execution result.
The Aptos nodes prune account state history, via a configurable time window.
If the requested ledger version has been pruned, the server responds with a 410.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/view","method":"post"}]} webhooks={[]} hasHead={false} />
# Wait for transaction by hash
URL: /api/node/wait_transaction_by_hash
{/* This file was generated by Fumadocs. Do not edit this file directly. Any changes should be made by running the generation command again. */}
Same as /transactions/by\_hash, but will wait for a pending transaction to be committed. To be used as a long
poll optimization by clients, to reduce latency caused by polling. The "long" poll is generally a second or
less but dictated by the server; the client must deal with the result as if the request was a normal
/transactions/by\_hash request, e.g., by retrying if the transaction is pending.
<APIPage document={"https://docs.movementnetwork.xyz/spec.yaml"} operations={[{"path":"/transactions/wait_by_hash/{txn_hash}","method":"get"}]} webhooks={[]} hasHead={false} />
# NEAR Intents SDK
URL: /devs/interactonchain/near-intents-sdk
# NEAR Intents SDK
The [`@moveindustries/near-intents-sdk`](https://github.com/MoveIndustries/near-intents-sdk) is a thin TypeScript SDK for moving **USDC or USDT** from a supported origin chain onto **Movement** — landing as **USDCx** or **MOVE** — over [NEAR Intents](https://docs.near-intents.org). It wraps the official [1Click API](https://docs.near-intents.org/near-intents/integration/distribution-channels/1click-api) and pins the destination to Movement, so a transfer can't accidentally land on the wrong chain.
It orchestrates the transfer — get a quote, build the deposit, track status — and **never signs, broadcasts, or holds keys**. Your own wallet signs the one on-chain step.
<Callout>
Just want to move funds yourself without writing code? Use the [NEAR Intents app](https://near.com) instead — see [NEAR Intents](/general/usingmovement/near-intents) for the no-code onboarding flow.
</Callout>
**The flow in four steps:**
1. **Quote** a route (origin chain + asset → Movement asset) and receive a one-time deposit address.
2. **Build** the unsigned deposit transaction with `prepareDepositTx` — a plain token transfer to that address.
3. **Sign & broadcast** it with your own wallet.
4. **Track** execution status until it reaches a terminal state.
<Callout type="info">
The destination is always Movement. You choose the origin (Ethereum, Polygon, or Tron), the origin asset (USDC or USDT), and whether you receive USDCx or MOVE on Movement.
</Callout>
## Installation
```bash tab="npm"
npm install @moveindustries/near-intents-sdk
```
```bash tab="pnpm"
pnpm add @moveindustries/near-intents-sdk
```
```bash tab="yarn"
yarn add @moveindustries/near-intents-sdk
```
```bash tab="bun"
bun add @moveindustries/near-intents-sdk
```
## Quick start
The full end-to-end transfer of **1 USDC on Ethereum → USDCx on Movement**. It runs without any credentials.
```ts
import {
configure,
quoteDeposit,
prepareDepositTx,
submitDeposit,
getStatus,
isTerminal,
} from "@moveindustries/near-intents-sdk";
// configure() is optional — omit it entirely to run token-free (see Authentication).
configure({ jwt: process.env.ONE_CLICK_JWT });
// 1. Quote the route. Amounts are in the origin asset's smallest units.
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 (6 decimals)
recipient: "0xYourMovementAddress",
refundTo: "0xYourEthereumAddress",
minAmountOut: "995000", // required floor, destination asset's smallest units; "0" opts out
});
const { depositAddress, amountOut, deadline } = res.quote;
console.log(`Send to ${depositAddress}, you'll receive ~${amountOut} before ${deadline}`);
// 2. Build the unsigned deposit transfer. Your wallet signs and broadcasts it.
const depositTx = prepareDepositTx("ethereum", "usdc", res);
// ...sign & broadcast `depositTx` with your wallet (see per-chain examples below)...
const txHash = "0xYourDepositTxHash";
// 3. (Optional) Hand 1Click the tx hash to speed up deposit detection.
await submitDeposit(depositAddress!, txHash);
// 4. Poll status until it settles.
let status = (await getStatus(depositAddress!)).status;
while (!isTerminal(status)) {
await new Promise((r) => setTimeout(r, 5000));
status = (await getStatus(depositAddress!)).status;
}
console.log("Final:", status); // "SUCCESS" | "REFUNDED" | "FAILED"
```
<Callout type="warn">
Amounts are strings in the origin asset's **smallest units**, not decimals. USDC and USDT use 6 decimals, so `"1000000"` = 1.0 USDC and `"20000"` = 0.02 USDC.
</Callout>
## Authentication
**A 1Click JWT is optional — the full transfer works without one.** Quoting, deposit-address binding, and status tracking all succeed unauthenticated.
Pass a JWT for two reasons:
* **Waive the protocol fee.** Without a token, NEAR auto-injects its `appFees` and takes a small cut of the swap.
* **Attributed rate limits** instead of anonymous, IP-based ones.
Obtain one at the [NEAR Intents Partners Portal](https://partners.near-intents.org) and pass it to `configure`:
```ts
configure({ jwt: process.env.ONE_CLICK_JWT });
```
The token is yours to manage. The SDK attaches the JWT you provide to its requests; it does not create or renew them. Obtain a token from the Partners Portal and replace it before it expires.
## Using it in the browser
The SDK works in the browser without additional setup: with no JWT it calls 1Click directly, and every step except the fee waiver functions normally. A proxy is required only when combining JWT benefits (fee waiver, attributed rate limits) with client-side use, since a JWT is a secret and must **never** be exposed to the client.
To use a JWT from the browser, place a server-side proxy in front of 1Click to inject the token, and point the SDK at it with `baseUrl` (omit `jwt`; the proxy holds it):
```ts
// Client code — no secret here. Requests go to your proxy, which adds the JWT.
configure({ baseUrl: "/api/1click" });
```
The proxy forwards the four paths the SDK uses (`v0/tokens`, `v0/quote`, `v0/status`, `v0/deposit/submit`) and adds the `Authorization` header server-side. A minimal Next.js Route Handler:
<details>
<summary>Example proxy — Next.js Route Handler</summary>
```ts
// app/api/1click/[...path]/route.ts
import { NextRequest, NextResponse } from "next/server";
const BASE = process.env.ONECLICK_BASE_URL ?? "https://1click.chaindefuser.com";
const JWT = process.env.ONECLICK_JWT; // server-side only — never NEXT_PUBLIC_
// Only the paths the SDK uses may be proxied.
const ALLOWED = new Set(["v0/tokens", "v0/quote", "v0/status", "v0/deposit/submit"]);
async function forward(method: "GET" | "POST", req: NextRequest, path: string[]) {
const joined = path.join("/");
if (!ALLOWED.has(joined)) {
return NextResponse.json({ error: "Path not allowed" }, { status: 400 });
}
const url = new URL(`${BASE}/${joined}`);
req.nextUrl.searchParams.forEach((v, k) => url.searchParams.set(k, v));
const res = await fetch(url.toString(), {
method,
headers: {
...(JWT ? { Authorization: `Bearer ${JWT}` } : {}),
...(method === "POST" ? { "Content-Type": "application/json" } : {}),
},
body: method === "POST" ? await req.text() : undefined,
});
const data = await res.json().catch(() => ({}));
return NextResponse.json(data, { status: res.status });
}
export async function GET(req: NextRequest, { params }: { params: Promise<{ path: string[] }> }) {
return forward("GET", req, (await params).path);
}
export async function POST(req: NextRequest, { params }: { params: Promise<{ path: string[] }> }) {
return forward("POST", req, (await params).path);
}
```
</details>
<Callout type="info">
Server-side scripts and backends require no proxy — with no `baseUrl`, the SDK calls 1Click directly and the JWT stays private.
</Callout>
## The deposit transaction
`prepareDepositTx(originChain, originAsset, quote)` returns an **unsigned** transfer of the quote's `amountIn` to its `depositAddress`. The shape depends on the origin chain family:
```ts
// EVM (Ethereum, Polygon)
{ family: "evm", to: string, value: "0x0", data: string }
// Tron
{ family: "tron", contractAddress: string, function: "transfer(address,uint256)", parameter: [depositAddress, amountIn] }
```
The SDK already knows each chain's USDC/USDT contract, so you don't pass a token address — everything needed to sign is in the returned object. The per-chain examples below show how to hand it to a wallet.
<Callout type="warn">
The origin wallet needs the chain's **native gas token** to send the deposit (ETH on Ethereum, POL on Polygon, TRX on Tron) — the SDK moves the stablecoin, not gas.
</Callout>
## Complete examples
Each example runs the full flow for one route. They share the `waitForSettlement` helper:
```ts
import { getStatus, isTerminal } from "@moveindustries/near-intents-sdk";
async function waitForSettlement(depositAddress: string) {
for (;;) {
const { status } = await getStatus(depositAddress);
if (isTerminal(status)) return status; // SUCCESS | REFUNDED | FAILED
await new Promise((r) => setTimeout(r, 5000));
}
}
```
### EVM (Ethereum or Polygon, viem)
One flow covers both EVM origins — only `originChain` and the viem `chain` differ. Shown server-side with a private key (JWT stays server-side, no proxy needed); the inline notes mark what changes in the browser and when the destination is MOVE. The EVM deposit is a raw transaction built entirely from `prepareDepositTx`.
```ts
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { mainnet } from "viem/chains"; // Polygon: import { polygon }
import { configure, quoteDeposit, prepareDepositTx, submitDeposit } from "@moveindustries/near-intents-sdk";
// Server-side, JWT stays private:
configure({ jwt: process.env.ONE_CLICK_JWT }); // optional
// In the browser instead: configure({ baseUrl: "/api/1click" }) — the proxy holds the JWT.
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const wallet = createWalletClient({ account, chain: mainnet, transport: http() });
const res = await quoteDeposit({
originChain: "ethereum", // or "polygon"
originAsset: "usdc",
destinationAsset: "usdcx", // for "move", also raise slippageTolerance below
amount: "1000000", // 1.0 USDC
recipient: "0xYourMovementAddress",
refundTo: account.address,
minAmountOut: "995000", // required floor, destination asset's smallest units; "0" opts out
// slippageTolerance: 300, // MOVE only: 3% — MOVE is volatile; the 1% default often refunds
});
const { depositAddress } = res.quote;
// prepareDepositTx returns { family: "evm", to, value: "0x0", data } — send it as-is.
const tx = prepareDepositTx("ethereum", "usdc", res); // match originChain above
const txHash = await wallet.sendTransaction({
account,
chain: mainnet,
to: tx.to as `0x${string}`,
value: 0n,
data: tx.data as `0x${string}`,
});
await submitDeposit(depositAddress!, txHash); // optional speed-up
console.log("Settled:", await waitForSettlement(depositAddress!));
```
### Tron → USDCx (injected TronLink)
Tron is USDT-only. The deposit is a TRC-20 transfer through the injected `window.tronWeb` provider (TronLink):
```ts
import { configure, quoteDeposit, prepareDepositTx, submitDeposit } from "@moveindustries/near-intents-sdk";
configure({ baseUrl: "/api/1click" });
async function bridgeTronToUsdcx(recipient: string, refundTo: string) {
const tronWeb = (window as any).tronWeb;
if (!tronWeb?.defaultAddress?.base58) throw new Error("Connect TronLink");
const res = await quoteDeposit({
originChain: "tron",
originAsset: "usdt",
destinationAsset: "usdcx",
amount: "1000000", // 1.0 USDT
recipient,
refundTo, // your Tron address, for refunds
minAmountOut: "995000", // required floor, destination asset's smallest units; "0" opts out
});
const { depositAddress } = res.quote;
// prepareDepositTx returns { family: "tron", contractAddress, function, parameter: [to, amount] }
const tx = prepareDepositTx("tron", "usdt", res);
const contract = await tronWeb.contract().at(tx.contractAddress);
const txId: string = await contract.transfer(tx.parameter[0], tx.parameter[1]).send();
await submitDeposit(depositAddress!, txId);
return waitForSettlement(depositAddress!);
}
```
### Tron → USDCx (TronWallet Adapter)
To avoid using `window.tronWeb` directly, use the [TronWallet Adapter](https://github.com/tronprotocol/tronwallet-adapter) React hooks. You build the transaction with a standalone `TronWeb` instance, sign it with the adapter's `signTransaction`, then broadcast. This maps cleanly onto `prepareDepositTx`'s Tron output.
```ts
import { TronWeb } from "tronweb";
import { useWallet } from "@tronweb3/tronwallet-adapter-react-hooks";
import { configure, quoteDeposit, prepareDepositTx, submitDeposit } from "@moveindustries/near-intents-sdk";
configure({ baseUrl: "/api/1click" });
// A read-only client just for building + broadcasting; the adapter does the signing.
const tronWeb = new TronWeb({ fullHost: "https://api.trongrid.io" });
function BridgeButton({ recipient }: { recipient: string }) {
const { address, signTransaction, connected } = useWallet();
async function bridge() {
if (!connected || !address) throw new Error("Connect a Tron wallet");
const res = await quoteDeposit({
originChain: "tron",
originAsset: "usdt",
destinationAsset: "usdcx",
amount: "1000000", // 1.0 USDT
recipient,
refundTo: address,
minAmountOut: "995000", // required floor, destination asset's smallest units; "0" opts out
});
const { depositAddress } = res.quote;
const tx = prepareDepositTx("tron", "usdt", res);
// Build the TRC-20 transfer from prepareDepositTx's contract + params.
const { transaction } = await tronWeb.transacti프로젝트로 돌아가기