Skip to content

Commit 406a9d3

Browse files
committed
feat: added opBNB support
Ticket: COIN-6014 TICKET: COIN-6014
1 parent 326b0dc commit 406a9d3

File tree

9 files changed

+749
-1
lines changed

9 files changed

+749
-1
lines changed

modules/bitgo/src/v2/coinFactory.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,10 @@ export function registerCoinConstructors(coinFactory: CoinFactory, coinMap: Coin
259259
coinFactory.register('eth', Eth.createInstance);
260260
coinFactory.register('ethw', Ethw.createInstance);
261261
coinFactory.register('baseeth', EthLikeCoin.createInstance);
262+
coinFactory.register('opbnb', EthLikeCoin.createInstance);
262263
coinFactory.register('og', EthLikeCoin.createInstance);
263264
coinFactory.register('tog', EthLikeCoin.createInstance);
265+
coinFactory.register('topbnb', TethLikeCoin.createInstance);
264266
coinFactory.register('tbaseeth', TethLikeCoin.createInstance);
265267
coinFactory.register('fiataed', FiatAED.createInstance);
266268
coinFactory.register('fiateur', FiatEur.createInstance);
@@ -641,8 +643,12 @@ export function getCoinConstructor(coinName: string): CoinConstructor | undefine
641643
return Ethw.createInstance;
642644
case 'baseeth':
643645
return EthLikeCoin.createInstance;
646+
case 'opbnb':
647+
return EthLikeCoin.createInstance;
644648
case 'tbaseeth':
645649
return TethLikeCoin.createInstance;
650+
case 'topbnb':
651+
return TethLikeCoin.createInstance;
646652
case 'fiataed':
647653
return FiatAED.createInstance;
648654
case 'fiateur':
@@ -993,6 +999,10 @@ export function getTokenConstructor(tokenConfig: TokenConfig): CoinConstructor |
993999
case 'tbaseeth':
9941000
const coinNames = { Mainnet: 'baseeth', Testnet: 'tbaseeth' };
9951001
return EthLikeErc20Token.createTokenConstructor(tokenConfig as EthLikeTokenConfig, coinNames);
1002+
case 'opbnb':
1003+
case 'topbnb':
1004+
const opbnbCoinNames = { Mainnet: 'opbnb', Testnet: 'topbnb' };
1005+
return EthLikeErc20Token.createTokenConstructor(tokenConfig as EthLikeTokenConfig, opbnbCoinNames);
9961006
case 'coredao':
9971007
case 'tcoredao':
9981008
return CoredaoToken.createTokenConstructor(tokenConfig as EthLikeTokenConfig);

modules/sdk-coin-ethlike/test/fixtures/ethlikeCoin.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,45 @@ export const getContractCallResponse = {
5454
id: 1,
5555
};
5656

57+
// opBNB Testnet specific mock data helpers (chainId: 5611)
58+
export function getOpBNBTxListRequest(address: string) {
59+
return {
60+
chainid: '5611',
61+
module: 'account',
62+
action: 'txlist',
63+
address: address,
64+
};
65+
}
66+
67+
export function getOpBNBBalanceRequest(address: string) {
68+
return {
69+
chainid: '5611',
70+
module: 'account',
71+
action: 'balance',
72+
address: address,
73+
};
74+
}
75+
76+
export function getOpBNBTokenBalanceRequest(tokenContractAddress: string, address: string) {
77+
return {
78+
chainid: '5611',
79+
module: 'account',
80+
action: 'tokenbalance',
81+
contractaddress: tokenContractAddress,
82+
address: address,
83+
tag: 'latest',
84+
};
85+
}
86+
87+
export const getOpBNBContractCallRequest = {
88+
chainid: '5611',
89+
module: 'proxy',
90+
action: 'eth_call',
91+
to: '0xdf07117705a9f8dc4c2a78de66b7f1797dba9d4e',
92+
data: 'a0b7967b',
93+
tag: 'latest',
94+
};
95+
5796
export const ccr = {
5897
hteth: {
5998
txHex:
@@ -70,6 +109,11 @@ export const ccr = {
70109
'0x02f9019683014a3402850ba43b740085746a5288008307a1209412fdf58540285273f9ddee9eac6f566418d6e7ac80b9016439125215000000000000000000000000b9f62c71d5f6949cfb211a67fb13ccf079cc760b00000000000000000000000000000000000000000000000000005af3107a400000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000066cc72e2000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000410eddb08026d2d5ba942ed77d4caef5bf3c3d7b4282bd4d2defcbc9c113c5f9af10d803b211fc0ea8b16263a614444abfc5d20dea24db28b833c0e15063400c411c00000000000000000000000000000000000000000000000000000000000000c0808080',
71110
txid: '0x663729bbb68b7638a7a58194e69546d64bb5536422f30557ef0118028317f3a8',
72111
},
112+
topbnb: {
113+
txHex:
114+
'0x02f901d38215eb01843b9aca00843b9aca00830186a0948ce59c2d1702844f8eded451aa103961bc37b4e880b90164391252150000000000000000000000002c2b9c9a4a25e24b174f26114e8926a9f2128fe40000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000006939c792000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041833fbbdb8457ee22924b2ad59becbd1629481ca2bf10b9c66dba45e6fbd8fe1f62fc94c6a3a0a8915abe7df7ce9cf2b3d43b0e46f539d11f00cbe9c5aa2dfbe71c00000000000000000000000000000000000000000000000000000000000000c080a05614c8ae83fee9c0d95334114103aa4fee94f574dd55497f41f532d98ce95100a0102dbe65dcd4034fbf2c2e997758180f15e8c626fb9df4f1695a7fa01dbb376e',
115+
txid: '0x48052a9408a20f317b938dbcd7c30c6019c19571ed07ded11853bae9f16493fd',
116+
},
73117
};
74118
export const encryptedUserKey =
75119
'{"iv":"VFZ3jvXhxo1Z+Yaf2MtZnA==","v":1,"iter":10000,"ks":256,"ts":64,"mode"\n' +

modules/sdk-coin-ethlike/test/resources.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ export const baseChainCommon = EthereumCommon.custom({
99
defaultHardfork: 'london',
1010
});
1111

12+
export const opBNBTestnetCommon = EthereumCommon.custom({
13+
name: 'opBNB testnet',
14+
chainId: new BN(5611),
15+
networkId: new BN(5611),
16+
defaultHardfork: 'london',
17+
});
18+
1219
export function getCommon(coin: string): EthereumCommon {
1320
return EthereumCommon.custom({
1421
name: coins.get(coin).name,

0 commit comments

Comments
 (0)