sui_jsonrpc/api/
write.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::net::SocketAddr;

use af_sui_types::Address as SuiAddress;
use jsonrpsee::proc_macros::rpc;

use crate::msgs::{
    DevInspectArgs,
    DevInspectResults,
    DryRunTransactionBlockResponse,
    ExecuteTransactionRequestType,
    SuiTransactionBlockResponse,
    SuiTransactionBlockResponseOptions,
};
use crate::serde::BigInt;

#[rpc(client, namespace = "sui")]
pub trait WriteApi {
    /// Execute the transaction. See [`ExecuteTransactionRequestType`] for details on how it's
    /// handled by the RPC.
    ///
    /// `request_type` defaults to
    /// [`WaitForEffectsCert`](ExecuteTransactionRequestType::WaitForEffectsCert).
    #[method(name = "executeTransactionBlock")]
    async fn execute_transaction_block(
        &self,
        tx_bytes: String,
        signatures: Vec<String>,
        options: Option<SuiTransactionBlockResponseOptions>,
        request_type: Option<ExecuteTransactionRequestType>,
    ) -> RpcResult<SuiTransactionBlockResponse>;

    #[method(name = "monitoredExecuteTransactionBlock")]
    async fn monitored_execute_transaction_block(
        &self,
        tx_bytes: String,
        signatures: Vec<String>,
        options: Option<SuiTransactionBlockResponseOptions>,
        request_type: Option<ExecuteTransactionRequestType>,
        client_addr: Option<SocketAddr>,
    ) -> RpcResult<SuiTransactionBlockResponse>;

    /// Runs the transaction in dev-inspect mode. Which allows for nearly any
    /// transaction (or Move call) with any arguments. Detailed results are
    /// provided, including both the transaction effects and any return values.
    #[method(name = "devInspectTransactionBlock")]
    async fn dev_inspect_transaction_block(
        &self,
        sender_address: SuiAddress,
        tx_bytes: String,
        gas_price: Option<BigInt<u64>>,
        epoch: Option<BigInt<u64>>,
        additional_args: Option<DevInspectArgs>,
    ) -> RpcResult<DevInspectResults>;

    /// Return transaction execution effects including the gas cost summary,
    /// while the effects are not committed to the chain.
    #[method(name = "dryRunTransactionBlock")]
    async fn dry_run_transaction_block(
        &self,
        tx_bytes: String,
    ) -> RpcResult<DryRunTransactionBlockResponse>;
}