diff --git a/modules/abstract-substrate/src/lib/utils.ts b/modules/abstract-substrate/src/lib/utils.ts index 4828743293..4c4e451068 100644 --- a/modules/abstract-substrate/src/lib/utils.ts +++ b/modules/abstract-substrate/src/lib/utils.ts @@ -1,11 +1,10 @@ import { DotAssetTypes, BaseUtils, DotAddressFormat, isBase58, isValidEd25519PublicKey, Seed } from '@bitgo/sdk-core'; -import { decodeAddress, encodeAddress, Keyring } from '@polkadot/keyring'; -import { decodePair } from '@polkadot/keyring/pair/decode'; +import { decodeAddress, encodeAddress } from '@polkadot/keyring'; import { KeyringPair } from '@polkadot/keyring/types'; import { createTypeUnsafe, GenericCall, GenericExtrinsic, GenericExtrinsicPayload } from '@polkadot/types'; import { EXTRINSIC_VERSION } from '@polkadot/types/extrinsic/v4/Extrinsic'; import { hexToU8a, isHex, u8aToHex, u8aToU8a } from '@polkadot/util'; -import { base64Decode, signatureVerify } from '@polkadot/util-crypto'; +import { signatureVerify } from '@polkadot/util-crypto'; import { Args, BaseTxInfo, defineMethod, OptionsWithMeta, UnsignedTransaction } from '@substrate/txwrapper-core'; import { DecodedSignedTx, DecodedSigningPayload, TypeRegistry } from '@substrate/txwrapper-core/lib/types'; import { construct } from '@substrate/txwrapper-polkadot'; @@ -29,7 +28,6 @@ import { TxMethod, UnstakeBatchCallArgs, } from './iface'; -import { KeyPair } from '.'; const PROXY_METHOD_ARG = 2; // map to retrieve the address encoding format when the key is the asset name @@ -160,19 +158,6 @@ export class Utils implements BaseUtils { return decodedArgs.args; } - /** - * keyPairFromSeed generates an object with secretKey and publicKey using the substrate sdk - * @param seed 32 bytes long seed - * @returns KeyPair - */ - keyPairFromSeed(seed: Uint8Array): KeyPair { - const keyring = new Keyring({ type: 'ed25519' }); - const keyringPair = keyring.addFromSeed(seed); - const pairJson = keyringPair.toJson(); - const decodedKeyPair = decodePair('', base64Decode(pairJson.encoded), pairJson.encoding.type); - return new KeyPair({ prv: Buffer.from(decodedKeyPair.secretKey).toString('hex') }); - } - /** * Signing function. Implement this on the OFFLINE signing device. * @@ -216,18 +201,6 @@ export class Utils implements BaseUtils { }); } - /** - * Decodes the substrate address from the given format - * - * @param {string} address - * @param {number} [ss58Format] - * @returns {string} - */ - decodeSubstrateAddress(address: string, ss58Format: number): string { - const keypair = new KeyPair({ pub: Buffer.from(decodeAddress(address, undefined, ss58Format)).toString('hex') }); - return keypair.getAddress(ss58Format); - } - /** * Decodes the substrate address from the given format * @@ -424,17 +397,6 @@ export class Utils implements BaseUtils { return signature; } - /** - * Decodes the dot address from the given format - * - * @param {string} address - * @param {number} [ss58Format] - * @returns {KeyPair} - */ - decodeSubstrateAddressToKeyPair(address: string, ss58Format?: number): KeyPair { - return new KeyPair({ pub: Buffer.from(decodeAddress(address, undefined, ss58Format)).toString('hex') }); - } - /** * Checks whether the given input is a hex string with with 0 value * used to check whether a given transaction is immortal or mortal diff --git a/modules/sdk-coin-tao/src/tao.ts b/modules/sdk-coin-tao/src/tao.ts index 55b0d6d9c8..5778dc22d6 100644 --- a/modules/sdk-coin-tao/src/tao.ts +++ b/modules/sdk-coin-tao/src/tao.ts @@ -9,7 +9,7 @@ import { VerifyTransactionOptions, } from '@bitgo/sdk-core'; import { BaseCoin as StaticsBaseCoin } from '@bitgo/statics'; -import { SubstrateCoin, Utils } from '@bitgo/abstract-substrate'; +import { Interface, SubstrateCoin, Utils } from '@bitgo/abstract-substrate'; import { TaoKeyPair } from './lib'; const utils = Utils.default;