@circle-fin/app-kit 1.12.0 → 1.12.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/bridge.d.cts CHANGED
@@ -2957,6 +2957,18 @@ interface TokenActionMap {
2957
2957
  */
2958
2958
  walletAddress?: string | undefined;
2959
2959
  };
2960
+ /**
2961
+ * Get the on-chain name of the token contract.
2962
+ *
2963
+ * This is a read-only operation. For USDC the value is also the EIP-712
2964
+ * domain name, which permit and authorize signing flows need.
2965
+ */
2966
+ name: ActionParameters & {
2967
+ /**
2968
+ * The contract address of the token.
2969
+ */
2970
+ tokenAddress: string;
2971
+ };
2960
2972
  }
2961
2973
 
2962
2974
  /**
@@ -3786,6 +3798,30 @@ declare class ActionRegistry {
3786
3798
  executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
3787
3799
  }
3788
3800
 
3801
+ /**
3802
+ * Canonical list of actions that do not prepare or submit transactions.
3803
+ *
3804
+ * @internal
3805
+ */
3806
+ declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
3807
+ /**
3808
+ * Action keys that execute without preparing or submitting a transaction.
3809
+ *
3810
+ * @remarks
3811
+ * Derive this type from the canonical runtime list so compile-time and runtime
3812
+ * classification cannot drift. `gateway.v1.signBurnIntents` is included
3813
+ * because the action system models off-chain signing as a read action: it does
3814
+ * not prepare a chain request.
3815
+ *
3816
+ * @example
3817
+ * ```typescript
3818
+ * import type { ReadActionKey } from '@core/adapter'
3819
+ *
3820
+ * const action: ReadActionKey = 'token.allowance'
3821
+ * ```
3822
+ */
3823
+ type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
3824
+
3789
3825
  /**
3790
3826
  * Defines the capabilities of an adapter, including address handling patterns and supported chains.
3791
3827
  *
@@ -3954,6 +3990,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
3954
3990
  * ```
3955
3991
  */
3956
3992
  prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
3993
+ /**
3994
+ * Execute a non-transaction action without routing through transaction preparation.
3995
+ *
3996
+ * @remarks
3997
+ * Use this seam for balance, allowance, contract-state, and other actions
3998
+ * classified as reads. It never calls {@link Adapter.prepareAction}, so
3999
+ * transaction authorization wrappers only observe actions that can produce a
4000
+ * signable chain request.
4001
+ *
4002
+ * @typeParam TActionKey - The read action key.
4003
+ * @param action - The read action to execute.
4004
+ * @param params - The parameters for the read action.
4005
+ * @param ctx - The operation context.
4006
+ * @returns The raw action response.
4007
+ * @throws {KitError} When the key is not a read action or no handler is registered.
4008
+ * @throws Error When the operation context or action handler fails.
4009
+ *
4010
+ * @example
4011
+ * ```typescript
4012
+ * import { Ethereum } from '@core/chains'
4013
+ *
4014
+ * const balance = await adapter.readAction(
4015
+ * 'token.balanceOf',
4016
+ * { tokenAddress, walletAddress },
4017
+ * { chain: Ethereum },
4018
+ * )
4019
+ * ```
4020
+ *
4021
+ * @internal
4022
+ */
4023
+ readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
4024
+ /**
4025
+ * Read the current token allowance a delegate holds over an owner's tokens.
4026
+ *
4027
+ * @remarks
4028
+ * Perform a network read through {@link Adapter.readAction}. This method
4029
+ * never routes through {@link Adapter.prepareAction}. On chains without an
4030
+ * allowance model, such as Solana, return the maximum uint256 value.
4031
+ *
4032
+ * @param params - The token to query and the delegate whose allowance is being read.
4033
+ * @param ctx - Operation context with compile-time validated address requirements.
4034
+ * @returns A promise resolving to the current allowance in the token's base units.
4035
+ * @throws {KitError} When the adapter does not register a `token.allowance` handler.
4036
+ * @throws Error When the operation context or action handler fails.
4037
+ *
4038
+ * @example
4039
+ * ```typescript
4040
+ * import type { Adapter } from '@core/adapter'
4041
+ * import { Ethereum } from '@core/chains'
4042
+ *
4043
+ * declare const adapter: Adapter
4044
+ *
4045
+ * const allowance = await adapter.getTokenAllowance(
4046
+ * {
4047
+ * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
4048
+ * delegate: '0x1111111111111111111111111111111111111111',
4049
+ * },
4050
+ * { chain: Ethereum },
4051
+ * )
4052
+ * console.log(allowance) // 1000000n
4053
+ * ```
4054
+ */
4055
+ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
3957
4056
  /**
3958
4057
  * Prepares a transaction for future gas estimation and execution.
3959
4058
  *
@@ -7635,7 +7734,7 @@ interface AppKitContext {
7635
7734
  * token: 'USDC'
7636
7735
  * })
7637
7736
  *
7638
- * console.log('Bridge completed:', result.hash)
7737
+ * console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
7639
7738
  * ```
7640
7739
  */
7641
7740
  declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;
package/bridge.d.mts CHANGED
@@ -2957,6 +2957,18 @@ interface TokenActionMap {
2957
2957
  */
2958
2958
  walletAddress?: string | undefined;
2959
2959
  };
2960
+ /**
2961
+ * Get the on-chain name of the token contract.
2962
+ *
2963
+ * This is a read-only operation. For USDC the value is also the EIP-712
2964
+ * domain name, which permit and authorize signing flows need.
2965
+ */
2966
+ name: ActionParameters & {
2967
+ /**
2968
+ * The contract address of the token.
2969
+ */
2970
+ tokenAddress: string;
2971
+ };
2960
2972
  }
2961
2973
 
2962
2974
  /**
@@ -3786,6 +3798,30 @@ declare class ActionRegistry {
3786
3798
  executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
3787
3799
  }
3788
3800
 
3801
+ /**
3802
+ * Canonical list of actions that do not prepare or submit transactions.
3803
+ *
3804
+ * @internal
3805
+ */
3806
+ declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
3807
+ /**
3808
+ * Action keys that execute without preparing or submitting a transaction.
3809
+ *
3810
+ * @remarks
3811
+ * Derive this type from the canonical runtime list so compile-time and runtime
3812
+ * classification cannot drift. `gateway.v1.signBurnIntents` is included
3813
+ * because the action system models off-chain signing as a read action: it does
3814
+ * not prepare a chain request.
3815
+ *
3816
+ * @example
3817
+ * ```typescript
3818
+ * import type { ReadActionKey } from '@core/adapter'
3819
+ *
3820
+ * const action: ReadActionKey = 'token.allowance'
3821
+ * ```
3822
+ */
3823
+ type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
3824
+
3789
3825
  /**
3790
3826
  * Defines the capabilities of an adapter, including address handling patterns and supported chains.
3791
3827
  *
@@ -3954,6 +3990,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
3954
3990
  * ```
3955
3991
  */
3956
3992
  prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
3993
+ /**
3994
+ * Execute a non-transaction action without routing through transaction preparation.
3995
+ *
3996
+ * @remarks
3997
+ * Use this seam for balance, allowance, contract-state, and other actions
3998
+ * classified as reads. It never calls {@link Adapter.prepareAction}, so
3999
+ * transaction authorization wrappers only observe actions that can produce a
4000
+ * signable chain request.
4001
+ *
4002
+ * @typeParam TActionKey - The read action key.
4003
+ * @param action - The read action to execute.
4004
+ * @param params - The parameters for the read action.
4005
+ * @param ctx - The operation context.
4006
+ * @returns The raw action response.
4007
+ * @throws {KitError} When the key is not a read action or no handler is registered.
4008
+ * @throws Error When the operation context or action handler fails.
4009
+ *
4010
+ * @example
4011
+ * ```typescript
4012
+ * import { Ethereum } from '@core/chains'
4013
+ *
4014
+ * const balance = await adapter.readAction(
4015
+ * 'token.balanceOf',
4016
+ * { tokenAddress, walletAddress },
4017
+ * { chain: Ethereum },
4018
+ * )
4019
+ * ```
4020
+ *
4021
+ * @internal
4022
+ */
4023
+ readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
4024
+ /**
4025
+ * Read the current token allowance a delegate holds over an owner's tokens.
4026
+ *
4027
+ * @remarks
4028
+ * Perform a network read through {@link Adapter.readAction}. This method
4029
+ * never routes through {@link Adapter.prepareAction}. On chains without an
4030
+ * allowance model, such as Solana, return the maximum uint256 value.
4031
+ *
4032
+ * @param params - The token to query and the delegate whose allowance is being read.
4033
+ * @param ctx - Operation context with compile-time validated address requirements.
4034
+ * @returns A promise resolving to the current allowance in the token's base units.
4035
+ * @throws {KitError} When the adapter does not register a `token.allowance` handler.
4036
+ * @throws Error When the operation context or action handler fails.
4037
+ *
4038
+ * @example
4039
+ * ```typescript
4040
+ * import type { Adapter } from '@core/adapter'
4041
+ * import { Ethereum } from '@core/chains'
4042
+ *
4043
+ * declare const adapter: Adapter
4044
+ *
4045
+ * const allowance = await adapter.getTokenAllowance(
4046
+ * {
4047
+ * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
4048
+ * delegate: '0x1111111111111111111111111111111111111111',
4049
+ * },
4050
+ * { chain: Ethereum },
4051
+ * )
4052
+ * console.log(allowance) // 1000000n
4053
+ * ```
4054
+ */
4055
+ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
3957
4056
  /**
3958
4057
  * Prepares a transaction for future gas estimation and execution.
3959
4058
  *
@@ -7635,7 +7734,7 @@ interface AppKitContext {
7635
7734
  * token: 'USDC'
7636
7735
  * })
7637
7736
  *
7638
- * console.log('Bridge completed:', result.hash)
7737
+ * console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
7639
7738
  * ```
7640
7739
  */
7641
7740
  declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;
package/bridge.d.ts CHANGED
@@ -2957,6 +2957,18 @@ interface TokenActionMap {
2957
2957
  */
2958
2958
  walletAddress?: string | undefined;
2959
2959
  };
2960
+ /**
2961
+ * Get the on-chain name of the token contract.
2962
+ *
2963
+ * This is a read-only operation. For USDC the value is also the EIP-712
2964
+ * domain name, which permit and authorize signing flows need.
2965
+ */
2966
+ name: ActionParameters & {
2967
+ /**
2968
+ * The contract address of the token.
2969
+ */
2970
+ tokenAddress: string;
2971
+ };
2960
2972
  }
2961
2973
 
2962
2974
  /**
@@ -3786,6 +3798,30 @@ declare class ActionRegistry {
3786
3798
  executeAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, context: ResolvedOperationContext): Promise<PreparedChainRequest>;
3787
3799
  }
3788
3800
 
3801
+ /**
3802
+ * Canonical list of actions that do not prepare or submit transactions.
3803
+ *
3804
+ * @internal
3805
+ */
3806
+ declare const READ_ACTION_KEYS: readonly ["token.allowance", "token.balanceOf", "token.name", "native.balanceOf", "usdc.allowance", "usdc.balanceOf", "usdc.name", "gateway.v1.isDelegate", "gateway.v1.withdrawingBalance", "gateway.v1.withdrawalBlock", "gateway.v1.signBurnIntents"];
3807
+ /**
3808
+ * Action keys that execute without preparing or submitting a transaction.
3809
+ *
3810
+ * @remarks
3811
+ * Derive this type from the canonical runtime list so compile-time and runtime
3812
+ * classification cannot drift. `gateway.v1.signBurnIntents` is included
3813
+ * because the action system models off-chain signing as a read action: it does
3814
+ * not prepare a chain request.
3815
+ *
3816
+ * @example
3817
+ * ```typescript
3818
+ * import type { ReadActionKey } from '@core/adapter'
3819
+ *
3820
+ * const action: ReadActionKey = 'token.allowance'
3821
+ * ```
3822
+ */
3823
+ type ReadActionKey = (typeof READ_ACTION_KEYS)[number];
3824
+
3789
3825
  /**
3790
3826
  * Defines the capabilities of an adapter, including address handling patterns and supported chains.
3791
3827
  *
@@ -3954,6 +3990,69 @@ declare abstract class Adapter<TAdapterCapabilities extends AdapterCapabilities
3954
3990
  * ```
3955
3991
  */
3956
3992
  prepareAction<TActionKey extends ActionKeys>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<PreparedChainRequest>;
3993
+ /**
3994
+ * Execute a non-transaction action without routing through transaction preparation.
3995
+ *
3996
+ * @remarks
3997
+ * Use this seam for balance, allowance, contract-state, and other actions
3998
+ * classified as reads. It never calls {@link Adapter.prepareAction}, so
3999
+ * transaction authorization wrappers only observe actions that can produce a
4000
+ * signable chain request.
4001
+ *
4002
+ * @typeParam TActionKey - The read action key.
4003
+ * @param action - The read action to execute.
4004
+ * @param params - The parameters for the read action.
4005
+ * @param ctx - The operation context.
4006
+ * @returns The raw action response.
4007
+ * @throws {KitError} When the key is not a read action or no handler is registered.
4008
+ * @throws Error When the operation context or action handler fails.
4009
+ *
4010
+ * @example
4011
+ * ```typescript
4012
+ * import { Ethereum } from '@core/chains'
4013
+ *
4014
+ * const balance = await adapter.readAction(
4015
+ * 'token.balanceOf',
4016
+ * { tokenAddress, walletAddress },
4017
+ * { chain: Ethereum },
4018
+ * )
4019
+ * ```
4020
+ *
4021
+ * @internal
4022
+ */
4023
+ readAction<TActionKey extends ReadActionKey>(action: TActionKey, params: ActionPayload<TActionKey>, ctx: OperationContext<TAdapterCapabilities>): Promise<unknown>;
4024
+ /**
4025
+ * Read the current token allowance a delegate holds over an owner's tokens.
4026
+ *
4027
+ * @remarks
4028
+ * Perform a network read through {@link Adapter.readAction}. This method
4029
+ * never routes through {@link Adapter.prepareAction}. On chains without an
4030
+ * allowance model, such as Solana, return the maximum uint256 value.
4031
+ *
4032
+ * @param params - The token to query and the delegate whose allowance is being read.
4033
+ * @param ctx - Operation context with compile-time validated address requirements.
4034
+ * @returns A promise resolving to the current allowance in the token's base units.
4035
+ * @throws {KitError} When the adapter does not register a `token.allowance` handler.
4036
+ * @throws Error When the operation context or action handler fails.
4037
+ *
4038
+ * @example
4039
+ * ```typescript
4040
+ * import type { Adapter } from '@core/adapter'
4041
+ * import { Ethereum } from '@core/chains'
4042
+ *
4043
+ * declare const adapter: Adapter
4044
+ *
4045
+ * const allowance = await adapter.getTokenAllowance(
4046
+ * {
4047
+ * tokenAddress: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
4048
+ * delegate: '0x1111111111111111111111111111111111111111',
4049
+ * },
4050
+ * { chain: Ethereum },
4051
+ * )
4052
+ * console.log(allowance) // 1000000n
4053
+ * ```
4054
+ */
4055
+ getTokenAllowance(params: ActionPayload<'token.allowance'>, ctx: OperationContext<TAdapterCapabilities>): Promise<bigint>;
3957
4056
  /**
3958
4057
  * Prepares a transaction for future gas estimation and execution.
3959
4058
  *
@@ -7635,7 +7734,7 @@ interface AppKitContext {
7635
7734
  * token: 'USDC'
7636
7735
  * })
7637
7736
  *
7638
- * console.log('Bridge completed:', result.hash)
7737
+ * console.log(`Bridged ${result.amount} ${result.token} (${result.state})`)
7639
7738
  * ```
7640
7739
  */
7641
7740
  declare const bridge: (context: AppKitContext, params: BridgeParams) => Promise<BridgeResult>;