otomato-sdk 1.5.8 → 1.5.10

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.
@@ -152,7 +152,7 @@ export function getTokenFromSymbol(chain, symbol) {
152
152
  if (!(chain in TOKENS)) {
153
153
  throw new Error(`Unsupported chain: ${chain}`);
154
154
  }
155
- const token = TOKENS[chain].find(token => token.symbol === symbol);
155
+ const token = TOKENS[chain].find(token => token.symbol.toLowerCase() === symbol.toLowerCase());
156
156
  if (!token) {
157
157
  throw new Error(`Token ${symbol} not found on chain ${chain}`);
158
158
  }
@@ -17,3 +17,16 @@ export function convertToTokenUnits(amount, chainId, contractAddress) {
17
17
  return adjustedAmount;
18
18
  });
19
19
  }
20
+ /**
21
+ * Compares two Ethereum addresses after normalizing them to lowercase.
22
+ * @param address1 - The first Ethereum address to compare.
23
+ * @param address2 - The second Ethereum address to compare.
24
+ * @returns boolean - True if the addresses are equal, false otherwise.
25
+ */
26
+ export function compareAddresses(address1, address2) {
27
+ // Normalize the addresses by converting them to lowercase
28
+ const normalizedAddress1 = address1.toLowerCase();
29
+ const normalizedAddress2 = address2.toLowerCase();
30
+ // Compare the normalized addresses
31
+ return normalizedAddress1 === normalizedAddress2;
32
+ }
@@ -29,6 +29,8 @@ export function validateType(expectedType, value) {
29
29
  case 'fixed':
30
30
  case 'ufixed':
31
31
  return typeof value === 'number';
32
+ case 'percentage':
33
+ return typeof value === 'number' && value >= 0 && value <= 100;
32
34
  case 'url':
33
35
  return typeof value === 'string' && isValidUrl(value);
34
36
  case 'phone_number':
@@ -1,2 +1,9 @@
1
1
  import { ethers } from 'ethers';
2
2
  export declare function convertToTokenUnits(amount: number, chainId: number, contractAddress: string): Promise<ethers.BigNumberish>;
3
+ /**
4
+ * Compares two Ethereum addresses after normalizing them to lowercase.
5
+ * @param address1 - The first Ethereum address to compare.
6
+ * @param address2 - The second Ethereum address to compare.
7
+ * @returns boolean - True if the addresses are equal, false otherwise.
8
+ */
9
+ export declare function compareAddresses(address1: string, address2: string): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "An SDK for building and managing automations on Otomato",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/types/src/index.d.ts",