getFeeForMessage RPC Method
Please note that this method is only available in solana-core v1.9 or newer. Please use getFees for solana-core v1.8
매개변수
메시지
문자열
필수
로딩 중...
객체
객체
로딩 중...
헌신
문자열
로딩 중...
확정됨
문자열
로딩 중...
확인됨
문자열
로딩 중...
처리됨
문자열
로딩 중...
maxSupportedTransactionVersion
숫자
로딩 중...
반품
결과
로딩 중...
문맥
로딩 중...
apiVersion
로딩 중...
슬롯
로딩 중...
값
로딩 중...
요청
1curlmainnet\2-X POST \3-H "Content-Type: application/json" \4-d '5{6"id":1,7"jsonrpc":"2.0",8"method":"getFeeForMessage",9"params":[10"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",11{12"commitment":"processed"13}14]15}16'
1curlmainnet\2-X POST \3-H "Content-Type: application/json" \4-d '5{6"id":1,7"jsonrpc":"2.0",8"method":"getFeeForMessage",9"params":[10"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",11{12"commitment":"processed"13}14]15}16'
1require "uri"2require "json"3require "net/http"45url = URI("mainnet")67https = Net::HTTP.new(url.호스트, url.포트)8https.use_ssl = true910요청 = 순::HTTP::POST.새(URL)11요청["Content-Type"] = "application/json"12요청.본문 = JSON.dump({13"id": 1,14"jsonrpc": "2.0",15"method": "getFeeForMessage",16"params": [17"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",18{19"commitment": "processed"20}21]22})2324답변 = https.요청(요청)25응답을 반환합니다.read_body26
1require "uri"2require "json"3require "net/http"45url = URI("mainnet")67https = Net::HTTP.new(url.호스트, url.포트)8https.use_ssl = true910요청 = 순::HTTP::POST.새(URL)11요청["Content-Type"] = "application/json"12요청.본문 = JSON.dump({13"id": 1,14"jsonrpc": "2.0",15"method": "getFeeForMessage",16"params": [17"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",18{19"commitment": "processed"20}21]22})2324답변 = https.요청(요청)25응답을 반환합니다.read_body26
1import { createSolanaRpc, GetFeeForMessageApi, Rpc, TransactionMessageBytesBase64 } from "@solana/kit";23async function getFeeForMessageExample() {45const rpc: Rpc<GetFeeForMessageApi> = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");67const message: TransactionMessageBytesBase64 = "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA" as TransactionMessageBytesBase64;8try {9const feeResult = await rpc.getFeeForMessage(message, { commitment: 'processed' }).send();10console.log("Fee for message:", feeResult);11} catch (error) {12console.error("Error:", error);13}14}1516getFeeForMessageExample();
1import { createSolanaRpc, GetFeeForMessageApi, Rpc, TransactionMessageBytesBase64 } from "@solana/kit";23async function getFeeForMessageExample() {45const rpc: Rpc<GetFeeForMessageApi> = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");67const message: TransactionMessageBytesBase64 = "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA" as TransactionMessageBytesBase64;8try {9const feeResult = await rpc.getFeeForMessage(message, { commitment: 'processed' }).send();10console.log("Fee for message:", feeResult);11} catch (error) {12console.error("Error:", error);13}14}1516getFeeForMessageExample();
1const web3 = require("solana.js");2(async () => {3const solana = new web3.연결("mainnet");4const YOUR_TRANSACTION = new Transaction();5const YOUR_MESSAGE = YOUR_TRANSACTION.compileMessage();6console.log(await solana.getFeeForMessage(YOUR_MESSAGE));7})();8
1const web3 = require("solana.js");2(async () => {3const solana = new web3.연결("mainnet");4const YOUR_TRANSACTION = new Transaction();5const YOUR_MESSAGE = YOUR_TRANSACTION.compileMessage();6console.log(await solana.getFeeForMessage(YOUR_MESSAGE));7})();8
1출처: solana.rpc.api import Client2from solana.keypair import Keypair3from solana.system_program import TransferParams, transfer4from solana.transaction import Transaction5sender, receiver = Keypair.from_seed(bytes(PublicKey(1))), Keypair.from_seed(bytes(PublicKey(2)))6txn = Transaction().add(transfer(TransferParams(from_pubkey=sender.public_key, to_pubkey=receiver.public_key, lamports=1000)))7solana= 클라이언트("mainnet")8print(solana_client.get_fee_for_message(txn.compile_message()))
1출처: solana.rpc.api import Client2from solana.keypair import Keypair3from solana.system_program import TransferParams, transfer4from solana.transaction import Transaction5sender, receiver = Keypair.from_seed(bytes(PublicKey(1))), Keypair.from_seed(bytes(PublicKey(2)))6txn = Transaction().add(transfer(TransferParams(from_pubkey=sender.public_key, to_pubkey=receiver.public_key, lamports=1000)))7solana= 클라이언트("mainnet")8print(solana_client.get_fee_for_message(txn.compile_message()))
1사용 reqwest::헤더;2사용 reqwest::클라이언트;3사용 std::error::오류;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut 헤더 = header::헤더맵::새();8헤더.삽입("Content-Type", "application/json".parse().unwrap());910let 클라이언트 client = Client::new();11let json_data = r#"12{13"id": 1,14"jsonrpc": "2.0",15"method": "getFeeForMessage",16"params": [17"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",18{19"commitment": "processed"20}21]22}23"#;24let 응답 응답 = client25.게시물("mainnet")26.헤더(헤더))27.본문(json_data)28.보내기()29.await?;3031let 본문 = 응답.text().await?;32println!("{}", body);3334알겠습니다(())35}36
1사용 reqwest::헤더;2사용 reqwest::클라이언트;3사용 std::error::오류;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut 헤더 = header::헤더맵::새();8헤더.삽입("Content-Type", "application/json".parse().unwrap());910let 클라이언트 client = Client::new();11let json_data = r#"12{13"id": 1,14"jsonrpc": "2.0",15"method": "getFeeForMessage",16"params": [17"AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA",18{19"commitment": "processed"20}21]22}23"#;24let 응답 응답 = client25.게시물("mainnet")26.헤더(헤더))27.본문(json_data)28.보내기()29.await?;3031let 본문 = 응답.text().await?;32println!("{}", body);3334알겠습니다(())35}36
답변
1{2"jsonrpc": "2.0",3"result": {4"context": {5"apiVersion": "2.1.21",6"slot": 3355018187},8"value": null9},10"id": 111}
1{2"jsonrpc": "2.0",3"result": {4"context": {5"apiVersion": "2.1.21",6"slot": 3355018187},8"value": null9},10"id": 111}