Skip to main content

Function: externalDeploymentMessage()

function externalDeploymentMessage(data, chainId): ExternalMessageEnvelope

Creates a new external deployment message.

Parameters

ParameterTypeDescription

data

IDeployData

The message data.

chainId

number

The chain ID.

Returns

ExternalMessageEnvelope

The envelope of the external deployment message.

Example

import {
Faucet,
LocalECDSAKeySigner,
HttpTransport,
PublicClient
WalletV1,
externalDeploymentMessage,
generateRandomPrivateKey,
} from '@nilfoundation/niljs';
const signer = new LocalECDSAKeySigner({
privateKey: generateRandomPrivateKey(),
});

const pubkey = signer.getPublicKey();
const chainId = await client.chainId();
const deploymentMessage = externalDeploymentMessage(
{
salt: 100n,
shard: 1,
bytecode: WalletV1.code,
abi: WalletV1.abi,
args: [bytesToHex(pubkey)],
},
chainId,
);

Defined

@nilfoundation/niljs/src/encoding/externalMessage.ts:237