Skip to content

Commit 38b172d

Browse files
committed
feat: add WRW support for polygonToken
Ticket: WIN-2682
1 parent 8dcfcc8 commit 38b172d

File tree

6 files changed

+53
-10
lines changed

6 files changed

+53
-10
lines changed

electron/main/index.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { Ltc } from '@bitgo/sdk-coin-ltc';
3434
import { Near, TNear } from '@bitgo/sdk-coin-near';
3535
import { Opeth, Topeth, OpethToken } from '@bitgo/sdk-coin-opeth';
3636
import { Osmo, Tosmo } from '@bitgo/sdk-coin-osmo';
37-
import { Polygon, Tpolygon } from '@bitgo/sdk-coin-polygon';
37+
import { Polygon, Tpolygon, PolygonToken } from '@bitgo/sdk-coin-polygon';
3838
import { Sol, Tsol } from '@bitgo/sdk-coin-sol';
3939
import { Trx, Ttrx } from '@bitgo/sdk-coin-trx';
4040
import { Txlm, Xlm } from '@bitgo/sdk-coin-xlm';
@@ -132,8 +132,8 @@ sdk.register('coreum', Coreum.createInstance);
132132
sdk.register('tcoreum', Tcoreum.createInstance);
133133
sdk.register('hbar', Hbar.createInstance);
134134
sdk.register('thbar', Thbar.createInstance);
135-
sdk.register('algo', Algo.createInstance)
136-
sdk.register('talgo', Talgo.createInstance)
135+
sdk.register('algo', Algo.createInstance);
136+
sdk.register('talgo', Talgo.createInstance);
137137
Erc20Token.createTokenConstructors().forEach(({ name, coinConstructor }) => {
138138
sdk.register(name, coinConstructor);
139139
});
@@ -146,6 +146,9 @@ ArbethToken.createTokenConstructors().forEach(({ name, coinConstructor }) => {
146146
OpethToken.createTokenConstructors().forEach(({ name, coinConstructor }) => {
147147
sdk.register(name, coinConstructor);
148148
});
149+
PolygonToken.createTokenConstructors().forEach(({ name, coinConstructor }) => {
150+
sdk.register(name, coinConstructor);
151+
});
149152

150153
function handleSdkError(e: unknown): string {
151154
if (typeof e === 'string' && e !== null) {
@@ -262,6 +265,8 @@ async function createWindow() {
262265
break;
263266
case 'polygon':
264267
case 'tpolygon':
268+
case 'polygonToken':
269+
case 'tpolygonToken':
265270
sdk = new BitGoAPI({ env: environment, polygonscanApiToken: apiKey });
266271
break;
267272
default:

src/containers/BuildUnsignedSweepCoin/BuildUnsignedSweepCoin.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ function Form() {
821821
case 'tarbethToken':
822822
case 'opethToken':
823823
case 'topethToken':
824+
case 'polygonToken':
825+
case 'tpolygonToken':
824826
return (
825827
<EthLikeTokenForm
826828
key={coin}
@@ -1152,9 +1154,9 @@ function Form() {
11521154
JSON.stringify(
11531155
includePubsInUnsignedSweep
11541156
? {
1155-
...recoverData,
1156-
...(await includePubsFor(coin, values)),
1157-
}
1157+
...recoverData,
1158+
...(await includePubsFor(coin, values)),
1159+
}
11581160
: recoverData,
11591161
null,
11601162
2

src/containers/BuildUnsignedSweepCoin/EthLikeTokenForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ export function EthLikeTokenForm({
4343
backupKey: '',
4444
backupKeyId: '',
4545
gasLimit: allCoinMetas[coinName]?.defaultGasLimitNum ?? 500000,
46-
maxFeePerGas: 20,
47-
maxPriorityFeePerGas: 10,
46+
maxFeePerGas: allCoinMetas[coinName]?.defaultMaxFeePerGas ?? 20,
47+
maxPriorityFeePerGas:
48+
allCoinMetas[coinName]?.defaultMaxPriorityFeePerGas ?? 10,
4849
recoveryDestination: '',
4950
tokenContractAddress: '',
5051
userKey: '',

src/containers/NonBitGoRecoveryCoin/EthLikeTokenForm.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,9 @@ export function EthLikeTokenForm({
5252
recoveryDestination: '',
5353
krsProvider: '',
5454
gasLimit: allCoinMetas[coinName]?.defaultGasLimitNum ?? 500000,
55-
maxFeePerGas: 20,
56-
maxPriorityFeePerGas: 10,
55+
maxFeePerGas: allCoinMetas[coinName]?.defaultMaxFeePerGas ?? 20,
56+
maxPriorityFeePerGas:
57+
allCoinMetas[coinName]?.defaultMaxPriorityFeePerGas ?? 10,
5758
},
5859
validationSchema,
5960
});

src/containers/NonBitGoRecoveryCoin/NonBitGoRecoveryCoin.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,8 @@ function Form() {
953953
case 'tarbethToken':
954954
case 'opethToken':
955955
case 'topethToken':
956+
case 'polygonToken':
957+
case 'tpolygonToken':
956958
return (
957959
<EthLikeTokenForm
958960
key={coin}

src/helpers/config.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export type CoinMetadata = {
1111
minGasLimit?: string;
1212
defaultGasLimit?: string;
1313
defaultGasLimitNum?: number;
14+
defaultMaxFeePerGas?: number;
15+
defaultMaxPriorityFeePerGas?: number;
1416
};
1517

1618
export const allCoinMetas: Record<string, CoinMetadata> = {
@@ -172,6 +174,18 @@ export const allCoinMetas: Record<string, CoinMetadata> = {
172174
Icon: 'polygon',
173175
value: 'polygon',
174176
},
177+
polygonToken: {
178+
Title: 'POLYGON TOKEN',
179+
Description: 'Polygon Token',
180+
Icon: 'polygon',
181+
value: 'polygonToken',
182+
ApiKeyProvider: 'polygonscan.com',
183+
minGasLimit: '30,000',
184+
defaultGasLimit: '500,000',
185+
defaultGasLimitNum: 500000,
186+
defaultMaxPriorityFeePerGas: 30,
187+
defaultMaxFeePerGas: 50,
188+
},
175189
bcha: {
176190
Title: 'BCHA',
177191
Description: 'Bitcoin ABC',
@@ -390,6 +404,18 @@ export const allCoinMetas: Record<string, CoinMetadata> = {
390404
Icon: 'polygon',
391405
value: 'tpolygon',
392406
},
407+
tpolygonToken: {
408+
Title: 'TPOLYGON TOKEN',
409+
Description: 'Testnet Polygon Token',
410+
Icon: 'polygon',
411+
value: 'tpolygonToken',
412+
ApiKeyProvider: 'polygonscan.com',
413+
minGasLimit: '30,000',
414+
defaultGasLimit: '500,000',
415+
defaultGasLimitNum: 500000,
416+
defaultMaxPriorityFeePerGas: 30,
417+
defaultMaxFeePerGas: 50,
418+
},
393419
tdoge: {
394420
Title: 'TDOGE',
395421
Description: 'Dogecoin Testnet',
@@ -513,6 +539,7 @@ export const buildUnsignedSweepCoins: Record<
513539
allCoinMetas.opeth,
514540
allCoinMetas.opethToken,
515541
allCoinMetas.polygon,
542+
allCoinMetas.polygonToken,
516543
allCoinMetas.bcha,
517544
allCoinMetas.doge,
518545
allCoinMetas.sol,
@@ -536,6 +563,7 @@ export const buildUnsignedSweepCoins: Record<
536563
allCoinMetas.topeth,
537564
allCoinMetas.topethToken,
538565
allCoinMetas.tpolygon,
566+
allCoinMetas.tpolygonToken,
539567
allCoinMetas.tdoge,
540568
allCoinMetas.tsol,
541569
allCoinMetas.tada,
@@ -571,6 +599,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
571599
allCoinMetas.dot,
572600
allCoinMetas.sol,
573601
allCoinMetas.polygon,
602+
allCoinMetas.polygonToken,
574603
allCoinMetas.bcha,
575604
allCoinMetas.doge,
576605
allCoinMetas.ada,
@@ -604,6 +633,7 @@ export const nonBitgoRecoveryCoins: Record<BitgoEnv, readonly CoinMetadata[]> =
604633
allCoinMetas.tdot,
605634
allCoinMetas.tsol,
606635
allCoinMetas.tpolygon,
636+
allCoinMetas.tpolygonToken,
607637
allCoinMetas.tdoge,
608638
allCoinMetas.tada,
609639
allCoinMetas.tatom,
@@ -692,4 +722,6 @@ export const tokenParentCoins = {
692722
tarbethToken: 'tarbeth',
693723
opethToken: 'opeth',
694724
topethToken: 'topeth',
725+
polygonToken: 'polygon',
726+
tpolygonToken: 'tpolygon',
695727
};

0 commit comments

Comments
 (0)