Skip to content

Commit fb8274f

Browse files
authored
Merge pull request #9181 from BitGo/wci-644/3-sol-recover-remaining
fix(sdk-coin-sol): migrate remaining recovery methods to BIP32-Ed25519
2 parents 8adf8d8 + a91e197 commit fb8274f

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

modules/sdk-coin-sol/src/sol.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ import {
6161
UnexpectedAddressError,
6262
EDDSAUtils,
6363
} from '@bitgo/sdk-core';
64-
import { auditEddsaPrivateKey, deriveUnhardenedMps, getDerivationPath } from '@bitgo/sdk-lib-mpc';
64+
import { auditEddsaPrivateKey, getDerivationPath } from '@bitgo/sdk-lib-mpc';
6565
import { BaseNetwork, CoinFamily, coins, SolCoin, BaseCoin as StaticsBaseCoin } from '@bitgo/statics';
6666
import {
6767
KeyPair as SolKeyPair,
@@ -1705,9 +1705,9 @@ export class Sol extends BaseCoin {
17051705

17061706
const index = params.index || 0;
17071707
const currPath = params.seed ? getDerivationPath(params.seed) + `/${index}` : `m/${index}`;
1708-
const accountId = isMpcV2
1709-
? deriveUnhardenedMps(bitgoKey, currPath).slice(0, 64)
1710-
: (await EDDSAMethods.getInitializedMpcInstance()).deriveUnhardened(bitgoKey, currPath).slice(0, 64);
1708+
const accountId = (await EDDSAMethods.getInitializedMpcInstance())
1709+
.deriveUnhardened(bitgoKey, currPath)
1710+
.slice(0, 64);
17111711
const bs58EncodedPublicKey = new SolKeyPair({ pub: accountId }).getAddress();
17121712

17131713
const blockhash = await this.getBlockhash(params.apiKey);
@@ -1826,9 +1826,9 @@ export class Sol extends BaseCoin {
18261826
const baseAddressPath = params.seed
18271827
? getDerivationPath(params.seed) + `/${baseAddressIndex}`
18281828
: `m/${baseAddressIndex}`;
1829-
const baseAccountId = isMpcV2
1830-
? deriveUnhardenedMps(bitgoKey, baseAddressPath).slice(0, 64)
1831-
: (await EDDSAMethods.getInitializedMpcInstance()).deriveUnhardened(bitgoKey, baseAddressPath).slice(0, 64);
1829+
const baseAccountId = (await EDDSAMethods.getInitializedMpcInstance())
1830+
.deriveUnhardened(bitgoKey, baseAddressPath)
1831+
.slice(0, 64);
18321832
const baseAddress = new SolKeyPair({ pub: baseAccountId }).getAddress();
18331833

18341834
let durableNoncePubKeysIndex = 0;

modules/sdk-coin-sol/test/unit/sol.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import {
2323
Wallet,
2424
WalletCoinSpecific,
2525
} from '@bitgo/sdk-core';
26-
import { deriveUnhardenedMps, MPSUtil } from '@bitgo/sdk-lib-mpc';
26+
import { MPSUtil } from '@bitgo/sdk-lib-mpc';
2727
import { TestBitGo, TestBitGoAPI } from '@bitgo/sdk-test';
2828
import { coins } from '@bitgo/statics';
2929
import {
@@ -3971,7 +3971,7 @@ describe('SOL:', function () {
39713971
mpcV2TokenCommonKeyChain = tokenUserDkg.getCommonKeychain();
39723972

39733973
mpcV2TokenBaseAddress = new KeyPair({
3974-
pub: deriveUnhardenedMps(mpcV2TokenCommonKeyChain, 'm/0').slice(0, 64),
3974+
pub: mpc.deriveUnhardened(mpcV2TokenCommonKeyChain, 'm/0').slice(0, 64),
39753975
}).getAddress();
39763976
mpcV2TokenAddress1 = new KeyPair({
39773977
pub: mpc.deriveUnhardened(mpcV2TokenCommonKeyChain, 'm/1').slice(0, 64),

0 commit comments

Comments
 (0)