It is possible to modify this object, but such modifications will not be
reflected outside the Node.js process, or (unless explicitly requested)
to other Worker threads.
In other words, the following example would not work:
Assigning a property on process.env will implicitly convert the value
to a string. This behavior is deprecated. Future versions of Node.js may
throw an error when the value is not a string, number, or boolean.
import { env } from'node:process';
env.test=null;
console.log(env.test);
// => 'null'
env.test=undefined;
console.log(env.test);
// => 'undefined'
Use delete to delete a property from process.env.
import { env } from'node:process';
env.TEST=1;
deleteenv.TEST;
console.log(env.TEST);
// => undefined
On Windows operating systems, environment variables are case-insensitive.
import { env } from'node:process';
env.TEST=1;
console.log(env.test);
// => 1
Unless explicitly specified when creating a Worker instance,
each Worker thread has its own copy of process.env, based on its
parent thread's process.env, or whatever was specified as the env option
to the Worker constructor. Changes to process.env will not be visible
across Worker threads, and only the main thread can make changes that
are visible to the operating system or to native add-ons. On Windows, a copy of process.env on a Worker instance operates in a case-sensitive manner
unlike the main thread.
@since ― v0.1.27
env["PRIVATE_KEY"]
if (!
constPRIVATE_KEY:string|undefined
PRIVATE_KEY) thrownew
varError:ErrorConstructor
new (message?:string, options?:ErrorOptions) =>Error (+1overload)
Error("Private key not found")
const
constaccount:DirectSecp256k1Wallet
account=await
classDirectSecp256k1Wallet
A wallet that holds a single secp256k1 keypair.
If you want to work with BIP39 mnemonics and multiple accounts, use DirectSecp256k1HdWallet.
Creates a DirectSecp256k1Wallet from the given private key
@param ― privkey The private key.
@param ― prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
fromKey(
varUint8Array:Uint8ArrayConstructor
A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
requested number of bytes could not be allocated an exception is raised.
It is possible to modify this object, but such modifications will not be
reflected outside the Node.js process, or (unless explicitly requested)
to other Worker threads.
In other words, the following example would not work:
Assigning a property on process.env will implicitly convert the value
to a string. This behavior is deprecated. Future versions of Node.js may
throw an error when the value is not a string, number, or boolean.
import { env } from'node:process';
env.test=null;
console.log(env.test);
// => 'null'
env.test=undefined;
console.log(env.test);
// => 'undefined'
Use delete to delete a property from process.env.
import { env } from'node:process';
env.TEST=1;
deleteenv.TEST;
console.log(env.TEST);
// => undefined
On Windows operating systems, environment variables are case-insensitive.
import { env } from'node:process';
env.TEST=1;
console.log(env.test);
// => 1
Unless explicitly specified when creating a Worker instance,
each Worker thread has its own copy of process.env, based on its
parent thread's process.env, or whatever was specified as the env option
to the Worker constructor. Changes to process.env will not be visible
across Worker threads, and only the main thread can make changes that
are visible to the operating system or to native add-ons. On Windows, a copy of process.env on a Worker instance operates in a case-sensitive manner
unlike the main thread.
@since ― v0.1.27
env["PRIVATE_KEY"]
if (!
constPRIVATE_KEY:string|undefined
PRIVATE_KEY) thrownew
varError:ErrorConstructor
new (message?:string, options?:ErrorOptions) =>Error (+1overload)
Creates a DirectSecp256k1Wallet from the given private key
@param ― privkey The private key.
@param ― prefix The bech32 address prefix (human readable part). Defaults to "cosmos".
fromKey(
varUint8Array:Uint8ArrayConstructor
A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
requested number of bytes could not be allocated an exception is raised.
You have the option to trigger the approval transaction manually by setting autoApprove to false then calling .approveTransaction before calling .transferAsset.
It is possible to modify this object, but such modifications will not be
reflected outside the Node.js process, or (unless explicitly requested)
to other Worker threads.
In other words, the following example would not work:
Assigning a property on process.env will implicitly convert the value
to a string. This behavior is deprecated. Future versions of Node.js may
throw an error when the value is not a string, number, or boolean.
import { env } from'node:process';
env.test=null;
console.log(env.test);
// => 'null'
env.test=undefined;
console.log(env.test);
// => 'undefined'
Use delete to delete a property from process.env.
import { env } from'node:process';
env.TEST=1;
deleteenv.TEST;
console.log(env.TEST);
// => undefined
On Windows operating systems, environment variables are case-insensitive.
import { env } from'node:process';
env.TEST=1;
console.log(env.test);
// => 1
Unless explicitly specified when creating a Worker instance,
each Worker thread has its own copy of process.env, based on its
parent thread's process.env, or whatever was specified as the env option
to the Worker constructor. Changes to process.env will not be visible
across Worker threads, and only the main thread can make changes that
are visible to the operating system or to native add-ons. On Windows, a copy of process.env on a Worker instance operates in a case-sensitive manner
unlike the main thread.
@since ― v0.1.27
env["PRIVATE_KEY"]
if (!
letPRIVATE_KEY:string|undefined
PRIVATE_KEY) thrownew
varError:ErrorConstructor
new (message?:string, options?:ErrorOptions) =>Error (+1overload)