export type CreateApiApiV2SolanaTransactionsSPLArgs = {'X-Network'?: ('testnet' | 'mainnet') | undefined, Authorization: string, 'Content-Type': 'application/json' | 'application/x-www-form-urlencoded' | 'multipart/form-data', body: {from: string, to: string, contractaddress: string, amount: number, privatekey: string}}; export type CreateApiApiV2SolanaTransactionsSPLOptions = {baseUrl?: string | undefined, defaultValue?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create SPL Token Transaction * * POST /api/v2/solana/transactions/SPL */ export const createApiApiV2SolanaTransactionsSPL = async (args: CreateApiApiV2SolanaTransactionsSPLArgs, options?: CreateApiApiV2SolanaTransactionsSPLOptions) => { const {baseUrl = "https://app.chaingateway.io", fetch: fetchFn = fetch, defaultValue} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['X-Network'] != null) headers.set("X-Network", String(args['X-Network'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (defaultValue !== undefined) headers.set('authorization', `Bearer ${defaultValue}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/solana/transactions/SPL${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };