@reown/appkit-common-react-native 0.0.0-canary-20240913151525 → 0.0.0-develop-20240925193922

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.
Files changed (65) hide show
  1. package/lib/commonjs/contracts/erc20.js +41 -0
  2. package/lib/commonjs/contracts/erc20.js.map +1 -0
  3. package/lib/commonjs/contracts/usdt.js +38 -0
  4. package/lib/commonjs/contracts/usdt.js.map +1 -0
  5. package/lib/commonjs/index.js +56 -0
  6. package/lib/commonjs/index.js.map +1 -1
  7. package/lib/commonjs/utils/ConstantsUtil.js +18 -1
  8. package/lib/commonjs/utils/ConstantsUtil.js.map +1 -1
  9. package/lib/commonjs/utils/ContractUtil.js +18 -0
  10. package/lib/commonjs/utils/ContractUtil.js.map +1 -0
  11. package/lib/commonjs/utils/DateUtil.js +48 -0
  12. package/lib/commonjs/utils/DateUtil.js.map +1 -0
  13. package/lib/commonjs/utils/NamesUtil.js +13 -0
  14. package/lib/commonjs/utils/NamesUtil.js.map +1 -0
  15. package/lib/commonjs/utils/NumberUtil.js +33 -0
  16. package/lib/commonjs/utils/NumberUtil.js.map +1 -0
  17. package/lib/commonjs/utils/TypeUtil.js +2 -0
  18. package/lib/commonjs/utils/TypeUtil.js.map +1 -0
  19. package/lib/module/contracts/erc20.js +35 -0
  20. package/lib/module/contracts/erc20.js.map +1 -0
  21. package/lib/module/contracts/usdt.js +32 -0
  22. package/lib/module/contracts/usdt.js.map +1 -0
  23. package/lib/module/index.js +6 -0
  24. package/lib/module/index.js.map +1 -1
  25. package/lib/module/utils/ConstantsUtil.js +18 -1
  26. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  27. package/lib/module/utils/ContractUtil.js +12 -0
  28. package/lib/module/utils/ContractUtil.js.map +1 -0
  29. package/lib/module/utils/DateUtil.js +41 -0
  30. package/lib/module/utils/DateUtil.js.map +1 -0
  31. package/lib/module/utils/NamesUtil.js +7 -0
  32. package/lib/module/utils/NamesUtil.js.map +1 -0
  33. package/lib/module/utils/NumberUtil.js +25 -0
  34. package/lib/module/utils/NumberUtil.js.map +1 -0
  35. package/lib/module/utils/TypeUtil.js +2 -0
  36. package/lib/module/utils/TypeUtil.js.map +1 -0
  37. package/lib/typescript/contracts/erc20.d.ts +14 -0
  38. package/lib/typescript/contracts/erc20.d.ts.map +1 -0
  39. package/lib/typescript/contracts/usdt.d.ts +14 -0
  40. package/lib/typescript/contracts/usdt.d.ts.map +1 -0
  41. package/lib/typescript/index.d.ts +6 -0
  42. package/lib/typescript/index.d.ts.map +1 -1
  43. package/lib/typescript/utils/ConstantsUtil.d.ts +3 -0
  44. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  45. package/lib/typescript/utils/ContractUtil.d.ts +16 -0
  46. package/lib/typescript/utils/ContractUtil.d.ts.map +1 -0
  47. package/lib/typescript/utils/DateUtil.d.ts +7 -0
  48. package/lib/typescript/utils/DateUtil.d.ts.map +1 -0
  49. package/lib/typescript/utils/NamesUtil.d.ts +4 -0
  50. package/lib/typescript/utils/NamesUtil.d.ts.map +1 -0
  51. package/lib/typescript/utils/NumberUtil.d.ts +13 -0
  52. package/lib/typescript/utils/NumberUtil.d.ts.map +1 -0
  53. package/lib/typescript/utils/TypeUtil.d.ts +78 -0
  54. package/lib/typescript/utils/TypeUtil.d.ts.map +1 -0
  55. package/package.json +9 -5
  56. package/readme.md +3 -3
  57. package/src/contracts/erc20.ts +48 -0
  58. package/src/contracts/usdt.ts +43 -0
  59. package/src/index.ts +6 -0
  60. package/src/utils/ConstantsUtil.ts +19 -1
  61. package/src/utils/ContractUtil.ts +13 -0
  62. package/src/utils/DateUtil.ts +47 -0
  63. package/src/utils/NamesUtil.ts +10 -0
  64. package/src/utils/NumberUtil.ts +31 -0
  65. package/src/utils/TypeUtil.ts +87 -0
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.erc20ABI = void 0;
7
+ const erc20ABI = exports.erc20ABI = [{
8
+ type: 'function',
9
+ name: 'transfer',
10
+ stateMutability: 'nonpayable',
11
+ inputs: [{
12
+ name: '_to',
13
+ type: 'address'
14
+ }, {
15
+ name: '_value',
16
+ type: 'uint256'
17
+ }],
18
+ outputs: [{
19
+ name: '',
20
+ type: 'bool'
21
+ }]
22
+ }, {
23
+ type: 'function',
24
+ name: 'transferFrom',
25
+ stateMutability: 'nonpayable',
26
+ inputs: [{
27
+ name: '_from',
28
+ type: 'address'
29
+ }, {
30
+ name: '_to',
31
+ type: 'address'
32
+ }, {
33
+ name: '_value',
34
+ type: 'uint256'
35
+ }],
36
+ outputs: [{
37
+ name: '',
38
+ type: 'bool'
39
+ }]
40
+ }];
41
+ //# sourceMappingURL=erc20.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["erc20ABI","exports","type","name","stateMutability","inputs","outputs"],"sourceRoot":"../../../src","sources":["contracts/erc20.ts"],"mappings":";;;;;;AAAO,MAAMA,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG,CACtB;EACEE,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,UAAU;EAChBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,KAAK;IACXD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,EACD;EACEA,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,cAAc;EACpBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,OAAO;IACbD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,KAAK;IACXD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,CACF"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.usdtABI = void 0;
7
+ const usdtABI = exports.usdtABI = [{
8
+ type: 'function',
9
+ name: 'transfer',
10
+ stateMutability: 'nonpayable',
11
+ inputs: [{
12
+ name: 'recipient',
13
+ type: 'address'
14
+ }, {
15
+ name: 'amount',
16
+ type: 'uint256'
17
+ }],
18
+ outputs: []
19
+ }, {
20
+ type: 'function',
21
+ name: 'transferFrom',
22
+ stateMutability: 'nonpayable',
23
+ inputs: [{
24
+ name: 'sender',
25
+ type: 'address'
26
+ }, {
27
+ name: 'recipient',
28
+ type: 'address'
29
+ }, {
30
+ name: 'amount',
31
+ type: 'uint256'
32
+ }],
33
+ outputs: [{
34
+ name: '',
35
+ type: 'bool'
36
+ }]
37
+ }];
38
+ //# sourceMappingURL=usdt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["usdtABI","exports","type","name","stateMutability","inputs","outputs"],"sourceRoot":"../../../src","sources":["contracts/usdt.ts"],"mappings":";;;;;;AAAO,MAAMA,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,CACrB;EACEE,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,UAAU;EAChBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,WAAW;IACjBD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,cAAc;EACpBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,WAAW;IACjBD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,CACF"}
@@ -3,18 +3,74 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ ConstantsUtil: true,
8
+ ContractUtil: true,
9
+ DateUtil: true,
10
+ NamesUtil: true,
11
+ NetworkUtil: true,
12
+ NumberUtil: true,
13
+ erc20ABI: true
14
+ };
6
15
  Object.defineProperty(exports, "ConstantsUtil", {
7
16
  enumerable: true,
8
17
  get: function () {
9
18
  return _ConstantsUtil.ConstantsUtil;
10
19
  }
11
20
  });
21
+ Object.defineProperty(exports, "ContractUtil", {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _ContractUtil.ContractUtil;
25
+ }
26
+ });
27
+ Object.defineProperty(exports, "DateUtil", {
28
+ enumerable: true,
29
+ get: function () {
30
+ return _DateUtil.DateUtil;
31
+ }
32
+ });
33
+ Object.defineProperty(exports, "NamesUtil", {
34
+ enumerable: true,
35
+ get: function () {
36
+ return _NamesUtil.NamesUtil;
37
+ }
38
+ });
12
39
  Object.defineProperty(exports, "NetworkUtil", {
13
40
  enumerable: true,
14
41
  get: function () {
15
42
  return _NetworkUtil.NetworkUtil;
16
43
  }
17
44
  });
45
+ Object.defineProperty(exports, "NumberUtil", {
46
+ enumerable: true,
47
+ get: function () {
48
+ return _NumberUtil.NumberUtil;
49
+ }
50
+ });
51
+ Object.defineProperty(exports, "erc20ABI", {
52
+ enumerable: true,
53
+ get: function () {
54
+ return _erc.erc20ABI;
55
+ }
56
+ });
18
57
  var _ConstantsUtil = require("./utils/ConstantsUtil");
58
+ var _ContractUtil = require("./utils/ContractUtil");
59
+ var _DateUtil = require("./utils/DateUtil");
60
+ var _NamesUtil = require("./utils/NamesUtil");
19
61
  var _NetworkUtil = require("./utils/NetworkUtil");
62
+ var _NumberUtil = require("./utils/NumberUtil");
63
+ var _erc = require("./contracts/erc20");
64
+ var _TypeUtil = require("./utils/TypeUtil");
65
+ Object.keys(_TypeUtil).forEach(function (key) {
66
+ if (key === "default" || key === "__esModule") return;
67
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
68
+ if (key in exports && exports[key] === _TypeUtil[key]) return;
69
+ Object.defineProperty(exports, key, {
70
+ enumerable: true,
71
+ get: function () {
72
+ return _TypeUtil[key];
73
+ }
74
+ });
75
+ });
20
76
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_ConstantsUtil","require","_NetworkUtil"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA"}
1
+ {"version":3,"names":["_ConstantsUtil","require","_ContractUtil","_DateUtil","_NamesUtil","_NetworkUtil","_NumberUtil","_erc","_TypeUtil","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAAAQ,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA"}
@@ -5,10 +5,27 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.ConstantsUtil = void 0;
7
7
  const ConstantsUtil = exports.ConstantsUtil = {
8
+ WC_NAME_SUFFIX: '.reown.id',
9
+ WC_NAME_SUFFIX_LEGACY: '.wcn.id',
8
10
  BLOCKCHAIN_API_RPC_URL: 'https://rpc.walletconnect.org',
9
11
  PULSE_API_URL: 'https://pulse.walletconnect.org',
10
12
  API_URL: 'https://api.web3modal.org',
11
13
  COINBASE_CONNECTOR_ID: 'coinbaseWallet',
12
- COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
14
+ COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
15
+ USDT_CONTRACT_ADDRESSES: [
16
+ // Mainnet
17
+ '0xdac17f958d2ee523a2206206994597c13d831ec7',
18
+ // Polygon
19
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
20
+ // Avalanche
21
+ '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7',
22
+ // Cosmos
23
+ '0x919C1c267BC06a7039e03fcc2eF738525769109c',
24
+ // Celo
25
+ '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
26
+ // Binance
27
+ '0x55d398326f99059fF775485246999027B3197955',
28
+ // Arbitrum
29
+ '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9']
13
30
  };
14
31
  //# sourceMappingURL=ConstantsUtil.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ConstantsUtil","exports","BLOCKCHAIN_API_RPC_URL","PULSE_API_URL","API_URL","COINBASE_CONNECTOR_ID","COINBASE_EXPLORER_ID"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":";;;;;;AAAO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3BE,sBAAsB,EAAE,+BAA+B;EACvDC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EACpCC,qBAAqB,EAAE,gBAAgB;EACvCC,oBAAoB,EAAE;AACxB,CAAC"}
1
+ {"version":3,"names":["ConstantsUtil","exports","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","PULSE_API_URL","API_URL","COINBASE_CONNECTOR_ID","COINBASE_EXPLORER_ID","USDT_CONTRACT_ADDRESSES"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":";;;;;;AAAO,MAAMA,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EAC3BE,cAAc,EAAE,WAAW;EAC3BC,qBAAqB,EAAE,SAAS;EAChCC,sBAAsB,EAAE,+BAA+B;EACvDC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EACpCC,qBAAqB,EAAE,gBAAgB;EACvCC,oBAAoB,EAAE,kEAAkE;EACxFC,uBAAuB,EAAE;EACvB;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;AAEhD,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ContractUtil = void 0;
7
+ var _erc = require("../contracts/erc20");
8
+ var _usdt = require("../contracts/usdt");
9
+ var _ConstantsUtil = require("./ConstantsUtil");
10
+ const ContractUtil = exports.ContractUtil = {
11
+ getERC20Abi: tokenAddress => {
12
+ if (_ConstantsUtil.ConstantsUtil.USDT_CONTRACT_ADDRESSES.includes(tokenAddress)) {
13
+ return _usdt.usdtABI;
14
+ }
15
+ return _erc.erc20ABI;
16
+ }
17
+ };
18
+ //# sourceMappingURL=ContractUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_erc","require","_usdt","_ConstantsUtil","ContractUtil","exports","getERC20Abi","tokenAddress","ConstantsUtil","USDT_CONTRACT_ADDRESSES","includes","usdtABI","erc20ABI"],"sourceRoot":"../../../src","sources":["utils/ContractUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,MAAMG,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,WAAW,EAAGC,YAAoB,IAAK;IACrC,IAAIC,4BAAa,CAACC,uBAAuB,CAACC,QAAQ,CAACH,YAAY,CAAC,EAAE;MAChE,OAAOI,aAAO;IAChB;IAEA,OAAOC,aAAQ;EACjB;AACF,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DateUtil = void 0;
7
+ var _dayjs = _interopRequireDefault(require("dayjs"));
8
+ var _en = _interopRequireDefault(require("dayjs/locale/en.js"));
9
+ var _relativeTime = _interopRequireDefault(require("dayjs/plugin/relativeTime.js"));
10
+ var _updateLocale = _interopRequireDefault(require("dayjs/plugin/updateLocale.js"));
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ _dayjs.default.extend(_relativeTime.default);
13
+ _dayjs.default.extend(_updateLocale.default);
14
+ const localeObject = {
15
+ ..._en.default,
16
+ name: 'en-web3-modal',
17
+ relativeTime: {
18
+ future: 'in %s',
19
+ past: '%s ago',
20
+ s: '%d sec',
21
+ m: '1 min',
22
+ mm: '%d min',
23
+ h: '1 hr',
24
+ hh: '%d hrs',
25
+ d: '1 d',
26
+ dd: '%d d',
27
+ M: '1 mo',
28
+ MM: '%d mo',
29
+ y: '1 yr',
30
+ yy: '%d yr'
31
+ }
32
+ };
33
+ _dayjs.default.locale('en-appkit', localeObject);
34
+ const DateUtil = exports.DateUtil = {
35
+ getYear(date = new Date().toISOString()) {
36
+ return (0, _dayjs.default)(date).year();
37
+ },
38
+ getRelativeDateFromNow(date) {
39
+ return (0, _dayjs.default)(date).locale('en-appkit').fromNow(true);
40
+ },
41
+ formatDate(date, format = 'DD MMM') {
42
+ return (0, _dayjs.default)(date).format(format);
43
+ },
44
+ getMonth(month) {
45
+ return (0, _dayjs.default)().month(month).format('MMMM');
46
+ }
47
+ };
48
+ //# sourceMappingURL=DateUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_dayjs","_interopRequireDefault","require","_en","_relativeTime","_updateLocale","obj","__esModule","default","dayjs","extend","relativeTime","updateLocale","localeObject","englishLocale","name","future","past","s","m","mm","h","hh","d","dd","M","MM","y","yy","locale","DateUtil","exports","getYear","date","Date","toISOString","year","getRelativeDateFromNow","fromNow","formatDate","format","getMonth","month"],"sourceRoot":"../../../src","sources":["utils/DateUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,GAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAAwD,SAAAD,uBAAAK,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAExDG,cAAK,CAACC,MAAM,CAACC,qBAAY,CAAC;AAC1BF,cAAK,CAACC,MAAM,CAACE,qBAAY,CAAC;AAE1B,MAAMC,YAAY,GAAG;EACnB,GAAGC,WAAa;EAChBC,IAAI,EAAE,eAAe;EACrBJ,YAAY,EAAE;IACZK,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,CAAC,EAAE,QAAQ;IACXC,CAAC,EAAE,OAAO;IACVC,EAAE,EAAE,QAAQ;IACZC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE,QAAQ;IACZC,CAAC,EAAE,KAAK;IACRC,EAAE,EAAE,MAAM;IACVC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE,OAAO;IACXC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE;EACN;AACF,CAAC;AAEDnB,cAAK,CAACoB,MAAM,CAAC,WAAW,EAAEhB,YAAY,CAAC;AAEhC,MAAMiB,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAG;EACtBE,OAAOA,CAACC,IAAY,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,EAAE;IAC/C,OAAO,IAAA1B,cAAK,EAACwB,IAAI,CAAC,CAACG,IAAI,CAAC,CAAC;EAC3B,CAAC;EAEDC,sBAAsBA,CAACJ,IAAqB,EAAE;IAC5C,OAAO,IAAAxB,cAAK,EAACwB,IAAI,CAAC,CAACJ,MAAM,CAAC,WAAW,CAAC,CAACS,OAAO,CAAC,IAAI,CAAC;EACtD,CAAC;EAEDC,UAAUA,CAACN,IAAqB,EAAEO,MAAM,GAAG,QAAQ,EAAE;IACnD,OAAO,IAAA/B,cAAK,EAACwB,IAAI,CAAC,CAACO,MAAM,CAACA,MAAM,CAAC;EACnC,CAAC;EAEDC,QAAQA,CAACC,KAAa,EAAE;IACtB,OAAO,IAAAjC,cAAK,EAAC,CAAC,CAACiC,KAAK,CAACA,KAAK,CAAC,CAACF,MAAM,CAAC,MAAM,CAAC;EAC5C;AACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NamesUtil = void 0;
7
+ var _ConstantsUtil = require("./ConstantsUtil");
8
+ const NamesUtil = exports.NamesUtil = {
9
+ isReownName(value) {
10
+ return value?.endsWith(_ConstantsUtil.ConstantsUtil.WC_NAME_SUFFIX_LEGACY) || value?.endsWith(_ConstantsUtil.ConstantsUtil.WC_NAME_SUFFIX);
11
+ }
12
+ };
13
+ //# sourceMappingURL=NamesUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ConstantsUtil","require","NamesUtil","exports","isReownName","value","endsWith","ConstantsUtil","WC_NAME_SUFFIX_LEGACY","WC_NAME_SUFFIX"],"sourceRoot":"../../../src","sources":["utils/NamesUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvBE,WAAWA,CAACC,KAAa,EAAE;IACzB,OACEA,KAAK,EAAEC,QAAQ,CAACC,4BAAa,CAACC,qBAAqB,CAAC,IACpDH,KAAK,EAAEC,QAAQ,CAACC,4BAAa,CAACE,cAAc,CAAC;EAEjD;AACF,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.NumberUtil = void 0;
7
+ var BigNumber = _interopRequireWildcard(require("bignumber.js"));
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const NumberUtil = exports.NumberUtil = {
11
+ bigNumber(value) {
12
+ return new BigNumber.BigNumber(value);
13
+ },
14
+ /**
15
+ * Multiply two numbers represented as strings with BigNumber to handle decimals correctly
16
+ * @param a string
17
+ * @param b string
18
+ * @returns
19
+ */
20
+ multiply(a, b) {
21
+ if (a === undefined || b === undefined) {
22
+ return BigNumber.BigNumber(0);
23
+ }
24
+ const aBigNumber = new BigNumber.BigNumber(a);
25
+ const bBigNumber = new BigNumber.BigNumber(b);
26
+ return aBigNumber.multipliedBy(bBigNumber);
27
+ },
28
+ roundNumber(number, threshold, fixed) {
29
+ const roundedNumber = number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
30
+ return roundedNumber;
31
+ }
32
+ };
33
+ //# sourceMappingURL=NumberUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BigNumber","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","NumberUtil","exports","bigNumber","value","multiply","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA0C,SAAAC,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAjB,CAAA,EAAAc,CAAA,SAAAI,CAAA,GAAAR,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAI,CAAA,KAAAA,CAAA,CAAAX,GAAA,IAAAW,CAAA,CAAAC,GAAA,IAAAR,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAI,CAAA,IAAAV,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAgB,GAAA,CAAAnB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAEnC,MAAMY,UAAU,GAAAC,OAAA,CAAAD,UAAA,GAAG;EACxBE,SAASA,CAACC,KAAgC,EAAE;IAC1C,OAAO,IAAI3B,SAAS,CAACA,SAAS,CAAC2B,KAAK,CAAC;EACvC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,QAAQA,CAACd,CAAwC,EAAEe,CAAwC,EAAE;IAC3F,IAAIf,CAAC,KAAKgB,SAAS,IAAID,CAAC,KAAKC,SAAS,EAAE;MACtC,OAAO9B,SAAS,CAACA,SAAS,CAAC,CAAC,CAAC;IAC/B;IAEA,MAAM+B,UAAU,GAAG,IAAI/B,SAAS,CAACA,SAAS,CAACc,CAAC,CAAC;IAC7C,MAAMkB,UAAU,GAAG,IAAIhC,SAAS,CAACA,SAAS,CAAC6B,CAAC,CAAC;IAE7C,OAAOE,UAAU,CAACE,YAAY,CAACD,UAAU,CAAC;EAC5C,CAAC;EAEDE,WAAWA,CAACC,MAAc,EAAEC,SAAiB,EAAEC,KAAa,EAAE;IAC5D,MAAMC,aAAa,GACjBH,MAAM,CAACI,QAAQ,CAAC,CAAC,CAACC,MAAM,IAAIJ,SAAS,GAAGK,MAAM,CAACN,MAAM,CAAC,CAACO,OAAO,CAACL,KAAK,CAAC,GAAGF,MAAM;IAEhF,OAAOG,aAAa;EACtB;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=TypeUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":""}
@@ -0,0 +1,35 @@
1
+ export const erc20ABI = [{
2
+ type: 'function',
3
+ name: 'transfer',
4
+ stateMutability: 'nonpayable',
5
+ inputs: [{
6
+ name: '_to',
7
+ type: 'address'
8
+ }, {
9
+ name: '_value',
10
+ type: 'uint256'
11
+ }],
12
+ outputs: [{
13
+ name: '',
14
+ type: 'bool'
15
+ }]
16
+ }, {
17
+ type: 'function',
18
+ name: 'transferFrom',
19
+ stateMutability: 'nonpayable',
20
+ inputs: [{
21
+ name: '_from',
22
+ type: 'address'
23
+ }, {
24
+ name: '_to',
25
+ type: 'address'
26
+ }, {
27
+ name: '_value',
28
+ type: 'uint256'
29
+ }],
30
+ outputs: [{
31
+ name: '',
32
+ type: 'bool'
33
+ }]
34
+ }];
35
+ //# sourceMappingURL=erc20.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["erc20ABI","type","name","stateMutability","inputs","outputs"],"sourceRoot":"../../../src","sources":["contracts/erc20.ts"],"mappings":"AAAA,OAAO,MAAMA,QAAQ,GAAG,CACtB;EACEC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,UAAU;EAChBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,KAAK;IACXD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,EACD;EACEA,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,cAAc;EACpBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,OAAO;IACbD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,KAAK;IACXD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,CACF"}
@@ -0,0 +1,32 @@
1
+ export const usdtABI = [{
2
+ type: 'function',
3
+ name: 'transfer',
4
+ stateMutability: 'nonpayable',
5
+ inputs: [{
6
+ name: 'recipient',
7
+ type: 'address'
8
+ }, {
9
+ name: 'amount',
10
+ type: 'uint256'
11
+ }],
12
+ outputs: []
13
+ }, {
14
+ type: 'function',
15
+ name: 'transferFrom',
16
+ stateMutability: 'nonpayable',
17
+ inputs: [{
18
+ name: 'sender',
19
+ type: 'address'
20
+ }, {
21
+ name: 'recipient',
22
+ type: 'address'
23
+ }, {
24
+ name: 'amount',
25
+ type: 'uint256'
26
+ }],
27
+ outputs: [{
28
+ name: '',
29
+ type: 'bool'
30
+ }]
31
+ }];
32
+ //# sourceMappingURL=usdt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["usdtABI","type","name","stateMutability","inputs","outputs"],"sourceRoot":"../../../src","sources":["contracts/usdt.ts"],"mappings":"AAAA,OAAO,MAAMA,OAAO,GAAG,CACrB;EACEC,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,UAAU;EAChBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,WAAW;IACjBD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE;AACX,CAAC,EACD;EACEJ,IAAI,EAAE,UAAU;EAChBC,IAAI,EAAE,cAAc;EACpBC,eAAe,EAAE,YAAY;EAC7BC,MAAM,EAAE,CACN;IACEF,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,WAAW;IACjBD,IAAI,EAAE;EACR,CAAC,EACD;IACEC,IAAI,EAAE,QAAQ;IACdD,IAAI,EAAE;EACR,CAAC,CACF;EACDI,OAAO,EAAE,CACP;IACEH,IAAI,EAAE,EAAE;IACRD,IAAI,EAAE;EACR,CAAC;AAEL,CAAC,CACF"}
@@ -1,3 +1,9 @@
1
1
  export { ConstantsUtil } from './utils/ConstantsUtil';
2
+ export { ContractUtil } from './utils/ContractUtil';
3
+ export { DateUtil } from './utils/DateUtil';
4
+ export { NamesUtil } from './utils/NamesUtil';
2
5
  export { NetworkUtil } from './utils/NetworkUtil';
6
+ export { NumberUtil } from './utils/NumberUtil';
7
+ export { erc20ABI } from './contracts/erc20';
8
+ export * from './utils/TypeUtil';
3
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ConstantsUtil","NetworkUtil"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,WAAW,QAAQ,qBAAqB"}
1
+ {"version":3,"names":["ConstantsUtil","ContractUtil","DateUtil","NamesUtil","NetworkUtil","NumberUtil","erc20ABI"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,uBAAuB;AACrD,SAASC,YAAY,QAAQ,sBAAsB;AACnD,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,oBAAoB;AAC/C,SAASC,QAAQ,QAAQ,mBAAmB;AAC5C,cAAc,kBAAkB"}
@@ -1,8 +1,25 @@
1
1
  export const ConstantsUtil = {
2
+ WC_NAME_SUFFIX: '.reown.id',
3
+ WC_NAME_SUFFIX_LEGACY: '.wcn.id',
2
4
  BLOCKCHAIN_API_RPC_URL: 'https://rpc.walletconnect.org',
3
5
  PULSE_API_URL: 'https://pulse.walletconnect.org',
4
6
  API_URL: 'https://api.web3modal.org',
5
7
  COINBASE_CONNECTOR_ID: 'coinbaseWallet',
6
- COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
8
+ COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
9
+ USDT_CONTRACT_ADDRESSES: [
10
+ // Mainnet
11
+ '0xdac17f958d2ee523a2206206994597c13d831ec7',
12
+ // Polygon
13
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
14
+ // Avalanche
15
+ '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7',
16
+ // Cosmos
17
+ '0x919C1c267BC06a7039e03fcc2eF738525769109c',
18
+ // Celo
19
+ '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
20
+ // Binance
21
+ '0x55d398326f99059fF775485246999027B3197955',
22
+ // Arbitrum
23
+ '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9']
7
24
  };
8
25
  //# sourceMappingURL=ConstantsUtil.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ConstantsUtil","BLOCKCHAIN_API_RPC_URL","PULSE_API_URL","API_URL","COINBASE_CONNECTOR_ID","COINBASE_EXPLORER_ID"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EAC3BC,sBAAsB,EAAE,+BAA+B;EACvDC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EACpCC,qBAAqB,EAAE,gBAAgB;EACvCC,oBAAoB,EAAE;AACxB,CAAC"}
1
+ {"version":3,"names":["ConstantsUtil","WC_NAME_SUFFIX","WC_NAME_SUFFIX_LEGACY","BLOCKCHAIN_API_RPC_URL","PULSE_API_URL","API_URL","COINBASE_CONNECTOR_ID","COINBASE_EXPLORER_ID","USDT_CONTRACT_ADDRESSES"],"sourceRoot":"../../../src","sources":["utils/ConstantsUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,aAAa,GAAG;EAC3BC,cAAc,EAAE,WAAW;EAC3BC,qBAAqB,EAAE,SAAS;EAChCC,sBAAsB,EAAE,+BAA+B;EACvDC,aAAa,EAAE,iCAAiC;EAChDC,OAAO,EAAE,2BAA2B;EACpCC,qBAAqB,EAAE,gBAAgB;EACvCC,oBAAoB,EAAE,kEAAkE;EACxFC,uBAAuB,EAAE;EACvB;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;EAC5C;EACA,4CAA4C;AAEhD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { erc20ABI } from '../contracts/erc20';
2
+ import { usdtABI } from '../contracts/usdt';
3
+ import { ConstantsUtil } from './ConstantsUtil';
4
+ export const ContractUtil = {
5
+ getERC20Abi: tokenAddress => {
6
+ if (ConstantsUtil.USDT_CONTRACT_ADDRESSES.includes(tokenAddress)) {
7
+ return usdtABI;
8
+ }
9
+ return erc20ABI;
10
+ }
11
+ };
12
+ //# sourceMappingURL=ContractUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["erc20ABI","usdtABI","ConstantsUtil","ContractUtil","getERC20Abi","tokenAddress","USDT_CONTRACT_ADDRESSES","includes"],"sourceRoot":"../../../src","sources":["utils/ContractUtil.ts"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,MAAMC,YAAY,GAAG;EAC1BC,WAAW,EAAGC,YAAoB,IAAK;IACrC,IAAIH,aAAa,CAACI,uBAAuB,CAACC,QAAQ,CAACF,YAAY,CAAC,EAAE;MAChE,OAAOJ,OAAO;IAChB;IAEA,OAAOD,QAAQ;EACjB;AACF,CAAC"}
@@ -0,0 +1,41 @@
1
+ import dayjs from 'dayjs';
2
+ import englishLocale from 'dayjs/locale/en.js';
3
+ import relativeTime from 'dayjs/plugin/relativeTime.js';
4
+ import updateLocale from 'dayjs/plugin/updateLocale.js';
5
+ dayjs.extend(relativeTime);
6
+ dayjs.extend(updateLocale);
7
+ const localeObject = {
8
+ ...englishLocale,
9
+ name: 'en-web3-modal',
10
+ relativeTime: {
11
+ future: 'in %s',
12
+ past: '%s ago',
13
+ s: '%d sec',
14
+ m: '1 min',
15
+ mm: '%d min',
16
+ h: '1 hr',
17
+ hh: '%d hrs',
18
+ d: '1 d',
19
+ dd: '%d d',
20
+ M: '1 mo',
21
+ MM: '%d mo',
22
+ y: '1 yr',
23
+ yy: '%d yr'
24
+ }
25
+ };
26
+ dayjs.locale('en-appkit', localeObject);
27
+ export const DateUtil = {
28
+ getYear(date = new Date().toISOString()) {
29
+ return dayjs(date).year();
30
+ },
31
+ getRelativeDateFromNow(date) {
32
+ return dayjs(date).locale('en-appkit').fromNow(true);
33
+ },
34
+ formatDate(date, format = 'DD MMM') {
35
+ return dayjs(date).format(format);
36
+ },
37
+ getMonth(month) {
38
+ return dayjs().month(month).format('MMMM');
39
+ }
40
+ };
41
+ //# sourceMappingURL=DateUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["dayjs","englishLocale","relativeTime","updateLocale","extend","localeObject","name","future","past","s","m","mm","h","hh","d","dd","M","MM","y","yy","locale","DateUtil","getYear","date","Date","toISOString","year","getRelativeDateFromNow","fromNow","formatDate","format","getMonth","month"],"sourceRoot":"../../../src","sources":["utils/DateUtil.ts"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,aAAa,MAAM,oBAAoB;AAC9C,OAAOC,YAAY,MAAM,8BAA8B;AACvD,OAAOC,YAAY,MAAM,8BAA8B;AAEvDH,KAAK,CAACI,MAAM,CAACF,YAAY,CAAC;AAC1BF,KAAK,CAACI,MAAM,CAACD,YAAY,CAAC;AAE1B,MAAME,YAAY,GAAG;EACnB,GAAGJ,aAAa;EAChBK,IAAI,EAAE,eAAe;EACrBJ,YAAY,EAAE;IACZK,MAAM,EAAE,OAAO;IACfC,IAAI,EAAE,QAAQ;IACdC,CAAC,EAAE,QAAQ;IACXC,CAAC,EAAE,OAAO;IACVC,EAAE,EAAE,QAAQ;IACZC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE,QAAQ;IACZC,CAAC,EAAE,KAAK;IACRC,EAAE,EAAE,MAAM;IACVC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE,OAAO;IACXC,CAAC,EAAE,MAAM;IACTC,EAAE,EAAE;EACN;AACF,CAAC;AAEDnB,KAAK,CAACoB,MAAM,CAAC,WAAW,EAAEf,YAAY,CAAC;AAEvC,OAAO,MAAMgB,QAAQ,GAAG;EACtBC,OAAOA,CAACC,IAAY,GAAG,IAAIC,IAAI,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,EAAE;IAC/C,OAAOzB,KAAK,CAACuB,IAAI,CAAC,CAACG,IAAI,CAAC,CAAC;EAC3B,CAAC;EAEDC,sBAAsBA,CAACJ,IAAqB,EAAE;IAC5C,OAAOvB,KAAK,CAACuB,IAAI,CAAC,CAACH,MAAM,CAAC,WAAW,CAAC,CAACQ,OAAO,CAAC,IAAI,CAAC;EACtD,CAAC;EAEDC,UAAUA,CAACN,IAAqB,EAAEO,MAAM,GAAG,QAAQ,EAAE;IACnD,OAAO9B,KAAK,CAACuB,IAAI,CAAC,CAACO,MAAM,CAACA,MAAM,CAAC;EACnC,CAAC;EAEDC,QAAQA,CAACC,KAAa,EAAE;IACtB,OAAOhC,KAAK,CAAC,CAAC,CAACgC,KAAK,CAACA,KAAK,CAAC,CAACF,MAAM,CAAC,MAAM,CAAC;EAC5C;AACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ConstantsUtil } from './ConstantsUtil';
2
+ export const NamesUtil = {
3
+ isReownName(value) {
4
+ return value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX_LEGACY) || value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX);
5
+ }
6
+ };
7
+ //# sourceMappingURL=NamesUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ConstantsUtil","NamesUtil","isReownName","value","endsWith","WC_NAME_SUFFIX_LEGACY","WC_NAME_SUFFIX"],"sourceRoot":"../../../src","sources":["utils/NamesUtil.ts"],"mappings":"AAAA,SAASA,aAAa,QAAQ,iBAAiB;AAE/C,OAAO,MAAMC,SAAS,GAAG;EACvBC,WAAWA,CAACC,KAAa,EAAE;IACzB,OACEA,KAAK,EAAEC,QAAQ,CAACJ,aAAa,CAACK,qBAAqB,CAAC,IACpDF,KAAK,EAAEC,QAAQ,CAACJ,aAAa,CAACM,cAAc,CAAC;EAEjD;AACF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import * as BigNumber from 'bignumber.js';
2
+ export const NumberUtil = {
3
+ bigNumber(value) {
4
+ return new BigNumber.BigNumber(value);
5
+ },
6
+ /**
7
+ * Multiply two numbers represented as strings with BigNumber to handle decimals correctly
8
+ * @param a string
9
+ * @param b string
10
+ * @returns
11
+ */
12
+ multiply(a, b) {
13
+ if (a === undefined || b === undefined) {
14
+ return BigNumber.BigNumber(0);
15
+ }
16
+ const aBigNumber = new BigNumber.BigNumber(a);
17
+ const bBigNumber = new BigNumber.BigNumber(b);
18
+ return aBigNumber.multipliedBy(bBigNumber);
19
+ },
20
+ roundNumber(number, threshold, fixed) {
21
+ const roundedNumber = number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
22
+ return roundedNumber;
23
+ }
24
+ };
25
+ //# sourceMappingURL=NumberUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BigNumber","NumberUtil","bigNumber","value","multiply","a","b","undefined","aBigNumber","bBigNumber","multipliedBy","roundNumber","number","threshold","fixed","roundedNumber","toString","length","Number","toFixed"],"sourceRoot":"../../../src","sources":["utils/NumberUtil.ts"],"mappings":"AAAA,OAAO,KAAKA,SAAS,MAAM,cAAc;AAEzC,OAAO,MAAMC,UAAU,GAAG;EACxBC,SAASA,CAACC,KAAgC,EAAE;IAC1C,OAAO,IAAIH,SAAS,CAACA,SAAS,CAACG,KAAK,CAAC;EACvC,CAAC;EAED;AACF;AACA;AACA;AACA;AACA;EACEC,QAAQA,CAACC,CAAwC,EAAEC,CAAwC,EAAE;IAC3F,IAAID,CAAC,KAAKE,SAAS,IAAID,CAAC,KAAKC,SAAS,EAAE;MACtC,OAAOP,SAAS,CAACA,SAAS,CAAC,CAAC,CAAC;IAC/B;IAEA,MAAMQ,UAAU,GAAG,IAAIR,SAAS,CAACA,SAAS,CAACK,CAAC,CAAC;IAC7C,MAAMI,UAAU,GAAG,IAAIT,SAAS,CAACA,SAAS,CAACM,CAAC,CAAC;IAE7C,OAAOE,UAAU,CAACE,YAAY,CAACD,UAAU,CAAC;EAC5C,CAAC;EAEDE,WAAWA,CAACC,MAAc,EAAEC,SAAiB,EAAEC,KAAa,EAAE;IAC5D,MAAMC,aAAa,GACjBH,MAAM,CAACI,QAAQ,CAAC,CAAC,CAACC,MAAM,IAAIJ,SAAS,GAAGK,MAAM,CAACN,MAAM,CAAC,CAACO,OAAO,CAACL,KAAK,CAAC,GAAGF,MAAM;IAEhF,OAAOG,aAAa;EACtB;AACF,CAAC"}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=TypeUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["utils/TypeUtil.ts"],"mappings":""}
@@ -0,0 +1,14 @@
1
+ export declare const erc20ABI: {
2
+ type: string;
3
+ name: string;
4
+ stateMutability: string;
5
+ inputs: {
6
+ name: string;
7
+ type: string;
8
+ }[];
9
+ outputs: {
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ }[];
14
+ //# sourceMappingURL=erc20.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/contracts/erc20.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ;;;;;;;;;;;;GA+CpB,CAAC"}
@@ -0,0 +1,14 @@
1
+ export declare const usdtABI: {
2
+ type: string;
3
+ name: string;
4
+ stateMutability: string;
5
+ inputs: {
6
+ name: string;
7
+ type: string;
8
+ }[];
9
+ outputs: {
10
+ name: string;
11
+ type: string;
12
+ }[];
13
+ }[];
14
+ //# sourceMappingURL=usdt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usdt.d.ts","sourceRoot":"","sources":["../../../src/contracts/usdt.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;;;;GA0CnB,CAAC"}
@@ -1,3 +1,9 @@
1
1
  export { ConstantsUtil } from './utils/ConstantsUtil';
2
+ export { ContractUtil } from './utils/ContractUtil';
3
+ export { DateUtil } from './utils/DateUtil';
4
+ export { NamesUtil } from './utils/NamesUtil';
2
5
  export { NetworkUtil } from './utils/NetworkUtil';
6
+ export { NumberUtil } from './utils/NumberUtil';
7
+ export { erc20ABI } from './contracts/erc20';
8
+ export * from './utils/TypeUtil';
3
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,cAAc,kBAAkB,CAAC"}
@@ -1,8 +1,11 @@
1
1
  export declare const ConstantsUtil: {
2
+ WC_NAME_SUFFIX: string;
3
+ WC_NAME_SUFFIX_LEGACY: string;
2
4
  BLOCKCHAIN_API_RPC_URL: string;
3
5
  PULSE_API_URL: string;
4
6
  API_URL: string;
5
7
  COINBASE_CONNECTOR_ID: string;
6
8
  COINBASE_EXPLORER_ID: string;
9
+ USDT_CONTRACT_ADDRESSES: string[];
7
10
  };
8
11
  //# sourceMappingURL=ConstantsUtil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAC"}
1
+ {"version":3,"file":"ConstantsUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ConstantsUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;CAwBzB,CAAC"}
@@ -0,0 +1,16 @@
1
+ export declare const ContractUtil: {
2
+ getERC20Abi: (tokenAddress: string) => {
3
+ type: string;
4
+ name: string;
5
+ stateMutability: string;
6
+ inputs: {
7
+ name: string;
8
+ type: string;
9
+ }[];
10
+ outputs: {
11
+ name: string;
12
+ type: string;
13
+ }[];
14
+ }[];
15
+ };
16
+ //# sourceMappingURL=ContractUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContractUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ContractUtil.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY;gCACK,MAAM;;;;;;;;;;;;;CAOnC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare const DateUtil: {
2
+ getYear(date?: string): number;
3
+ getRelativeDateFromNow(date: string | number): string;
4
+ formatDate(date: string | number, format?: string): string;
5
+ getMonth(month: number): string;
6
+ };
7
+ //# sourceMappingURL=DateUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/DateUtil.ts"],"names":[],"mappings":"AA8BA,eAAO,MAAM,QAAQ;mBACL,MAAM;iCAIS,MAAM,GAAG,MAAM;qBAI3B,MAAM,GAAG,MAAM;oBAIhB,MAAM;CAGvB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const NamesUtil: {
2
+ isReownName(value: string): boolean;
3
+ };
4
+ //# sourceMappingURL=NamesUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NamesUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NamesUtil.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS;uBACD,MAAM;CAM1B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import * as BigNumber from 'bignumber.js';
2
+ export declare const NumberUtil: {
3
+ bigNumber(value: BigNumber.BigNumber.Value): BigNumber.BigNumber;
4
+ /**
5
+ * Multiply two numbers represented as strings with BigNumber to handle decimals correctly
6
+ * @param a string
7
+ * @param b string
8
+ * @returns
9
+ */
10
+ multiply(a: BigNumber.BigNumber.Value | undefined, b: BigNumber.BigNumber.Value | undefined): BigNumber.BigNumber;
11
+ roundNumber(number: number, threshold: number, fixed: number): string | number;
12
+ };
13
+ //# sourceMappingURL=NumberUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NumberUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/NumberUtil.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,UAAU;qBACJ,mBAAmB,CAAC,KAAK;IAI1C;;;;;OAKG;gBACS,mBAAmB,CAAC,KAAK,GAAG,SAAS,KAAK,mBAAmB,CAAC,KAAK,GAAG,SAAS;wBAWvE,MAAM,aAAa,MAAM,SAAS,MAAM;CAM7D,CAAC"}
@@ -0,0 +1,78 @@
1
+ export interface Balance {
2
+ name: string;
3
+ symbol: string;
4
+ chainId: string;
5
+ address?: string;
6
+ value?: number;
7
+ price: number;
8
+ quantity: BalanceQuantity;
9
+ iconUrl: string;
10
+ }
11
+ type BalanceQuantity = {
12
+ decimals: string;
13
+ numeric: string;
14
+ };
15
+ export type TransactionStatus = 'confirmed' | 'failed' | 'pending';
16
+ export type TransactionDirection = 'in' | 'out' | 'self';
17
+ export type TransactionImage = {
18
+ type: 'FUNGIBLE' | 'NFT' | undefined;
19
+ url: string | undefined;
20
+ };
21
+ export interface Transaction {
22
+ id: string;
23
+ metadata: TransactionMetadata;
24
+ transfers: TransactionTransfer[];
25
+ }
26
+ export interface TransactionMetadata {
27
+ application: {
28
+ iconUrl: string | null;
29
+ name: string | null;
30
+ };
31
+ operationType: string;
32
+ hash: string;
33
+ minedAt: string;
34
+ sentFrom: string;
35
+ sentTo: string;
36
+ status: TransactionStatus;
37
+ nonce: number;
38
+ chain?: string;
39
+ }
40
+ export interface TransactionTransfer {
41
+ fungible_info?: {
42
+ name?: string;
43
+ symbol?: string;
44
+ icon?: {
45
+ url: string;
46
+ };
47
+ };
48
+ nft_info?: TransactionNftInfo;
49
+ direction: TransactionDirection;
50
+ quantity: TransactionQuantity;
51
+ value?: number;
52
+ price?: number;
53
+ }
54
+ export interface TransactionNftInfo {
55
+ name?: string;
56
+ content?: TransactionContent;
57
+ flags: TransactionNftInfoFlags;
58
+ }
59
+ export interface TransactionNftInfoFlags {
60
+ is_spam: boolean;
61
+ }
62
+ export interface TransactionContent {
63
+ preview?: TransactionPreview;
64
+ detail?: TransactionDetail;
65
+ }
66
+ export interface TransactionPreview {
67
+ url: string;
68
+ content_type?: null;
69
+ }
70
+ export interface TransactionDetail {
71
+ url: string;
72
+ content_type?: null;
73
+ }
74
+ export interface TransactionQuantity {
75
+ numeric: string;
76
+ }
77
+ export {};
78
+ //# sourceMappingURL=TypeUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/TypeUtil.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AACnE,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,KAAK,GAAG,MAAM,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,UAAU,GAAG,KAAK,GAAG,SAAS,CAAC;IACrC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,mBAAmB,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE;QACX,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,iBAAiB,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,CAAC,EAAE;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE;YACL,GAAG,EAAE,MAAM,CAAC;SACb,CAAC;KACH,CAAC;IACF,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,KAAK,EAAE,uBAAuB,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-common-react-native",
3
- "version": "0.0.0-canary-20240913151525",
3
+ "version": "0.0.0-develop-20240925193922",
4
4
  "main": "lib/commonjs/index.js",
5
5
  "types": "lib/typescript/index.d.ts",
6
6
  "module": "lib/module/index.js",
@@ -11,6 +11,10 @@
11
11
  "test": "jest --passWithNoTests",
12
12
  "lint": "eslint . --ext .js,.jsx,.ts,.tsx"
13
13
  },
14
+ "dependencies": {
15
+ "bignumber.js": "9.1.2",
16
+ "dayjs": "1.11.10"
17
+ },
14
18
  "files": [
15
19
  "src",
16
20
  "lib"
@@ -23,16 +27,16 @@
23
27
  "walletconnect",
24
28
  "react-native"
25
29
  ],
26
- "repository": "https://github.com/WalletConnect/web3modal-react-native",
30
+ "repository": "https://github.com/reown-com/appkit-react-native",
27
31
  "author": "Reown <support@reown.com> (https://reown.com)",
28
- "homepage": "https://github.com/WalletConnect/web3modal-react-native",
32
+ "homepage": "https://reown.com/appkit",
29
33
  "license": "Apache-2.0",
30
34
  "bugs": {
31
- "url": "https://github.com/WalletConnect/web3modal-react-native/issues"
35
+ "url": "https://github.com/reown-com/appkit-react-native/issues"
32
36
  },
33
37
  "publishConfig": {
34
38
  "registry": "https://registry.npmjs.org/",
35
- "access": "restricted"
39
+ "access": "public"
36
40
  },
37
41
  "react-native": "src/index.ts",
38
42
  "react-native-builder-bob": {
package/readme.md CHANGED
@@ -1,8 +1,8 @@
1
- #### 📚 [Documentation](https://docs.walletconnect.com/appkit/react-native/core/installation)
1
+ #### 📚 [Documentation](https://docs.reown.com/appkit/react-native/core/installation)
2
2
 
3
- #### 🔎 [Examples](https://github.com/WalletConnect/react-native-examples)
3
+ #### 🔎 [Examples](https://github.com/reown-com/react-native-examples)
4
4
 
5
- #### 🔗 [Website](https://walletconnect.com/appkit)
5
+ #### 🔗 [Website](https://reown.com/appkit)
6
6
 
7
7
  # AppKit
8
8
 
@@ -0,0 +1,48 @@
1
+ export const erc20ABI = [
2
+ {
3
+ type: 'function',
4
+ name: 'transfer',
5
+ stateMutability: 'nonpayable',
6
+ inputs: [
7
+ {
8
+ name: '_to',
9
+ type: 'address'
10
+ },
11
+ {
12
+ name: '_value',
13
+ type: 'uint256'
14
+ }
15
+ ],
16
+ outputs: [
17
+ {
18
+ name: '',
19
+ type: 'bool'
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ type: 'function',
25
+ name: 'transferFrom',
26
+ stateMutability: 'nonpayable',
27
+ inputs: [
28
+ {
29
+ name: '_from',
30
+ type: 'address'
31
+ },
32
+ {
33
+ name: '_to',
34
+ type: 'address'
35
+ },
36
+ {
37
+ name: '_value',
38
+ type: 'uint256'
39
+ }
40
+ ],
41
+ outputs: [
42
+ {
43
+ name: '',
44
+ type: 'bool'
45
+ }
46
+ ]
47
+ }
48
+ ];
@@ -0,0 +1,43 @@
1
+ export const usdtABI = [
2
+ {
3
+ type: 'function',
4
+ name: 'transfer',
5
+ stateMutability: 'nonpayable',
6
+ inputs: [
7
+ {
8
+ name: 'recipient',
9
+ type: 'address'
10
+ },
11
+ {
12
+ name: 'amount',
13
+ type: 'uint256'
14
+ }
15
+ ],
16
+ outputs: []
17
+ },
18
+ {
19
+ type: 'function',
20
+ name: 'transferFrom',
21
+ stateMutability: 'nonpayable',
22
+ inputs: [
23
+ {
24
+ name: 'sender',
25
+ type: 'address'
26
+ },
27
+ {
28
+ name: 'recipient',
29
+ type: 'address'
30
+ },
31
+ {
32
+ name: 'amount',
33
+ type: 'uint256'
34
+ }
35
+ ],
36
+ outputs: [
37
+ {
38
+ name: '',
39
+ type: 'bool'
40
+ }
41
+ ]
42
+ }
43
+ ];
package/src/index.ts CHANGED
@@ -1,2 +1,8 @@
1
1
  export { ConstantsUtil } from './utils/ConstantsUtil';
2
+ export { ContractUtil } from './utils/ContractUtil';
3
+ export { DateUtil } from './utils/DateUtil';
4
+ export { NamesUtil } from './utils/NamesUtil';
2
5
  export { NetworkUtil } from './utils/NetworkUtil';
6
+ export { NumberUtil } from './utils/NumberUtil';
7
+ export { erc20ABI } from './contracts/erc20';
8
+ export * from './utils/TypeUtil';
@@ -1,7 +1,25 @@
1
1
  export const ConstantsUtil = {
2
+ WC_NAME_SUFFIX: '.reown.id',
3
+ WC_NAME_SUFFIX_LEGACY: '.wcn.id',
2
4
  BLOCKCHAIN_API_RPC_URL: 'https://rpc.walletconnect.org',
3
5
  PULSE_API_URL: 'https://pulse.walletconnect.org',
4
6
  API_URL: 'https://api.web3modal.org',
5
7
  COINBASE_CONNECTOR_ID: 'coinbaseWallet',
6
- COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa'
8
+ COINBASE_EXPLORER_ID: 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa',
9
+ USDT_CONTRACT_ADDRESSES: [
10
+ // Mainnet
11
+ '0xdac17f958d2ee523a2206206994597c13d831ec7',
12
+ // Polygon
13
+ '0xc2132d05d31c914a87c6611c10748aeb04b58e8f',
14
+ // Avalanche
15
+ '0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7',
16
+ // Cosmos
17
+ '0x919C1c267BC06a7039e03fcc2eF738525769109c',
18
+ // Celo
19
+ '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
20
+ // Binance
21
+ '0x55d398326f99059fF775485246999027B3197955',
22
+ // Arbitrum
23
+ '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9'
24
+ ]
7
25
  };
@@ -0,0 +1,13 @@
1
+ import { erc20ABI } from '../contracts/erc20';
2
+ import { usdtABI } from '../contracts/usdt';
3
+ import { ConstantsUtil } from './ConstantsUtil';
4
+
5
+ export const ContractUtil = {
6
+ getERC20Abi: (tokenAddress: string) => {
7
+ if (ConstantsUtil.USDT_CONTRACT_ADDRESSES.includes(tokenAddress)) {
8
+ return usdtABI;
9
+ }
10
+
11
+ return erc20ABI;
12
+ }
13
+ };
@@ -0,0 +1,47 @@
1
+ import dayjs from 'dayjs';
2
+ import englishLocale from 'dayjs/locale/en.js';
3
+ import relativeTime from 'dayjs/plugin/relativeTime.js';
4
+ import updateLocale from 'dayjs/plugin/updateLocale.js';
5
+
6
+ dayjs.extend(relativeTime);
7
+ dayjs.extend(updateLocale);
8
+
9
+ const localeObject = {
10
+ ...englishLocale,
11
+ name: 'en-web3-modal',
12
+ relativeTime: {
13
+ future: 'in %s',
14
+ past: '%s ago',
15
+ s: '%d sec',
16
+ m: '1 min',
17
+ mm: '%d min',
18
+ h: '1 hr',
19
+ hh: '%d hrs',
20
+ d: '1 d',
21
+ dd: '%d d',
22
+ M: '1 mo',
23
+ MM: '%d mo',
24
+ y: '1 yr',
25
+ yy: '%d yr'
26
+ }
27
+ };
28
+
29
+ dayjs.locale('en-appkit', localeObject);
30
+
31
+ export const DateUtil = {
32
+ getYear(date: string = new Date().toISOString()) {
33
+ return dayjs(date).year();
34
+ },
35
+
36
+ getRelativeDateFromNow(date: string | number) {
37
+ return dayjs(date).locale('en-appkit').fromNow(true);
38
+ },
39
+
40
+ formatDate(date: string | number, format = 'DD MMM') {
41
+ return dayjs(date).format(format);
42
+ },
43
+
44
+ getMonth(month: number) {
45
+ return dayjs().month(month).format('MMMM');
46
+ }
47
+ };
@@ -0,0 +1,10 @@
1
+ import { ConstantsUtil } from './ConstantsUtil';
2
+
3
+ export const NamesUtil = {
4
+ isReownName(value: string) {
5
+ return (
6
+ value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX_LEGACY) ||
7
+ value?.endsWith(ConstantsUtil.WC_NAME_SUFFIX)
8
+ );
9
+ }
10
+ };
@@ -0,0 +1,31 @@
1
+ import * as BigNumber from 'bignumber.js';
2
+
3
+ export const NumberUtil = {
4
+ bigNumber(value: BigNumber.BigNumber.Value) {
5
+ return new BigNumber.BigNumber(value);
6
+ },
7
+
8
+ /**
9
+ * Multiply two numbers represented as strings with BigNumber to handle decimals correctly
10
+ * @param a string
11
+ * @param b string
12
+ * @returns
13
+ */
14
+ multiply(a: BigNumber.BigNumber.Value | undefined, b: BigNumber.BigNumber.Value | undefined) {
15
+ if (a === undefined || b === undefined) {
16
+ return BigNumber.BigNumber(0);
17
+ }
18
+
19
+ const aBigNumber = new BigNumber.BigNumber(a);
20
+ const bBigNumber = new BigNumber.BigNumber(b);
21
+
22
+ return aBigNumber.multipliedBy(bBigNumber);
23
+ },
24
+
25
+ roundNumber(number: number, threshold: number, fixed: number) {
26
+ const roundedNumber =
27
+ number.toString().length >= threshold ? Number(number).toFixed(fixed) : number;
28
+
29
+ return roundedNumber;
30
+ }
31
+ };
@@ -0,0 +1,87 @@
1
+ export interface Balance {
2
+ name: string;
3
+ symbol: string;
4
+ chainId: string;
5
+ address?: string;
6
+ value?: number;
7
+ price: number;
8
+ quantity: BalanceQuantity;
9
+ iconUrl: string;
10
+ }
11
+
12
+ type BalanceQuantity = {
13
+ decimals: string;
14
+ numeric: string;
15
+ };
16
+
17
+ export type TransactionStatus = 'confirmed' | 'failed' | 'pending';
18
+ export type TransactionDirection = 'in' | 'out' | 'self';
19
+ export type TransactionImage = {
20
+ type: 'FUNGIBLE' | 'NFT' | undefined;
21
+ url: string | undefined;
22
+ };
23
+
24
+ export interface Transaction {
25
+ id: string;
26
+ metadata: TransactionMetadata;
27
+ transfers: TransactionTransfer[];
28
+ }
29
+
30
+ export interface TransactionMetadata {
31
+ application: {
32
+ iconUrl: string | null;
33
+ name: string | null;
34
+ };
35
+ operationType: string;
36
+ hash: string;
37
+ minedAt: string;
38
+ sentFrom: string;
39
+ sentTo: string;
40
+ status: TransactionStatus;
41
+ nonce: number;
42
+ chain?: string;
43
+ }
44
+
45
+ export interface TransactionTransfer {
46
+ fungible_info?: {
47
+ name?: string;
48
+ symbol?: string;
49
+ icon?: {
50
+ url: string;
51
+ };
52
+ };
53
+ nft_info?: TransactionNftInfo;
54
+ direction: TransactionDirection;
55
+ quantity: TransactionQuantity;
56
+ value?: number;
57
+ price?: number;
58
+ }
59
+
60
+ export interface TransactionNftInfo {
61
+ name?: string;
62
+ content?: TransactionContent;
63
+ flags: TransactionNftInfoFlags;
64
+ }
65
+
66
+ export interface TransactionNftInfoFlags {
67
+ is_spam: boolean;
68
+ }
69
+
70
+ export interface TransactionContent {
71
+ preview?: TransactionPreview;
72
+ detail?: TransactionDetail;
73
+ }
74
+
75
+ export interface TransactionPreview {
76
+ url: string;
77
+ content_type?: null;
78
+ }
79
+
80
+ export interface TransactionDetail {
81
+ url: string;
82
+ content_type?: null;
83
+ }
84
+
85
+ export interface TransactionQuantity {
86
+ numeric: string;
87
+ }