@avalabs/core-wallets-sdk 3.1.0-alpha.7 → 3.1.0-alpha.71

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 (130) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.d.ts +438 -172
  3. package/esm/Avalanche/index.d.ts +5 -4
  4. package/esm/Avalanche/index.js +1 -1
  5. package/esm/Avalanche/models.d.ts +47 -6
  6. package/esm/Avalanche/models.js +1 -1
  7. package/esm/Avalanche/providers/AbstractProvider.d.ts +4 -9
  8. package/esm/Avalanche/providers/AbstractProvider.js +1 -1
  9. package/esm/Avalanche/providers/JsonRpcProvider.d.ts +2 -1
  10. package/esm/Avalanche/providers/JsonRpcProvider.js +1 -1
  11. package/esm/Avalanche/providers/constants.d.ts +2 -1
  12. package/esm/Avalanche/providers/constants.js +1 -1
  13. package/esm/Avalanche/providers/platformFeeConfig.js +1 -0
  14. package/esm/Avalanche/utils/addSignaturesToAvalancheTx.js +1 -1
  15. package/esm/Avalanche/utils/appendDisableAuthAddressMaps.js +1 -0
  16. package/esm/Avalanche/utils/convertGlacierUtxo.d.ts +5 -4
  17. package/esm/Avalanche/utils/convertGlacierUtxo.js +1 -1
  18. package/esm/Avalanche/utils/createAvalancheEvmUnsignedTx.d.ts +3 -2
  19. package/esm/Avalanche/utils/createAvalancheEvmUnsignedTx.js +1 -1
  20. package/esm/Avalanche/utils/createAvalancheUnsignedTx.d.ts +1 -1
  21. package/esm/Avalanche/utils/createAvalancheUnsignedTx.js +1 -1
  22. package/esm/Avalanche/utils/getAssetBalance.d.ts +2 -1
  23. package/esm/Avalanche/utils/getAssetBalance.js +1 -1
  24. package/esm/Avalanche/utils/getAvalancheDerivationPath.d.ts +3 -0
  25. package/esm/Avalanche/utils/getAvalancheDerivationPath.js +1 -0
  26. package/esm/Avalanche/utils/getChainAliasByChainId.js +1 -1
  27. package/esm/Avalanche/utils/getPchainUnixNow.d.ts +3 -1
  28. package/esm/Avalanche/utils/getPchainUnixNow.js +1 -1
  29. package/esm/Avalanche/utils/getStakedAssetBalance.d.ts +2 -1
  30. package/esm/Avalanche/utils/getTxOutputAddresses.js +1 -1
  31. package/esm/Avalanche/utils/getUtxosByTxFromGlacier.d.ts +4 -2
  32. package/esm/Avalanche/utils/getUtxosByTxFromGlacier.js +1 -1
  33. package/esm/Avalanche/utils/getVmByChainAlias.d.ts +1 -1
  34. package/esm/Avalanche/utils/getXpubFromMnemonic.d.ts +1 -1
  35. package/esm/Avalanche/utils/getXpubFromMnemonic.js +1 -1
  36. package/esm/Avalanche/utils/handleSubnetAuth.js +1 -1
  37. package/esm/Avalanche/utils/orderBy.js +1 -0
  38. package/esm/Avalanche/utils/parseAvalancheTx.d.ts +12 -1
  39. package/esm/Avalanche/utils/parseAvalancheTx.js +1 -1
  40. package/esm/Avalanche/utils/parsers/index.js +1 -1
  41. package/esm/Avalanche/utils/parsers/parseAddPermissionlessDelegatorTx.js +1 -1
  42. package/esm/Avalanche/utils/parsers/parseAddPermissionlessValidatorTx.js +1 -1
  43. package/esm/Avalanche/utils/parsers/parseAddSubnetValidorTx.js +1 -1
  44. package/esm/Avalanche/utils/parsers/parseBaseTx.js +1 -1
  45. package/esm/Avalanche/utils/parsers/parseConvertSubnetToL1Tx.js +1 -0
  46. package/esm/Avalanche/utils/parsers/parseCreateChainTx.js +1 -1
  47. package/esm/Avalanche/utils/parsers/parseCreateSubnetTx.js +1 -1
  48. package/esm/Avalanche/utils/parsers/parseDisableL1ValidatorTx.js +1 -0
  49. package/esm/Avalanche/utils/parsers/parseExportTx.js +1 -1
  50. package/esm/Avalanche/utils/parsers/parseImportTx.js +1 -1
  51. package/esm/Avalanche/utils/parsers/parseIncreaseL1ValidatorBalanceTx.js +1 -0
  52. package/esm/Avalanche/utils/parsers/parseRegisterL1ValidatorTx.js +1 -0
  53. package/esm/Avalanche/utils/parsers/parseRemoveSubnetValidatorTx.js +1 -1
  54. package/esm/Avalanche/utils/parsers/parseSetL1ValidatorWeightTx.js +1 -0
  55. package/esm/Avalanche/utils/parsers/parseTransferSubnetOwnershipTx.js +1 -1
  56. package/esm/Avalanche/utils/parsers/utils/chainIdToVm.js +1 -1
  57. package/esm/Avalanche/utils/populateCredential.js +1 -1
  58. package/esm/Avalanche/utils/sortUTXOs.d.ts +6 -4
  59. package/esm/Avalanche/utils/sortUTXOs.js +1 -1
  60. package/esm/Avalanche/utils/txSizeLimits.d.ts +10 -3
  61. package/esm/Avalanche/utils/txSizeLimits.js +1 -1
  62. package/esm/Avalanche/wallets/AddressWallet.js +1 -1
  63. package/esm/Avalanche/wallets/SimpleSigner.d.ts +1 -1
  64. package/esm/Avalanche/wallets/SimpleSigner.js +1 -1
  65. package/esm/Avalanche/wallets/StaticSigner.js +1 -1
  66. package/esm/Avalanche/wallets/TxBuilderTypes.d.ts +179 -0
  67. package/esm/Avalanche/wallets/WalletAbstract.d.ts +17 -22
  68. package/esm/Avalanche/wallets/WalletAbstract.js +1 -1
  69. package/esm/Avalanche/wallets/WalletVoid.js +1 -1
  70. package/esm/Avalanche/wallets/ledger/LedgerLiveSigner.d.ts +16 -0
  71. package/esm/Avalanche/wallets/ledger/LedgerLiveSigner.js +1 -0
  72. package/esm/Avalanche/wallets/ledger/LedgerSigner.js +1 -1
  73. package/esm/Avalanche/wallets/ledger/SimpleLedgerSigner.d.ts +1 -1
  74. package/esm/Avalanche/wallets/ledger/SimpleLedgerSigner.js +1 -1
  75. package/esm/Avalanche/wallets/ledger/models.d.ts +1 -1
  76. package/esm/Avalanche/wallets/legacy/LedgerWallet.js +1 -1
  77. package/esm/Avalanche/wallets/legacy/MnemonicWallet.js +1 -1
  78. package/esm/Avalanche/wallets/legacy/MnemonicWalletVoid.js +1 -1
  79. package/esm/Avalanche/wallets/models.d.ts +1 -1
  80. package/esm/BitcoinVM/index.d.ts +5 -0
  81. package/esm/BitcoinVM/index.js +1 -0
  82. package/esm/BitcoinVM/models.d.ts +1 -1
  83. package/esm/BitcoinVM/providers/BitcoinProvider.d.ts +4 -3
  84. package/esm/BitcoinVM/providers/BitcoinProvider.js +1 -1
  85. package/esm/BitcoinVM/providers/BitcoinProviderAbstract.d.ts +1 -0
  86. package/esm/BitcoinVM/utils/getBech32AddressFromXPub.js +1 -1
  87. package/esm/BitcoinVM/wallets/BitcoinWallet.js +1 -1
  88. package/esm/BitcoinVM/wallets/BitcoinWalletLedger.js +1 -1
  89. package/esm/BitcoinVM/wallets/models.d.ts +1 -1
  90. package/esm/EVM/LedgerSigner.js +1 -1
  91. package/esm/EVM/utils/blockPolling.js +1 -1
  92. package/esm/EVM/utils/getEvmDerivationPath.d.ts +5 -0
  93. package/esm/EVM/utils/getEvmDerivationPath.js +1 -0
  94. package/esm/EVM/utils/getWalletFromMnemonic.js +1 -1
  95. package/esm/SolanaVM/utils/compileSolanaTx.d.ts +9 -0
  96. package/esm/SolanaVM/utils/compileSolanaTx.js +1 -0
  97. package/esm/SolanaVM/utils/derivationPath.d.ts +3 -0
  98. package/esm/SolanaVM/utils/derivationPath.js +1 -0
  99. package/esm/SolanaVM/utils/deserializeSolanaTx.d.ts +6 -0
  100. package/esm/SolanaVM/utils/deserializeSolanaTx.js +1 -0
  101. package/esm/SolanaVM/utils/getSolanaPublicKeyFromLedger.d.ts +5 -0
  102. package/esm/SolanaVM/utils/getSolanaPublicKeyFromLedger.js +1 -0
  103. package/esm/SolanaVM/utils/maybeGetAssociatedTokenAccount.d.ts +37 -0
  104. package/esm/SolanaVM/utils/maybeGetAssociatedTokenAccount.js +1 -0
  105. package/esm/SolanaVM/utils/serializeSolanaTx.d.ts +6 -0
  106. package/esm/SolanaVM/utils/serializeSolanaTx.js +1 -0
  107. package/esm/SolanaVM/utils/solanaProvider.d.ts +11 -0
  108. package/esm/SolanaVM/utils/solanaProvider.js +1 -0
  109. package/esm/SolanaVM/utils/transferSol.d.ts +14 -0
  110. package/esm/SolanaVM/utils/transferSol.js +1 -0
  111. package/esm/SolanaVM/utils/transferToken.d.ts +17 -0
  112. package/esm/SolanaVM/utils/transferToken.js +1 -0
  113. package/esm/SolanaVM/wallets/SolanaLedgerSigner.d.ts +10 -0
  114. package/esm/SolanaVM/wallets/SolanaLedgerSigner.js +1 -0
  115. package/esm/SolanaVM/wallets/SolanaSigner.d.ts +20 -0
  116. package/esm/SolanaVM/wallets/SolanaSigner.js +1 -0
  117. package/esm/abis/erc20.abi.js +1 -0
  118. package/esm/index.d.ts +32 -20
  119. package/esm/index.js +1 -1
  120. package/esm/utils/assertFeeStateProvided.js +1 -0
  121. package/esm/utils/getAddressDerivationPath.d.ts +8 -2
  122. package/esm/utils/getAddressDerivationPath.js +1 -1
  123. package/esm/utils/getPubKeyFromTransport.js +1 -1
  124. package/package.json +31 -13
  125. package/dist/index.js +0 -1
  126. package/esm/Avalanche/utils/getUtxoInfo.d.ts +0 -13
  127. package/esm/Avalanche/utils/getUtxoInfo.js +0 -1
  128. package/esm/Avalanche/utils/parsers/parseAddDelegatorTx.js +0 -1
  129. package/esm/Avalanche/utils/parsers/parseAddValidatorTx.js +0 -1
  130. package/esm/Avalanche/utils/parsers/parseTransformSubnetTx.js +0 -1
@@ -1,4 +1,4 @@
1
- export { AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, CreateChainTx, CreateSubnetTx, ExportTx, FeeData, ImportTx, RemoveSubnetValidatorTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, TxType, UnknownTx, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isCreateChainTx, isCreateSubnetTx, isExportTx, isImportTx, isRemoveSubnetValidatorTx, isTransferSubnetOwnershipTx, isTransformSubnetTx } from './models.js';
1
+ export { AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, ConvertSubnetToL1Tx, CreateChainTx, CreateSubnetTx, DisableL1ValidatorTx, ExportTx, FeeData, ImportTx, IncreaseL1ValidatorBalanceTx, RegisterL1ValidatorTx, RemoveSubnetValidatorTx, SetL1ValidatorWeightTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, TxType, UnknownTx, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isConvertSubnetToL1Tx, isCreateChainTx, isCreateSubnetTx, isDisableL1ValidatorTx, isExportTx, isImportTx, isIncreaseL1ValidatorBalance, isRegisterL1ValidatorTx, isRemoveSubnetValidatorTx, isSetL1ValidatorWeightTx, isTransferSubnetOwnershipTx, isTransformSubnetTx } from './models.js';
2
2
  export { WalletAbstract } from './wallets/WalletAbstract.js';
3
3
  export { WalletVoid } from './wallets/WalletVoid.js';
4
4
  export { isObsidianApp } from './wallets/ledger/isObsidianApp.js';
@@ -11,10 +11,11 @@ export { StaticSigner } from './wallets/StaticSigner.js';
11
11
  export { SimpleSigner } from './wallets/SimpleSigner.js';
12
12
  export { LedgerSigner } from './wallets/ledger/LedgerSigner.js';
13
13
  export { SimpleLedgerSigner } from './wallets/ledger/SimpleLedgerSigner.js';
14
+ export { LedgerLiveSigner } from './wallets/ledger/LedgerLiveSigner.js';
14
15
  export { LedgerGetXpubResponse, SignMessageRequest, SignTxBufferRequest, SignTxRequest, Signer } from './wallets/models.js';
15
16
  export { AbstractProvider } from './providers/AbstractProvider.js';
16
17
  export { JsonRpcProvider } from './providers/JsonRpcProvider.js';
17
- export { FujiContext, MainnetContext } from './providers/constants.js';
18
+ export { DevnetContext, FujiContext, MainnetContext } from './providers/constants.js';
18
19
  export { default as addSignaturesToAvalancheTx } from './utils/addSignaturesToAvalancheTx.js';
19
20
  export { GlacierOutput, convertGlacierUtxo } from './utils/convertGlacierUtxo.js';
20
21
  export { createAvalancheEvmUnsignedTx } from './utils/createAvalancheEvmUnsignedTx.js';
@@ -28,14 +29,14 @@ export { getPchainUnixNow } from './utils/getPchainUnixNow.js';
28
29
  export { GetStakedAvaxBalanceDict, getStakedAssetBalance } from './utils/getStakedAssetBalance.js';
29
30
  export { getStakeForAddresses } from './utils/getStakeForAddresses.js';
30
31
  export { getUnixNow } from './utils/getUnixNow.js';
31
- export { UtxoInfo, getUtxoInfo } from './utils/getUtxoInfo.js';
32
32
  export { getUtxosByTxFromGlacier } from './utils/getUtxosByTxFromGlacier.js';
33
33
  export { getVmByChainAlias } from './utils/getVmByChainAlias.js';
34
34
  export { getXpubFromMnemonic } from './utils/getXpubFromMnemonic.js';
35
35
  export { isBech32Address } from './utils/isBech32Address.js';
36
- export { parseAvalancheTx } from './utils/parseAvalancheTx.js';
36
+ export { ParseOptions, parseAvalancheTx } from './utils/parseAvalancheTx.js';
37
37
  export { emptySignature, populateCredential } from './utils/populateCredential.js';
38
38
  export { signedTxToHex } from './utils/signedTxToHex.js';
39
39
  export { sortUTXOsByAmount, sortUTXOsByAmountAscending, sortUTXOsByAmountDescending, sortUTXOsStaking } from './utils/sortUTXOs.js';
40
40
  export { P_CHAIN_TX_SIZE_LIMIT, SizeSupportedTx, getMaximumUtxoSet } from './utils/txSizeLimits.js';
41
41
  export { verifyDerivationPath } from './utils/verifyDerivationPath.js';
42
+ export { getAvalancheDerivationPath } from './utils/getAvalancheDerivationPath.js';
@@ -1 +1 @@
1
- export{TxType,isAddDelegatorTx,isAddPermissionlessDelegatorTx,isAddPermissionlessValidatorTx,isAddSubnetValidatorTx,isAddValidatorTx,isBaseTx,isCreateChainTx,isCreateSubnetTx,isExportTx,isImportTx,isRemoveSubnetValidatorTx,isTransferSubnetOwnershipTx,isTransformSubnetTx}from"./models.js";export{WalletAbstract}from"./wallets/WalletAbstract.js";export{WalletVoid}from"./wallets/WalletVoid.js";export{isObsidianApp}from"./wallets/ledger/isObsidianApp.js";export{getLedgerProvider}from"./wallets/ledger/getLedgerProvider.js";export{AddressWallet}from"./wallets/AddressWallet.js";export{MnemonicWalletVoid}from"./wallets/legacy/MnemonicWalletVoid.js";export{LedgerWallet}from"./wallets/legacy/LedgerWallet.js";export{MnemonicWallet}from"./wallets/legacy/MnemonicWallet.js";export{StaticSigner}from"./wallets/StaticSigner.js";export{SimpleSigner}from"./wallets/SimpleSigner.js";export{LedgerSigner}from"./wallets/ledger/LedgerSigner.js";export{SimpleLedgerSigner}from"./wallets/ledger/SimpleLedgerSigner.js";export{AbstractProvider}from"./providers/AbstractProvider.js";export{JsonRpcProvider}from"./providers/JsonRpcProvider.js";export{FujiContext,MainnetContext}from"./providers/constants.js";export{addSignaturesToAvalancheTx}from"./utils/addSignaturesToAvalancheTx.js";export{convertGlacierUtxo}from"./utils/convertGlacierUtxo.js";export{createAvalancheEvmUnsignedTx}from"./utils/createAvalancheEvmUnsignedTx.js";export{createAvalancheUnsignedTx}from"./utils/createAvalancheUnsignedTx.js";export{digestMessage}from"./utils/digestMessage.js";export{getAddressFromXpub}from"./utils/getAddressFromXpub.js";export{getAddressPublicKeyFromXpub}from"./utils/getAddressPublicKeyFromXpub.js";export{getPaginatedUTXOs,getUTXOsForAddresses}from"./utils/getAllUTXOs.js";export{getAssetBalance}from"./utils/getAssetBalance.js";export{getPchainUnixNow}from"./utils/getPchainUnixNow.js";export{getStakedAssetBalance}from"./utils/getStakedAssetBalance.js";export{getStakeForAddresses}from"./utils/getStakeForAddresses.js";export{getUnixNow}from"./utils/getUnixNow.js";export{getUtxoInfo}from"./utils/getUtxoInfo.js";export{getUtxosByTxFromGlacier}from"./utils/getUtxosByTxFromGlacier.js";export{getVmByChainAlias}from"./utils/getVmByChainAlias.js";export{getXpubFromMnemonic}from"./utils/getXpubFromMnemonic.js";export{isBech32Address}from"./utils/isBech32Address.js";export{parseAvalancheTx}from"./utils/parseAvalancheTx.js";export{emptySignature,populateCredential}from"./utils/populateCredential.js";export{signedTxToHex}from"./utils/signedTxToHex.js";export{sortUTXOsByAmount,sortUTXOsByAmountAscending,sortUTXOsByAmountDescending,sortUTXOsStaking}from"./utils/sortUTXOs.js";export{P_CHAIN_TX_SIZE_LIMIT,SizeSupportedTx,getMaximumUtxoSet}from"./utils/txSizeLimits.js";export{verifyDerivationPath}from"./utils/verifyDerivationPath.js";
1
+ export{TxType,isAddDelegatorTx,isAddPermissionlessDelegatorTx,isAddPermissionlessValidatorTx,isAddSubnetValidatorTx,isAddValidatorTx,isBaseTx,isConvertSubnetToL1Tx,isCreateChainTx,isCreateSubnetTx,isDisableL1ValidatorTx,isExportTx,isImportTx,isIncreaseL1ValidatorBalance,isRegisterL1ValidatorTx,isRemoveSubnetValidatorTx,isSetL1ValidatorWeightTx,isTransferSubnetOwnershipTx,isTransformSubnetTx}from"./models.js";export{WalletAbstract}from"./wallets/WalletAbstract.js";export{WalletVoid}from"./wallets/WalletVoid.js";export{isObsidianApp}from"./wallets/ledger/isObsidianApp.js";export{getLedgerProvider}from"./wallets/ledger/getLedgerProvider.js";export{AddressWallet}from"./wallets/AddressWallet.js";export{MnemonicWalletVoid}from"./wallets/legacy/MnemonicWalletVoid.js";export{LedgerWallet}from"./wallets/legacy/LedgerWallet.js";export{MnemonicWallet}from"./wallets/legacy/MnemonicWallet.js";export{StaticSigner}from"./wallets/StaticSigner.js";export{SimpleSigner}from"./wallets/SimpleSigner.js";export{LedgerSigner}from"./wallets/ledger/LedgerSigner.js";export{SimpleLedgerSigner}from"./wallets/ledger/SimpleLedgerSigner.js";export{LedgerLiveSigner}from"./wallets/ledger/LedgerLiveSigner.js";export{AbstractProvider}from"./providers/AbstractProvider.js";export{JsonRpcProvider}from"./providers/JsonRpcProvider.js";export{DevnetContext,FujiContext,MainnetContext}from"./providers/constants.js";export{addSignaturesToAvalancheTx}from"./utils/addSignaturesToAvalancheTx.js";export{convertGlacierUtxo}from"./utils/convertGlacierUtxo.js";export{createAvalancheEvmUnsignedTx}from"./utils/createAvalancheEvmUnsignedTx.js";export{createAvalancheUnsignedTx}from"./utils/createAvalancheUnsignedTx.js";export{digestMessage}from"./utils/digestMessage.js";export{getAddressFromXpub}from"./utils/getAddressFromXpub.js";export{getAddressPublicKeyFromXpub}from"./utils/getAddressPublicKeyFromXpub.js";export{getPaginatedUTXOs,getUTXOsForAddresses}from"./utils/getAllUTXOs.js";export{getAssetBalance}from"./utils/getAssetBalance.js";export{getPchainUnixNow}from"./utils/getPchainUnixNow.js";export{getStakedAssetBalance}from"./utils/getStakedAssetBalance.js";export{getStakeForAddresses}from"./utils/getStakeForAddresses.js";export{getUnixNow}from"./utils/getUnixNow.js";export{getUtxosByTxFromGlacier}from"./utils/getUtxosByTxFromGlacier.js";export{getVmByChainAlias}from"./utils/getVmByChainAlias.js";export{getXpubFromMnemonic}from"./utils/getXpubFromMnemonic.js";export{isBech32Address}from"./utils/isBech32Address.js";export{parseAvalancheTx}from"./utils/parseAvalancheTx.js";export{emptySignature,populateCredential}from"./utils/populateCredential.js";export{signedTxToHex}from"./utils/signedTxToHex.js";export{sortUTXOsByAmount,sortUTXOsByAmountAscending,sortUTXOsByAmountDescending,sortUTXOsStaking}from"./utils/sortUTXOs.js";export{P_CHAIN_TX_SIZE_LIMIT,SizeSupportedTx,getMaximumUtxoSet}from"./utils/txSizeLimits.js";export{verifyDerivationPath}from"./utils/verifyDerivationPath.js";export{getAvalancheDerivationPath}from"./utils/getAvalancheDerivationPath.js";
@@ -1,16 +1,17 @@
1
- import { VM, Common, OutputOwners, TransferableOutput, pvmSerial } from '@avalabs/avalanchejs';
1
+ import { VM, OutputOwners, TransferableOutput, Common, pvmSerial } from '@avalabs/avalanchejs';
2
2
 
3
3
  type ChainIDAlias = 'X' | 'P' | 'C';
4
4
  /**
5
5
  * Types for parsed transaction
6
6
  */
7
- type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx | UnknownTx;
7
+ type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | UnknownTx;
8
8
  interface FeeData {
9
9
  totalAvaxBurned: bigint;
10
10
  totalAvaxOutput: bigint;
11
11
  totalAvaxInput: bigint;
12
12
  isValidAvaxBurnedAmount: boolean;
13
13
  txFee: bigint;
14
+ baseFee: bigint;
14
15
  }
15
16
  interface TxBase extends FeeData {
16
17
  type: string;
@@ -24,6 +25,11 @@ declare enum TxType {
24
25
  Import = "import",
25
26
  CreateSubnet = "create_subnet",
26
27
  CreateChain = "create_chain",
28
+ ConvertSubnetToL1 = "convert_subnet_to_l1",
29
+ RegisterL1Validator = "register_l1_validator",
30
+ SetL1ValidatorWeight = "set_l1_validator_weight",
31
+ IncreaseL1ValidatorBalance = "increase_l1_validator_balance",
32
+ DisableL1Validator = "disable_l1_validator",
27
33
  AddSubnetValidator = "add_subnet_validator",
28
34
  RemoveSubnetValidator = "remove_subnet_validator",
29
35
  AddPermissionlessValidator = "add_permissionless_validator",
@@ -102,6 +108,35 @@ interface RemoveSubnetValidatorTx extends TxBase {
102
108
  nodeID: string;
103
109
  subnetID: string;
104
110
  }
111
+ interface ConvertSubnetToL1Tx extends TxBase {
112
+ type: TxType.ConvertSubnetToL1;
113
+ managerAddress: string;
114
+ validators: {
115
+ nodeId: string;
116
+ stake: bigint;
117
+ balance: bigint;
118
+ remainingBalanceOwners: string[];
119
+ deactivationOwners: string[];
120
+ }[];
121
+ subnetID: string;
122
+ chainID: string;
123
+ }
124
+ interface RegisterL1ValidatorTx extends TxBase {
125
+ type: TxType.RegisterL1Validator;
126
+ balance: bigint;
127
+ }
128
+ interface SetL1ValidatorWeightTx extends TxBase {
129
+ type: TxType.SetL1ValidatorWeight;
130
+ }
131
+ interface IncreaseL1ValidatorBalanceTx extends TxBase {
132
+ type: TxType.IncreaseL1ValidatorBalance;
133
+ balance: bigint;
134
+ validationId: string;
135
+ }
136
+ interface DisableL1ValidatorTx extends TxBase {
137
+ type: TxType.DisableL1Validator;
138
+ validationId: string;
139
+ }
105
140
  interface AddPermissionlessValidatorTx extends TxBase {
106
141
  type: TxType.AddPermissionlessValidator;
107
142
  nodeID: string;
@@ -111,7 +146,7 @@ interface AddPermissionlessValidatorTx extends TxBase {
111
146
  rewardOwner: OutputOwners;
112
147
  delegationRewardOwner: OutputOwners;
113
148
  stake: bigint;
114
- stakeOuts: TransferableOutput[];
149
+ stakeOuts: readonly TransferableOutput[];
115
150
  subnetID: string;
116
151
  publicKey: undefined | string;
117
152
  signature: undefined | string;
@@ -125,7 +160,7 @@ interface AddPermissionlessDelegatorTx extends TxBase {
125
160
  stake: bigint;
126
161
  subnetID: string;
127
162
  delegatorRewardsOwner: OutputOwners;
128
- stakeOuts: TransferableOutput[];
163
+ stakeOuts: readonly TransferableOutput[];
129
164
  }
130
165
  interface TransformSubnetTx extends TxBase {
131
166
  type: TxType.TransformSubnet;
@@ -140,7 +175,7 @@ interface TransformSubnetTx extends TxBase {
140
175
  minStakeDuration: number;
141
176
  maxStakeDuration: number;
142
177
  minDelegationFee: number;
143
- minDelegatorStake: number;
178
+ minDelegatorStake: bigint;
144
179
  maxValidatorWeightFactor: number;
145
180
  uptimeRequirement: number;
146
181
  }
@@ -161,6 +196,11 @@ declare function isAddDelegatorTx(tx: Tx): tx is AddDelegatorTx;
161
196
  declare function isExportTx(tx: Tx): tx is ExportTx;
162
197
  declare function isImportTx(tx: Tx): tx is ImportTx;
163
198
  declare function isBaseTx(tx: Tx): tx is BaseTx;
199
+ declare function isConvertSubnetToL1Tx(tx: Tx): tx is ConvertSubnetToL1Tx;
200
+ declare function isRegisterL1ValidatorTx(tx: Tx): tx is RegisterL1ValidatorTx;
201
+ declare function isSetL1ValidatorWeightTx(tx: Tx): tx is SetL1ValidatorWeightTx;
202
+ declare function isDisableL1ValidatorTx(tx: Tx): tx is DisableL1ValidatorTx;
203
+ declare function isIncreaseL1ValidatorBalance(tx: Tx): tx is IncreaseL1ValidatorBalanceTx;
164
204
  declare function isCreateSubnetTx(tx: Tx): tx is CreateSubnetTx;
165
205
  declare function isCreateChainTx(tx: Tx): tx is CreateChainTx;
166
206
  declare function isAddSubnetValidatorTx(tx: Tx): tx is AddSubnetValidatorTx;
@@ -170,4 +210,5 @@ declare function isAddPermissionlessDelegatorTx(tx: Tx): tx is AddPermissionless
170
210
  declare function isTransformSubnetTx(tx: Tx): tx is TransformSubnetTx;
171
211
  declare function isTransferSubnetOwnershipTx(tx: Tx): tx is TransferSubnetOwnershipTx;
172
212
 
173
- export { AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, CreateChainTx, CreateSubnetTx, ExportTx, FeeData, ImportTx, RemoveSubnetValidatorTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, TxType, UnknownTx, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isCreateChainTx, isCreateSubnetTx, isExportTx, isImportTx, isRemoveSubnetValidatorTx, isTransferSubnetOwnershipTx, isTransformSubnetTx };
213
+ export { TxType, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isConvertSubnetToL1Tx, isCreateChainTx, isCreateSubnetTx, isDisableL1ValidatorTx, isExportTx, isImportTx, isIncreaseL1ValidatorBalance, isRegisterL1ValidatorTx, isRemoveSubnetValidatorTx, isSetL1ValidatorWeightTx, isTransferSubnetOwnershipTx, isTransformSubnetTx };
214
+ export type { AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, ConvertSubnetToL1Tx, CreateChainTx, CreateSubnetTx, DisableL1ValidatorTx, ExportTx, FeeData, ImportTx, IncreaseL1ValidatorBalanceTx, RegisterL1ValidatorTx, RemoveSubnetValidatorTx, SetL1ValidatorWeightTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, UnknownTx };
@@ -1 +1 @@
1
- var e=(e=>(e.Base="base",e.AddValidator="add_validator",e.AddDelegator="add_delegator",e.Export="export",e.Import="import",e.CreateSubnet="create_subnet",e.CreateChain="create_chain",e.AddSubnetValidator="add_subnet_validator",e.RemoveSubnetValidator="remove_subnet_validator",e.AddPermissionlessValidator="add_permissionless_validator",e.AddPermissionlessDelegator="add_permissionless_delegator",e.TransformSubnet="transform_subnet",e.TransferSubnetOwnership="transfer_subnet_ownership",e.Unknown="unknown",e))(e||{});function t(e){return"add_validator"===e.type}function r(e){return"add_delegator"===e.type}function n(e){return"export"===e.type}function a(e){return"import"===e.type}function o(e){return"base"===e.type}function d(e){return"create_subnet"===e.type}function s(e){return"create_chain"===e.type}function i(e){return"add_subnet_validator"===e.type}function u(e){return"remove_subnet_validator"===e.type}function _(e){return"add_permissionless_validator"===e.type}function p(e){return"add_permissionless_delegator"===e.type}function l(e){return"transform_subnet"===e.type}function c(e){return"transfer_subnet_ownership"===e.type}export{e as TxType,r as isAddDelegatorTx,p as isAddPermissionlessDelegatorTx,_ as isAddPermissionlessValidatorTx,i as isAddSubnetValidatorTx,t as isAddValidatorTx,o as isBaseTx,s as isCreateChainTx,d as isCreateSubnetTx,n as isExportTx,a as isImportTx,u as isRemoveSubnetValidatorTx,c as isTransferSubnetOwnershipTx,l as isTransformSubnetTx};
1
+ var e=(e=>(e.Base="base",e.AddValidator="add_validator",e.AddDelegator="add_delegator",e.Export="export",e.Import="import",e.CreateSubnet="create_subnet",e.CreateChain="create_chain",e.ConvertSubnetToL1="convert_subnet_to_l1",e.RegisterL1Validator="register_l1_validator",e.SetL1ValidatorWeight="set_l1_validator_weight",e.IncreaseL1ValidatorBalance="increase_l1_validator_balance",e.DisableL1Validator="disable_l1_validator",e.AddSubnetValidator="add_subnet_validator",e.RemoveSubnetValidator="remove_subnet_validator",e.AddPermissionlessValidator="add_permissionless_validator",e.AddPermissionlessDelegator="add_permissionless_delegator",e.TransformSubnet="transform_subnet",e.TransferSubnetOwnership="transfer_subnet_ownership",e.Unknown="unknown",e))(e||{});function t(e){return"add_validator"===e.type}function r(e){return"add_delegator"===e.type}function n(e){return"export"===e.type}function a(e){return"import"===e.type}function o(e){return"base"===e.type}function i(e){return"convert_subnet_to_l1"===e.type}function d(e){return"register_l1_validator"===e.type}function s(e){return"set_l1_validator_weight"===e.type}function _(e){return"disable_l1_validator"===e.type}function u(e){return"increase_l1_validator_balance"===e.type}function l(e){return"create_subnet"===e.type}function c(e){return"create_chain"===e.type}function p(e){return"add_subnet_validator"===e.type}function b(e){return"remove_subnet_validator"===e.type}function f(e){return"add_permissionless_validator"===e.type}function v(e){return"add_permissionless_delegator"===e.type}function y(e){return"transform_subnet"===e.type}function m(e){return"transfer_subnet_ownership"===e.type}export{e as TxType,r as isAddDelegatorTx,v as isAddPermissionlessDelegatorTx,f as isAddPermissionlessValidatorTx,p as isAddSubnetValidatorTx,t as isAddValidatorTx,o as isBaseTx,i as isConvertSubnetToL1Tx,c as isCreateChainTx,l as isCreateSubnetTx,_ as isDisableL1ValidatorTx,n as isExportTx,a as isImportTx,u as isIncreaseL1ValidatorBalance,d as isRegisterL1ValidatorTx,b as isRemoveSubnetValidatorTx,s as isSetL1ValidatorWeightTx,m as isTransferSubnetOwnershipTx,y as isTransformSubnetTx};
@@ -1,18 +1,12 @@
1
1
  import * as _avalabs_avalanchejs_dist_vms_common from '@avalabs/avalanchejs/dist/vms/common';
2
- import * as ethers from 'ethers';
3
- import { JsonRpcProvider } from 'ethers';
4
- import { Context, avm, pvm, evm, VM, avaxSerial } from '@avalabs/avalanchejs';
2
+ import { Context, avm, pvm, evm, info, VM, avaxSerial } from '@avalabs/avalanchejs';
5
3
  import { ChainIDAlias } from '../models.js';
6
4
 
7
5
  declare class AbstractProvider {
8
6
  protected baseUrl: string;
9
7
  protected context: Context.Context;
10
- evmRpc: JsonRpcProvider;
11
- constructor(baseUrl: string, context: Context.Context);
12
- /**
13
- * @link https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData
14
- */
15
- getEvmFeeData(): Promise<ethers.FeeData>;
8
+ fetchOptions?: RequestInit | undefined;
9
+ constructor(baseUrl: string, context: Context.Context, fetchOptions?: RequestInit | undefined);
16
10
  getContext(): Context.Context;
17
11
  getChainID(chainAlias: ChainIDAlias): string;
18
12
  getNetworkID(): number;
@@ -20,6 +14,7 @@ declare class AbstractProvider {
20
14
  getApiX(): avm.AVMApi;
21
15
  getApiP(): pvm.PVMApi;
22
16
  getApiC(): evm.EVMApi;
17
+ getInfo(): info.InfoApi;
23
18
  getApi(chain: ChainIDAlias): avm.AVMApi | pvm.PVMApi | evm.EVMApi;
24
19
  getAvaxID(): string;
25
20
  getAddress(publicKey: Buffer, chain: ChainIDAlias): string;
@@ -1 +1 @@
1
- import{networkIDs as t,avm as e,pvm as s,evm as r,utils as i,secp256k1 as c}from"@avalabs/avalanchejs";import{strip0x as n}from"@avalabs/core-utils-sdk";import{signedTxToHex as a}from"../utils/signedTxToHex.js";import{JsonRpcProvider as o,SigningKey as u}from"ethers";const{parseBech32:h,format:p}=i,{publicKeyBytesToAddress:g}=c;class x{constructor(t,e){this.baseUrl=t,this.context=e;const s=`${t}/ext/bc/C/rpc`;this.evmRpc=new o(s)}evmRpc;async getEvmFeeData(){return this.evmRpc.getFeeData()}getContext(){return this.context}getChainID(t){switch(t){case"X":return this.context.xBlockchainID;case"P":return this.context.pBlockchainID;case"C":return this.context.cBlockchainID}}getNetworkID(){return this.context.networkID}getHrp(){return t.getHRP(this.getNetworkID())}getApiX(){return new e.AVMApi(this.baseUrl)}getApiP(){return new s.PVMApi(this.baseUrl)}getApiC(){return new r.EVMApi(this.baseUrl)}getApi(t){switch(t){case"X":return this.getApiX();case"P":return this.getApiP();case"C":return this.getApiC()}}getAvaxID(){return this.getContext().avaxAssetID}getAddress(t,e){const s=n(u.computePublicKey(t,!0)),r=Buffer.from(s,"hex"),i=g(r);return p(e,this.getHrp(),i)}getAddressFromBuffer(t,e){return p(e,this.getHrp(),t)}formatAddress(t,e){const[,s]=h(t);return p(e,this.getHrp(),s)}getApiByVM(t){switch(t){case"AVM":return this.getApiX();case"PVM":return this.getApiP();case"EVM":return this.getApiC()}}getApiByChainID(t){switch(t){case this.context.xBlockchainID:return this.getApiX();case this.context.pBlockchainID:return this.getApiP();case this.context.cBlockchainID:return this.getApiC()}}async issueTx(t){const e=t.unsignedTx.getVM(),s=a(t);return this.issueTxHex(s,e)}async issueTxHex(t,e){return this.getApiByVM(e).issueTx({tx:t})}async waitForTransaction(t,e,s=6e4){const i=this.getApiByVM(e),c=Date.now();return new Promise(((e,n)=>{const a=async()=>{let o;switch(s&&c+s<Date.now()&&n(new Error("Timeout")),o=i instanceof r.EVMApi?await i.getAtomicTxStatus(t):await i.getTxStatus({txID:t,includeReason:!0}),o.status){case"Accepted":case"Committed":return void e({success:!0});case"Dropped":case"Rejected":return void e({success:!1});default:setTimeout((()=>{a()}),1e3)}};a()}))}}export{x as AbstractProvider};
1
+ import{utils as t,secp256k1 as e,networkIDs as s,avm as i,pvm as r,evm as n,info as c}from"@avalabs/avalanchejs";import{strip0x as o}from"@avalabs/core-utils-sdk";import{signedTxToHex as h}from"../utils/signedTxToHex.js";import{SigningKey as a}from"ethers";const{parseBech32:p,format:u}=t,{publicKeyBytesToAddress:g}=e;class A{constructor(t,e,s){this.baseUrl=t,this.context=e,this.fetchOptions=s}getContext(){return this.context}getChainID(t){switch(t){case"X":return this.context.xBlockchainID;case"P":return this.context.pBlockchainID;case"C":return this.context.cBlockchainID}}getNetworkID(){return this.context.networkID}getHrp(){return s.getHRP(this.getNetworkID())}getApiX(){const t=new i.AVMApi(this.baseUrl);return this.fetchOptions&&t.setFetchOptions(this.fetchOptions),t}getApiP(){const t=new r.PVMApi(this.baseUrl);return this.fetchOptions&&t.setFetchOptions(this.fetchOptions),t}getApiC(){const t=new n.EVMApi(this.baseUrl);return this.fetchOptions&&t.setFetchOptions(this.fetchOptions),t}getInfo(){const t=new c.InfoApi(this.baseUrl);return this.fetchOptions&&t.setFetchOptions(this.fetchOptions),t}getApi(t){switch(t){case"X":return this.getApiX();case"P":return this.getApiP();case"C":return this.getApiC()}}getAvaxID(){return this.getContext().avaxAssetID}getAddress(t,e){const s=o(a.computePublicKey(t,!0)),i=Buffer.from(s,"hex"),r=g(i);return u(e,this.getHrp(),r)}getAddressFromBuffer(t,e){return u(e,this.getHrp(),t)}formatAddress(t,e){const[,s]=p(t);return u(e,this.getHrp(),s)}getApiByVM(t){switch(t){case"AVM":return this.getApiX();case"PVM":return this.getApiP();case"EVM":return this.getApiC()}}getApiByChainID(t){switch(t){case this.context.xBlockchainID:return this.getApiX();case this.context.pBlockchainID:return this.getApiP();case this.context.cBlockchainID:return this.getApiC()}}async issueTx(t){const e=t.unsignedTx.getVM(),s=h(t);return this.issueTxHex(s,e)}async issueTxHex(t,e){return this.getApiByVM(e).issueTx({tx:t})}async waitForTransaction(t,e,s=6e4){const i=this.getApiByVM(e),r=Date.now();return new Promise(((e,c)=>{const o=async()=>{let h;switch(s&&r+s<Date.now()&&c(new Error("Timeout")),h=i instanceof n.EVMApi?await i.getAtomicTxStatus(t):await i.getTxStatus({txID:t,includeReason:!0}),h.status){case"Accepted":case"Committed":return void e({success:!0});case"Dropped":case"Rejected":return void e({success:!1});default:setTimeout((()=>{o()}),1e3)}};o()}))}}export{A as AbstractProvider};
@@ -2,10 +2,11 @@ import { AbstractProvider } from './AbstractProvider.js';
2
2
  import { Context } from '@avalabs/avalanchejs';
3
3
 
4
4
  declare class JsonRpcProvider extends AbstractProvider {
5
- constructor(baseUrl: string, context: Context.Context);
5
+ constructor(baseUrl: string, context: Context.Context, fetchOptions?: RequestInit);
6
6
  static fromBaseURL(url: string): Promise<JsonRpcProvider>;
7
7
  static getDefaultMainnetProvider(): JsonRpcProvider;
8
8
  static getDefaultFujiProvider(): JsonRpcProvider;
9
+ static getDefaultDevnetProvider(): JsonRpcProvider;
9
10
  }
10
11
 
11
12
  export { JsonRpcProvider };
@@ -1 +1 @@
1
- import{AbstractProvider as r}from"./AbstractProvider.js";import{Context as t}from"@avalabs/avalanchejs";import{MainnetContext as a,FujiContext as e}from"./constants.js";import{AVALANCHE_XP_NETWORK as s,AVALANCHE_XP_TEST_NETWORK as o}from"@avalabs/core-chains-sdk";class n extends r{constructor(r,t){super(r,t)}static async fromBaseURL(r){const a=await t.getContextFromURI(r);return new n(r,a)}static getDefaultMainnetProvider(){return new n(s.rpcUrl,a)}static getDefaultFujiProvider(){return new n(o.rpcUrl,e)}}export{n as JsonRpcProvider};
1
+ import{AbstractProvider as r}from"./AbstractProvider.js";import{Context as t}from"@avalabs/avalanchejs";import{MainnetContext as e,FujiContext as a,DevnetContext as n}from"./constants.js";import{AVALANCHE_XP_NETWORK as s,AVALANCHE_XP_TEST_NETWORK as o,AVALANCHE_P_DEV_NETWORK as c}from"@avalabs/core-chains-sdk";class i extends r{constructor(r,t,e){super(r,t,e)}static async fromBaseURL(r){const e=await t.getContextFromURI(r);try{return new i(r,e)}catch{return new i(r,e)}}static getDefaultMainnetProvider(){return new i(s.rpcUrl,e)}static getDefaultFujiProvider(){return new i(o.rpcUrl,a)}static getDefaultDevnetProvider(){return new i(c.rpcUrl,n)}}export{i as JsonRpcProvider};
@@ -8,5 +8,6 @@ declare const MainnetContext: Context.Context;
8
8
  * Avalanche Fuji testnet context
9
9
  */
10
10
  declare const FujiContext: Context.Context;
11
+ declare const DevnetContext: Context.Context;
11
12
 
12
- export { FujiContext, MainnetContext };
13
+ export { DevnetContext, FujiContext, MainnetContext };
@@ -1 +1 @@
1
- const e={xBlockchainID:"2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM",pBlockchainID:"11111111111111111111111111111111LpoYY",cBlockchainID:"2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5",avaxAssetID:"FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",baseTxFee:BigInt(1e6),createAssetTxFee:BigInt(1e7),createSubnetTxFee:BigInt(1e9),transformSubnetTxFee:BigInt(1e10),createBlockchainTxFee:BigInt(1e9),addPrimaryNetworkValidatorFee:BigInt(0),addPrimaryNetworkDelegatorFee:BigInt(0),addSubnetValidatorFee:BigInt(1e6),addSubnetDelegatorFee:BigInt(1e6),networkID:1,hrp:"avax"},t={xBlockchainID:"2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm",pBlockchainID:"11111111111111111111111111111111LpoYY",cBlockchainID:"yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp",avaxAssetID:"U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK",baseTxFee:BigInt(1e6),createAssetTxFee:BigInt(1e7),createSubnetTxFee:BigInt(1e8),transformSubnetTxFee:BigInt(1e9),createBlockchainTxFee:BigInt(1e8),addPrimaryNetworkValidatorFee:BigInt(0),addPrimaryNetworkDelegatorFee:BigInt(0),addSubnetValidatorFee:BigInt(1e6),addSubnetDelegatorFee:BigInt(1e6),networkID:5,hrp:"fuji"};export{t as FujiContext,e as MainnetContext};
1
+ import{platformFeeConfig as e}from"./platformFeeConfig.js";const o={xBlockchainID:"2oYMBNV4eNHyqk2fjjV5nVQLDbtmNJzq5s3qs3Lo6ftnC6FByM",pBlockchainID:"11111111111111111111111111111111LpoYY",cBlockchainID:"2q9e4r6Mu3U68nU1fYjgbR6JvwrRx36CohpAX5UQxse55x1Q5",avaxAssetID:"FvwEAhmxKfeiG8SnEvq42hc6whRyY3EFYAvebMqDNDGCgxN5Z",baseTxFee:BigInt(1e6),createAssetTxFee:BigInt(1e7),networkID:1,hrp:"avax",platformFeeConfig:e},c={xBlockchainID:"2JVSBoinj9C2J33VntvzYtVJNZdN2NKiwwKjcumHUWEb5DbBrm",pBlockchainID:"11111111111111111111111111111111LpoYY",cBlockchainID:"yH8D7ThNJkxmtkuv2jgBa4P1Rn3Qpr4pPr7QYNfcdoS6k6HWp",avaxAssetID:"U8iRqJoiJm8xZHAacmvYyZVwqQx6uDNtQeP3CQ6fcgQk3JqnK",baseTxFee:BigInt(1e6),createAssetTxFee:BigInt(1e7),networkID:5,hrp:"fuji",platformFeeConfig:e},n={xBlockchainID:"2piQ2AVHCjnduiWXsSY15DtbVuwHE2cwMHYnEXHsLL73BBkdbV",pBlockchainID:"11111111111111111111111111111111LpoYY",cBlockchainID:"vV3cui1DsEPC3nLCGH9rorwo8s6BYxM2Hz4QFE5gEYjwTqAu",avaxAssetID:"22jjRVdyTJiAEtcZciAVR8bTFyVDUVoo1T3o5PiDspQSZ2maXR",baseTxFee:1000000n,createAssetTxFee:1000000n,networkID:76,hrp:"custom",platformFeeConfig:e};export{n as DevnetContext,c as FujiContext,o as MainnetContext};
@@ -0,0 +1 @@
1
+ import{Common as e}from"@avalabs/avalanchejs";const t={weights:e.createDimensions({bandwidth:1,dbRead:1e3,dbWrite:1e3,compute:4}),maxCapacity:BigInt(1e6),maxPerSecond:BigInt(1e5),targetPerSecond:BigInt(5e4),minPrice:BigInt(1),excessConversionConstant:BigInt(2164043)};export{t as platformFeeConfig};
@@ -1 +1 @@
1
- import{getVmByChainAlias as e}from"./getVmByChainAlias.js";import{Credential as t,UnsignedTx as r,avaxSerial as n,EVM as a,utils as s}from"@avalabs/avalanchejs";import{createAvalancheUnsignedTx as i}from"./createAvalancheUnsignedTx.js";import{populateCredential as o}from"./populateCredential.js";import{signedTxToHex as d}from"./signedTxToHex.js";const{getManagerForVM:c,hexToBuffer:x,unpackWithManager:g}=s,u=async({transactionHex:r,chainAlias:s,provider:d,utxos:u})=>{const p=e(s);if(p===a)throw new Error("EVM transactions are not supported");const l=x(r),m=g(p,l),h=await(async({tx:e,txBytes:r,provider:a,vm:s,utxos:d})=>{try{const x=c(s).unpack(r,n.SignedTx),g=await i({tx:e,utxos:d,provider:a,credentials:x.getCredentials()});return e.getSigIndices().map(((e,r)=>new t(o(e,{unsignedTx:g,credentialIndex:r}))))}catch(r){return e.getSigIndices().map((e=>new t(o(e))))}})({tx:m,txBytes:l,provider:d,vm:p,utxos:u});return i({tx:m,provider:d,credentials:h,utxos:u})},p=async({transactionHex:e,signatures:a,chainAlias:s,provider:i,utxos:o})=>{if(!a.length)throw new Error("signatures were not provided");const c=await u({transactionHex:e,chainAlias:s,provider:i,utxos:o});await Promise.all(a.map((e=>c.addSignature(e))));const x=c.getCredentials(),g=c.getSigIndices().reduce(((e,r,n)=>{const a=r.map((e=>{const t=x[n]?.toJSON()[e];if(!t)throw new Error(`Failed to sign [${n}, ${e}]`);return t}));return e.push(new t(a)),e}),[]),p=new r(c.getTx(),c.getInputUtxos(),c.addressMaps,g),l=new n.SignedTx(c.getTx(),g);return{signedTxHex:d(l),hasAllSignatures:p.hasAllSignatures()}};export{p as addSignaturesToAvalancheTx,p as default};
1
+ import{getVmByChainAlias as e}from"./getVmByChainAlias.js";import{utils as t,Credential as r,UnsignedTx as n,avaxSerial as a,EVM as s}from"@avalabs/avalanchejs";import i from"./createAvalancheUnsignedTx.js";import{populateCredential as o}from"./populateCredential.js";import{signedTxToHex as c}from"./signedTxToHex.js";const{getManagerForVM:d,hexToBuffer:x,unpackWithManager:g}=t,p=async({transactionHex:t,chainAlias:n,provider:c,utxos:p})=>{const u=e(n);if(u===s)throw new Error("EVM transactions are not supported");const l=x(t),m=g(u,l),h=await(async({tx:e,txBytes:t,provider:n,vm:s,utxos:c})=>{try{const x=d(s).unpack(t,a.SignedTx),g=await i({tx:e,utxos:c,provider:n,credentials:x.getCredentials()});return e.getSigIndices().map(((e,t)=>new r(o(e,{unsignedTx:g,credentialIndex:t}))))}catch(t){return e.getSigIndices().map((e=>new r(o(e))))}})({tx:m,txBytes:l,provider:c,vm:u,utxos:p});return i({tx:m,provider:c,credentials:h,utxos:p})},u=async({transactionHex:e,signatures:t,chainAlias:s,provider:i,utxos:o})=>{if(!t.length)throw new Error("signatures were not provided");const d=await p({transactionHex:e,chainAlias:s,provider:i,utxos:o});await Promise.all(t.map((e=>d.addSignature(e))));const x=d.getCredentials(),g=d.getSigIndices().reduce(((e,t,n)=>{const a=t.map((e=>{const t=x[n]?.toJSON()[e];if(!t)throw new Error(`Failed to sign [${n}, ${e}]`);return t}));return e.push(new r(a)),e}),[]),u=new n(d.getTx(),d.getInputUtxos(),d.addressMaps,g),l=new a.SignedTx(d.getTx(),g);return{signedTxHex:c(l),hasAllSignatures:u.hasAllSignatures()}};export{u as addSignaturesToAvalancheTx};
@@ -0,0 +1 @@
1
+ import{utils as a}from"@avalabs/avalanchejs";async function e(e,r,t){try{const{deactivationOwner:s}=await t.getApiP().getL1Validator(r.validationId.toString()),i=r.getDisableAuth().values(),n=s.addresses.reduce(((a,e,r)=>(i.includes(r)&&a.push([e,r]),a)),[]);return e.push(new a.AddressMap(n)),e}catch(a){throw new Error(`Error while preparing disableAuth data: ${a.message}`)}}export{e as appendDisableAuthAddressMaps};
@@ -1,7 +1,8 @@
1
- import { Utxo as Utxo$1 } from '@avalabs/avalanchejs';
2
- import { Utxo, PChainUtxo } from '@avalabs/glacier-sdk';
1
+ import { Utxo as Utxo$1, TransferOutput, pvmSerial } from '@avalabs/avalanchejs';
2
+ import { Utxo, PChainUtxo, Network } from '@avalabs/glacier-sdk';
3
3
 
4
4
  type GlacierOutput = Utxo | PChainUtxo;
5
- declare const convertGlacierUtxo: (glacierUtxo: GlacierOutput, isTestnet: boolean) => Utxo$1;
5
+ declare const convertGlacierUtxo: (glacierUtxo: GlacierOutput, network: Network) => Utxo$1<TransferOutput | pvmSerial.StakeableLockOut<TransferOutput>>;
6
6
 
7
- export { GlacierOutput, convertGlacierUtxo };
7
+ export { convertGlacierUtxo };
8
+ export type { GlacierOutput };
@@ -1 +1 @@
1
- import{Utxo as t,avaxSerial as e,Id as a,pvmSerial as o,BigIntPr as s,TransferOutput as n,OutputOwners as r,utils as m}from"@avalabs/avalanchejs";import{getChainAliasByChainId as i}from"./getChainAliasByChainId.js";const{bytesCompare:c,parseBech32:l}=m,d=(t,e)=>"P"===e,h=(t,e,a)=>{const o=d(0,e)?t.amount:t.asset?.amount;return new n(new s(BigInt(o)),r.fromNative(t.addresses.map((t=>l(t)[1])).sort(c),BigInt(a??0),t.threshold))},k=(n,r)=>{const m=i(n.createdOnChainId,r),c=d(0,m)?n.txHash:n.creationTxHash,l=d(0,m)?n.assetId:n.asset?.assetId;return new t(e.UTXOID.fromNative(c,Number(n.outputIndex)),a.fromString(l),((t,e)=>d(0,e)?t.stakeableLocktime?new o.StakeableLockOut(new s(BigInt(t.stakeableLocktime??0)),h(t,e,t.platformLocktime??0)):h(t,e,t.platformLocktime):h(t,e,t.locktime))(n,m))};export{k as convertGlacierUtxo};
1
+ import{utils as t,Utxo as e,avaxSerial as a,Id as o,pvmSerial as s,BigIntPr as n,TransferOutput as r,OutputOwners as m}from"@avalabs/avalanchejs";import{getChainAliasByChainId as i}from"./getChainAliasByChainId.js";const{bytesCompare:c,parseBech32:l}=t,d=(t,e)=>"P"===e,h=(t,e,a)=>{const o=d(0,e)?t.amount:t.asset?.amount;return new r(new n(BigInt(o)),m.fromNative(t.addresses.map((t=>l(t)[1])).sort(c),BigInt(a??0),t.threshold))},k=(t,r)=>{const m=i(t.createdOnChainId,r),c=d(0,m)?t.txHash:t.creationTxHash,l=d(0,m)?t.assetId:t.asset?.assetId;return new e(a.UTXOID.fromNative(c,Number(t.outputIndex)),o.fromString(l),((t,e)=>d(0,e)?t.stakeableLocktime?new s.StakeableLockOut(new n(BigInt(t.stakeableLocktime??0)),h(t,e,t.platformLocktime??0)):h(t,e,t.platformLocktime):h(t,e,t.locktime))(t,m))};export{k as convertGlacierUtxo};
@@ -1,11 +1,12 @@
1
- import { UnsignedTx, VM, Utxo } from '@avalabs/avalanchejs';
1
+ import { VM, Credential, Utxo, UnsignedTx } from '@avalabs/avalanchejs';
2
2
 
3
3
  type Params = {
4
4
  txBytes: Uint8Array;
5
5
  fromAddress: string;
6
6
  vm: VM;
7
+ credentials?: Credential[];
7
8
  utxos: Utxo[];
8
9
  };
9
- declare const createAvalancheEvmUnsignedTx: ({ txBytes, fromAddress, vm, utxos, }: Params) => Promise<UnsignedTx>;
10
+ declare const createAvalancheEvmUnsignedTx: ({ txBytes, fromAddress, vm, credentials, utxos, }: Params) => Promise<UnsignedTx>;
10
11
 
11
12
  export { createAvalancheEvmUnsignedTx };
@@ -1 +1 @@
1
- import{evmSerial as r,EVMUnsignedTx as e,UnsignedTx as t,utils as s}from"@avalabs/avalanchejs";const{unpackWithManager:n,parse:o,bufferToHex:a,AddressMaps:p,AddressMap:f}=s,i=async({txBytes:s,fromAddress:i,vm:m,utxos:d})=>{const u=n(m,s),c=o(i)[2],x=a(c);if(r.isExportTx(u))return new e(u,[],new p([f.fromJSON([[x,0]])]));if(r.isImportTx(u)){const r=p.fromTransferableInputs(u.importedInputs,d,BigInt(Math.floor((new Date).getTime()/1e3)),[c]);return new t(u,d,r)}throw new Error("Unsupported transaction type")};export{i as createAvalancheEvmUnsignedTx};
1
+ import{utils as r,evmSerial as e,EVMUnsignedTx as t,UnsignedTx as s}from"@avalabs/avalanchejs";const{unpackWithManager:n,parse:a,bufferToHex:o,AddressMaps:p,AddressMap:i}=r,f=async({txBytes:r,fromAddress:f,vm:d,credentials:m,utxos:c})=>{const u=n(d,r),x=a(f)[2],w=o(x);if(e.isExportTx(u))return new t(u,[],new p([i.fromJSON([[w,0]])]),m);if(e.isImportTx(u)){const r=p.fromTransferableInputs(u.importedInputs,c,BigInt(Math.floor((new Date).getTime()/1e3)),[x]);return new s(u,c,r,m)}throw new Error("Unsupported transaction type")};export{f as createAvalancheEvmUnsignedTx};
@@ -1,4 +1,4 @@
1
- import { UnsignedTx, avaxSerial, Credential, Utxo } from '@avalabs/avalanchejs';
1
+ import { avaxSerial, Credential, Utxo, UnsignedTx } from '@avalabs/avalanchejs';
2
2
  import { JsonRpcProvider } from '../providers/JsonRpcProvider.js';
3
3
 
4
4
  type Params = {
@@ -1 +1 @@
1
- import{UnsignedTx as r,utils as e}from"@avalabs/avalanchejs";import{isSubnetTx as t,handleSubnetAuth as a}from"./handleSubnetAuth.js";const{getTransferableInputsByTx:s,AddressMaps:n}=e,o=async({tx:e,fromAddressBytes:o,provider:i,credentials:d,utxos:p})=>{const u=s(e),f=n.fromTransferableInputs(u,p,BigInt(Math.floor((new Date).getTime()/1e3)),o);if(t(e))try{const t=await a({tx:e,provider:i,addressMaps:f});return new r(e,p,t,d)}catch(r){throw new Error(`Error while preparing subnet authorization data: ${r.message}`)}return new r(e,p,f,d)};export{o as createAvalancheUnsignedTx,o as default};
1
+ import{utils as e,UnsignedTx as r,pvmSerial as a}from"@avalabs/avalanchejs";import{isSubnetTx as t,handleSubnetAuth as s}from"./handleSubnetAuth.js";import{appendDisableAuthAddressMaps as n}from"./appendDisableAuthAddressMaps.js";const{getTransferableInputsByTx:o,AddressMaps:i}=e,d=async({tx:e,fromAddressBytes:d,provider:p,credentials:l,utxos:u})=>{const f=o(e);let m=i.fromTransferableInputs(f,u,BigInt(Math.floor((new Date).getTime()/1e3)),d);if(t(e))try{const a=await s({tx:e,provider:p,addressMaps:m});return new r(e,u,a,l)}catch(e){throw new Error(`Error while preparing subnet authorization data: ${e.message}`)}else a.isDisableL1ValidatorTx(e)&&(m=await n(m,e,p));return new r(e,u,m,l)};var p=d;export{d as createAvalancheUnsignedTx,p as default};
@@ -26,4 +26,5 @@ interface GetAvaxBalanceDict {
26
26
  */
27
27
  declare function getAssetBalance(utxoSet: utils.UtxoSet, assetID: string): GetAvaxBalanceDict;
28
28
 
29
- export { GetAvaxBalanceDict, getAssetBalance };
29
+ export { getAssetBalance };
30
+ export type { GetAvaxBalanceDict };
@@ -1 +1 @@
1
- import{getUnixNow as t}from"./getUnixNow.js";import{getUtxoInfo as e}from"./getUtxoInfo.js";function o(o,l){const i=o.getAssetDict()[l],a={locked:BigInt(0),available:BigInt(0),multisig:BigInt(0),lockedStakeable:BigInt(0),total:BigInt(0)};if(!i)return a;const n=i.getUTXOs(),c=t();return n.forEach((t=>{const o=e(t);a[o.threshold>1?"multisig":o.locktime>c?"locked":o.stakeableLocktime>c?"lockedStakeable":"available"]+=o.amount})),a.total=a.locked+a.lockedStakeable+a.multisig+a.available,a}export{o as getAssetBalance};
1
+ import{utils as t}from"@avalabs/avalanchejs";import{getUnixNow as e}from"./getUnixNow.js";const{getUtxoInfo:a}=t;function o(t,o){const l=t.getAssetDict()[o],i={locked:BigInt(0),available:BigInt(0),multisig:BigInt(0),lockedStakeable:BigInt(0),total:BigInt(0)};if(!l)return i;const n=l.getUTXOs(),c=e();return n.forEach((t=>{const e=a(t);i[e.threshold>1?"multisig":e.locktime>c?"locked":e.stakeableLocktime>c?"lockedStakeable":"available"]+=e.amount})),i.total=i.locked+i.lockedStakeable+i.multisig+i.available,i}export{o as getAssetBalance};
@@ -0,0 +1,3 @@
1
+ declare const getAvalancheDerivationPath: (accountIndex: number, withRoot?: boolean) => string;
2
+
3
+ export { getAvalancheDerivationPath };
@@ -0,0 +1 @@
1
+ const o=(o,t=!0)=>`${t?"m/":""}44'/9000'/${o}'/0/0`;export{o as getAvalancheDerivationPath};
@@ -1 +1 @@
1
- import"@avalabs/avalanchejs";import"@avalabs/core-utils-sdk";import"ethers";import{FujiContext as r,MainnetContext as o}from"../providers/constants.js";import"@avalabs/core-chains-sdk";const a=(a,n)=>{const{cBlockchainID:t,xBlockchainID:c,pBlockchainID:i}=n?r:o;if(t===a)return"C";if(c===a)return"X";if(i===a)return"P";throw new Error(`Unknown chainId "${a}"`)};export{a as getChainAliasByChainId};
1
+ import{Network as r}from"@avalabs/glacier-sdk";import"../providers/AbstractProvider.js";import"@avalabs/avalanchejs";import{FujiContext as o,MainnetContext as a}from"../providers/constants.js";import"@avalabs/core-chains-sdk";const i=(i,n)=>{const c=n===r.FUJI,{cBlockchainID:s,xBlockchainID:t,pBlockchainID:e}=c?o:a;if(s===i)return"C";if(t===i)return"X";if(e===i)return"P";throw new Error(`Unknown chainId "${i}"`)};export{i as getChainAliasByChainId};
@@ -1,6 +1,8 @@
1
+ import { AbstractProvider } from '../providers/AbstractProvider.js';
2
+
1
3
  /**
2
4
  * Get the current p-chain timestamp in unix
3
5
  */
4
- declare function getPchainUnixNow(isTestnet: boolean): Promise<bigint>;
6
+ declare function getPchainUnixNow(provider: AbstractProvider): Promise<bigint>;
5
7
 
6
8
  export { getPchainUnixNow };
@@ -1 +1 @@
1
- import{JsonRpcProvider as e}from"../providers/JsonRpcProvider.js";async function t(t){const i=t?e.getDefaultFujiProvider():e.getDefaultMainnetProvider(),r=await i.getApiP().getTimestamp(),o=new Date(r.timestamp),a=Math.floor(o.getTime()/1e3);return BigInt(a)}export{t as getPchainUnixNow};
1
+ async function t(t){const e=await t.getApiP().getTimestamp(),a=new Date(e.timestamp),i=Math.floor(a.getTime()/1e3);return BigInt(i)}export{t as getPchainUnixNow};
@@ -13,4 +13,5 @@ interface GetStakedAvaxBalanceDict {
13
13
  }
14
14
  declare function getStakedAssetBalance(stakeResponse: pvm.GetStakeResponse): GetStakedAvaxBalanceDict;
15
15
 
16
- export { GetStakedAvaxBalanceDict, getStakedAssetBalance };
16
+ export { getStakedAssetBalance };
17
+ export type { GetStakedAvaxBalanceDict };
@@ -1 +1 @@
1
- import{avmSerial as t,pvmSerial as e,evmSerial as a,utils as o}from"@avalabs/avalanchejs";const{isTransferOut:s,isStakeableLockOut:n}=o;function r(t){const e=t.output;return s(e)||n(e)?e.getOwners():[]}function u(o){const s=o.getTx();return t.isExportTx(s)||e.isExportTx(s)?new Set(s.outs.map(r).flat()):a.isExportTx(s)?new Set(s.exportedOutputs.map(r).flat()):new Set((s.baseTx?.outputs??[]).map(r).flat())}export{r as getOutputAddresses,u as getTxOutputAddresses};
1
+ import{utils as t,avmSerial as e,pvmSerial as a,evmSerial as o}from"@avalabs/avalanchejs";const{isTransferOut:s,isStakeableLockOut:n}=t;function r(t){const e=t.output;return s(e)||n(e)?e.getOwners():[]}function u(t){const s=t.getTx();return e.isExportTx(s)||a.isExportTx(s)?new Set(s.outs.map(r).flat()):o.isExportTx(s)?new Set(s.exportedOutputs.map(r).flat()):new Set((s.baseTx?.outputs??[]).map(r).flat())}export{r as getOutputAddresses,u as getTxOutputAddresses};
@@ -1,14 +1,16 @@
1
+ import * as _avalabs_avalanchejs_dist_serializable_common_types from '@avalabs/avalanchejs/dist/serializable/common/types';
2
+ import { Network } from '@avalabs/glacier-sdk';
1
3
  import { Utxo } from '@avalabs/avalanchejs';
2
4
  import { ChainIDAlias } from '../models.js';
3
5
 
4
6
  type Params = {
5
7
  transactionHex: string;
6
8
  chainAlias: ChainIDAlias;
7
- isTestnet: boolean;
9
+ network: Network;
8
10
  url: string;
9
11
  token?: string;
10
12
  headers?: Record<string, string>;
11
13
  };
12
- declare const getUtxosByTxFromGlacier: ({ transactionHex, chainAlias, isTestnet, url, token, headers, }: Params) => Promise<Utxo[]>;
14
+ declare const getUtxosByTxFromGlacier: ({ transactionHex, chainAlias, network, url, token, headers, }: Params) => Promise<Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[]>;
13
15
 
14
16
  export { getUtxosByTxFromGlacier };
@@ -1 +1 @@
1
- import{Glacier as t,Network as r,BlockchainId as o}from"@avalabs/glacier-sdk";import{evmSerial as e,utils as n,avmSerial as a,pvmSerial as i,PVM as s,AVM as x,EVM as c}from"@avalabs/avalanchejs";import{getVmByChainAlias as u}from"./getVmByChainAlias.js";import{convertGlacierUtxo as I}from"./convertGlacierUtxo.js";const{getTransferableInputsByTx:p,hexToBuffer:f,unpackWithManager:h}=n,l=async({transactionHex:n,chainAlias:l,isTestnet:m,url:d,token:T,headers:w})=>{const D=u(l),g=f(n),E=h(D,g);if(e.isExportTx(E))return[];const A=(t=>{if(e.isImportTx(t)||a.isImportTx(t)||i.isImportTx(t))return t.sourceChain.toString();const r=t.getVM();switch(r){case c:return o.C_CHAIN;case x:return o.X_CHAIN;case s:return o.P_CHAIN;default:throw new Error(`Unable to get chain for VM type "${r}"`)}})(E),H=p(E),b=new t({BASE:d,TOKEN:T,HEADERS:w}),N=m?r.FUJI:r.MAINNET,S=[...new Set(H.map((t=>t.utxoID.txID.toString())))],U=await Promise.all(S.map((t=>b.primaryNetworkTransactions.getTxByHash({blockchainId:A,network:N,txHash:t}))));return H.reduce(((t,r)=>{const o=U.find((t=>t.txHash===r.utxoID.txID.toString()));if(!o)throw new Error(`Unable to find parent tx "${r.utxoID.txID.toString()}"`);const e=o.emittedUtxos.find((t=>t.utxoId===r.utxoID.ID()));if(!e)throw new Error(`Unable to find UTXO "${r.utxoID.ID()}" at index "${r.utxoID.outputIdx.value()}"`);const n=I(e,m);return t.push(n),t}),[])};export{l as getUtxosByTxFromGlacier};
1
+ import{Glacier as t,BlockchainId as r}from"@avalabs/glacier-sdk";import{utils as o,evmSerial as e,avmSerial as n,pvmSerial as a,PVM as i,AVM as s,EVM as x}from"@avalabs/avalanchejs";import{getVmByChainAlias as c}from"./getVmByChainAlias.js";import{convertGlacierUtxo as u}from"./convertGlacierUtxo.js";const{getTransferableInputsByTx:I,hexToBuffer:p,unpackWithManager:f}=o,h=async({transactionHex:o,chainAlias:h,network:l,url:m,token:d,headers:w})=>{const D=c(h),g=p(o),T=f(D,g);if(e.isExportTx(T))return[];const E=(t=>{if(e.isImportTx(t)||n.isImportTx(t)||a.isImportTx(t))return t.sourceChain.toString();const o=t.getVM();switch(o){case x:return r.C_CHAIN;case s:return r.X_CHAIN;case i:return r.P_CHAIN;default:throw new Error(`Unable to get chain for VM type "${o}"`)}})(T),H=I(T),b=new t({BASE:m,TOKEN:d,HEADERS:w}),k=[...new Set(H.map((t=>t.utxoID.txID.toString())))],A=await Promise.all(k.map((t=>b.primaryNetworkTransactions.getTxByHash({blockchainId:E,network:l,txHash:t}))));return H.reduce(((t,r)=>{const o=A.find((t=>t.txHash===r.utxoID.txID.toString()));if(!o)throw new Error(`Unable to find parent tx "${r.utxoID.txID.toString()}"`);const e=o.emittedUtxos.find((t=>t.utxoId===r.utxoID.ID()));if(!e)throw new Error(`Unable to find UTXO "${r.utxoID.ID()}" at index "${r.utxoID.outputIdx.value()}"`);const n=u(e,l);return t.push(n),t}),[])};export{h as getUtxosByTxFromGlacier};
@@ -1,3 +1,3 @@
1
- declare const getVmByChainAlias: (chainAlias: string) => "EVM" | "AVM" | "PVM";
1
+ declare const getVmByChainAlias: (chainAlias: string) => "AVM" | "EVM" | "PVM";
2
2
 
3
3
  export { getVmByChainAlias };
@@ -2,6 +2,6 @@
2
2
  * Get the xpub for m/44'/9000'/0' from the given mnemonic
3
3
  * @param mnemonic
4
4
  */
5
- declare function getXpubFromMnemonic(mnemonic: string): string;
5
+ declare function getXpubFromMnemonic(mnemonic: string, accountIndex: number): string;
6
6
 
7
7
  export { getXpubFromMnemonic };
@@ -1 +1 @@
1
- import{validateMnemonic as r,mnemonicToSeedSync as e}from"bip39";import{fromSeed as o}from"bip32";function t(t){if(!r(t))throw new Error("Invalid mnemonic phrase.");const i=e(t);return o(i).derivePath("44'/9000'/0'").neutered().toBase58()}export{t as getXpubFromMnemonic};
1
+ import{validateMnemonic as r,mnemonicToSeedSync as e}from"bip39";import{fromSeed as o}from"bip32";function t(t,i){if(!r(t))throw new Error("Invalid mnemonic phrase.");const n=e(t);return o(n).derivePath(`44'/9000'/${i}'`).neutered().toBase58()}export{t as getXpubFromMnemonic};
@@ -1 +1 @@
1
- import{pvmSerial as e,utils as s}from"@avalabs/avalanchejs";const t=s=>e.isCreateChainTx(s)||e.isAddSubnetValidatorTx(s)||e.isRemoveSubnetValidatorTx(s)||e.isTransformSubnetTx(s)||e.isTransferSubnetOwnershipTx(s),a=async({tx:e,provider:t,addressMaps:a})=>{const n=e.getSubnetAuth().values(),r=(await t.getApiP().getTx({txID:e.getSubnetID().value()})).unsignedTx.getSubnetOwners().addrs.reduce(((e,s,t)=>(n.includes(t)&&e.push([s,t]),e)),[]);return a.push(new s.AddressMap(r)),a};export{a as handleSubnetAuth,t as isSubnetTx};
1
+ import{pvmSerial as e,OutputOwners as t,utils as s}from"@avalabs/avalanchejs";const a=t=>e.isCreateChainTx(t)||e.isAddSubnetValidatorTx(t)||e.isRemoveSubnetValidatorTx(t)||e.isTransformSubnetTx(t)||e.isTransferSubnetOwnershipTx(t)||e.isConvertSubnetToL1Tx(t),r=async({tx:e,provider:a,addressMaps:r})=>{const n=e.getSubnetAuth().values(),i=await a.getApiP().getSubnet({subnetID:e.getSubnetID().value()}),u=t.fromNative(i.controlKeys.map((e=>s.parse(e)[2])),BigInt(i.locktime),Number(i.threshold)).addrs.reduce(((e,t,s)=>(n.includes(s)&&e.push([t,s]),e)),[]);return r.push(new s.AddressMap(u)),r};export{r as handleSubnetAuth,a as isSubnetTx};
@@ -0,0 +1 @@
1
+ function r(r,t,n){return[...r].sort(((r,e)=>{for(let o=0;o<t.length;o++){const u=t[o];if(r[u]>e[u])return"asc"===n?1:-1;if(r[u]<e[u])return"asc"===n?-1:1}return 0}))}export{r as orderBy};
@@ -2,9 +2,20 @@ import { Common } from '@avalabs/avalanchejs';
2
2
  import { Tx } from '../models.js';
3
3
  import { JsonRpcProvider } from '../providers/JsonRpcProvider.js';
4
4
 
5
+ type ParseOptions = {
6
+ /**
7
+ * Tolerance percentage range where the burned amount is considered valid.
8
+ */
9
+ feeTolerance?: number;
10
+ /**
11
+ * Base fee used for validating burn amount. Priced in nAvax.
12
+ */
13
+ baseFee?: bigint;
14
+ };
5
15
  /**
6
16
  * Returns human readable data from a given a transaction buffer,
7
17
  */
8
- declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string): Promise<Tx>;
18
+ declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string, { feeTolerance, baseFee: inputBaseFee }?: ParseOptions): Promise<Tx>;
9
19
 
10
20
  export { parseAvalancheTx };
21
+ export type { ParseOptions };
@@ -1 +1 @@
1
- import{evmSerial as t,utils as e}from"@avalabs/avalanchejs";import{TxType as n}from"../models.js";import a from"./parsers/index.js";const{getBurnedAmountByTx:r,getOutputAmounts:o,getInputAmounts:s,validateBurnedAmount:u}=e;async function i(e,i,x){try{const n=i.getContext(),d=e.getTx(),m=(t=>{for(const e of Object.values(a)){const n=e(t);if(null!==n)return n}throw new Error("no parser found for tx")})(d),A=r(d),g=o(d),p=s(d).get(n.avaxAssetID)??BigInt(0),v=A.get(n.avaxAssetID)??BigInt(0),c=g.get(n.avaxAssetID)??BigInt(0),{isValid:l,txFee:I}=u({unsignedTx:e,context:n,burnedAmount:v,...t.isImportExportTx(d)&&{evmBaseFee:await i.getApiC().getBaseFee()/BigInt(1e9),evmFeeTolerance:50}});return await m({feeData:{totalAvaxBurned:v,totalAvaxOutput:c,totalAvaxInput:p,isValidAvaxBurnedAmount:l,txFee:I},assetId:n.avaxAssetID,provider:i,currentAddress:x})}catch(t){return{type:n.Unknown}}}export{i as parseAvalancheTx};
1
+ import{utils as t,evmSerial as e}from"@avalabs/avalanchejs";import{TxType as n}from"../models.js";import a from"./parsers/index.js";const{getBurnedAmountByTx:o,getOutputAmounts:r,getInputAmounts:s,validateBurnedAmount:i}=t;async function u(t,u,x,{feeTolerance:c=50,baseFee:g}={}){try{const n=u.getContext(),d=t.getTx(),p=(t=>{for(const e of Object.values(a)){const n=e(t);if(null!==n)return n}throw new Error("no parser found for tx")})(d),A=o(d,n),l=r(d),m=s(d).get(n.avaxAssetID)??BigInt(0),v=A.get(n.avaxAssetID)??BigInt(0),I=l.get(n.avaxAssetID)??BigInt(0);let f=g;void 0===f&&(f=0n,e.isImportExportTx(d)?(f=await u.getApiC().getBaseFee()/BigInt(1e9),0n===f&&(f=1n)):"PVM"===d.vm&&(f=await u.getApiP().getFeeState().then((t=>t.price)).catch((()=>BigInt(0)))));const{isValid:B,txFee:F}=i({unsignedTx:t,context:n,burnedAmount:v,baseFee:f,feeTolerance:c});return await p({feeData:{totalAvaxBurned:v,totalAvaxOutput:I,totalAvaxInput:m,isValidAvaxBurnedAmount:B,txFee:F,baseFee:f},assetId:n.avaxAssetID,provider:u,currentAddress:x})}catch(t){return{type:n.Unknown}}}export{u as parseAvalancheTx};
@@ -1 +1 @@
1
- import r from"./parseAddValidatorTx.js";import e from"./parseAddDelegatorTx.js";import s from"./parseCreateSubnetTx.js";import a from"./parseCreateChainTx.js";import o from"./parseAddSubnetValidorTx.js";import p from"./parseImportTx.js";import t from"./parseExportTx.js";import m from"./parseBaseTx.js";import i from"./parseAddPermissionlessValidatorTx.js";import T from"./parseAddPermissionlessDelegatorTx.js";import d from"./parseRemoveSubnetValidatorTx.js";import x from"./parseTransformSubnetTx.js";import n from"./parseTransferSubnetOwnershipTx.js";var f={parseAddValidatorTx:r,parseAddDelegatorTx:e,parseCreateSubnetTx:s,parseCreateChainTx:a,parseAddSubnetValidatorTx:o,parseRemoveSubnetValidatorTx:d,parseImportTx:p,parseExportTx:t,parseBaseTx:m,parseAddPermissionlessValidatorTx:i,parseAddPermissionlessDelegatorTx:T,parseTransformSubnetTx:x,parseTransferSubnetOwnershipTx:n};export{f as default};
1
+ import r from"./parseCreateSubnetTx.js";import e from"./parseCreateChainTx.js";import a from"./parseAddSubnetValidorTx.js";import s from"./parseImportTx.js";import o from"./parseExportTx.js";import t from"./parseBaseTx.js";import p from"./parseAddPermissionlessValidatorTx.js";import i from"./parseAddPermissionlessDelegatorTx.js";import m from"./parseRemoveSubnetValidatorTx.js";import x from"./parseTransferSubnetOwnershipTx.js";import T from"./parseConvertSubnetToL1Tx.js";import d from"./parseRegisterL1ValidatorTx.js";import n from"./parseSetL1ValidatorWeightTx.js";import l from"./parseDisableL1ValidatorTx.js";import f from"./parseIncreaseL1ValidatorBalanceTx.js";var j={parseCreateSubnetTx:r,parseCreateChainTx:e,parseAddSubnetValidatorTx:a,parseRemoveSubnetValidatorTx:m,parseImportTx:s,parseExportTx:o,parseBaseTx:t,parseAddPermissionlessValidatorTx:p,parseAddPermissionlessDelegatorTx:i,parseTransferSubnetOwnershipTx:x,parseConvertSubnetTx:T,parseRegisterL1ValidatorTx:d,parseIncreaseL1ValidatorBalanceTx:f,parseSetL1ValidatorWeightTx:n,parseDisableL1ValidatorTx:l};export{j as default};
@@ -1 +1 @@
1
- import{pvmSerial as e}from"@avalabs/avalanchejs";import{TxType as a}from"../../models.js";const t=t=>e.isAddPermissionlessDelegatorTx(t)?({feeData:e,assetId:s})=>({type:a.AddPermissionlessDelegator,chain:t.getVM(),stake:t.subnetValidator.validator.weight.value(),nodeID:t.subnetValidator.validator.nodeId.value(),start:t.subnetValidator.validator.startTime.value().toString(),end:t.subnetValidator.validator.endTime.value().toString(),subnetID:t.subnetValidator.subnetId.value(),stakeOuts:t.stake,delegatorRewardsOwner:t.getDelegatorRewardsOwner(),...e}):null;export{t as default};
1
+ import{pvmSerial as e}from"@avalabs/avalanchejs";import{TxType as a}from"../../models.js";var t=t=>e.isAddPermissionlessDelegatorTx(t)?({feeData:e})=>({type:a.AddPermissionlessDelegator,chain:t.getVM(),stake:t.subnetValidator.validator.weight.value(),nodeID:t.subnetValidator.validator.nodeId.value(),start:t.subnetValidator.validator.startTime.value().toString(),end:t.subnetValidator.validator.endTime.value().toString(),subnetID:t.subnetValidator.subnetId.value(),stakeOuts:t.stake,delegatorRewardsOwner:t.getDelegatorRewardsOwner(),...e}):null;export{t as default};
@@ -1 +1 @@
1
- import{pvmSerial as e,utils as a}from"@avalabs/avalanchejs";import{TxType as t}from"../../models.js";const r=r=>{if(!e.isAddPermissionlessValidatorTx(r))return null;let s,i;return e.isSigner(r.signer)&&(i=a.bufferToHex(r.signer.proof.publicKey),s=a.bufferToHex(r.signer.proof.signature)),({feeData:e,assetId:a})=>({type:t.AddPermissionlessValidator,chain:r.getVM(),stake:r.subnetValidator.validator.weight.value(),nodeID:r.subnetValidator.validator.nodeId.value(),start:r.subnetValidator.validator.startTime.value().toString(),end:r.subnetValidator.validator.endTime.value().toString(),subnetID:r.subnetValidator.subnetId.value(),delegationFee:r.shares.value(),stakeOuts:r.stake,rewardOwner:r.getValidatorRewardsOwner(),delegationRewardOwner:r.getDelegatorRewardsOwner(),signer:r.signer,publicKey:i,signature:s,...e})};export{r as default};
1
+ import{pvmSerial as e,utils as a}from"@avalabs/avalanchejs";import{TxType as r}from"../../models.js";var t=t=>{if(!e.isAddPermissionlessValidatorTx(t))return null;let i,s;return e.isSigner(t.signer)&&(s=a.bufferToHex(t.signer.proof.publicKey),i=a.bufferToHex(t.signer.proof.signature)),({feeData:e})=>({type:r.AddPermissionlessValidator,chain:t.getVM(),stake:t.subnetValidator.validator.weight.value(),nodeID:t.subnetValidator.validator.nodeId.value(),start:t.subnetValidator.validator.startTime.value().toString(),end:t.subnetValidator.validator.endTime.value().toString(),subnetID:t.subnetValidator.subnetId.value(),delegationFee:t.shares.value(),stakeOuts:t.stake,rewardOwner:t.getValidatorRewardsOwner(),delegationRewardOwner:t.getDelegatorRewardsOwner(),signer:t.signer,publicKey:s,signature:i,...e})};export{t as default};
@@ -1 +1 @@
1
- import{pvmSerial as a}from"@avalabs/avalanchejs";import{TxType as t}from"../../models.js";const e=e=>a.isAddSubnetValidatorTx(e)?({feeData:a})=>({type:t.AddSubnetValidator,chain:e.getVM(),stake:e.subnetValidator.validator.weight.value(),nodeID:e.subnetValidator.validator.nodeId.value(),start:e.subnetValidator.validator.startTime.value().toString(),end:e.subnetValidator.validator.endTime.value().toString(),subnetID:e.getSubnetID().value(),...a}):null;export{e as default};
1
+ import{pvmSerial as a}from"@avalabs/avalanchejs";import{TxType as t}from"../../models.js";var e=e=>a.isAddSubnetValidatorTx(e)?({feeData:a})=>({type:t.AddSubnetValidator,chain:e.getVM(),stake:e.subnetValidator.validator.weight.value(),nodeID:e.subnetValidator.validator.nodeId.value(),start:e.subnetValidator.validator.startTime.value().toString(),end:e.subnetValidator.validator.endTime.value().toString(),subnetID:e.getSubnetID().value(),...a}):null;export{e as default};
@@ -1 +1 @@
1
- import{avmSerial as t,pvmSerial as e,TransferOutput as s}from"@avalabs/avalanchejs";import o from"xss";import{TxType as u}from"../../models.js";import{getUnixNow as a}from"../getUnixNow.js";const r=r=>t.isAvmBaseTx(r)||e.isPvmBaseTx(r)?async({feeData:e,currentAddress:n,provider:i})=>{const p=r.baseTx,m=await(async(e,o)=>{const u=e.baseTx,a=new Set;if(u.outputs.forEach((t=>{a.add(t.assetId.value())})),t.isAvmBaseTx(e)){const t=await Promise.all([...a.values()].map((t=>o.getApiX().getAssetDescription(t))));return u.outputs.reduce(((e,u)=>{if(u.output instanceof s){const s=u.assetId.value(),r=[...a.values()].indexOf(s),n=t[r],i=u.output.outputOwners.addrs.map((t=>`X-${t.toString(o.getContext().hrp)}`));return[...e,{assetId:s,amount:u.output.amount(),locktime:u.output.getLocktime(),threshold:BigInt(u.output.getThreshold()),assetDescription:n,owners:i,isAvax:o.getContext().avaxAssetID===s}]}return e}),[])}return u.outputs.reduce(((t,e)=>{if(e.output instanceof s){const s=e.assetId.value(),u=e.output.outputOwners.addrs.map((t=>`P-${t.toString(o.getContext().hrp)}`));return[...t,{assetId:s,amount:e.output.amount(),locktime:e.output.getLocktime(),threshold:BigInt(e.output.getThreshold()),owners:u,isAvax:o.getContext().avaxAssetID===s}]}return t}),[])})(r,i),c=a(),d=m.filter((t=>!(1===t.owners.length&&t.owners[0]===n&&t.locktime<=c)));return{type:u.Base,chain:r.getVM(),outputs:d,memo:o(Buffer.from(p.memo.toBytes()).toString("utf-8",4)),...e}}:null;export{r as default};
1
+ import{avmSerial as t,pvmSerial as e,TransferOutput as s}from"@avalabs/avalanchejs";import o from"xss";import{TxType as a}from"../../models.js";import{getUnixNow as r}from"../getUnixNow.js";var u=u=>t.isAvmBaseTx(u)||e.isPvmBaseTx(u)?async({feeData:e,currentAddress:n,provider:i})=>{const p=u.baseTx,m=await(async(e,o)=>{const a=e.baseTx,r=new Set;if(a.outputs.forEach((t=>{r.add(t.assetId.value())})),t.isAvmBaseTx(e)){const t=await Promise.all([...r.values()].map((t=>o.getApiX().getAssetDescription(t))));return a.outputs.reduce(((e,a)=>{if(a.output instanceof s){const s=a.assetId.value(),u=[...r.values()].indexOf(s),n=t[u],i=a.output.outputOwners.addrs.map((t=>`X-${t.toString(o.getContext().hrp)}`));return[...e,{assetId:s,amount:a.output.amount(),locktime:a.output.getLocktime(),threshold:BigInt(a.output.getThreshold()),assetDescription:n,owners:i,isAvax:o.getContext().avaxAssetID===s}]}return e}),[])}return a.outputs.reduce(((t,e)=>{if(e.output instanceof s){const s=e.assetId.value(),a=e.output.outputOwners.addrs.map((t=>`P-${t.toString(o.getContext().hrp)}`));return[...t,{assetId:s,amount:e.output.amount(),locktime:e.output.getLocktime(),threshold:BigInt(e.output.getThreshold()),owners:a,isAvax:o.getContext().avaxAssetID===s}]}return t}),[])})(u,i),d=r(),c=m.filter((t=>!(1===t.owners.length&&t.owners[0]===n&&t.locktime<=d)));return{type:a.Base,chain:u.getVM(),outputs:c,memo:o(Buffer.from(p.memo.toBytes()).toString("utf-8",4)),...e}}:null;export{u as default};
@@ -0,0 +1 @@
1
+ import{pvmSerial as e,NodeId as a}from"@avalabs/avalanchejs";import{TxType as n}from"../../models.js";var t=t=>e.isConvertSubnetToL1Tx(t)?({feeData:e,provider:r})=>{const s=r.getHrp(),o=e=>`P-${e.toString(s)}`;return{type:n.ConvertSubnetToL1,chain:t.getVM(),managerAddress:`0x${t.address.toString("hex")}`,validators:t.validators.map((e=>({nodeId:a.fromHex(e.nodeId.toString("hex")).toString(),stake:e.weight.value(),balance:e.balance.value(),remainingBalanceOwners:e.remainingBalanceOwner.addresses.map(o),deactivationOwners:e.deactivationOwner.addresses.map(o)}))),chainID:t.chainID.value(),subnetID:t.subnetID.value(),...e}}:null;export{t as default};
@@ -1 +1 @@
1
- import{pvmSerial as a}from"@avalabs/avalanchejs";import{TxType as e}from"../../models.js";const t=t=>a.isCreateChainTx(t)?({feeData:a})=>({type:e.CreateChain,chain:t.getVM(),subnetID:t.getSubnetID().value(),chainName:t.chainName.value(),chainID:t.getBlockchainId(),vmID:t.vmID.value(),fxIDs:t.fxIds.map((a=>a.value())),genesisData:t.genesisData.toString(),...a}):null;export{t as default};
1
+ import{pvmSerial as a}from"@avalabs/avalanchejs";import{TxType as e}from"../../models.js";var t=t=>a.isCreateChainTx(t)?({feeData:a})=>({type:e.CreateChain,chain:t.getVM(),subnetID:t.getSubnetID().value(),chainName:t.chainName.value(),chainID:t.getBlockchainId(),vmID:t.vmID.value(),fxIDs:t.fxIds.map((a=>a.value())),genesisData:t.genesisData.toString(),...a}):null;export{t as default};
@@ -1 +1 @@
1
- import{pvmSerial as e}from"@avalabs/avalanchejs";import{TxType as t}from"../../models.js";const r=r=>e.isCreateSubnetTx(r)?({feeData:e,provider:a})=>({type:t.CreateSubnet,chain:r.getVM(),threshold:r.getSubnetOwners().threshold.value(),controlKeys:r.getSubnetOwners().addrs.map((e=>`P-${e.toString(a.getHrp())}`)),...e}):null;export{r as default};
1
+ import{pvmSerial as e}from"@avalabs/avalanchejs";import{TxType as t}from"../../models.js";var r=r=>e.isCreateSubnetTx(r)?({feeData:e,provider:a})=>({type:t.CreateSubnet,chain:r.getVM(),threshold:r.getSubnetOwners().threshold.value(),controlKeys:r.getSubnetOwners().addrs.map((e=>`P-${e.toString(a.getHrp())}`)),...e}):null;export{r as default};
@@ -0,0 +1 @@
1
+ import{pvmSerial as a}from"@avalabs/avalanchejs";import{TxType as i}from"../../models.js";var t=t=>a.isDisableL1ValidatorTx(t)?({feeData:a})=>({type:i.DisableL1Validator,chain:t.getVM(),validationId:t.validationId.toString(),...a}):null;export{t as default};
@@ -1 +1 @@
1
- import{pvmSerial as t,avmSerial as o,evmSerial as a}from"@avalabs/avalanchejs";import{TxType as s}from"../../models.js";import e from"./utils/chainIdToVm.js";import{getTransferableOutputAmount as i}from"./utils/getTransferableAmount.js";const n=n=>t.isExportTx(n)||o.isExportTx(n)||a.isExportTx(n)?a.isExportTx(n)?({feeData:t,assetId:o})=>({type:s.Export,chain:n.getVM(),destination:e(n.destinationChain.toString()),amount:i(n.exportedOutputs,o),...t}):({feeData:t,assetId:o})=>({type:s.Export,chain:n.getVM(),destination:e(n.destination.value()),amount:i(n.outs,o),...t}):null;export{n as default};
1
+ import{pvmSerial as t,avmSerial as a,evmSerial as o}from"@avalabs/avalanchejs";import{TxType as e}from"../../models.js";import s from"./utils/chainIdToVm.js";import{getTransferableOutputAmount as i}from"./utils/getTransferableAmount.js";var r=r=>t.isExportTx(r)||a.isExportTx(r)||o.isExportTx(r)?o.isExportTx(r)?({feeData:t,assetId:a})=>({type:e.Export,chain:r.getVM(),destination:s(r.destinationChain.toString()),amount:i(r.exportedOutputs,a),...t}):({feeData:t,assetId:a})=>({type:e.Export,chain:r.getVM(),destination:s(r.destination.value()),amount:i(r.outs,a),...t}):null;export{r as default};