@avalabs/core-wallets-sdk 3.1.0-canary.a06f84d.0 → 3.1.0-canary.a1461ba.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.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +166 -33
- package/esm/Avalanche/index.d.ts +4 -2
- package/esm/Avalanche/index.js +1 -1
- package/esm/Avalanche/models.d.ts +36 -3
- package/esm/Avalanche/models.js +1 -1
- package/esm/Avalanche/providers/AbstractProvider.d.ts +2 -8
- package/esm/Avalanche/providers/AbstractProvider.js +1 -1
- package/esm/Avalanche/providers/JsonRpcProvider.d.ts +4 -4
- package/esm/Avalanche/providers/JsonRpcProvider.js +1 -1
- package/esm/Avalanche/utils/appendAutoRenewedValidatorConfigAddressMaps.js +1 -0
- package/esm/Avalanche/utils/createAvalancheEvmUnsignedTx.d.ts +3 -2
- package/esm/Avalanche/utils/createAvalancheEvmUnsignedTx.js +1 -1
- package/esm/Avalanche/utils/createAvalancheUnsignedTx.js +1 -1
- package/esm/Avalanche/utils/getAvalancheDerivationPath.d.ts +3 -0
- package/esm/Avalanche/utils/getAvalancheDerivationPath.js +1 -0
- package/esm/Avalanche/utils/getPchainUnixNow.d.ts +3 -1
- package/esm/Avalanche/utils/getPchainUnixNow.js +1 -1
- package/esm/Avalanche/utils/getVmByChainAlias.d.ts +1 -1
- package/esm/Avalanche/utils/getXpubFromMnemonic.d.ts +1 -1
- package/esm/Avalanche/utils/getXpubFromMnemonic.js +1 -1
- package/esm/Avalanche/utils/parseAvalancheTx.d.ts +6 -1
- package/esm/Avalanche/utils/parseAvalancheTx.js +1 -1
- package/esm/Avalanche/utils/parsers/index.js +1 -1
- package/esm/Avalanche/utils/parsers/parseAddAutoRenewedValidatorTx.js +1 -0
- package/esm/Avalanche/utils/parsers/parseConvertSubnetToL1Tx.js +1 -1
- package/esm/Avalanche/utils/parsers/parseRewardAutoRenewedValidatorTx.js +1 -0
- package/esm/Avalanche/utils/parsers/parseSetAutoRenewedValidatorConfigTx.js +1 -0
- package/esm/Avalanche/utils/txSizeLimits.js +1 -1
- package/esm/Avalanche/wallets/AddressWallet.js +1 -1
- package/esm/Avalanche/wallets/SimpleSigner.d.ts +1 -1
- package/esm/Avalanche/wallets/SimpleSigner.js +1 -1
- package/esm/Avalanche/wallets/StaticSigner.js +1 -1
- package/esm/Avalanche/wallets/TxBuilderTypes.d.ts +29 -1
- package/esm/Avalanche/wallets/WalletAbstract.d.ts +3 -5
- package/esm/Avalanche/wallets/WalletAbstract.js +1 -1
- package/esm/Avalanche/wallets/WalletVoid.js +1 -1
- package/esm/Avalanche/wallets/ledger/LedgerLiveSigner.d.ts +16 -0
- package/esm/Avalanche/wallets/ledger/LedgerLiveSigner.js +1 -0
- package/esm/Avalanche/wallets/ledger/LedgerSigner.js +1 -1
- package/esm/Avalanche/wallets/ledger/SimpleLedgerSigner.d.ts +4 -2
- package/esm/Avalanche/wallets/ledger/SimpleLedgerSigner.js +1 -1
- package/esm/Avalanche/wallets/legacy/LedgerWallet.js +1 -1
- package/esm/Avalanche/wallets/legacy/MnemonicWallet.js +1 -1
- package/esm/Avalanche/wallets/legacy/MnemonicWalletVoid.js +1 -1
- package/esm/BitcoinVM/index.js +1 -1
- package/esm/BitcoinVM/providers/BitcoinProvider.js +1 -1
- package/esm/BitcoinVM/utils/getBech32AddressFromXPub.js +1 -1
- package/esm/BitcoinVM/wallets/BitcoinWallet.js +1 -1
- package/esm/BitcoinVM/wallets/BitcoinWalletLedger.js +1 -1
- package/esm/EVM/LedgerSigner.js +1 -1
- package/esm/EVM/utils/getEvmDerivationPath.d.ts +5 -0
- package/esm/EVM/utils/getEvmDerivationPath.js +1 -0
- package/esm/EVM/utils/getWalletFromMnemonic.js +1 -1
- package/esm/SolanaVM/utils/maybeGetAssociatedTokenAccount.d.ts +40 -0
- package/esm/SolanaVM/utils/maybeGetAssociatedTokenAccount.js +1 -0
- package/esm/SolanaVM/utils/resolveTokenProgramForMint.d.ts +13 -0
- package/esm/SolanaVM/utils/resolveTokenProgramForMint.js +1 -0
- package/esm/SolanaVM/utils/transferToken.js +1 -1
- package/esm/SolanaVM/wallets/SolanaLedgerSigner.js +1 -1
- package/esm/index.d.ts +3 -0
- package/esm/index.js +1 -1
- package/esm/utils/getAddressDerivationPath.d.ts +8 -5
- package/esm/utils/getAddressDerivationPath.js +1 -1
- package/esm/utils/getPubKeyFromTransport.js +1 -1
- package/package.json +13 -11
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import * as bitcoinjs_lib from 'bitcoinjs-lib';
|
|
|
2
2
|
import { Network, Psbt, ECPairInterface, Transaction as Transaction$1, networks } from 'bitcoinjs-lib';
|
|
3
3
|
import Eth from '@ledgerhq/hw-app-eth';
|
|
4
4
|
import Transport from '@ledgerhq/hw-transport';
|
|
5
|
-
import * as ethers from 'ethers';
|
|
6
5
|
import { Provider, VoidSigner, HDNodeWallet, TransactionResponse, JsonRpcProvider as JsonRpcProvider$1, FetchRequest, Network as Network$1, Contract, AbstractSigner, BytesLike, TransactionRequest, TypedDataDomain, TypedDataField } from 'ethers';
|
|
7
6
|
import * as _avalabs_avalanchejs from '@avalabs/avalanchejs';
|
|
8
7
|
import { VM, OutputOwners, TransferableOutput, Common, pvmSerial, Context, avm, pvm, evm, info, avaxSerial, utils, UnsignedTx, EVMUnsignedTx, Utxo, TransferOutput, Credential, Signature } from '@avalabs/avalanchejs';
|
|
@@ -13,7 +12,7 @@ import { BIP32Interface } from 'bip32';
|
|
|
13
12
|
import { Utxo as Utxo$1, PChainUtxo, Network as Network$2 } from '@avalabs/glacier-sdk';
|
|
14
13
|
import * as _avalabs_avalanchejs_dist_serializable_common_types from '@avalabs/avalanchejs/dist/serializable/common/types';
|
|
15
14
|
import * as _solana_kit from '@solana/kit';
|
|
16
|
-
import { CompilableTransactionMessage, Transaction as Transaction$2, IInstruction } from '@solana/kit';
|
|
15
|
+
import { CompilableTransactionMessage, Transaction as Transaction$2, IInstruction, Address } from '@solana/kit';
|
|
17
16
|
import { Transaction } from '@ledgerhq/hw-app-btc/lib/types';
|
|
18
17
|
import { WalletPolicy, PsbtV2 } from 'ledger-bitcoin';
|
|
19
18
|
|
|
@@ -469,6 +468,8 @@ declare function getEvmAddressFromPubKey(pubKey: Buffer): string;
|
|
|
469
468
|
*/
|
|
470
469
|
declare function getBtcAddressFromPubKey(pubKey: Buffer, network: Network): string;
|
|
471
470
|
|
|
471
|
+
declare const getEVMDerivationPath: (accountIndex: number, pathSpec: DerivationPath, withRoot?: boolean) => string;
|
|
472
|
+
|
|
472
473
|
declare class LedgerSigner$1 extends AbstractSigner {
|
|
473
474
|
readonly type: string;
|
|
474
475
|
readonly path: string;
|
|
@@ -566,13 +567,14 @@ type ChainIDAlias = 'X' | 'P' | 'C';
|
|
|
566
567
|
/**
|
|
567
568
|
* Types for parsed transaction
|
|
568
569
|
*/
|
|
569
|
-
type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx$1 | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx$1 | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | UnknownTx;
|
|
570
|
+
type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx$1 | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx$1 | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | AddAutoRenewedValidatorTx | SetAutoRenewedValidatorConfigTx | RewardAutoRenewedValidatorTx | UnknownTx;
|
|
570
571
|
interface FeeData {
|
|
571
572
|
totalAvaxBurned: bigint;
|
|
572
573
|
totalAvaxOutput: bigint;
|
|
573
574
|
totalAvaxInput: bigint;
|
|
574
575
|
isValidAvaxBurnedAmount: boolean;
|
|
575
576
|
txFee: bigint;
|
|
577
|
+
baseFee: bigint;
|
|
576
578
|
}
|
|
577
579
|
interface TxBase extends FeeData {
|
|
578
580
|
type: string;
|
|
@@ -591,6 +593,9 @@ declare enum TxType {
|
|
|
591
593
|
SetL1ValidatorWeight = "set_l1_validator_weight",
|
|
592
594
|
IncreaseL1ValidatorBalance = "increase_l1_validator_balance",
|
|
593
595
|
DisableL1Validator = "disable_l1_validator",
|
|
596
|
+
AddAutoRenewedValidator = "add_auto_renewed_validator",
|
|
597
|
+
SetAutoRenewedValidatorConfig = "set_auto_renewed_validator_config",
|
|
598
|
+
RewardAutoRenewedValidator = "reward_auto_renewed_validator",
|
|
594
599
|
AddSubnetValidator = "add_subnet_validator",
|
|
595
600
|
RemoveSubnetValidator = "remove_subnet_validator",
|
|
596
601
|
AddPermissionlessValidator = "add_permissionless_validator",
|
|
@@ -698,6 +703,32 @@ interface DisableL1ValidatorTx extends TxBase {
|
|
|
698
703
|
type: TxType.DisableL1Validator;
|
|
699
704
|
validationId: string;
|
|
700
705
|
}
|
|
706
|
+
interface AddAutoRenewedValidatorTx extends TxBase {
|
|
707
|
+
type: TxType.AddAutoRenewedValidator;
|
|
708
|
+
nodeID: string;
|
|
709
|
+
stake: bigint;
|
|
710
|
+
stakeOuts: readonly TransferableOutput[];
|
|
711
|
+
rewardOwner: OutputOwners;
|
|
712
|
+
delegationRewardOwner: OutputOwners;
|
|
713
|
+
owner: OutputOwners;
|
|
714
|
+
delegationFee: number;
|
|
715
|
+
weight: bigint;
|
|
716
|
+
autoCompoundRewardShares: number;
|
|
717
|
+
period: bigint;
|
|
718
|
+
signer: pvmSerial.Signer | pvmSerial.SignerEmpty;
|
|
719
|
+
publicKey: undefined | string;
|
|
720
|
+
signature: undefined | string;
|
|
721
|
+
}
|
|
722
|
+
interface SetAutoRenewedValidatorConfigTx extends TxBase {
|
|
723
|
+
type: TxType.SetAutoRenewedValidatorConfig;
|
|
724
|
+
txId: string;
|
|
725
|
+
autoCompoundRewardShares: number;
|
|
726
|
+
period: bigint;
|
|
727
|
+
}
|
|
728
|
+
interface RewardAutoRenewedValidatorTx extends TxBase {
|
|
729
|
+
type: TxType.RewardAutoRenewedValidator;
|
|
730
|
+
txId: string;
|
|
731
|
+
}
|
|
701
732
|
interface AddPermissionlessValidatorTx extends TxBase {
|
|
702
733
|
type: TxType.AddPermissionlessValidator;
|
|
703
734
|
nodeID: string;
|
|
@@ -770,16 +801,15 @@ declare function isAddPermissionlessValidatorTx(tx: Tx): tx is AddPermissionless
|
|
|
770
801
|
declare function isAddPermissionlessDelegatorTx(tx: Tx): tx is AddPermissionlessDelegatorTx;
|
|
771
802
|
declare function isTransformSubnetTx(tx: Tx): tx is TransformSubnetTx;
|
|
772
803
|
declare function isTransferSubnetOwnershipTx(tx: Tx): tx is TransferSubnetOwnershipTx$1;
|
|
804
|
+
declare function isAddAutoRenewedValidatorTx(tx: Tx): tx is AddAutoRenewedValidatorTx;
|
|
805
|
+
declare function isSetAutoRenewedValidatorConfigTx(tx: Tx): tx is SetAutoRenewedValidatorConfigTx;
|
|
806
|
+
declare function isRewardAutoRenewedValidatorTx(tx: Tx): tx is RewardAutoRenewedValidatorTx;
|
|
773
807
|
|
|
774
808
|
declare class AbstractProvider {
|
|
775
809
|
protected baseUrl: string;
|
|
776
810
|
protected context: Context.Context;
|
|
777
|
-
|
|
778
|
-
constructor(baseUrl: string, context: Context.Context);
|
|
779
|
-
/**
|
|
780
|
-
* @link https://docs.ethers.io/v5/api/providers/provider/#Provider-getFeeData
|
|
781
|
-
*/
|
|
782
|
-
getEvmFeeData(): Promise<ethers.FeeData>;
|
|
811
|
+
fetchOptions?: RequestInit | undefined;
|
|
812
|
+
constructor(baseUrl: string, context: Context.Context, fetchOptions?: RequestInit | undefined);
|
|
783
813
|
getContext(): Context.Context;
|
|
784
814
|
getChainID(chainAlias: ChainIDAlias): string;
|
|
785
815
|
getNetworkID(): number;
|
|
@@ -808,11 +838,11 @@ declare class AbstractProvider {
|
|
|
808
838
|
}
|
|
809
839
|
|
|
810
840
|
declare class JsonRpcProvider extends AbstractProvider {
|
|
811
|
-
constructor(baseUrl: string, context: Context.Context);
|
|
841
|
+
constructor(baseUrl: string, context: Context.Context, fetchOptions?: RequestInit);
|
|
812
842
|
static fromBaseURL(url: string): Promise<JsonRpcProvider>;
|
|
813
|
-
static getDefaultMainnetProvider(): JsonRpcProvider;
|
|
814
|
-
static getDefaultFujiProvider(): JsonRpcProvider;
|
|
815
|
-
static getDefaultDevnetProvider(): JsonRpcProvider;
|
|
843
|
+
static getDefaultMainnetProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
844
|
+
static getDefaultFujiProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
845
|
+
static getDefaultDevnetProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
816
846
|
}
|
|
817
847
|
|
|
818
848
|
/**
|
|
@@ -989,6 +1019,34 @@ type RemoveSubnetValidator = {
|
|
|
989
1019
|
fromAddresses?: string[];
|
|
990
1020
|
options?: Common.SpendOptions;
|
|
991
1021
|
};
|
|
1022
|
+
type AddAutoRenewedValidator = {
|
|
1023
|
+
utxoSet: utils.UtxoSet;
|
|
1024
|
+
nodeId: string;
|
|
1025
|
+
weight: bigint;
|
|
1026
|
+
shares: number;
|
|
1027
|
+
feeState: pvm.FeeState;
|
|
1028
|
+
fromAddresses?: string[];
|
|
1029
|
+
rewardAddresses?: string[];
|
|
1030
|
+
delegatorRewardAddresses?: string[];
|
|
1031
|
+
ownerAddresses?: string[];
|
|
1032
|
+
publicKey?: Buffer;
|
|
1033
|
+
signature?: Buffer;
|
|
1034
|
+
autoCompoundRewardShares: number;
|
|
1035
|
+
period: bigint;
|
|
1036
|
+
options?: Common.SpendOptions;
|
|
1037
|
+
locktime?: bigint;
|
|
1038
|
+
threshold?: number;
|
|
1039
|
+
};
|
|
1040
|
+
type SetAutoRenewedValidatorConfig = {
|
|
1041
|
+
utxoSet: utils.UtxoSet;
|
|
1042
|
+
feeState: pvm.FeeState;
|
|
1043
|
+
validatorTxId: string;
|
|
1044
|
+
auth: number[];
|
|
1045
|
+
autoCompoundRewardShares: number;
|
|
1046
|
+
period: bigint;
|
|
1047
|
+
fromAddresses?: string[];
|
|
1048
|
+
options?: Common.SpendOptions;
|
|
1049
|
+
};
|
|
992
1050
|
type TransferSubnetOwnershipTx = {
|
|
993
1051
|
utxoSet: utils.UtxoSet;
|
|
994
1052
|
subnetId: string;
|
|
@@ -1046,10 +1104,6 @@ declare abstract class WalletAbstract {
|
|
|
1046
1104
|
* @param source What is the source chain of the atomic UTXOs
|
|
1047
1105
|
*/
|
|
1048
1106
|
getAtomicUTXOs(chain: ChainIDAlias, source: ChainIDAlias): Promise<utils.UtxoSet>;
|
|
1049
|
-
/**
|
|
1050
|
-
* Get the nonce of this wallet's C chain address
|
|
1051
|
-
*/
|
|
1052
|
-
getNonce(): Promise<number>;
|
|
1053
1107
|
exportX(amount: bigint, utxoSet: utils.UtxoSet, destination: 'P' | 'C', toAddress?: string): Common.UnsignedTx;
|
|
1054
1108
|
importP({ utxoSet, sourceChain, toAddress, threshold, feeState, locktime, }: ImportP): Common.UnsignedTx;
|
|
1055
1109
|
importX(utxos: utils.UtxoSet, sourceChain: 'P' | 'C', toAddress?: string): Common.UnsignedTx;
|
|
@@ -1086,6 +1140,8 @@ declare abstract class WalletAbstract {
|
|
|
1086
1140
|
setL1ValidatorWeight({ utxoSet, feeState, message, options, fromAddresses, }: SetL1ValidatorWeight): Common.UnsignedTx;
|
|
1087
1141
|
disableL1Validator({ utxoSet, feeState, options, fromAddresses, disableAuth, validationId, }: DisableL1Validator): Common.UnsignedTx;
|
|
1088
1142
|
increaseL1ValidatorBalance({ utxoSet, feeState, options, fromAddresses, balance, validationId, }: IncreaseL1ValidatorBalance): Common.UnsignedTx;
|
|
1143
|
+
addAutoRenewedValidator({ utxoSet, nodeId, weight, shares, feeState, fromAddresses, rewardAddresses, delegatorRewardAddresses, ownerAddresses, publicKey, signature, autoCompoundRewardShares, period, options, locktime, threshold, }: AddAutoRenewedValidator): Common.UnsignedTx;
|
|
1144
|
+
setAutoRenewedValidatorConfig({ utxoSet, feeState, validatorTxId, auth, autoCompoundRewardShares, period, fromAddresses, options, }: SetAutoRenewedValidatorConfig): Common.UnsignedTx;
|
|
1089
1145
|
createBlockchain({ utxoSet, subnetId, chainName, vmID, fxIds, genesisData, subnetAuth, feeState, options, fromAddresses, }: CreateChain): Common.UnsignedTx;
|
|
1090
1146
|
createSubnet({ utxoSet, rewardAddresses, feeState, fromAddresses, options, threshold, locktime, }: CreateSubnet): Common.UnsignedTx;
|
|
1091
1147
|
addSubnetValidator({ utxoSet, nodeId, start, end, weight, subnetId, subnetAuth, feeState, fromAddresses, options, }: AddSubnetValidator): Common.UnsignedTx;
|
|
@@ -1442,7 +1498,7 @@ declare class StaticSigner extends WalletVoid implements Signer {
|
|
|
1442
1498
|
*/
|
|
1443
1499
|
declare class SimpleSigner implements Signer {
|
|
1444
1500
|
/**
|
|
1445
|
-
* Node for `m/44'/9000'/
|
|
1501
|
+
* Node for `m/44'/9000'/n'`
|
|
1446
1502
|
* @private {BIP32Interface}
|
|
1447
1503
|
*/
|
|
1448
1504
|
private accountNodeXP;
|
|
@@ -1542,12 +1598,13 @@ declare class LedgerSigner extends WalletVoid implements Signer {
|
|
|
1542
1598
|
declare class SimpleLedgerSigner implements Signer {
|
|
1543
1599
|
private activeAccountIndex;
|
|
1544
1600
|
private provider;
|
|
1601
|
+
private pathSpec;
|
|
1545
1602
|
private accountNode;
|
|
1546
1603
|
/**
|
|
1547
1604
|
* @param {number} activeAccountIndex - the index of the primary account used for static signing
|
|
1548
|
-
* @param {string} xpubXP - optional extended public key of `m/44'/9000'
|
|
1605
|
+
* @param {string} xpubXP - optional extended public key of `m/44'/9000'/${activeAccountIndex}`
|
|
1549
1606
|
*/
|
|
1550
|
-
constructor(activeAccountIndex: number, provider: JsonRpcProvider, xpubXP?: string);
|
|
1607
|
+
constructor(activeAccountIndex: number, provider: JsonRpcProvider, xpubXP?: string, pathSpec?: DerivationPath);
|
|
1551
1608
|
private reSerializeTx;
|
|
1552
1609
|
private getChainAlias;
|
|
1553
1610
|
private getAccountPath;
|
|
@@ -1559,6 +1616,18 @@ declare class SimpleLedgerSigner implements Signer {
|
|
|
1559
1616
|
signMessage(request: SignMessageRequest): Promise<Buffer>;
|
|
1560
1617
|
}
|
|
1561
1618
|
|
|
1619
|
+
/**
|
|
1620
|
+
* Ledger signer that can use multiple LedgerLive derivation paths for signing transactions.
|
|
1621
|
+
*/
|
|
1622
|
+
declare class LedgerLiveSigner implements Signer {
|
|
1623
|
+
#private;
|
|
1624
|
+
private accountIndices;
|
|
1625
|
+
constructor(accountIndices: number[]);
|
|
1626
|
+
signMessage(request: SignMessageRequest): Promise<Buffer>;
|
|
1627
|
+
signTx(txRequest: SignTxRequest): Promise<UnsignedTx>;
|
|
1628
|
+
signTxBuffer(txRequest: SignTxBufferRequest): Promise<Buffer[]>;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1562
1631
|
declare const addSignaturesToAvalancheTx: ({ transactionHex, signatures, chainAlias, provider, utxos, }: {
|
|
1563
1632
|
transactionHex: string;
|
|
1564
1633
|
signatures: Uint8Array[];
|
|
@@ -1577,9 +1646,10 @@ type Params$2 = {
|
|
|
1577
1646
|
txBytes: Uint8Array;
|
|
1578
1647
|
fromAddress: string;
|
|
1579
1648
|
vm: VM;
|
|
1649
|
+
credentials?: Credential[];
|
|
1580
1650
|
utxos: Utxo[];
|
|
1581
1651
|
};
|
|
1582
|
-
declare const createAvalancheEvmUnsignedTx: ({ txBytes, fromAddress, vm, utxos, }: Params$2) => Promise<UnsignedTx>;
|
|
1652
|
+
declare const createAvalancheEvmUnsignedTx: ({ txBytes, fromAddress, vm, credentials, utxos, }: Params$2) => Promise<UnsignedTx>;
|
|
1583
1653
|
|
|
1584
1654
|
type Params$1 = {
|
|
1585
1655
|
tx: avaxSerial.AvaxTx;
|
|
@@ -1653,7 +1723,7 @@ declare function getAssetBalance(utxoSet: utils.UtxoSet, assetID: string): GetAv
|
|
|
1653
1723
|
/**
|
|
1654
1724
|
* Get the current p-chain timestamp in unix
|
|
1655
1725
|
*/
|
|
1656
|
-
declare function getPchainUnixNow(
|
|
1726
|
+
declare function getPchainUnixNow(provider: AbstractProvider): Promise<bigint>;
|
|
1657
1727
|
|
|
1658
1728
|
interface GetStakedAvaxBalanceDict {
|
|
1659
1729
|
/**
|
|
@@ -1685,13 +1755,13 @@ type Params = {
|
|
|
1685
1755
|
};
|
|
1686
1756
|
declare const getUtxosByTxFromGlacier: ({ transactionHex, chainAlias, network, url, token, headers, }: Params) => Promise<Utxo<_avalabs_avalanchejs_dist_serializable_common_types.Serializable>[]>;
|
|
1687
1757
|
|
|
1688
|
-
declare const getVmByChainAlias: (chainAlias: string) => "
|
|
1758
|
+
declare const getVmByChainAlias: (chainAlias: string) => "AVM" | "EVM" | "PVM";
|
|
1689
1759
|
|
|
1690
1760
|
/**
|
|
1691
1761
|
* Get the xpub for m/44'/9000'/0' from the given mnemonic
|
|
1692
1762
|
* @param mnemonic
|
|
1693
1763
|
*/
|
|
1694
|
-
declare function getXpubFromMnemonic(mnemonic: string): string;
|
|
1764
|
+
declare function getXpubFromMnemonic(mnemonic: string, accountIndex: number): string;
|
|
1695
1765
|
|
|
1696
1766
|
/**
|
|
1697
1767
|
* Verify the given address is a valid Avalanche bech32 address
|
|
@@ -1705,11 +1775,15 @@ type ParseOptions = {
|
|
|
1705
1775
|
* Tolerance percentage range where the burned amount is considered valid.
|
|
1706
1776
|
*/
|
|
1707
1777
|
feeTolerance?: number;
|
|
1778
|
+
/**
|
|
1779
|
+
* Base fee used for validating burn amount. Priced in nAvax.
|
|
1780
|
+
*/
|
|
1781
|
+
baseFee?: bigint;
|
|
1708
1782
|
};
|
|
1709
1783
|
/**
|
|
1710
1784
|
* Returns human readable data from a given a transaction buffer,
|
|
1711
1785
|
*/
|
|
1712
|
-
declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string, { feeTolerance }?: ParseOptions): Promise<Tx>;
|
|
1786
|
+
declare function parseAvalancheTx(unsignedTx: Common.UnsignedTx, provider: JsonRpcProvider, currentAddress: string, { feeTolerance, baseFee: inputBaseFee }?: ParseOptions): Promise<Tx>;
|
|
1713
1787
|
|
|
1714
1788
|
declare const emptySignature: Signature;
|
|
1715
1789
|
declare const populateCredential: (indices: number[], existingCredentialData?: {
|
|
@@ -1772,8 +1846,11 @@ declare function getMaximumUtxoSet({ wallet, utxos, sizeSupportedTx, limit, feeS
|
|
|
1772
1846
|
*/
|
|
1773
1847
|
declare function verifyDerivationPath(path: string): any;
|
|
1774
1848
|
|
|
1849
|
+
declare const getAvalancheDerivationPath: (accountIndex: number, withRoot?: boolean) => string;
|
|
1850
|
+
|
|
1775
1851
|
type index_AbstractProvider = AbstractProvider;
|
|
1776
1852
|
declare const index_AbstractProvider: typeof AbstractProvider;
|
|
1853
|
+
type index_AddAutoRenewedValidatorTx = AddAutoRenewedValidatorTx;
|
|
1777
1854
|
type index_AddDelegatorTx = AddDelegatorTx;
|
|
1778
1855
|
type index_AddPermissionlessDelegatorTx = AddPermissionlessDelegatorTx;
|
|
1779
1856
|
type index_AddPermissionlessValidatorTx = AddPermissionlessValidatorTx;
|
|
@@ -1798,6 +1875,8 @@ type index_IncreaseL1ValidatorBalanceTx = IncreaseL1ValidatorBalanceTx;
|
|
|
1798
1875
|
type index_JsonRpcProvider = JsonRpcProvider;
|
|
1799
1876
|
declare const index_JsonRpcProvider: typeof JsonRpcProvider;
|
|
1800
1877
|
type index_LedgerGetXpubResponse = LedgerGetXpubResponse;
|
|
1878
|
+
type index_LedgerLiveSigner = LedgerLiveSigner;
|
|
1879
|
+
declare const index_LedgerLiveSigner: typeof LedgerLiveSigner;
|
|
1801
1880
|
type index_LedgerSigner = LedgerSigner;
|
|
1802
1881
|
declare const index_LedgerSigner: typeof LedgerSigner;
|
|
1803
1882
|
type index_LedgerWallet = LedgerWallet;
|
|
@@ -1808,8 +1887,11 @@ declare const index_MnemonicWallet: typeof MnemonicWallet;
|
|
|
1808
1887
|
type index_MnemonicWalletVoid = MnemonicWalletVoid;
|
|
1809
1888
|
declare const index_MnemonicWalletVoid: typeof MnemonicWalletVoid;
|
|
1810
1889
|
declare const index_P_CHAIN_TX_SIZE_LIMIT: typeof P_CHAIN_TX_SIZE_LIMIT;
|
|
1890
|
+
type index_ParseOptions = ParseOptions;
|
|
1811
1891
|
type index_RegisterL1ValidatorTx = RegisterL1ValidatorTx;
|
|
1812
1892
|
type index_RemoveSubnetValidatorTx = RemoveSubnetValidatorTx;
|
|
1893
|
+
type index_RewardAutoRenewedValidatorTx = RewardAutoRenewedValidatorTx;
|
|
1894
|
+
type index_SetAutoRenewedValidatorConfigTx = SetAutoRenewedValidatorConfigTx;
|
|
1813
1895
|
type index_SetL1ValidatorWeightTx = SetL1ValidatorWeightTx;
|
|
1814
1896
|
type index_SignMessageRequest = SignMessageRequest;
|
|
1815
1897
|
type index_SignTxBufferRequest = SignTxBufferRequest;
|
|
@@ -1842,6 +1924,7 @@ declare const index_emptySignature: typeof emptySignature;
|
|
|
1842
1924
|
declare const index_getAddressFromXpub: typeof getAddressFromXpub;
|
|
1843
1925
|
declare const index_getAddressPublicKeyFromXpub: typeof getAddressPublicKeyFromXpub;
|
|
1844
1926
|
declare const index_getAssetBalance: typeof getAssetBalance;
|
|
1927
|
+
declare const index_getAvalancheDerivationPath: typeof getAvalancheDerivationPath;
|
|
1845
1928
|
declare const index_getLedgerProvider: typeof getLedgerProvider;
|
|
1846
1929
|
declare const index_getMaximumUtxoSet: typeof getMaximumUtxoSet;
|
|
1847
1930
|
declare const index_getPaginatedUTXOs: typeof getPaginatedUTXOs;
|
|
@@ -1853,6 +1936,7 @@ declare const index_getUnixNow: typeof getUnixNow;
|
|
|
1853
1936
|
declare const index_getUtxosByTxFromGlacier: typeof getUtxosByTxFromGlacier;
|
|
1854
1937
|
declare const index_getVmByChainAlias: typeof getVmByChainAlias;
|
|
1855
1938
|
declare const index_getXpubFromMnemonic: typeof getXpubFromMnemonic;
|
|
1939
|
+
declare const index_isAddAutoRenewedValidatorTx: typeof isAddAutoRenewedValidatorTx;
|
|
1856
1940
|
declare const index_isAddDelegatorTx: typeof isAddDelegatorTx;
|
|
1857
1941
|
declare const index_isAddPermissionlessDelegatorTx: typeof isAddPermissionlessDelegatorTx;
|
|
1858
1942
|
declare const index_isAddPermissionlessValidatorTx: typeof isAddPermissionlessValidatorTx;
|
|
@@ -1870,6 +1954,8 @@ declare const index_isIncreaseL1ValidatorBalance: typeof isIncreaseL1ValidatorBa
|
|
|
1870
1954
|
declare const index_isObsidianApp: typeof isObsidianApp;
|
|
1871
1955
|
declare const index_isRegisterL1ValidatorTx: typeof isRegisterL1ValidatorTx;
|
|
1872
1956
|
declare const index_isRemoveSubnetValidatorTx: typeof isRemoveSubnetValidatorTx;
|
|
1957
|
+
declare const index_isRewardAutoRenewedValidatorTx: typeof isRewardAutoRenewedValidatorTx;
|
|
1958
|
+
declare const index_isSetAutoRenewedValidatorConfigTx: typeof isSetAutoRenewedValidatorConfigTx;
|
|
1873
1959
|
declare const index_isSetL1ValidatorWeightTx: typeof isSetL1ValidatorWeightTx;
|
|
1874
1960
|
declare const index_isTransferSubnetOwnershipTx: typeof isTransferSubnetOwnershipTx;
|
|
1875
1961
|
declare const index_isTransformSubnetTx: typeof isTransformSubnetTx;
|
|
@@ -1882,20 +1968,23 @@ declare const index_sortUTXOsByAmountDescending: typeof sortUTXOsByAmountDescend
|
|
|
1882
1968
|
declare const index_sortUTXOsStaking: typeof sortUTXOsStaking;
|
|
1883
1969
|
declare const index_verifyDerivationPath: typeof verifyDerivationPath;
|
|
1884
1970
|
declare namespace index {
|
|
1885
|
-
export { index_AbstractProvider as AbstractProvider, index_AddressWallet as AddressWallet, index_DevnetContext as DevnetContext, index_FujiContext as FujiContext, index_JsonRpcProvider as JsonRpcProvider, index_LedgerSigner as LedgerSigner, index_LedgerWallet as LedgerWallet, index_MainnetContext as MainnetContext, index_MnemonicWallet as MnemonicWallet, index_MnemonicWalletVoid as MnemonicWalletVoid, index_P_CHAIN_TX_SIZE_LIMIT as P_CHAIN_TX_SIZE_LIMIT, index_SimpleLedgerSigner as SimpleLedgerSigner, index_SimpleSigner as SimpleSigner, index_SizeSupportedTx as SizeSupportedTx, index_StaticSigner as StaticSigner, index_TxType as TxType, index_WalletAbstract as WalletAbstract, index_WalletVoid as WalletVoid, index_addSignaturesToAvalancheTx as addSignaturesToAvalancheTx, index_convertGlacierUtxo as convertGlacierUtxo, index_createAvalancheEvmUnsignedTx as createAvalancheEvmUnsignedTx, index_createAvalancheUnsignedTx as createAvalancheUnsignedTx, index_digestMessage as digestMessage, index_emptySignature as emptySignature, index_getAddressFromXpub as getAddressFromXpub, index_getAddressPublicKeyFromXpub as getAddressPublicKeyFromXpub, index_getAssetBalance as getAssetBalance, index_getLedgerProvider as getLedgerProvider, index_getMaximumUtxoSet as getMaximumUtxoSet, index_getPaginatedUTXOs as getPaginatedUTXOs, index_getPchainUnixNow as getPchainUnixNow, index_getStakeForAddresses as getStakeForAddresses, index_getStakedAssetBalance as getStakedAssetBalance, index_getUTXOsForAddresses as getUTXOsForAddresses, index_getUnixNow as getUnixNow, index_getUtxosByTxFromGlacier as getUtxosByTxFromGlacier, index_getVmByChainAlias as getVmByChainAlias, index_getXpubFromMnemonic as getXpubFromMnemonic, index_isAddDelegatorTx as isAddDelegatorTx, index_isAddPermissionlessDelegatorTx as isAddPermissionlessDelegatorTx, index_isAddPermissionlessValidatorTx as isAddPermissionlessValidatorTx, index_isAddSubnetValidatorTx as isAddSubnetValidatorTx, index_isAddValidatorTx as isAddValidatorTx, index_isBaseTx as isBaseTx, index_isBech32Address as isBech32Address, index_isConvertSubnetToL1Tx as isConvertSubnetToL1Tx, index_isCreateChainTx as isCreateChainTx, index_isCreateSubnetTx as isCreateSubnetTx, index_isDisableL1ValidatorTx as isDisableL1ValidatorTx, index_isExportTx as isExportTx, index_isImportTx as isImportTx, index_isIncreaseL1ValidatorBalance as isIncreaseL1ValidatorBalance, index_isObsidianApp as isObsidianApp, index_isRegisterL1ValidatorTx as isRegisterL1ValidatorTx, index_isRemoveSubnetValidatorTx as isRemoveSubnetValidatorTx, index_isSetL1ValidatorWeightTx as isSetL1ValidatorWeightTx, index_isTransferSubnetOwnershipTx as isTransferSubnetOwnershipTx, index_isTransformSubnetTx as isTransformSubnetTx, index_parseAvalancheTx as parseAvalancheTx, index_populateCredential as populateCredential, index_signedTxToHex as signedTxToHex, index_sortUTXOsByAmount as sortUTXOsByAmount, index_sortUTXOsByAmountAscending as sortUTXOsByAmountAscending, index_sortUTXOsByAmountDescending as sortUTXOsByAmountDescending, index_sortUTXOsStaking as sortUTXOsStaking, index_verifyDerivationPath as verifyDerivationPath };
|
|
1886
|
-
export type { index_AddDelegatorTx as AddDelegatorTx, index_AddPermissionlessDelegatorTx as AddPermissionlessDelegatorTx, index_AddPermissionlessValidatorTx as AddPermissionlessValidatorTx, index_AddSubnetValidatorTx as AddSubnetValidatorTx, index_AddValidatorTx as AddValidatorTx, BaseTx$1 as BaseTx, index_ChainIDAlias as ChainIDAlias, index_ConvertSubnetToL1Tx as ConvertSubnetToL1Tx, index_CreateChainTx as CreateChainTx, index_CreateSubnetTx as CreateSubnetTx, index_DisableL1ValidatorTx as DisableL1ValidatorTx, index_ExportTx as ExportTx, index_FeeData as FeeData, index_GetAvaxBalanceDict as GetAvaxBalanceDict, index_GetStakedAvaxBalanceDict as GetStakedAvaxBalanceDict, index_GlacierOutput as GlacierOutput, index_ImportTx as ImportTx, index_IncreaseL1ValidatorBalanceTx as IncreaseL1ValidatorBalanceTx, index_LedgerGetXpubResponse as LedgerGetXpubResponse, index_RegisterL1ValidatorTx as RegisterL1ValidatorTx, index_RemoveSubnetValidatorTx as RemoveSubnetValidatorTx, index_SetL1ValidatorWeightTx as SetL1ValidatorWeightTx, index_SignMessageRequest as SignMessageRequest, index_SignTxBufferRequest as SignTxBufferRequest, index_SignTxRequest as SignTxRequest, index_Signer as Signer, TransferSubnetOwnershipTx$1 as TransferSubnetOwnershipTx, index_TransformSubnetTx as TransformSubnetTx, index_Tx as Tx, index_TxBase as TxBase, index_UnknownTx as UnknownTx };
|
|
1971
|
+
export { index_AbstractProvider as AbstractProvider, index_AddressWallet as AddressWallet, index_DevnetContext as DevnetContext, index_FujiContext as FujiContext, index_JsonRpcProvider as JsonRpcProvider, index_LedgerLiveSigner as LedgerLiveSigner, index_LedgerSigner as LedgerSigner, index_LedgerWallet as LedgerWallet, index_MainnetContext as MainnetContext, index_MnemonicWallet as MnemonicWallet, index_MnemonicWalletVoid as MnemonicWalletVoid, index_P_CHAIN_TX_SIZE_LIMIT as P_CHAIN_TX_SIZE_LIMIT, index_SimpleLedgerSigner as SimpleLedgerSigner, index_SimpleSigner as SimpleSigner, index_SizeSupportedTx as SizeSupportedTx, index_StaticSigner as StaticSigner, index_TxType as TxType, index_WalletAbstract as WalletAbstract, index_WalletVoid as WalletVoid, index_addSignaturesToAvalancheTx as addSignaturesToAvalancheTx, index_convertGlacierUtxo as convertGlacierUtxo, index_createAvalancheEvmUnsignedTx as createAvalancheEvmUnsignedTx, index_createAvalancheUnsignedTx as createAvalancheUnsignedTx, index_digestMessage as digestMessage, index_emptySignature as emptySignature, index_getAddressFromXpub as getAddressFromXpub, index_getAddressPublicKeyFromXpub as getAddressPublicKeyFromXpub, index_getAssetBalance as getAssetBalance, index_getAvalancheDerivationPath as getAvalancheDerivationPath, index_getLedgerProvider as getLedgerProvider, index_getMaximumUtxoSet as getMaximumUtxoSet, index_getPaginatedUTXOs as getPaginatedUTXOs, index_getPchainUnixNow as getPchainUnixNow, index_getStakeForAddresses as getStakeForAddresses, index_getStakedAssetBalance as getStakedAssetBalance, index_getUTXOsForAddresses as getUTXOsForAddresses, index_getUnixNow as getUnixNow, index_getUtxosByTxFromGlacier as getUtxosByTxFromGlacier, index_getVmByChainAlias as getVmByChainAlias, index_getXpubFromMnemonic as getXpubFromMnemonic, index_isAddAutoRenewedValidatorTx as isAddAutoRenewedValidatorTx, index_isAddDelegatorTx as isAddDelegatorTx, index_isAddPermissionlessDelegatorTx as isAddPermissionlessDelegatorTx, index_isAddPermissionlessValidatorTx as isAddPermissionlessValidatorTx, index_isAddSubnetValidatorTx as isAddSubnetValidatorTx, index_isAddValidatorTx as isAddValidatorTx, index_isBaseTx as isBaseTx, index_isBech32Address as isBech32Address, index_isConvertSubnetToL1Tx as isConvertSubnetToL1Tx, index_isCreateChainTx as isCreateChainTx, index_isCreateSubnetTx as isCreateSubnetTx, index_isDisableL1ValidatorTx as isDisableL1ValidatorTx, index_isExportTx as isExportTx, index_isImportTx as isImportTx, index_isIncreaseL1ValidatorBalance as isIncreaseL1ValidatorBalance, index_isObsidianApp as isObsidianApp, index_isRegisterL1ValidatorTx as isRegisterL1ValidatorTx, index_isRemoveSubnetValidatorTx as isRemoveSubnetValidatorTx, index_isRewardAutoRenewedValidatorTx as isRewardAutoRenewedValidatorTx, index_isSetAutoRenewedValidatorConfigTx as isSetAutoRenewedValidatorConfigTx, index_isSetL1ValidatorWeightTx as isSetL1ValidatorWeightTx, index_isTransferSubnetOwnershipTx as isTransferSubnetOwnershipTx, index_isTransformSubnetTx as isTransformSubnetTx, index_parseAvalancheTx as parseAvalancheTx, index_populateCredential as populateCredential, index_signedTxToHex as signedTxToHex, index_sortUTXOsByAmount as sortUTXOsByAmount, index_sortUTXOsByAmountAscending as sortUTXOsByAmountAscending, index_sortUTXOsByAmountDescending as sortUTXOsByAmountDescending, index_sortUTXOsStaking as sortUTXOsStaking, index_verifyDerivationPath as verifyDerivationPath };
|
|
1972
|
+
export type { index_AddAutoRenewedValidatorTx as AddAutoRenewedValidatorTx, index_AddDelegatorTx as AddDelegatorTx, index_AddPermissionlessDelegatorTx as AddPermissionlessDelegatorTx, index_AddPermissionlessValidatorTx as AddPermissionlessValidatorTx, index_AddSubnetValidatorTx as AddSubnetValidatorTx, index_AddValidatorTx as AddValidatorTx, BaseTx$1 as BaseTx, index_ChainIDAlias as ChainIDAlias, index_ConvertSubnetToL1Tx as ConvertSubnetToL1Tx, index_CreateChainTx as CreateChainTx, index_CreateSubnetTx as CreateSubnetTx, index_DisableL1ValidatorTx as DisableL1ValidatorTx, index_ExportTx as ExportTx, index_FeeData as FeeData, index_GetAvaxBalanceDict as GetAvaxBalanceDict, index_GetStakedAvaxBalanceDict as GetStakedAvaxBalanceDict, index_GlacierOutput as GlacierOutput, index_ImportTx as ImportTx, index_IncreaseL1ValidatorBalanceTx as IncreaseL1ValidatorBalanceTx, index_LedgerGetXpubResponse as LedgerGetXpubResponse, index_ParseOptions as ParseOptions, index_RegisterL1ValidatorTx as RegisterL1ValidatorTx, index_RemoveSubnetValidatorTx as RemoveSubnetValidatorTx, index_RewardAutoRenewedValidatorTx as RewardAutoRenewedValidatorTx, index_SetAutoRenewedValidatorConfigTx as SetAutoRenewedValidatorConfigTx, index_SetL1ValidatorWeightTx as SetL1ValidatorWeightTx, index_SignMessageRequest as SignMessageRequest, index_SignTxBufferRequest as SignTxBufferRequest, index_SignTxRequest as SignTxRequest, index_Signer as Signer, TransferSubnetOwnershipTx$1 as TransferSubnetOwnershipTx, index_TransformSubnetTx as TransformSubnetTx, index_Tx as Tx, index_TxBase as TxBase, index_UnknownTx as UnknownTx };
|
|
1887
1973
|
}
|
|
1888
1974
|
|
|
1975
|
+
type DerivationPathOptions = {
|
|
1976
|
+
withRoot?: boolean;
|
|
1977
|
+
pathSpec?: DerivationPath;
|
|
1978
|
+
};
|
|
1889
1979
|
/**
|
|
1890
1980
|
* Get the derivation path used by wallet addresses
|
|
1891
1981
|
* @param addressIndex Which index is the address on
|
|
1892
|
-
* @param pathSpec BIP44 vs LedgerLive
|
|
1893
1982
|
* @param vm Which VM is this address on. Coin index changes between Avalanche and EVM
|
|
1894
|
-
* @param
|
|
1983
|
+
* @param options
|
|
1984
|
+
* @param options.withRoot If false, skips the "m/" prefix. Needed for Solana Ledger app.
|
|
1985
|
+
* @param options.pathSpec Only relevant (and required) for EVM.
|
|
1895
1986
|
*/
|
|
1896
|
-
declare function getAddressDerivationPath(
|
|
1897
|
-
vm: 'SVM', withRoot?: boolean): string;
|
|
1898
|
-
declare function getAddressDerivationPath(addressIndex: number, pathSpec: DerivationPath, vm: 'EVM' | 'AVM' | 'PVM', withRoot?: never): string;
|
|
1987
|
+
declare function getAddressDerivationPath(accountIndex: number, vm: 'SVM' | 'EVM' | 'AVM' | 'PVM', options?: DerivationPathOptions): string;
|
|
1899
1988
|
|
|
1900
1989
|
/**
|
|
1901
1990
|
* Get the public key from a given private key.
|
|
@@ -1982,6 +2071,50 @@ declare const getSolanaDerivationPath: (accountIndex: number, withRoot?: boolean
|
|
|
1982
2071
|
|
|
1983
2072
|
declare const getSolanaPublicKeyFromLedger: (accountIndex: number, transport: Transport) => Promise<Buffer>;
|
|
1984
2073
|
|
|
2074
|
+
/**
|
|
2075
|
+
* Helper to abstract confirming the existence of an Associated Token Account (ATA).
|
|
2076
|
+
* Useful for transferring SPL tokens, as each wallet must have an ATA for each token they own.
|
|
2077
|
+
* If a ATA does not exist, gas estimates must include a one-time rent-exempt minimum for creating
|
|
2078
|
+
* and holding an ATA on-chain.
|
|
2079
|
+
* @param mint - The mint address of the token.
|
|
2080
|
+
* @param owner - The public key of the wallet owner.
|
|
2081
|
+
* @param provider - An instance of SolanaProvider to interact with the Solana blockchain.
|
|
2082
|
+
* @param tokenProgram - SPL Token program id for this mint (legacy or Token-2022). If omitted, it is resolved via RPC.
|
|
2083
|
+
* @returns { ataAddress: string; exists: boolean; info: SolanaAccountInfo } - The ATA address, a boolean indicating if it exists, and the account info if it does.
|
|
2084
|
+
*/
|
|
2085
|
+
declare const maybeGetAssociatedTokenAccount: ({ mint, owner, provider, tokenProgram: tokenProgramOverride, }: {
|
|
2086
|
+
mint: string;
|
|
2087
|
+
owner: string;
|
|
2088
|
+
provider: SolanaProvider;
|
|
2089
|
+
tokenProgram?: Address<string> | undefined;
|
|
2090
|
+
}) => Promise<{
|
|
2091
|
+
address: Address<string>;
|
|
2092
|
+
exists: boolean;
|
|
2093
|
+
info: Readonly<{
|
|
2094
|
+
context: Readonly<{
|
|
2095
|
+
slot: bigint;
|
|
2096
|
+
}>;
|
|
2097
|
+
value: (Readonly<{
|
|
2098
|
+
executable: boolean;
|
|
2099
|
+
lamports: _solana_kit.Lamports;
|
|
2100
|
+
owner: Address<string>;
|
|
2101
|
+
rentEpoch: bigint;
|
|
2102
|
+
space: bigint;
|
|
2103
|
+
}> & Readonly<{
|
|
2104
|
+
data: _solana_kit.Base64EncodedDataResponse;
|
|
2105
|
+
}>) | null;
|
|
2106
|
+
}>;
|
|
2107
|
+
}>;
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* Loads the mint account and returns the SPL Token program that owns it
|
|
2111
|
+
* (legacy Tokenkeg... or Token-2022 TokenzQd...).
|
|
2112
|
+
*/
|
|
2113
|
+
declare const resolveTokenProgramForMint: ({ mint, provider, }: {
|
|
2114
|
+
mint: string;
|
|
2115
|
+
provider: SolanaProvider;
|
|
2116
|
+
}) => Promise<Address>;
|
|
2117
|
+
|
|
1985
2118
|
declare class SolanaSigner {
|
|
1986
2119
|
#private;
|
|
1987
2120
|
constructor(privateKey: Buffer);
|
|
@@ -2005,5 +2138,5 @@ declare class SolanaLedgerSigner {
|
|
|
2005
2138
|
signTx(base64EncodedTx: string, provider: SolanaProvider): Promise<string>;
|
|
2006
2139
|
}
|
|
2007
2140
|
|
|
2008
|
-
export { index as Avalanche, BitcoinLedgerWallet, BitcoinProvider, BitcoinProviderAbstract, BitcoinWallet, BitcoinWalletAbstract, BitcoinWalletVoid, BtcNetworks, DerivationPath, ETH_ACCOUNT_PATH, ETH_COIN_PATH, JsonRpcBatchInternal, LedgerSigner$1 as LedgerSigner, SolanaLedgerSigner, SolanaSigner, addEncodedSigToPsbt, compileSolanaTx, createPSBTV2, createPsbt, createTransferTx, createWalletPolicy, deserializeTransactionMessage, formatAddressForNetworkBech32, getAddressDerivationPath, getAddressFromXPub, getAddressPrivateKeyFromXPriv, getAddressPublicKeyFromXPub, getAppEth, getBech32Address, getBech32AddressFromXPub, getBtcAddressFromPubKey, getEvmAddressFromPubKey, getLedgerAppInfo, getLedgerExtendedPublicKey, getMaxTransferAmount, getPubKeyFromTransport, getPublicKeyFromPrivateKey, getSolanaDerivationPath, getSolanaProvider, getSolanaPublicKeyFromLedger, getTransferTxDetails, getVoidSigner, getWalletFromMnemonic, getXpubFromMnemonic$1 as getXpubFromMnemonic, isERC20Transfer, isNativeTxn, isSolanaProvider, omitUndefinedKeys, onBalanceChange, openLedgerApp, psbt2ToPsbt0, quitLedgerApp, selectUtxos, serializeSolanaTx, transferSol, transferToken };
|
|
2141
|
+
export { index as Avalanche, BitcoinLedgerWallet, BitcoinProvider, BitcoinProviderAbstract, BitcoinWallet, BitcoinWalletAbstract, BitcoinWalletVoid, BtcNetworks, DerivationPath, ETH_ACCOUNT_PATH, ETH_COIN_PATH, JsonRpcBatchInternal, LedgerSigner$1 as LedgerSigner, SolanaLedgerSigner, SolanaSigner, addEncodedSigToPsbt, compileSolanaTx, createPSBTV2, createPsbt, createTransferTx, createWalletPolicy, deserializeTransactionMessage, formatAddressForNetworkBech32, getAddressDerivationPath, getAddressFromXPub, getAddressPrivateKeyFromXPriv, getAddressPublicKeyFromXPub, getAppEth, getBech32Address, getBech32AddressFromXPub, getBtcAddressFromPubKey, getEVMDerivationPath, getEvmAddressFromPubKey, getLedgerAppInfo, getLedgerExtendedPublicKey, getMaxTransferAmount, getPubKeyFromTransport, getPublicKeyFromPrivateKey, getSolanaDerivationPath, getSolanaProvider, getSolanaPublicKeyFromLedger, getTransferTxDetails, getVoidSigner, getWalletFromMnemonic, getXpubFromMnemonic$1 as getXpubFromMnemonic, isERC20Transfer, isNativeTxn, isSolanaProvider, maybeGetAssociatedTokenAccount, omitUndefinedKeys, onBalanceChange, openLedgerApp, psbt2ToPsbt0, quitLedgerApp, resolveTokenProgramForMint, selectUtxos, serializeSolanaTx, transferSol, transferToken };
|
|
2009
2142
|
export type { BitcoinHistoryTx, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinLedgerInputUTXO, BitcoinOutputUTXO, BitcoinTx, SolanaProvider };
|
package/esm/Avalanche/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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';
|
|
1
|
+
export { AddAutoRenewedValidatorTx, AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, ConvertSubnetToL1Tx, CreateChainTx, CreateSubnetTx, DisableL1ValidatorTx, ExportTx, FeeData, ImportTx, IncreaseL1ValidatorBalanceTx, RegisterL1ValidatorTx, RemoveSubnetValidatorTx, RewardAutoRenewedValidatorTx, SetAutoRenewedValidatorConfigTx, SetL1ValidatorWeightTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, TxType, UnknownTx, isAddAutoRenewedValidatorTx, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isConvertSubnetToL1Tx, isCreateChainTx, isCreateSubnetTx, isDisableL1ValidatorTx, isExportTx, isImportTx, isIncreaseL1ValidatorBalance, isRegisterL1ValidatorTx, isRemoveSubnetValidatorTx, isRewardAutoRenewedValidatorTx, isSetAutoRenewedValidatorConfigTx, 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,6 +11,7 @@ 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';
|
|
@@ -32,9 +33,10 @@ export { getUtxosByTxFromGlacier } from './utils/getUtxosByTxFromGlacier.js';
|
|
|
32
33
|
export { getVmByChainAlias } from './utils/getVmByChainAlias.js';
|
|
33
34
|
export { getXpubFromMnemonic } from './utils/getXpubFromMnemonic.js';
|
|
34
35
|
export { isBech32Address } from './utils/isBech32Address.js';
|
|
35
|
-
export { parseAvalancheTx } from './utils/parseAvalancheTx.js';
|
|
36
|
+
export { ParseOptions, parseAvalancheTx } from './utils/parseAvalancheTx.js';
|
|
36
37
|
export { emptySignature, populateCredential } from './utils/populateCredential.js';
|
|
37
38
|
export { signedTxToHex } from './utils/signedTxToHex.js';
|
|
38
39
|
export { sortUTXOsByAmount, sortUTXOsByAmountAscending, sortUTXOsByAmountDescending, sortUTXOsStaking } from './utils/sortUTXOs.js';
|
|
39
40
|
export { P_CHAIN_TX_SIZE_LIMIT, SizeSupportedTx, getMaximumUtxoSet } from './utils/txSizeLimits.js';
|
|
40
41
|
export { verifyDerivationPath } from './utils/verifyDerivationPath.js';
|
|
42
|
+
export { getAvalancheDerivationPath } from './utils/getAvalancheDerivationPath.js';
|
package/esm/Avalanche/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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{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";
|
|
1
|
+
export{TxType,isAddAutoRenewedValidatorTx,isAddDelegatorTx,isAddPermissionlessDelegatorTx,isAddPermissionlessValidatorTx,isAddSubnetValidatorTx,isAddValidatorTx,isBaseTx,isConvertSubnetToL1Tx,isCreateChainTx,isCreateSubnetTx,isDisableL1ValidatorTx,isExportTx,isImportTx,isIncreaseL1ValidatorBalance,isRegisterL1ValidatorTx,isRemoveSubnetValidatorTx,isRewardAutoRenewedValidatorTx,isSetAutoRenewedValidatorConfigTx,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";
|
|
@@ -4,13 +4,14 @@ 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 | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | UnknownTx;
|
|
7
|
+
type Tx = AddValidatorTx | AddDelegatorTx | ExportTx | ImportTx | BaseTx | CreateSubnetTx | CreateChainTx | AddSubnetValidatorTx | RemoveSubnetValidatorTx | AddPermissionlessValidatorTx | AddPermissionlessDelegatorTx | TransformSubnetTx | TransferSubnetOwnershipTx | ConvertSubnetToL1Tx | RegisterL1ValidatorTx | SetL1ValidatorWeightTx | DisableL1ValidatorTx | IncreaseL1ValidatorBalanceTx | AddAutoRenewedValidatorTx | SetAutoRenewedValidatorConfigTx | RewardAutoRenewedValidatorTx | 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;
|
|
@@ -29,6 +30,9 @@ declare enum TxType {
|
|
|
29
30
|
SetL1ValidatorWeight = "set_l1_validator_weight",
|
|
30
31
|
IncreaseL1ValidatorBalance = "increase_l1_validator_balance",
|
|
31
32
|
DisableL1Validator = "disable_l1_validator",
|
|
33
|
+
AddAutoRenewedValidator = "add_auto_renewed_validator",
|
|
34
|
+
SetAutoRenewedValidatorConfig = "set_auto_renewed_validator_config",
|
|
35
|
+
RewardAutoRenewedValidator = "reward_auto_renewed_validator",
|
|
32
36
|
AddSubnetValidator = "add_subnet_validator",
|
|
33
37
|
RemoveSubnetValidator = "remove_subnet_validator",
|
|
34
38
|
AddPermissionlessValidator = "add_permissionless_validator",
|
|
@@ -136,6 +140,32 @@ interface DisableL1ValidatorTx extends TxBase {
|
|
|
136
140
|
type: TxType.DisableL1Validator;
|
|
137
141
|
validationId: string;
|
|
138
142
|
}
|
|
143
|
+
interface AddAutoRenewedValidatorTx extends TxBase {
|
|
144
|
+
type: TxType.AddAutoRenewedValidator;
|
|
145
|
+
nodeID: string;
|
|
146
|
+
stake: bigint;
|
|
147
|
+
stakeOuts: readonly TransferableOutput[];
|
|
148
|
+
rewardOwner: OutputOwners;
|
|
149
|
+
delegationRewardOwner: OutputOwners;
|
|
150
|
+
owner: OutputOwners;
|
|
151
|
+
delegationFee: number;
|
|
152
|
+
weight: bigint;
|
|
153
|
+
autoCompoundRewardShares: number;
|
|
154
|
+
period: bigint;
|
|
155
|
+
signer: pvmSerial.Signer | pvmSerial.SignerEmpty;
|
|
156
|
+
publicKey: undefined | string;
|
|
157
|
+
signature: undefined | string;
|
|
158
|
+
}
|
|
159
|
+
interface SetAutoRenewedValidatorConfigTx extends TxBase {
|
|
160
|
+
type: TxType.SetAutoRenewedValidatorConfig;
|
|
161
|
+
txId: string;
|
|
162
|
+
autoCompoundRewardShares: number;
|
|
163
|
+
period: bigint;
|
|
164
|
+
}
|
|
165
|
+
interface RewardAutoRenewedValidatorTx extends TxBase {
|
|
166
|
+
type: TxType.RewardAutoRenewedValidator;
|
|
167
|
+
txId: string;
|
|
168
|
+
}
|
|
139
169
|
interface AddPermissionlessValidatorTx extends TxBase {
|
|
140
170
|
type: TxType.AddPermissionlessValidator;
|
|
141
171
|
nodeID: string;
|
|
@@ -208,6 +238,9 @@ declare function isAddPermissionlessValidatorTx(tx: Tx): tx is AddPermissionless
|
|
|
208
238
|
declare function isAddPermissionlessDelegatorTx(tx: Tx): tx is AddPermissionlessDelegatorTx;
|
|
209
239
|
declare function isTransformSubnetTx(tx: Tx): tx is TransformSubnetTx;
|
|
210
240
|
declare function isTransferSubnetOwnershipTx(tx: Tx): tx is TransferSubnetOwnershipTx;
|
|
241
|
+
declare function isAddAutoRenewedValidatorTx(tx: Tx): tx is AddAutoRenewedValidatorTx;
|
|
242
|
+
declare function isSetAutoRenewedValidatorConfigTx(tx: Tx): tx is SetAutoRenewedValidatorConfigTx;
|
|
243
|
+
declare function isRewardAutoRenewedValidatorTx(tx: Tx): tx is RewardAutoRenewedValidatorTx;
|
|
211
244
|
|
|
212
|
-
export { TxType, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isConvertSubnetToL1Tx, isCreateChainTx, isCreateSubnetTx, isDisableL1ValidatorTx, isExportTx, isImportTx, isIncreaseL1ValidatorBalance, isRegisterL1ValidatorTx, isRemoveSubnetValidatorTx, isSetL1ValidatorWeightTx, isTransferSubnetOwnershipTx, isTransformSubnetTx };
|
|
213
|
-
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 };
|
|
245
|
+
export { TxType, isAddAutoRenewedValidatorTx, isAddDelegatorTx, isAddPermissionlessDelegatorTx, isAddPermissionlessValidatorTx, isAddSubnetValidatorTx, isAddValidatorTx, isBaseTx, isConvertSubnetToL1Tx, isCreateChainTx, isCreateSubnetTx, isDisableL1ValidatorTx, isExportTx, isImportTx, isIncreaseL1ValidatorBalance, isRegisterL1ValidatorTx, isRemoveSubnetValidatorTx, isRewardAutoRenewedValidatorTx, isSetAutoRenewedValidatorConfigTx, isSetL1ValidatorWeightTx, isTransferSubnetOwnershipTx, isTransformSubnetTx };
|
|
246
|
+
export type { AddAutoRenewedValidatorTx, AddDelegatorTx, AddPermissionlessDelegatorTx, AddPermissionlessValidatorTx, AddSubnetValidatorTx, AddValidatorTx, BaseTx, ChainIDAlias, ConvertSubnetToL1Tx, CreateChainTx, CreateSubnetTx, DisableL1ValidatorTx, ExportTx, FeeData, ImportTx, IncreaseL1ValidatorBalanceTx, RegisterL1ValidatorTx, RemoveSubnetValidatorTx, RewardAutoRenewedValidatorTx, SetAutoRenewedValidatorConfigTx, SetL1ValidatorWeightTx, TransferSubnetOwnershipTx, TransformSubnetTx, Tx, TxBase, UnknownTx };
|
package/esm/Avalanche/models.js
CHANGED
|
@@ -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.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
|
|
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.AddAutoRenewedValidator="add_auto_renewed_validator",e.SetAutoRenewedValidatorConfig="set_auto_renewed_validator_config",e.RewardAutoRenewedValidator="reward_auto_renewed_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 _(e){return"set_l1_validator_weight"===e.type}function u(e){return"disable_l1_validator"===e.type}function l(e){return"increase_l1_validator_balance"===e.type}function s(e){return"create_subnet"===e.type}function c(e){return"create_chain"===e.type}function p(e){return"add_subnet_validator"===e.type}function f(e){return"remove_subnet_validator"===e.type}function v(e){return"add_permissionless_validator"===e.type}function b(e){return"add_permissionless_delegator"===e.type}function y(e){return"transform_subnet"===e.type}function w(e){return"transfer_subnet_ownership"===e.type}function g(e){return"add_auto_renewed_validator"===e.type}function m(e){return"set_auto_renewed_validator_config"===e.type}function V(e){return"reward_auto_renewed_validator"===e.type}export{e as TxType,g as isAddAutoRenewedValidatorTx,r as isAddDelegatorTx,b as isAddPermissionlessDelegatorTx,v as isAddPermissionlessValidatorTx,p as isAddSubnetValidatorTx,t as isAddValidatorTx,o as isBaseTx,i as isConvertSubnetToL1Tx,c as isCreateChainTx,s as isCreateSubnetTx,u as isDisableL1ValidatorTx,n as isExportTx,a as isImportTx,l as isIncreaseL1ValidatorBalance,d as isRegisterL1ValidatorTx,f as isRemoveSubnetValidatorTx,V as isRewardAutoRenewedValidatorTx,m as isSetAutoRenewedValidatorConfigTx,_ as isSetL1ValidatorWeightTx,w 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
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
|
-
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{utils as t,secp256k1 as e,networkIDs as s,avm as
|
|
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,11 +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
|
-
static getDefaultMainnetProvider(): JsonRpcProvider;
|
|
8
|
-
static getDefaultFujiProvider(): JsonRpcProvider;
|
|
9
|
-
static getDefaultDevnetProvider(): JsonRpcProvider;
|
|
7
|
+
static getDefaultMainnetProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
8
|
+
static getDefaultFujiProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
9
|
+
static getDefaultDevnetProvider(fetchOptions?: RequestInit): JsonRpcProvider;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export { JsonRpcProvider };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AbstractProvider as r}from"./AbstractProvider.js";import{Context as t
|
|
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(r){return new i(s.rpcUrl,e,r)}static getDefaultFujiProvider(r){return new i(o.rpcUrl,a,r)}static getDefaultDevnetProvider(r){return new i(c.rpcUrl,n,r)}}export{i as JsonRpcProvider};
|