@gvnrdao/dh-lit-actions 0.0.23 → 0.0.24

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 @@
1
+ d27c13a41c5bcc6709d851c076c5f2d38aa804a9a9e3183a2dc035dd1d6b29d7
@@ -0,0 +1,3 @@
1
+ // LIT Actions runtime provides: Lit, ethers, fetch
2
+ var _LIT_ACTION_ = (() => {
3
+ })();
@@ -1 +1 @@
1
- 487c310167d785851cb9174b523c2463359e04cfa8e24d2a6afe12a7a7925b6b
1
+ 6c842ec61916b48d7a77ad2ecf7a3567e0c33fd20c3870f8ce97f296f3e4a1a9
@@ -1829,21 +1829,13 @@ var _LIT_ACTION_ = (() => {
1829
1829
  throw new Error(`Amount must be positive, got: ${amount.toString()} wei`);
1830
1830
  }
1831
1831
  console.log(" Fetching protocol mint limits...");
1832
- const minLoanValueResult = await Lit.Actions.call({
1833
- chain,
1834
- contractAddress: LOAN_OPS_MANAGER_ADDRESS,
1835
- abi: ABI_MINIMUM_LOAN_VALUE_WEI,
1836
- methodName: "minimumLoanValueWei",
1837
- params: []
1838
- });
1832
+ const rpcUrl = await Lit.Actions.getRpcUrl({ chain });
1833
+ const provider = new ethers.providers.JsonRpcProvider(rpcUrl);
1834
+ const loanOpsContract = new ethers.Contract(LOAN_OPS_MANAGER_ADDRESS, ABI_MINIMUM_LOAN_VALUE_WEI, provider);
1835
+ const minLoanValueResult = await loanOpsContract.minimumLoanValueWei();
1839
1836
  const MIN_MINT_AMOUNT = BigInt(minLoanValueResult.toString());
1840
- const maxLoanValueUcdResult = await Lit.Actions.call({
1841
- chain,
1842
- contractAddress: LOAN_OPS_MANAGER_ADDRESS,
1843
- abi: ABI_MAXIMUM_LOAN_VALUE_UCD,
1844
- methodName: "maximumLoanValueUcd",
1845
- params: []
1846
- });
1837
+ const loanOpsContractForMax = new ethers.Contract(LOAN_OPS_MANAGER_ADDRESS, ABI_MAXIMUM_LOAN_VALUE_UCD, provider);
1838
+ const maxLoanValueUcdResult = await loanOpsContractForMax.maximumLoanValueUcd();
1847
1839
  const maxLoanValueUcd = BigInt(maxLoanValueUcdResult.toString());
1848
1840
  const MAX_MINT_AMOUNT = maxLoanValueUcd * 1000000000000000000n;
1849
1841
  console.log(` \u2705 Protocol limits loaded from LoanOperationsManager`);
@@ -1958,13 +1950,8 @@ var _LIT_ACTION_ = (() => {
1958
1950
  currentStep = "4a";
1959
1951
  console.log("[Step 4a] Validating daily mint limit...");
1960
1952
  const totalMintAmount = amount + mintFee;
1961
- const remainingCapacity = await Lit.Actions.call({
1962
- chain,
1963
- contractAddress: UCD_CONTROLLER_ADDRESS,
1964
- abi: ABI_REMAINING_MINT_CAPACITY,
1965
- methodName: "getRemainingMintCapacity",
1966
- params: []
1967
- });
1953
+ const ucdControllerContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_REMAINING_MINT_CAPACITY, provider);
1954
+ const remainingCapacity = await ucdControllerContract.getRemainingMintCapacity();
1968
1955
  const remainingCapacityBigInt = BigInt(remainingCapacity.toString());
1969
1956
  if (totalMintAmount > remainingCapacityBigInt) {
1970
1957
  throw new Error(
@@ -1980,22 +1967,12 @@ var _LIT_ACTION_ = (() => {
1980
1967
  );
1981
1968
  currentStep = "4b";
1982
1969
  console.log("[Step 4b] Validating max supply limit...");
1983
- const maxSupplyResult = await Lit.Actions.call({
1984
- chain,
1985
- contractAddress: UCD_CONTROLLER_ADDRESS,
1986
- abi: ABI_MAX_SUPPLY,
1987
- methodName: "maxSupply",
1988
- params: []
1989
- });
1970
+ const ucdControllerMaxSupplyContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_MAX_SUPPLY, provider);
1971
+ const maxSupplyResult = await ucdControllerMaxSupplyContract.maxSupply();
1990
1972
  const maxSupply = BigInt(maxSupplyResult.toString());
1991
1973
  if (maxSupply > 0n) {
1992
- const currentSupplyResult = await Lit.Actions.call({
1993
- chain,
1994
- contractAddress: UCD_CONTROLLER_ADDRESS,
1995
- abi: ABI_CURRENT_SUPPLY,
1996
- methodName: "getCurrentSupply",
1997
- params: []
1998
- });
1974
+ const ucdControllerCurrentSupplyContract = new ethers.Contract(UCD_CONTROLLER_ADDRESS, ABI_CURRENT_SUPPLY, provider);
1975
+ const currentSupplyResult = await ucdControllerCurrentSupplyContract.getCurrentSupply();
1999
1976
  const currentSupply = BigInt(currentSupplyResult.toString());
2000
1977
  const projectedSupply = currentSupply + totalMintAmount;
2001
1978
  if (projectedSupply > maxSupply) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gvnrdao/dh-lit-actions",
3
- "version": "0.0.23",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "description": "Diamond Hands Protocol LIT Actions - Deterministic, Auditable Builds",
6
6
  "main": "./pkg-dist/index.cjs",