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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@multiversx/sdk-core",
"version": "13.17.1",
"version": "13.17.2",
"description": "MultiversX SDK for JavaScript and TypeScript",
"author": "MultiversX",
"homepage": "https://multiversx.com",
Expand Down
16 changes: 16 additions & 0 deletions src/tokens.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ describe("test tokens and token computer", async () => {
const fungibleTokenIdentifier = "FNG-123456";
identifier = tokenComputer.extractIdentifierFromExtendedIdentifier(fungibleTokenIdentifier);
assert.equal(identifier, "FNG-123456");

const numericTokenTicker = "2065-65td7s";
identifier = tokenComputer.extractIdentifierFromExtendedIdentifier(numericTokenTicker);
assert.equal(identifier, "2065-65td7s");

const numericTokenTickerWithNonce = "2065-65td7s-01";
identifier = tokenComputer.extractIdentifierFromExtendedIdentifier(numericTokenTickerWithNonce);
assert.equal(identifier, "2065-65td7s");

const numericTokenTickerWithPrefix = "t0-2065-65td7s";
identifier = tokenComputer.extractIdentifierFromExtendedIdentifier(numericTokenTickerWithPrefix);
assert.equal(identifier, "t0-2065-65td7s");

const numericTokenTickerWithPrefixAndNonce = "t0-2065-65td7s";
identifier = tokenComputer.extractIdentifierFromExtendedIdentifier(numericTokenTickerWithPrefixAndNonce);
assert.equal(identifier, "t0-2065-65td7s")
});

it("should fail if prefix longer than expected", async () => {
Expand Down
6 changes: 1 addition & 5 deletions src/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ export class TokenComputer {
}

private splitIdentifierIntoComponents(parts: string[]): { prefix: any; ticker: any; randomSequence: any } {
if (this.isLowercaseAlphanumeric(parts[0])) {
if (parts.length >= 3 && parts[2].length === this.TOKEN_RANDOM_SEQUENCE_LENGTH) {
return { prefix: parts[0], ticker: parts[1], randomSequence: parts[2] };
}

Expand Down Expand Up @@ -329,10 +329,6 @@ export class TokenComputer {
if (!ticker.match(/^[a-zA-Z0-9]+$/)) {
throw new ErrInvalidTokenIdentifier("The token ticker should only contain alphanumeric characters");
}

if (!(ticker == ticker.toUpperCase())) {
throw new ErrInvalidTokenIdentifier("The token ticker should be upper case");
}
}
}

Expand Down
Loading