mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
36 lines
877 B
TypeScript
36 lines
877 B
TypeScript
import { Effects } from "../types";
|
|
import { AddressReceipt } from "./AddressReceipt";
|
|
import { Origin } from "./Origin";
|
|
|
|
export class NetworkInterfaceBuilder {
|
|
constructor(
|
|
readonly options: {
|
|
effects: Effects;
|
|
name: string;
|
|
id: string;
|
|
description: string;
|
|
ui: boolean;
|
|
basic?: null | { password: string; username: string };
|
|
path?: string;
|
|
search?: Record<string, string>;
|
|
},
|
|
) {}
|
|
|
|
async exportAddresses(addresses: Iterable<Origin>) {
|
|
const { name, description, id, ui, path, search } = this.options;
|
|
for (const origin of addresses) {
|
|
const address = origin.withAuth(this.options.basic);
|
|
await this.options.effects.exportAddress({
|
|
name,
|
|
description,
|
|
address,
|
|
id,
|
|
ui,
|
|
path,
|
|
search,
|
|
});
|
|
}
|
|
return {} as AddressReceipt;
|
|
}
|
|
}
|