Skip to main content

Function: externalDeploymentTransaction()

function externalDeploymentTransaction(data, maybeChainId?): ExternalTransactionEnvelope

Creates a new external deployment transaction.

Parameters

ParameterTypeDescription

data

IDeployData

The transaction data.

maybeChainId?

number

Returns

ExternalTransactionEnvelope

The envelope of the external deployment transaction.

Example

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

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

Defined

@nilfoundation/niljs/src/encoding/externalTransaction.ts:276