Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
25 changes: 1 addition & 24 deletions modules/sdk-coin-tempo/src/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,10 @@ import { Tempo } from './tempo';
import { Ttempo } from './ttempo';
import { Tip20Token } from './tip20Token';

/**
* Register Tempo and TIP20 tokens with the SDK
* @param sdk - BitGo SDK instance
*/
export const register = (sdk: BitGoBase): void => {
// Register base Tempo coins
sdk.register('tempo', Tempo.createInstance);
sdk.register('ttempo', Ttempo.createInstance);

// Register TIP20 tokens (skeleton)
// TODO: Add actual token configurations from @bitgo/statics
// For now, this creates an empty array which can be populated progressively
const tip20Tokens = Tip20Token.createTokenConstructors([
// TODO: Add TIP20 token configurations here
// Example:
// {
// type: 'tempo:usdc',
// coin: 'tempo',
// network: 'Mainnet',
// name: 'USD Coin on Tempo',
// tokenContractAddress: '0x...',
// decimalPlaces: 6,
// },
]);

// Register each TIP20 token with the SDK
tip20Tokens.forEach(({ name, coinConstructor }) => {
Tip20Token.createTokenConstructors().forEach(({ name, coinConstructor }) => {
sdk.register(name, coinConstructor);
});
};
10 changes: 6 additions & 4 deletions modules/sdk-coin-tempo/src/tip20Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @prettier
*/
import { BitGoBase, CoinConstructor, MPCAlgorithm, NamedCoinConstructor } from '@bitgo/sdk-core';
import { coins, Tip20TokenConfig } from '@bitgo/statics';
import { coins, tokens, Tip20TokenConfig } from '@bitgo/statics';
import { GetSendMethodArgsOptions, SendMethodArgs } from '@bitgo/abstract-eth';
import { Address } from './lib/types';
import { Tempo } from './tempo';
Expand Down Expand Up @@ -37,10 +37,12 @@ export class Tip20Token extends Tempo {

/**
* Create token constructors for all TIP20 tokens
* @param tokenConfigs - Array of token configurations (optional)
* @param tokenConfigs - Array of token configurations; defaults to all TIP20 tokens from statics
*/
static createTokenConstructors(tokenConfigs?: Tip20TokenConfig[]): NamedCoinConstructor[] {
const configs = tokenConfigs || [];
static createTokenConstructors(
tokenConfigs: Tip20TokenConfig[] = [...tokens.bitcoin.tempo.tokens, ...tokens.testnet.tempo.tokens]
): NamedCoinConstructor[] {
const configs = tokenConfigs;
const tokensCtors: NamedCoinConstructor[] = [];

for (const token of configs) {
Expand Down