otomato-sdk 1.5.79 → 1.5.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ export const LOGIC_OPERATORS = {
2
+ AND: 'and',
3
+ OR: 'or',
4
+ };
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '1.5.78';
1
+ export const SDK_VERSION = '1.5.80';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -0,0 +1,15 @@
1
+ // ConditionCheck.ts
2
+ export class ConditionCheck {
3
+ constructor(value1, condition, value2) {
4
+ this.value1 = value1;
5
+ this.condition = condition;
6
+ this.value2 = value2;
7
+ }
8
+ toJSON() {
9
+ return {
10
+ value1: this.value1,
11
+ condition: this.condition,
12
+ value2: this.value2,
13
+ };
14
+ }
15
+ }
@@ -0,0 +1,18 @@
1
+ // ConditionGroup.ts
2
+ import { ConditionCheck } from './ConditionCheck.js';
3
+ export class ConditionGroup {
4
+ constructor(logic = 'and') {
5
+ this.logic = logic;
6
+ this.checks = [];
7
+ }
8
+ addConditionCheck(value1, condition, value2) {
9
+ const check = new ConditionCheck(value1, condition, value2);
10
+ this.checks.push(check);
11
+ }
12
+ toJSON() {
13
+ return {
14
+ logic: this.logic,
15
+ checks: this.checks.map((check) => check.toJSON()),
16
+ };
17
+ }
18
+ }
@@ -31,6 +31,12 @@ export function convertToTokenUnitsFromSymbol(amount, chainId, symbol) {
31
31
  return adjustedAmount;
32
32
  });
33
33
  }
34
+ export function convertToTokenUnitsFromDecimals(amount, decimals) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ const adjustedAmount = ethers.parseUnits(amount.toString(), decimals);
37
+ return adjustedAmount;
38
+ });
39
+ }
34
40
  export function convertTokenUnitsFromSymbol(amount, chainId, symbol) {
35
41
  return __awaiter(this, void 0, void 0, function* () {
36
42
  const token = yield getTokenFromSymbol(chainId, symbol);
@@ -47,6 +53,12 @@ export function convertTokenUnitsFromAddress(amount, chainId, contractAddress) {
47
53
  return Number(amount) / Math.pow(10, decimals);
48
54
  });
49
55
  }
56
+ export function convertTokenUnitsFromDecimals(amount, decimals) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ // Convert to float using division
59
+ return Number(amount) / Math.pow(10, decimals);
60
+ });
61
+ }
50
62
  /**
51
63
  * Compares two Ethereum addresses after normalizing them to lowercase.
52
64
  * @param address1 - The first Ethereum address to compare.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const LOGIC_OPERATORS: {
2
+ AND: string;
3
+ OR: string;
4
+ };
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "1.5.78";
1
+ export declare const SDK_VERSION = "1.5.80";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
@@ -0,0 +1,11 @@
1
+ export declare class ConditionCheck {
2
+ value1: any;
3
+ condition: string;
4
+ value2: any;
5
+ constructor(value1: any, condition: string, value2: any);
6
+ toJSON(): {
7
+ value1: any;
8
+ condition: string;
9
+ value2: any;
10
+ };
11
+ }
@@ -0,0 +1,15 @@
1
+ import { ConditionCheck } from './ConditionCheck.js';
2
+ export declare class ConditionGroup {
3
+ logic: string;
4
+ checks: ConditionCheck[];
5
+ constructor(logic?: string);
6
+ addConditionCheck(value1: any, condition: string, value2: any): void;
7
+ toJSON(): {
8
+ logic: string;
9
+ checks: {
10
+ value1: any;
11
+ condition: string;
12
+ value2: any;
13
+ }[];
14
+ };
15
+ }
@@ -1,8 +1,10 @@
1
1
  import { ethers } from 'ethers';
2
2
  export declare function convertToTokenUnits(amount: number, chainId: number, contractAddress: string): Promise<ethers.BigNumberish>;
3
3
  export declare function convertToTokenUnitsFromSymbol(amount: number, chainId: number, symbol: string): Promise<ethers.BigNumberish>;
4
+ export declare function convertToTokenUnitsFromDecimals(amount: number, decimals: number): Promise<ethers.BigNumberish>;
4
5
  export declare function convertTokenUnitsFromSymbol(amount: bigint, chainId: number, symbol: string): Promise<number>;
5
6
  export declare function convertTokenUnitsFromAddress(amount: bigint, chainId: number, contractAddress: string): Promise<number>;
7
+ export declare function convertTokenUnitsFromDecimals(amount: bigint, decimals: number): Promise<number>;
6
8
  /**
7
9
  * Compares two Ethereum addresses after normalizing them to lowercase.
8
10
  * @param address1 - The first Ethereum address to compare.
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "1.5.79",
3
+ "version": "1.5.80",
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",