1- import { addTxSignatures , pvm , utils } from '../../../src' ;
1+ import {
2+ L1Validator ,
3+ PChainOwner ,
4+ addTxSignatures ,
5+ pvm ,
6+ pvmSerial ,
7+ utils ,
8+ } from '../../../src' ;
29import { setupEtnaExample } from './utils/etna-helper' ;
3- import { ConvertSubnetValidator } from '../../../src/serializable/fxs/pvm/convertSubnetValidator' ;
4- import { ProofOfPossession } from '../../../src/serializable/pvm' ;
5- import { PChainOwner } from '../../../src/serializable/fxs/pvm/pChainOwner' ;
610import { getEnvVars } from '../../utils/getEnvVars' ;
711
812const AMOUNT_TO_VALIDATE_AVAX : number = 1 ;
913const BALANCE_AVAX : number = 1 ;
1014
1115/**
12- * Converts a subnet to permissionless subnet .
16+ * Converts a subnet to L1 .
1317 *
1418 * **Note** A subnet must be created (createSubnetTx) and a chain must be created (createChainTx)
1519 * before a subnet can be converted from permissioned to permissionless.
@@ -20,7 +24,7 @@ const BALANCE_AVAX: number = 1;
2024 * @param subnetId the ID of the subnet that is created via `createSubnetTx`.
2125 * @returns The resulting transaction's ID.
2226 */
23- const convertSubnetTxExample = async ( ) => {
27+ const convertSubnetToL1TxExample = async ( ) => {
2428 const {
2529 AVAX_PUBLIC_URL ,
2630 P_CHAIN_ADDRESS ,
@@ -41,9 +45,9 @@ const convertSubnetTxExample = async () => {
4145
4246 const signature = utils . hexToBuffer ( BLS_SIGNATURE ) ;
4347
44- const signer = new ProofOfPossession ( publicKey , signature ) ;
48+ const signer = new pvmSerial . ProofOfPossession ( publicKey , signature ) ;
4549
46- const validator = ConvertSubnetValidator . fromNative (
50+ const validator = L1Validator . fromNative (
4751 NODE_ID ,
4852 BigInt ( AMOUNT_TO_VALIDATE_AVAX * 1e9 ) ,
4953 BigInt ( BALANCE_AVAX * 1e9 ) ,
@@ -52,7 +56,7 @@ const convertSubnetTxExample = async () => {
5256 pChainOwner ,
5357 ) ;
5458
55- const tx = pvm . e . newConvertSubnetTx (
59+ const tx = pvm . e . newConvertSubnetToL1Tx (
5660 {
5761 feeState,
5862 fromAddressesBytes : [ testPAddr ] ,
@@ -74,4 +78,4 @@ const convertSubnetTxExample = async () => {
7478 return pvmApi . issueSignedTx ( tx . getSignedTx ( ) ) ;
7579} ;
7680
77- convertSubnetTxExample ( ) . then ( console . log ) ;
81+ convertSubnetToL1TxExample ( ) . then ( console . log ) ;
0 commit comments