@clonegod/ttd-sui-common 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ export declare enum SUI_TOKEN_ADDRESS {
2
+ SHORT = "0x2::sui::SUI",
3
+ LONG = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SUI_TOKEN_ADDRESS = void 0;
4
+ var SUI_TOKEN_ADDRESS;
5
+ (function (SUI_TOKEN_ADDRESS) {
6
+ SUI_TOKEN_ADDRESS["SHORT"] = "0x2::sui::SUI";
7
+ SUI_TOKEN_ADDRESS["LONG"] = "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI";
8
+ })(SUI_TOKEN_ADDRESS || (exports.SUI_TOKEN_ADDRESS = SUI_TOKEN_ADDRESS = {}));
@@ -1 +1 @@
1
- export declare const normalizeSuiTokenAddress: (address: string) => string;
1
+ export declare const normalizeSuiTokenAddress: (address: string, useLongAddress?: boolean) => string;
@@ -1,9 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeSuiTokenAddress = void 0;
4
- const normalizeSuiTokenAddress = (address) => {
5
- if (address === '0x2::sui::SUI') {
6
- return '0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI';
4
+ const constants_1 = require("../constants");
5
+ const normalizeSuiTokenAddress = (address, useLongAddress = true) => {
6
+ if (useLongAddress) {
7
+ if (address === constants_1.SUI_TOKEN_ADDRESS.SHORT) {
8
+ return constants_1.SUI_TOKEN_ADDRESS.LONG;
9
+ }
10
+ }
11
+ else {
12
+ if (address === constants_1.SUI_TOKEN_ADDRESS.LONG) {
13
+ return constants_1.SUI_TOKEN_ADDRESS.SHORT;
14
+ }
7
15
  }
8
16
  return address;
9
17
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clonegod/ttd-sui-common",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Sui common library",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",