arweave-multihost
Version:
JavaScript/TypeScript Arweave SDK with multiple host support
34 lines (33 loc) • 1.03 kB
TypeScript
import Arweave from "arweave";
interface HostConfig {
host: string;
port: number;
protocol: string;
}
interface AdditionalArweaveConfig {
timeout: number;
logging: boolean;
logger?: (...arg: any) => any;
onError?: (...arg: any) => any;
}
/**
* Returns overrriden arweave instance
* @param hosts - Array of hosts
* @param config - Other configuration options
* (timeout, logging, logger, onError callback)
* @returns arweave instance
*/
declare function init(hosts: HostConfig[], config?: AdditionalArweaveConfig): Arweave;
/**
* Returns overrriden arweave instance with default hosts
* (arweave.net, gateway.amplify.host, arweave.dev)
* @param config - Other configuration options
* (timeout, logging, logger, onError callback)
* @returns arweave instance
*/
declare function initWithDefaultHosts(config: AdditionalArweaveConfig): Arweave;
declare const _default: {
init: typeof init;
initWithDefaultHosts: typeof initWithDefaultHosts;
};
export = _default;