Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types #78

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 29 additions & 21 deletions src/request/types/stxMethods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ interface Memo {

interface TxId {
/**
* The transaction ID of the transfer STX transaction as a hex-encoded string.
* The ID of the transaction.
*/
txid: string;
}

interface Transaction {
/**
* An STX transaction as a hex-encoded string.
* A Stacks transaction as a hex-encoded string.
*/
transaction: string;
}
Expand Down Expand Up @@ -196,58 +196,66 @@ export interface CallContractParams {
*/
arguments?: Array<string>;
}
type CallContractResult = TxId & Transaction;
export type CallContractResult = TxId & Transaction;
export type StxCallContract = MethodParamsAndResult<CallContractParams, CallContractResult>;

// Types for `stx_transferStx` request
type TransferStxParams = Amount &
export type TransferStxParams = Amount &
Recipient &
Partial<Memo> &
Partial<ParameterFormatVersion> &
Partial<PostConditionMode> &
Partial<PostConditions> &
Partial<Pubkey>;
type TransferStxResult = TxId & Transaction;
export type TransferStxResult = TxId & Transaction;
export type StxTransferStx = MethodParamsAndResult<TransferStxParams, TransferStxResult>;

// Types for `stx_signMessage` request
type SignStxMessageParams = Message & Partial<Pubkey> & Partial<ParameterFormatVersion>;
type SignStxMessageResult = Signature & PublicKey;
export type SignStxMessageParams = Message & Partial<Pubkey> & Partial<ParameterFormatVersion>;
export type SignStxMessageResult = Signature & PublicKey;
export type StxSignStxMessage = MethodParamsAndResult<SignStxMessageParams, SignStxMessageResult>;

// Types for `stx_signStructuredMessage` request
type SignStructuredMessageParams = Domain &
Message &
Partial<ParameterFormatVersion> &
Partial<Pubkey>;
type SignStructuredMessageResult = Signature & PublicKey;
export type SignStructuredMessageResult = Signature & PublicKey;
export type StxSignStructuredMessage = MethodParamsAndResult<
SignStructuredMessageParams,
SignStructuredMessageResult
>;

// Types for `stx_deployContract` request
type DeployContractParams = CodeBody &
ContractName &
Sponsored &
Partial<ClarityVersion> &
Partial<ParameterFormatVersion> &
Partial<PostConditionMode> &
Partial<PostConditions> &
Partial<Pubkey>;
type DeployContractResult = TxId & Transaction;
export interface DeployContractParams {
/**
* Name of the contract.
*/
name: string;

/**
* The code of the Clarity contract.
*/
clarityCode: string;

/**
* The version of the Clarity contract.
*/
clarityVersion?: string;
}
export type DeployContractResult = TxId & Transaction;
export type StxDeployContract = MethodParamsAndResult<DeployContractParams, DeployContractResult>;

// Types for `stx_getAccounts` request
type GetAccountsParams = {};
type GetAccountsResult = {
export type GetAccountsParams = {};
export type GetAccountsResult = {
addresses: Array<Address & PublicKey & { gaiaHubUrl: string; gaiaAppKey: string }>;
};
export type StxGetAccounts = MethodParamsAndResult<GetAccountsParams, GetAccountsResult>;

// Types for `stx_getAddresses` request
type GetAddressesParams = {};
type GetAddressesResult = {
export type GetAddressesParams = undefined | null;
export type GetAddressesResult = {
addresses: Array<Address & PublicKey>;
};
export type StxGetAddresses = MethodParamsAndResult<GetAddressesParams, GetAddressesResult>;
Expand Down
Loading