accounts
Version:
Tempo Accounts SDK
32 lines • 1.17 kB
JavaScript
import * as CoreProvider from '../core/Provider.js';
import { cli } from './adapter.js';
import * as Storage from './storage.js';
/**
* Creates a provider that bootstraps access-key authorization through the CLI
* device-code flow.
*/
export function create(options) {
const { host = 'https://wallet.tempo.xyz/api/auth/device', name, open, pollingInterval, rdns, storage = Storage.filesystem(), timeout, ...rest } = options;
// CLI defaults `mode` to `'pull'` (local account friendly path).
const mpp = (() => {
if (!options.mpp)
return undefined;
if (typeof options.mpp === 'object')
return { mode: 'pull', ...options.mpp };
return { mode: 'pull' };
})();
return CoreProvider.create({
...rest,
adapter: cli({
host,
...(name ? { name } : {}),
...(open ? { open } : {}),
...(pollingInterval !== undefined ? { pollingInterval } : {}),
...(rdns ? { rdns } : {}),
...(timeout !== undefined ? { timeout } : {}),
}),
...(mpp ? { mpp } : {}),
storage,
});
}
//# sourceMappingURL=Provider.js.map