Skip to content

chore: upgrade stacks wallet-sdk to 3.4.0 #2303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
diagnostics: false,
tsconfig: '<rootDir>/tests/tsconfig.json',
},
Uint8Array: Uint8Array,
VERSION: version,
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'd.ts'],
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@
"@sentry/react": "6.16.1",
"@sentry/tracing": "6.16.1",
"@stacks/blockchain-api-client": "0.65.0",
"@stacks/common": "3.0.0",
"@stacks/storage": "3.2.0",
"@stacks/storage": "3.3.0",
"@stacks/common": "3.3.0",
"@stacks/connect": "6.4.0",
"@stacks/connect-ui": "5.2.0",
"@stacks/encryption": "3.0.0",
"@stacks/network": "3.0.0",
"@stacks/encryption": "3.3.0",
"@stacks/network": "3.3.0",
"@stacks/rpc-client": "1.0.3",
"@stacks/transactions": "3.0.0",
"@stacks/transactions": "3.3.0",
"@stacks/ui": "7.10.0",
"@stacks/ui-core": "7.3.0",
"@stacks/ui-theme": "7.5.0",
"@stacks/ui-utils": "7.5.0",
"@stacks/wallet-sdk": "3.0.0",
"@stacks/wallet-sdk": "3.4.0",
"@styled-system/theme-get": "5.1.2",
"@tippyjs/react": "4.2.6",
"@vkontakte/vk-qr": "2.0.13",
Expand Down Expand Up @@ -267,7 +267,7 @@
"resolutions": {
"**/**/prismjs": "1.27.0",
"**/**/xmldom": "github:xmldom/xmldom#0.7.0",
"**/**/@stacks/network": "3.0.0",
"**/**/@stacks/network": "3.3.0",
"@redux-devtools/cli/**/tar": "4.4.18",
"bn.js": "5.2.0",
"buffer": "6.0.3",
Expand Down
4 changes: 4 additions & 0 deletions src/app/store/keys/key.actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ import { sendMessage } from '@shared/messages';
import { InternalMethods } from '@shared/message-types';
import { inMemoryKeySlice } from '../in-memory-key/in-memory-key.slice';
import { selectDefaultWalletKey } from '../in-memory-key/in-memory-key.selectors';
import { StacksMainnet } from '@stacks/network';

async function restoredWalletHighestGeneratedAccountIndex(secretKey: string) {
try {
// Don't need, nor return, encrypted wallet value, so a legit password isn't
// needed. Ideally `@stacks/wallet-sdk` should be updated so that the encrypt
// function is a separate method
const wallet = await generateWallet({ secretKey, password: '' });
// use network to select addresses based on owned usernames
const network = new StacksMainnet();
const restoredWallet = await restoreWalletAccounts({
wallet,
gaiaHubUrl: gaiaUrl,
network,
});
return restoredWallet.accounts.length - 1;
} catch (e) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/store/transactions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
publicKeyToString,
AddressVersion,
} from '@stacks/transactions';
import { serializePayload } from '@stacks/transactions/dist/payload';
import { serializePayload } from '@stacks/transactions';

import { stxToMicroStx, validateStacksAddress } from '@app/common/stacks-utils';
import { stacksTransactionToHex, whenChainId } from '@app/common/transactions/transaction-utils';
Expand Down
2 changes: 1 addition & 1 deletion src/app/store/transactions/transaction.hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
unsignedTransactionState,
unsignedStacksTransactionBaseState,
} from './index';
import { serializePayload } from '@stacks/transactions/dist/payload';
import { serializePayload } from '@stacks/transactions';
import { selectedAssetIdState } from '../assets/asset-search';
import { generateUnsignedTransaction } from '@app/common/transactions/generate-unsigned-txs';
import { logger } from '@shared/logger';
Expand Down
4 changes: 3 additions & 1 deletion src/background/message-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { gaiaUrl } from '@shared/constants';
import { logger } from '@shared/logger';
import { InternalMethods } from '@shared/message-types';
import { BackgroundActions } from '@shared/messages';
import { StacksMainnet } from '@stacks/network';
import { generateNewAccount, generateWallet, restoreWalletAccounts } from '@stacks/wallet-sdk';
import memoize from 'promise-memoize';
import { backupWalletSaltForGaia } from './backup-old-wallet-salt';
Expand All @@ -20,7 +21,8 @@ const deriveWalletWithAccounts = memoize(async (secretKey: string, highestAccoun
// method. This does the same as the catch case, with the addition that it will
// also try and fetch usernames associated with an account
try {
return restoreWalletAccounts({ wallet, gaiaHubUrl: gaiaUrl });
const network = new StacksMainnet();
return restoreWalletAccounts({ wallet, gaiaHubUrl: gaiaUrl, network });
} catch (e) {
// To generate a new account, the wallet-sdk requires the entire `Wallet` to
// be supplied so that it can count the `wallet.accounts[]` length, and return
Expand Down
12 changes: 11 additions & 1 deletion webpack/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,17 @@ const HTML_PROD_OPTIONS = IS_DEV
},
};

const aliases = {};
const aliases = {
// alias stacks.js packages to their esm (default prefers /dist/polyfill)
'@stacks/auth': '@stacks/auth/dist/esm',
'@stacks/common': '@stacks/common/dist/esm',
'@stacks/encryption': '@stacks/encryption/dist/esm',
'@stacks/network': '@stacks/network/dist/esm',
'@stacks/profile': '@stacks/profile/dist/esm',
'@stacks/storage': '@stacks/storage/dist/esm',
'@stacks/transactions': '@stacks/transactions/dist/esm',
'@stacks/wallet-sdk': '@stacks/wallet-sdk/dist/esm',
};

const config = {
entry: {
Expand Down
Loading