@moveindustries/near-intents-sdk 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ configure({ jwt: process.env.ONE_CLICK_JWT }); // jwt optional; omit configure()
19
19
 
20
20
  // 1. Quote: USDC on Ethereum -> USDCx on Movement. Destination is pinned to Movement.
21
21
  const res = await quoteDeposit({
22
- originChain: "ethereum", // "ethereum" | "polygon" | "tron"
22
+ originChain: "ethereum", // "ethereum" | "polygon" | "tron" | "near"
23
23
  originAsset: "usdc", // "usdc" | "usdt" (tron is usdt-only)
24
24
  destinationAsset: "usdcx", // "usdcx" | "move"
25
25
  amount: "1000000", // 1.0 USDC, in the origin asset's smallest units
@@ -33,9 +33,11 @@ const { depositAddress, amountOut, deadline } = res.quote;
33
33
  // 2. (Optional) Build the unsigned deposit transfer; your wallet signs + broadcasts it.
34
34
  const depositTx = prepareDepositTx("ethereum", "usdc", res);
35
35
  // EVM: { family: "evm", to, value, data } Tron: { family: "tron", contractAddress, function, parameter }
36
+ // NEAR: { family: "near", receiverId, methodName: "ft_transfer", args, gas, deposit }
36
37
 
37
38
  // 3. (Optional) After broadcasting, hand 1Click the tx hash to speed up deposit detection.
38
39
  await submitDeposit(depositAddress!, "0xYourDepositTxHash");
40
+ // For a NEAR origin, also pass the signing account: submitDeposit(depositAddress!, txHash, { nearSenderAccount: "you.near" })
39
41
 
40
42
  // 4. Read execution status. Poll on your own cadence until isTerminal(status).
41
43
  const { status } = await getStatus(depositAddress!);
@@ -46,7 +48,7 @@ The SDK never signs, broadcasts, or holds keys — step 2 returns an *unsigned*
46
48
 
47
49
  ## Supported routes
48
50
 
49
- Backed by Movement's own solver: origins **Polygon, Ethereum, Tron** (USDC + USDT; Tron is USDT-only) → **USDCx** or **MOVE** on Movement.
51
+ Backed by Movement's own solver: origins **Polygon, Ethereum, Tron, NEAR** (USDC + USDT; Tron is USDT-only) → **USDCx** or **MOVE** on Movement.
50
52
 
51
53
  ## Install
52
54
 
package/dist/deposit.d.ts CHANGED
@@ -12,6 +12,18 @@ export type TronDepositTx = {
12
12
  function: "transfer(address,uint256)";
13
13
  parameter: [string, string];
14
14
  };
15
- export type DepositTx = EvmDepositTx | TronDepositTx;
15
+ /** Unsigned NEP-141 `ft_transfer` call. `deposit` is the mandatory 1-yoctoNEAR security deposit. */
16
+ export type NearDepositTx = {
17
+ family: "near";
18
+ receiverId: string;
19
+ methodName: "ft_transfer";
20
+ args: {
21
+ receiver_id: string;
22
+ amount: string;
23
+ };
24
+ gas: string;
25
+ deposit: "1";
26
+ };
27
+ export type DepositTx = EvmDepositTx | TronDepositTx | NearDepositTx;
16
28
  /** Unsigned transfer of the quote's `amountIn` to its `depositAddress`. The caller signs and broadcasts. */
17
29
  export declare function prepareDepositTx(origin: OriginKey, originAsset: StableKey, quote: QuoteResponse): DepositTx;
package/dist/deposit.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { resolveOrigin, family } from "./registry.js";
2
2
  const pad32 = (hex) => hex.replace(/^0x/, "").toLowerCase().padStart(64, "0");
3
+ /** 30 Tgas — generous for a plain `ft_transfer`, which calls no other contract. */
4
+ const NEAR_FT_TRANSFER_GAS = "30000000000000";
3
5
  /** Unsigned transfer of the quote's `amountIn` to its `depositAddress`. The caller signs and broadcasts. */
4
6
  export function prepareDepositTx(origin, originAsset, quote) {
5
7
  const { tokenAddress } = resolveOrigin(origin, originAsset);
@@ -8,8 +10,12 @@ export function prepareDepositTx(origin, originAsset, quote) {
8
10
  throw new Error("quote has no depositAddress (dry run?)");
9
11
  if (!tokenAddress)
10
12
  throw new Error(`no verified L1 token address for ${origin}/${originAsset} (see tasks.md precondition)`);
11
- if (family(origin) === "tron") {
13
+ const fam = family(origin);
14
+ if (fam === "tron") {
12
15
  return { family: "tron", contractAddress: tokenAddress, function: "transfer(address,uint256)", parameter: [depositAddress, amountIn] };
13
16
  }
17
+ if (fam === "near") {
18
+ return { family: "near", receiverId: tokenAddress, methodName: "ft_transfer", args: { receiver_id: depositAddress, amount: amountIn }, gas: NEAR_FT_TRANSFER_GAS, deposit: "1" };
19
+ }
14
20
  return { family: "evm", to: tokenAddress, value: "0x0", data: "0xa9059cbb" + pad32(depositAddress) + pad32(BigInt(amountIn).toString(16)) };
15
21
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { configure, quoteDeposit, type QuoteDepositParams } from "./quote.js";
2
- export { prepareDepositTx, type DepositTx, type EvmDepositTx, type TronDepositTx } from "./deposit.js";
2
+ export { prepareDepositTx, type DepositTx, type EvmDepositTx, type TronDepositTx, type NearDepositTx } from "./deposit.js";
3
3
  export { submitDeposit } from "./submit.js";
4
4
  export { getStatus, isTerminal } from "./status.js";
5
5
  export { listTokens, type SupportedToken } from "./tokens.js";
@@ -48,8 +48,20 @@ export declare const ORIGINS: {
48
48
  readonly tokenAddress: "41a614f803b6fd780986a42c78ec9c7f77e6ded13c";
49
49
  };
50
50
  };
51
+ readonly near: {
52
+ readonly usdc: {
53
+ readonly assetId: "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1";
54
+ readonly decimals: 6;
55
+ readonly tokenAddress: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1";
56
+ };
57
+ readonly usdt: {
58
+ readonly assetId: "nep141:usdt.tether-token.near";
59
+ readonly decimals: 6;
60
+ readonly tokenAddress: "usdt.tether-token.near";
61
+ };
62
+ };
51
63
  };
52
- export declare const family: (origin: OriginKey) => "evm" | "tron";
64
+ export declare const family: (origin: OriginKey) => "evm" | "tron" | "near";
53
65
  export declare function resolveOrigin(origin: string, originAsset: string): AssetEntry;
54
66
  export declare function resolveDest(destinationAsset: string): AssetEntry;
55
67
  export declare function normalizeRecipient(addr: string): string;
package/dist/registry.js CHANGED
@@ -2,11 +2,13 @@ export const MOVEMENT = {
2
2
  usdcx: { assetId: "nep141:movement-6f9a70ef4605e7d9174f1abf8d8d3c15012f48f3.omft.near", decimals: 6 },
3
3
  move: { assetId: "nep141:movement.omft.near", decimals: 8 },
4
4
  };
5
- // tokenAddress is the L1 token contract the deposit transfer targets. Provenance (the omft assetId hex
6
- // equals the L1 contract only on EVM — never derive a non-EVM contract from it):
5
+ // tokenAddress is the token contract the deposit transfer targets. Provenance (the omft assetId hex
6
+ // equals the token contract only on EVM — never derive a non-EVM contract from it):
7
7
  // ethereum USDC 0xa0b8…eb48 / USDT 0xdac1…1ec7 — canonical Ethereum contracts (also embedded in the assetId).
8
8
  // polygon USDC 0x3c49…3359 (native USDC, NOT USDC.e) / USDT 0xc213…8e8f — canonical Polygon contracts.
9
9
  // tron USDT 41a614f803… (TR7NHqje…) — canonical TRC-20 USDT; NOT the omft assetId hex (a bridge id).
10
+ // near USDC 17208628…6133a1 / USDT usdt.tether-token.near — canonical NEAR NEP-141 accounts; here the
11
+ // assetId's nep141: suffix already *is* the token contract (no bridge wrapping), unlike the others.
10
12
  export const ORIGINS = {
11
13
  ethereum: {
12
14
  usdc: { assetId: "nep141:eth-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.omft.near", decimals: 6, tokenAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" },
@@ -19,8 +21,12 @@ export const ORIGINS = {
19
21
  tron: {
20
22
  usdt: { assetId: "nep141:tron-d28a265909efecdcee7c5028585214ea0b96f015.omft.near", decimals: 6, tokenAddress: "41a614f803b6fd780986a42c78ec9c7f77e6ded13c" },
21
23
  },
24
+ near: {
25
+ usdc: { assetId: "nep141:17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1", decimals: 6, tokenAddress: "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1" },
26
+ usdt: { assetId: "nep141:usdt.tether-token.near", decimals: 6, tokenAddress: "usdt.tether-token.near" },
27
+ },
22
28
  };
23
- export const family = (origin) => (origin === "tron" ? "tron" : "evm");
29
+ export const family = (origin) => origin === "tron" ? "tron" : origin === "near" ? "near" : "evm";
24
30
  export function resolveOrigin(origin, originAsset) {
25
31
  const e = ORIGINS[origin]?.[originAsset];
26
32
  if (!e)
package/dist/submit.d.ts CHANGED
@@ -3,7 +3,11 @@ import { type SubmitDepositTxResponse } from "@defuse-protocol/one-click-sdk-typ
3
3
  * Hand 1Click the deposit tx hash so it can start processing without waiting to
4
4
  * detect the deposit on the origin chain. Optional speed-up — status tracking works
5
5
  * without it. Goes between broadcasting the deposit and reading status.
6
+ *
7
+ * `nearSenderAccount` is required by the 1Click API for NEAR-origin deposits (the
8
+ * account that signed the `ft_transfer`); ignored for other origins.
6
9
  */
7
10
  export declare function submitDeposit(depositAddress: string, txHash: string, opts?: {
8
11
  memo?: string;
12
+ nearSenderAccount?: string;
9
13
  }): Promise<SubmitDepositTxResponse>;
package/dist/submit.js CHANGED
@@ -3,7 +3,10 @@ import { OneClickService } from "@defuse-protocol/one-click-sdk-typescript";
3
3
  * Hand 1Click the deposit tx hash so it can start processing without waiting to
4
4
  * detect the deposit on the origin chain. Optional speed-up — status tracking works
5
5
  * without it. Goes between broadcasting the deposit and reading status.
6
+ *
7
+ * `nearSenderAccount` is required by the 1Click API for NEAR-origin deposits (the
8
+ * account that signed the `ft_transfer`); ignored for other origins.
6
9
  */
7
10
  export async function submitDeposit(depositAddress, txHash, opts = {}) {
8
- return OneClickService.submitDepositTx({ depositAddress, txHash, memo: opts.memo });
11
+ return OneClickService.submitDepositTx({ depositAddress, txHash, memo: opts.memo, nearSenderAccount: opts.nearSenderAccount });
9
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moveindustries/near-intents-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Thin SDK: USDT/USDC -> Movement USDCx/MOVE over NEAR Intents 1Click.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",