@spirobel/monero-wallet-api 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ export declare function writeStagenetSpendViewKeysToDotEnv(spend_key?: string):
5
5
  export declare function writeRegtestSpendViewKeysToDotEnvTestLocal(spend_key?: string): Promise<string>;
6
6
  export declare function writeTestnetSpendViewKeysToDotEnvLocal(spend_key?: string): Promise<string>;
7
7
  export declare function writeWalletSecretsToDotEnv(wallet_secret: Uint8Array): Promise<string>;
8
+ export declare function writeViewKeyToDotEnv(primary_address: string, view_key: string): Promise<void>;
8
9
  export declare function writeEnvLineToDotEnvRefresh(key: string, value: string, path?: string): Promise<void>;
9
10
  export declare function writeEnvLineToDotEnv(key: string, value: string, path?: string): Promise<void>;
10
11
  export declare const STAGENET_FRESH_WALLET_HEIGHT_DEFAULT = 2014841;
@@ -44,6 +44,9 @@ export async function writeWalletSecretsToDotEnv(wallet_secret) {
44
44
  await writeEnvLineToDotEnvRefresh(`sk${primary_address}`, spend_key);
45
45
  return primary_address;
46
46
  }
47
+ export async function writeViewKeyToDotEnv(primary_address, view_key) {
48
+ return await writeEnvLineToDotEnvRefresh(`vk${primary_address}`, view_key);
49
+ }
47
50
  // this should be used in a web backend that does (non custodial) scanning
48
51
  // to add new view / spend keys, received from the users without a restart.
49
52
  export async function writeEnvLineToDotEnvRefresh(key, value, path = ".env") {
@@ -82,7 +82,7 @@ export declare function readWalletFromScanSettings(primary_address: string, scan
82
82
  export declare function readWalletsFromScanSettings(scan_settings_path?: string): Promise<ScanSettingOpened[]>;
83
83
  export declare function walletSettingsPlusKeys(wallet_settings: ScanSettingOpened, secret_view_key?: string, secret_spend_key?: string): Promise<{
84
84
  secret_view_key: string;
85
- secret_spend_key: string;
85
+ secret_spend_key: string | undefined;
86
86
  primary_address: string;
87
87
  start_height: number | null;
88
88
  node_url: string;
@@ -154,9 +154,6 @@ export async function walletSettingsPlusKeys(wallet_settings, secret_view_key, s
154
154
  wallet_settings.primary_address);
155
155
  if (!secret_spend_key)
156
156
  secret_spend_key = Bun.env[`sk${wallet_settings.primary_address}`];
157
- if (!secret_spend_key)
158
- throw ("no secret_spend_key provided and not found in env for address: " +
159
- wallet_settings.primary_address);
160
157
  return {
161
158
  ...wallet_settings,
162
159
  secret_view_key,