@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
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BitcoinWalletAbstract as t}from"./BitcoinWalletAbstract.js";import
|
|
1
|
+
import{BitcoinWalletAbstract as t}from"./BitcoinWalletAbstract.js";import{AppClient as i}from"ledger-bitcoin";import"bitcoinjs-lib";import"coinselect";import"@ledgerhq/hw-app-eth";import"ethers";import"bip32";import"bip39";import"@avalabs/core-utils-sdk";import"@ledgerhq/hw-transport";import"@metamask/eth-sig-util";import{createPSBTV2 as r}from"../utils/createPSBTV2.js";import{psbt2ToPsbt0 as e}from"../utils/psbt2ToPsbt0.js";class s extends t{constructor(t,i,r,e,s){super(t,r),this.derivationPath=i,this.transport=e,this.walletPolicyDetails=s}setTransport(t){this.transport=t}async signTx(t,s){const a=function(t){return new i(t)}(this.transport),o=this.ecPair.publicKey,n=this.provider.getNetwork(),p=await a.getMasterFingerprint(),l=r(t,s,n,Buffer.from(p,"hex"),o,this.derivationPath),{policy:c,hmac:h}=this.walletPolicyDetails,m=await a.signPsbt(l,c,h),u=e(l,n,o,this.derivationPath);if(m.forEach((t=>{const[i,r]=t;u.updateInput(i,{partialSig:[{signature:r.signature,pubkey:r.pubkey}]})})),!u.validateSignaturesOfAllInputs())throw new Error("Failed to validate signatures");return u.finalizeAllInputs(),u.extractTransaction()}}export{s as BitcoinLedgerWallet};
|
package/esm/EVM/LedgerSigner.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AbstractSigner as t,defineProperties as s,getAddress as i,toUtf8Bytes as e,hexlify as r,Signature as a,Transaction as n,TypedDataEncoder as o}from"ethers";import{getAppEth as h}from"./utils/getAppEth.js";import{
|
|
1
|
+
import{AbstractSigner as t,defineProperties as s,getAddress as i,toUtf8Bytes as e,hexlify as r,Signature as a,Transaction as n,TypedDataEncoder as o}from"ethers";import{getAppEth as h}from"./utils/getAppEth.js";import{getEVMDerivationPath as p}from"./utils/getEvmDerivationPath.js";import"bip32";import"bip39";import"bitcoinjs-lib";import"@avalabs/core-utils-sdk";import{TransportStatusError as c,StatusCodes as d}from"@ledgerhq/hw-transport";import{TypedDataUtils as m,SignTypedDataVersion as g}from"@metamask/eth-sig-util";class u extends t{type="default";path;provider=null;accountIndex;derivationSpec;transport;_eth;constructor(t=0,i,e,r){super(),this.path=p(t,e),this.accountIndex=t,this.transport=i,this.derivationSpec=e,this._eth=h(i),s(this,{path:this.path,type:"default",provider:r??null})}setTransport(t){this._eth=h(t),this.transport=t}async getAddress(){const t=await this._eth.getAddress(this.path);return i(t.address)}async signMessage(t){"string"==typeof t&&(t=e(t));const s=r(t).substring(2),i=await this._eth.signPersonalMessage(this.path,s);return i.r="0x"+i.r,i.s="0x"+i.s,a.from(i).serialized}async signTransaction(t){const s=await this.populateTransaction(t);delete s.from;const i=n.from(s),e=i.unsignedSerialized,r=await this._eth.signTransaction(this.path,e.slice(2),null);return i.signature={v:BigInt("0x"+r.v),r:"0x"+r.r,s:"0x"+r.s},i.serialized}connect(t){return new u(this.accountIndex,this.transport,this.derivationSpec,t)}async signTypedData(t,s,i){const{EIP712Domain:e,...r}=s,n=o.getPrimaryType(r);try{const e=await this._eth.signEIP712Message(this.path,{domain:{name:t.name||void 0,chainId:t.chainId?Number(t.chainId):void 0,version:t.version||void 0,verifyingContract:t.verifyingContract||void 0,salt:t.salt?.toString()||void 0},types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],...s},primaryType:n,message:i});return e.r="0x"+e.r,e.s="0x"+e.s,a.from(e).serialized}catch(e){if(e instanceof c&&e.statusCode===d.INS_NOT_SUPPORTED){const e=m.hashStruct(n,i,s,g.V4),r=m.hashStruct("EIP712Domain",t,s,g.V4),o=await this._eth.signEIP712HashedMessage(this.path,r.toString("hex"),e.toString("hex"));return o.r="0x"+o.r,o.s="0x"+o.s,a.from(o).serialized}throw e}}}export{u as LedgerSigner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DerivationPath as r}from"../constants.js";const e=(e,t,s=!0)=>{switch(t){case r.BIP44:return`${s?"m/":""}44'/60'/0'/0/${e}`;case r.LedgerLive:return`${s?"m/":""}44'/60'/${e}'/0/0`;default:throw new Error("Invalid path spec")}};export{e as getEVMDerivationPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HDNodeWallet as r,Mnemonic as e}from"ethers";import{
|
|
1
|
+
import{HDNodeWallet as r,Mnemonic as e}from"ethers";import{getEVMDerivationPath as t}from"./getEvmDerivationPath.js";function o(o,n,i){if(!(n>=0&&n%1==0))throw new Error("Account index must be an integer greater than or equal to 0.");return r.fromMnemonic(e.fromPhrase(o),t(n,i))}export{o as getWalletFromMnemonic};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as _solana_kit from '@solana/kit';
|
|
2
|
+
import { Address } from '@solana/kit';
|
|
3
|
+
import { SolanaProvider } from './solanaProvider.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Helper to abstract confirming the existence of an Associated Token Account (ATA).
|
|
7
|
+
* Useful for transferring SPL tokens, as each wallet must have an ATA for each token they own.
|
|
8
|
+
* If a ATA does not exist, gas estimates must include a one-time rent-exempt minimum for creating
|
|
9
|
+
* and holding an ATA on-chain.
|
|
10
|
+
* @param mint - The mint address of the token.
|
|
11
|
+
* @param owner - The public key of the wallet owner.
|
|
12
|
+
* @param provider - An instance of SolanaProvider to interact with the Solana blockchain.
|
|
13
|
+
* @param tokenProgram - SPL Token program id for this mint (legacy or Token-2022). If omitted, it is resolved via RPC.
|
|
14
|
+
* @returns { ataAddress: string; exists: boolean; info: SolanaAccountInfo } - The ATA address, a boolean indicating if it exists, and the account info if it does.
|
|
15
|
+
*/
|
|
16
|
+
declare const maybeGetAssociatedTokenAccount: ({ mint, owner, provider, tokenProgram: tokenProgramOverride, }: {
|
|
17
|
+
mint: string;
|
|
18
|
+
owner: string;
|
|
19
|
+
provider: SolanaProvider;
|
|
20
|
+
tokenProgram?: Address<string> | undefined;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
address: Address<string>;
|
|
23
|
+
exists: boolean;
|
|
24
|
+
info: Readonly<{
|
|
25
|
+
context: Readonly<{
|
|
26
|
+
slot: bigint;
|
|
27
|
+
}>;
|
|
28
|
+
value: (Readonly<{
|
|
29
|
+
executable: boolean;
|
|
30
|
+
lamports: _solana_kit.Lamports;
|
|
31
|
+
owner: Address<string>;
|
|
32
|
+
rentEpoch: bigint;
|
|
33
|
+
space: bigint;
|
|
34
|
+
}> & Readonly<{
|
|
35
|
+
data: _solana_kit.Base64EncodedDataResponse;
|
|
36
|
+
}>) | null;
|
|
37
|
+
}>;
|
|
38
|
+
}>;
|
|
39
|
+
|
|
40
|
+
export { maybeGetAssociatedTokenAccount };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{findAssociatedTokenPda as o}from"@solana-program/token";import{address as r}from"@solana/kit";import{resolveTokenProgramForMint as n}from"./resolveTokenProgramForMint.js";const t=async({mint:t,owner:e,provider:a,tokenProgram:i})=>{const m=i??await n({mint:t,provider:a}),[s]=await o({mint:r(t),owner:r(e),tokenProgram:m}),p=await a.getAccountInfo(s,{encoding:"base64"}).send();return{address:s,exists:Boolean(p.value),info:p}};export{t as maybeGetAssociatedTokenAccount};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Address } from '@solana/kit';
|
|
2
|
+
import { SolanaProvider } from './solanaProvider.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Loads the mint account and returns the SPL Token program that owns it
|
|
6
|
+
* (legacy Tokenkeg... or Token-2022 TokenzQd...).
|
|
7
|
+
*/
|
|
8
|
+
declare const resolveTokenProgramForMint: ({ mint, provider, }: {
|
|
9
|
+
mint: string;
|
|
10
|
+
provider: SolanaProvider;
|
|
11
|
+
}) => Promise<Address>;
|
|
12
|
+
|
|
13
|
+
export { resolveTokenProgramForMint };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{address as o}from"@solana/kit";import{TOKEN_PROGRAM_ADDRESS as r}from"@solana-program/token";import{TOKEN_2022_PROGRAM_ADDRESS as n}from"@solana-program/token-2022";const t=(o,r)=>String(o)===String(r),e=async({mint:e,provider:i})=>{const a=o(e),{value:m}=await i.getAccountInfo(a,{encoding:"base64"}).send();if(!m)throw new Error(`Mint account not found: ${e}`);const p=m.owner;if(t(p,r))return r;if(t(p,n))return n;throw new Error(`Unsupported token program for mint ${e}: ${String(p)}`)};export{e as resolveTokenProgramForMint};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{address as t,createNoopSigner as
|
|
1
|
+
import{address as t,createNoopSigner as o,pipe as r,createTransactionMessage as e,setTransactionMessageLifetimeUsingBlockhash as a,setTransactionMessageFeePayer as n,appendTransactionMessageInstructions as i}from"@solana/kit";import{getCreateAssociatedTokenIdempotentInstruction as s,getTransferCheckedInstruction as m}from"@solana-program/token";import{getCreateAssociatedTokenIdempotentInstruction as c,TOKEN_2022_PROGRAM_ADDRESS as d,getTransferCheckedInstruction as p}from"@solana-program/token-2022";import{maybeGetAssociatedTokenAccount as u}from"./maybeGetAssociatedTokenAccount.js";import{resolveTokenProgramForMint as g}from"./resolveTokenProgramForMint.js";const k=async({from:k,to:l,mint:w,amount:f,decimals:h,provider:v})=>{const y=await g({mint:w,provider:v}),P=String(y)===String(d);const{address:T}=await u({mint:w,owner:k,provider:v,tokenProgram:y}),{address:A,exists:I}=await u({mint:w,owner:l,provider:v,tokenProgram:y}),j=[];I||j.push(P?c({payer:o(t(k)),mint:t(w),owner:t(l),ata:A,tokenProgram:d}):s({payer:o(t(k)),mint:t(w),owner:t(l),ata:A})),j.push(P?p({amount:f,authority:o(t(k)),decimals:h,mint:t(w),destination:A,source:T}):m({amount:f,authority:o(t(k)),decimals:h,mint:t(w),destination:A,source:T}));const{value:x}=await v.getLatestBlockhash().send();return r(e({version:0}),(t=>a(x,t)),(o=>n(t(k),o)),(t=>i(j,t)))};export{k as transferToken};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{base58 as r}from"@scure/base";import t from"@ledgerhq/hw-app-solana";import{compileTransaction as a,address as s,assertIsSignature as i,getBase64EncodedWireTransaction as e}from"@solana/kit";import{deserializeTransactionMessage as o}from"../utils/deserializeSolanaTx.js";import"@solana-program/system";import"@solana-program/token";import{getSolanaDerivationPath as n}from"../utils/derivationPath.js";class m{#r;#t;constructor(r,t){this.#r=n(r,!1),this.#t=t}async signTx(n,m){const
|
|
1
|
+
import{base58 as r}from"@scure/base";import t from"@ledgerhq/hw-app-solana";import{compileTransaction as a,address as s,assertIsSignature as i,getBase64EncodedWireTransaction as e}from"@solana/kit";import{deserializeTransactionMessage as o}from"../utils/deserializeSolanaTx.js";import"@solana-program/system";import"@solana-program/token";import"@solana-program/token-2022";import{getSolanaDerivationPath as n}from"../utils/derivationPath.js";class m{#r;#t;constructor(r,t){this.#r=n(r,!1),this.#t=t}async signTx(n,m){const p=await o(n,m),{signatures:d,messageBytes:u,...g}=a(p),h=new t(this.#t),{address:c}=await h.getAddress(this.#r),f=s(r.encode(Uint8Array.from(c)));if(!this.#a(f,d))return n;const{signature:l}=await h.signTransaction(this.#r,Buffer.from(u)),y=r.encode(Uint8Array.from(l));return i(y),e({...g,messageBytes:u,signatures:{...d,[f]:r.decode(y)}})}#a(r,t){return r in t&&!t[r]}}export{m as SolanaLedgerSigner};
|
package/esm/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export { getAddressFromXPub } from './EVM/utils/getAddressFromXPub.js';
|
|
|
10
10
|
export { getXpubFromMnemonic } from './EVM/utils/getXpubFromMnemonic.js';
|
|
11
11
|
export { getEvmAddressFromPubKey } from './EVM/utils/getEvmAddressFromPubKey.js';
|
|
12
12
|
export { getBtcAddressFromPubKey } from './EVM/utils/getBtcAddressFromPubKey.js';
|
|
13
|
+
export { getEVMDerivationPath } from './EVM/utils/getEvmDerivationPath.js';
|
|
13
14
|
export { DerivationPath, ETH_ACCOUNT_PATH, ETH_COIN_PATH } from './EVM/constants.js';
|
|
14
15
|
export { LedgerSigner } from './EVM/LedgerSigner.js';
|
|
15
16
|
import * as index from './Avalanche/index.js';
|
|
@@ -30,6 +31,8 @@ export { transferSol } from './SolanaVM/utils/transferSol.js';
|
|
|
30
31
|
export { transferToken } from './SolanaVM/utils/transferToken.js';
|
|
31
32
|
export { getSolanaDerivationPath } from './SolanaVM/utils/derivationPath.js';
|
|
32
33
|
export { getSolanaPublicKeyFromLedger } from './SolanaVM/utils/getSolanaPublicKeyFromLedger.js';
|
|
34
|
+
export { maybeGetAssociatedTokenAccount } from './SolanaVM/utils/maybeGetAssociatedTokenAccount.js';
|
|
35
|
+
export { resolveTokenProgramForMint } from './SolanaVM/utils/resolveTokenProgramForMint.js';
|
|
33
36
|
export { SolanaSigner } from './SolanaVM/wallets/SolanaSigner.js';
|
|
34
37
|
export { SolanaLedgerSigner } from './SolanaVM/wallets/SolanaLedgerSigner.js';
|
|
35
38
|
export { BitcoinHistoryTx, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinLedgerInputUTXO, BitcoinOutputUTXO, BitcoinTx } from './BitcoinVM/models.js';
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{BtcNetworks}from"./BitcoinVM/index.js";export{getAppEth}from"./EVM/utils/getAppEth.js";export{getVoidSigner}from"./EVM/utils/getVoidSigner.js";export{getWalletFromMnemonic}from"./EVM/utils/getWalletFromMnemonic.js";export{isERC20Transfer,isNativeTxn,onBalanceChange}from"./EVM/utils/blockPolling.js";export{JsonRpcBatchInternal}from"./EVM/utils/jsonRpcBatchProvider.js";export{getAddressPrivateKeyFromXPriv}from"./EVM/utils/getAddressPrivateKeyFromXPriv.js";export{getAddressPublicKeyFromXPub}from"./EVM/utils/getAddressPublicKeyFromXPub.js";export{getAddressFromXPub}from"./EVM/utils/getAddressFromXPub.js";export{getXpubFromMnemonic}from"./EVM/utils/getXpubFromMnemonic.js";export{getEvmAddressFromPubKey}from"./EVM/utils/getEvmAddressFromPubKey.js";export{getBtcAddressFromPubKey}from"./EVM/utils/getBtcAddressFromPubKey.js";export{DerivationPath,ETH_ACCOUNT_PATH,ETH_COIN_PATH}from"./EVM/constants.js";export{LedgerSigner}from"./EVM/LedgerSigner.js";import*as e from"./Avalanche/index.js";export{e as Avalanche};export{getAddressDerivationPath}from"./utils/getAddressDerivationPath.js";export{getPublicKeyFromPrivateKey}from"./utils/getPublicKeyFromPrivateKey.js";export{getPubKeyFromTransport}from"./utils/getPubKeyFromTransport.js";export{getLedgerExtendedPublicKey}from"./utils/getLedgerExtendedPublicKey.js";export{omitUndefinedKeys}from"./utils/omitUndefinedKeys.js";export{getLedgerAppInfo}from"./utils/getLedgerAppInfo.js";export{openLedgerApp}from"./utils/openLedgerApp.js";export{quitLedgerApp}from"./utils/quitLedgerApp.js";export{compileSolanaTx}from"./SolanaVM/utils/compileSolanaTx.js";export{deserializeTransactionMessage}from"./SolanaVM/utils/deserializeSolanaTx.js";export{serializeSolanaTx}from"./SolanaVM/utils/serializeSolanaTx.js";export{getSolanaProvider,isSolanaProvider}from"./SolanaVM/utils/solanaProvider.js";export{transferSol}from"./SolanaVM/utils/transferSol.js";export{transferToken}from"./SolanaVM/utils/transferToken.js";export{getSolanaDerivationPath}from"./SolanaVM/utils/derivationPath.js";export{getSolanaPublicKeyFromLedger}from"./SolanaVM/utils/getSolanaPublicKeyFromLedger.js";export{SolanaSigner}from"./SolanaVM/wallets/SolanaSigner.js";export{SolanaLedgerSigner}from"./SolanaVM/wallets/SolanaLedgerSigner.js";export{BitcoinProviderAbstract}from"./BitcoinVM/providers/BitcoinProviderAbstract.js";export{BitcoinProvider}from"./BitcoinVM/providers/BitcoinProvider.js";export{addEncodedSigToPsbt}from"./BitcoinVM/utils/addEncodedSigToPsbt.js";export{createPsbt}from"./BitcoinVM/utils/createPsbt.js";export{createTransferTx}from"./BitcoinVM/utils/createTransferTx.js";export{formatAddressForNetworkBech32}from"./BitcoinVM/utils/formatAddressForNetworkBech32.js";export{getBech32Address}from"./BitcoinVM/utils/getBech32Address.js";export{getBech32AddressFromXPub}from"./BitcoinVM/utils/getBech32AddressFromXPub.js";export{getMaxTransferAmount}from"./BitcoinVM/utils/getMaxTransferAmount.js";export{selectUtxos}from"./BitcoinVM/utils/selectUtxos.js";export{createWalletPolicy}from"./BitcoinVM/utils/createWalletPolicy.js";export{createPSBTV2}from"./BitcoinVM/utils/createPSBTV2.js";export{psbt2ToPsbt0}from"./BitcoinVM/utils/psbt2ToPsbt0.js";export{getTransferTxDetails}from"./BitcoinVM/utils/getTransferTxDetails.js";export{BitcoinWalletAbstract}from"./BitcoinVM/wallets/BitcoinWalletAbstract.js";export{BitcoinWallet}from"./BitcoinVM/wallets/BitcoinWallet.js";export{BitcoinLedgerWallet}from"./BitcoinVM/wallets/BitcoinWalletLedger.js";export{BitcoinWalletVoid}from"./BitcoinVM/wallets/BitcoinWalletVoid.js";
|
|
1
|
+
export{BtcNetworks}from"./BitcoinVM/index.js";export{getAppEth}from"./EVM/utils/getAppEth.js";export{getVoidSigner}from"./EVM/utils/getVoidSigner.js";export{getWalletFromMnemonic}from"./EVM/utils/getWalletFromMnemonic.js";export{isERC20Transfer,isNativeTxn,onBalanceChange}from"./EVM/utils/blockPolling.js";export{JsonRpcBatchInternal}from"./EVM/utils/jsonRpcBatchProvider.js";export{getAddressPrivateKeyFromXPriv}from"./EVM/utils/getAddressPrivateKeyFromXPriv.js";export{getAddressPublicKeyFromXPub}from"./EVM/utils/getAddressPublicKeyFromXPub.js";export{getAddressFromXPub}from"./EVM/utils/getAddressFromXPub.js";export{getXpubFromMnemonic}from"./EVM/utils/getXpubFromMnemonic.js";export{getEvmAddressFromPubKey}from"./EVM/utils/getEvmAddressFromPubKey.js";export{getBtcAddressFromPubKey}from"./EVM/utils/getBtcAddressFromPubKey.js";export{getEVMDerivationPath}from"./EVM/utils/getEvmDerivationPath.js";export{DerivationPath,ETH_ACCOUNT_PATH,ETH_COIN_PATH}from"./EVM/constants.js";export{LedgerSigner}from"./EVM/LedgerSigner.js";import*as e from"./Avalanche/index.js";export{e as Avalanche};export{getAddressDerivationPath}from"./utils/getAddressDerivationPath.js";export{getPublicKeyFromPrivateKey}from"./utils/getPublicKeyFromPrivateKey.js";export{getPubKeyFromTransport}from"./utils/getPubKeyFromTransport.js";export{getLedgerExtendedPublicKey}from"./utils/getLedgerExtendedPublicKey.js";export{omitUndefinedKeys}from"./utils/omitUndefinedKeys.js";export{getLedgerAppInfo}from"./utils/getLedgerAppInfo.js";export{openLedgerApp}from"./utils/openLedgerApp.js";export{quitLedgerApp}from"./utils/quitLedgerApp.js";export{compileSolanaTx}from"./SolanaVM/utils/compileSolanaTx.js";export{deserializeTransactionMessage}from"./SolanaVM/utils/deserializeSolanaTx.js";export{serializeSolanaTx}from"./SolanaVM/utils/serializeSolanaTx.js";export{getSolanaProvider,isSolanaProvider}from"./SolanaVM/utils/solanaProvider.js";export{transferSol}from"./SolanaVM/utils/transferSol.js";export{transferToken}from"./SolanaVM/utils/transferToken.js";export{getSolanaDerivationPath}from"./SolanaVM/utils/derivationPath.js";export{getSolanaPublicKeyFromLedger}from"./SolanaVM/utils/getSolanaPublicKeyFromLedger.js";export{maybeGetAssociatedTokenAccount}from"./SolanaVM/utils/maybeGetAssociatedTokenAccount.js";export{resolveTokenProgramForMint}from"./SolanaVM/utils/resolveTokenProgramForMint.js";export{SolanaSigner}from"./SolanaVM/wallets/SolanaSigner.js";export{SolanaLedgerSigner}from"./SolanaVM/wallets/SolanaLedgerSigner.js";export{BitcoinProviderAbstract}from"./BitcoinVM/providers/BitcoinProviderAbstract.js";export{BitcoinProvider}from"./BitcoinVM/providers/BitcoinProvider.js";export{addEncodedSigToPsbt}from"./BitcoinVM/utils/addEncodedSigToPsbt.js";export{createPsbt}from"./BitcoinVM/utils/createPsbt.js";export{createTransferTx}from"./BitcoinVM/utils/createTransferTx.js";export{formatAddressForNetworkBech32}from"./BitcoinVM/utils/formatAddressForNetworkBech32.js";export{getBech32Address}from"./BitcoinVM/utils/getBech32Address.js";export{getBech32AddressFromXPub}from"./BitcoinVM/utils/getBech32AddressFromXPub.js";export{getMaxTransferAmount}from"./BitcoinVM/utils/getMaxTransferAmount.js";export{selectUtxos}from"./BitcoinVM/utils/selectUtxos.js";export{createWalletPolicy}from"./BitcoinVM/utils/createWalletPolicy.js";export{createPSBTV2}from"./BitcoinVM/utils/createPSBTV2.js";export{psbt2ToPsbt0}from"./BitcoinVM/utils/psbt2ToPsbt0.js";export{getTransferTxDetails}from"./BitcoinVM/utils/getTransferTxDetails.js";export{BitcoinWalletAbstract}from"./BitcoinVM/wallets/BitcoinWalletAbstract.js";export{BitcoinWallet}from"./BitcoinVM/wallets/BitcoinWallet.js";export{BitcoinLedgerWallet}from"./BitcoinVM/wallets/BitcoinWalletLedger.js";export{BitcoinWalletVoid}from"./BitcoinVM/wallets/BitcoinWalletVoid.js";
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { DerivationPath } from '../EVM/constants.js';
|
|
2
2
|
|
|
3
|
+
type DerivationPathOptions = {
|
|
4
|
+
withRoot?: boolean;
|
|
5
|
+
pathSpec?: DerivationPath;
|
|
6
|
+
};
|
|
3
7
|
/**
|
|
4
8
|
* Get the derivation path used by wallet addresses
|
|
5
9
|
* @param addressIndex Which index is the address on
|
|
6
|
-
* @param pathSpec BIP44 vs LedgerLive
|
|
7
10
|
* @param vm Which VM is this address on. Coin index changes between Avalanche and EVM
|
|
8
|
-
* @param
|
|
11
|
+
* @param options
|
|
12
|
+
* @param options.withRoot If false, skips the "m/" prefix. Needed for Solana Ledger app.
|
|
13
|
+
* @param options.pathSpec Only relevant (and required) for EVM.
|
|
9
14
|
*/
|
|
10
|
-
declare function getAddressDerivationPath(
|
|
11
|
-
vm: 'SVM', withRoot?: boolean): string;
|
|
12
|
-
declare function getAddressDerivationPath(addressIndex: number, pathSpec: DerivationPath, vm: 'EVM' | 'AVM' | 'PVM', withRoot?: never): string;
|
|
15
|
+
declare function getAddressDerivationPath(accountIndex: number, vm: 'SVM' | 'EVM' | 'AVM' | 'PVM', options?: DerivationPathOptions): string;
|
|
13
16
|
|
|
14
17
|
export { getAddressDerivationPath };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"@solana/kit";import"@solana-program/system";import"@solana-program/token";import{getSolanaDerivationPath as
|
|
1
|
+
import"@ledgerhq/hw-app-eth";import"ethers";import{getEVMDerivationPath as a}from"../EVM/utils/getEvmDerivationPath.js";import"bip32";import"bip39";import"bitcoinjs-lib";import"@avalabs/core-utils-sdk";import"@ledgerhq/hw-transport";import"@metamask/eth-sig-util";import"../Avalanche/wallets/WalletAbstract.js";import"../Avalanche/utils/addSignaturesToAvalancheTx.js";import"../Avalanche/utils/convertGlacierUtxo.js";import"../Avalanche/utils/createAvalancheEvmUnsignedTx.js";import"../Avalanche/utils/createAvalancheUnsignedTx.js";import"create-hash";import"@avalabs/avalanchejs";import"../Avalanche/utils/getAssetBalance.js";import"../Avalanche/utils/getUtxosByTxFromGlacier.js";import"../Avalanche/utils/parseAvalancheTx.js";import"../Avalanche/utils/populateCredential.js";import"../Avalanche/utils/txSizeLimits.js";import"bip32-path";import{getAvalancheDerivationPath as t}from"../Avalanche/utils/getAvalancheDerivationPath.js";import"@avalabs/hw-app-avalanche";import"../Avalanche/wallets/legacy/MnemonicWalletVoid.js";import"../Avalanche/wallets/legacy/LedgerWallet.js";import"../Avalanche/wallets/legacy/MnemonicWallet.js";import"../Avalanche/wallets/StaticSigner.js";import"@solana/kit";import"@solana-program/system";import"@solana-program/token";import"@solana-program/token-2022";import{getSolanaDerivationPath as e}from"../SolanaVM/utils/derivationPath.js";import"@ledgerhq/hw-app-solana";import"@noble/curves/ed25519";import"@scure/base";import"micro-key-producer/slip10.js";import"hdkey";import"../Avalanche/wallets/ledger/LedgerSigner.js";import"../Avalanche/wallets/ledger/SimpleLedgerSigner.js";import"../Avalanche/providers/AbstractProvider.js";import"../Avalanche/providers/constants.js";import"@avalabs/core-chains-sdk";function r(r,i,o={withRoot:!0}){if(r<0)throw new Error("Account index can not be less than 0.");switch(i){case"EVM":if(!o.pathSpec)throw new Error("Path spec is required for EVM: either BIP44 or Ledger Live");return a(r,o.pathSpec,o.withRoot);case"AVM":case"PVM":return t(r,o.withRoot);case"SVM":return e(r,o.withRoot);default:throw new Error(`Unknown derivation path for VM: ${i}`)}}export{r as getAddressDerivationPath};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAppEth as t}from"../EVM/utils/getAppEth.js";import{getAddressDerivationPath as
|
|
1
|
+
import{getAppEth as t}from"../EVM/utils/getAppEth.js";import{getAddressDerivationPath as e}from"./getAddressDerivationPath.js";async function r(r,o,s,i="EVM"){const p=t(r),a="EVM"===i?e(o,i,{pathSpec:s}):e(o,i),f=await p.getAddress(a,!1,!1);return Buffer.from(f.publicKey,"hex")}export{r as getPubKeyFromTransport};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@avalabs/core-wallets-sdk",
|
|
3
|
-
"version": "3.1.0-canary.
|
|
3
|
+
"version": "3.1.0-canary.a1461ba.0+a1461ba",
|
|
4
4
|
"license": "Limited Ecosystem License",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -39,22 +39,24 @@
|
|
|
39
39
|
"ts-jest": "29.1.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@avalabs/avalanchejs": "
|
|
43
|
-
"@avalabs/core-chains-sdk": "3.1.0-
|
|
44
|
-
"@avalabs/core-utils-sdk": "3.1.0-
|
|
45
|
-
"@avalabs/glacier-sdk": "3.1.0-
|
|
46
|
-
"@avalabs/hw-app-avalanche": "
|
|
47
|
-
"@ledgerhq/hw-app-btc": "10.
|
|
48
|
-
"@ledgerhq/hw-app-eth": "6.
|
|
49
|
-
"@ledgerhq/hw-app-solana": "7.
|
|
50
|
-
"@ledgerhq/hw-transport": "6.
|
|
42
|
+
"@avalabs/avalanchejs": "5.1.0-canary.5",
|
|
43
|
+
"@avalabs/core-chains-sdk": "3.1.0-alpha.61",
|
|
44
|
+
"@avalabs/core-utils-sdk": "3.1.0-alpha.61",
|
|
45
|
+
"@avalabs/glacier-sdk": "3.1.0-alpha.61",
|
|
46
|
+
"@avalabs/hw-app-avalanche": "1.1.1",
|
|
47
|
+
"@ledgerhq/hw-app-btc": "10.11.0",
|
|
48
|
+
"@ledgerhq/hw-app-eth": "6.45.18",
|
|
49
|
+
"@ledgerhq/hw-app-solana": "7.5.3",
|
|
50
|
+
"@ledgerhq/hw-transport": "6.31.10",
|
|
51
51
|
"@metamask/eth-sig-util": "7.0.2",
|
|
52
52
|
"@noble/curves": "1.6.0",
|
|
53
53
|
"@noble/hashes": "1.7.1",
|
|
54
54
|
"@scure/base": "1.2.4",
|
|
55
55
|
"@solana-program/system": "0.7.0",
|
|
56
56
|
"@solana-program/token": "0.5.1",
|
|
57
|
+
"@solana-program/token-2022": "0.4.2",
|
|
57
58
|
"@solana/kit": "2.1.0",
|
|
59
|
+
"bip174": "2.1.1",
|
|
58
60
|
"bip32": "2.0.6",
|
|
59
61
|
"bip32-path": "0.4.2",
|
|
60
62
|
"bip39": "3.1.0",
|
|
@@ -69,5 +71,5 @@
|
|
|
69
71
|
"peerDependencies": {
|
|
70
72
|
"ethers": "^6.7.1"
|
|
71
73
|
},
|
|
72
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "a1461ba0d5c7fe3b635a6808c6162c25872df673"
|
|
73
75
|
}
|