@kanalabs/aptos-smart-wallet
Version:
Typescript SDK to interact with the Aptos smart wallet
74 lines (73 loc) • 2.89 kB
TypeScript
import { AptosAccount, Provider } from 'aptos';
export type GetAptosWalletAddressResonse = {
vec: string[];
};
export interface WalletNetworkOptions {
network: string;
sponsor?: string;
}
export interface GetSmartWalletDetailsResponse {
type: string;
data: {
controller_address: string;
fee_payers: string[];
guardians: string[];
initialised_at: string;
signer_cap: {
account: string;
};
wallet_address: string;
};
}
export interface SmartWalletDetails {
controller_address: string;
wallet_address: string;
fee_payers: string[];
guardians: string[];
initialised_at: string;
}
export interface TokenBalanceResponse {
status: number;
data: TokenBalance[];
message: string;
}
export interface TokenBalance {
address: string;
balance: string;
symbol: string;
decimals: number;
name: string;
logoURI: string;
chainId: number;
coingeckoId: string;
usdPrice: number;
}
export interface TransactionResponse {
success: boolean;
status: string;
hash?: string;
}
export interface SmartWallet {
readonly address: string;
readonly controller: string;
readonly provider?: Provider;
readonly wallet?: AptosAccount;
readonly sponsor?: AptosAccount;
getWalletBalance(wallet: string): Promise<TokenBalance[]>;
getSmartWalletDetails(wallet: string): Promise<SmartWalletDetails>;
signMessage(message: string): Promise<string>;
computeAccountAddress(): Promise<string>;
getAccountAddress(controller: string): Promise<string>;
createAccount(seed: string, guardians: string[], feePayers: string[]): Promise<TransactionResponse>;
changeControllerAccount(walletAddress: string, newController: string): Promise<TransactionResponse>;
recoverAccount(walletAddress: string, newController: string): Promise<TransactionResponse>;
addAccountFeePayers(walletAddress: string, feePayers: string[]): Promise<TransactionResponse>;
removeAccountFeePayers(walletAddress: string, feePayers: string[]): Promise<TransactionResponse>;
addAccountGuardians(walletAddress: string, guardians: string[]): Promise<TransactionResponse>;
removeAccountGuardians(walletAddress: string, guardians: string[]): Promise<TransactionResponse>;
depositToAccount(walletAddress: string, coinType: string, amount: number): Promise<TransactionResponse>;
withdrawFromAccount(walletAddress: string, coinType: string, amount: number): Promise<TransactionResponse>;
transferFromAccount(walletAddress: string, coinType: string, amount: number): Promise<TransactionResponse>;
executeAptosFunction(wallAddress: string, coinTypes: string[], payload: any[]): Promise<TransactionResponse>;
createAccountSponsored(seed: string, guardians: string[], feePayers: string[]): Promise<TransactionResponse>;
}