Skip to content

Commit 2ec0263

Browse files
committed
docs: update etna examples
1 parent a18fbff commit 2ec0263

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

cspell.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,14 @@
1919
"ignoreRegExpList": ["/.*[0-9].*/"],
2020
"language": "en",
2121
"minWordLength": 5,
22-
"words": ["amounter", "avalabs", "locktime", "stakeable", "unstakeable", "utxo", "utxos"]
22+
"words": [
23+
"amounter",
24+
"avalabs",
25+
"locktime",
26+
"permissioned",
27+
"stakeable",
28+
"unstakeable",
29+
"utxo",
30+
"utxos"
31+
]
2332
}

examples/p-chain/etna/convertSubnet.ts renamed to examples/p-chain/etna/convertSubnetToL1.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import { addTxSignatures, pvm, utils } from '../../../src';
1+
import {
2+
L1Validator,
3+
PChainOwner,
4+
addTxSignatures,
5+
pvm,
6+
pvmSerial,
7+
utils,
8+
} from '../../../src';
29
import { 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';
610
import { getEnvVars } from '../../utils/getEnvVars';
711

812
const AMOUNT_TO_VALIDATE_AVAX: number = 1;
913
const 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);

examples/p-chain/etna/increaseBalanceTx.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const increaseBalanceTx = async () => {
1313

1414
const testPAddr = utils.bech32ToBytes(P_CHAIN_ADDRESS);
1515

16-
const unsignedTx = pvm.e.newIncreaseBalanceTx(
16+
const unsignedTx = pvm.e.newIncreaseL1ValidatorBalanceTx(
1717
{
1818
balance: BigInt(BALANCE_AVAX * 1e9),
1919
feeState,

0 commit comments

Comments
 (0)