cactus-agent
Version:
cactus rpc/websocket client library
1,341 lines (1,134 loc) • 104 kB
text/typescript
import {WalletInfo} from "../../cactus/wallet/wallet_info";
import {Coin} from "../../cactus/types/blockchain_format/coin";
import {
bool,
bytes,
False,
int, None,
Optional,
str,
True,
uint16,
uint32,
uint64,
uint8
} from "../../cactus/types/_python_types_";
import {bytes32} from "../../cactus/types/blockchain_format/sized_bytes";
import {
TransactionRecord,
TransactionRecordConvenience,
TransactionRecordConvenienceWithMetadata
} from "../../cactus/wallet/transaction_record";
import {SpendBundle} from "../../cactus/types/spend_bundle";
import {TRPCAgent} from "../../../rpc";
import {PoolWalletInfo} from "../../cactus/pools/pool_wallet_info";
import {TradeRecordConvenience} from "../../cactus/wallet/trade_record";
import {CAT} from "../../cactus/wallet/cat_wallet/cat_constants";
import {TDriverDict} from "../../cactus/wallet/puzzle_drivers";
import {NFTInfo} from "../../cactus/wallet/nft_wallet/nft_info";
import {Mirror, SingletonRecord} from "../../cactus/data_layer/data_layer_wallet";
import {TPushTxResponseOfWallet} from "../index";
import {GetMessageType, ResType} from "../../types";
import {TDaemon} from "../../../daemon/index";
import {CoinRecord} from "../../cactus/types/coin_record";
import {SigningMode} from "../../cactus/types/signing_mode";
import {Balance} from "../../cactus/wallet/wallet_node";
import {AutoClaimSettings} from "../../cactus/wallet/puzzles/clawback/metadata";
import {GetCoinRecords} from "../../cactus/wallet/wallet_coin_store";
import {WalletCoinRecordWithMetadata} from "../../cactus/wallet/wallet_coin_record";
import {VCRecord} from "../../cactus/wallet/vc_wallet/vc_store";
import {TransactionTypeFilter} from "../../cactus/wallet/util/quality_filter";
export const cactus_wallet_service = "cactus_wallet";
export type cactus_wallet_service = typeof cactus_wallet_service;
// # Key management
export const log_in_command = "log_in";
export type log_in_command = typeof log_in_command;
export type TLoginRequest = {
fingerprint: int;
};
export type TLoginResponse = {
fingerprint: int;
} | {
success: False;
error: "Unknown Error";
};
export type WsLoginMessage = GetMessageType<cactus_wallet_service, log_in_command, TLoginResponse>;
export async function log_in<T extends TRPCAgent | TDaemon>(agent: T, data: TLoginRequest){
type R = ResType<T, TLoginResponse, WsLoginMessage>;
return agent.sendMessage<R>(cactus_wallet_service, log_in_command, data);
}
export const get_logged_in_fingerprint_command = "get_logged_in_fingerprint";
export type get_logged_in_fingerprint_command = typeof get_logged_in_fingerprint_command;
export type TGetLoggedInFingerprintResponse = {
fingerprint: Optional<int>;
};
export type WsGetLoggedInFingerprintMessage = GetMessageType<cactus_wallet_service, get_logged_in_fingerprint_command, TGetLoggedInFingerprintResponse>;
export async function get_logged_in_fingerprint<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetLoggedInFingerprintResponse, WsGetLoggedInFingerprintMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_logged_in_fingerprint_command);
}
export const get_public_keys_command = "get_public_keys";
export type get_public_keys_command = typeof get_public_keys_command;
export type TGetPublicKeysRequest = {
};
export type TGetPublicKeysResponse = {
public_key_fingerprints: int[];
} | {
keyring_is_locked: True;
};
export type WsGetPublicKeysMessage = GetMessageType<cactus_wallet_service, get_public_keys_command, TGetPublicKeysResponse>;
export async function get_public_keys<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetPublicKeysResponse, WsGetPublicKeysMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_public_keys_command);
}
export const get_private_key_command = "get_private_key";
export type get_private_key_command = typeof get_private_key_command;
export type TGetPrivateKeyRequest = {
fingerprint: int; // https://github.com/Cactus-Network/bls-signatures/blob/main/python-impl/ec.py#L164
};
export type TGetPrivateKeyResponse = {
private_key: {
fingerprint: int;
sk: str;
pk: str;
farmer_pk: str;
pool_pk: str;
seed: Optional<str>;
};
} | {
success: False;
private_key: {
fingerprint: int;
};
};
export type WsGetPrivateKeyMessage = GetMessageType<cactus_wallet_service, get_private_key_command, TGetPrivateKeyResponse>;
export async function get_private_key<T extends TRPCAgent | TDaemon>(agent: T, data: TGetPrivateKeyRequest){
type R = ResType<T, TGetPrivateKeyResponse, WsGetPrivateKeyMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_private_key_command, data);
}
export const generate_mnemonic_command = "generate_mnemonic";
export type generate_mnemonic_command = typeof generate_mnemonic_command;
export type TGenerateMnemonicRequest = {
};
export type TGenerateMnemonicResponse = {
mnemonic: str[];
};
export type WsGenerateMnemonicMessage = GetMessageType<cactus_wallet_service, generate_mnemonic_command, TGenerateMnemonicResponse>;
export async function generate_mnemonic<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGenerateMnemonicResponse, WsGenerateMnemonicMessage>;
return agent.sendMessage<R>(cactus_wallet_service, generate_mnemonic_command);
}
export const add_key_command = "add_key";
export type add_key_command = typeof add_key_command;
export type TAddKeyRequest = {
mnemonic: str[];
};
export type TAddKeyResponse = {
success: false;
error: str;
word?: unknown; // `word` is e.args[0] where e = KeyError
} | {
fingerprint: int;
};
export type WsAddKeyMessage = GetMessageType<cactus_wallet_service, add_key_command, TAddKeyResponse>;
export async function add_key<T extends TRPCAgent | TDaemon>(agent: T, data: TAddKeyRequest){
type R = ResType<T, TAddKeyResponse, WsAddKeyMessage>;
return agent.sendMessage<R>(cactus_wallet_service, add_key_command, data);
}
export const delete_key_command = "delete_key";
export type delete_key_command = typeof delete_key_command;
export type TDeleteKeyRequest = {
fingerprint: int;
};
export type TDeleteKeyResponse = {
};
export type WsDeleteKeyMessage = GetMessageType<cactus_wallet_service, delete_key_command, TDeleteKeyResponse>;
export async function delete_key<T extends TRPCAgent | TDaemon>(agent: T, data: TDeleteKeyRequest){
type R = ResType<T, TDeleteKeyResponse, WsDeleteKeyMessage>;
return agent.sendMessage<R>(cactus_wallet_service, delete_key_command, data);
}
export const check_delete_key_command = "check_delete_key";
export type check_delete_key_command = typeof check_delete_key_command;
export type TCheckDeleteKeyRequest = {
fingerprint: int;
max_ph_to_search?: int;
};
export type TCheckDeleteKeyResponse = {
fingerprint: int;
used_for_farmer_rewards: bool;
used_for_pool_rewards: bool;
wallet_balance: bool;
};
export type WsCheckDeleteKeyMessage = GetMessageType<cactus_wallet_service, check_delete_key_command, TCheckDeleteKeyResponse>;
export async function check_delete_key<T extends TRPCAgent | TDaemon>(agent: T, data: TCheckDeleteKeyRequest){
type R = ResType<T, TCheckDeleteKeyResponse, WsCheckDeleteKeyMessage>;
return agent.sendMessage<R>(cactus_wallet_service, check_delete_key_command, data);
}
export const delete_all_keys_command = "delete_all_keys";
export type delete_all_keys_command = typeof delete_all_keys_command;
export type TDeleteAllKeysRequest = {
// no input
};
export type TDeleteAllKeysResponse = {} | {
success: False;
error: str;
};
export type WsDeleteAllKeysMessage = GetMessageType<cactus_wallet_service, delete_all_keys_command, TDeleteAllKeysResponse>;
export async function delete_all_keys<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TDeleteAllKeysResponse, WsDeleteAllKeysMessage>;
return agent.sendMessage<R>(cactus_wallet_service, delete_all_keys_command);
}
export const set_wallet_resync_on_startup_command = "set_wallet_resync_on_startup";
export type set_wallet_resync_on_startup_command = typeof set_wallet_resync_on_startup_command;
export type TSetWalletResyncOnStartupRequest = {
enable?: bool;
};
export type TSetWalletResyncOnStartupResponse = {
success: True;
};
export type WsSetWalletResyncOnStartupMessage = GetMessageType<cactus_wallet_service, set_wallet_resync_on_startup_command, TSetWalletResyncOnStartupResponse>;
export async function set_wallet_resync_on_startup<T extends TRPCAgent | TDaemon>(agent: T) {
type R = ResType<T, TSetWalletResyncOnStartupResponse, WsSetWalletResyncOnStartupMessage>;
return agent.sendMessage<R>(cactus_wallet_service, set_wallet_resync_on_startup_command);
}
// # Wallet node
export const get_sync_status_command = "get_sync_status";
export type get_sync_status_command = typeof get_sync_status_command;
export type TGetSyncStatusRequest = {
};
export type TGetSyncStatusResponse = {
synced: bool;
syncing: bool;
genesis_initialized: bool;
};
export type WsGetSyncStatusMessage = GetMessageType<cactus_wallet_service, get_sync_status_command, TGetSyncStatusResponse>;
export async function get_sync_status<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetSyncStatusResponse, WsGetSyncStatusMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_sync_status_command);
}
export const get_height_info_command = "get_height_info";
export type get_height_info_command = typeof get_height_info_command;
export type TGetHeightInfoRequest = {
};
export type TGetHeightInfoResponse = {
height: uint32;
};
export type WsGetHeightInfoMessage = GetMessageType<cactus_wallet_service, get_height_info_command, TGetHeightInfoResponse>;
export async function get_height_info<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetHeightInfoResponse, WsGetHeightInfoMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_height_info_command);
}
export const push_tx_command = "push_tx";
export type push_tx_command = typeof push_tx_command;
export type TPushTxRequest = {
spend_bundle: str; // SpendBundle serialized to hex string
};
export type TPushTxResponse = {};
export type WsPushTxMessageOfWallet = GetMessageType<cactus_wallet_service, push_tx_command, TPushTxResponse>;
export async function push_tx<T extends TRPCAgent | TDaemon>(agent: T, data: TPushTxRequest){
type R = ResType<T, TPushTxResponseOfWallet, WsPushTxMessageOfWallet>;
return agent.sendMessage<R>(cactus_wallet_service, push_tx_command, data);
}
export const push_transactions_command = "push_transactions";
export type push_transactions_command = typeof push_transactions_command;
export type TPushTransactionsRequest = {
transactions: str; // TransactionRecord serialized to hex string
};
export type TPushTransactionsResponse = {};
export type WsPushTransactionsMessage = GetMessageType<cactus_wallet_service, push_transactions_command, TPushTransactionsResponse>;
export async function push_transactions<T extends TRPCAgent | TDaemon>(agent: T, data: TPushTransactionsRequest){
type R = ResType<T, TPushTransactionsResponse, WsPushTransactionsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, push_transactions_command, data);
}
export const farm_block_command = "farm_block";
export type farm_block_command = typeof farm_block_command;
export type TFarmBlockRequest = {
address: str;
};
export type TFarmBlockResponse = {
};
export type WsFarmBlockMessage = GetMessageType<cactus_wallet_service, farm_block_command, TFarmBlockResponse>;
export async function farm_block<T extends TRPCAgent | TDaemon>(agent: T, data: TFarmBlockRequest){
type R = ResType<T, TFarmBlockResponse, WsFarmBlockMessage>;
return agent.sendMessage<R>(cactus_wallet_service, farm_block_command, data);
}
export const get_timestamp_for_height_command = "get_timestamp_for_height";
export type get_timestamp_for_height_command = typeof get_timestamp_for_height_command;
export type TGetTimestampForHeightResponse = {
timestamp: uint64;
};
export type WsGetTimestampForHeightMessage = GetMessageType<cactus_wallet_service, get_timestamp_for_height_command, TGetTimestampForHeightResponse>;
export async function get_timestamp_for_height<T extends TRPCAgent | TDaemon>(agent: T) {
type R = ResType<T, TGetTimestampForHeightResponse, WsGetTimestampForHeightMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_timestamp_for_height_command);
}
export const set_auto_claim_command = "set_auto_claim";
export type set_auto_claim_command = typeof set_auto_claim_command;
export type TSetAutoClaimRequest = AutoClaimSettings;
export type TSetAutoClaimResponse = AutoClaimSettings;
export type WsSetAutoClaimMessage = GetMessageType<cactus_wallet_service, set_auto_claim_command, TSetAutoClaimResponse>;
export async function set_auto_claim<T extends TRPCAgent | TDaemon>(agent: T, data: TSetAutoClaimRequest) {
type R = ResType<T, TSetAutoClaimResponse, WsSetAutoClaimMessage>;
return agent.sendMessage<R>(cactus_wallet_service, set_auto_claim_command, data);
}
export const get_auto_claim_command = "get_auto_claim";
export type get_auto_claim_command = typeof get_auto_claim_command;
export type TGetAutoClaimResponse = AutoClaimSettings;
export type WsGetAutoClaimMessage = GetMessageType<cactus_wallet_service, get_auto_claim_command, TGetAutoClaimResponse>;
export async function get_auto_claim<T extends TRPCAgent | TDaemon>(agent: T) {
type R = ResType<T, TGetAutoClaimResponse, WsGetAutoClaimMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_auto_claim_command);
}
export const get_initial_freeze_period_command_of_wallet = "get_initial_freeze_period";
export type get_initial_freeze_period_command_of_wallet = typeof get_initial_freeze_period_command_of_wallet;
export type TGetInitialFreezePeriodRequestOfWallet = {
};
export type TGetInitialFreezePeriodResponseOfWallet = {
INITIAL_FREEZE_END_TIMESTAMP: 1620061200; // Mon May 03 2021 17:00:00 GMT+0000
};
export type WsGetInitialFreezePeriodMessageOfWallet = GetMessageType<cactus_wallet_service, get_initial_freeze_period_command_of_wallet, TGetInitialFreezePeriodResponseOfWallet>;
export async function get_initial_freeze_period_of_wallet<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetInitialFreezePeriodResponseOfWallet, WsGetInitialFreezePeriodMessageOfWallet>;
return agent.sendMessage<R>(cactus_wallet_service, get_initial_freeze_period_command_of_wallet);
}
export const get_network_info_command_of_wallet = "get_network_info";
export type get_network_info_command_of_wallet = typeof get_network_info_command_of_wallet;
export type TGetNetworkInfoRequestOfWallet = {
};
export type TGetNetworkInfoResponseOfWallet = {
network_name: str;
network_prefix: str;
};
export type WsGetNetworkInfoMessageOfWallet = GetMessageType<cactus_wallet_service, get_network_info_command_of_wallet, TGetNetworkInfoResponseOfWallet>;
export async function get_network_info_of_wallet<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetNetworkInfoResponseOfWallet, WsGetNetworkInfoMessageOfWallet>;
return agent.sendMessage<R>(cactus_wallet_service, get_network_info_command_of_wallet);
}
// # Wallet management
export const get_wallets_command = "get_wallets";
export type get_wallets_command = typeof get_wallets_command;
export type TGetWalletsRequest = {
type?: int;
include_data?: bool;
};
export type TGetWalletsResponse = {
wallets: WalletInfo[];
fingerprint?: int;
};
export type WsGetWalletsMessage = GetMessageType<cactus_wallet_service, get_wallets_command, TGetWalletsResponse>;
export async function get_wallets<T extends TRPCAgent | TDaemon>(agent: T, data: TGetWalletsRequest){
type R = ResType<T, TGetWalletsResponse, WsGetWalletsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_wallets_command, data);
}
export type TCreate_New_CAT_WalletRequest = {
fee?: uint64;
wallet_type: "cat_wallet"
mode: "new";
amount: uint64;
} | {
fee?: uint64;
wallet_type: "cat_wallet"
mode: "existing";
asset_id: str;
};
export type TCreate_New_CAT_WalletResponse = {
type: uint8;
asset_id: str;
wallet_id: uint32;
};
export type TCreate_New_RL_WalletRequest = {
fee?: uint64;
wallet_type: "rl_wallet";
rl_type: "admin";
interval: int;
limit: int;
pubkey: str;
amount: int;
} | {
fee?: uint64;
wallet_type: "rl_wallet";
rl_type: "user";
};
export type TCreate_New_RL_WalletResponse = {
success: bool;
id: uint32;
type: uint8;
origin: Optional<Coin>;
pubkey: str;
} | {
id: uint32;
type: uint8;
pubkey: str;
};
export type TCreate_New_DID_WalletRequest = {
fee?: uint64;
wallet_type: "did_wallet";
did_type: "new";
backup_dids: str[];
num_of_backup_ids_needed: uint64;
amount: int;
metadata?: Record<str, str>;
wallet_name?: str;
} | {
fee?: uint64;
wallet_type: "did_wallet";
did_type: "recovery";
backup_data: str;
};
export type TCreate_New_DID_WalletResponse = {
success: True;
type: uint8;
my_did: str;
wallet_id: uint32;
} | {
success: True;
type: uint8;
my_did: str;
wallet_id: uint32;
coin_name: str;
coin_list: [bytes32, bytes32, uint64]; // Not Coin[]. See as_list function implementation.
newpuzhash: str;
pubkey: str;
backup_dids: bytes[];
num_verifications_required: uint64;
};
export type TCreate_New_NFT_WalletRequest = {
fee?: uint64;
wallet_type: "nft_wallet";
did_id?: str;
name?: str;
};
export type TCreate_New_NFT_WalletResponse = {
success: True;
type: uint8;
wallet_id: uint32;
};
export type TCreate_New_Pool_WalletRequest = {
fee?: uint64;
wallet_type: "pool_wallet";
mode: "new";
initial_target_state: {
state: "SELF_POOLING";
} | {
state: "FARMING_TO_POOL";
target_puzzle_hash: str;
pool_url: str;
relative_lock_height: uint32;
};
p2_singleton_delayed_ph?: str;
p2_singleton_delay_time?: uint64;
} | {
fee?: uint64;
wallet_type: "pool_wallet";
mode: "recovery";
};
export type TCreate_New_Pool_WalletResponse = {
total_fee: uint64;
transaction: TransactionRecord;
launcher_id: str;
p2_singleton_puzzle_hash: str;
};
export type TCreateWalletErrorResponse = {
success: False;
error: str;
};
export const create_new_wallet_command = "create_new_wallet";
export type create_new_wallet_command = typeof create_new_wallet_command;
export type TCreateNewWalletRequest = TCreate_New_CAT_WalletRequest
| TCreate_New_RL_WalletRequest
| TCreate_New_DID_WalletRequest
| TCreate_New_NFT_WalletRequest
| TCreate_New_Pool_WalletRequest;
export type TCreateNewWalletResponse = TCreate_New_CAT_WalletResponse
| TCreate_New_RL_WalletResponse
| TCreate_New_DID_WalletResponse
| TCreate_New_NFT_WalletResponse
| TCreate_New_Pool_WalletResponse
| TCreateWalletErrorResponse;
export type WsCreateNewWalletMessage = GetMessageType<cactus_wallet_service, create_new_wallet_command, TCreateNewWalletResponse>;
export async function create_new_wallet<T extends TRPCAgent | TDaemon>(agent: T, data: TCreateNewWalletRequest){
type R = ResType<T, TCreateNewWalletResponse, WsCreateNewWalletMessage>;
return agent.sendMessage<R>(cactus_wallet_service, create_new_wallet_command, data);
}
// # Wallet
export type WalletBalance = Balance & {
wallet_id: uint32;
wallet_type: int;
fingerprint?: int;
asset_id?: str;
};
export const get_wallet_balance_command = "get_wallet_balance";
export type get_wallet_balance_command = typeof get_wallet_balance_command;
export type TGetWalletBalanceRequest = {
wallet_id: int;
};
export type TGetWalletBalanceResponse = {
wallet_balance: WalletBalance;
};
export type WsGetWalletBalanceMessage = GetMessageType<cactus_wallet_service, get_wallet_balance_command, TGetWalletBalanceResponse>;
export async function get_wallet_balance<T extends TRPCAgent | TDaemon>(agent: T, data: TGetWalletBalanceRequest){
type R = ResType<T, TGetWalletBalanceResponse, WsGetWalletBalanceMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_wallet_balance_command, data);
}
export const get_wallet_balances_command = "get_wallet_balances";
export type get_wallet_balances_command = typeof get_wallet_balances_command;
export type TGetWalletBalancesRequest = {
wallet_ids: int[];
};
export type TGetWalletBalancesResponse = {
wallet_balances: Record<uint32, WalletBalance>;
};
export type WsGetWalletBalancesMessage = GetMessageType<cactus_wallet_service, get_wallet_balances_command, TGetWalletBalancesResponse>;
export async function get_wallet_balances<T extends TRPCAgent | TDaemon>(agent: T, data: TGetWalletBalancesRequest) {
type R = ResType<T, TGetWalletBalancesResponse, WsGetWalletBalancesMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_wallet_balances_command, data);
}
export const get_transaction_command = "get_transaction";
export type get_transaction_command = typeof get_transaction_command;
export type TGetTransactionRequest = {
transaction_id: str;
};
export type TGetTransactionResponse = {
transaction: TransactionRecordConvenience;
transaction_id: TransactionRecord["name"];
};
export type WsGetTransactionMessage = GetMessageType<cactus_wallet_service, get_transaction_command, TGetTransactionResponse>;
export async function get_transaction<T extends TRPCAgent | TDaemon>(agent: T, data: TGetTransactionRequest){
type R = ResType<T, TGetTransactionResponse, WsGetTransactionMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_transaction_command, data);
}
export const get_transactions_command = "get_transactions";
export type get_transactions_command = typeof get_transactions_command;
export type TGetTransactionsRequest = {
wallet_id: int;
start?: int;
end?: int;
sort_key?: str;
reverse?: bool;
to_address?: str;
type_filter?: TransactionTypeFilter;
confirmed?: bool;
};
export type TGetTransactionsResponse = {
transactions: TransactionRecordConvenienceWithMetadata[];
wallet_id: int;
};
export type WsGetTransactionsMessage = GetMessageType<cactus_wallet_service, get_transactions_command, TGetTransactionsResponse>;
export async function get_transactions<T extends TRPCAgent | TDaemon>(agent: T, data: TGetTransactionsRequest){
type R = ResType<T, TGetTransactionsResponse, WsGetTransactionsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_transactions_command, data);
}
export const get_next_address_command = "get_next_address";
export type get_next_address_command = typeof get_next_address_command;
export type TGetNextAddressRequest = {
new_address: bool;
wallet_id: int;
};
export type TGetNextAddressResponse = {
wallet_id: uint32; // wallet_id in request is int, but response is uint32
address: str;
};
export type WsGetNextAddressMessage = GetMessageType<cactus_wallet_service, get_next_address_command, TGetNextAddressResponse>;
export async function get_next_address<T extends TRPCAgent | TDaemon>(agent: T, data: TGetNextAddressRequest){
type R = ResType<T, TGetNextAddressResponse, WsGetNextAddressMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_next_address_command, data);
}
export const send_transaction_command = "send_transaction";
export type send_transaction_command = typeof send_transaction_command;
export type TSendTransactionRequest = {
wallet_id: uint32;
amount: int;
fee: int;
address: str;
memos?: str[];
min_coin_amount?: uint64;
max_coin_amount?: uint64;
excluded_coin_amounts?: uint64[];
excluded_coin_ids?: str[];
puzzle_decorator?: Array<{decorator: str; clawback_timelock?: uint64}>;
reuse_puzhash?: bool;
};
export type TSendTransactionResponse = {
transaction: TransactionRecordConvenience;
transaction_id: TransactionRecord["name"];
};
export type WsSendTransactionMessage = GetMessageType<cactus_wallet_service, send_transaction_command, TSendTransactionResponse>;
export async function send_transaction<T extends TRPCAgent | TDaemon>(agent: T, data: TSendTransactionRequest){
type R = ResType<T, TSendTransactionResponse, WsSendTransactionMessage>;
return agent.sendMessage<R>(cactus_wallet_service, send_transaction_command, data);
}
export const send_transaction_multi_command = "send_transaction_multi";
export type send_transaction_multi_command = typeof send_transaction_multi_command;
export type TSendTransactionMultiRequest = {
wallet_id: uint32;
additions: TAdditions[];
fee?: uint64;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
exclude_coin_amounts?: uint64[];
exclude_coins?: Coin[];
coins?: Coin[];
coin_announcements?: TCoinAnnouncement[];
puzzle_announcements?: TPuzzleAnnouncement[];
} | {
wallet_id: uint32;
additions: TAdditions[];
fee: uint64;
amount: uint64;
inner_address: str;
memos: str;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
exclude_coin_amounts?: uint64[];
exclude_coin_ids?: str[];
};
export type TSendTransactionMultiResponse = {
transaction: TransactionRecordConvenience;
transaction_id: TransactionRecordConvenience["name"];
};
export type WsSendTransactionMultiMessage = GetMessageType<cactus_wallet_service, send_transaction_multi_command, TSendTransactionMultiResponse>;
export async function send_transaction_multi<T extends TRPCAgent | TDaemon>(agent: T, data: TSendTransactionMultiRequest){
type R = ResType<T, TSendTransactionMultiResponse, WsSendTransactionMultiMessage>;
return agent.sendMessage<R>(cactus_wallet_service, send_transaction_multi_command, data);
}
export const spend_clawback_coins_command = "spend_clawback_coins";
export type spend_clawback_coins_command = typeof spend_clawback_coins_command;
export type TSpendClawbackCoinsRequest = {
coin_ids: str[];
fee?: uint64;
batch_size: int;
};
export type TSpendClawbackCoinsResponse = {
success: True;
transaction_ids: str[];
};
export type WsSpendClawbackCoinsMessage = GetMessageType<cactus_wallet_service, spend_clawback_coins_command, TSpendClawbackCoinsResponse>;
export async function spend_clawback_coins<T extends TRPCAgent | TDaemon>(agent: T, data: TSpendClawbackCoinsRequest) {
type R = ResType<T, TSpendClawbackCoinsResponse, WsSpendClawbackCoinsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, spend_clawback_coins_command, data);
}
export const get_coin_records_command = "get_coin_records";
export type get_coin_records_command = typeof get_coin_records_command;
export type TGetCoinRecordsRequest = GetCoinRecords;
export type TGetCoinRecordsResponse = {
coin_records: WalletCoinRecordWithMetadata[];
total_count: uint32 | None;
};
export type WsGetCoinRecordsMessage = GetMessageType<cactus_wallet_service, get_coin_records_command, TGetCoinRecordsResponse>;
export async function get_coin_records<T extends TRPCAgent | TDaemon>(agent: T, data: TGetCoinRecordsRequest) {
type R = ResType<T, TGetCoinRecordsResponse, WsGetCoinRecordsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_coin_records_command, data);
}
export const get_transaction_count_command = "get_transaction_count";
export type get_transaction_count_command = typeof get_transaction_count_command;
export type TGetTransactionCountRequest = {
wallet_id: int;
type_filter?: TransactionTypeFilter;
confirmed?: bool;
};
export type TGetTransactionCountResponse = {
count: int;
wallet_id: int;
};
export type WsGetTransactionCountMessage = GetMessageType<cactus_wallet_service, get_transaction_count_command, TGetTransactionCountResponse>;
export async function get_transaction_count<T extends TRPCAgent | TDaemon>(agent: T, data: TGetTransactionCountRequest){
type R = ResType<T, TGetTransactionCountResponse, WsGetTransactionCountMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_transaction_count_command, data);
}
export const get_farmed_amount_command = "get_farmed_amount";
export type get_farmed_amount_command = typeof get_farmed_amount_command;
export type TGetFarmedAmountRequest = {
};
export type TGetFarmedAmountResponse = {
farmed_amount: int;
pool_reward_amount: int;
farmer_reward_amount: int;
fee_amount: int;
last_height_farmed: int;
last_time_farmed: uint32;
blocks_won: uint32;
};
export type WsGetFarmedAmountMessage = GetMessageType<cactus_wallet_service, get_farmed_amount_command, TGetFarmedAmountResponse>;
export async function get_farmed_amount<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetFarmedAmountResponse, WsGetFarmedAmountMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_farmed_amount_command);
}
export type TAdditions = {
amount: uint64;
puzzle_hash: str;
memos?: str[];
};
export type TCoinAnnouncement = {
coin_id: str;
message: str;
morph_bytes?: str;
};
export type TPuzzleAnnouncement = {
puzzle_hash: str;
message: str;
morph_bytes?: str;
};
export const create_signed_transaction_command = "create_signed_transaction";
export type create_signed_transaction_command = typeof create_signed_transaction_command;
export type TCreateSignedTransactionRequest = {
wallet_id?: uint32;
additions: TAdditions[];
fee?: uint64;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
excluded_coin_amounts?: uint64[];
coins?: Coin[];
excluded_coins?: Coin[];
coin_announcements?: TCoinAnnouncement[];
puzzle_announcements?: TPuzzleAnnouncement[];
};
export type TCreateSignedTransactionResponse = {
signed_txs: TransactionRecordConvenience[];
signed_tx: TransactionRecordConvenience;
};
export type WsCreateSignedTransactionMessage = GetMessageType<cactus_wallet_service, create_signed_transaction_command, TCreateSignedTransactionResponse>;
export async function create_signed_transaction<T extends TRPCAgent | TDaemon>(agent: T, data: TCreateSignedTransactionRequest){
type R = ResType<T, TCreateSignedTransactionResponse, WsCreateSignedTransactionMessage>;
return agent.sendMessage<R>(cactus_wallet_service, create_signed_transaction_command, data);
}
export const delete_unconfirmed_transactions_command = "delete_unconfirmed_transactions";
export type delete_unconfirmed_transactions_command = typeof delete_unconfirmed_transactions_command;
export type TDeleteUnconfirmedTransactionsRequest = {
wallet_id: uint32;
};
export type TDeleteUnconfirmedTransactionsResponse = {
};
export type WsDeleteUnconfirmedTransactionsMessage = GetMessageType<cactus_wallet_service, delete_unconfirmed_transactions_command, TDeleteUnconfirmedTransactionsResponse>;
export async function delete_unconfirmed_transactions<T extends TRPCAgent | TDaemon>(agent: T, data: TDeleteUnconfirmedTransactionsRequest){
type R = ResType<T, TDeleteUnconfirmedTransactionsResponse, WsDeleteUnconfirmedTransactionsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, delete_unconfirmed_transactions_command, data);
}
export const select_coins_command = "select_coins";
export type select_coins_command = typeof select_coins_command;
export type TSelectCoinsRequest = {
amount: uint64;
wallet_id: uint32;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
excluded_coin_amounts?: uint64[];
excluded_coins?: Coin[];
};
export type TSelectCoinsResponse = {
coins: Coin[];
};
export type WsSelectCoinsMessage = GetMessageType<cactus_wallet_service, select_coins_command, TSelectCoinsResponse>;
export async function select_coins<T extends TRPCAgent | TDaemon>(agent: T, data: TSelectCoinsRequest){
type R = ResType<T, TSelectCoinsResponse, WsSelectCoinsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, select_coins_command, data);
}
export const get_spendable_coins_command = "get_spendable_coins";
export type get_spendable_coins_command = typeof get_spendable_coins_command;
export type TGetSpendableCoinsRequest = {
wallet_id: uint32;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
excluded_coin_amounts?: Optional<uint64[]>;
excluded_coins?: Coin[];
excluded_coin_ids?: str[];
};
export type TGetSpendableCoinsResponse = {
confirmed_records: CoinRecord[];
unconfirmed_removals: CoinRecord[];
unconfirmed_additions: Coin[];
};
export type WsGetSpendableCoinsMessage = GetMessageType<cactus_wallet_service, get_spendable_coins_command, TGetSpendableCoinsResponse>;
export async function get_spendable_coins<T extends TRPCAgent | TDaemon>(agent: T, data: TGetSpendableCoinsRequest) {
type R = ResType<T, TGetSpendableCoinsResponse, WsGetSpendableCoinsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_spendable_coins_command, data);
}
export const get_coin_records_by_names_command = "get_coin_records_by_names";
export type get_coin_records_by_names_command = typeof get_coin_records_by_names_command;
export type TGetCoinRecordsByNamesRequest = {
names: str[];
start_height?: uint32;
end_height?: uint32;
include_spent_coins?: bool;
};
export type TGetCoinRecordsByNamesResponse = {
coin_records: CoinRecord[];
};
export type WsGetCoinRecordsByNamesMessage = GetMessageType<cactus_wallet_service, get_coin_records_by_names_command, TGetCoinRecordsByNamesResponse>;
export async function get_coin_records_by_names<T extends TRPCAgent | TDaemon>(agent: T, data: TGetCoinRecordsByNamesRequest) {
type R = ResType<T, TGetCoinRecordsByNamesResponse, WsGetCoinRecordsByNamesMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_coin_records_by_names_command, data);
}
export const get_current_derivation_index_command = "get_current_derivation_index";
export type get_current_derivation_index_command = typeof get_current_derivation_index_command;
export type TGetCurrentDerivationIndexResponse = {
success: True;
index: Optional<uint32>;
};
export type WsGetCurrentDerivationIndexMessage = GetMessageType<cactus_wallet_service, get_current_derivation_index_command, TGetCurrentDerivationIndexResponse>;
export async function get_current_derivation_index<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetCurrentDerivationIndexResponse, WsGetCurrentDerivationIndexMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_current_derivation_index_command);
}
export const extend_derivation_index_command = "extend_derivation_index";
export type extend_derivation_index_command = typeof extend_derivation_index_command;
export type TExtendDerivationIndexRequest = {
index: uint32;
};
export type TExtendDerivationIndexResponse = {
success: True;
index: Optional<uint32>;
};
export type WsExtendDerivationIndexMessage = GetMessageType<cactus_wallet_service, extend_derivation_index_command, TExtendDerivationIndexResponse>;
export async function extend_derivation_index<T extends TRPCAgent | TDaemon>(agent: T, data: TExtendDerivationIndexRequest){
type R = ResType<T, TExtendDerivationIndexResponse, WsExtendDerivationIndexMessage>;
return agent.sendMessage<R>(cactus_wallet_service, extend_derivation_index_command, data);
}
export const get_notifications_command = "get_notifications";
export type get_notifications_command = typeof get_notifications_command;
export type TGetNotificationsRequest = {
ids?: str[];
start?: int;
end?: int;
};
export type TGetNotificationsResponse = {
notifications: Array<{
id: str;
message: str;
amount: uint64;
height: uint32;
}>;
};
export type WsGetNotificationsMessage = GetMessageType<cactus_wallet_service, get_notifications_command, TGetNotificationsResponse>;
export async function get_notifications<T extends TRPCAgent | TDaemon>(agent: T, data: TGetNotificationsRequest){
type R = ResType<T, TGetNotificationsResponse, WsGetNotificationsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_notifications_command, data);
}
export const delete_notifications_command = "delete_notifications";
export type delete_notifications_command = typeof delete_notifications_command;
export type TDeleteNotificationsRequest = {
ids?: str[];
};
export type TDeleteNotificationsResponse = {
};
export type WsDeleteNotificationsMessage = GetMessageType<cactus_wallet_service, delete_notifications_command, TDeleteNotificationsResponse>;
export async function delete_notifications<T extends TRPCAgent | TDaemon>(agent: T, data: TDeleteNotificationsRequest){
type R = ResType<T, TDeleteNotificationsResponse, WsDeleteNotificationsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, delete_notifications_command, data);
}
export const send_notification_command = "send_notification";
export type send_notification_command = typeof send_notification_command;
export type TSendNotificationRequest = {
target: str;
message: str;
amount: uint64;
fee?: uint64;
};
export type TSendNotificationResponse = {
tx: TransactionRecordConvenience;
};
export type WsSendNotificationMessage = GetMessageType<cactus_wallet_service, send_notification_command, TSendNotificationResponse>;
export async function send_notification<T extends TRPCAgent | TDaemon>(agent: T, data: TSendNotificationRequest){
type R = ResType<T, TSendNotificationResponse, WsSendNotificationMessage>;
return agent.sendMessage<R>(cactus_wallet_service, send_notification_command, data);
}
export const verify_signature_command = "verify_signature";
export type verify_signature_command = typeof verify_signature_command;
export type TVerifySignatureRequest = {
message: str;
signing_mode?: SigningMode;
pubkey: str;
signature: str;
address?: str;
};
export type TVerifySignatureResponse = {
isValid: True;
} | {
isValid: False;
error: str;
};
export type WsVerifySignatureMessage = GetMessageType<cactus_wallet_service, verify_signature_command, TVerifySignatureResponse>;
export async function verify_signature<T extends TRPCAgent | TDaemon>(agent: T, data: TVerifySignatureRequest) {
type R = ResType<T, TVerifySignatureResponse, WsVerifySignatureMessage>;
return agent.sendMessage<R>(cactus_wallet_service, verify_signature_command, data);
}
export const get_transaction_memo_command = "get_transaction_memo";
export type get_transaction_memo_command = typeof get_transaction_memo_command;
export type TGetTransactionMemoRequest = {
transaction_id: str;
};
export type TGetTransactionMemoResponse = {
[transaction_id: string]: {
[coin_id: string]: string[];
};
};
export type WsGetTransactionMemoMessage = GetMessageType<cactus_wallet_service, get_transaction_memo_command, TGetTransactionMemoResponse>;
export async function get_transaction_memo<T extends TRPCAgent | TDaemon>(agent: T, data: TGetTransactionMemoRequest) {
type R = ResType<T, TGetTransactionMemoResponse, WsGetTransactionMemoMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_transaction_memo_command, data);
}
export const sign_message_by_address_command = "sign_message_by_address";
export type sign_message_by_address_command = typeof sign_message_by_address_command;
export type TSignMessageByAddressRequest = {
address: str;
message: str;
is_hex?: bool;
};
export type TSignMessageByAddressResponse = {
success: True;
pubkey: str;
signature: str;
signing_mode: SigningMode;
};
export type WsSignMessageByAddressMessage = GetMessageType<cactus_wallet_service, sign_message_by_address_command, TSignMessageByAddressResponse>;
export async function sign_message_by_address<T extends TRPCAgent | TDaemon>(agent: T, data: TSignMessageByAddressRequest){
type R = ResType<T, TSignMessageByAddressResponse, WsSignMessageByAddressMessage>;
return agent.sendMessage<R>(cactus_wallet_service, sign_message_by_address_command, data);
}
export const sign_message_by_id_command = "sign_message_by_id";
export type sign_message_by_id_command = typeof sign_message_by_id_command;
export type TSignMessageByIdRequest = {
id: str;
message: str;
is_hex?: bool;
};
export type TSignMessageByIdResponse = {
success: False;
error: str;
} | {
success: True;
pubkey: str;
signature: str;
latest_coin_id: str|None;
signing_mode: SigningMode;
};
export type WsSignMessageByIdMessage = GetMessageType<cactus_wallet_service, sign_message_by_id_command, TSignMessageByIdResponse>;
export async function sign_message_by_id<T extends TRPCAgent | TDaemon>(agent: T, data: TSignMessageByIdRequest){
type R = ResType<T, TSignMessageByIdResponse, WsSignMessageByIdMessage>;
return agent.sendMessage<R>(cactus_wallet_service, sign_message_by_id_command, data);
}
// # CATs and Trading
export const get_cat_list_command = "get_cat_list";
export type get_cat_list_command = typeof get_cat_list_command;
export type TGetCatListResponse = {
cat_list: CAT[];
};
export type WsGetCatListMessage = GetMessageType<cactus_wallet_service, get_cat_list_command, TGetCatListResponse>;
export async function get_cat_list<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetCatListResponse, WsGetCatListMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_cat_list_command);
}
export const cat_set_name_command = "cat_set_name";
export type cat_set_name_command = typeof cat_set_name_command;
export type TCatSetNameRequest = {
wallet_id: uint32;
name: str;
};
export type TCatSetNameResponse = {
wallet_id: uint32;
};
export type WsCatSetNameMessage = GetMessageType<cactus_wallet_service, cat_set_name_command, TCatSetNameResponse>;
export async function cat_set_name<T extends TRPCAgent | TDaemon>(agent: T, data: TCatSetNameRequest){
type R = ResType<T, TCatSetNameResponse, WsCatSetNameMessage>;
return agent.sendMessage<R>(cactus_wallet_service, cat_set_name_command, data);
}
export const cat_asset_id_to_name_command = "cat_asset_id_to_name";
export type cat_asset_id_to_name_command = typeof cat_asset_id_to_name_command;
export type TCatAssetIdToNameRequest = {
asset_id: str;
};
export type TCatAssetIdToNameResponse = {
wallet_id: Optional<uint32>;
name: str;
};
export type WsCatAssetIdToNameMessage = GetMessageType<cactus_wallet_service, cat_asset_id_to_name_command, TCatAssetIdToNameResponse>;
export async function cat_asset_id_to_name<T extends TRPCAgent | TDaemon>(agent: T, data: TCatAssetIdToNameRequest){
type R = ResType<T, TCatAssetIdToNameResponse, WsCatAssetIdToNameMessage>;
return agent.sendMessage<R>(cactus_wallet_service, cat_asset_id_to_name_command, data);
}
export const cat_get_name_command = "cat_get_name";
export type cat_get_name_command = typeof cat_get_name_command;
export type TCatGetNameRequest = {
wallet_id: uint32;
};
export type TCatGetNameResponse = {
wallet_id: uint32;
name: str;
};
export type WsCatGetNameMessage = GetMessageType<cactus_wallet_service, cat_get_name_command, TCatGetNameResponse>;
export async function cat_get_name<T extends TRPCAgent | TDaemon>(agent: T, data: TCatGetNameRequest){
type R = ResType<T, TCatGetNameResponse, WsCatGetNameMessage>;
return agent.sendMessage<R>(cactus_wallet_service, cat_get_name_command, data);
}
export const get_stray_cats_command = "get_stray_cats";
export type get_stray_cats_command = typeof get_stray_cats_command;
export type TGetStrayCatsResponse = {
stray_cats: Array<{
asset_id: str;
name: str;
first_seen_height: int;
sender_puzzle_hash: str;
}>;
};
export type WsGetStrayCatsMessage = GetMessageType<cactus_wallet_service, get_stray_cats_command, TGetStrayCatsResponse>;
export async function get_stray_cats<T extends TRPCAgent | TDaemon>(agent: T){
type R = ResType<T, TGetStrayCatsResponse, WsGetStrayCatsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_stray_cats_command);
}
export const cat_spend_command = "cat_spend";
export type cat_spend_command = typeof cat_spend_command;
export type TCatSpendRequest = {
wallet_id: uint32;
additions?: TAdditions[];
fee: uint64;
amount: uint64;
inner_address: str;
memos?: str[];
coins?: Coin[];
min_coin_amount?: uint64;
max_coin_amount?: uint64;
excluded_coin_amounts?: uint64[];
excluded_coin_ids?: str[];
reuse_puzhash?: bool;
extra_delta?: int;
tail_reveal?: str;
tail_solution?: str;
};
export type TCatSpendResponse = {
transaction: TransactionRecordConvenience;
transaction_id: TransactionRecord["name"];
};
export type WsCatSpendMessage = GetMessageType<cactus_wallet_service, cat_spend_command, TCatSpendResponse>;
export async function cat_spend<T extends TRPCAgent | TDaemon>(agent: T, data: TCatSpendRequest){
type R = ResType<T, TCatSpendResponse, WsCatSpendMessage>;
return agent.sendMessage<R>(cactus_wallet_service, cat_spend_command, data);
}
export const cat_get_asset_id_command = "cat_get_asset_id";
export type cat_get_asset_id_command = typeof cat_get_asset_id_command;
export type TCatGetAssetIdRequest = {
wallet_id: uint32;
};
export type TCatGetAssetIdResponse = {
asset_id: str;
wallet_id: uint32;
};
export type WsCatGetAssetIdMessage = GetMessageType<cactus_wallet_service, cat_get_asset_id_command, TCatGetAssetIdResponse>;
export async function cat_get_asset_id<T extends TRPCAgent | TDaemon>(agent: T, data: TCatGetAssetIdRequest){
type R = ResType<T, TCatGetAssetIdResponse, WsCatGetAssetIdMessage>;
return agent.sendMessage<R>(cactus_wallet_service, cat_get_asset_id_command, data);
}
export const create_offer_for_ids_command = "create_offer_for_ids";
export type create_offer_for_ids_command = typeof create_offer_for_ids_command;
export type TCreateOfferForIdsRequest = {
offer: Record<int, int>;
fee?: uint64;
validate_only?: bool;
driver_dict?: TDriverDict;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
solver?: Record<str, any>;
reuse_puzhash?: bool;
};
export type TCreateOfferForIdsResponse = {
offer: str;
trade_record: TradeRecordConvenience;
};
export type WsCreateOfferForIdsMessage = GetMessageType<cactus_wallet_service, create_offer_for_ids_command, TCreateOfferForIdsResponse>;
export async function create_offer_for_ids<T extends TRPCAgent | TDaemon>(agent: T, data: TCreateOfferForIdsRequest){
type R = ResType<T, TCreateOfferForIdsResponse, WsCreateOfferForIdsMessage>;
return agent.sendMessage<R>(cactus_wallet_service, create_offer_for_ids_command, data);
}
export const get_offer_summary_command = "get_offer_summary";
export type get_offer_summary_command = typeof get_offer_summary_command;
export type TGetOfferSummaryRequest = {
offer: str;
advanced?: bool;
};
export type TGetOfferSummaryResponse = {
summary: {
offered: Record<str, int>;
requested: Record<str, int>;
fees: int;
infos: TDriverDict;
};
id: bytes32;
};
export type WsGetOfferSummaryMessage = GetMessageType<cactus_wallet_service, get_offer_summary_command, TGetOfferSummaryResponse>;
export async function get_offer_summary<T extends TRPCAgent | TDaemon>(agent: T, data: TGetOfferSummaryRequest){
type R = ResType<T, TGetOfferSummaryResponse, WsGetOfferSummaryMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_offer_summary_command, data);
}
export const check_offer_validity_command = "check_offer_validity";
export type check_offer_validity_command = typeof check_offer_validity_command;
export type TCheckOfferValidityRequest = {
offer: str;
};
export type TCheckOfferValidityResponse = {
valid: bool;
id: bytes32;
};
export type WsCheckOfferValidityMessage = GetMessageType<cactus_wallet_service, check_offer_validity_command, TCheckOfferValidityResponse>;
export async function check_offer_validity<T extends TRPCAgent | TDaemon>(agent: T, data: TCheckOfferValidityRequest){
type R = ResType<T, TCheckOfferValidityResponse, WsCheckOfferValidityMessage>;
return agent.sendMessage<R>(cactus_wallet_service, check_offer_validity_command, data);
}
export const take_offer_command = "take_offer";
export type take_offer_command = typeof take_offer_command;
export type TTakeOfferRequest = {
offer: str;
fee?: uint64;
min_coin_amount?: uint64;
max_coin_amount?: uint64;
solver?: Record<str, any>;
reuse_puzhash?: bool;
};
export type TTakeOfferResponse = {
trade_record: TradeRecordConvenience;
};
export type WsTakeOfferMessage = GetMessageType<cactus_wallet_service, take_offer_command, TTakeOfferResponse>;
export async function take_offer<T extends TRPCAgent | TDaemon>(agent: T, data: TTakeOfferRequest){
type R = ResType<T, TTakeOfferResponse, WsTakeOfferMessage>;
return agent.sendMessage<R>(cactus_wallet_service, take_offer_command, data);
}
export const get_offer_command = "get_offer";
export type get_offer_command = typeof get_offer_command;
export type TGetOfferRequest = {
trade_id: str;
file_contents?: bool;
};
export type TGetOfferResponse = {
trade_record: TradeRecordConvenience;
offer: Optional<str>;
};
export type WsGetOfferMessage = GetMessageType<cactus_wallet_service, get_offer_command, TGetOfferResponse>;
export async function get_offer<T extends TRPCAgent | TDaemon>(agent: T, data: TGetOfferRequest){
type R = ResType<T, TGetOfferResponse, WsGetOfferMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_offer_command, data);
}
export const get_all_offers_command = "get_all_offers";
export type get_all_offers_command = typeof get_all_offers_command;
export type TGetAllOffersRequest = {
start?: int;
end?: int;
exclude_my_offers?: bool;
exclude_taken_offers?: bool;
include_completed?: bool;
sort_key?: str;
reverse?: bool;
file_contents?: bool;
};
export type TGetAllOffersResponse = {
trade_records: TradeRecordConvenience[];
offers: Optional<str[]>;
};
export type WsGetAllOffersMessage = GetMessageType<cactus_wallet_service, get_all_offers_command, TGetAllOffersResponse>;
export async function get_all_offers<T extends TRPCAgent | TDaemon>(agent: T, data: TGetAllOffersRequest){
type R = ResType<T, TGetAllOffersResponse, WsGetAllOffersMessage>;
return agent.sendMessage<R>(cactus_wallet_service, get_all_offers_command, data);
}
export const get_offers_count_command = "get_offers_count";
export type get_offers_count_command = typeof get_offers_count_command;
export type TGetOffersCountResponse = {
total: int;
my_offers_count: int;
taken_offers_count: int;
};
export type WsGetOffersCountMessage = Ge