Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modules/sdk-coin-sol/src/solToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ export class SolToken extends Sol {
return Math.pow(10, this.tokenConfig.decimalPlaces);
}

/**
* Token standard for consolidation intents (wallet-platform).
* @returns {string} SPL token type identifier
*/
getTokenType(): string {
return 'SPL';
}

/**
* Flag for sending value of 0
* @returns {boolean} True if okay to send 0 value, false otherwise
Expand Down
8 changes: 8 additions & 0 deletions modules/sdk-coin-sol/test/unit/solToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ describe('SOL Token:', function () {
solTokenCoin.tokenAddress.should.equal('J3NKxxXZcnNiMjKw9hYb2K4LUxgwB6t1FtPtQVsv3KFr');
solTokenCoin.contractAddress.should.equal('J3NKxxXZcnNiMjKw9hYb2K4LUxgwB6t1FtPtQVsv3KFr');
});

it('should return SPL token type for mainnet token', function () {
solTokenCoin.getTokenType().should.equal('SPL');
});

it('should return SPL token type for testnet token', function () {
(bitgo.coin('tsol:usdc') as SolToken).getTokenType().should.equal('SPL');
});
});
10 changes: 10 additions & 0 deletions modules/statics/test/unit/coins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import {
trimmedDynamicBaseChainConfig,
} from './resources/amsTokenConfig';
import { EthLikeErc20Token } from '../../../sdk-coin-evm/src';
import { ProgramID } from '../../src/account';
import { allCoinsAndTokens } from '../../src/allCoinsAndTokens';

interface DuplicateCoinObject {
Expand Down Expand Up @@ -1012,6 +1013,15 @@ describe('Token contract address field defaults', () => {
solToken.contractAddress.should.eql(solToken.tokenAddress);
});
});

it('have valid programId (SPL or Token-2022)', () => {
const validProgramIds = [ProgramID.TokenProgramId, ProgramID.Token2022ProgramId];
coins
.filter((coin) => coin.family === CoinFamily.SOL && coin instanceof SolCoin)
.forEach((coin) => {
validProgramIds.should.containEql((coin as SolCoin).programId);
});
});
});
describe('XRP tokens', function () {
it('have `contractAddress` === `issuerAddress::currencyCode`', () => {
Expand Down
Loading