Send parallel transactions
This quide explains how to send multiple parallel transactions. Note that you don’t need to send parallel transactions for batching calls. This is for sending new transactions when, for example, there’s already a transaction in the mempool for a certain account.
Prerequisites
- An Alchemy API Key
- A Gas Manager policy
- A signer to own the account and sign messages
nonceKey
override must fit into a uint152
!React
JavaScript
API
Use the useSendCalls
hook and the nonceOverride
capability parameter to send parallel userops. You can also use the usePrepareCalls
hook to only prepare the operation for signing.
You’ll need both ALCHEMY_API_KEY
and ALCHEMY_POLICY_ID
environment variables set to follow along!
import { import configconfig } from "@/app/config";
import {
function useSendCalls<TEntryPointVersion extends EntryPointVersion = keyof EntryPointRegistryBase<unknown>>(params: UseSendCallsParams): UseSendCallsResult<TEntryPointVersion>Hook for sending calls to a smart account or EOA wallet.
This hook provides functionality to execute calls on a smart account using Account Abstraction, or fall back to regular EOA transactions when connected to an EOA wallet. It handles the complete flow of preparing, signing, and sending calls.
If using this hook with an ERC-20 paymaster in pre-operation mode with autoPermit
, the contents of the permit will be hidden from the user. It is recommended to use the usePrepareCalls
hook instead to manually handle the permit signature.
useSendCalls,
function useSmartAccountClient<TChain extends Chain | undefined = Chain | undefined, TAccount extends SupportedAccountTypes | undefined = "ModularAccountV2">(args: UseSmartAccountClientProps<TChain, TAccount>): UseSmartAccountClientResult<TChain, SupportedAccount<TAccount extends undefined ? "ModularAccountV2" : TAccount>>useSmartAccountClient,
function useSmartWalletClient<TAccount extends Address | undefined = `0x${string}` | undefined>(params: GetSmartWalletClientParams<TAccount>): GetSmartWalletClientResult<TAccount>React hook that provides a Smart Wallet Client instance. Returns undefined if an EOA wallet is connected via wagmi, as Smart Wallet Clients are only for smart accounts. The hook automatically subscribes to changes in signer status and chain configuration.
useSmartWalletClient,
} from "@account-kit/react";
export default function function SendParallelCalls(): JSX.ElementSendParallelCalls() {
const { const client: {
account: ModularAccountV2<AlchemySigner>;
batch?: {
multicall?: boolean | Prettify<MulticallBatchOptions> | undefined;
} | undefined;
cacheTime: number;
ccipRead?: false | {
request?: (parameters: CcipRequestParameters) => Promise<CcipRequestReturnType>;
} | undefined;
chain: Chain | undefined;
experimental_blockTag?: BlockTag | undefined;
... 82 more ...;
extend: <const client extends {
...;
} & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>;
} | undefinedclient } = useSmartAccountClient<Chain | undefined, "ModularAccountV2">(args: UseSmartAccountClientProps<Chain | undefined, "ModularAccountV2">): UseSmartAccountClientResult<Chain | undefined, ModularAccountV2<AlchemySigner>>useSmartAccountClient({});
const { const sendCallsAsync: UseMutateAsyncFunction<MutationResult<keyof EntryPointRegistryBase<unknown>>, Error, {
calls: {
data?: `0x${string}` | undefined;
value?: `0x${string}` | undefined;
to: `0x${string}`;
}[];
capabilities?: {
eip7702Auth?: true | {
account?: `0x${string}` | undefined;
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
} | undefined;
permissions?: {
context: `0x${string}`;
} | {
signature: `0x${string}`;
sessionId: `0x${string}`;
} | undefined;
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
...;
} & ({
...;
} | ... 1 more ... | {})) | undefined;
}) | undefined;
gasParamsOverride?: {
...;
} | undefined;
nonceOverride?: {
...;
} | undefined;
} | undefined;
paymasterPermitSignature?: {
...;
} | ... 1 more ... | undefined;
from?: never | undefined;
}, unknown>sendCallsAsync } = useSendCalls<keyof EntryPointRegistryBase<unknown>>(params: UseSendCallsParams): UseSendCallsResult<keyof EntryPointRegistryBase<unknown>>Hook for sending calls to a smart account or EOA wallet.
This hook provides functionality to execute calls on a smart account using Account Abstraction, or fall back to regular EOA transactions when connected to an EOA wallet. It handles the complete flow of preparing, signing, and sending calls.
If using this hook with an ERC-20 paymaster in pre-operation mode with autoPermit
, the contents of the permit will be hidden from the user. It is recommended to use the usePrepareCalls
hook instead to manually handle the permit signature.
useSendCalls({ client: {
account: SupportedAccounts;
batch?: {
multicall?: boolean | Prettify<MulticallBatchOptions> | undefined;
} | undefined;
cacheTime: number;
ccipRead?: false | {
request?: (parameters: CcipRequestParameters) => Promise<CcipRequestReturnType>;
} | undefined;
chain: Chain | undefined;
experimental_blockTag?: BlockTag | undefined;
key: string;
... 81 more ...;
extend: <const client extends {
...;
} & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>;
} | {
...;
} | {
...;
} | {
...;
} | undefinedclient });
const const walletClient: GetSmartWalletClientResult<`0x${string}`>walletClient = useSmartWalletClient<`0x${string}`>(params: GetSmartWalletClientParams<`0x${string}`>): GetSmartWalletClientResult<`0x${string}`>React hook that provides a Smart Wallet Client instance. Returns undefined if an EOA wallet is connected via wagmi, as Smart Wallet Clients are only for smart accounts. The hook automatically subscribes to changes in signer status and chain configuration.
useSmartWalletClient({
account?: `0x${string}` | undefinedaccount: const client: {
account: ModularAccountV2<AlchemySigner>;
batch?: {
multicall?: boolean | Prettify<MulticallBatchOptions> | undefined;
} | undefined;
cacheTime: number;
ccipRead?: false | {
request?: (parameters: CcipRequestParameters) => Promise<CcipRequestReturnType>;
} | undefined;
chain: Chain | undefined;
experimental_blockTag?: BlockTag | undefined;
... 82 more ...;
extend: <const client extends {
...;
} & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>;
} | undefinedclient?.account: ModularAccountV2<AlchemySigner>The Account of the Client.
account.address: `0x${string}` | undefinedaddress,
});
const const handleSend: () => Promise<void>handleSend = async () => {
if (!const client: {
account: ModularAccountV2<AlchemySigner>;
batch?: {
multicall?: boolean | Prettify<MulticallBatchOptions> | undefined;
} | undefined;
cacheTime: number;
ccipRead?: false | {
request?: (parameters: CcipRequestParameters) => Promise<CcipRequestReturnType>;
} | undefined;
chain: Chain | undefined;
experimental_blockTag?: BlockTag | undefined;
... 82 more ...;
extend: <const client extends {
...;
} & ExactPartial<...>>(fn: (client: Client<...>) => client) => Client<...>;
} | undefinedclient) {
throw new var Error: ErrorConstructor
new (message?: string) => ErrorError("Smart account client not connected");
}
if (!const walletClient: GetSmartWalletClientResult<`0x${string}`>walletClient) {
throw new var Error: ErrorConstructor
new (message?: string) => ErrorError("Smart wallet client not connected");
}
try {
const [{ ids: `0x${string}`[]ids: const idsOne: `0x${string}`[]idsOne }, { ids: `0x${string}`[]ids: const idsTwo: `0x${string}`[]idsTwo }] = await var Promise: PromiseConstructorRepresents the completion of an asynchronous operation
Promise.PromiseConstructor.all<[Promise<MutationResult<keyof EntryPointRegistryBase<unknown>>>, Promise<MutationResult<keyof EntryPointRegistryBase<unknown>>>]>(values: [Promise<MutationResult<keyof EntryPointRegistryBase<unknown>>>, Promise<MutationResult<keyof EntryPointRegistryBase<unknown>>>]): Promise<[MutationResult<keyof EntryPointRegistryBase<unknown>>, MutationResult<...>]> (+1 overload)Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
all([
const sendCallsAsync: (variables: {
calls: {
data?: `0x${string}` | undefined;
value?: `0x${string}` | undefined;
to: `0x${string}`;
}[];
capabilities?: {
eip7702Auth?: true | {
account?: `0x${string}` | undefined;
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
} | undefined;
permissions?: {
context: `0x${string}`;
} | {
signature: `0x${string}`;
sessionId: `0x${string}`;
} | undefined;
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
maxTokenAmount?: `0x${string}` | undefined;
tokenAddress: `0x${string}`;
} & ({
preOpSettings: {
autoPermit: {
...;
};
} | {
...;
};
} | {
...;
} | {})) | undefined;
}) | undefined;
gasParamsOverride?: {
...;
} | undefined;
nonceOverride?: {
...;
} | undefined;
} | undefined;
paymasterPermitSignature?: {
...;
} | ... 1 more ... | undefined;
from?: never | undefined;
}, options?: MutateOptions<...> | undefined) => Promise<...>sendCallsAsync({
capabilities?: {
eip7702Auth?: true | {
account?: `0x${string}` | undefined;
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
} | undefined;
permissions?: {
context: `0x${string}`;
} | {
signature: `0x${string}`;
sessionId: `0x${string}`;
} | undefined;
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
...;
} & ({
...;
} | ... 1 more ... | {})) | undefined;
}) | undefined;
gasParamsOverride?: {
...;
} | undefined;
nonceOverride?: {
...;
} | undefined;
} | undefinedcapabilities: {
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
...;
} & ({
...;
} | ... 1 more ... | {})) | undefined;
}) | undefinedpaymasterService: {
policyId: stringpolicyId: import configconfig.anypolicyId,
},
nonceOverride?: {
nonceKey: `0x${string}`;
} | undefinednonceOverride: {
nonceKey: `0x${string}`nonceKey: "0x01",
},
},
calls: {
data?: `0x${string}` | undefined;
value?: `0x${string}` | undefined;
to: `0x${string}`;
}[]calls: [
{
to: `0x${string}`to: "0x0000000000000000000000000000000000000000",
value?: `0x${string}` | undefinedvalue: "0x00",
data?: `0x${string}` | undefineddata: "0x",
},
],
}),
const sendCallsAsync: (variables: {
calls: {
data?: `0x${string}` | undefined;
value?: `0x${string}` | undefined;
to: `0x${string}`;
}[];
capabilities?: {
eip7702Auth?: true | {
account?: `0x${string}` | undefined;
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
} | undefined;
permissions?: {
context: `0x${string}`;
} | {
signature: `0x${string}`;
sessionId: `0x${string}`;
} | undefined;
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
maxTokenAmount?: `0x${string}` | undefined;
tokenAddress: `0x${string}`;
} & ({
preOpSettings: {
autoPermit: {
...;
};
} | {
...;
};
} | {
...;
} | {})) | undefined;
}) | undefined;
gasParamsOverride?: {
...;
} | undefined;
nonceOverride?: {
...;
} | undefined;
} | undefined;
paymasterPermitSignature?: {
...;
} | ... 1 more ... | undefined;
from?: never | undefined;
}, options?: MutateOptions<...> | undefined) => Promise<...>sendCallsAsync({
capabilities?: {
eip7702Auth?: true | {
account?: `0x${string}` | undefined;
delegation: "ModularAccountV2" | "0x69007702764179f14F51cdce752f4f775d74E139";
} | undefined;
permissions?: {
context: `0x${string}`;
} | {
signature: `0x${string}`;
sessionId: `0x${string}`;
} | undefined;
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
...;
} & ({
...;
} | ... 1 more ... | {})) | undefined;
}) | undefined;
gasParamsOverride?: {
...;
} | undefined;
nonceOverride?: {
...;
} | undefined;
} | undefinedcapabilities: {
paymasterService?: (({
policyId: string;
} | {
policyIds: string[];
}) & {
onlyEstimation?: boolean | undefined;
erc20?: ({
...;
} & ({
...;
} | ... 1 more ... | {})) | undefined;
}) | undefinedpaymasterService: {
policyId: stringpolicyId: import configconfig.anypolicyId,
},
nonceOverride?: {
nonceKey: `0x${string}`;
} | undefinednonceOverride: {
nonceKey: `0x${string}`nonceKey: "0x02",
},
},
calls: {
data?: `0x${string}` | undefined;
value?: `0x${string}` | undefined;
to: `0x${string}`;
}[]calls: [
{
to: `0x${string}`to: "0x0000000000000000000000000000000000000000",
value?: `0x${string}` | undefinedvalue: "0x00",
data?: `0x${string}` | undefineddata: "0x",
},
],
}),
]);
var console: ConsoleThe console
module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A
Console
class with methods such as console.log()
, console.error()
and console.warn()
that can be used to write to any Node.js stream. * A global console
instance configured to write to process.stdout
and process.stderr
. The global console
can be used without importing the node:console
module.
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O
for more information.
Example using the global console
:
const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```
Example using the `Console` class:
```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);
myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console.Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)Prints to stdout
with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3)
(the arguments are all passed to util.format()
).
js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout
See util.format()
for more information.
log("id of sent call one: ", const idsOne: `0x${string}`[]idsOne);
var console: ConsoleThe console
module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A
Console
class with methods such as console.log()
, console.error()
and console.warn()
that can be used to write to any Node.js stream. * A global console
instance configured to write to process.stdout
and process.stderr
. The global console
can be used without importing the node:console
module.
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O
for more information.
Example using the global console
:
const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```
Example using the `Console` class:
```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);
myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console.Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)Prints to stdout
with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3)
(the arguments are all passed to util.format()
).
js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout
See util.format()
for more information.
log("id of sent call two: ", const idsTwo: `0x${string}`[]idsTwo);
const const result: [{
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}, {
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}]result = await var Promise: PromiseConstructorRepresents the completion of an asynchronous operation
Promise.PromiseConstructor.all<[Promise<{
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}>, Promise<{
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}>]>(values: [...]): Promise<...> (+1 overload)Creates a Promise that is resolved with an array of results when all of the provided Promises resolve, or rejected when any Promise is rejected.
all([
const walletClient: SmartWalletClient<`0x${string}`>walletClient.waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>waitForCallsStatus({ id: stringThe id of the call batch to wait for.
id: const idsOne: `0x${string}`[]idsOne[0]! }),
const walletClient: SmartWalletClient<`0x${string}`>walletClient.waitForCallsStatus: (params: WaitForCallsStatusParameters) => Promise<WaitForCallsStatusReturnType>waitForCallsStatus({ id: stringThe id of the call batch to wait for.
id: const idsTwo: `0x${string}`[]idsTwo[0]! }),
]);
var console: ConsoleThe console
module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A
Console
class with methods such as console.log()
, console.error()
and console.warn()
that can be used to write to any Node.js stream. * A global console
instance configured to write to process.stdout
and process.stderr
. The global console
can be used without importing the node:console
module.
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O
for more information.
Example using the global console
:
const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```
Example using the `Console` class:
```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);
myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console.Console.log(message?: any, ...optionalParams: any[]): void (+2 overloads)Prints to stdout
with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3)
(the arguments are all passed to util.format()
).
js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout
See util.format()
for more information.
log(const result: [{
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}, {
id: string;
chainId: number;
capabilities?: {
[key: string]: any;
} | {
[x: string]: any;
} | undefined;
atomic: boolean;
receipts?: WalletCallReceipt<bigint, "success" | "reverted">[] | undefined;
version: string;
statusCode: number;
status: "pending" | "success" | "failure" | undefined;
}]result);
} catch (function (local var) error: unknownerror) {
var console: ConsoleThe console
module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers.
The module exports two specific components:
- A
Console
class with methods such as console.log()
, console.error()
and console.warn()
that can be used to write to any Node.js stream. * A global console
instance configured to write to process.stdout
and process.stderr
. The global console
can be used without importing the node:console
module.
Warning: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the note on process I/O
for more information.
Example using the global console
:
const name = 'Will Robinson'; console.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ```
Example using the `Console` class:
```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err);
myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err
const name = 'Will Robinson'; myConsole.warn(`Danger $name! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```
console.Console.error(message?: any, ...optionalParams: any[]): void (+2 overloads)Prints to stderr
with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to printf(3)
(the arguments are all passed to util.format()
).
js const code = 5; console.error('error #%d', code); // Prints: error #5, to stderr console.error('error', code); // Prints: error 5, to stderr
If formatting elements (e.g. %d
) are not found in the first string then util.inspect()
is called on each argument and the resulting string values are concatenated. See util.format()
for more information.
error(function (local var) error: unknownerror);
}
};
return <React.JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>button React.DOMAttributes<HTMLButtonElement>.onClick?: React.MouseEventHandler<HTMLButtonElement> | undefinedonClick={const handleSend: () => Promise<void>handleSend}>Click to Send</React.JSX.IntrinsicElements.button: React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>button>;
}
export const const config: {
alchemyApiKey: string;
policyId: string;
}config = {
alchemyApiKey: stringalchemyApiKey: var process: NodeJS.Processprocess.NodeJS.Process.env: NodeJS.ProcessEnvThe process.env
property returns an object containing the user environment. See environ(7)
.
An example of this object looks like:
jsTERM: 'xterm-256color', SHELL: '/usr/local/bin/bash', USER: 'maciej', PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', PWD: '/Users/maciej', EDITOR: 'vim', SHLVL: '1', HOME: '/Users/maciej', LOGNAME: 'maciej', _: '/usr/local/bin/node'
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:
bash node -e 'process.env.foo = "bar"' && echo $foo
While the following will:
env.foo = 'bar'; console.log(env.foo); ```
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.
```js 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`.
```js import env from 'node:process';
env.TEST = 1; delete env.TEST; console.log(env.TEST); // => undefined ```
On Windows operating systems, environment variables are case-insensitive.
```js 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.
env.string | undefinedALCHEMY_API_KEY!,
policyId: stringpolicyId: var process: NodeJS.Processprocess.NodeJS.Process.env: NodeJS.ProcessEnvThe process.env
property returns an object containing the user environment. See environ(7)
.
An example of this object looks like:
jsTERM: 'xterm-256color', SHELL: '/usr/local/bin/bash', USER: 'maciej', PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', PWD: '/Users/maciej', EDITOR: 'vim', SHLVL: '1', HOME: '/Users/maciej', LOGNAME: 'maciej', _: '/usr/local/bin/node'
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:
bash node -e 'process.env.foo = "bar"' && echo $foo
While the following will:
env.foo = 'bar'; console.log(env.foo); ```
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.
```js 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`.
```js import env from 'node:process';
env.TEST = 1; delete env.TEST; console.log(env.TEST); // => undefined ```
On Windows operating systems, environment variables are case-insensitive.
```js 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.
env.string | undefinedALCHEMY_POLICY_ID!,
};