@anywalletkit/protocol-swap2-0x 0.2.0 → 0.3.1

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/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_GAS_CAP_CEILING, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, isZeroExGasCap, zeroExChain, zeroExChainId, zeroExChains } from './chains.cjs';
2
2
  export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExGasLimit, r as checkZeroExTransaction, s as createSettlerResolver, t as decodeSettlerExecute, u as isZeroExNative, z as zeroExMaxGasLimit, v as zeroExSettlerAddress, w as zeroExSettlerNonce } from './settler-CeJFLW5t.cjs';
3
- export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExPreflightDeposit, zeroExProvider } from './provider.cjs';
3
+ export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExGasEstimate, zeroExPreflightDeposit, zeroExProvider } from './provider.cjs';
4
4
  export { ZeroExPinsConfig, ZeroExRemoteOptions, ZeroExRemoteProvider, ZeroExVerifyContext, zeroExKnownSpenders, zeroExPins, zeroExRefusalReason, zeroExRemoteProvider, zeroExVerifyBuild, zeroExVerifyQuote } from './remote.cjs';
5
5
  export { ZeroExSwap2Config, ZeroExSwap2Protocol, ZeroExSwap2Protocol as default } from './protocol.cjs';
6
6
  export { ZEROEX_MODULE, describeZeroExActivity } from './activity.cjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_GAS_CAP_CEILING, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, isZeroExGasCap, zeroExChain, zeroExChainId, zeroExChains } from './chains.js';
2
2
  export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExGasLimit, r as checkZeroExTransaction, s as createSettlerResolver, t as decodeSettlerExecute, u as isZeroExNative, z as zeroExMaxGasLimit, v as zeroExSettlerAddress, w as zeroExSettlerNonce } from './settler-DBLrnepW.js';
3
- export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExPreflightDeposit, zeroExProvider } from './provider.js';
3
+ export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExGasEstimate, zeroExPreflightDeposit, zeroExProvider } from './provider.js';
4
4
  export { ZeroExPinsConfig, ZeroExRemoteOptions, ZeroExRemoteProvider, ZeroExVerifyContext, zeroExKnownSpenders, zeroExPins, zeroExRefusalReason, zeroExRemoteProvider, zeroExVerifyBuild, zeroExVerifyQuote } from './remote.js';
5
5
  export { ZeroExSwap2Config, ZeroExSwap2Protocol, ZeroExSwap2Protocol as default } from './protocol.js';
6
6
  export { ZEROEX_MODULE, describeZeroExActivity } from './activity.js';
package/dist/index.js CHANGED
@@ -5,17 +5,18 @@ import {
5
5
  zeroExRemoteProvider,
6
6
  zeroExVerifyBuild,
7
7
  zeroExVerifyQuote
8
- } from "./chunk-SAI3RXOP.js";
8
+ } from "./chunk-ABT2WYBK.js";
9
9
  import {
10
10
  ZeroExSwap2Protocol
11
- } from "./chunk-VPQZVV5O.js";
11
+ } from "./chunk-KYVRMBZG.js";
12
12
  import {
13
13
  ZEROEX_DEFAULT_BASE_URL,
14
14
  ZEROEX_PROVIDER,
15
15
  zeroExFees,
16
+ zeroExGasEstimate,
16
17
  zeroExPreflightDeposit,
17
18
  zeroExProvider
18
- } from "./chunk-PLQSYP6W.js";
19
+ } from "./chunk-S2RUUV3X.js";
19
20
  import {
20
21
  ZEROEX_MODULE,
21
22
  describeZeroExActivity
@@ -95,6 +96,7 @@ export {
95
96
  zeroExChainId,
96
97
  zeroExChains,
97
98
  zeroExFees,
99
+ zeroExGasEstimate,
98
100
  zeroExKnownSpenders,
99
101
  zeroExMaxGasLimit,
100
102
  zeroExPins,
package/dist/protocol.cjs CHANGED
@@ -526,6 +526,10 @@ function zeroExFees(response, gas) {
526
526
  if (network !== null) out.push({ type: "network", amount: network.toString(), token: "native", included: false, description: "Estimated network fee (gas \xD7 gas price, as 0x reports it)" });
527
527
  return { fees: out, networkFeeKnown: network !== null };
528
528
  }
529
+ function zeroExGasEstimate(gas) {
530
+ const units = uint(gas);
531
+ return units !== null && units > 0n && units < 10000000000n ? units.toString() : void 0;
532
+ }
529
533
  function taxBps(v) {
530
534
  if (v === null || v === void 0) return null;
531
535
  if (typeof v === "number" && Number.isFinite(v) && v >= 0) return v;
@@ -698,6 +702,7 @@ function zeroExProvider(config) {
698
702
  const tx = plain(transaction) ? transaction : void 0;
699
703
  const parsedFees = zeroExFees(r, tx ? { gas: own(tx, "gas"), gasPrice: own(tx, "gasPrice") } : { gas: own(r, "gas"), gasPrice: own(r, "gasPrice") });
700
704
  if (typeof parsedFees === "string") return refuse2(parsedFees, parsedFees === UNASKED_INTEGRATOR_FEE ? "policy_refused" : "upstream_unavailable");
705
+ const gasEstimate = zeroExGasEstimate(tx ? own(tx, "gas") : own(r, "gas"));
701
706
  const flags = [];
702
707
  const issues = own(r, "issues");
703
708
  if (plain(issues)) {
@@ -813,6 +818,7 @@ function zeroExProvider(config) {
813
818
  minDestAmount: minBuyAmount.toString(),
814
819
  feeUsd: 0,
815
820
  fees: parsedFees.fees,
821
+ ...gasEstimate !== void 0 ? { gasEstimate, gasEstimateSource: "venue" } : {},
816
822
  etaSeconds: 15,
817
823
  reliability: 0.96,
818
824
  validUntilMs,