export type CreateApiUserAddressWalletRpcArgs = {address: string, Authorization: string}; export type CreateApiUserAddressWalletRpcOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * RPC proxy * * POST /user/{address}/wallet/rpc */ export const createApiUserAddressWalletRpc = async (args: CreateApiUserAddressWalletRpcArgs, options?: CreateApiUserAddressWalletRpcOptions) => { const {baseUrl = "https://api.unstoppabledomains.com/profile", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/user/${encodeURIComponent(String(args.address))}/wallet/rpc${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };