@strkfarm/sdk 1.0.58 → 1.0.60

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strkfarm/sdk",
3
- "version": "1.0.58",
3
+ "version": "1.0.60",
4
4
  "description": "STRKFarm TS SDK (Meant for our internal use, but feel free to use it)",
5
5
  "typings": "dist/index.d.ts",
6
6
  "types": "dist/index.d.ts",
@@ -54,11 +54,12 @@
54
54
  "@types/react": "^19.1.2",
55
55
  "axios": "^1.7.2",
56
56
  "react": "19.1.0",
57
- "starknet": "^6.11.0"
57
+ "starknet": "7.6.4"
58
58
  },
59
59
  "dependencies": {
60
60
  "@avnu/avnu-sdk": "3.0.2",
61
61
  "@ericnordelo/strk-merkle-tree": "^1.0.0",
62
+ "@scure/starknet": "^2.0.0",
62
63
  "bignumber.js": "4.0.4",
63
64
  "browser-assert": "^1.2.1",
64
65
  "chalk": "^4.1.2",
@@ -1,5 +1,5 @@
1
1
  import { ContractAddr, Web3Number } from "@/dataTypes";
2
- import { BlockIdentifier, RpcProvider } from "starknet";
2
+ import { BlockIdentifier, constants, RpcProvider } from "starknet";
3
3
  import React, { ReactNode } from "react";
4
4
 
5
5
  export enum RiskType {
@@ -107,12 +107,14 @@ export interface IInvestmentFlow {
107
107
 
108
108
  export function getMainnetConfig(
109
109
  rpcUrl: string = 'https://starknet-mainnet.public.blastapi.io',
110
- blockIdentifier: BlockIdentifier = "pending"
110
+ blockIdentifier: BlockIdentifier = "pending",
111
+ // specVersion = constants.SupportedRpcVersion.v0_8_1
111
112
  ): IConfig {
112
113
  return {
113
114
  provider: new RpcProvider({
114
115
  nodeUrl: rpcUrl,
115
- blockIdentifier: blockIdentifier
116
+ blockIdentifier: blockIdentifier,
117
+ // specVersion
116
118
  }),
117
119
  stage: "production",
118
120
  network: Network.mainnet
@@ -144,7 +146,7 @@ export const getRiskExplaination = (riskType: RiskType) => {
144
146
 
145
147
  export const getRiskColor = (risk: RiskFactor) => {
146
148
  const value = risk.value;
147
- if (value <= 1) return "light_green_2";
149
+ if (value <= 2) return "light_green_2";
148
150
  if (value < 3) return "yellow";
149
151
  return "red";
150
152
  };
@@ -214,6 +216,18 @@ const VesuProtocol: IProtocol = {
214
216
  logo: "https://static-assets-8zct.onrender.com/integrations/vesu/logo.png"
215
217
  };
216
218
 
219
+ const EndurProtocol: IProtocol = {
220
+ name: "Endur",
221
+ logo: "http://endur.fi/logo.png"
222
+ }
223
+
224
+ const ExtendedProtocol: IProtocol = {
225
+ name: "Extended",
226
+ logo: "https://static-assets-8zct.onrender.com/integrations/extended/extended.svg"
227
+ };
228
+
217
229
  export const Protocols = {
218
230
  VESU: VesuProtocol,
231
+ ENDUR: EndurProtocol,
232
+ EXTENDED: ExtendedProtocol
219
233
  }
@@ -96,7 +96,7 @@ async function deployContract(contract_name: string, classHash: string, construc
96
96
  classHash,
97
97
  constructorCalldata: constructorData,
98
98
  })
99
- console.log("Deploy fee", contract_name, Number(fee.suggestedMaxFee) / 10 ** 18, 'ETH')
99
+ console.log("Deploy fee", contract_name, Number(fee.overall_fee) / 10 ** 18, 'ETH')
100
100
 
101
101
  const tx = await acc.deployContract({
102
102
  classHash,
@@ -1,6 +1,6 @@
1
1
  import { ContractAddr } from "@/dataTypes";
2
2
 
3
- export const SIMPLE_SANITIZER = ContractAddr.from('0x11b59e89b35dfceb3e48ec18c01f8ec569592026c275bcb58e22af9f4dedaac');
3
+ export const SIMPLE_SANITIZER = ContractAddr.from('0x3798dc4f83fdfad199e5236e3656cf2fb79bc50c00504d0dd41522e0f042072');
4
4
 
5
5
  export function toBigInt(value: string | number): bigint {
6
6
  if (typeof value === 'string') {
@@ -14,6 +14,8 @@ export interface ApproveCallParams {
14
14
 
15
15
  export interface CommonAdapterConfig {
16
16
  id: string,
17
+ vaultAddress: ContractAddr,
18
+ vaultAllocator: ContractAddr,
17
19
  manager: ContractAddr,
18
20
  asset: ContractAddr
19
21
  }
@@ -93,4 +95,33 @@ export class CommonAdapter extends BaseAdapter {
93
95
  }
94
96
  }
95
97
  }
98
+
99
+ getBringLiquidityAdapter(id: string): () => AdapterLeafType<ApproveCallParams> {
100
+ return () => ({
101
+ leaf: this.constructSimpleLeafData({
102
+ id: id,
103
+ target: this.config.vaultAddress,
104
+ method: 'bring_liquidity',
105
+ packedArguments: []
106
+ }),
107
+ callConstructor: this.getBringLiquidityCall().bind(this)
108
+ });
109
+ }
110
+
111
+ getBringLiquidityCall() {
112
+ return (params: ApproveCallParams) => {
113
+ const uint256Amount = uint256.bnToUint256(params.amount.toWei());
114
+ return {
115
+ sanitizer: SIMPLE_SANITIZER,
116
+ call: {
117
+ contractAddress: this.config.vaultAddress,
118
+ selector: hash.getSelectorFromName('bring_liquidity'),
119
+ calldata: [
120
+ toBigInt(uint256Amount.low.toString()), // amount low
121
+ toBigInt(uint256Amount.high.toString()), // amount high
122
+ ]
123
+ }
124
+ }
125
+ }
126
+ }
96
127
  }