@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@circle-fin/app-kit",
3
- "version": "1.12.0",
3
+ "version": "1.12.1",
4
4
  "description": "A one-stop Circle SDK solution for building stablecoin (e.g. USDC) applications, with bridging, swapping, and more on-chain operations",
5
5
  "keywords": [
6
6
  "circle",
@@ -36,11 +36,11 @@
36
36
  "module": "./index.mjs",
37
37
  "types": "./index.d.cts",
38
38
  "dependencies": {
39
- "@circle-fin/unified-balance-kit": "1.4.0",
40
- "@circle-fin/provider-gateway-v1": "1.2.0",
41
- "@circle-fin/earn-kit": "1.5.0",
39
+ "@circle-fin/unified-balance-kit": "1.4.1",
40
+ "@circle-fin/provider-gateway-v1": "1.2.1",
41
+ "@circle-fin/earn-kit": "1.5.1",
42
42
  "@circle-fin/bridge-kit": "1.13.0",
43
- "@circle-fin/swap-kit": "1.5.1",
43
+ "@circle-fin/swap-kit": "1.5.2",
44
44
  "@coral-xyz/anchor": "^0.31.1",
45
45
  "@noble/curves": "1.4.2",
46
46
  "bn.js": "^5.2.3",
package/swap.cjs CHANGED
@@ -8761,6 +8761,7 @@ const swapTokenEnumSchema = zod.z.enum([
8761
8761
  [Blockchain.Arbitrum_Sepolia]: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
8762
8762
  [Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
8763
8763
  [Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
8764
+ [Blockchain.Celo_Alfajores_Testnet]: '0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B',
8764
8765
  [Blockchain.Codex_Testnet]: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f',
8765
8766
  [Blockchain.Cronos_Testnet]: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
8766
8767
  [Blockchain.Edge_Testnet]: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B',
@@ -10128,6 +10129,44 @@ var pkg$2 = {
10128
10129
  }
10129
10130
  });
10130
10131
 
10132
+ /**
10133
+ * Canonical list of actions that do not prepare or submit transactions.
10134
+ *
10135
+ * @internal
10136
+ */ const READ_ACTION_KEYS = [
10137
+ 'token.allowance',
10138
+ 'token.balanceOf',
10139
+ 'token.name',
10140
+ 'native.balanceOf',
10141
+ 'usdc.allowance',
10142
+ 'usdc.balanceOf',
10143
+ 'usdc.name',
10144
+ 'gateway.v1.isDelegate',
10145
+ 'gateway.v1.withdrawingBalance',
10146
+ 'gateway.v1.withdrawalBlock',
10147
+ 'gateway.v1.signBurnIntents'
10148
+ ];
10149
+ const READ_ACTION_KEY_SET = new Set(READ_ACTION_KEYS);
10150
+ /**
10151
+ * Check whether a runtime value identifies a read action.
10152
+ *
10153
+ * @param action - The value to classify.
10154
+ * @returns Whether the value is a registered read-action key.
10155
+ *
10156
+ * @example
10157
+ * ```typescript
10158
+ * import { isReadActionKey } from '@core/adapter'
10159
+ *
10160
+ * if (isReadActionKey(value)) {
10161
+ * await adapter.readAction(value, params, context)
10162
+ * }
10163
+ * ```
10164
+ *
10165
+ * @internal
10166
+ */ function isReadActionKey(action) {
10167
+ return typeof action === 'string' && READ_ACTION_KEY_SET.has(action);
10168
+ }
10169
+
10131
10170
  /**
10132
10171
  * Resolves an operation context into concrete chain and address values.
10133
10172
  *
@@ -10207,6 +10246,141 @@ var pkg$2 = {
10207
10246
  };
10208
10247
  }
10209
10248
 
10249
+ /**
10250
+ * Create the standard error for a missing or non-read action.
10251
+ *
10252
+ * @param action - The unsupported action value.
10253
+ * @returns A fatal unsupported-action error.
10254
+ *
10255
+ * @internal
10256
+ */ function createUnsupportedReadActionError(action) {
10257
+ return new KitError({
10258
+ ...InputError.UNSUPPORTED_ACTION,
10259
+ recoverability: 'FATAL',
10260
+ message: `Read action "${String(action)}" is not registered in this adapter.`
10261
+ });
10262
+ }
10263
+ /**
10264
+ * Execute a read through the adapter's dedicated read seam when available.
10265
+ *
10266
+ * @remarks
10267
+ * Fall back to the legacy `prepareAction().execute()` contract so providers
10268
+ * remain runtime-compatible with adapter versions released before `readAction`.
10269
+ * Consumers must upgrade their adapter package for reads to bypass custom
10270
+ * `prepareAction` wrappers.
10271
+ *
10272
+ * @typeParam TAdapterCapabilities - The adapter capabilities type.
10273
+ * @typeParam TActionKey - The read action key.
10274
+ * @param adapter - The adapter that owns the read action.
10275
+ * @param action - The read action to execute.
10276
+ * @param params - The parameters for the read action.
10277
+ * @param ctx - The operation context.
10278
+ * @returns The raw read-action result.
10279
+ * @throws {KitError} When `action` is not a supported read-action key.
10280
+ *
10281
+ * @example
10282
+ * ```typescript
10283
+ * import { executeAdapterReadAction } from '@core/adapter'
10284
+ * import { Ethereum } from '@core/chains'
10285
+ *
10286
+ * const allowance = await executeAdapterReadAction(
10287
+ * adapter,
10288
+ * 'token.allowance',
10289
+ * { tokenAddress, delegate },
10290
+ * { chain: Ethereum },
10291
+ * )
10292
+ * ```
10293
+ *
10294
+ * @internal
10295
+ */ async function executeAdapterReadAction(adapter, action, params, ctx) {
10296
+ if (!isReadActionKey(action)) {
10297
+ throw createUnsupportedReadActionError(action);
10298
+ }
10299
+ const runtimeAdapter = adapter;
10300
+ if (typeof runtimeAdapter.readAction === 'function') {
10301
+ return runtimeAdapter.readAction(action, params, ctx);
10302
+ }
10303
+ let request;
10304
+ try {
10305
+ request = await adapter.prepareAction(action, params, ctx);
10306
+ } catch (error) {
10307
+ if (error instanceof Error && error.message === `Action ${action} is not supported`) {
10308
+ throw createUnsupportedReadActionError(action);
10309
+ }
10310
+ throw error;
10311
+ }
10312
+ return request.execute();
10313
+ }
10314
+ /**
10315
+ * Read and parse a token allowance while supporting older adapter versions.
10316
+ *
10317
+ * @remarks
10318
+ * Prefer the adapter's dedicated read seam and fall back to the legacy
10319
+ * `prepareAction().execute()` contract when the runtime adapter predates it.
10320
+ *
10321
+ * @typeParam TAdapterCapabilities - The adapter capabilities type.
10322
+ * @param adapter - The adapter that owns the allowance action.
10323
+ * @param params - The token and delegate whose allowance is being read.
10324
+ * @param ctx - The operation context.
10325
+ * @returns The non-negative allowance in token base units.
10326
+ * @throws {KitError} When the action is unsupported or its response is malformed.
10327
+ *
10328
+ * @example
10329
+ * ```typescript
10330
+ * import { readTokenAllowance } from '@core/adapter'
10331
+ * import { Ethereum } from '@core/chains'
10332
+ *
10333
+ * const allowance = await readTokenAllowance(
10334
+ * adapter,
10335
+ * { tokenAddress, delegate },
10336
+ * { chain: Ethereum },
10337
+ * )
10338
+ * ```
10339
+ *
10340
+ * @internal
10341
+ */ async function readTokenAllowance(adapter, params, ctx) {
10342
+ return parseAllowanceResponse(await executeAdapterReadAction(adapter, 'token.allowance', params, ctx));
10343
+ }
10344
+ /**
10345
+ * Parse a raw token allowance response into base units.
10346
+ *
10347
+ * @param allowanceRaw - The adapter response, optionally wrapped as an Amount output.
10348
+ * @returns The non-negative allowance as a bigint, or zero for a missing value.
10349
+ * @throws {KitError} When the response cannot represent a non-negative bigint.
10350
+ *
10351
+ * @example
10352
+ * ```typescript
10353
+ * import { parseAllowanceResponse } from '@core/adapter'
10354
+ *
10355
+ * const allowance = parseAllowanceResponse({ amount: { raw: 1000000n } })
10356
+ * ```
10357
+ */ function parseAllowanceResponse(allowanceRaw) {
10358
+ let value = allowanceRaw;
10359
+ if (typeof value === 'object' && value !== null && 'amount' in value) {
10360
+ const amount = value.amount;
10361
+ if (typeof amount === 'object' && amount !== null && 'raw' in amount) {
10362
+ value = amount.raw;
10363
+ }
10364
+ }
10365
+ if (value === undefined || value === null) {
10366
+ return 0n;
10367
+ }
10368
+ let allowance;
10369
+ if (typeof value === 'bigint') {
10370
+ allowance = value;
10371
+ } else if (typeof value === 'string') {
10372
+ try {
10373
+ allowance = BigInt(value);
10374
+ } catch {
10375
+ allowance = undefined;
10376
+ }
10377
+ }
10378
+ if (allowance === undefined || allowance < 0n) {
10379
+ throw createValidationFailedError$1('token.allowance', value, 'token.allowance response must be a non-negative bigint-compatible string or bigint');
10380
+ }
10381
+ return allowance;
10382
+ }
10383
+
10210
10384
  /**
10211
10385
  * Schema for validating hexadecimal strings with '0x' prefix.
10212
10386
  *
@@ -10984,7 +11158,7 @@ var TransferSpeed;
10984
11158
  registerKit(`${pkg$2.name}/${pkg$2.version}`);
10985
11159
 
10986
11160
  var name$1 = "@circle-fin/swap-kit";
10987
- var version$1 = "1.5.1";
11161
+ var version$1 = "1.5.2";
10988
11162
  var pkg$1 = {
10989
11163
  name: name$1,
10990
11164
  version: version$1};
@@ -15304,14 +15478,13 @@ const TOKEN_REGISTRY$2 = createTokenRegistry();
15304
15478
  return;
15305
15479
  }
15306
15480
  // For non-native tokens (SPL tokens, ERC-20 tokens), check the token balance
15307
- const balancePrepared = await adapter.prepareAction('token.balanceOf', {
15481
+ const balance = await executeAdapterReadAction(adapter, 'token.balanceOf', {
15308
15482
  tokenAddress: tokenInAddress,
15309
15483
  walletAddress
15310
15484
  }, context);
15311
- const balance = await balancePrepared.execute();
15312
15485
  // Compare balances
15313
15486
  const requiredAmount = BigInt(amount);
15314
- const currentBalance = BigInt(balance);
15487
+ const currentBalance = BigInt(String(balance));
15315
15488
  if (currentBalance < requiredAmount) {
15316
15489
  throw new KitError({
15317
15490
  ...BalanceError.INSUFFICIENT_TOKEN,
@@ -16472,11 +16645,10 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
16472
16645
  * @throws Error if the adapter fails to prepare or execute approval transactions
16473
16646
  * @throws Error if transaction confirmation fails or times out
16474
16647
  */ async handleUsdtApproval(adapter, chain, executionCtx, adapterContractAddress, resolvedContext, executedTransactions) {
16475
- const allowanceRequest = await adapter.prepareAction('token.allowance', {
16648
+ const current = await readTokenAllowance(adapter, {
16476
16649
  tokenAddress: executionCtx.tokenInAddress,
16477
16650
  delegate: adapterContractAddress
16478
16651
  }, resolvedContext);
16479
- const current = BigInt(await allowanceRequest.execute());
16480
16652
  const required = BigInt(executionCtx.amount);
16481
16653
  if (current >= required) {
16482
16654
  // Sufficient allowance - proceed to swap
@@ -21250,7 +21422,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
21250
21422
  };
21251
21423
 
21252
21424
  var name = "@circle-fin/earn-kit";
21253
- var version = "1.5.0";
21425
+ var version = "1.5.1";
21254
21426
  var pkg = {
21255
21427
  name: name,
21256
21428
  version: version};
package/swap.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
  *
package/swap.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
  *
package/swap.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
  *