From 8c3b863965720aa726066037f29b54fda151bc27 Mon Sep 17 00:00:00 2001 From: William Swanson Date: Mon, 28 Aug 2023 14:42:06 -0700 Subject: [PATCH] fixup! Add Filecoin --- src/filecoin/FilecoinEngine.ts | 11 +++-------- src/filecoin/FilecoinTools.ts | 8 ++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/filecoin/FilecoinEngine.ts b/src/filecoin/FilecoinEngine.ts index abe832d75..976f93799 100644 --- a/src/filecoin/FilecoinEngine.ts +++ b/src/filecoin/FilecoinEngine.ts @@ -11,7 +11,6 @@ import { add, lte, mul, sub } from 'biggystring' import { EdgeCurrencyEngine, EdgeCurrencyEngineOptions, - EdgeCurrencyTools, EdgeEnginePrivateKeyOptions, EdgeFreshAddress, EdgeSpendInfo, @@ -266,12 +265,8 @@ export class FilecoinEngine extends CurrencyEngine< return this.walletInfo.keys.publicKey } - async loadEngine( - plugin: EdgeCurrencyTools, - walletInfo: SafeFilecoinWalletInfo, - opts: EdgeCurrencyEngineOptions - ): Promise { - await super.loadEngine(plugin, walletInfo, opts) + async loadEngine(): Promise { + await super.loadEngine() this.engineOn = true } @@ -382,7 +377,7 @@ export async function makeCurrencyEngine( const engine = new FilecoinEngine(env, tools, safeWalletInfo, opts) // Do any async initialization necessary for the engine - await engine.loadEngine(tools, safeWalletInfo, opts) + await engine.loadEngine() return engine } diff --git a/src/filecoin/FilecoinTools.ts b/src/filecoin/FilecoinTools.ts index 88acadbef..6ed27ef0b 100644 --- a/src/filecoin/FilecoinTools.ts +++ b/src/filecoin/FilecoinTools.ts @@ -18,7 +18,7 @@ import { base16 } from 'rfc4648' import { PluginEnvironment } from '../common/innerPlugin' import { encodeUriCommon, parseUriCommon } from '../common/uriHelpers' -import { getDenomInfo } from '../common/utils' +import { getLegacyDenomination } from '../common/utils' import { asFilecoinPrivateKeys, asFilPublicKey, @@ -149,7 +149,7 @@ export class FilecoinTools implements EdgeCurrencyTools { async encodeUri( obj: EdgeEncodeUri, - customTokens?: EdgeMetaToken[] + customTokens: EdgeMetaToken[] = [] ): Promise { const { pluginId } = this.currencyInfo const { nativeAmount, currencyCode, publicAddress } = obj @@ -160,9 +160,9 @@ export class FilecoinTools implements EdgeCurrencyTools { let amount if (nativeAmount != null) { - const denom = getDenomInfo( - this.currencyInfo, + const denom = getLegacyDenomination( currencyCode ?? this.currencyInfo.currencyCode, + this.currencyInfo, customTokens ) if (denom == null) {