@dimes-dot-fi/sdk 2.1.0 → 2.3.0
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/dist/{aliases-BJyM8ydu.d.cts → aliases-Dne14KBa.d.cts} +125 -11
- package/dist/{aliases-BJyM8ydu.d.ts → aliases-Dne14KBa.d.ts} +125 -11
- package/dist/{chunk-PZCBUVPD.mjs → chunk-4OKYU5D7.mjs} +5 -2
- package/dist/{chunk-PZCBUVPD.mjs.map → chunk-4OKYU5D7.mjs.map} +1 -1
- package/dist/{chunk-5VHDXPRV.mjs → chunk-7SGBJTUW.mjs} +2 -2
- package/dist/{chunk-72LTVPD2.cjs → chunk-E6YJDY4F.cjs} +5 -2
- package/dist/chunk-E6YJDY4F.cjs.map +1 -0
- package/dist/{chunk-7SAMK7CS.cjs → chunk-GY6L2QGR.cjs} +5 -5
- package/dist/{chunk-7SAMK7CS.cjs.map → chunk-GY6L2QGR.cjs.map} +1 -1
- package/dist/{chunk-T67Z74J3.mjs → chunk-IJO5E22G.mjs} +2 -2
- package/dist/{chunk-PK2PRTQW.mjs → chunk-TYR33WJW.mjs} +9 -4
- package/dist/chunk-TYR33WJW.mjs.map +1 -0
- package/dist/{chunk-FAW2C5AM.cjs → chunk-UPNJRN65.cjs} +4 -4
- package/dist/{chunk-FAW2C5AM.cjs.map → chunk-UPNJRN65.cjs.map} +1 -1
- package/dist/{chunk-53U53KZ2.cjs → chunk-UYDXDYEP.cjs} +9 -4
- package/dist/chunk-UYDXDYEP.cjs.map +1 -0
- package/dist/contract/index.cjs +21 -14
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +3 -3
- package/dist/contract/index.d.ts +3 -3
- package/dist/contract/index.mjs +9 -2
- package/dist/contract/index.mjs.map +1 -1
- package/dist/{dimes-client-ntybPwHK.d.cts → dimes-client-D9tohawC.d.cts} +2 -1
- package/dist/{dimes-client-DLbPP30g.d.ts → dimes-client-DJ1d_p31.d.ts} +2 -1
- package/dist/{dimes-error-BhKtCgba.d.cts → dimes-error-E9yPAZb-.d.cts} +1 -1
- package/dist/{dimes-error-DjxvjzCZ.d.ts → dimes-error-hSoOierP.d.ts} +1 -1
- package/dist/index.cjs +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +10 -5
- package/dist/index.mjs.map +1 -1
- package/dist/{quote-BoTWtznc.d.ts → quote-D4QunMtN.d.ts} +2 -2
- package/dist/{quote-Bc9H5-2H.d.cts → quote-sWguOcoJ.d.cts} +2 -2
- package/dist/react/index.cjs +30 -12
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +7 -5
- package/dist/react/index.d.ts +7 -5
- package/dist/react/index.mjs +25 -7
- package/dist/react/index.mjs.map +1 -1
- package/dist/{types-ClHQbIcY.d.ts → types-BHU4Qq7e.d.ts} +6 -3
- package/dist/{types-Co-2bQSi.d.cts → types-Bvj_WDbX.d.cts} +6 -3
- package/dist/ws/index.cjs +3 -3
- package/dist/ws/index.d.cts +3 -3
- package/dist/ws/index.d.ts +3 -3
- package/dist/ws/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/chunk-53U53KZ2.cjs.map +0 -1
- package/dist/chunk-72LTVPD2.cjs.map +0 -1
- package/dist/chunk-PK2PRTQW.mjs.map +0 -1
- /package/dist/{chunk-5VHDXPRV.mjs.map → chunk-7SGBJTUW.mjs.map} +0 -0
- /package/dist/{chunk-T67Z74J3.mjs.map → chunk-IJO5E22G.mjs.map} +0 -0
package/dist/contract/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkE6YJDY4Fcjs = require('../chunk-E6YJDY4F.cjs');
|
|
5
5
|
|
|
6
6
|
// src/contract/vault-abi.json
|
|
7
7
|
var vault_abi_default = {
|
|
@@ -5598,7 +5598,7 @@ var _viem = require('viem');
|
|
|
5598
5598
|
function toHex(value) {
|
|
5599
5599
|
if (!_viem.isHex.call(void 0, value)) {
|
|
5600
5600
|
const HEX_PREVIEW_LENGTH = 10;
|
|
5601
|
-
throw new (0,
|
|
5601
|
+
throw new (0, _chunkE6YJDY4Fcjs.DimesError)(
|
|
5602
5602
|
"invalid_hex",
|
|
5603
5603
|
`Expected hex string starting with 0x, got: ${value.slice(0, HEX_PREVIEW_LENGTH)}`
|
|
5604
5604
|
);
|
|
@@ -5607,7 +5607,7 @@ function toHex(value) {
|
|
|
5607
5607
|
}
|
|
5608
5608
|
function toAddress(value) {
|
|
5609
5609
|
if (!_viem.isAddress.call(void 0, value)) {
|
|
5610
|
-
throw new (0,
|
|
5610
|
+
throw new (0, _chunkE6YJDY4Fcjs.DimesError)("invalid_address", `Invalid EVM address: ${value}`);
|
|
5611
5611
|
}
|
|
5612
5612
|
return _viem.getAddress.call(void 0, value);
|
|
5613
5613
|
}
|
|
@@ -5902,7 +5902,7 @@ async function assertQuoteSigner(quote, userAddress, expectedSigner) {
|
|
|
5902
5902
|
const recoveredSigner = await recoverCreatePositionSigner(quote, userAddress);
|
|
5903
5903
|
const expected = _viem.getAddress.call(void 0, expectedSigner);
|
|
5904
5904
|
if (recoveredSigner !== expected) {
|
|
5905
|
-
throw new (0,
|
|
5905
|
+
throw new (0, _chunkE6YJDY4Fcjs.DimesContractError)(
|
|
5906
5906
|
"invalid_signer",
|
|
5907
5907
|
`Recovered signer ${recoveredSigner} does not match expected authority ${expected}`
|
|
5908
5908
|
);
|
|
@@ -6005,7 +6005,14 @@ var friendlyBySelector = {
|
|
|
6005
6005
|
"0xe237d922": "Missing ERC-1155 approval.",
|
|
6006
6006
|
"0x3e31884e": "Invalid ERC-1155 approver (zero address).",
|
|
6007
6007
|
"0xced3e100": "Invalid ERC-1155 operator (zero address).",
|
|
6008
|
-
"0x5b059991": "ERC-1155 array length mismatch."
|
|
6008
|
+
"0x5b059991": "ERC-1155 array length mismatch.",
|
|
6009
|
+
// Solady SafeTransferLib — thrown by the vault's token transfers and not
|
|
6010
|
+
// present in its ABI, so they only decode by selector.
|
|
6011
|
+
"0xf4d678b8": "Insufficient USDC balance to cover collateral and fees. Add USDC and try again.",
|
|
6012
|
+
"0x13be252b": "Insufficient USDC allowance. Approve and try again.",
|
|
6013
|
+
"0x7939f424": "USDC transfer failed. Check your balance and allowance.",
|
|
6014
|
+
"0x90b8ec18": "USDC transfer failed. Check your balance.",
|
|
6015
|
+
"0x3e3f8f73": "USDC approval failed."
|
|
6009
6016
|
};
|
|
6010
6017
|
var HEX_SELECTOR_LENGTH = 10;
|
|
6011
6018
|
function humanizeName(name) {
|
|
@@ -6018,12 +6025,12 @@ function firstLine(s) {
|
|
|
6018
6025
|
}
|
|
6019
6026
|
function formatContractError(err) {
|
|
6020
6027
|
if (!err) {
|
|
6021
|
-
return new (0,
|
|
6028
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("unknown", "Transaction failed.");
|
|
6022
6029
|
}
|
|
6023
6030
|
if (err instanceof _viem.BaseError) {
|
|
6024
6031
|
const rejected = err.walk((e) => e instanceof _viem.UserRejectedRequestError);
|
|
6025
6032
|
if (rejected) {
|
|
6026
|
-
return new (0,
|
|
6033
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("UserRejected", "Transaction rejected in wallet.");
|
|
6027
6034
|
}
|
|
6028
6035
|
const reverted = err.walk(
|
|
6029
6036
|
(e) => e instanceof _viem.ContractFunctionRevertedError
|
|
@@ -6034,12 +6041,12 @@ function formatContractError(err) {
|
|
|
6034
6041
|
if (errorName) {
|
|
6035
6042
|
const fmt = friendlyByErrorName[errorName];
|
|
6036
6043
|
const message = fmt ? fmt(args) : humanizeName(errorName);
|
|
6037
|
-
return new (0,
|
|
6044
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)(errorName, message);
|
|
6038
6045
|
}
|
|
6039
6046
|
const raw = reverted.raw;
|
|
6040
6047
|
const selector = raw && raw.length >= HEX_SELECTOR_LENGTH ? raw.slice(0, HEX_SELECTOR_LENGTH) : void 0;
|
|
6041
6048
|
const selectorMessage = selector ? friendlyBySelector[selector] : void 0;
|
|
6042
|
-
return new (0,
|
|
6049
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)(
|
|
6043
6050
|
_nullishCoalesce(selector, () => ( "unknown_revert")),
|
|
6044
6051
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
6045
6052
|
_nullishCoalesce(_nullishCoalesce(selectorMessage, () => ( reverted.shortMessage)), () => ( "Contract reverted."))
|
|
@@ -6047,17 +6054,17 @@ function formatContractError(err) {
|
|
|
6047
6054
|
}
|
|
6048
6055
|
const exec = err.walk((e) => e instanceof _viem.ContractFunctionExecutionError);
|
|
6049
6056
|
if (_optionalChain([exec, 'optionalAccess', _5 => _5.shortMessage])) {
|
|
6050
|
-
return new (0,
|
|
6057
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("execution_error", firstLine(exec.shortMessage));
|
|
6051
6058
|
}
|
|
6052
6059
|
if (err.shortMessage) {
|
|
6053
|
-
return new (0,
|
|
6060
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("base_error", firstLine(err.shortMessage));
|
|
6054
6061
|
}
|
|
6055
|
-
return new (0,
|
|
6062
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("base_error", firstLine(err.message));
|
|
6056
6063
|
}
|
|
6057
6064
|
if (err instanceof Error) {
|
|
6058
|
-
return new (0,
|
|
6065
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("error", firstLine(err.message));
|
|
6059
6066
|
}
|
|
6060
|
-
return new (0,
|
|
6067
|
+
return new (0, _chunkE6YJDY4Fcjs.DimesContractError)("unknown", "Transaction failed.");
|
|
6061
6068
|
}
|
|
6062
6069
|
|
|
6063
6070
|
|