Skip to content

Commit

Permalink
fixup! Add Filecoin
Browse files Browse the repository at this point in the history
  • Loading branch information
swansontec committed Aug 28, 2023
1 parent f7a6a4c commit 8c3b863
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
11 changes: 3 additions & 8 deletions src/filecoin/FilecoinEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { add, lte, mul, sub } from 'biggystring'
import {
EdgeCurrencyEngine,
EdgeCurrencyEngineOptions,
EdgeCurrencyTools,
EdgeEnginePrivateKeyOptions,
EdgeFreshAddress,
EdgeSpendInfo,
Expand Down Expand Up @@ -266,12 +265,8 @@ export class FilecoinEngine extends CurrencyEngine<
return this.walletInfo.keys.publicKey
}

async loadEngine(
plugin: EdgeCurrencyTools,
walletInfo: SafeFilecoinWalletInfo,
opts: EdgeCurrencyEngineOptions
): Promise<void> {
await super.loadEngine(plugin, walletInfo, opts)
async loadEngine(): Promise<void> {
await super.loadEngine()
this.engineOn = true
}

Expand Down Expand Up @@ -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
}
8 changes: 4 additions & 4 deletions src/filecoin/FilecoinTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -149,7 +149,7 @@ export class FilecoinTools implements EdgeCurrencyTools {

async encodeUri(
obj: EdgeEncodeUri,
customTokens?: EdgeMetaToken[]
customTokens: EdgeMetaToken[] = []
): Promise<string> {
const { pluginId } = this.currencyInfo
const { nativeAmount, currencyCode, publicAddress } = obj
Expand All @@ -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) {
Expand Down

0 comments on commit 8c3b863

Please sign in to comment.