Skip to content
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

Feat/add erc20 support #111

Closed
wants to merge 6 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat(@fireblocks/recovery-utility): ✨ add erc20 support -> fix patche…
…s and readme
TomerHFB committed Dec 19, 2024
commit 5031cc4858ed9a8e1a51e15bef0fa953dd167e55
15 changes: 15 additions & 0 deletions apps/recovery-relay/lib/wallets/index.ts
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ import { Celestia } from './CELESTIA';
import { CoreDAO } from './EVM/CORE_COREDAO';
import { Ton } from './TON';
import { Jetton } from './Jetton';
import { ERC20 } from './ERC20';
export { ConnectedWallet } from './ConnectedWallet';

const fillJettons = () => {
@@ -54,6 +55,19 @@ const fillJettons = () => {
return jettons;
};

const fillERC20s = () => {
const jerc20List = getAllERC20s();
const erc20Tokens = jerc20List.reduce(
(prev, curr) => ({
...prev,
[curr]: ERC20,
}),
{},
) as any;
Object.keys(erc20Tokens).forEach((key) => (erc20Tokens[key] === undefined ? delete erc20Tokens[key] : {}));
return erc20Tokens;
};

export const WalletClasses = {
ALGO: Algorand,
ALGO_TEST: Algorand,
@@ -137,6 +151,7 @@ export const WalletClasses = {
TON: Ton,
TON_TEST: Ton,
...fillJettons(),
...fillERC20s(),
} as const;

type WalletClass = (typeof WalletClasses)[keyof typeof WalletClasses];
2 changes: 1 addition & 1 deletion apps/recovery-utility/renderer/lib/wallets/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { Bitcoin } from './BTC';
import { assets, getAllJettons, getAllERC20s } from '@fireblocks/asset-config';
import { assets, getAllJettons } from '@fireblocks/asset-config';
import { ERC20, ETC } from '@fireblocks/wallet-derivation';
import { Ripple } from './XRP';
import { Cosmos } from './ATOM';
4 changes: 2 additions & 2 deletions packages/asset-config/README.md
Original file line number Diff line number Diff line change
@@ -52,8 +52,8 @@ For your convinience we have provided base methods for common types of chains:

### Add a new Jetton token

To add support for withdrawals of a listed Jetton, make sure the token is listed in `globalAssets.ts` and in `patches.ts`.
The Jetton master contract address must be present in the 'globalAssets' list as the 'address' parameter.
To add support for withdrawals of a listed Jetton, make sure the token is listed in `globalAssets.ts`.
The Jetton master contract address must be present in the `globalAssets` list as the `address` parameter.

### Token or new Base Asset Support

27 changes: 0 additions & 27 deletions packages/asset-config/config/patches.ts
Original file line number Diff line number Diff line change
@@ -362,31 +362,4 @@ export const nativeAssetPatches: NativeAssetPatches = {
memo: true,
getExplorerUrl: getTonExplorerUrl('https://testnet/tonviewer.com'),
},
DOGS_TON: {
derive: true,
transfer: true,
utxo: false,
segwit: false,
minBalance: true,
memo: true,
getExplorerUrl: getTonExplorerUrl('https://tonviewer.com'),
},
USDT_TON: {
derive: true,
transfer: true,
utxo: false,
segwit: false,
minBalance: true,
memo: true,
getExplorerUrl: getTonExplorerUrl('https://tonviewer.com'),
},
NOTCOIN_TON: {
derive: true,
transfer: true,
utxo: false,
segwit: false,
minBalance: true,
memo: true,
getExplorerUrl: getTonExplorerUrl('https://tonviewer.com'),
},
};