nara-sdk 1.0.81 → 1.0.82

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/bridge.ts +14 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nara-sdk",
3
- "version": "1.0.81",
3
+ "version": "1.0.82",
4
4
  "description": "SDK for the Nara chain (Solana-compatible)",
5
5
  "module": "index.ts",
6
6
  "main": "index.ts",
package/src/bridge.ts CHANGED
@@ -49,6 +49,8 @@ export interface BridgeTokenSide {
49
49
  export interface BridgeTokenConfig {
50
50
  symbol: string;
51
51
  decimals: number;
52
+ /** Minimum per-transfer amount in raw units (rejected if below) */
53
+ minAmount: bigint;
52
54
  solana: BridgeTokenSide;
53
55
  nara: BridgeTokenSide;
54
56
  }
@@ -128,6 +130,7 @@ export const BRIDGE_TOKENS: Record<string, BridgeTokenConfig> = {
128
130
  USDC: {
129
131
  symbol: "USDC",
130
132
  decimals: 6,
133
+ minAmount: 100_000n, // 0.1 USDC
131
134
  solana: {
132
135
  warpProgram: new PublicKey("4GcZJTa8s9vxtTz97Vj1RrwKMqPkT3DiiJkvUQDwsuZP"),
133
136
  mode: "collateral",
@@ -144,6 +147,7 @@ export const BRIDGE_TOKENS: Record<string, BridgeTokenConfig> = {
144
147
  USDT: {
145
148
  symbol: "USDT",
146
149
  decimals: 6,
150
+ minAmount: 100_000n, // 0.1 USDT
147
151
  solana: {
148
152
  warpProgram: new PublicKey("DCTt9H3pwwU89qC3Z4voYNThZypV68AwhYNzMNBxWXoy"),
149
153
  mode: "collateral",
@@ -160,6 +164,7 @@ export const BRIDGE_TOKENS: Record<string, BridgeTokenConfig> = {
160
164
  SOL: {
161
165
  symbol: "SOL",
162
166
  decimals: 9,
167
+ minAmount: 1_000_000n, // 0.001 SOL
163
168
  solana: {
164
169
  warpProgram: new PublicKey("46MmAWwKRAt9uvn7m44NXbVq2DCWBQE2r1TDw25nyXrt"),
165
170
  mode: "native",
@@ -523,6 +528,15 @@ export function makeBridgeIxs(params: BridgeTransferParams): BridgeIxsResult {
523
528
 
524
529
  if (amount <= 0n) throw new Error("amount must be > 0");
525
530
 
531
+ // Enforce per-token minimum transfer amount
532
+ const tokenCfg = getToken(token);
533
+ if (amount < tokenCfg.minAmount) {
534
+ const min = Number(tokenCfg.minAmount) / Math.pow(10, tokenCfg.decimals);
535
+ throw new Error(
536
+ `Bridge amount too small: minimum for ${token} is ${min} (raw ${tokenCfg.minAmount})`
537
+ );
538
+ }
539
+
526
540
  const split = skipFee
527
541
  ? { feeAmount: 0n, bridgeAmount: amount, feeBps: 0 }
528
542
  : calculateBridgeFee(amount, feeBps);