Skip to content

Commit 114ccb9

Browse files
committed
feat(sdk-coin-tempo): integrate Tempo SDK and update references
Ticket: WIN-8719
1 parent 9b284f3 commit 114ccb9

11 files changed

Lines changed: 49 additions & 46 deletions

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ COPY --from=builder /tmp/bitgo/modules/sdk-coin-stt /var/modules/sdk-coin-stt/
109109
COPY --from=builder /tmp/bitgo/modules/sdk-coin-stx /var/modules/sdk-coin-stx/
110110
COPY --from=builder /tmp/bitgo/modules/sdk-coin-sui /var/modules/sdk-coin-sui/
111111
COPY --from=builder /tmp/bitgo/modules/sdk-coin-tao /var/modules/sdk-coin-tao/
112+
COPY --from=builder /tmp/bitgo/modules/sdk-coin-tempo /var/modules/sdk-coin-tempo/
112113
COPY --from=builder /tmp/bitgo/modules/sdk-coin-tia /var/modules/sdk-coin-tia/
113114
COPY --from=builder /tmp/bitgo/modules/sdk-coin-ton /var/modules/sdk-coin-ton/
114115
COPY --from=builder /tmp/bitgo/modules/sdk-coin-trx /var/modules/sdk-coin-trx/
@@ -207,6 +208,7 @@ cd /var/modules/sdk-coin-stt && yarn link && \
207208
cd /var/modules/sdk-coin-stx && yarn link && \
208209
cd /var/modules/sdk-coin-sui && yarn link && \
209210
cd /var/modules/sdk-coin-tao && yarn link && \
211+
cd /var/modules/sdk-coin-tempo && yarn link && \
210212
cd /var/modules/sdk-coin-tia && yarn link && \
211213
cd /var/modules/sdk-coin-ton && yarn link && \
212214
cd /var/modules/sdk-coin-trx && yarn link && \
@@ -308,6 +310,7 @@ RUN cd /var/bitgo-express && \
308310
yarn link @bitgo/sdk-coin-stx && \
309311
yarn link @bitgo/sdk-coin-sui && \
310312
yarn link @bitgo/sdk-coin-tao && \
313+
yarn link @bitgo/sdk-coin-tempo && \
311314
yarn link @bitgo/sdk-coin-tia && \
312315
yarn link @bitgo/sdk-coin-ton && \
313316
yarn link @bitgo/sdk-coin-trx && \

modules/account-lib/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"@bitgo/sdk-coin-stx": "^3.10.24",
7777
"@bitgo/sdk-coin-sui": "^5.19.24",
7878
"@bitgo/sdk-coin-tao": "^1.13.4",
79+
"@bitgo/sdk-coin-tempo": "^1.3.2",
7980
"@bitgo/sdk-coin-tia": "^3.5.24",
8081
"@bitgo/sdk-coin-ton": "^3.13.3",
8182
"@bitgo/sdk-coin-trx": "^3.8.4",

modules/account-lib/src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ export { Apechain };
170170
import * as Tao from '@bitgo/sdk-coin-tao';
171171
export { Tao };
172172

173+
import * as Tempo from '@bitgo/sdk-coin-tempo';
174+
export { Tempo };
175+
173176
import * as Icp from '@bitgo/sdk-coin-icp';
174177
export { Icp };
175178

@@ -292,6 +295,8 @@ const coinBuilderMap = {
292295
tapt: Apt.TransactionBuilder,
293296
tao: Tao.TransactionBuilderFactory,
294297
ttao: Tao.TransactionBuilderFactory,
298+
tempo: Tempo.Tip20TransactionBuilder,
299+
ttempo: Tempo.Tip20TransactionBuilder,
295300
icp: Icp.TransactionBuilder,
296301
ticp: Icp.TransactionBuilder,
297302
baby: Baby.TransactionBuilder,

modules/account-lib/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@
121121
{
122122
"path": "../sdk-coin-tia"
123123
},
124+
{
125+
"path": "../sdk-coin-tempo"
126+
},
124127
{
125128
"path": "../sdk-coin-trx"
126129
},

modules/bitgo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@
110110
"@bitgo/sdk-coin-stx": "^3.10.24",
111111
"@bitgo/sdk-coin-sui": "^5.19.24",
112112
"@bitgo/sdk-coin-tao": "^1.13.4",
113+
"@bitgo/sdk-coin-tempo": "^1.3.2",
113114
"@bitgo/sdk-coin-tia": "^3.5.24",
114115
"@bitgo/sdk-coin-ton": "^3.13.3",
115116
"@bitgo/sdk-coin-trx": "^3.8.4",

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import {
3737
CosmosTokenConfig,
3838
VetTokenConfig,
3939
TaoTokenConfig,
40+
Tip20TokenConfig,
4041
PolyxTokenConfig,
4142
JettonTokenConfig,
4243
} from '@bitgo/statics';
@@ -133,6 +134,8 @@ import {
133134
Susd,
134135
Tao,
135136
TaoToken,
137+
Tempo,
138+
Tip20Token,
136139
Ton,
137140
Tada,
138141
Talgo,
@@ -200,6 +203,7 @@ import {
200203
Twemix,
201204
Tworld,
202205
Ttao,
206+
Ttempo,
203207
Ttia,
204208
Tton,
205209
Ttrx,
@@ -304,6 +308,7 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
304308
coinFactory.register('sui', Sui.createInstance);
305309
coinFactory.register('susd', Susd.createInstance);
306310
coinFactory.register('tao', Tao.createInstance);
311+
coinFactory.register('tempo', Tempo.createInstance);
307312
coinFactory.register('tia', Tia.createInstance);
308313
coinFactory.register('ton', Ton.createInstance);
309314
coinFactory.register('talgo', Talgo.createInstance);
@@ -373,6 +378,7 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
373378
coinFactory.register('tsui', Tsui.createInstance);
374379
coinFactory.register('tsusd', Tsusd.createInstance);
375380
coinFactory.register('ttao', Ttao.createInstance);
381+
coinFactory.register('ttempo', Ttempo.createInstance);
376382
coinFactory.register('ttia', Ttia.createInstance);
377383
coinFactory.register('tton', Tton.createInstance);
378384
coinFactory.register('ttrx', Ttrx.createInstance);
@@ -522,6 +528,10 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
522528
({ name, coinConstructor }) => coinFactory.register(name, coinConstructor)
523529
);
524530

531+
Tip20Token.createTokenConstructors([...tokens.bitcoin.tempo.tokens, ...tokens.testnet.tempo.tokens]).forEach(
532+
({ name, coinConstructor }) => coinFactory.register(name, coinConstructor)
533+
);
534+
525535
PolyxToken.createTokenConstructors([...tokens.bitcoin.polyx.tokens, ...tokens.testnet.polyx.tokens]).forEach(
526536
({ name, coinConstructor }) => coinFactory.register(name, coinConstructor)
527537
);
@@ -751,6 +761,8 @@ export function getCoinConstructor(coinName: string): CoinConstructor | undefine
751761
return Susd.createInstance;
752762
case 'tao':
753763
return Tao.createInstance;
764+
case 'tempo':
765+
return Tempo.createInstance;
754766
case 'tia':
755767
return Tia.createInstance;
756768
case 'ton':
@@ -889,6 +901,8 @@ export function getCoinConstructor(coinName: string): CoinConstructor | undefine
889901
return Tsusd.createInstance;
890902
case 'ttao':
891903
return Ttao.createInstance;
904+
case 'ttempo':
905+
return Ttempo.createInstance;
892906
case 'ttia':
893907
return Ttia.createInstance;
894908
case 'tton':
@@ -1043,6 +1057,9 @@ export function getTokenConstructor(tokenConfig: TokenConfig): CoinConstructor |
10431057
case 'tao':
10441058
case 'ttao':
10451059
return TaoToken.createTokenConstructor(tokenConfig as TaoTokenConfig);
1060+
case 'tempo':
1061+
case 'ttempo':
1062+
return Tip20Token.createTokenConstructor(tokenConfig as Tip20TokenConfig);
10461063
case 'polyx':
10471064
case 'tpolyx':
10481065
return PolyxToken.createTokenConstructor(tokenConfig as PolyxTokenConfig);

modules/bitgo/src/v2/coins/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import { Sol, Tsol } from '@bitgo/sdk-coin-sol';
6161
import { Stx, Tstx, Sip10Token } from '@bitgo/sdk-coin-stx';
6262
import { Sui, Tsui, SuiToken } from '@bitgo/sdk-coin-sui';
6363
import { Tao, Ttao, TaoToken } from '@bitgo/sdk-coin-tao';
64+
import { Tempo, Ttempo, Tip20Token } from '@bitgo/sdk-coin-tempo';
6465
import { Tia, Ttia } from '@bitgo/sdk-coin-tia';
6566
import { Ton, Tton, JettonToken } from '@bitgo/sdk-coin-ton';
6667
import { Trx, Ttrx } from '@bitgo/sdk-coin-trx';
@@ -134,6 +135,7 @@ export { Tstt };
134135
export { Stx, Tstx, Sip10Token };
135136
export { Sui, Tsui, SuiToken };
136137
export { Tao, Ttao, TaoToken };
138+
export { Tempo, Ttempo, Tip20Token };
137139
export { Tia, Ttia };
138140
export { Ton, Tton, JettonToken };
139141
export { Bld, Tbld };

modules/bitgo/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,9 @@
236236
{
237237
"path": "../sdk-coin-tao"
238238
},
239+
{
240+
"path": "../sdk-coin-tempo"
241+
},
239242
{
240243
"path": "../sdk-coin-tia"
241244
},

modules/sdk-coin-tempo/src/lib/keyPair.ts

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,7 @@
22
* Tempo KeyPair - Reuses Ethereum KeyPair Implementation
33
*
44
* Since Tempo is EVM-compatible and uses the same cryptography (ECDSA/secp256k1)
5-
* as Ethereum, we can directly reuse the Ethereum KeyPair implementation.
5+
* as Ethereum, we directly reuse the Ethereum KeyPair implementation from abstract-eth.
66
*/
77

8-
import { bip32 } from '@bitgo/secp256k1';
9-
import { DefaultKeys, KeyPairOptions } from '@bitgo/sdk-core';
10-
11-
/**
12-
* Tempo KeyPair class
13-
* Uses same key derivation as Ethereum (BIP32 + secp256k1)
14-
*/
15-
export class KeyPair {
16-
private keyPair: DefaultKeys;
17-
18-
constructor(source?: KeyPairOptions) {
19-
// TODO: Implement proper key generation when needed
20-
const seed = Buffer.alloc(64);
21-
const hdNode = bip32.fromSeed(seed);
22-
23-
this.keyPair = {
24-
prv: hdNode.toBase58(),
25-
pub: hdNode.neutered().toBase58(),
26-
};
27-
}
28-
29-
getKeys(): DefaultKeys {
30-
return this.keyPair;
31-
}
32-
33-
getAddress(): string {
34-
// TODO: Implement Ethereum-style address derivation
35-
return '0x0000000000000000000000000000000000000000';
36-
}
37-
}
8+
export { KeyPair } from '@bitgo/abstract-eth';

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,13 @@
22
* @prettier
33
*/
44
import { BitGoBase, CoinConstructor, MPCAlgorithm, NamedCoinConstructor } from '@bitgo/sdk-core';
5-
import { coins } from '@bitgo/statics';
5+
import { coins, Tip20TokenConfig } from '@bitgo/statics';
66
import { GetSendMethodArgsOptions, SendMethodArgs } from '@bitgo/abstract-eth';
77
import { Address } from './lib/types';
88
import { Tempo } from './tempo';
99
import { encodeTip20TransferWithMemo, amountToTip20Units, isValidAddress, isValidTip20Amount } from './lib/utils';
1010

11-
/**
12-
* TIP20 Token Configuration Interface
13-
*/
14-
export interface Tip20TokenConfig {
15-
type: string; // Token identifier (e.g., 'tempo:usdc')
16-
coin: string; // Base coin (e.g., 'tempo' or 'ttempo')
17-
network: 'Mainnet' | 'Testnet';
18-
name: string; // Token full name
19-
tokenContractAddress: string; // Smart contract address (0x...)
20-
decimalPlaces: number; // Token decimal places
21-
}
11+
export { Tip20TokenConfig };
2212

2313
/**
2414
* TIP20 Token Implementation (Skeleton)
@@ -31,8 +21,7 @@ export class Tip20Token extends Tempo {
3121
public readonly tokenConfig: Tip20TokenConfig;
3222

3323
constructor(bitgo: BitGoBase, tokenConfig: Tip20TokenConfig) {
34-
const coinName = tokenConfig.network === 'Mainnet' ? 'tempo' : 'ttempo';
35-
const staticsCoin = coins.get(coinName);
24+
const staticsCoin = tokenConfig.network === 'Mainnet' ? coins.get('tempo') : coins.get('ttempo');
3625
super(bitgo, staticsCoin);
3726
this.tokenConfig = tokenConfig;
3827
}
@@ -79,7 +68,7 @@ export class Tip20Token extends Tempo {
7968
}
8069

8170
/** Get the network */
82-
get network(): 'Mainnet' | 'Testnet' {
71+
get network(): string {
8372
return this.tokenConfig.network;
8473
}
8574

@@ -98,6 +87,11 @@ export class Tip20Token extends Tempo {
9887
return this.tokenConfig.type;
9988
}
10089

90+
/** @inheritDoc */
91+
getBaseChain(): string {
92+
return this.coin;
93+
}
94+
10195
/** @inheritDoc */
10296
getFullName(): string {
10397
return 'TIP20 Token';

0 commit comments

Comments
 (0)