@circle-fin/bridge-kit 1.1.0 → 1.1.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/CHANGELOG.md +109 -0
- package/{chains.cjs.js → chains.cjs} +1 -1
- package/chains.cjs.map +1 -0
- package/{index.cjs.js → index.cjs} +3446 -3444
- package/index.cjs.map +1 -0
- package/index.d.ts +67 -10
- package/index.mjs +3441 -3439
- package/package.json +8 -7
- package/chains.cjs.js.map +0 -1
- package/index.cjs.js.map +0 -1
package/index.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/index.d.ts
CHANGED
|
@@ -596,10 +596,11 @@ interface EvmPreparedChainRequest {
|
|
|
596
596
|
* Estimate the gas cost for the contract execution.
|
|
597
597
|
*
|
|
598
598
|
* @param overrides - Optional parameters to override the default estimation behavior
|
|
599
|
+
* @param fallback - Optional fallback gas information to use if the estimation fails
|
|
599
600
|
* @returns A promise that resolves to the estimated gas information
|
|
600
601
|
* @throws If the estimation fails
|
|
601
602
|
*/
|
|
602
|
-
estimate(overrides?: EvmEstimateOverrides): Promise<EstimatedGas>;
|
|
603
|
+
estimate(overrides?: EvmEstimateOverrides, fallback?: EstimatedGas): Promise<EstimatedGas>;
|
|
603
604
|
/**
|
|
604
605
|
* Execute the prepared contract call.
|
|
605
606
|
*
|
|
@@ -677,7 +678,7 @@ interface SolanaPreparedChainRequest {
|
|
|
677
678
|
/** The type of the chain request. */
|
|
678
679
|
type: 'solana';
|
|
679
680
|
/** Estimate the compute units and fee for the transaction. */
|
|
680
|
-
estimate(overrides?: SolanaEstimateOverrides): Promise<EstimatedGas>;
|
|
681
|
+
estimate(overrides?: SolanaEstimateOverrides, fallback?: EstimatedGas): Promise<EstimatedGas>;
|
|
681
682
|
/** Execute the prepared transaction. */
|
|
682
683
|
execute(overrides?: SolanaExecuteOverrides): Promise<string>;
|
|
683
684
|
}
|
|
@@ -709,7 +710,7 @@ interface NoopPreparedChainRequest {
|
|
|
709
710
|
* Placeholder for the estimate method.
|
|
710
711
|
* @returns The estimated gas cost.
|
|
711
712
|
*/
|
|
712
|
-
estimate: () => Promise<EstimatedGas>;
|
|
713
|
+
estimate: (overrides?: EvmEstimateOverrides | SolanaEstimateOverrides, fallback?: EstimatedGas) => Promise<EstimatedGas>;
|
|
713
714
|
/**
|
|
714
715
|
* Placeholder for the execute method.
|
|
715
716
|
* @returns The transaction hash.
|
|
@@ -1967,10 +1968,23 @@ interface AdapterCapabilities {
|
|
|
1967
1968
|
*/
|
|
1968
1969
|
declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities> {
|
|
1969
1970
|
/**
|
|
1970
|
-
* The type of the chain.
|
|
1971
|
-
*
|
|
1971
|
+
* The type of the chain for this adapter.
|
|
1972
|
+
*
|
|
1973
|
+
* - For concrete adapters, this should be a real chain type (e.g., `'evm'`, `'solana'`, etc.) from the ChainType union.
|
|
1974
|
+
* - For hybrid adapters (adapters that route to concrete adapters supporting multiple ecosystems),
|
|
1975
|
+
* set this property to the string literal `'hybrid'`.
|
|
1976
|
+
*
|
|
1977
|
+
* Note: `'hybrid'` is not a legal ChainType and should only be used as a marker for multi-ecosystem adapters.
|
|
1978
|
+
* Hybrid adapters do not interact directly with any chain, but instead route requests to a concrete underlying adapter.
|
|
1979
|
+
*
|
|
1980
|
+
* @example
|
|
1981
|
+
* // For an EVM-only adapter:
|
|
1982
|
+
* chainType = 'evm'
|
|
1983
|
+
*
|
|
1984
|
+
* // For a hybrid adapter:
|
|
1985
|
+
* chainType = 'hybrid'
|
|
1972
1986
|
*/
|
|
1973
|
-
abstract chainType: ChainType;
|
|
1987
|
+
abstract chainType: ChainType | 'hybrid';
|
|
1974
1988
|
/**
|
|
1975
1989
|
* Capabilities of this adapter, defining address control model and supported chains.
|
|
1976
1990
|
*
|
|
@@ -2052,7 +2066,7 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
|
|
|
2052
2066
|
* })
|
|
2053
2067
|
* ```
|
|
2054
2068
|
*/
|
|
2055
|
-
prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx
|
|
2069
|
+
prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
|
|
2056
2070
|
/**
|
|
2057
2071
|
* Prepares a transaction for future gas estimation and execution.
|
|
2058
2072
|
*
|
|
@@ -2434,6 +2448,49 @@ TChainDefinition extends ChainDefinition = ChainDefinition> {
|
|
|
2434
2448
|
*/
|
|
2435
2449
|
chain: TChainDefinition;
|
|
2436
2450
|
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Wallet context for bridge destinations with optional custom recipient.
|
|
2453
|
+
*
|
|
2454
|
+
* Extends WalletContext to support scenarios where the recipient address
|
|
2455
|
+
* differs from the signer address (e.g., bridging to a third-party wallet).
|
|
2456
|
+
* The signer address is used for transaction authorization, while the
|
|
2457
|
+
* recipient address specifies where the minted funds should be sent.
|
|
2458
|
+
*
|
|
2459
|
+
* @typeParam TAdapterCapabilities - The adapter capabilities type to use for the wallet context.
|
|
2460
|
+
* @typeParam TChainDefinition - The chain definition type to use for the wallet context.
|
|
2461
|
+
*
|
|
2462
|
+
* @example
|
|
2463
|
+
* ```typescript
|
|
2464
|
+
* import type { DestinationWalletContext } from '@core/provider'
|
|
2465
|
+
* import { adapter, blockchain } from './setup'
|
|
2466
|
+
*
|
|
2467
|
+
* // Bridge to a custom recipient address
|
|
2468
|
+
* const destination: DestinationWalletContext = {
|
|
2469
|
+
* adapter,
|
|
2470
|
+
* address: '0x1234...abcd', // Signer address
|
|
2471
|
+
* chain: blockchain,
|
|
2472
|
+
* recipientAddress: '0x9876...fedc' // Custom recipient
|
|
2473
|
+
* }
|
|
2474
|
+
* ```
|
|
2475
|
+
*/
|
|
2476
|
+
interface DestinationWalletContext<TAdapterCapabilities extends AdapterCapabilities = AdapterCapabilities,
|
|
2477
|
+
/**
|
|
2478
|
+
* The chain definition type to use for the wallet context.
|
|
2479
|
+
*
|
|
2480
|
+
* @defaultValue ChainDefinition
|
|
2481
|
+
*/
|
|
2482
|
+
TChainDefinition extends ChainDefinition = ChainDefinition> extends WalletContext<TAdapterCapabilities, TChainDefinition> {
|
|
2483
|
+
/**
|
|
2484
|
+
* Optional custom recipient address for minted funds.
|
|
2485
|
+
*
|
|
2486
|
+
* When provided, minted tokens will be sent to this address instead of
|
|
2487
|
+
* the address specified in the wallet context. The wallet context address
|
|
2488
|
+
* is still used for transaction signing and authorization.
|
|
2489
|
+
*
|
|
2490
|
+
* Must be a valid address format for the specified blockchain.
|
|
2491
|
+
*/
|
|
2492
|
+
recipientAddress?: string;
|
|
2493
|
+
}
|
|
2437
2494
|
/**
|
|
2438
2495
|
* Parameters for executing a cross-chain bridge operation.
|
|
2439
2496
|
*/
|
|
@@ -2447,7 +2504,7 @@ TChainDefinition extends ChainDefinition = ChainDefinition> {
|
|
|
2447
2504
|
/** The source adapter containing wallet and chain information */
|
|
2448
2505
|
source: WalletContext<TFromCapabilities, TChainDefinition>;
|
|
2449
2506
|
/** The destination adapter containing wallet and chain information */
|
|
2450
|
-
destination:
|
|
2507
|
+
destination: DestinationWalletContext<TToCapabilities, TChainDefinition>;
|
|
2451
2508
|
/** The amount to transfer (as a string to avoid precision issues) */
|
|
2452
2509
|
amount: string;
|
|
2453
2510
|
/** The token to transfer (currently only USDC is supported) */
|
|
@@ -4263,5 +4320,5 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
4263
4320
|
*/
|
|
4264
4321
|
declare function getErrorCode(error: unknown): number | null;
|
|
4265
4322
|
|
|
4266
|
-
export { Blockchain, BridgeKit, KitError, bridgeParamsWithChainIdentifierSchema, getErrorCode, getErrorMessage, isFatalError, isInputError, isKitError, isRetryableError, setExternalPrefix };
|
|
4267
|
-
export type { ActionHandler, BridgeKitConfig, BridgeParams, BridgeResult, ChainDefinition, ChainIdentifier, ErrorDetails, Recoverability };
|
|
4323
|
+
export { Blockchain, BridgeKit, KitError, TransferSpeed, bridgeParamsWithChainIdentifierSchema, getErrorCode, getErrorMessage, isFatalError, isInputError, isKitError, isRetryableError, setExternalPrefix };
|
|
4324
|
+
export type { ActionHandler, AdapterContext, BridgeConfig, BridgeKitConfig, BridgeParams, BridgeResult, ChainDefinition, ChainIdentifier, CustomFeePolicy, ErrorDetails, Recoverability };
|