@panoptic-eng/sdk 1.0.57 → 1.0.58

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
- import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, erc20Abi, getAbiItem, getAddress, keccak256, parseAbi, toFunctionSelector, toHex, zeroAddress } from "viem";
1
+ import { BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ExecutionRevertedError, decodeAbiParameters, decodeErrorResult, decodeEventLog, decodeFunctionData, decodeFunctionResult, encodeAbiParameters, encodeFunctionData, erc20Abi, getAbiItem, getAddress, hexToString, keccak256, parseAbi, toFunctionSelector, toHex, trim, zeroAddress } from "viem";
2
2
  import { call, multicall } from "viem/actions";
3
3
  import Decimal from "decimal.js";
4
4
 
@@ -22966,6 +22966,44 @@ const erc20MetaAbi = [
22966
22966
  stateMutability: "view"
22967
22967
  }
22968
22968
  ];
22969
+ const erc20Bytes32MetaAbi = [{
22970
+ type: "function",
22971
+ name: "symbol",
22972
+ inputs: [],
22973
+ outputs: [{ type: "bytes32" }],
22974
+ stateMutability: "view"
22975
+ }, {
22976
+ type: "function",
22977
+ name: "name",
22978
+ inputs: [],
22979
+ outputs: [{ type: "bytes32" }],
22980
+ stateMutability: "view"
22981
+ }];
22982
+ async function readTokenText(client, blockNumber, calls) {
22983
+ const asString = await client.multicall({
22984
+ allowFailure: true,
22985
+ blockNumber,
22986
+ contracts: calls.map((call$1) => ({
22987
+ ...call$1,
22988
+ abi: erc20MetaAbi
22989
+ }))
22990
+ });
22991
+ if (asString.every((result) => result.status === "success")) return asString.map((result) => result.result);
22992
+ const asBytes32 = await client.multicall({
22993
+ allowFailure: true,
22994
+ blockNumber,
22995
+ contracts: calls.map((call$1) => ({
22996
+ ...call$1,
22997
+ abi: erc20Bytes32MetaAbi
22998
+ }))
22999
+ });
23000
+ return asString.map((result, index) => {
23001
+ if (result.status === "success") return result.result;
23002
+ const fallback = asBytes32[index];
23003
+ if (fallback.status !== "success") throw fallback.error;
23004
+ return hexToString(trim(fallback.result, { dir: "right" }));
23005
+ });
23006
+ }
22969
23007
  /**
22970
23008
  * Fetch core data for a Uniswap V3 pool directly from chain.
22971
23009
  *
@@ -23010,42 +23048,36 @@ async function getUniswapV3PoolInfo(params) {
23010
23048
  }
23011
23049
  ]
23012
23050
  });
23013
- const [t0Symbol, t0Name, t0Decimals, t1Symbol, t1Name, t1Decimals] = await client.multicall({
23051
+ const [[t0Symbol, t0Name, t1Symbol, t1Name], [t0Decimals, t1Decimals]] = await Promise.all([readTokenText(client, _meta.blockNumber, [
23052
+ {
23053
+ address: token0Addr,
23054
+ functionName: "symbol"
23055
+ },
23056
+ {
23057
+ address: token0Addr,
23058
+ functionName: "name"
23059
+ },
23060
+ {
23061
+ address: token1Addr,
23062
+ functionName: "symbol"
23063
+ },
23064
+ {
23065
+ address: token1Addr,
23066
+ functionName: "name"
23067
+ }
23068
+ ]), client.multicall({
23014
23069
  allowFailure: false,
23015
23070
  blockNumber: _meta.blockNumber,
23016
- contracts: [
23017
- {
23018
- address: token0Addr,
23019
- abi: erc20MetaAbi,
23020
- functionName: "symbol"
23021
- },
23022
- {
23023
- address: token0Addr,
23024
- abi: erc20MetaAbi,
23025
- functionName: "name"
23026
- },
23027
- {
23028
- address: token0Addr,
23029
- abi: erc20MetaAbi,
23030
- functionName: "decimals"
23031
- },
23032
- {
23033
- address: token1Addr,
23034
- abi: erc20MetaAbi,
23035
- functionName: "symbol"
23036
- },
23037
- {
23038
- address: token1Addr,
23039
- abi: erc20MetaAbi,
23040
- functionName: "name"
23041
- },
23042
- {
23043
- address: token1Addr,
23044
- abi: erc20MetaAbi,
23045
- functionName: "decimals"
23046
- }
23047
- ]
23048
- });
23071
+ contracts: [{
23072
+ address: token0Addr,
23073
+ abi: erc20MetaAbi,
23074
+ functionName: "decimals"
23075
+ }, {
23076
+ address: token1Addr,
23077
+ abi: erc20MetaAbi,
23078
+ functionName: "decimals"
23079
+ }]
23080
+ })]);
23049
23081
  return {
23050
23082
  poolAddress,
23051
23083
  token0: {
@@ -31227,7 +31259,7 @@ var _1 = {
31227
31259
  "semiFungiblePositionManagerV4": "0x00000000000005C3287f136Ef5AF56c68Ea6849f",
31228
31260
  "semiFungiblePositionManagerV3": "0x00000000000005E4693aDc8Ec0f12D686f728198",
31229
31261
  "builderFactory": "0x0000000000000a3D22E158417AA639D7F71b0FF7",
31230
- "riskEngine": "0x0000000000000E65545005B26207D7edFd031260",
31262
+ "riskEngine": "0x000000000000075e29cdaa9cb640a69e148ca7da",
31231
31263
  "panopticPoolImplementation": "0x000000000000135429F0DaCaB61639Bf6a63EbbC",
31232
31264
  "collateralTrackerImplementation": "0x0000000000001d9c38CA405A2e04420865A08A33",
31233
31265
  "panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
@@ -31238,12 +31270,7 @@ var _1 = {
31238
31270
  "interactionHelper": "0x00000000000041fe14Ce3c2392337CE501aE8328"
31239
31271
  }
31240
31272
  },
31241
- "riskEngines": [
31242
- "0x000000000000075e29cdaa9cb640a69e148ca7da",
31243
- "0x0000000000000fe1e261f66ce2f44def4f5ae0cb",
31244
- "0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac",
31245
- "0x0000000000000E65545005B26207D7edFd031260"
31246
- ],
31273
+ "riskEngines": ["0x000000000000075e29cdaa9cb640a69e148ca7da", "0x0000000000000fe1e261f66ce2f44def4f5ae0cb"],
31247
31274
  "markets": { "ethUsdc30bps": {
31248
31275
  "currency0": "0x0000000000000000000000000000000000000000",
31249
31276
  "currency1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -31262,7 +31289,8 @@ var _1 = {
31262
31289
  "poolId": "2824133844976349",
31263
31290
  "fee": 500,
31264
31291
  "weth": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
31265
- }
31292
+ },
31293
+ "deprecatedRiskEngines": ["0x0000000000000e673aECBDB5f5fE5DFAf4a8e9Ac", "0x0000000000000E65545005B26207D7edFd031260"]
31266
31294
  };
31267
31295
  var _4663 = {
31268
31296
  "chainId": 4663,
@@ -31306,7 +31334,7 @@ var _4663 = {
31306
31334
  "semiFungiblePositionManagerV4": "0x00000000000005C3287f136Ef5AF56c68Ea6849f",
31307
31335
  "semiFungiblePositionManagerV3": "0x00000000000005E4693aDc8Ec0f12D686f728198",
31308
31336
  "builderFactory": "0x0000000000000a3D22E158417AA639D7F71b0FF7",
31309
- "riskEngine": "0x0000000000000E65545005B26207D7edFd031260",
31337
+ "riskEngine": "0x000000000000075e29cdaa9cb640a69e148ca7da",
31310
31338
  "panopticPoolImplementation": "0x000000000000135429F0DaCaB61639Bf6a63EbbC",
31311
31339
  "collateralTrackerImplementation": "0x0000000000001d9c38CA405A2e04420865A08A33",
31312
31340
  "panopticFactoryV4": "0x0000000000000c51d0f8cf4bd9adE7191372a625",
@@ -31317,7 +31345,11 @@ var _4663 = {
31317
31345
  "interactionHelper": "0x00000000000041fe14Ce3c2392337CE501aE8328"
31318
31346
  }
31319
31347
  },
31320
- "riskEngines": ["0x0000000000000E65545005B26207D7edFd031260", "0x0000000000000fe1e261f66ce2f44def4f5ae0cb"],
31348
+ "riskEngines": [
31349
+ "0x000000000000075e29cdaa9cb640a69e148ca7da",
31350
+ "0x0000000000000fe1e261f66ce2f44def4f5ae0cb",
31351
+ "0x0000000000000f3fb82469581A74776178E76Ca4"
31352
+ ],
31321
31353
  "markets": { "spyUsdg": {
31322
31354
  "currency0": "0x117cc2133c37B721F49dE2A7a74833232B3B4C0C",
31323
31355
  "currency1": "0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168",
@@ -31328,7 +31360,8 @@ var _4663 = {
31328
31360
  "subgraphs": {
31329
31361
  "hypovault": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/hypovault-subgraph-robinhood/prod/gn",
31330
31362
  "panoptic": "https://api.goldsky.com/api/public/project_cl9gc21q105380hxuh8ks53k3/subgraphs/panoptic-subgraph-robinhood/v2_prod/gn"
31331
- }
31363
+ },
31364
+ "deprecatedRiskEngines": ["0x0000000000000E65545005B26207D7edFd031260"]
31332
31365
  };
31333
31366
  var _8453 = {
31334
31367
  "chainId": 8453,