Skip to content

Commit

Permalink
chore: update SDKs (#79)
Browse files Browse the repository at this point in the history
  • Loading branch information
meeh0w authored Oct 23, 2024
1 parent e9bcf19 commit e273d06
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 149 deletions.
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,25 @@
"sentry": "node sentryscript.js"
},
"dependencies": {
"@avalabs/avalanche-module": "0.10.0",
"@avalabs/avalanchejs": "4.0.5",
"@avalabs/bitcoin-module": "0.10.0",
"@avalabs/avalanche-module": "0.11.2",
"@avalabs/avalanchejs": "4.1.0-alpha.7",
"@avalabs/bitcoin-module": "0.11.2",
"@avalabs/bridge-unified": "2.1.0",
"@avalabs/core-bridge-sdk": "3.1.0-alpha.7",
"@avalabs/core-chains-sdk": "3.1.0-alpha.7",
"@avalabs/core-coingecko-sdk": "3.1.0-alpha.7",
"@avalabs/core-covalent-sdk": "3.1.0-alpha.7",
"@avalabs/core-etherscan-sdk": "3.1.0-alpha.7",
"@avalabs/core-bridge-sdk": "3.1.0-alpha.10",
"@avalabs/core-chains-sdk": "3.1.0-alpha.10",
"@avalabs/core-coingecko-sdk": "3.1.0-alpha.10",
"@avalabs/core-covalent-sdk": "3.1.0-alpha.10",
"@avalabs/core-etherscan-sdk": "3.1.0-alpha.10",
"@avalabs/core-k2-components": "4.18.0-alpha.47",
"@avalabs/core-snowtrace-sdk": "3.1.0-alpha.7",
"@avalabs/core-token-prices-sdk": "3.1.0-alpha.7",
"@avalabs/core-utils-sdk": "3.1.0-alpha.7",
"@avalabs/core-wallets-sdk": "3.1.0-alpha.7",
"@avalabs/evm-module": "0.10.0",
"@avalabs/glacier-sdk": "3.1.0-alpha.7",
"@avalabs/core-snowtrace-sdk": "3.1.0-alpha.10",
"@avalabs/core-token-prices-sdk": "3.1.0-alpha.10",
"@avalabs/core-utils-sdk": "3.1.0-alpha.10",
"@avalabs/core-wallets-sdk": "3.1.0-alpha.10",
"@avalabs/evm-module": "0.11.2",
"@avalabs/glacier-sdk": "3.1.0-alpha.10",
"@avalabs/hw-app-avalanche": "0.14.1",
"@avalabs/types": "3.1.0-alpha.3",
"@avalabs/vm-module-types": "0.10.0",
"@avalabs/types": "3.1.0-alpha.10",
"@avalabs/vm-module-types": "0.11.2",
"@blockaid/client": "0.10.0",
"@coinbase/cbpay-js": "1.6.0",
"@cubist-labs/cubesigner-sdk": "0.3.28",
Expand Down
4 changes: 2 additions & 2 deletions src/background/services/glacier/GlacierService.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Glacier,
PrimaryNetwork,
Network as GlacierNetwork,
PrimaryNetworkChainName,
} from '@avalabs/glacier-sdk';
import { GlacierService } from './GlacierService';
Expand Down Expand Up @@ -32,7 +32,7 @@ const pchainBalance = {
},
chainInfo: {
chainName: PrimaryNetworkChainName.P_CHAIN,
network: PrimaryNetwork.FUJI,
network: GlacierNetwork.FUJI,
},
};

Expand Down
7 changes: 4 additions & 3 deletions src/background/services/history/utils/isTxHistoryItem.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { TxHistoryItem } from '../models';
import { NetworkVMType, TokenType } from '@avalabs/vm-module-types';
import { isPchainTxHistoryItem, isTxHistoryItem } from './isTxHistoryItem';
import {
NetworkVMType,
PChainTransactionType,
TokenType,
XChainTransactionType,
} from '@avalabs/glacier-sdk';
} from '@avalabs/vm-module-types';
import { isPchainTxHistoryItem, isTxHistoryItem } from './isTxHistoryItem';
import { TransactionType } from '@avalabs/vm-module-types';

describe('src/background/services/history/utils/isTxHistoryItem.ts', () => {
Expand Down
16 changes: 8 additions & 8 deletions src/pages/Send/hooks/useSend/useAVMSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ export const useAvmSend: SendAdapterAVM = ({
const amountBigInt = bigToBigInt(Big(amount), token.decimals);
const changeAddress = utils.parse(account.addressAVM)[2];

const unsignedTx = wallet.baseTX(
utxos.utxos,
XCHAIN_ALIAS,
address,
{
const unsignedTx = wallet.baseTX({
utxoSet: utxos.utxos,
chain: XCHAIN_ALIAS,
toAddress: address,
amountsPerAsset: {
[avax]: amountBigInt,
},
{
options: {
changeAddresses: [changeAddress],
}
);
},
});

const manager = utils.getManagerForVM(unsignedTx.getVM());
const [codec] = manager.getCodecFromBuffer(unsignedTx.toBytes());
Expand Down
19 changes: 11 additions & 8 deletions src/pages/Send/hooks/useSend/usePVMSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ export const usePvmSend: SendAdapterPVM = ({
const amountBigInt = bigToBigInt(Big(amount), token.decimals);
const changeAddress = utils.parse(account.addressPVM)[2];

const unsignedTx = wallet.baseTX(
utxos,
PCHAIN_ALIAS,
address,
{
const unsignedTx = wallet.baseTX({
utxoSet: utxos,
chain: PCHAIN_ALIAS,
toAddress: address,
amountsPerAsset: {
[avax]: amountBigInt,
},
{
options: {
changeAddresses: [changeAddress],
}
);
},
});
const manager = utils.getManagerForVM(unsignedTx.getVM());
const [codec] = manager.getCodecFromBuffer(unsignedTx.toBytes());

Expand All @@ -156,6 +156,9 @@ export const usePvmSend: SendAdapterPVM = ({
method: DAppProviderRequest.AVALANCHE_SEND_TRANSACTION,
params,
});
} catch (err) {
console.error(err);
throw err;
} finally {
setIsSending(false);
}
Expand Down
10 changes: 5 additions & 5 deletions src/pages/Send/utils/getMaxUtxos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export async function getMaxUtxoSet(

if (isPchainNetwork(network)) {
try {
filteredUtxos = Avalanche.getMaximumUtxoSet(
filteredUtxos = Avalanche.getMaximumUtxoSet({
wallet,
utxos.getUTXOs(),
Avalanche.SizeSupportedTx.BaseP,
isLedgerWallet ? LEDGER_TX_SIZE_LIMIT_BYTES : undefined
);
utxos: utxos.getUTXOs(),
sizeSupportedTx: Avalanche.SizeSupportedTx.BaseP,
limit: isLedgerWallet ? LEDGER_TX_SIZE_LIMIT_BYTES : undefined,
});
} catch (error) {
console.error('Error calculating maximum utxo set', {
e: error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import {
ArrowRightIcon,
ArrowUpRightIcon,
BlockchainIcon,
BuildIcon,
ChevronDoubleUpIcon,
ClockIcon,
DownloadIcon,
HelpCircleIcon,
MinusCircleIcon,
RefreshIcon,
ShareIcon,
Stack,
ValidatorIcon,
useTheme,
} from '@avalabs/core-k2-components';
import { useMemo } from 'react';
Expand All @@ -26,6 +31,7 @@ export interface PrimaryNetworkMethodIconProp {
| 'CreateAssetTx'
| 'OperationTx';
}

const METHOD_NAME_TO_ICON: Record<
| PChainTransactionType
| XChainTransactionType
Expand Down Expand Up @@ -53,6 +59,11 @@ const METHOD_NAME_TO_ICON: Record<
RemoveSubnetValidatorTx: MinusCircleIcon,
RewardValidatorTx: AirdropIcon,
AdvanceTimeTx: ClockIcon,
[PChainTransactionType.CONVERT_SUBNET_TX]: RefreshIcon,
[PChainTransactionType.REGISTER_SUBNET_VALIDATOR_TX]: ValidatorIcon,
[PChainTransactionType.SET_SUBNET_VALIDATOR_WEIGHT_TX]: BuildIcon,
[PChainTransactionType.DISABLE_SUBNET_VALIDATOR_TX]: DownloadIcon,
[PChainTransactionType.INCREASE_BALANCE_TX]: ChevronDoubleUpIcon,
UNKNOWN: HelpCircleIcon,
};

Expand Down
Loading

0 comments on commit e273d06

Please sign in to comment.