@reown/appkit-common-react-native 0.0.0-fix-email-login-20241010173711 → 0.0.0-fix-token-balance-20241017200828

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 +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 +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 +71 -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 +30 -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 +8 -4
  56. package/readme.md +1 -1
  57. package/src/contracts/erc20.ts +95 -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,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,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,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-fix-email-login-20241010173711",
3
+ "version": "0.0.0-fix-token-balance-20241017200828",
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,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
+ };