@strkfarm/sdk 2.0.0-staging.18 → 2.0.0-staging.19

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.
@@ -17936,16 +17936,16 @@ ${r2}}` : "}", l2;
17936
17936
  solidityUint256PackedKeccak256: () => solidityUint256PackedKeccak2562,
17937
17937
  starknetKeccak: () => starknetKeccak2
17938
17938
  });
17939
- var import_starknet25 = require_lib3();
17939
+ var import_starknet26 = require_lib3();
17940
17940
  var import_sha34 = require_sha3();
17941
17941
  var import_utils210 = require_utils2();
17942
17942
  function keccakBn2(value) {
17943
17943
  const hexWithoutPrefix = removeHexPrefix2(toHex3(BigInt(value)));
17944
17944
  const evenHex = hexWithoutPrefix.length % 2 === 0 ? hexWithoutPrefix : `0${hexWithoutPrefix}`;
17945
- return addHexPrefix2((0, import_starknet25.keccak)(hexToBytes5(addHexPrefix2(evenHex))).toString(16));
17945
+ return addHexPrefix2((0, import_starknet26.keccak)(hexToBytes5(addHexPrefix2(evenHex))).toString(16));
17946
17946
  }
17947
17947
  function keccakHex2(str) {
17948
- return addHexPrefix2((0, import_starknet25.keccak)(utf8ToArray2(str)).toString(16));
17948
+ return addHexPrefix2((0, import_starknet26.keccak)(utf8ToArray2(str)).toString(16));
17949
17949
  }
17950
17950
  function starknetKeccak2(str) {
17951
17951
  const hash3 = BigInt(keccakHex2(str));
@@ -20192,7 +20192,7 @@ ${r2}}` : "}", l2;
20192
20192
  hashDAMode: () => hashDAMode2,
20193
20193
  hashFeeField: () => hashFeeField
20194
20194
  });
20195
- var import_starknet26 = require_lib3();
20195
+ var import_starknet27 = require_lib3();
20196
20196
  var AToBI2 = (array) => array.map((it) => BigInt(it));
20197
20197
  var DATA_AVAILABILITY_MODE_BITS2 = 32n;
20198
20198
  var MAX_AMOUNT_BITS2 = 64n;
@@ -20212,7 +20212,7 @@ ${r2}}` : "}", l2;
20212
20212
  function hashFeeField(tip, bounds) {
20213
20213
  const L1Bound = encodeResourceBoundsL12(bounds);
20214
20214
  const L2Bound = encodeResourceBoundsL22(bounds);
20215
- return (0, import_starknet26.poseidonHashMany)([BigInt(tip), L1Bound, L2Bound]);
20215
+ return (0, import_starknet27.poseidonHashMany)([BigInt(tip), L1Bound, L2Bound]);
20216
20216
  }
20217
20217
  function calculateTransactionHashCommon22(txHashPrefix, version5, senderAddress, chainId, nonce, tip, paymasterData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, additionalData = []) {
20218
20218
  const feeFieldHash = hashFeeField(tip, resourceBounds);
@@ -20222,13 +20222,13 @@ ${r2}}` : "}", l2;
20222
20222
  version5,
20223
20223
  senderAddress,
20224
20224
  feeFieldHash,
20225
- (0, import_starknet26.poseidonHashMany)(AToBI2(paymasterData)),
20225
+ (0, import_starknet27.poseidonHashMany)(AToBI2(paymasterData)),
20226
20226
  chainId,
20227
20227
  nonce,
20228
20228
  dAModeHash,
20229
20229
  ...AToBI2(additionalData)
20230
20230
  ]);
20231
- return toHex3((0, import_starknet26.poseidonHashMany)(dataToHash));
20231
+ return toHex3((0, import_starknet27.poseidonHashMany)(dataToHash));
20232
20232
  }
20233
20233
  function calculateDeployAccountTransactionHash22(contractAddress, classHash, compiledConstructorCalldata, salt, version5, chainId, nonce, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
20234
20234
  return calculateTransactionHashCommon22(
@@ -20242,7 +20242,7 @@ ${r2}}` : "}", l2;
20242
20242
  nonceDataAvailabilityMode,
20243
20243
  feeDataAvailabilityMode,
20244
20244
  resourceBounds,
20245
- [(0, import_starknet26.poseidonHashMany)(AToBI2(compiledConstructorCalldata)), classHash, salt]
20245
+ [(0, import_starknet27.poseidonHashMany)(AToBI2(compiledConstructorCalldata)), classHash, salt]
20246
20246
  );
20247
20247
  }
20248
20248
  function calculateDeclareTransactionHash22(classHash, compiledClassHash, senderAddress, version5, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
@@ -20257,7 +20257,7 @@ ${r2}}` : "}", l2;
20257
20257
  nonceDataAvailabilityMode,
20258
20258
  feeDataAvailabilityMode,
20259
20259
  resourceBounds,
20260
- [(0, import_starknet26.poseidonHashMany)(AToBI2(accountDeploymentData)), classHash, compiledClassHash]
20260
+ [(0, import_starknet27.poseidonHashMany)(AToBI2(accountDeploymentData)), classHash, compiledClassHash]
20261
20261
  );
20262
20262
  }
20263
20263
  function calculateInvokeTransactionHash3(senderAddress, version5, compiledCalldata, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
@@ -20272,7 +20272,7 @@ ${r2}}` : "}", l2;
20272
20272
  nonceDataAvailabilityMode,
20273
20273
  feeDataAvailabilityMode,
20274
20274
  resourceBounds,
20275
- [(0, import_starknet26.poseidonHashMany)(AToBI2(accountDeploymentData)), (0, import_starknet26.poseidonHashMany)(AToBI2(compiledCalldata))]
20275
+ [(0, import_starknet27.poseidonHashMany)(AToBI2(accountDeploymentData)), (0, import_starknet27.poseidonHashMany)(AToBI2(compiledCalldata))]
20276
20276
  );
20277
20277
  }
20278
20278
  function isV3InvokeTx2(args) {
@@ -30607,91 +30607,6 @@ ${JSON.stringify(data, null, 2)}`;
30607
30607
 
30608
30608
  // src/dataTypes/_bignumber.ts
30609
30609
  var import_bignumber = __toESM(require_bignumber());
30610
- var _Web3Number = class extends import_bignumber.default {
30611
- constructor(value, decimals) {
30612
- super(value);
30613
- this.decimals = decimals;
30614
- }
30615
- toWei() {
30616
- return super.mul(10 ** this.decimals).toFixed(0);
30617
- }
30618
- multipliedBy(value) {
30619
- const _value2 = this.getStandardString(value);
30620
- return this.construct(super.mul(_value2).toString(), this.decimals);
30621
- }
30622
- dividedBy(value) {
30623
- const _value2 = this.getStandardString(value);
30624
- return this.construct(super.dividedBy(_value2).toString(), this.decimals);
30625
- }
30626
- plus(value) {
30627
- const rawValue = this.getStandardString(value);
30628
- const thisBN = new import_bignumber.default(this.toString());
30629
- const result2 = thisBN.plus(rawValue);
30630
- return this.construct(result2.toString(), this.decimals);
30631
- }
30632
- minus(n2, base2) {
30633
- const rawValue = this.getStandardString(n2);
30634
- const thisBN = new import_bignumber.default(this.toString());
30635
- const result2 = thisBN.minus(rawValue, base2);
30636
- return this.construct(result2.toString(), this.decimals);
30637
- }
30638
- construct(value, decimals) {
30639
- return new this.constructor(value, decimals);
30640
- }
30641
- toString() {
30642
- return super.toString();
30643
- }
30644
- toJSON() {
30645
- return this.toString();
30646
- }
30647
- valueOf() {
30648
- return this.toString();
30649
- }
30650
- maxToFixedDecimals() {
30651
- return Math.min(this.decimals, 18);
30652
- }
30653
- getStandardString(value) {
30654
- if (typeof value === "string") {
30655
- return value;
30656
- }
30657
- if (typeof value === "number") {
30658
- return value.toString();
30659
- }
30660
- return import_bignumber.default.prototype.toString.call(value);
30661
- }
30662
- minimum(value) {
30663
- const _value2 = new import_bignumber.default(value);
30664
- const _valueMe = new import_bignumber.default(this.toString());
30665
- const answer = _value2.lessThanOrEqualTo(_valueMe) ? _value2 : _valueMe;
30666
- return this.construct(answer.toString(), this.decimals);
30667
- }
30668
- maximum(value) {
30669
- const _value2 = new import_bignumber.default(value);
30670
- const _valueMe = new import_bignumber.default(this.toString());
30671
- const answer = _value2.greaterThanOrEqualTo(_valueMe) ? _value2 : _valueMe;
30672
- return this.construct(answer.toString(), this.decimals);
30673
- }
30674
- abs() {
30675
- return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
30676
- }
30677
- toI129() {
30678
- const sign2 = this.isNegative() ? 1 : 0;
30679
- return {
30680
- mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
30681
- sign: sign2
30682
- };
30683
- }
30684
- };
30685
- import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
30686
- _Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
30687
-
30688
- // src/dataTypes/bignumber.browser.ts
30689
- var Web3Number = class _Web3Number2 extends _Web3Number {
30690
- static fromWei(weiNumber, decimals) {
30691
- const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
30692
- return new _Web3Number2(bn.toString(), decimals);
30693
- }
30694
- };
30695
30610
 
30696
30611
  // node_modules/.pnpm/@starknet-io+types-js@0.9.2/node_modules/@starknet-io/types-js/dist/esm/index.js
30697
30612
  var esm_exports = {};
@@ -49171,6 +49086,96 @@ ${JSON.stringify(data, null, 2)}`;
49171
49086
  };
49172
49087
  var export_TypedDataRevision = api_exports3.TypedDataRevision;
49173
49088
 
49089
+ // src/dataTypes/_bignumber.ts
49090
+ var _Web3Number = class extends import_bignumber.default {
49091
+ constructor(value, decimals) {
49092
+ super(value);
49093
+ this.decimals = decimals;
49094
+ }
49095
+ toWei() {
49096
+ return super.mul(10 ** this.decimals).toFixed(0);
49097
+ }
49098
+ multipliedBy(value) {
49099
+ const _value2 = this.getStandardString(value);
49100
+ return this.construct(super.mul(_value2).toString(), this.decimals);
49101
+ }
49102
+ dividedBy(value) {
49103
+ const _value2 = this.getStandardString(value);
49104
+ return this.construct(super.dividedBy(_value2).toString(), this.decimals);
49105
+ }
49106
+ plus(value) {
49107
+ const rawValue = this.getStandardString(value);
49108
+ const thisBN = new import_bignumber.default(this.toString());
49109
+ const result2 = thisBN.plus(rawValue);
49110
+ return this.construct(result2.toString(), this.decimals);
49111
+ }
49112
+ minus(n2, base2) {
49113
+ const rawValue = this.getStandardString(n2);
49114
+ const thisBN = new import_bignumber.default(this.toString());
49115
+ const result2 = thisBN.minus(rawValue, base2);
49116
+ return this.construct(result2.toString(), this.decimals);
49117
+ }
49118
+ construct(value, decimals) {
49119
+ return new this.constructor(value, decimals);
49120
+ }
49121
+ toString() {
49122
+ return super.toString();
49123
+ }
49124
+ toJSON() {
49125
+ return this.toString();
49126
+ }
49127
+ valueOf() {
49128
+ return this.toString();
49129
+ }
49130
+ maxToFixedDecimals() {
49131
+ return Math.min(this.decimals, 18);
49132
+ }
49133
+ getStandardString(value) {
49134
+ if (typeof value === "string") {
49135
+ return value;
49136
+ }
49137
+ if (typeof value === "number") {
49138
+ return value.toString();
49139
+ }
49140
+ return import_bignumber.default.prototype.toString.call(value);
49141
+ }
49142
+ minimum(value) {
49143
+ const _value2 = new import_bignumber.default(value);
49144
+ const _valueMe = new import_bignumber.default(this.toString());
49145
+ const answer = _value2.lessThanOrEqualTo(_valueMe) ? _value2 : _valueMe;
49146
+ return this.construct(answer.toString(), this.decimals);
49147
+ }
49148
+ maximum(value) {
49149
+ const _value2 = new import_bignumber.default(value);
49150
+ const _valueMe = new import_bignumber.default(this.toString());
49151
+ const answer = _value2.greaterThanOrEqualTo(_valueMe) ? _value2 : _valueMe;
49152
+ return this.construct(answer.toString(), this.decimals);
49153
+ }
49154
+ abs() {
49155
+ return this.construct(Math.abs(this.toNumber()).toFixed(12), this.decimals);
49156
+ }
49157
+ toI129() {
49158
+ const sign2 = this.isNegative() ? 1 : 0;
49159
+ return {
49160
+ mag: BigInt(this.toWei()) * (this.isNegative() ? -1n : 1n),
49161
+ sign: sign2
49162
+ };
49163
+ }
49164
+ toUint256() {
49165
+ return uint256_exports.bnToUint256(this.toWei());
49166
+ }
49167
+ };
49168
+ import_bignumber.default.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
49169
+ _Web3Number.config({ DECIMAL_PLACES: 18, ROUNDING_MODE: import_bignumber.default.ROUND_DOWN });
49170
+
49171
+ // src/dataTypes/bignumber.browser.ts
49172
+ var Web3Number = class _Web3Number2 extends _Web3Number {
49173
+ static fromWei(weiNumber, decimals) {
49174
+ const bn = new _Web3Number2(weiNumber, decimals).dividedBy(10 ** decimals);
49175
+ return new _Web3Number2(bn.toString(), decimals);
49176
+ }
49177
+ };
49178
+
49174
49179
  // src/dataTypes/address.ts
49175
49180
  var ContractAddr = class _ContractAddr {
49176
49181
  constructor(address) {
@@ -103866,14 +103871,21 @@ spurious results.`);
103866
103871
  handleFeesCall() {
103867
103872
  return [this.contract.populate("handle_fees", [])];
103868
103873
  }
103869
- async getFeeHistory(timePeriod = "24h") {
103874
+ async getFeeHistory(timePeriod = "24h", range2) {
103870
103875
  const { data } = await apollo_client_default.query({
103871
103876
  query: gql`
103872
103877
  query ContractFeeEarnings(
103873
103878
  $timeframe: String!
103874
103879
  $contract: String!
103880
+ $startTimestamp: Float
103881
+ $endTimestamp: Float
103875
103882
  ) {
103876
- contractFeeEarnings(timeframe: $timeframe, contract: $contract) {
103883
+ contractFeeEarnings(
103884
+ timeframe: $timeframe
103885
+ contract: $contract
103886
+ startTimestamp: $startTimestamp
103887
+ endTimestamp: $endTimestamp
103888
+ ) {
103877
103889
  contract
103878
103890
  dailyEarnings {
103879
103891
  date
@@ -103886,7 +103898,9 @@ spurious results.`);
103886
103898
  `,
103887
103899
  variables: {
103888
103900
  timeframe: timePeriod,
103889
- contract: this.address.address
103901
+ contract: this.address.address,
103902
+ startTimestamp: range2?.startTimestamp,
103903
+ endTimestamp: range2?.endTimestamp
103890
103904
  },
103891
103905
  fetchPolicy: "no-cache"
103892
103906
  });
@@ -115049,15 +115063,15 @@ spurious results.`);
115049
115063
  }
115050
115064
  };
115051
115065
  };
115052
- this.getVesuModifyDelegationAdapter = (id2) => {
115066
+ this.getVesuModifyDelegationAdapter = (id2, delegatee) => {
115053
115067
  return () => {
115054
115068
  const { addr: VESU_SINGLETON2, isV2 } = getVesuSingletonAddress(this.config.poolId);
115055
115069
  const packedArguments = isV2 ? [
115056
- toBigInt3(this.VESU_MULTIPLY.toString())
115070
+ toBigInt3(delegatee.toString())
115057
115071
  // v2
115058
115072
  ] : [
115059
115073
  this.config.poolId.toBigInt(),
115060
- toBigInt3(this.VESU_MULTIPLY_V1.toString())
115074
+ toBigInt3(delegatee.toString())
115061
115075
  // v1
115062
115076
  ];
115063
115077
  const output2 = this.constructSimpleLeafData({
@@ -115066,29 +115080,31 @@ spurious results.`);
115066
115080
  method: "modify_delegation",
115067
115081
  packedArguments
115068
115082
  }, isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS);
115069
- return { leaf: output2, callConstructor: this.getVesuModifyDelegationCall.bind(this) };
115083
+ return { leaf: output2, callConstructor: this.getVesuModifyDelegationCall(delegatee).bind(this) };
115070
115084
  };
115071
115085
  };
115072
- this.getVesuModifyDelegationCall = (params) => {
115073
- const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
115074
- const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
115075
- const call = contract.populate("modify_delegation", isV2 ? {
115076
- delegatee: this.VESU_MULTIPLY.toBigInt(),
115077
- delegation: params.delegation
115078
- } : {
115079
- pool_id: this.config.poolId.toBigInt(),
115080
- delegatee: this.VESU_MULTIPLY_V1.toBigInt(),
115081
- delegation: params.delegation
115082
- });
115083
- return {
115084
- sanitizer: isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS,
115085
- call: {
115086
- contractAddress: VESU_SINGLETON2,
115087
- selector: hash_exports.getSelectorFromName("modify_delegation"),
115088
- calldata: [
115089
- ...call.calldata
115090
- ]
115091
- }
115086
+ this.getVesuModifyDelegationCall = (delegatee) => {
115087
+ return (params) => {
115088
+ const VESU_SINGLETON2 = getVesuSingletonAddress(this.config.poolId).addr;
115089
+ const { contract, isV2 } = this.getVesuSingletonContract(getMainnetConfig(), this.config.poolId);
115090
+ const call = contract.populate("modify_delegation", isV2 ? {
115091
+ delegatee: delegatee.toBigInt(),
115092
+ delegation: params.delegation
115093
+ } : {
115094
+ pool_id: this.config.poolId.toBigInt(),
115095
+ delegatee: delegatee.toBigInt(),
115096
+ delegation: params.delegation
115097
+ });
115098
+ return {
115099
+ sanitizer: isV2 ? SIMPLE_SANITIZER_V2 : SIMPLE_SANITIZER_VESU_V1_DELEGATIONS,
115100
+ call: {
115101
+ contractAddress: VESU_SINGLETON2,
115102
+ selector: hash_exports.getSelectorFromName("modify_delegation"),
115103
+ calldata: [
115104
+ ...call.calldata
115105
+ ]
115106
+ }
115107
+ };
115092
115108
  };
115093
115109
  };
115094
115110
  this.getDefispringRewardsAdapter = (id2) => {
@@ -120068,9 +120084,9 @@ spurious results.`);
120068
120084
  const leafIdApprove = getVesuGenericLegId(poolId.toString(), "multiple_approve" /* MULTIPLE_APPROVE */);
120069
120085
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, VESU_MULTIPLY, leafIdApprove).bind(commonAdapter));
120070
120086
  const leafIdDelegationOn = getVesuGenericLegId(poolId.toString(), "switch_delegation_on" /* SWITCH_DELEGATION_ON */);
120071
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn).bind(vesuAdapterLST));
120087
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOn, VESU_MULTIPLY).bind(vesuAdapterLST));
120072
120088
  const leafIdDelegationOff = getVesuGenericLegId(poolId.toString(), "switch_delegation_off" /* SWITCH_DELEGATION_OFF */);
120073
- vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff).bind(vesuAdapterLST));
120089
+ vaultSettings.leafAdapters.push(vesuAdapterLST.getVesuModifyDelegationAdapter(leafIdDelegationOff, VESU_MULTIPLY).bind(vesuAdapterLST));
120074
120090
  const multiplID = getVesuLegId("multiply_vesu" /* MULTIPLY_VESU */, underlyingToken.symbol, poolId.toString());
120075
120091
  vaultSettings.leafAdapters.push(vesuAdapterLST.getMultiplyAdapter(multiplID).bind(vesuAdapterLST));
120076
120092
  vaultSettings.leafAdapters.push(commonAdapter.getApproveAdapter(lstToken.address, poolAddr, "approve_token1" /* APPROVE_TOKEN1 */).bind(commonAdapter));
@@ -120187,7 +120203,9 @@ spurious results.`);
120187
120203
  minHealthFactor: 1.05,
120188
120204
  borrowable_assets: [
120189
120205
  ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7xSTRK })),
120190
- ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Prime }))
120206
+ ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Prime })),
120207
+ ...Global.getDefaultTokens().filter((token) => token.symbol === "STRK").map((token) => ({ token, poolId: VesuPools.Re7STRK }))
120208
+ // v2, new alt for Re7xSTRK
120191
120209
  ],
120192
120210
  underlyingToken: Global.getDefaultTokens().find((token) => token.symbol === "STRK"),
120193
120211
  defaultPoolId: VesuPools.Re7xSTRK