@avalabs/core-wallets-sdk 3.1.0-alpha.8 → 3.1.0-canary.03cd702.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/index.d.ts +324 -45
  2. package/dist/index.js +1 -1
  3. package/esm/Avalanche/index.d.ts +2 -2
  4. package/esm/Avalanche/index.js +1 -1
  5. package/esm/Avalanche/models.d.ts +44 -5
  6. package/esm/Avalanche/models.js +1 -1
  7. package/esm/Avalanche/providers/AbstractProvider.d.ts +6 -2
  8. package/esm/Avalanche/providers/AbstractProvider.js +1 -1
  9. package/esm/Avalanche/providers/JsonRpcProvider.d.ts +5 -3
  10. package/esm/Avalanche/providers/JsonRpcProvider.js +1 -1
  11. package/esm/Avalanche/providers/constants.d.ts +20 -1
  12. package/esm/Avalanche/providers/constants.js +1 -1
  13. package/esm/Avalanche/providers/platformFeeConfig.js +1 -0
  14. package/esm/Avalanche/utils/convertGlacierUtxo.d.ts +3 -3
  15. package/esm/Avalanche/utils/getChainAliasByChainId.js +1 -1
  16. package/esm/Avalanche/utils/getPchainUnixNow.js +1 -1
  17. package/esm/Avalanche/utils/getUtxosByTxFromGlacier.d.ts +4 -2
  18. package/esm/Avalanche/utils/getUtxosByTxFromGlacier.js +1 -1
  19. package/esm/Avalanche/utils/handleSubnetAuth.js +1 -1
  20. package/esm/Avalanche/utils/parseAvalancheTx.d.ts +7 -1
  21. package/esm/Avalanche/utils/parseAvalancheTx.js +1 -1
  22. package/esm/Avalanche/utils/parsers/index.js +1 -1
  23. package/esm/Avalanche/utils/parsers/parseAddPermissionlessDelegatorTx.js +1 -1
  24. package/esm/Avalanche/utils/parsers/parseAddPermissionlessValidatorTx.js +1 -1
  25. package/esm/Avalanche/utils/parsers/parseConvertSubnetTx.js +1 -0
  26. package/esm/Avalanche/utils/parsers/parseDisableL1ValidatorTx.js +1 -0
  27. package/esm/Avalanche/utils/parsers/parseIncreaseL1ValidatorBalanceTx.js +1 -0
  28. package/esm/Avalanche/utils/parsers/parseRegisterL1ValidatorTx.js +1 -0
  29. package/esm/Avalanche/utils/parsers/parseSetL1ValidatorWeightTx.js +1 -0
  30. package/esm/Avalanche/utils/parsers/parseTransformSubnetTx.js +1 -1
  31. package/esm/Avalanche/utils/parsers/utils/chainIdToVm.js +1 -1
  32. package/esm/Avalanche/utils/sortUTXOs.d.ts +5 -4
  33. package/esm/Avalanche/utils/txSizeLimits.d.ts +9 -2
  34. package/esm/Avalanche/utils/txSizeLimits.js +1 -1
  35. package/esm/Avalanche/wallets/AddressWallet.js +1 -1
  36. package/esm/Avalanche/wallets/SimpleSigner.js +1 -1
  37. package/esm/Avalanche/wallets/StaticSigner.js +1 -1
  38. package/esm/Avalanche/wallets/TxBuilderTypes.d.ts +179 -0
  39. package/esm/Avalanche/wallets/WalletAbstract.d.ts +24 -18
  40. package/esm/Avalanche/wallets/WalletAbstract.js +1 -1
  41. package/esm/Avalanche/wallets/WalletVoid.js +1 -1
  42. package/esm/Avalanche/wallets/ledger/LedgerSigner.js +1 -1
  43. package/esm/Avalanche/wallets/ledger/SimpleLedgerSigner.js +1 -1
  44. package/esm/utils/assertFeeStateProvided.js +1 -0
  45. package/package.json +5 -5
package/dist/index.d.ts CHANGED
@@ -8,12 +8,15 @@ import { Provider, VoidSigner, HDNodeWallet, TransactionResponse, JsonRpcProvide
8
8
  import Transport from '@ledgerhq/hw-transport';
9
9
  import Eth from '@ledgerhq/hw-app-eth';
10
10
  import * as _avalabs_avalanchejs from '@avalabs/avalanchejs';
11
- import { VM, Common, OutputOwners, TransferableOutput, pvmSerial, Context, avm, pvm, evm, avaxSerial, utils, UnsignedTx, EVMUnsignedTx, Utxo, Credential, Signature } from '@avalabs/avalanchejs';
11
+ import { VM, Common, OutputOwners, TransferableOutput, pvmSerial, Context, info, avm, pvm, evm, avaxSerial, utils, UnsignedTx, EVMUnsignedTx, Utxo, TransferOutput, Credential, Signature } from '@avalabs/avalanchejs';
12
12
  import * as _avalabs_avalanchejs_dist_vms_common from '@avalabs/avalanchejs/dist/vms/common';
13
13
  import { Bip32Path } from 'bip32-path';
14
14
  import AppZondax, { ResponseBase } from '@avalabs/hw-app-avalanche';
15
15
  import { BIP32Interface } from 'bip32';
16
- import { Utxo as Utxo$1, PChainUtxo } from '@avalabs/glacier-sdk';
16
+ import { GetUpgradesInfoResponse } from '@avalabs/avalanchejs/dist/info/model';
17
+ import * as _avalabs_avalanchejs_dist_vms_pvm from '@avalabs/avalanchejs/dist/vms/pvm';
18
+ import { Utxo as Utxo$1, PChainUtxo, Network as Network$2 } from '@avalabs/glacier-sdk';
19
+ import * as _avalabs_avalanchejs_dist_serializable_common_types from '@avalabs/avalanchejs/dist/serializable/common/types';
17
20
  import { WalletAbstract as WalletAbstract$1 } from 'Avalanche/wallets';
18
21
 
19
22
  /**
@@ -563,7 +566,7 @@ type ChainIDAlias = 'X' | 'P' | 'C';
563
566
  /**
564
567
  * Types for parsed transaction
565
568
  */
566
- type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx | UnknownTx;
569
+ type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx$1 | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx$1 | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | UnknownTx;
567
570
  interface FeeData {
568
571
  totalAvaxBurned: bigint;
569
572
  totalAvaxOutput: bigint;
@@ -583,6 +586,11 @@ declare enum TxType {
583
586
  Import = "import",
584
587
  CreateSubnet = "create_subnet",
585
588
  CreateChain = "create_chain",
589
+ ConvertSubnetToL1 = "convert_subnet_to_l1",
590
+ RegisterL1Validator = "register_l1_validator",
591
+ SetL1ValidatorWeight = "set_l1_validator_weight",
592
+ IncreaseL1ValidatorBalance = "increase_l1_validator_balance",
593
+ DisableL1Validator = "disable_l1_validator",
586
594
  AddSubnetValidator = "add_subnet_validator",
587
595
  RemoveSubnetValidator = "remove_subnet_validator",
588
596
  AddPermissionlessValidator = "add_permissionless_validator",
@@ -591,7 +599,7 @@ declare enum TxType {
591
599
  TransferSubnetOwnership = "transfer_subnet_ownership",
592
600
  Unknown = "unknown"
593
601
  }
594
- interface BaseTx extends TxBase {
602
+ interface BaseTx$1 extends TxBase {
595
603
  type: TxType.Base;
596
604
  chain: VM;
597
605
  outputs: {
@@ -661,6 +669,35 @@ interface RemoveSubnetValidatorTx extends TxBase {
661
669
  nodeID: string;
662
670
  subnetID: string;
663
671
  }
672
+ interface ConvertSubnetToL1Tx extends TxBase {
673
+ type: TxType.ConvertSubnetToL1;
674
+ managerAddress: string;
675
+ validators: {
676
+ nodeId: string;
677
+ stake: bigint;
678
+ balance: bigint;
679
+ remainingBalanceOwners: string[];
680
+ deactivationOwners: string[];
681
+ }[];
682
+ subnetID: string;
683
+ chainID: string;
684
+ }
685
+ interface RegisterL1ValidatorTx extends TxBase {
686
+ type: TxType.RegisterL1Validator;
687
+ balance: bigint;
688
+ }
689
+ interface SetL1ValidatorWeightTx extends TxBase {
690
+ type: TxType.SetL1ValidatorWeight;
691
+ }
692
+ interface IncreaseL1ValidatorBalanceTx extends TxBase {
693
+ type: TxType.IncreaseL1ValidatorBalance;
694
+ balance: bigint;
695
+ validationId: string;
696
+ }
697
+ interface DisableL1ValidatorTx extends TxBase {
698
+ type: TxType.DisableL1Validator;
699
+ validationId: string;
700
+ }
664
701
  interface AddPermissionlessValidatorTx extends TxBase {
665
702
  type: TxType.AddPermissionlessValidator;
666
703
  nodeID: string;
@@ -670,7 +707,7 @@ interface AddPermissionlessValidatorTx extends TxBase {
670
707
  rewardOwner: OutputOwners;
671
708
  delegationRewardOwner: OutputOwners;
672
709
  stake: bigint;
673
- stakeOuts: TransferableOutput[];
710
+ stakeOuts: readonly TransferableOutput[];
674
711
  subnetID: string;
675
712
  publicKey: undefined | string;
676
713
  signature: undefined | string;
@@ -684,7 +721,7 @@ interface AddPermissionlessDelegatorTx extends TxBase {
684
721
  stake: bigint;
685
722
  subnetID: string;
686
723
  delegatorRewardsOwner: OutputOwners;
687
- stakeOuts: TransferableOutput[];
724
+ stakeOuts: readonly TransferableOutput[];
688
725
  }
689
726
  interface TransformSubnetTx extends TxBase {
690
727
  type: TxType.TransformSubnet;
@@ -699,11 +736,11 @@ interface TransformSubnetTx extends TxBase {
699
736
  minStakeDuration: number;
700
737
  maxStakeDuration: number;
701
738
  minDelegationFee: number;
702
- minDelegatorStake: number;
739
+ minDelegatorStake: bigint;
703
740
  maxValidatorWeightFactor: number;
704
741
  uptimeRequirement: number;
705
742
  }
706
- interface TransferSubnetOwnershipTx extends TxBase {
743
+ interface TransferSubnetOwnershipTx$1 extends TxBase {
707
744
  type: TxType.TransferSubnetOwnership;
708
745
  subnetID: string;
709
746
  threshold: number;
@@ -719,7 +756,12 @@ declare function isAddValidatorTx(tx: Tx): tx is AddValidatorTx;
719
756
  declare function isAddDelegatorTx(tx: Tx): tx is AddDelegatorTx;
720
757
  declare function isExportTx(tx: Tx): tx is ExportTx;
721
758
  declare function isImportTx(tx: Tx): tx is ImportTx;
722
- declare function isBaseTx(tx: Tx): tx is BaseTx;
759
+ declare function isBaseTx(tx: Tx): tx is BaseTx$1;
760
+ declare function isConvertSubnetToL1Tx(tx: Tx): tx is ConvertSubnetToL1Tx;
761
+ declare function isRegisterL1ValidatorTx(tx: Tx): tx is RegisterL1ValidatorTx;
762
+ declare function isSetL1ValidatorWeightTx(tx: Tx): tx is SetL1ValidatorWeightTx;
763
+ declare function isDisableL1ValidatorTx(tx: Tx): tx is DisableL1ValidatorTx;
764
+ declare function isIncreaseL1ValidatorBalance(tx: Tx): tx is IncreaseL1ValidatorBalanceTx;
723
765
  declare function isCreateSubnetTx(tx: Tx): tx is CreateSubnetTx;
724
766
  declare function isCreateChainTx(tx: Tx): tx is CreateChainTx;
725
767
  declare function isAddSubnetValidatorTx(tx: Tx): tx is AddSubnetValidatorTx;
@@ -727,24 +769,28 @@ declare function isRemoveSubnetValidatorTx(tx: Tx): tx is RemoveSubnetValidatorT
727
769
  declare function isAddPermissionlessValidatorTx(tx: Tx): tx is AddPermissionlessValidatorTx;
728
770
  declare function isAddPermissionlessDelegatorTx(tx: Tx): tx is AddPermissionlessDelegatorTx;
729
771
  declare function isTransformSubnetTx(tx: Tx): tx is TransformSubnetTx;
730
- declare function isTransferSubnetOwnershipTx(tx: Tx): tx is TransferSubnetOwnershipTx;
772
+ declare function isTransferSubnetOwnershipTx(tx: Tx): tx is TransferSubnetOwnershipTx$1;
731
773
 
732
774
  declare class AbstractProvider {
733
775
  protected baseUrl: string;
734
776
  protected context: Context.Context;
777
+ protected upgradesInfo?: info.GetUpgradesInfoResponse | undefined;
735
778
  evmRpc: JsonRpcProvider$1;
736
- constructor(baseUrl: string, context: Context.Context);
779
+ constructor(baseUrl: string, context: Context.Context, upgradesInfo?: info.GetUpgradesInfoResponse | undefined);
737
780
  /**
738
781
  * @link https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData
739
782
  */
740
783
  getEvmFeeData(): Promise<ethers.FeeData>;
741
784
  getContext(): Context.Context;
785
+ isEtnaEnabled(): boolean;
786
+ getUpgradesInfo(): info.GetUpgradesInfoResponse | undefined;
742
787
  getChainID(chainAlias: ChainIDAlias): string;
743
788
  getNetworkID(): number;
744
789
  getHrp(): string;
745
790
  getApiX(): avm.AVMApi;
746
791
  getApiP(): pvm.PVMApi;
747
792
  getApiC(): evm.EVMApi;
793
+ getInfo(): info.InfoApi;
748
794
  getApi(chain: ChainIDAlias): avm.AVMApi | pvm.PVMApi | evm.EVMApi;
749
795
  getAvaxID(): string;
750
796
  getAddress(publicKey: Buffer, chain: ChainIDAlias): string;
@@ -765,10 +811,11 @@ declare class AbstractProvider {
765
811
  }
766
812
 
767
813
  declare class JsonRpcProvider extends AbstractProvider {
768
- constructor(baseUrl: string, context: Context.Context);
814
+ constructor(baseUrl: string, context: Context.Context, upgradesInfo?: GetUpgradesInfoResponse);
769
815
  static fromBaseURL(url: string): Promise<JsonRpcProvider>;
770
- static getDefaultMainnetProvider(): JsonRpcProvider;
771
- static getDefaultFujiProvider(): JsonRpcProvider;
816
+ static getDefaultMainnetProvider(upgradesInfo?: GetUpgradesInfoResponse): JsonRpcProvider;
817
+ static getDefaultFujiProvider(upgradesInfo?: GetUpgradesInfoResponse): JsonRpcProvider;
818
+ static getDefaultDevnetProvider(upgradesInfo?: GetUpgradesInfoResponse): JsonRpcProvider;
772
819
  }
773
820
 
774
821
  /**
@@ -779,6 +826,200 @@ declare const MainnetContext: Context.Context;
779
826
  * Avalanche Fuji testnet context
780
827
  */
781
828
  declare const FujiContext: Context.Context;
829
+ declare const DevnetContext: {
830
+ addPrimaryNetworkDelegatorFee: bigint;
831
+ addPrimaryNetworkValidatorFee: bigint;
832
+ addSubnetDelegatorFee: bigint;
833
+ addSubnetValidatorFee: bigint;
834
+ avaxAssetID: string;
835
+ baseTxFee: bigint;
836
+ cBlockchainID: string;
837
+ createAssetTxFee: bigint;
838
+ createBlockchainTxFee: bigint;
839
+ createSubnetTxFee: bigint;
840
+ hrp: string;
841
+ networkID: number;
842
+ pBlockchainID: string;
843
+ transformSubnetTxFee: bigint;
844
+ xBlockchainID: string;
845
+ platformFeeConfig: _avalabs_avalanchejs_dist_vms_pvm.FeeConfig;
846
+ };
847
+
848
+ type BaseTx = {
849
+ utxoSet: utils.UtxoSet;
850
+ chain: 'X' | 'P';
851
+ toAddress: string;
852
+ amountsPerAsset: Record<string, bigint>;
853
+ feeState?: pvm.FeeState;
854
+ options?: Common.SpendOptions;
855
+ fromAddresses?: string[];
856
+ };
857
+ type ImportP = {
858
+ utxoSet: utils.UtxoSet;
859
+ sourceChain: 'X' | 'C';
860
+ toAddress?: string;
861
+ threshold?: number;
862
+ feeState?: pvm.FeeState;
863
+ locktime?: bigint;
864
+ };
865
+ type ExportP = {
866
+ amount: bigint;
867
+ utxoSet: utils.UtxoSet;
868
+ destination: 'X' | 'C';
869
+ feeState?: pvm.FeeState;
870
+ toAddress?: string;
871
+ };
872
+ type ConsolidateP = {
873
+ utxoSet: utils.UtxoSet;
874
+ amount: bigint;
875
+ feeState?: pvm.FeeState;
876
+ toAddress?: string;
877
+ options?: Common.SpendOptions;
878
+ };
879
+ type CreateChain = {
880
+ utxoSet: utils.UtxoSet;
881
+ subnetId: string;
882
+ chainName: string;
883
+ vmID: string;
884
+ fxIds: string[];
885
+ genesisData: Record<string, unknown>;
886
+ subnetAuth: number[];
887
+ feeState?: pvm.FeeState;
888
+ options?: Common.SpendOptions;
889
+ fromAddresses?: string[];
890
+ };
891
+ type ConvertSubnetToL1 = {
892
+ utxoSet: utils.UtxoSet;
893
+ address: string;
894
+ chainId: string;
895
+ subnetId: string;
896
+ subnetAuth: number[];
897
+ options?: Common.SpendOptions;
898
+ feeState: pvm.FeeState;
899
+ fromAddresses?: string[];
900
+ validators: {
901
+ nodeId: string;
902
+ weight: bigint;
903
+ balance: bigint;
904
+ pubKey: string;
905
+ signature: string;
906
+ remainingBalanceOwner: {
907
+ addresses: string[];
908
+ threshold?: number;
909
+ };
910
+ deactivationOwner: {
911
+ addresses: string[];
912
+ threshold?: number;
913
+ };
914
+ }[];
915
+ };
916
+ type RegisterL1Validator = {
917
+ utxoSet: utils.UtxoSet;
918
+ balance: bigint;
919
+ signature: string;
920
+ feeState: pvm.FeeState;
921
+ message: string;
922
+ options?: Common.SpendOptions;
923
+ fromAddresses?: string[];
924
+ };
925
+ type SetL1ValidatorWeight = {
926
+ utxoSet: utils.UtxoSet;
927
+ feeState: pvm.FeeState;
928
+ message: string;
929
+ options?: Common.SpendOptions;
930
+ fromAddresses?: string[];
931
+ };
932
+ type DisableL1Validator = {
933
+ utxoSet: utils.UtxoSet;
934
+ feeState: pvm.FeeState;
935
+ disableAuth: number[];
936
+ validationId: string;
937
+ options?: Common.SpendOptions;
938
+ fromAddresses?: string[];
939
+ };
940
+ type IncreaseL1ValidatorBalance = {
941
+ utxoSet: utils.UtxoSet;
942
+ feeState: pvm.FeeState;
943
+ balance: bigint;
944
+ validationId: string;
945
+ options?: Common.SpendOptions;
946
+ fromAddresses?: string[];
947
+ };
948
+ type CreateSubnet = {
949
+ utxoSet: utils.UtxoSet;
950
+ rewardAddresses: string[];
951
+ feeState?: pvm.FeeState;
952
+ fromAddresses?: string[];
953
+ options?: Common.SpendOptions;
954
+ threshold?: number;
955
+ locktime?: bigint;
956
+ };
957
+ type AddSubnetValidator = {
958
+ utxoSet: utils.UtxoSet;
959
+ nodeId: string;
960
+ start: bigint;
961
+ end: bigint;
962
+ weight: bigint;
963
+ subnetId: string;
964
+ subnetAuth: number[];
965
+ feeState?: pvm.FeeState;
966
+ fromAddresses?: string[];
967
+ options?: Common.SpendOptions;
968
+ };
969
+ type AddPermissionlessValidator = {
970
+ utxoSet: utils.UtxoSet;
971
+ nodeId: string;
972
+ start: bigint;
973
+ end: bigint;
974
+ weight: bigint;
975
+ subnetId: string;
976
+ shares: number;
977
+ fromAddresses?: string[];
978
+ rewardAddresses?: string[];
979
+ delegatorRewardAddresses?: string[];
980
+ publicKey?: Buffer;
981
+ signature?: Buffer;
982
+ options?: Common.SpendOptions;
983
+ stakingAssetId?: string;
984
+ locktime?: bigint;
985
+ threshold?: number;
986
+ feeState?: pvm.FeeState;
987
+ };
988
+ type AddPermissionlessDelegator = {
989
+ utxoSet: utils.UtxoSet;
990
+ nodeId: string;
991
+ start: bigint;
992
+ end: bigint;
993
+ weight: bigint;
994
+ subnetId: string;
995
+ fromAddresses?: string[];
996
+ rewardAddresses?: string[];
997
+ options?: Common.SpendOptions;
998
+ locktime?: bigint;
999
+ feeState?: pvm.FeeState;
1000
+ stakingAssetId?: string;
1001
+ threshold?: number;
1002
+ };
1003
+ type RemoveSubnetValidator = {
1004
+ utxoSet: utils.UtxoSet;
1005
+ nodeId: string;
1006
+ subnetId: string;
1007
+ subnetAuth: number[];
1008
+ feeState?: pvm.FeeState;
1009
+ fromAddresses?: string[];
1010
+ options?: Common.SpendOptions;
1011
+ };
1012
+ type TransferSubnetOwnershipTx = {
1013
+ utxoSet: utils.UtxoSet;
1014
+ subnetId: string;
1015
+ subnetAuth: number[];
1016
+ subnetOwners: string[];
1017
+ feeState?: pvm.FeeState;
1018
+ fromAddresses?: string[];
1019
+ options?: Common.SpendOptions;
1020
+ threshold?: number;
1021
+ locktime?: bigint;
1022
+ };
782
1023
 
783
1024
  /**
784
1025
  * An abstract class that that is shared by all wallet classes.
@@ -825,8 +1066,12 @@ declare abstract class WalletAbstract {
825
1066
  * @param source What is the source chain of the atomic UTXOs
826
1067
  */
827
1068
  getAtomicUTXOs(chain: ChainIDAlias, source: ChainIDAlias): Promise<utils.UtxoSet>;
1069
+ /**
1070
+ * Get the nonce of this wallet's C chain address
1071
+ */
1072
+ getNonce(): Promise<number>;
828
1073
  exportX(amount: bigint, utxoSet: utils.UtxoSet, destination: 'P' | 'C', toAddress?: string): Common.UnsignedTx;
829
- importP(utxos: utils.UtxoSet, sourceChain: 'X' | 'C', toAddress?: string): Common.UnsignedTx;
1074
+ importP({ utxoSet, sourceChain, toAddress, threshold, feeState, locktime, }: ImportP): Common.UnsignedTx;
830
1075
  importX(utxos: utils.UtxoSet, sourceChain: 'P' | 'C', toAddress?: string): Common.UnsignedTx;
831
1076
  /**
832
1077
  *
@@ -846,10 +1091,6 @@ declare abstract class WalletAbstract {
846
1091
  * @param toAddress
847
1092
  */
848
1093
  exportC(amount: bigint, destination: 'X' | 'P', nonce: bigint, baseFee: bigint, toAddress?: string): _avalabs_avalanchejs.EVMUnsignedTx;
849
- /**
850
- * Get the nonce of this wallet's C chain address
851
- */
852
- getNonce(): Promise<number>;
853
1094
  /**
854
1095
  * Export the given amount of AVAX from the P chain. Export fee is automatically added.
855
1096
  * @param amount
@@ -857,18 +1098,23 @@ declare abstract class WalletAbstract {
857
1098
  * @param destination
858
1099
  * @param toAddress
859
1100
  */
860
- exportP(amount: bigint, utxoSet: utils.UtxoSet, destination: 'X' | 'C', toAddress?: string): Common.UnsignedTx;
861
- addValidator(utxos: utils.UtxoSet, nodeID: string, stakeAmount: bigint, startDate: bigint, endDate: bigint, delegationFee: number, config?: {
1101
+ exportP({ amount, utxoSet, destination, feeState, toAddress }: ExportP): Common.UnsignedTx;
1102
+ addValidator(utxos: utils.UtxoSet, nodeId: string, stakeAmount: bigint, startDate: bigint, endDate: bigint, delegationFee: number, config?: {
862
1103
  rewardAddress?: string;
863
1104
  }): Common.UnsignedTx;
864
- addDelegator(utxos: utils.UtxoSet, nodeID: string, stakeAmount: bigint, startDate: bigint, endDate: bigint, config?: {
1105
+ addDelegator(utxos: utils.UtxoSet, nodeId: string, stakeAmount: bigint, startDate: bigint, endDate: bigint, config?: {
865
1106
  rewardAddress?: string;
866
1107
  }): Common.UnsignedTx;
867
- consolidateP(utxoSet: utils.UtxoSet, amount: bigint, toAddress?: string, options?: Common.SpendOptions): Common.UnsignedTx;
868
- baseTX(utxoSet: utils.UtxoSet, chain: 'X' | 'P', toAddress: string, amountsPerAsset: Record<string, bigint>, options?: Common.SpendOptions, fromAddresses?: string[]): Common.UnsignedTx;
869
- createBlockchain(utxoSet: utils.UtxoSet, subnetId: string, chainName: string, vmID: string, fxIds: string[], genesisData: Record<string, unknown>, subnetAuth: number[], options?: Common.SpendOptions, fromAddresses?: string[]): Common.UnsignedTx;
870
- createSubnet(utxoSet: utils.UtxoSet, rewardAddresses: string[], fromAddresses?: string[], options?: Common.SpendOptions, threshold?: number, locktime?: bigint): Common.UnsignedTx;
871
- addSubnetValidator(utxoSet: utils.UtxoSet, nodeId: string, start: bigint, end: bigint, weight: bigint, subnetId: string, subnetAuth: number[], fromAddresses?: string[], options?: Common.SpendOptions): Common.UnsignedTx;
1108
+ consolidateP({ utxoSet, amount, feeState, toAddress, options, }: ConsolidateP): Common.UnsignedTx;
1109
+ baseTX({ utxoSet, chain, toAddress, amountsPerAsset, feeState, options, fromAddresses, }: BaseTx): Common.UnsignedTx;
1110
+ convertSubnetToL1({ utxoSet, chainId, subnetId, subnetAuth, feeState, address, validators, options, fromAddresses, }: ConvertSubnetToL1): Common.UnsignedTx;
1111
+ registerL1Validator({ utxoSet, balance, signature, message, feeState, fromAddresses, options, }: RegisterL1Validator): Common.UnsignedTx;
1112
+ setL1ValidatorWeight({ utxoSet, feeState, message, options, fromAddresses, }: SetL1ValidatorWeight): Common.UnsignedTx;
1113
+ disableL1Validator({ utxoSet, feeState, options, fromAddresses, disableAuth, validationId, }: DisableL1Validator): Common.UnsignedTx;
1114
+ increaseL1ValidatorBalance({ utxoSet, feeState, options, fromAddresses, balance, validationId, }: IncreaseL1ValidatorBalance): Common.UnsignedTx;
1115
+ createBlockchain({ utxoSet, subnetId, chainName, vmID, fxIds, genesisData, subnetAuth, feeState, options, fromAddresses, }: CreateChain): Common.UnsignedTx;
1116
+ createSubnet({ utxoSet, rewardAddresses, feeState, fromAddresses, options, threshold, locktime, }: CreateSubnet): Common.UnsignedTx;
1117
+ addSubnetValidator({ utxoSet, nodeId, start, end, weight, subnetId, subnetAuth, feeState, fromAddresses, options, }: AddSubnetValidator): Common.UnsignedTx;
872
1118
  /**
873
1119
  *
874
1120
  * @param utxoSet The transaction will be constructed from these UTXOs.
@@ -885,7 +1131,7 @@ declare abstract class WalletAbstract {
885
1131
  * @param signature the BLS signature, If the subnet is the primary network. Can be found in the Node on startup.
886
1132
  * @param options
887
1133
  */
888
- addPermissionlessValidator(utxoSet: utils.UtxoSet, nodeId: string, start: bigint, end: bigint, weight: bigint, subnetId: string, shares: number, fromAddresses?: string[], rewardAddresses?: string[], delegatorRewardAddresses?: string[], publicKey?: Buffer, signature?: Buffer, options?: Common.SpendOptions): Common.UnsignedTx;
1134
+ addPermissionlessValidator({ utxoSet, nodeId, start, end, weight, subnetId, shares, feeState, fromAddresses, rewardAddresses, delegatorRewardAddresses, publicKey, signature, options, threshold, locktime, stakingAssetId, }: AddPermissionlessValidator): Common.UnsignedTx;
889
1135
  /**
890
1136
  *
891
1137
  * @param utxoSet The transaction will be constructed from these UTXOs.
@@ -898,10 +1144,10 @@ declare abstract class WalletAbstract {
898
1144
  * @param rewardAddresses Will use active address if not provided. Given addresses will share the reward UTXO.
899
1145
  * @param options
900
1146
  */
901
- addPermissionlessDelegator(utxoSet: utils.UtxoSet, nodeId: string, start: bigint, end: bigint, weight: bigint, subnetId: string, fromAddresses?: string[], rewardAddresses?: string[], options?: Common.SpendOptions): Common.UnsignedTx;
902
- removeSubnetValidator(utxoSet: utils.UtxoSet, nodeId: string, subnetId: string, subnetAuth: number[], fromAddresses?: string[], options?: Common.SpendOptions): Common.UnsignedTx;
903
- transferSubnetOwnershipTx(utxoSet: utils.UtxoSet, subnetId: string, subnetAuth: number[], subnetOwners: string[], fromAddresses?: string[], options?: Common.SpendOptions, threshold?: number, locktime?: bigint): Common.UnsignedTx;
904
- transformSubnetTx(utxoSet: utils.UtxoSet, subnetId: string, assetId: string, initialSupply: bigint, maximumSupply: bigint, minConsumptionRate: bigint, maxConsumptionRate: bigint, minValidatorStake: bigint, maxValidatorStake: bigint, minStakeDuration: number, maxStakeDuration: number, minDelegationFee: number, minDelegatorStake: number, maxValidatorWeightFactor: number, uptimeRequirement: number, subnetAuth: number[], fromAddresses?: string[], options?: Common.SpendOptions): Common.UnsignedTx;
1147
+ addPermissionlessDelegator({ utxoSet, nodeId, start, end, weight, subnetId, fromAddresses, rewardAddresses, options, locktime, feeState, threshold, stakingAssetId, }: AddPermissionlessDelegator): Common.UnsignedTx;
1148
+ removeSubnetValidator({ utxoSet, nodeId, subnetId, subnetAuth, fromAddresses, feeState, options, }: RemoveSubnetValidator): Common.UnsignedTx;
1149
+ transferSubnetOwnershipTx({ utxoSet, subnetId, subnetAuth, subnetOwners, feeState, fromAddresses, options, threshold, locktime, }: TransferSubnetOwnershipTx): Common.UnsignedTx;
1150
+ transformSubnetTx(utxoSet: utils.UtxoSet, subnetId: string, assetId: string, initialSupply: bigint, maximumSupply: bigint, minConsumptionRate: bigint, maxConsumptionRate: bigint, minValidatorStake: bigint, maxValidatorStake: bigint, minStakeDuration: number, maxStakeDuration: number, minDelegationFee: number, minDelegatorStake: bigint, maxValidatorWeightFactor: number, uptimeRequirement: number, subnetAuth: number[], fromAddresses?: string[], options?: Common.SpendOptions): Common.UnsignedTx;
905
1151
  protected constructor(provider: AbstractProvider);
906
1152
  }
907
1153
 
@@ -1352,7 +1598,7 @@ declare const addSignaturesToAvalancheTx: ({ transactionHex, signatures, chainAl
1352
1598
  }>;
1353
1599
 
1354
1600
  type GlacierOutput = Utxo$1 | PChainUtxo;
1355
- declare const convertGlacierUtxo: (glacierUtxo: GlacierOutput, isTestnet: boolean) => Utxo;
1601
+ declare const convertGlacierUtxo: (glacierUtxo: GlacierOutput, network: Network$2) => Utxo<TransferOutput | pvmSerial.StakeableLockOut<TransferOutput>>;
1356
1602
 
1357
1603
  type Params$2 = {
1358
1604
  txBytes: Uint8Array;
@@ -1469,12 +1715,12 @@ declare const getUtxoInfo: (utxo: Utxo) => UtxoInfo;
1469
1715
  type Params = {
1470
1716
  transactionHex: string;
1471
1717
  chainAlias: ChainIDAlias;
1472
- isTestnet: boolean;
1718
+ network: Network$2;
1473
1719
  url: string;
1474
1720
  token?: string;
1475
1721
  headers?: Record<string, string>;
1476
1722
  };
1477
- declare const getUtxosByTxFromGlacier: ({ transactionHex, chainAlias, isTestnet, url, token, headers, }: Params) => Promise<Utxo[]>;
1723
+ declare const getUtxosByTxFromGlacier: ({ transactionHex, chainAlias, network, url, token, headers, }: Params) => Promise<Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[]>;
1478
1724
 
1479
1725
  declare const getVmByChainAlias: (chainAlias: string) => "EVM" | "AVM" | "PVM";
1480
1726
 
@@ -1491,10 +1737,16 @@ declare function getXpubFromMnemonic(mnemonic: string): string;
1491
1737
  */
1492
1738
  declare function isBech32Address(address: string, hasChainId?: boolean): boolean;
1493
1739
 
1740
+ type ParseOptions = {
1741
+ /**
1742
+ * Tolerance percentage range where the burned amount is considered valid.
1743
+ */
1744
+ feeTolerance?: number;
1745
+ };
1494
1746
  /**
1495
1747
  * Returns human readable data from a given a transaction buffer,
1496
1748
  */
1497
- declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string): Promise<Tx>;
1749
+ declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string, { feeTolerance }?: ParseOptions): Promise<Tx>;
1498
1750
 
1499
1751
  declare const emptySignature: Signature;
1500
1752
  declare const populateCredential: (indices: number[], existingCredentialData?: {
@@ -1510,10 +1762,10 @@ declare function signedTxToHex(signedTx: avaxSerial.SignedTx): string;
1510
1762
  * 2- Highest value UTXOs to lowest
1511
1763
  * @remark Does not check for locked UTXOs
1512
1764
  */
1513
- declare function sortUTXOsStaking(utxos: Utxo[]): Utxo[];
1514
- declare function sortUTXOsByAmount(utxos: Utxo[], isDescending: boolean): Utxo[];
1515
- declare const sortUTXOsByAmountDescending: (utxos: Utxo[]) => Utxo[];
1516
- declare const sortUTXOsByAmountAscending: (utxos: Utxo[]) => Utxo[];
1765
+ declare function sortUTXOsStaking(utxos: Utxo[]): Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[];
1766
+ declare function sortUTXOsByAmount(utxos: Utxo[], isDescending: boolean): Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[];
1767
+ declare const sortUTXOsByAmountDescending: (utxos: Utxo[]) => Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[];
1768
+ declare const sortUTXOsByAmountAscending: (utxos: Utxo[]) => Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[];
1517
1769
 
1518
1770
  /**
1519
1771
  * The list of transaction types supported by `getMaximumUtxoSet`.
@@ -1539,9 +1791,16 @@ declare const P_CHAIN_TX_SIZE_LIMIT = 65536;
1539
1791
  * @param utxos - list of UTXOs to be consumed by the transaction.
1540
1792
  * @param sizeSupportedTx - one of the supported transaction types
1541
1793
  * @param limit - optional - byte size limit, defaults to 64kb.
1794
+ * @param feeState - current fee state on the chain
1542
1795
  * @returns the largest prefix of sorted `utxos` before hitting the size limit. If no such prefix exists, then an empty array.
1543
1796
  */
1544
- declare function getMaximumUtxoSet(wallet: WalletAbstract$1, utxos: Utxo[], sizeSupportedTx: SizeSupportedTx, limit?: number): Utxo[];
1797
+ declare function getMaximumUtxoSet({ wallet, utxos, sizeSupportedTx, limit, feeState, }: {
1798
+ wallet: WalletAbstract$1;
1799
+ utxos: Utxo[];
1800
+ sizeSupportedTx: SizeSupportedTx;
1801
+ limit?: number;
1802
+ feeState?: pvm.FeeState;
1803
+ }): Utxo[];
1545
1804
 
1546
1805
  /**
1547
1806
  * Verifies the given derivation path is valid, starts with `m`, and of the right length
@@ -1558,10 +1817,12 @@ type index_AddSubnetValidatorTx = AddSubnetValidatorTx;
1558
1817
  type index_AddValidatorTx = AddValidatorTx;
1559
1818
  type index_AddressWallet = AddressWallet;
1560
1819
  declare const index_AddressWallet: typeof AddressWallet;
1561
- type index_BaseTx = BaseTx;
1562
1820
  type index_ChainIDAlias = ChainIDAlias;
1821
+ type index_ConvertSubnetToL1Tx = ConvertSubnetToL1Tx;
1563
1822
  type index_CreateChainTx = CreateChainTx;
1564
1823
  type index_CreateSubnetTx = CreateSubnetTx;
1824
+ declare const index_DevnetContext: typeof DevnetContext;
1825
+ type index_DisableL1ValidatorTx = DisableL1ValidatorTx;
1565
1826
  type index_ExportTx = ExportTx;
1566
1827
  type index_FeeData = FeeData;
1567
1828
  declare const index_FujiContext: typeof FujiContext;
@@ -1569,6 +1830,7 @@ type index_GetAvaxBalanceDict = GetAvaxBalanceDict;
1569
1830
  type index_GetStakedAvaxBalanceDict = GetStakedAvaxBalanceDict;
1570
1831
  type index_GlacierOutput = GlacierOutput;
1571
1832
  type index_ImportTx = ImportTx;
1833
+ type index_IncreaseL1ValidatorBalanceTx = IncreaseL1ValidatorBalanceTx;
1572
1834
  type index_JsonRpcProvider = JsonRpcProvider;
1573
1835
  declare const index_JsonRpcProvider: typeof JsonRpcProvider;
1574
1836
  type index_LedgerGetXpubResponse = LedgerGetXpubResponse;
@@ -1582,7 +1844,9 @@ declare const index_MnemonicWallet: typeof MnemonicWallet;
1582
1844
  type index_MnemonicWalletVoid = MnemonicWalletVoid;
1583
1845
  declare const index_MnemonicWalletVoid: typeof MnemonicWalletVoid;
1584
1846
  declare const index_P_CHAIN_TX_SIZE_LIMIT: typeof P_CHAIN_TX_SIZE_LIMIT;
1847
+ type index_RegisterL1ValidatorTx = RegisterL1ValidatorTx;
1585
1848
  type index_RemoveSubnetValidatorTx = RemoveSubnetValidatorTx;
1849
+ type index_SetL1ValidatorWeightTx = SetL1ValidatorWeightTx;
1586
1850
  type index_SignMessageRequest = SignMessageRequest;
1587
1851
  type index_SignTxBufferRequest = SignTxBufferRequest;
1588
1852
  type index_SignTxRequest = SignTxRequest;
@@ -1595,7 +1859,6 @@ type index_SizeSupportedTx = SizeSupportedTx;
1595
1859
  declare const index_SizeSupportedTx: typeof SizeSupportedTx;
1596
1860
  type index_StaticSigner = StaticSigner;
1597
1861
  declare const index_StaticSigner: typeof StaticSigner;
1598
- type index_TransferSubnetOwnershipTx = TransferSubnetOwnershipTx;
1599
1862
  type index_TransformSubnetTx = TransformSubnetTx;
1600
1863
  type index_Tx = Tx;
1601
1864
  type index_TxBase = TxBase;
@@ -1635,12 +1898,17 @@ declare const index_isAddSubnetValidatorTx: typeof isAddSubnetValidatorTx;
1635
1898
  declare const index_isAddValidatorTx: typeof isAddValidatorTx;
1636
1899
  declare const index_isBaseTx: typeof isBaseTx;
1637
1900
  declare const index_isBech32Address: typeof isBech32Address;
1901
+ declare const index_isConvertSubnetToL1Tx: typeof isConvertSubnetToL1Tx;
1638
1902
  declare const index_isCreateChainTx: typeof isCreateChainTx;
1639
1903
  declare const index_isCreateSubnetTx: typeof isCreateSubnetTx;
1904
+ declare const index_isDisableL1ValidatorTx: typeof isDisableL1ValidatorTx;
1640
1905
  declare const index_isExportTx: typeof isExportTx;
1641
1906
  declare const index_isImportTx: typeof isImportTx;
1907
+ declare const index_isIncreaseL1ValidatorBalance: typeof isIncreaseL1ValidatorBalance;
1642
1908
  declare const index_isObsidianApp: typeof isObsidianApp;
1909
+ declare const index_isRegisterL1ValidatorTx: typeof isRegisterL1ValidatorTx;
1643
1910
  declare const index_isRemoveSubnetValidatorTx: typeof isRemoveSubnetValidatorTx;
1911
+ declare const index_isSetL1ValidatorWeightTx: typeof isSetL1ValidatorWeightTx;
1644
1912
  declare const index_isTransferSubnetOwnershipTx: typeof isTransferSubnetOwnershipTx;
1645
1913
  declare const index_isTransformSubnetTx: typeof isTransformSubnetTx;
1646
1914
  declare const index_parseAvalancheTx: typeof parseAvalancheTx;
@@ -1660,10 +1928,13 @@ declare namespace index {
1660
1928
  index_AddSubnetValidatorTx as AddSubnetValidatorTx,
1661
1929
  index_AddValidatorTx as AddValidatorTx,
1662
1930
  index_AddressWallet as AddressWallet,
1663
- index_BaseTx as BaseTx,
1931
+ BaseTx$1 as BaseTx,
1664
1932
  index_ChainIDAlias as ChainIDAlias,
1933
+ index_ConvertSubnetToL1Tx as ConvertSubnetToL1Tx,
1665
1934
  index_CreateChainTx as CreateChainTx,
1666
1935
  index_CreateSubnetTx as CreateSubnetTx,
1936
+ index_DevnetContext as DevnetContext,
1937
+ index_DisableL1ValidatorTx as DisableL1ValidatorTx,
1667
1938
  index_ExportTx as ExportTx,
1668
1939
  index_FeeData as FeeData,
1669
1940
  index_FujiContext as FujiContext,
@@ -1671,6 +1942,7 @@ declare namespace index {
1671
1942
  index_GetStakedAvaxBalanceDict as GetStakedAvaxBalanceDict,
1672
1943
  index_GlacierOutput as GlacierOutput,
1673
1944
  index_ImportTx as ImportTx,
1945
+ index_IncreaseL1ValidatorBalanceTx as IncreaseL1ValidatorBalanceTx,
1674
1946
  index_JsonRpcProvider as JsonRpcProvider,
1675
1947
  index_LedgerGetXpubResponse as LedgerGetXpubResponse,
1676
1948
  index_LedgerSigner as LedgerSigner,
@@ -1679,7 +1951,9 @@ declare namespace index {
1679
1951
  index_MnemonicWallet as MnemonicWallet,
1680
1952
  index_MnemonicWalletVoid as MnemonicWalletVoid,
1681
1953
  index_P_CHAIN_TX_SIZE_LIMIT as P_CHAIN_TX_SIZE_LIMIT,
1954
+ index_RegisterL1ValidatorTx as RegisterL1ValidatorTx,
1682
1955
  index_RemoveSubnetValidatorTx as RemoveSubnetValidatorTx,
1956
+ index_SetL1ValidatorWeightTx as SetL1ValidatorWeightTx,
1683
1957
  index_SignMessageRequest as SignMessageRequest,
1684
1958
  index_SignTxBufferRequest as SignTxBufferRequest,
1685
1959
  index_SignTxRequest as SignTxRequest,
@@ -1688,7 +1962,7 @@ declare namespace index {
1688
1962
  index_SimpleSigner as SimpleSigner,
1689
1963
  index_SizeSupportedTx as SizeSupportedTx,
1690
1964
  index_StaticSigner as StaticSigner,
1691
- index_TransferSubnetOwnershipTx as TransferSubnetOwnershipTx,
1965
+ TransferSubnetOwnershipTx$1 as TransferSubnetOwnershipTx,
1692
1966
  index_TransformSubnetTx as TransformSubnetTx,
1693
1967
  index_Tx as Tx,
1694
1968
  index_TxBase as TxBase,
@@ -1725,12 +1999,17 @@ declare namespace index {
1725
1999
  index_isAddValidatorTx as isAddValidatorTx,
1726
2000
  index_isBaseTx as isBaseTx,
1727
2001
  index_isBech32Address as isBech32Address,
2002
+ index_isConvertSubnetToL1Tx as isConvertSubnetToL1Tx,
1728
2003
  index_isCreateChainTx as isCreateChainTx,
1729
2004
  index_isCreateSubnetTx as isCreateSubnetTx,
2005
+ index_isDisableL1ValidatorTx as isDisableL1ValidatorTx,
1730
2006
  index_isExportTx as isExportTx,
1731
2007
  index_isImportTx as isImportTx,
2008
+ index_isIncreaseL1ValidatorBalance as isIncreaseL1ValidatorBalance,
1732
2009
  index_isObsidianApp as isObsidianApp,
2010
+ index_isRegisterL1ValidatorTx as isRegisterL1ValidatorTx,
1733
2011
  index_isRemoveSubnetValidatorTx as isRemoveSubnetValidatorTx,
2012
+ index_isSetL1ValidatorWeightTx as isSetL1ValidatorWeightTx,
1734
2013
  index_isTransferSubnetOwnershipTx as isTransferSubnetOwnershipTx,
1735
2014
  index_isTransformSubnetTx as isTransformSubnetTx,
1736
2015
  index_parseAvalancheTx as parseAvalancheTx,