@stableflow/bridges 3.1.3 → 3.1.4-rc-0f7f3e64ed-20260731

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.mts CHANGED
@@ -248,6 +248,15 @@ declare const formatNumber: (value: string | number | Big.Big | undefined, preci
248
248
  isLessPrecision?: boolean;
249
249
  }) => any;
250
250
 
251
+ /** Default OFT sharedDecimals across LayerZero / FraxZero deployments. */
252
+ declare const OFT_SHARED_DECIMALS = 6;
253
+ /**
254
+ * Floor an amount in local decimals to the OFT sharedDecimals precision.
255
+ * Matches on-chain `_removeDust`: `(amountLD / decimalConversionRate) * decimalConversionRate`
256
+ * where `decimalConversionRate = 10^(localDecimals - sharedDecimals)`.
257
+ */
258
+ declare function removeOftDust(amountWei: string | number | bigint, localDecimals: number, sharedDecimals?: number): string;
259
+
251
260
  declare const getHopMsgFee: (params: any) => Promise<bigint>;
252
261
 
253
262
  interface Usdt0Config extends LayerZeroChainConfig {
@@ -270,7 +279,11 @@ declare const DATA_HEX_PROTOBUF_EXTRA = 3;
270
279
  declare const SIGNATURE_SIZE = 67;
271
280
 
272
281
  declare const OFT_ABI: ({
273
- inputs: never[];
282
+ inputs: {
283
+ internalType: string;
284
+ name: string;
285
+ type: string;
286
+ }[];
274
287
  name: string;
275
288
  outputs: {
276
289
  internalType: string;
@@ -327,4 +340,4 @@ declare const MIDDLE_TOKEN_CHAIN: _stableflow_core.TokenConfig;
327
340
  declare const CCTP_PROXY_RELAY_CONTRACT = "0x0da5336C5CEb9d15e7659Ae376CC41d86Edd8802";
328
341
  declare const MIDDLE_CHAIN_REFOUND_ADDRESS = "0x654E7B96E1DE0b54E53D9ae8082fC2219E66dAC3";
329
342
 
330
- export { BridgeSFA, type BuildTransactionResult, MIDDLE_CHAIN_REFOUND_ADDRESS as CCTP_MIDDLE_CHAIN_REFOUND_ADDRESS, MIDDLE_TOKEN_CHAIN as CCTP_MIDDLE_TOKEN_CHAIN, CCTP_PROXY_RELAY_CONTRACT, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
343
+ export { BridgeSFA, type BuildTransactionResult, MIDDLE_CHAIN_REFOUND_ADDRESS as CCTP_MIDDLE_CHAIN_REFOUND_ADDRESS, MIDDLE_TOKEN_CHAIN as CCTP_MIDDLE_TOKEN_CHAIN, CCTP_PROXY_RELAY_CONTRACT, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, OFT_SHARED_DECIMALS, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature, removeOftDust };
package/dist/index.d.ts CHANGED
@@ -248,6 +248,15 @@ declare const formatNumber: (value: string | number | Big.Big | undefined, preci
248
248
  isLessPrecision?: boolean;
249
249
  }) => any;
250
250
 
251
+ /** Default OFT sharedDecimals across LayerZero / FraxZero deployments. */
252
+ declare const OFT_SHARED_DECIMALS = 6;
253
+ /**
254
+ * Floor an amount in local decimals to the OFT sharedDecimals precision.
255
+ * Matches on-chain `_removeDust`: `(amountLD / decimalConversionRate) * decimalConversionRate`
256
+ * where `decimalConversionRate = 10^(localDecimals - sharedDecimals)`.
257
+ */
258
+ declare function removeOftDust(amountWei: string | number | bigint, localDecimals: number, sharedDecimals?: number): string;
259
+
251
260
  declare const getHopMsgFee: (params: any) => Promise<bigint>;
252
261
 
253
262
  interface Usdt0Config extends LayerZeroChainConfig {
@@ -270,7 +279,11 @@ declare const DATA_HEX_PROTOBUF_EXTRA = 3;
270
279
  declare const SIGNATURE_SIZE = 67;
271
280
 
272
281
  declare const OFT_ABI: ({
273
- inputs: never[];
282
+ inputs: {
283
+ internalType: string;
284
+ name: string;
285
+ type: string;
286
+ }[];
274
287
  name: string;
275
288
  outputs: {
276
289
  internalType: string;
@@ -327,4 +340,4 @@ declare const MIDDLE_TOKEN_CHAIN: _stableflow_core.TokenConfig;
327
340
  declare const CCTP_PROXY_RELAY_CONTRACT = "0x0da5336C5CEb9d15e7659Ae376CC41d86Edd8802";
328
341
  declare const MIDDLE_CHAIN_REFOUND_ADDRESS = "0x654E7B96E1DE0b54E53D9ae8082fC2219E66dAC3";
329
342
 
330
- export { BridgeSFA, type BuildTransactionResult, MIDDLE_CHAIN_REFOUND_ADDRESS as CCTP_MIDDLE_CHAIN_REFOUND_ADDRESS, MIDDLE_TOKEN_CHAIN as CCTP_MIDDLE_TOKEN_CHAIN, CCTP_PROXY_RELAY_CONTRACT, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature };
343
+ export { BridgeSFA, type BuildTransactionResult, MIDDLE_CHAIN_REFOUND_ADDRESS as CCTP_MIDDLE_CHAIN_REFOUND_ADDRESS, MIDDLE_TOKEN_CHAIN as CCTP_MIDDLE_TOKEN_CHAIN, CCTP_PROXY_RELAY_CONTRACT, DATA_HEX_PROTOBUF_EXTRA, type EvmTxData, FRAXZERO_MIDDLE_TOKEN_FRXUSD, FRAXZERO_MIDDLE_TOKEN_USDC, type GetAllQuoteParams, LZ_RECEIVE_VALUE, OFT_ABI, OFT_SHARED_DECIMALS, type PermitSignature, type PermitTypedData, SIGNATURE_SIZE, ServiceMap, USDT0_CONFIG, USDT0_LEGACY_MESH_TRANSFTER_FEE, addressToBytes32, buildApproveTx, buildPermitTypedData, buildSendTx, formatNumber, formatQuoteError, getHopMsgFee, getQuoteModes, quoteSignature, removeOftDust };
package/dist/index.js CHANGED
@@ -886,6 +886,17 @@ async function quoteSignature(params) {
886
886
  return response.data ?? {};
887
887
  }
888
888
 
889
+ // src/utils/oft.ts
890
+ var OFT_SHARED_DECIMALS = 6;
891
+ function removeOftDust(amountWei, localDecimals, sharedDecimals = OFT_SHARED_DECIMALS) {
892
+ const amount = BigInt(amountWei.toString());
893
+ if (localDecimals <= sharedDecimals) {
894
+ return amount.toString();
895
+ }
896
+ const rate = 10n ** BigInt(localDecimals - sharedDecimals);
897
+ return (amount / rate * rate).toString();
898
+ }
899
+
889
900
  // src/usdt0/config.ts
890
901
  var USDT0_CONFIG = {
891
902
  Ethereum: {
@@ -1097,6 +1108,17 @@ var OFT_ABI = [
1097
1108
  stateMutability: "pure",
1098
1109
  type: "function"
1099
1110
  },
1111
+ {
1112
+ inputs: [
1113
+ { internalType: "uint256", name: "_amountLD", type: "uint256" }
1114
+ ],
1115
+ name: "removeDust",
1116
+ outputs: [
1117
+ { internalType: "uint256", name: "amountLD", type: "uint256" }
1118
+ ],
1119
+ stateMutability: "view",
1120
+ type: "function"
1121
+ },
1100
1122
  {
1101
1123
  inputs: [
1102
1124
  {
@@ -6658,6 +6680,7 @@ exports.FRAXZERO_MIDDLE_TOKEN_FRXUSD = FRAXZERO_MIDDLE_TOKEN_FRXUSD;
6658
6680
  exports.FRAXZERO_MIDDLE_TOKEN_USDC = FRAXZERO_MIDDLE_TOKEN_USDC;
6659
6681
  exports.LZ_RECEIVE_VALUE = LZ_RECEIVE_VALUE;
6660
6682
  exports.OFT_ABI = OFT_ABI;
6683
+ exports.OFT_SHARED_DECIMALS = OFT_SHARED_DECIMALS;
6661
6684
  exports.SIGNATURE_SIZE = SIGNATURE_SIZE;
6662
6685
  exports.ServiceMap = ServiceMap;
6663
6686
  exports.USDT0_CONFIG = USDT0_CONFIG;
@@ -6671,5 +6694,6 @@ exports.formatQuoteError = formatQuoteError;
6671
6694
  exports.getHopMsgFee = getHopMsgFee;
6672
6695
  exports.getQuoteModes = getQuoteModes;
6673
6696
  exports.quoteSignature = quoteSignature;
6697
+ exports.removeOftDust = removeOftDust;
6674
6698
  //# sourceMappingURL=index.js.map
6675
6699
  //# sourceMappingURL=index.js.map