otomato-sdk 2.0.103 → 2.0.104

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.
@@ -1,4 +1,4 @@
1
- export const SDK_VERSION = '2.0.103';
1
+ export const SDK_VERSION = '2.0.104';
2
2
  export function compareVersions(v1, v2) {
3
3
  // Split the version strings into parts
4
4
  const v1Parts = v1.split('.').map(Number);
@@ -8,6 +8,7 @@ export const PROTOCOLS = {
8
8
  IONIC: 'IONIC',
9
9
  MOONWELL: 'MOONWELL',
10
10
  IRONCLAD: 'IRONCLAD',
11
+ MORPHO: 'MORPHO',
11
12
  WALLET: 'WALLET',
12
13
  };
13
14
  // Minimal ABIs
@@ -29,6 +30,19 @@ const chainTokenProtocolMap = {
29
30
  { protocol: PROTOCOLS.IONIC, token: '0xa900A17a49Bc4D442bA7F72c39FA2108865671f0' },
30
31
  { protocol: PROTOCOLS.MOONWELL, token: '0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22' },
31
32
  { protocol: PROTOCOLS.WALLET, token: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913' },
33
+ { protocol: PROTOCOLS.MORPHO, token: '0x7BfA7C4f149E7415b73bdeDfe609237e29CBF34A' }, // Spark USDC Vault
34
+ { protocol: PROTOCOLS.MORPHO, token: '0xc1256Ae5FF1cf2719D4937adb3bbCCab2E00A2Ca' }, // Moonwell Flagship USDC
35
+ { protocol: PROTOCOLS.MORPHO, token: '0x616a4E1db48e22028f6bbf20444Cd3b8e3273738' }, // Seamless USDC Vault
36
+ { protocol: PROTOCOLS.MORPHO, token: '0xc0c5689e6f4D256E861F65465b691aeEcC0dEb12' }, // Gauntlet USDC Core
37
+ { protocol: PROTOCOLS.MORPHO, token: '0xeE8F4eC5672F09119b96Ab6fB59C27E1b7e44b61' }, // Gauntlet USDC Prime
38
+ { protocol: PROTOCOLS.MORPHO, token: '0xcdDCDd18A16ED441F6CB10c3909e5e7ec2B9e8f3' }, // Apostro Resolv USDC
39
+ { protocol: PROTOCOLS.MORPHO, token: '0xbeeF010f9cb27031ad51e3333f9aF9C6B1228183' }, // Steakhouse USDC
40
+ { protocol: PROTOCOLS.MORPHO, token: '0x23479229e52Ab6aaD312D0B03DF9F33B46753B5e' }, // Ionic Ecosystem USDC
41
+ { protocol: PROTOCOLS.MORPHO, token: '0x12AFDeFb2237a5963e7BAb3e2D46ad0eee70406e' }, // Re7 USDC
42
+ { protocol: PROTOCOLS.MORPHO, token: '0xB7890CEE6CF4792cdCC13489D36D9d42726ab863' }, // Universal USDC
43
+ { protocol: PROTOCOLS.MORPHO, token: '0x0FaBfEAcedf47e890c50C8120177fff69C6a1d9B' }, // Pyth USDC
44
+ { protocol: PROTOCOLS.MORPHO, token: '0xdB90A4e973B7663ce0Ccc32B6FbD37ffb19BfA83' }, // Degen USDC
45
+ { protocol: PROTOCOLS.MORPHO, token: '0xCd347c1e7d600a9A3e403497562eDd0A7Bc3Ef21' }, // Ionic Ecosystem USDC2
32
46
  ],
33
47
  // WETH on Base
34
48
  '0x4200000000000000000000000000000000000006': [
@@ -37,6 +51,27 @@ const chainTokenProtocolMap = {
37
51
  { protocol: PROTOCOLS.IONIC, token: '0x49420311B518f3d0c94e897592014de53831cfA3' },
38
52
  { protocol: PROTOCOLS.MOONWELL, token: '0x628ff693426583D9a7FB391E54366292F509D457' },
39
53
  { protocol: PROTOCOLS.WALLET, token: '0x4200000000000000000000000000000000000006' },
54
+ { protocol: PROTOCOLS.MORPHO, token: '0xa0E430870c4604CcfC7B38Ca7845B1FF653D0ff1' }, // Moonwell Flagship WETH
55
+ { protocol: PROTOCOLS.MORPHO, token: '0x27D8c7273fd3fcC6956a0B370cE5Fd4A7fc65c18' }, // Seamless WETH Vault
56
+ { protocol: PROTOCOLS.MORPHO, token: '0x6b13c060F13Af1fdB319F52315BbbF3fb1D88844' }, // Gauntlet WETH Core
57
+ { protocol: PROTOCOLS.MORPHO, token: '0x5496b42ad0deCebFab0db944D83260e60D54f667' }, // 9Summits WETH Core 1.1
58
+ { protocol: PROTOCOLS.MORPHO, token: '0xA2Cac0023a4797b4729Db94783405189a4203AFc' }, // Re7 WETH
59
+ { protocol: PROTOCOLS.MORPHO, token: '0x5A32099837D89E3a794a44fb131CBbAD41f87a8C' }, // Ionic Ecosystem WETH
60
+ { protocol: PROTOCOLS.MORPHO, token: '0x80D9964fEb4A507dD697b4437Fc5b25b618CE446' }, // Pyth ETH
61
+ { protocol: PROTOCOLS.MORPHO, token: '0xbEEf050a7485865A7a8d8Ca0CC5f7536b7a3443e' }, // Steakhouse ETH
62
+ { protocol: PROTOCOLS.MORPHO, token: '0x9aB2d181E4b87ba57D5eD564D3eF652C4E710707' }, // Ionic Ecosystem WETH 2
63
+ { protocol: PROTOCOLS.MORPHO, token: '0xF540D790413FCFAedAC93518Ae99EdDacE82cb78' }, // 9Summits WETH Core
64
+ ],
65
+ // CBBTC on Base
66
+ '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf': [
67
+ { protocol: PROTOCOLS.AAVE, token: '0xBdb9300b7CDE636d9cD4AFF00f6F009fFBBc8EE6' },
68
+ { protocol: PROTOCOLS.IONIC, token: '0x1De166df671AE6DB4C4C98903df88E8007593748' },
69
+ { protocol: PROTOCOLS.MOONWELL, token: '0xF877ACaFA28c19b96727966690b2f44d35aD5976' },
70
+ { protocol: PROTOCOLS.IRONCLAD, token: '0x58254000eE8127288387b04ce70292B56098D55C' },
71
+ { protocol: PROTOCOLS.WALLET, token: '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf' },
72
+ { protocol: PROTOCOLS.MORPHO, token: '0x5a47C803488FE2BB0A0EAaf346b420e4dF22F3C7' }, // Seamless cbBTC Vault
73
+ { protocol: PROTOCOLS.MORPHO, token: '0x543257eF2161176D7C8cD90BA65C2d4CaEF5a796' }, // Moonwell Frontier cbBTC
74
+ { protocol: PROTOCOLS.MORPHO, token: '0x6770216aC60F634483Ec073cBABC4011c94307Cb' }, // Gauntlet cbBTC Core
40
75
  ],
41
76
  },
42
77
  34443: {
@@ -126,6 +161,7 @@ export async function getUserProtocolBalances(params) {
126
161
  'function balanceOf(address) view returns (uint256)',
127
162
  'function decimals() view returns (uint8)',
128
163
  'function symbol() view returns (string)',
164
+ 'function convertToAssets(uint256) view returns (uint256)',
129
165
  ];
130
166
  const results = [];
131
167
  for (const { protocol, token } of addressesToCheck) {
@@ -154,7 +190,13 @@ export async function getUserProtocolBalances(params) {
154
190
  displayValue,
155
191
  };
156
192
  // Now do your conversion
157
- const underlyingBalance = await getBalanceInUnderlying(protocol, chainId, address, token, balanceObj, underlyingDecimals, provider);
193
+ let underlyingBalance;
194
+ if (protocol == PROTOCOLS.MORPHO) {
195
+ underlyingBalance = ethers.formatUnits(await contract.convertToAssets(rawBalance), underlyingDecimals);
196
+ }
197
+ else {
198
+ underlyingBalance = await getBalanceInUnderlying(protocol, chainId, address, token, balanceObj, underlyingDecimals, provider);
199
+ }
158
200
  results.push({
159
201
  protocol,
160
202
  wrapperTokenAddress: token,
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.103";
1
+ export declare const SDK_VERSION = "2.0.104";
2
2
  export declare function compareVersions(v1: string, v2: string): number;
@@ -4,6 +4,7 @@ export declare const PROTOCOLS: {
4
4
  readonly IONIC: "IONIC";
5
5
  readonly MOONWELL: "MOONWELL";
6
6
  readonly IRONCLAD: "IRONCLAD";
7
+ readonly MORPHO: "MORPHO";
7
8
  readonly WALLET: "WALLET";
8
9
  };
9
10
  export type Protocol = typeof PROTOCOLS[keyof typeof PROTOCOLS];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otomato-sdk",
3
- "version": "2.0.103",
3
+ "version": "2.0.104",
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",