ラムポートのアンラップとは何ですか?
UnwrapLamports は、ネイティブ(ラップされたSOL)token
accountからSOLをlamportとしてデスティネーションアカウントに移動します。残高全体または特定の量をアンラップでき、token
accountは開いたままになります。
これはラップされたSOLアカウントを閉じるよりも柔軟です:部分的なアンラップにより、後で使用するためにアカウントに資金を残しながら一部のSOLを引き出すことができます。
ソースリファレンス
アカウント
| アカウント | 説明 |
|---|---|
source | 書き込み可能。アンラップするネイティブ(ラップされたSOL)token account。 |
destination | 書き込み可能。アンラップされたlamportを受け取ります。 |
authority | アカウントのオーナーまたはデリゲート(またはマルチシグ署名者)。 |
ソースはネイティブtoken accountである必要があります。それ以外のtoken accountは
NonNativeNotSupported
を返します。デリゲートは委任された量までアンラップできます。
ラムポートをアンラップする方法
amount
を省略すると残高全体をアンラップし、設定すると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]);
マルチシグ認証の場合は、multiSigners を使用して共同署名者を渡します。
Is this page helpful?