Skip to content

Commit edf8f32

Browse files
authored
Merge pull request #8258 from BitGo/cecho-312
fix(sdk-coin-tempo): register TIP20 tokens
2 parents 276777a + ebff4e2 commit edf8f32

2 files changed

Lines changed: 7 additions & 28 deletions

File tree

modules/sdk-coin-tempo/src/register.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,10 @@ import { Tempo } from './tempo';
33
import { Ttempo } from './ttempo';
44
import { Tip20Token } from './tip20Token';
55

6-
/**
7-
* Register Tempo and TIP20 tokens with the SDK
8-
* @param sdk - BitGo SDK instance
9-
*/
106
export const register = (sdk: BitGoBase): void => {
11-
// Register base Tempo coins
127
sdk.register('tempo', Tempo.createInstance);
138
sdk.register('ttempo', Ttempo.createInstance);
14-
15-
// Register TIP20 tokens (skeleton)
16-
// TODO: Add actual token configurations from @bitgo/statics
17-
// For now, this creates an empty array which can be populated progressively
18-
const tip20Tokens = Tip20Token.createTokenConstructors([
19-
// TODO: Add TIP20 token configurations here
20-
// Example:
21-
// {
22-
// type: 'tempo:usdc',
23-
// coin: 'tempo',
24-
// network: 'Mainnet',
25-
// name: 'USD Coin on Tempo',
26-
// tokenContractAddress: '0x...',
27-
// decimalPlaces: 6,
28-
// },
29-
]);
30-
31-
// Register each TIP20 token with the SDK
32-
tip20Tokens.forEach(({ name, coinConstructor }) => {
9+
Tip20Token.createTokenConstructors().forEach(({ name, coinConstructor }) => {
3310
sdk.register(name, coinConstructor);
3411
});
3512
};

modules/sdk-coin-tempo/src/tip20Token.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @prettier
33
*/
44
import { BitGoBase, CoinConstructor, MPCAlgorithm, NamedCoinConstructor } from '@bitgo/sdk-core';
5-
import { coins, Tip20TokenConfig } from '@bitgo/statics';
5+
import { coins, tokens, Tip20TokenConfig } from '@bitgo/statics';
66
import { GetSendMethodArgsOptions, SendMethodArgs } from '@bitgo/abstract-eth';
77
import { Address } from './lib/types';
88
import { Tempo } from './tempo';
@@ -37,10 +37,12 @@ export class Tip20Token extends Tempo {
3737

3838
/**
3939
* Create token constructors for all TIP20 tokens
40-
* @param tokenConfigs - Array of token configurations (optional)
40+
* @param tokenConfigs - Array of token configurations; defaults to all TIP20 tokens from statics
4141
*/
42-
static createTokenConstructors(tokenConfigs?: Tip20TokenConfig[]): NamedCoinConstructor[] {
43-
const configs = tokenConfigs || [];
42+
static createTokenConstructors(
43+
tokenConfigs: Tip20TokenConfig[] = [...tokens.bitcoin.tempo.tokens, ...tokens.testnet.tempo.tokens]
44+
): NamedCoinConstructor[] {
45+
const configs = tokenConfigs;
4446
const tokensCtors: NamedCoinConstructor[] = [];
4547

4648
for (const token of configs) {

0 commit comments

Comments
 (0)