Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (pvm, avm, info) CP-9758 cleanup. WIP #958

Merged
merged 8 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/p-chain/etna/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const main = async () => {

const { utxos } = await pvmApi.getUTXOs({ addresses: [P_CHAIN_ADDRESS] });

const tx = pvm.e.newBaseTx(
const tx = pvm.newBaseTx(
{
feeState,
fromAddressesBytes: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/convertSubnetToL1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const convertSubnetToL1TxExample = async () => {
pChainOwner,
);

const tx = pvm.e.newConvertSubnetToL1Tx(
const tx = pvm.newConvertSubnetToL1Tx(
{
feeState,
fromAddressesBytes: [testPAddr],
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/createChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const createChainTxExample = async () => {
const vmId = 'rWhpuQPF1kb72esV2momhMuTYGkEb1oL29pt2EBXWmSy4kxnT'; // platform vmId
const subnetId = ''; // subnetId from createSubnetTx

const tx = pvm.e.newCreateChainTx(
const tx = pvm.newCreateChainTx(
{
feeState,
fromAddressesBytes: [testPAddr],
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/createSubnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const createSubnetTxExample = async () => {

const testPAddr = utils.bech32ToBytes(P_CHAIN_ADDRESS);

const tx = pvm.e.newCreateSubnetTx(
const tx = pvm.newCreateSubnetTx(
{
feeState,
fromAddressesBytes: [testPAddr],
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const main = async () => {
// TODO: Get this from an argument.
const nodeId = 'NodeID-MqgFXT8JhorbEW2LpTDGePBBhv55SSp3M';

const tx = pvm.e.newAddPermissionlessDelegatorTx(
const tx = pvm.newAddPermissionlessDelegatorTx(
{
end,
feeState,
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const main = async () => {
addresses: [P_CHAIN_ADDRESS],
});

const exportTx = pvm.e.newExportTx(
const exportTx = pvm.newExportTx(
{
destinationChainId: context.xBlockchainID,
feeState,
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const main = async () => {
addresses: [P_CHAIN_ADDRESS],
});

const importTx = pvm.e.newImportTx(
const importTx = pvm.newImportTx(
{
feeState,
fromAddressesBytes: [utils.bech32ToBytes(X_CHAIN_ADDRESS)],
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/increaseBalanceTx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const increaseBalanceTx = async () => {

const testPAddr = utils.bech32ToBytes(P_CHAIN_ADDRESS);

const unsignedTx = pvm.e.newIncreaseL1ValidatorBalanceTx(
const unsignedTx = pvm.newIncreaseL1ValidatorBalanceTx(
{
balance: BigInt(BALANCE_AVAX * 1e9),
feeState,
Expand Down
2 changes: 1 addition & 1 deletion examples/p-chain/etna/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const main = async () => {

const signature = utils.hexToBuffer(BLS_SIGNATURE);

const tx = pvm.e.newAddPermissionlessValidatorTx(
const tx = pvm.newAddPermissionlessValidatorTx(
{
end,
delegatorRewardsOwner: [utils.bech32ToBytes(P_CHAIN_ADDRESS)],
Expand Down
7 changes: 0 additions & 7 deletions src/fixtures/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ export const testContext: Context = {
avaxAssetID: 'FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z',
baseTxFee: 1000000n,
createAssetTxFee: 10000000n,
createSubnetTxFee: 1000000000n,
transformSubnetTxFee: 10000000000n,
createBlockchainTxFee: 1000000000n,
addPrimaryNetworkValidatorFee: 0n,
addPrimaryNetworkDelegatorFee: 0n,
addSubnetValidatorFee: 1000000n,
addSubnetDelegatorFee: 1000000n,
networkID: 1,
hrp: 'avax',
platformFeeConfig: {
Expand Down
19 changes: 0 additions & 19 deletions src/info/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import type {
GetNodeIpResponse,
GetNodeVersionReply,
GetPeersResponse,
GetTxFeeResponse,
isBootstrapped,
UptimeResponse,
GetUpgradesInfoResponse,
Expand Down Expand Up @@ -50,24 +49,6 @@ export class InfoApi extends Api {
isBootstrapped(chain: string): Promise<isBootstrapped> {
return this.callRpc<isBootstrapped>('peers', { chain });
}
/**
* @link https://docs.avax.network/apis/avalanchego/apis/info#infogettxfee
*/
async getTxFee(): Promise<GetTxFeeResponse> {
const resp = await this.callRpc<GetTxFeeResponse>('getTxFee');

return {
txFee: BigInt(resp.txFee),
createAssetTxFee: BigInt(resp.createAssetTxFee),
createSubnetTxFee: BigInt(resp.createSubnetTxFee),
transformSubnetTxFee: BigInt(resp.transformSubnetTxFee),
createBlockchainTxFee: BigInt(resp.createBlockchainTxFee),
addPrimaryNetworkValidatorFee: BigInt(resp.addPrimaryNetworkValidatorFee),
addPrimaryNetworkDelegatorFee: BigInt(resp.addPrimaryNetworkDelegatorFee),
addSubnetValidatorFee: BigInt(resp.addSubnetValidatorFee),
addSubnetDelegatorFee: BigInt(resp.addSubnetDelegatorFee),
};
}

uptime(): Promise<UptimeResponse> {
return this.callRpc<UptimeResponse>('uptime');
Expand Down
20 changes: 0 additions & 20 deletions src/info/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,6 @@ export type GetPeersResponse = {
peers: Peer[];
};

export type GetTxFeeApiResponse = {
txFee: string;
creationTxFee: string;
createAssetTxFee: string;
createSubnetTxFee: string;
createBlockchainTxFee: string;
};

export type GetTxFeeResponse = {
txFee: bigint;
createAssetTxFee: bigint;
createSubnetTxFee: bigint;
transformSubnetTxFee: bigint;
createBlockchainTxFee: bigint;
addPrimaryNetworkValidatorFee: bigint;
addPrimaryNetworkDelegatorFee: bigint;
addSubnetValidatorFee: bigint;
addSubnetDelegatorFee: bigint;
};

export type UptimeResponse = {
rewardingStakePercentage: string;
weightedAveragePercentage: string;
Expand Down
Loading