@reown/appkit-common-react-native 1.0.2 → 1.1.0

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 (79) hide show
  1. package/lib/commonjs/contracts/erc20.js +77 -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 +72 -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/ErrorUtil.js +41 -0
  14. package/lib/commonjs/utils/ErrorUtil.js.map +1 -0
  15. package/lib/commonjs/utils/NamesUtil.js +13 -0
  16. package/lib/commonjs/utils/NamesUtil.js.map +1 -0
  17. package/lib/commonjs/utils/NumberUtil.js +33 -0
  18. package/lib/commonjs/utils/NumberUtil.js.map +1 -0
  19. package/lib/commonjs/utils/StringUtil.js +15 -0
  20. package/lib/commonjs/utils/StringUtil.js.map +1 -0
  21. package/lib/commonjs/utils/TypeUtil.js +2 -0
  22. package/lib/commonjs/utils/TypeUtil.js.map +1 -0
  23. package/lib/module/contracts/erc20.js +71 -0
  24. package/lib/module/contracts/erc20.js.map +1 -0
  25. package/lib/module/contracts/usdt.js +32 -0
  26. package/lib/module/contracts/usdt.js.map +1 -0
  27. package/lib/module/index.js +8 -0
  28. package/lib/module/index.js.map +1 -1
  29. package/lib/module/utils/ConstantsUtil.js +18 -1
  30. package/lib/module/utils/ConstantsUtil.js.map +1 -1
  31. package/lib/module/utils/ContractUtil.js +12 -0
  32. package/lib/module/utils/ContractUtil.js.map +1 -0
  33. package/lib/module/utils/DateUtil.js +41 -0
  34. package/lib/module/utils/DateUtil.js.map +1 -0
  35. package/lib/module/utils/ErrorUtil.js +35 -0
  36. package/lib/module/utils/ErrorUtil.js.map +1 -0
  37. package/lib/module/utils/NamesUtil.js +7 -0
  38. package/lib/module/utils/NamesUtil.js.map +1 -0
  39. package/lib/module/utils/NumberUtil.js +25 -0
  40. package/lib/module/utils/NumberUtil.js.map +1 -0
  41. package/lib/module/utils/StringUtil.js +9 -0
  42. package/lib/module/utils/StringUtil.js.map +1 -0
  43. package/lib/module/utils/TypeUtil.js +2 -0
  44. package/lib/module/utils/TypeUtil.js.map +1 -0
  45. package/lib/typescript/contracts/erc20.d.ts +30 -0
  46. package/lib/typescript/contracts/erc20.d.ts.map +1 -0
  47. package/lib/typescript/contracts/usdt.d.ts +14 -0
  48. package/lib/typescript/contracts/usdt.d.ts.map +1 -0
  49. package/lib/typescript/index.d.ts +8 -0
  50. package/lib/typescript/index.d.ts.map +1 -1
  51. package/lib/typescript/utils/ConstantsUtil.d.ts +3 -0
  52. package/lib/typescript/utils/ConstantsUtil.d.ts.map +1 -1
  53. package/lib/typescript/utils/ContractUtil.d.ts +16 -0
  54. package/lib/typescript/utils/ContractUtil.d.ts.map +1 -0
  55. package/lib/typescript/utils/DateUtil.d.ts +7 -0
  56. package/lib/typescript/utils/DateUtil.d.ts.map +1 -0
  57. package/lib/typescript/utils/ErrorUtil.d.ts +35 -0
  58. package/lib/typescript/utils/ErrorUtil.d.ts.map +1 -0
  59. package/lib/typescript/utils/NamesUtil.d.ts +4 -0
  60. package/lib/typescript/utils/NamesUtil.d.ts.map +1 -0
  61. package/lib/typescript/utils/NumberUtil.d.ts +13 -0
  62. package/lib/typescript/utils/NumberUtil.d.ts.map +1 -0
  63. package/lib/typescript/utils/StringUtil.d.ts +4 -0
  64. package/lib/typescript/utils/StringUtil.d.ts.map +1 -0
  65. package/lib/typescript/utils/TypeUtil.d.ts +79 -0
  66. package/lib/typescript/utils/TypeUtil.d.ts.map +1 -0
  67. package/package.json +8 -4
  68. package/readme.md +1 -1
  69. package/src/contracts/erc20.ts +95 -0
  70. package/src/contracts/usdt.ts +43 -0
  71. package/src/index.ts +8 -0
  72. package/src/utils/ConstantsUtil.ts +19 -1
  73. package/src/utils/ContractUtil.ts +13 -0
  74. package/src/utils/DateUtil.ts +47 -0
  75. package/src/utils/ErrorUtil.ts +35 -0
  76. package/src/utils/NamesUtil.ts +10 -0
  77. package/src/utils/NumberUtil.ts +31 -0
  78. package/src/utils/StringUtil.ts +9 -0
  79. package/src/utils/TypeUtil.ts +89 -0
@@ -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,35 @@
1
+ export const ErrorUtil = {
2
+ UniversalProviderErrors: {
3
+ UNAUTHORIZED_DOMAIN_NOT_ALLOWED: {
4
+ message: 'Unauthorized: origin not allowed',
5
+ alertErrorKey: 'INVALID_APP_CONFIGURATION'
6
+ },
7
+ PROJECT_ID_NOT_CONFIGURED: {
8
+ message: 'Project ID is missing',
9
+ alertErrorKey: 'PROJECT_ID_NOT_CONFIGURED'
10
+ },
11
+ JWT_VALIDATION_ERROR: {
12
+ message: 'JWT validation error: JWT Token is not yet valid',
13
+ alertErrorKey: 'JWT_TOKEN_NOT_VALID'
14
+ }
15
+ },
16
+ ALERT_ERRORS: {
17
+ INVALID_APP_CONFIGURATION: {
18
+ shortMessage: 'Invalid App Configuration',
19
+ longMessage: `Bundle ID not found on Allowlist - Please verify that your bundle ID is allowed at https://cloud.reown.com`
20
+ },
21
+ SOCIALS_TIMEOUT: {
22
+ shortMessage: 'Invalid App Configuration',
23
+ longMessage: 'There was an issue loading the embedded wallet. Please verify that your bundle ID is allowed at https://cloud.reown.com'
24
+ },
25
+ JWT_TOKEN_NOT_VALID: {
26
+ shortMessage: 'Session Expired',
27
+ longMessage: 'Invalid session found - please check your time settings and connect again'
28
+ },
29
+ PROJECT_ID_NOT_CONFIGURED: {
30
+ shortMessage: 'Project ID Not Configured',
31
+ longMessage: 'Project ID Not Configured - update configuration'
32
+ }
33
+ }
34
+ };
35
+ //# sourceMappingURL=ErrorUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ErrorUtil","UniversalProviderErrors","UNAUTHORIZED_DOMAIN_NOT_ALLOWED","message","alertErrorKey","PROJECT_ID_NOT_CONFIGURED","JWT_VALIDATION_ERROR","ALERT_ERRORS","INVALID_APP_CONFIGURATION","shortMessage","longMessage","SOCIALS_TIMEOUT","JWT_TOKEN_NOT_VALID"],"sourceRoot":"../../../src","sources":["utils/ErrorUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG;EACvBC,uBAAuB,EAAE;IACvBC,+BAA+B,EAAE;MAC/BC,OAAO,EAAE,kCAAkC;MAC3CC,aAAa,EAAE;IACjB,CAAC;IACDC,yBAAyB,EAAE;MACzBF,OAAO,EAAE,uBAAuB;MAChCC,aAAa,EAAE;IACjB,CAAC;IACDE,oBAAoB,EAAE;MACpBH,OAAO,EAAE,kDAAkD;MAC3DC,aAAa,EAAE;IACjB;EACF,CAAC;EACDG,YAAY,EAAE;IACZC,yBAAyB,EAAE;MACzBC,YAAY,EAAE,2BAA2B;MACzCC,WAAW,EAAG;IAChB,CAAC;IACDC,eAAe,EAAE;MACfF,YAAY,EAAE,2BAA2B;MACzCC,WAAW,EACT;IACJ,CAAC;IACDE,mBAAmB,EAAE;MACnBH,YAAY,EAAE,iBAAiB;MAC/BC,WAAW,EAAE;IACf,CAAC;IACDL,yBAAyB,EAAE;MACzBI,YAAY,EAAE,2BAA2B;MACzCC,WAAW,EAAE;IACf;EACF;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,9 @@
1
+ export const StringUtil = {
2
+ capitalize(value) {
3
+ if (!value) {
4
+ return '';
5
+ }
6
+ return value.charAt(0).toUpperCase() + value.slice(1);
7
+ }
8
+ };
9
+ //# sourceMappingURL=StringUtil.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StringUtil","capitalize","value","charAt","toUpperCase","slice"],"sourceRoot":"../../../src","sources":["utils/StringUtil.ts"],"mappings":"AAAA,OAAO,MAAMA,UAAU,GAAG;EACxBC,UAAUA,CAACC,KAAc,EAAE;IACzB,IAAI,CAACA,KAAK,EAAE;MACV,OAAO,EAAE;IACX;IAEA,OAAOA,KAAK,CAACC,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,KAAK,CAACG,KAAK,CAAC,CAAC,CAAC;EACvD;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,30 @@
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
+ constant?: undefined;
14
+ payable?: undefined;
15
+ } | {
16
+ constant: boolean;
17
+ inputs: {
18
+ name: string;
19
+ type: string;
20
+ }[];
21
+ name: string;
22
+ outputs: {
23
+ name: string;
24
+ type: string;
25
+ }[];
26
+ payable: boolean;
27
+ stateMutability: string;
28
+ type: string;
29
+ })[];
30
+ //# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8FpB,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,11 @@
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 { StringUtil } from './utils/StringUtil';
8
+ export { ErrorUtil } from './utils/ErrorUtil';
9
+ export { erc20ABI } from './contracts/erc20';
10
+ export * from './utils/TypeUtil';
3
11
  //# 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,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,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,35 @@
1
+ export declare const ErrorUtil: {
2
+ UniversalProviderErrors: {
3
+ UNAUTHORIZED_DOMAIN_NOT_ALLOWED: {
4
+ message: string;
5
+ alertErrorKey: string;
6
+ };
7
+ PROJECT_ID_NOT_CONFIGURED: {
8
+ message: string;
9
+ alertErrorKey: string;
10
+ };
11
+ JWT_VALIDATION_ERROR: {
12
+ message: string;
13
+ alertErrorKey: string;
14
+ };
15
+ };
16
+ ALERT_ERRORS: {
17
+ INVALID_APP_CONFIGURATION: {
18
+ shortMessage: string;
19
+ longMessage: string;
20
+ };
21
+ SOCIALS_TIMEOUT: {
22
+ shortMessage: string;
23
+ longMessage: string;
24
+ };
25
+ JWT_TOKEN_NOT_VALID: {
26
+ shortMessage: string;
27
+ longMessage: string;
28
+ };
29
+ PROJECT_ID_NOT_CONFIGURED: {
30
+ shortMessage: string;
31
+ longMessage: string;
32
+ };
33
+ };
34
+ };
35
+ //# sourceMappingURL=ErrorUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ErrorUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/ErrorUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkCrB,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,4 @@
1
+ export declare const StringUtil: {
2
+ capitalize(value?: string): string;
3
+ };
4
+ //# sourceMappingURL=StringUtil.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringUtil.d.ts","sourceRoot":"","sources":["../../../src/utils/StringUtil.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;uBACF,MAAM;CAO1B,CAAC"}
@@ -0,0 +1,79 @@
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 type SocialProvider = 'apple' | 'x' | 'discord' | 'farcaster';
78
+ export {};
79
+ //# 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;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,GAAG,GAAG,SAAS,GAAG,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reown/appkit-common-react-native",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
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,12 +27,12 @@
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/",
package/readme.md CHANGED
@@ -1,6 +1,6 @@
1
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
5
  #### 🔗 [Website](https://reown.com/appkit)
6
6
 
@@ -0,0 +1,95 @@
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
+ {
49
+ constant: true,
50
+ inputs: [],
51
+ name: 'symbol',
52
+ outputs: [
53
+ {
54
+ name: '',
55
+ type: 'string'
56
+ }
57
+ ],
58
+ payable: false,
59
+ stateMutability: 'view',
60
+ type: 'function'
61
+ },
62
+ {
63
+ constant: true,
64
+ inputs: [],
65
+ name: 'decimals',
66
+ outputs: [
67
+ {
68
+ name: '',
69
+ type: 'uint8'
70
+ }
71
+ ],
72
+ payable: false,
73
+ stateMutability: 'view',
74
+ type: 'function'
75
+ },
76
+ {
77
+ constant: true,
78
+ inputs: [
79
+ {
80
+ name: '_owner',
81
+ type: 'address'
82
+ }
83
+ ],
84
+ name: 'balanceOf',
85
+ outputs: [
86
+ {
87
+ name: 'balance',
88
+ type: 'uint256'
89
+ }
90
+ ],
91
+ payable: false,
92
+ stateMutability: 'view',
93
+ type: 'function'
94
+ }
95
+ ];
@@ -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,10 @@
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 { StringUtil } from './utils/StringUtil';
8
+ export { ErrorUtil } from './utils/ErrorUtil';
9
+ export { erc20ABI } from './contracts/erc20';
10
+ export * from './utils/TypeUtil';