@avalabs/core-wallets-sdk
Advanced tools
Comparing version
@@ -1,1 +0,1 @@ | ||
import{Network as r}from"@avalabs/glacier-sdk";import"@avalabs/avalanchejs";import"@avalabs/core-utils-sdk";import"ethers";import{DevnetContext as a,FujiContext as o,MainnetContext as i}from"../providers/constants.js";import"@avalabs/core-chains-sdk";const n=(n,s)=>{const t=s===r.FUJI,c=s===r.DEVNET,{cBlockchainID:e,xBlockchainID:l,pBlockchainID:p}=c?a:t?o:i;if(e===n)return"C";if(l===n)return"X";if(p===n)return"P";throw new Error(`Unknown chainId "${n}"`)};export{n as getChainAliasByChainId}; | ||
import{Network as r}from"@avalabs/glacier-sdk";import"@avalabs/avalanchejs";import"@avalabs/core-utils-sdk";import"ethers";import{FujiContext as a,MainnetContext as o}from"../providers/constants.js";import"@avalabs/core-chains-sdk";const i=(i,n)=>{const s=n===r.FUJI,{cBlockchainID:t,xBlockchainID:c,pBlockchainID:e}=s?a:o;if(t===i)return"C";if(c===i)return"X";if(e===i)return"P";throw new Error(`Unknown chainId "${i}"`)};export{i as getChainAliasByChainId}; |
@@ -1,1 +0,1 @@ | ||
import{evmSerial as t,utils as e}from"@avalabs/avalanchejs";import{TxType as n}from"../models.js";import a from"./parsers/index.js";const{getBurnedAmountByTx:r,getOutputAmounts:o,getInputAmounts:s,validateBurnedAmount:i}=e;async function u(e,u,x,{feeTolerance:g=50}={}){try{const n=u.getContext(),c=e.getTx(),p=(t=>{for(const e of Object.values(a)){const n=e(t);if(null!==n)return n}throw new Error("no parser found for tx")})(c),A=r(c,n),d=o(c),l=s(c).get(n.avaxAssetID)??BigInt(0),m=A.get(n.avaxAssetID)??BigInt(0),v=d.get(n.avaxAssetID)??BigInt(0);let I=BigInt(0);t.isImportExportTx(c)?I=await u.getApiC().getBaseFee()/BigInt(1e9):"PVM"===c.vm&&(I=await u.getApiP().getFeeState().then((t=>t.price)).catch((()=>BigInt(0))));const{isValid:f,txFee:B}=i({unsignedTx:e,context:n,burnedAmount:m,baseFee:I,feeTolerance:g});return await p({feeData:{totalAvaxBurned:m,totalAvaxOutput:v,totalAvaxInput:l,isValidAvaxBurnedAmount:f,txFee:B},assetId:n.avaxAssetID,provider:u,currentAddress:x})}catch(t){return{type:n.Unknown}}}export{u as parseAvalancheTx}; | ||
import{evmSerial as t,utils as e}from"@avalabs/avalanchejs";import{TxType as n}from"../models.js";import a from"./parsers/index.js";const{getBurnedAmountByTx:r,getOutputAmounts:o,getInputAmounts:s,validateBurnedAmount:i}=e;async function u(e,u,x,{feeTolerance:g=50}={}){try{const n=u.getContext(),c=e.getTx(),p=(t=>{for(const e of Object.values(a)){const n=e(t);if(null!==n)return n}throw new Error("no parser found for tx")})(c),A=r(c,n),d=o(c),l=s(c).get(n.avaxAssetID)??BigInt(0),m=A.get(n.avaxAssetID)??BigInt(0),v=d.get(n.avaxAssetID)??BigInt(0);let I=BigInt(0);t.isImportExportTx(c)?(I=await u.getApiC().getBaseFee()/BigInt(1e9),0n===I&&(I=1n)):"PVM"===c.vm&&(I=await u.getApiP().getFeeState().then((t=>t.price)).catch((()=>BigInt(0))));const{isValid:f,txFee:B}=i({unsignedTx:e,context:n,burnedAmount:m,baseFee:I,feeTolerance:g});return await p({feeData:{totalAvaxBurned:m,totalAvaxOutput:v,totalAvaxInput:l,isValidAvaxBurnedAmount:f,txFee:B},assetId:n.avaxAssetID,provider:u,currentAddress:x})}catch(t){return{type:n.Unknown}}}export{u as parseAvalancheTx}; |
{ | ||
"name": "@avalabs/core-wallets-sdk", | ||
"version": "3.1.0-alpha.43", | ||
"version": "3.1.0-alpha.44", | ||
"license": "Limited Ecosystem License", | ||
@@ -34,4 +34,4 @@ "private": false, | ||
"@avalabs/avalanchejs": "4.2.0-alpha.1", | ||
"@avalabs/core-chains-sdk": "3.1.0-alpha.43", | ||
"@avalabs/glacier-sdk": "3.1.0-alpha.43", | ||
"@avalabs/core-chains-sdk": "3.1.0-alpha.44", | ||
"@avalabs/glacier-sdk": "3.1.0-alpha.44", | ||
"@avalabs/hw-app-avalanche": "0.14.1", | ||
@@ -62,3 +62,3 @@ "@ledgerhq/hw-app-btc": "10.2.4", | ||
}, | ||
"gitHead": "842ab129df6b6a651c94ed83c042e91196d90579" | ||
"gitHead": "dfe5104408ca5f6fc06fde5811007c5679a85ff6" | ||
} |
Sorry, the diff of this file is too big to display
4942
0.02%378599
-0.01%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed