Lamport 언래핑

Lamport 언래핑이란?

*rsUnwrapLamports*는 네이티브(래핑된 SOL) token account에서 SOL을 꺼내 대상 계정으로 lamport 형태로 전송합니다. 전체 잔액을 언래핑하거나 특정 금액만 언래핑할 수 있으며, token account는 그대로 유지됩니다.

이는 래핑된 SOL 계정을 닫는 것보다 더 유연한 방법입니다. 부분 언래핑을 통해 일부 SOL을 인출하면서도 나중에 사용하기 위해 계정에 잔액을 유지할 수 있습니다.

소스 참조

항목설명소스
UnwrapLamports명령어(판별자 45).소스
process_unwrap_lamports프로세서 로직.소스

계정

계정설명
source쓰기 가능. 언래핑할 네이티브(래핑된 SOL) token account.
destination쓰기 가능. 언래핑된 lamport를 수신합니다.
authority계정 소유자 또는 위임자(또는 멀티시그 서명자).

소스는 반드시 네이티브 token account여야 합니다. 다른 token account는 *rsNonNativeNotSupported*를 반환합니다. 위임자는 위임된 금액 한도 내에서 언래핑할 수 있습니다.

Lamport 언래핑 방법

*tsamount*를 생략하면 전체 잔액을 언래핑하고, 값을 설정하면 특정 수량의 lamport를 언래핑합니다. 이 예제는 구성된 @solana/kit 클라이언트를 사용합니다 — 클라이언트 설정은 토큰 전송을 참조하세요.

Unwrap wrapped SOL (Kit)
import { getUnwrapLamportsInstruction } from "@solana-program/token";
// source: the native (wrapped SOL) token account to unwrap.
// destination: address that receives the unwrapped lamports.
// authority: a TransactionSigner (the account owner or a delegate).
// Unwrap a specific number of lamports.
const unwrapSome = getUnwrapLamportsInstruction({
source,
destination,
authority,
amount: 500_000_000n
});
// Or omit `amount` to unwrap the entire balance.
const unwrapAll = getUnwrapLamportsInstruction({
source,
destination,
authority
});
// Send whichever instruction you need.
await client.sendTransaction([unwrapSome]);

멀티시그 권한을 사용하는 경우, *tsmultiSigners*로 공동 서명자를 전달하세요.

Is this page helpful?

목차

페이지 편집