Skip to content

Commit

Permalink
Merge pull request #5539 from BitGo/WIN-4530-alter-contractName-for-eos
Browse files Browse the repository at this point in the history
chore(sdk-coin-eos): use contractAddress to form contractName
  • Loading branch information
rakeshgsharma authored Feb 13, 2025
2 parents 57b71e0 + 6d3f2db commit 6dd1946
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions modules/sdk-coin-eos/src/eosToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ export class EosToken extends Eos {
return this.tokenConfig.decimalPlaces;
}

get contractName() {
return this.tokenConfig.contractName;
}

get contractAddress() {
return this.tokenConfig.contractAddress;
}

getChain() {
return this.tokenConfig.type;
}
Expand Down
4 changes: 4 additions & 0 deletions modules/sdk-coin-eos/test/unit/eosToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ describe('EOS Token:', function () {
eosTokenCoin.coin.should.equal('teos');
eosTokenCoin.decimalPlaces.should.equal(8);
eosTokenCoin.tokenContractAddress.should.equal('testtoken113');
eosTokenCoin.contractName.should.equal('testtoken113');
eosTokenCoin.contractAddress.should.equal('testtoken113');
eosTokenCoin.tokenContractAddress.should.equal(eosTokenCoin.contractName);
eosTokenCoin.tokenContractAddress.should.equal(eosTokenCoin.contractAddress);
});

describe('verify transaction', function () {
Expand Down
2 changes: 1 addition & 1 deletion modules/statics/src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ export class EosCoin extends AccountCoinToken {
...options,
});

this.contractName = options.contractName;
this.contractName = options.contractAddress;
this.contractAddress = options.contractAddress;
}
}
Expand Down
7 changes: 6 additions & 1 deletion modules/statics/src/tokenConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export interface BaseContractAddressConfig extends BaseNetworkConfig {
export type AvaxcTokenConfig = BaseContractAddressConfig;
export type CeloTokenConfig = BaseContractAddressConfig;
export type EthLikeTokenConfig = BaseContractAddressConfig;
export type EosTokenConfig = BaseContractAddressConfig;
export type EosTokenConfig = BaseContractAddressConfig & {
contractName: string;
contractAddress: string;
};
export type Erc20TokenConfig = BaseContractAddressConfig;
export type TrxTokenConfig = BaseContractAddressConfig;
export type StellarTokenConfig = BaseNetworkConfig;
Expand Down Expand Up @@ -328,6 +331,8 @@ const formattedEosTokens = coins.reduce((acc: EosTokenConfig[], coin) => {
name: coin.fullName,
tokenContractAddress: coin.contractName.toString().toLowerCase(),
decimalPlaces: coin.decimalPlaces,
contractName: coin.contractName,
contractAddress: coin.contractAddress,
});
}
return acc;
Expand Down

0 comments on commit 6dd1946

Please sign in to comment.