@stablechain/sdk 1.0.8 → 1.0.9
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/README.md +66 -6
- package/dist/{chunk-VS6GBRDF.js → chunk-FN7OKBRH.js} +3 -1
- package/dist/{chunk-QQ26UI3F.cjs → chunk-MMZ7HVWZ.cjs} +3 -1
- package/dist/erc3009.cjs +2 -2
- package/dist/erc3009.js +1 -1
- package/dist/index.cjs +117 -106
- package/dist/index.d.cts +19 -7
- package/dist/index.d.ts +19 -7
- package/dist/index.js +14 -3
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -263,12 +263,12 @@ interface BridgeStatus {
|
|
|
263
263
|
/**
|
|
264
264
|
* Bridge route selection:
|
|
265
265
|
* - `"oft"` — force the native LayerZero OFT path for whichever asset the token
|
|
266
|
-
* addresses name, USDT0 or
|
|
266
|
+
* addresses name, USDT0, XAUt0 or PYUSD (no protocol fee, just gas + LZ messaging fee;
|
|
267
267
|
* slower). Throws if the chain pair has no adapter for that asset.
|
|
268
268
|
* - `"usdt0"` — deprecated alias for `"oft"`, kept for compatibility. It does not
|
|
269
269
|
* restrict the route to USDT0; the token addresses decide the asset.
|
|
270
270
|
* - `"lifi"` — force the LI.FI aggregator path (fast, charges a fee).
|
|
271
|
-
* - `"auto"` — use the native OFT mesh (USDT0 or
|
|
271
|
+
* - `"auto"` — use the native OFT mesh (USDT0, XAUt0 or PYUSD) when both chains deploy
|
|
272
272
|
* the requested asset and the token addresses match, else LI.FI.
|
|
273
273
|
* This is the default.
|
|
274
274
|
*/
|
|
@@ -373,7 +373,7 @@ interface BridgeCalldata {
|
|
|
373
373
|
/** The source chain every step must be sent on */
|
|
374
374
|
chainId: number;
|
|
375
375
|
/** Which OFT mesh this send moves through */
|
|
376
|
-
asset: "usdt0" | "xaut0";
|
|
376
|
+
asset: "usdt0" | "xaut0" | "pyusd";
|
|
377
377
|
/** The quote these steps were built from, whether supplied or freshly read */
|
|
378
378
|
quote: BridgeQuote;
|
|
379
379
|
/**
|
|
@@ -711,7 +711,7 @@ interface ChainConfig {
|
|
|
711
711
|
declare const CHAIN_CONFIGS: Partial<Record<Chain, ChainConfig>>;
|
|
712
712
|
|
|
713
713
|
/** An asset with its own LayerZero OFT mesh. Each has separate adapters per chain. */
|
|
714
|
-
type BridgeAsset = "usdt0" | "xaut0";
|
|
714
|
+
type BridgeAsset = "usdt0" | "xaut0" | "pyusd";
|
|
715
715
|
/** One asset's deployment on one chain. */
|
|
716
716
|
interface BridgeTokenConfig {
|
|
717
717
|
/** The ERC-20 a holder owns — what gets debited, and approved when required */
|
|
@@ -728,12 +728,18 @@ interface BridgeTokenConfig {
|
|
|
728
728
|
approvalRequired?: boolean;
|
|
729
729
|
/** False when the adapter exists but has no outbound send pathways configured */
|
|
730
730
|
lzOutbound?: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Overrides the chain's {@link BridgeChainConfig.minDeliverySec} for sends of
|
|
733
|
+
* this asset. The chain's floor was measured on one asset's pathways; another
|
|
734
|
+
* asset's DVNs may not share its wait (0 means no floor).
|
|
735
|
+
*/
|
|
736
|
+
minDeliverySec?: number;
|
|
731
737
|
}
|
|
732
738
|
interface BridgeChainConfig extends ChainConfig {
|
|
733
739
|
lzEid: number;
|
|
734
740
|
/**
|
|
735
|
-
* Which OFT assets this chain can bridge. A chain may carry
|
|
736
|
-
*
|
|
741
|
+
* Which OFT assets this chain can bridge. A chain may carry some and not the
|
|
742
|
+
* others — BSC has XAUt0 but no USDT0 deployment.
|
|
737
743
|
*/
|
|
738
744
|
tokens: Partial<Record<BridgeAsset, BridgeTokenConfig>>;
|
|
739
745
|
/**
|
|
@@ -942,6 +948,12 @@ declare function clearBridgeEstimateCache(): void;
|
|
|
942
948
|
declare function buildLzOptions(gasLimit?: bigint, nativeDrop?: bigint, dropReceiver?: Address): Hex;
|
|
943
949
|
|
|
944
950
|
declare const STABLE_USDT_ADDRESS: Address;
|
|
951
|
+
/**
|
|
952
|
+
* PayPal USD on Stable mainnet — 6 decimals, ERC-3009 capable. Its EIP-712 domain is
|
|
953
|
+
* `{ name: "PayPal USD", version: "1" }`, which the ERC-3009 actions resolve on their
|
|
954
|
+
* own (verified against the contract's DOMAIN_SEPARATOR, 2026-10-20).
|
|
955
|
+
*/
|
|
956
|
+
declare const STABLE_PYUSD_ADDRESS: Address;
|
|
945
957
|
declare const STABLE_VAULT_ADDRESS: Address;
|
|
946
958
|
|
|
947
959
|
declare class StableError extends BaseError {
|
|
@@ -1001,4 +1013,4 @@ declare class StableBulkError extends StableError {
|
|
|
1001
1013
|
});
|
|
1002
1014
|
}
|
|
1003
1015
|
|
|
1004
|
-
export { BRIDGE_CHAIN_CONFIGS, type BridgeAsset, type BridgeCalldata, type BridgeCalldataStep, type BridgeChainConfig, type BridgeDeliveryState, type BridgeGasEstimate, type BridgeOftFee, type BridgeOftQuote, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BridgeTokenConfig, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, OFT_ADAPTER_ABI, type OperationResult, type PrepareBridgeParams, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, bridgeAssetFor, buildLzOptions, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|
|
1016
|
+
export { BRIDGE_CHAIN_CONFIGS, type BridgeAsset, type BridgeCalldata, type BridgeCalldataStep, type BridgeChainConfig, type BridgeDeliveryState, type BridgeGasEstimate, type BridgeOftFee, type BridgeOftQuote, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BridgeTokenConfig, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, OFT_ADAPTER_ABI, type OperationResult, type PrepareBridgeParams, STABLE_PYUSD_ADDRESS, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, bridgeAssetFor, buildLzOptions, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|
package/dist/index.d.ts
CHANGED
|
@@ -263,12 +263,12 @@ interface BridgeStatus {
|
|
|
263
263
|
/**
|
|
264
264
|
* Bridge route selection:
|
|
265
265
|
* - `"oft"` — force the native LayerZero OFT path for whichever asset the token
|
|
266
|
-
* addresses name, USDT0 or
|
|
266
|
+
* addresses name, USDT0, XAUt0 or PYUSD (no protocol fee, just gas + LZ messaging fee;
|
|
267
267
|
* slower). Throws if the chain pair has no adapter for that asset.
|
|
268
268
|
* - `"usdt0"` — deprecated alias for `"oft"`, kept for compatibility. It does not
|
|
269
269
|
* restrict the route to USDT0; the token addresses decide the asset.
|
|
270
270
|
* - `"lifi"` — force the LI.FI aggregator path (fast, charges a fee).
|
|
271
|
-
* - `"auto"` — use the native OFT mesh (USDT0 or
|
|
271
|
+
* - `"auto"` — use the native OFT mesh (USDT0, XAUt0 or PYUSD) when both chains deploy
|
|
272
272
|
* the requested asset and the token addresses match, else LI.FI.
|
|
273
273
|
* This is the default.
|
|
274
274
|
*/
|
|
@@ -373,7 +373,7 @@ interface BridgeCalldata {
|
|
|
373
373
|
/** The source chain every step must be sent on */
|
|
374
374
|
chainId: number;
|
|
375
375
|
/** Which OFT mesh this send moves through */
|
|
376
|
-
asset: "usdt0" | "xaut0";
|
|
376
|
+
asset: "usdt0" | "xaut0" | "pyusd";
|
|
377
377
|
/** The quote these steps were built from, whether supplied or freshly read */
|
|
378
378
|
quote: BridgeQuote;
|
|
379
379
|
/**
|
|
@@ -711,7 +711,7 @@ interface ChainConfig {
|
|
|
711
711
|
declare const CHAIN_CONFIGS: Partial<Record<Chain, ChainConfig>>;
|
|
712
712
|
|
|
713
713
|
/** An asset with its own LayerZero OFT mesh. Each has separate adapters per chain. */
|
|
714
|
-
type BridgeAsset = "usdt0" | "xaut0";
|
|
714
|
+
type BridgeAsset = "usdt0" | "xaut0" | "pyusd";
|
|
715
715
|
/** One asset's deployment on one chain. */
|
|
716
716
|
interface BridgeTokenConfig {
|
|
717
717
|
/** The ERC-20 a holder owns — what gets debited, and approved when required */
|
|
@@ -728,12 +728,18 @@ interface BridgeTokenConfig {
|
|
|
728
728
|
approvalRequired?: boolean;
|
|
729
729
|
/** False when the adapter exists but has no outbound send pathways configured */
|
|
730
730
|
lzOutbound?: boolean;
|
|
731
|
+
/**
|
|
732
|
+
* Overrides the chain's {@link BridgeChainConfig.minDeliverySec} for sends of
|
|
733
|
+
* this asset. The chain's floor was measured on one asset's pathways; another
|
|
734
|
+
* asset's DVNs may not share its wait (0 means no floor).
|
|
735
|
+
*/
|
|
736
|
+
minDeliverySec?: number;
|
|
731
737
|
}
|
|
732
738
|
interface BridgeChainConfig extends ChainConfig {
|
|
733
739
|
lzEid: number;
|
|
734
740
|
/**
|
|
735
|
-
* Which OFT assets this chain can bridge. A chain may carry
|
|
736
|
-
*
|
|
741
|
+
* Which OFT assets this chain can bridge. A chain may carry some and not the
|
|
742
|
+
* others — BSC has XAUt0 but no USDT0 deployment.
|
|
737
743
|
*/
|
|
738
744
|
tokens: Partial<Record<BridgeAsset, BridgeTokenConfig>>;
|
|
739
745
|
/**
|
|
@@ -942,6 +948,12 @@ declare function clearBridgeEstimateCache(): void;
|
|
|
942
948
|
declare function buildLzOptions(gasLimit?: bigint, nativeDrop?: bigint, dropReceiver?: Address): Hex;
|
|
943
949
|
|
|
944
950
|
declare const STABLE_USDT_ADDRESS: Address;
|
|
951
|
+
/**
|
|
952
|
+
* PayPal USD on Stable mainnet — 6 decimals, ERC-3009 capable. Its EIP-712 domain is
|
|
953
|
+
* `{ name: "PayPal USD", version: "1" }`, which the ERC-3009 actions resolve on their
|
|
954
|
+
* own (verified against the contract's DOMAIN_SEPARATOR, 2026-10-20).
|
|
955
|
+
*/
|
|
956
|
+
declare const STABLE_PYUSD_ADDRESS: Address;
|
|
945
957
|
declare const STABLE_VAULT_ADDRESS: Address;
|
|
946
958
|
|
|
947
959
|
declare class StableError extends BaseError {
|
|
@@ -1001,4 +1013,4 @@ declare class StableBulkError extends StableError {
|
|
|
1001
1013
|
});
|
|
1002
1014
|
}
|
|
1003
1015
|
|
|
1004
|
-
export { BRIDGE_CHAIN_CONFIGS, type BridgeAsset, type BridgeCalldata, type BridgeCalldataStep, type BridgeChainConfig, type BridgeDeliveryState, type BridgeGasEstimate, type BridgeOftFee, type BridgeOftQuote, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BridgeTokenConfig, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, OFT_ADAPTER_ABI, type OperationResult, type PrepareBridgeParams, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, bridgeAssetFor, buildLzOptions, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|
|
1016
|
+
export { BRIDGE_CHAIN_CONFIGS, type BridgeAsset, type BridgeCalldata, type BridgeCalldataStep, type BridgeChainConfig, type BridgeDeliveryState, type BridgeGasEstimate, type BridgeOftFee, type BridgeOftQuote, type BridgeParams, type BridgeQuote, type BridgeRoute, type BridgeStatus, type BridgeTimeEstimate, type BridgeTokenConfig, type BulkDepositOptions, type BulkEarnResult, type BulkEarnResultItem, type BulkWithdrawOptions, CHAIN_CONFIGS, Chain, type ChainConfig, type EarnConfig, type EarnDepositCalldata, type EarnDepositParams, type EarnRedeemParams, type EarnResult, type EarnWithdrawCalldata, type EarnWithdrawParams, type ForceDeallocation, type ForceRedeemParams, type ForceWithdrawParams, type MerklClaimCalldata, type MerklClaimResult, type MerklReward, type MerklRewardToken, type MerklRewardsResult, Network, OFT_ADAPTER_ABI, type OperationResult, type PrepareBridgeParams, STABLE_PYUSD_ADDRESS, STABLE_USDT_ADDRESS, STABLE_VAULT_ADDRESS, StableBulkError, type StableClient, type StableConfig, StableError, StableNetworkError, StableQuoteError, type StableReader, type StableReaderConfig, StableTransactionError, StableValidationError, type SwapParams, type SwapQuote, type TransferParams, type VaultPosition, type VaultYield, type VaultYieldReward, type WithdrawStatus, type YieldPreview, bridgeAssetFor, buildLzOptions, clearBridgeEstimateCache, createStable, createStableReader, erc3009Actions };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ERC3009_ABI,
|
|
3
|
+
STABLE_PYUSD_ADDRESS,
|
|
3
4
|
STABLE_USDT_ADDRESS,
|
|
4
5
|
STABLE_VAULT_ADDRESS,
|
|
5
6
|
StableBulkError,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
signTransferAuthorization,
|
|
19
20
|
transferWithAuthorization,
|
|
20
21
|
verifyAuthorization
|
|
21
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-FN7OKBRH.js";
|
|
22
23
|
|
|
23
24
|
// src/stable.ts
|
|
24
25
|
import {
|
|
@@ -1750,6 +1751,12 @@ var XAUT0_DEPLOYMENTS = {
|
|
|
1750
1751
|
["plasma" /* Plasma */]: { address: "0x1B64B9025EEbb9A6239575dF9Ea4b9Ac46D4d193", decimals: 6, oftAdapter: "0x63aB93cBC9d4ecD9c4947b1A38F458147C08E6F7", approvalRequired: false },
|
|
1751
1752
|
["bsc" /* BSC */]: { address: "0x21cAef8A43163Eea865baeE23b9C2E327696A3bf", decimals: 6, oftAdapter: "0x53C3A64c8942288e12813C1F8457Db45980BcfC2", approvalRequired: false }
|
|
1752
1753
|
};
|
|
1754
|
+
var PYUSD_DEPLOYMENTS = {
|
|
1755
|
+
// No floor: unlike USDT0's, this pathway's DVNs don't hold for finality. 15
|
|
1756
|
+
// confirmations compute to ~184s; LayerZero Scan observed ~202s (2026-10-27).
|
|
1757
|
+
["ethereum" /* Ethereum */]: { address: "0x6c3ea9036406852006290770BEdFcAbA0e23A0e8", decimals: 6, oftAdapter: "0xa2C323fE5A74aDffAd2bf3E007E36bb029606444", approvalRequired: false, minDeliverySec: 0 },
|
|
1758
|
+
["stable" /* Stable */]: { address: STABLE_PYUSD_ADDRESS, decimals: 6, oftAdapter: "0x2eb79387Fa1a6EF6DC8E25401C8fdc291Cc542C7", approvalRequired: false }
|
|
1759
|
+
};
|
|
1753
1760
|
var USDT0_LOCKBOX_CHAINS = /* @__PURE__ */ new Set(["ethereum" /* Ethereum */, "sepolia" /* Sepolia */]);
|
|
1754
1761
|
function bridgeChain(chain, lzEid, blockTimeSec, usdt0Adapter, minDeliverySec) {
|
|
1755
1762
|
const base = C[chain];
|
|
@@ -1764,6 +1771,8 @@ function bridgeChain(chain, lzEid, blockTimeSec, usdt0Adapter, minDeliverySec) {
|
|
|
1764
1771
|
}
|
|
1765
1772
|
const xaut0 = XAUT0_DEPLOYMENTS[chain];
|
|
1766
1773
|
if (xaut0) tokens.xaut0 = xaut0;
|
|
1774
|
+
const pyusd = PYUSD_DEPLOYMENTS[chain];
|
|
1775
|
+
if (pyusd) tokens.pyusd = pyusd;
|
|
1767
1776
|
return { ...base, lzEid, blockTimeSec, minDeliverySec, tokens, oftAdapter: usdt0Adapter };
|
|
1768
1777
|
}
|
|
1769
1778
|
var BRIDGE_CHAIN_CONFIGS = {
|
|
@@ -2394,7 +2403,7 @@ var LayerZeroService = class {
|
|
|
2394
2403
|
* The number comes from the pathway's live ULN config:
|
|
2395
2404
|
* `srcBlockTime × confirmations + dstBlockTime × (2 + dvnCount)`, floored at the
|
|
2396
2405
|
* source chain's {@link BridgeChainConfig.minDeliverySec} where the confirmation
|
|
2397
|
-
* count is not the whole wait. This is what the DVNs are actually bound by, so it
|
|
2406
|
+
* count is not the whole wait (unless the asset sets its own floor). This is what the DVNs are actually bound by, so it
|
|
2398
2407
|
* tracks a config change the moment it lands — and on every pathway that is purely
|
|
2399
2408
|
* confirmation-bound it agrees with both usdt0.to's own estimate and the delivery
|
|
2400
2409
|
* times Scan reports to well under a percent.
|
|
@@ -2437,7 +2446,8 @@ var LayerZeroService = class {
|
|
|
2437
2446
|
);
|
|
2438
2447
|
formulaSeconds = Number.isFinite(computed) ? computed : void 0;
|
|
2439
2448
|
}
|
|
2440
|
-
const
|
|
2449
|
+
const floor = srcToken.minDeliverySec ?? src.minDeliverySec;
|
|
2450
|
+
const resolved = resolveDeliverySeconds(formulaSeconds, observedSeconds, floor);
|
|
2441
2451
|
if (!resolved) {
|
|
2442
2452
|
throw new StableQuoteError({
|
|
2443
2453
|
provider: "layerzero",
|
|
@@ -2940,6 +2950,7 @@ export {
|
|
|
2940
2950
|
ERC3009_ABI,
|
|
2941
2951
|
Network,
|
|
2942
2952
|
OFT_ADAPTER_ABI,
|
|
2953
|
+
STABLE_PYUSD_ADDRESS,
|
|
2943
2954
|
STABLE_USDT_ADDRESS,
|
|
2944
2955
|
STABLE_VAULT_ADDRESS,
|
|
2945
2956
|
StableBulkError,
|