@dynamic-labs/ethereum-gasless-core 4.100.0 → 4.100.2

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +4 -3
  5. package/src/lib/generateIntentNonce/generateIntentNonce.cjs +22 -1
  6. package/src/lib/generateIntentNonce/generateIntentNonce.d.ts +3 -1
  7. package/src/lib/generateIntentNonce/generateIntentNonce.js +22 -1
  8. package/src/lib/getAvailableEvmGaslessRelayer/getAvailableEvmGaslessRelayer.cjs +9 -0
  9. package/src/lib/getAvailableEvmGaslessRelayer/getAvailableEvmGaslessRelayer.js +9 -0
  10. package/src/lib/is7702DelegationActive/is7702DelegationActive.cjs +28 -0
  11. package/src/lib/is7702DelegationActive/is7702DelegationActive.js +29 -1
  12. package/src/lib/logger/logger.cjs +15 -0
  13. package/src/lib/logger/logger.d.ts +6 -0
  14. package/src/lib/logger/logger.js +10 -0
  15. package/src/lib/relaySponsoredTransaction/relaySponsoredTransaction.cjs +10 -0
  16. package/src/lib/relaySponsoredTransaction/relaySponsoredTransaction.js +10 -0
  17. package/src/lib/resolveAuthorization/resolveAuthorization.cjs +34 -1
  18. package/src/lib/resolveAuthorization/resolveAuthorization.js +34 -1
  19. package/src/lib/sendSponsoredTransaction/sendSponsoredTransaction.cjs +25 -2
  20. package/src/lib/sendSponsoredTransaction/sendSponsoredTransaction.js +25 -2
  21. package/src/lib/sign7702Authorization/sign7702Authorization.cjs +15 -5
  22. package/src/lib/sign7702Authorization/sign7702Authorization.js +15 -5
  23. package/src/lib/signSponsoredTransaction/signSponsoredTransaction.cjs +22 -1
  24. package/src/lib/signSponsoredTransaction/signSponsoredTransaction.js +22 -1
  25. package/src/lib/waitForSponsoredTransaction/waitForSponsoredTransaction.cjs +31 -1
  26. package/src/lib/waitForSponsoredTransaction/waitForSponsoredTransaction.d.ts +5 -1
  27. package/src/lib/waitForSponsoredTransaction/waitForSponsoredTransaction.js +31 -1
package/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ### [4.100.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.100.1...v4.100.2) (2026-09-17)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **webview-controller:** route MetaMask connector storage through native secure storage [V4 backport] ([#12418](https://github.com/dynamic-labs/dynamic-auth/issues/12418)) ([0a9047c](https://github.com/dynamic-labs/dynamic-auth/commit/0a9047c72f184fca3fd27116d0a9eaa0a5bc69e6)), closes [#12304](https://github.com/dynamic-labs/dynamic-auth/issues/12304)
8
+
9
+ ### [4.100.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.100.0...v4.100.1) (2026-09-16)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **ethereum-core:** prefer dashboard-saved RPC urls when mapping viem chains ([#12407](https://github.com/dynamic-labs/dynamic-auth/issues/12407)) ([e794605](https://github.com/dynamic-labs/dynamic-auth/commit/e79460541f5d99caee64e9f4699baa1bf1b36544))
15
+ * **wallet-connect:** fix Rabby WalletConnect connection on Mobile [V4 backport] ([#12387](https://github.com/dynamic-labs/dynamic-auth/issues/12387)) ([a2f137f](https://github.com/dynamic-labs/dynamic-auth/commit/a2f137f5dc203f7fbfc4399b9999751c22851654))
16
+
2
17
  ## [4.100.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.99.0...v4.100.0) (2026-09-10)
3
18
 
4
19
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.100.0";
6
+ var version = "4.100.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.100.0";
2
+ var version = "4.100.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-gasless-core",
3
- "version": "4.100.0",
3
+ "version": "4.100.2",
4
4
  "main": "./src/index.cjs",
5
5
  "module": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -14,8 +14,9 @@
14
14
  "./package.json": "./package.json"
15
15
  },
16
16
  "dependencies": {
17
- "@dynamic-labs/sdk-api-core": "0.12.0",
18
- "@dynamic-labs/assert-package-version": "4.100.0"
17
+ "@dynamic-labs/sdk-api-core": "0.40.0",
18
+ "@dynamic-labs/assert-package-version": "4.100.2",
19
+ "@dynamic-labs/logger": "4.100.2"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "viem": "^2.45.3"
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('../constants.cjs');
7
7
  var generateRandomNonce = require('../generateRandomNonce/generateRandomNonce.cjs');
8
+ var logger = require('../logger/logger.cjs');
8
9
 
9
10
  /**
10
11
  * Generates a random 256-bit bitmap nonce for UGD `AuthorizedExecutions`
@@ -16,7 +17,8 @@ var generateRandomNonce = require('../generateRandomNonce/generateRandomNonce.cj
16
17
  * fails (e.g. delegation not yet active), the random nonce is still safe to
17
18
  * use because it was generated locally with 256 bits of entropy.
18
19
  */
19
- const generateIntentNonce = async ({ walletAddress }, { publicClient }) => {
20
+ const generateIntentNonce = async ({ walletAddress }, { chainId, publicClient }) => {
21
+ const startedAt = Date.now();
20
22
  const nonce = generateRandomNonce.generateRandomNonce();
21
23
  try {
22
24
  const isUsed = await publicClient.readContract({
@@ -26,13 +28,32 @@ const generateIntentNonce = async ({ walletAddress }, { publicClient }) => {
26
28
  functionName: 'isNonceUsed',
27
29
  });
28
30
  if (isUsed) {
31
+ logger.logger.instrument('[evm-gasless] generateIntentNonce - completed', {
32
+ chainId,
33
+ key: 'generateIntentNonce-completed',
34
+ nonceCheck: 'used',
35
+ time: Date.now() - startedAt,
36
+ });
29
37
  return generateRandomNonce.generateRandomNonce();
30
38
  }
31
39
  }
32
40
  catch {
33
41
  // Contract call may fail if delegation is not yet active — the nonce is
34
42
  // still safe to use since it was randomly generated.
43
+ logger.logger.instrument('[evm-gasless] generateIntentNonce - completed', {
44
+ chainId,
45
+ key: 'generateIntentNonce-completed',
46
+ nonceCheck: 'failed',
47
+ time: Date.now() - startedAt,
48
+ });
49
+ return nonce;
35
50
  }
51
+ logger.logger.instrument('[evm-gasless] generateIntentNonce - completed', {
52
+ chainId,
53
+ key: 'generateIntentNonce-completed',
54
+ nonceCheck: 'unused',
55
+ time: Date.now() - startedAt,
56
+ });
36
57
  return nonce;
37
58
  };
38
59
 
@@ -4,6 +4,8 @@ type GenerateIntentNonceParams = {
4
4
  walletAddress: Hex;
5
5
  };
6
6
  type GenerateIntentNonceDeps = {
7
+ /** Optional chain ID, included in instrumentation logs when provided. */
8
+ chainId?: number;
7
9
  publicClient: PublicClient<Transport, Chain>;
8
10
  };
9
11
  /**
@@ -16,5 +18,5 @@ type GenerateIntentNonceDeps = {
16
18
  * fails (e.g. delegation not yet active), the random nonce is still safe to
17
19
  * use because it was generated locally with 256 bits of entropy.
18
20
  */
19
- export declare const generateIntentNonce: ({ walletAddress }: GenerateIntentNonceParams, { publicClient }: GenerateIntentNonceDeps) => Promise<bigint>;
21
+ export declare const generateIntentNonce: ({ walletAddress }: GenerateIntentNonceParams, { chainId, publicClient }: GenerateIntentNonceDeps) => Promise<bigint>;
20
22
  export {};
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { UGD_ABI } from '../constants.js';
3
3
  import { generateRandomNonce } from '../generateRandomNonce/generateRandomNonce.js';
4
+ import { logger } from '../logger/logger.js';
4
5
 
5
6
  /**
6
7
  * Generates a random 256-bit bitmap nonce for UGD `AuthorizedExecutions`
@@ -12,7 +13,8 @@ import { generateRandomNonce } from '../generateRandomNonce/generateRandomNonce.
12
13
  * fails (e.g. delegation not yet active), the random nonce is still safe to
13
14
  * use because it was generated locally with 256 bits of entropy.
14
15
  */
15
- const generateIntentNonce = async ({ walletAddress }, { publicClient }) => {
16
+ const generateIntentNonce = async ({ walletAddress }, { chainId, publicClient }) => {
17
+ const startedAt = Date.now();
16
18
  const nonce = generateRandomNonce();
17
19
  try {
18
20
  const isUsed = await publicClient.readContract({
@@ -22,13 +24,32 @@ const generateIntentNonce = async ({ walletAddress }, { publicClient }) => {
22
24
  functionName: 'isNonceUsed',
23
25
  });
24
26
  if (isUsed) {
27
+ logger.instrument('[evm-gasless] generateIntentNonce - completed', {
28
+ chainId,
29
+ key: 'generateIntentNonce-completed',
30
+ nonceCheck: 'used',
31
+ time: Date.now() - startedAt,
32
+ });
25
33
  return generateRandomNonce();
26
34
  }
27
35
  }
28
36
  catch {
29
37
  // Contract call may fail if delegation is not yet active — the nonce is
30
38
  // still safe to use since it was randomly generated.
39
+ logger.instrument('[evm-gasless] generateIntentNonce - completed', {
40
+ chainId,
41
+ key: 'generateIntentNonce-completed',
42
+ nonceCheck: 'failed',
43
+ time: Date.now() - startedAt,
44
+ });
45
+ return nonce;
31
46
  }
47
+ logger.instrument('[evm-gasless] generateIntentNonce - completed', {
48
+ chainId,
49
+ key: 'generateIntentNonce-completed',
50
+ nonceCheck: 'unused',
51
+ time: Date.now() - startedAt,
52
+ });
32
53
  return nonce;
33
54
  };
34
55
 
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var SponsorTransactionError = require('../errors/SponsorTransactionError/SponsorTransactionError.cjs');
7
+ var logger = require('../logger/logger.cjs');
7
8
 
8
9
  /**
9
10
  * Fetches the relayer address to embed in the EIP-712 sponsored-transaction
@@ -15,6 +16,7 @@ var SponsorTransactionError = require('../errors/SponsorTransactionError/Sponsor
15
16
  * validates the signature against this address.
16
17
  */
17
18
  const getAvailableEvmGaslessRelayer = async ({ chainId }, { sdkApi, environmentId }) => {
19
+ const startedAt = Date.now();
18
20
  let data;
19
21
  try {
20
22
  data = await sdkApi.getAvailableEVMGaslessRelayer({
@@ -29,6 +31,13 @@ const getAvailableEvmGaslessRelayer = async ({ chainId }, { sdkApi, environmentI
29
31
  if (!data.relayerAddress) {
30
32
  throw new SponsorTransactionError.SponsorTransactionError();
31
33
  }
34
+ logger.logger.instrument('[evm-gasless] getAvailableEvmGaslessRelayer - completed', {
35
+ chainId,
36
+ environmentId,
37
+ key: 'getAvailableEvmGaslessRelayer-completed',
38
+ relayerAddress: data.relayerAddress,
39
+ time: Date.now() - startedAt,
40
+ });
32
41
  return { relayerAddress: data.relayerAddress };
33
42
  };
34
43
 
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { SponsorTransactionError } from '../errors/SponsorTransactionError/SponsorTransactionError.js';
3
+ import { logger } from '../logger/logger.js';
3
4
 
4
5
  /**
5
6
  * Fetches the relayer address to embed in the EIP-712 sponsored-transaction
@@ -11,6 +12,7 @@ import { SponsorTransactionError } from '../errors/SponsorTransactionError/Spons
11
12
  * validates the signature against this address.
12
13
  */
13
14
  const getAvailableEvmGaslessRelayer = async ({ chainId }, { sdkApi, environmentId }) => {
15
+ const startedAt = Date.now();
14
16
  let data;
15
17
  try {
16
18
  data = await sdkApi.getAvailableEVMGaslessRelayer({
@@ -25,6 +27,13 @@ const getAvailableEvmGaslessRelayer = async ({ chainId }, { sdkApi, environmentI
25
27
  if (!data.relayerAddress) {
26
28
  throw new SponsorTransactionError();
27
29
  }
30
+ logger.instrument('[evm-gasless] getAvailableEvmGaslessRelayer - completed', {
31
+ chainId,
32
+ environmentId,
33
+ key: 'getAvailableEvmGaslessRelayer-completed',
34
+ relayerAddress: data.relayerAddress,
35
+ time: Date.now() - startedAt,
36
+ });
28
37
  return { relayerAddress: data.relayerAddress };
29
38
  };
30
39
 
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('../constants.cjs');
7
+ var logger = require('../logger/logger.cjs');
7
8
 
8
9
  /**
9
10
  * Checks whether EIP-7702 delegation to the Dynamic gasless contract is
@@ -14,18 +15,45 @@ var constants = require('../constants.cjs');
14
15
  * delegation marker is `DELEGATION_CODE_PREFIX + DELEGATION_CONTRACT_ADDRESS`.
15
16
  */
16
17
  const is7702DelegationActive = async ({ walletAddress }, { chainId, delegationRegistry, publicClient }) => {
18
+ const startedAt = Date.now();
17
19
  if (delegationRegistry.isDelegated({ chainId, walletAddress })) {
20
+ logger.logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
21
+ chainId,
22
+ delegateAddress: constants.DELEGATION_CONTRACT_ADDRESS,
23
+ isActive: true,
24
+ key: 'is7702DelegationActive-completed',
25
+ time: Date.now() - startedAt,
26
+ });
18
27
  return true;
19
28
  }
20
29
  const bytecode = await publicClient.getCode({ address: walletAddress });
21
30
  if (!bytecode) {
31
+ logger.logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
32
+ chainId,
33
+ isActive: false,
34
+ key: 'is7702DelegationActive-completed',
35
+ time: Date.now() - startedAt,
36
+ });
22
37
  return false;
23
38
  }
24
39
  const expectedPrefix = constants.DELEGATION_CODE_PREFIX + constants.DELEGATION_CONTRACT_ADDRESS.slice(2).toLowerCase();
25
40
  const isActive = bytecode.toLowerCase().startsWith(expectedPrefix);
41
+ const isDelegationBytecode = bytecode
42
+ .toLowerCase()
43
+ .startsWith(constants.DELEGATION_CODE_PREFIX);
44
+ const delegateAddress = isDelegationBytecode
45
+ ? `0x${bytecode.slice(constants.DELEGATION_CODE_PREFIX.length, constants.DELEGATION_CODE_PREFIX.length + 40)}`
46
+ : undefined;
26
47
  if (isActive) {
27
48
  delegationRegistry.markDelegated({ chainId, walletAddress });
28
49
  }
50
+ logger.logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
51
+ chainId,
52
+ delegateAddress,
53
+ isActive,
54
+ key: 'is7702DelegationActive-completed',
55
+ time: Date.now() - startedAt,
56
+ });
29
57
  return isActive;
30
58
  };
31
59
 
@@ -1,5 +1,6 @@
1
1
  'use client'
2
- import { DELEGATION_CODE_PREFIX, DELEGATION_CONTRACT_ADDRESS } from '../constants.js';
2
+ import { DELEGATION_CONTRACT_ADDRESS, DELEGATION_CODE_PREFIX } from '../constants.js';
3
+ import { logger } from '../logger/logger.js';
3
4
 
4
5
  /**
5
6
  * Checks whether EIP-7702 delegation to the Dynamic gasless contract is
@@ -10,18 +11,45 @@ import { DELEGATION_CODE_PREFIX, DELEGATION_CONTRACT_ADDRESS } from '../constant
10
11
  * delegation marker is `DELEGATION_CODE_PREFIX + DELEGATION_CONTRACT_ADDRESS`.
11
12
  */
12
13
  const is7702DelegationActive = async ({ walletAddress }, { chainId, delegationRegistry, publicClient }) => {
14
+ const startedAt = Date.now();
13
15
  if (delegationRegistry.isDelegated({ chainId, walletAddress })) {
16
+ logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
17
+ chainId,
18
+ delegateAddress: DELEGATION_CONTRACT_ADDRESS,
19
+ isActive: true,
20
+ key: 'is7702DelegationActive-completed',
21
+ time: Date.now() - startedAt,
22
+ });
14
23
  return true;
15
24
  }
16
25
  const bytecode = await publicClient.getCode({ address: walletAddress });
17
26
  if (!bytecode) {
27
+ logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
28
+ chainId,
29
+ isActive: false,
30
+ key: 'is7702DelegationActive-completed',
31
+ time: Date.now() - startedAt,
32
+ });
18
33
  return false;
19
34
  }
20
35
  const expectedPrefix = DELEGATION_CODE_PREFIX + DELEGATION_CONTRACT_ADDRESS.slice(2).toLowerCase();
21
36
  const isActive = bytecode.toLowerCase().startsWith(expectedPrefix);
37
+ const isDelegationBytecode = bytecode
38
+ .toLowerCase()
39
+ .startsWith(DELEGATION_CODE_PREFIX);
40
+ const delegateAddress = isDelegationBytecode
41
+ ? `0x${bytecode.slice(DELEGATION_CODE_PREFIX.length, DELEGATION_CODE_PREFIX.length + 40)}`
42
+ : undefined;
22
43
  if (isActive) {
23
44
  delegationRegistry.markDelegated({ chainId, walletAddress });
24
45
  }
46
+ logger.instrument('[evm-gasless] is7702DelegationActive - completed', {
47
+ chainId,
48
+ delegateAddress,
49
+ isActive,
50
+ key: 'is7702DelegationActive-completed',
51
+ time: Date.now() - startedAt,
52
+ });
25
53
  return isActive;
26
54
  };
27
55
 
@@ -0,0 +1,15 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var logger$1 = require('@dynamic-labs/logger');
7
+
8
+ const logger = new logger$1.Logger('@dynamic-labs/ethereum-gasless-core');
9
+ const errorLogContext = (error) => ({
10
+ errorCode: error?.code,
11
+ errorType: error?.constructor?.name,
12
+ });
13
+
14
+ exports.errorLogContext = errorLogContext;
15
+ exports.logger = logger;
@@ -0,0 +1,6 @@
1
+ import { Logger } from '@dynamic-labs/logger';
2
+ export declare const logger: Logger;
3
+ export declare const errorLogContext: (error: unknown) => {
4
+ errorCode: string | undefined;
5
+ errorType: string | undefined;
6
+ };
@@ -0,0 +1,10 @@
1
+ 'use client'
2
+ import { Logger } from '@dynamic-labs/logger';
3
+
4
+ const logger = new Logger('@dynamic-labs/ethereum-gasless-core');
5
+ const errorLogContext = (error) => ({
6
+ errorCode: error?.code,
7
+ errorType: error?.constructor?.name,
8
+ });
9
+
10
+ export { errorLogContext, logger };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('../constants.cjs');
7
7
  var SponsorTransactionError = require('../errors/SponsorTransactionError/SponsorTransactionError.cjs');
8
+ var logger = require('../logger/logger.cjs');
8
9
  var signSponsoredTransaction = require('../signSponsoredTransaction/signSponsoredTransaction.cjs');
9
10
 
10
11
  const isSignedTransactionParams = (params) => 'signedTransaction' in params;
@@ -17,6 +18,8 @@ const isSignedTransactionParams = (params) => 'signedTransaction' in params;
17
18
  * this with `waitForSponsoredTransaction` to await on-chain inclusion.
18
19
  */
19
20
  const relaySponsoredTransaction = async (params, deps) => {
21
+ const { chainId, environmentId } = deps;
22
+ const startedAt = Date.now();
20
23
  const signedTransaction = isSignedTransactionParams(params)
21
24
  ? params.signedTransaction
22
25
  : await signSponsoredTransaction.signSponsoredTransaction({
@@ -53,6 +56,13 @@ const relaySponsoredTransaction = async (params, deps) => {
53
56
  if (!data.requestId) {
54
57
  throw new SponsorTransactionError.SponsorTransactionError();
55
58
  }
59
+ logger.logger.instrument('[evm-gasless] relaySponsoredTransaction - completed', {
60
+ chainId,
61
+ environmentId,
62
+ key: 'relaySponsoredTransaction-completed',
63
+ requestId: data.requestId,
64
+ time: Date.now() - startedAt,
65
+ });
56
66
  return { requestId: data.requestId };
57
67
  };
58
68
 
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { DEFAULT_VALID_FOR_SECONDS } from '../constants.js';
3
3
  import { SponsorTransactionError } from '../errors/SponsorTransactionError/SponsorTransactionError.js';
4
+ import { logger } from '../logger/logger.js';
4
5
  import { signSponsoredTransaction } from '../signSponsoredTransaction/signSponsoredTransaction.js';
5
6
 
6
7
  const isSignedTransactionParams = (params) => 'signedTransaction' in params;
@@ -13,6 +14,8 @@ const isSignedTransactionParams = (params) => 'signedTransaction' in params;
13
14
  * this with `waitForSponsoredTransaction` to await on-chain inclusion.
14
15
  */
15
16
  const relaySponsoredTransaction = async (params, deps) => {
17
+ const { chainId, environmentId } = deps;
18
+ const startedAt = Date.now();
16
19
  const signedTransaction = isSignedTransactionParams(params)
17
20
  ? params.signedTransaction
18
21
  : await signSponsoredTransaction({
@@ -49,6 +52,13 @@ const relaySponsoredTransaction = async (params, deps) => {
49
52
  if (!data.requestId) {
50
53
  throw new SponsorTransactionError();
51
54
  }
55
+ logger.instrument('[evm-gasless] relaySponsoredTransaction - completed', {
56
+ chainId,
57
+ environmentId,
58
+ key: 'relaySponsoredTransaction-completed',
59
+ requestId: data.requestId,
60
+ time: Date.now() - startedAt,
61
+ });
52
62
  return { requestId: data.requestId };
53
63
  };
54
64
 
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var is7702DelegationActive = require('../is7702DelegationActive/is7702DelegationActive.cjs');
7
+ var logger = require('../logger/logger.cjs');
7
8
  var sign7702Authorization = require('../sign7702Authorization/sign7702Authorization.cjs');
8
9
 
9
10
  /**
@@ -16,17 +17,49 @@ var sign7702Authorization = require('../sign7702Authorization/sign7702Authorizat
16
17
  * already active, no authorization is needed; if not, signs one.
17
18
  */
18
19
  const resolveAuthorization = async ({ authorization, autoDelegate, walletAddress }, deps) => {
20
+ const { chainId } = deps;
21
+ const startedAt = Date.now();
22
+ logger.logger.instrument('[evm-gasless] resolveAuthorization - start', {
23
+ chainId,
24
+ key: 'resolveAuthorization-start',
25
+ time: 0,
26
+ });
19
27
  if (authorization) {
28
+ logger.logger.instrument('[evm-gasless] resolveAuthorization - completed', {
29
+ chainId,
30
+ hasAuthorization: true,
31
+ key: 'resolveAuthorization-completed',
32
+ time: Date.now() - startedAt,
33
+ });
20
34
  return authorization;
21
35
  }
22
36
  if (!autoDelegate) {
37
+ logger.logger.instrument('[evm-gasless] resolveAuthorization - completed', {
38
+ chainId,
39
+ hasAuthorization: false,
40
+ key: 'resolveAuthorization-completed',
41
+ time: Date.now() - startedAt,
42
+ });
23
43
  return undefined;
24
44
  }
25
45
  const isDelegated = await is7702DelegationActive.is7702DelegationActive({ walletAddress }, deps);
26
46
  if (isDelegated) {
47
+ logger.logger.instrument('[evm-gasless] resolveAuthorization - completed', {
48
+ chainId,
49
+ hasAuthorization: false,
50
+ key: 'resolveAuthorization-completed',
51
+ time: Date.now() - startedAt,
52
+ });
27
53
  return undefined;
28
54
  }
29
- return sign7702Authorization.sign7702Authorization({}, deps);
55
+ const signedAuthorization = await sign7702Authorization.sign7702Authorization({}, deps);
56
+ logger.logger.instrument('[evm-gasless] resolveAuthorization - completed', {
57
+ chainId,
58
+ hasAuthorization: true,
59
+ key: 'resolveAuthorization-completed',
60
+ time: Date.now() - startedAt,
61
+ });
62
+ return signedAuthorization;
30
63
  };
31
64
 
32
65
  exports.resolveAuthorization = resolveAuthorization;
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { is7702DelegationActive } from '../is7702DelegationActive/is7702DelegationActive.js';
3
+ import { logger } from '../logger/logger.js';
3
4
  import { sign7702Authorization } from '../sign7702Authorization/sign7702Authorization.js';
4
5
 
5
6
  /**
@@ -12,17 +13,49 @@ import { sign7702Authorization } from '../sign7702Authorization/sign7702Authoriz
12
13
  * already active, no authorization is needed; if not, signs one.
13
14
  */
14
15
  const resolveAuthorization = async ({ authorization, autoDelegate, walletAddress }, deps) => {
16
+ const { chainId } = deps;
17
+ const startedAt = Date.now();
18
+ logger.instrument('[evm-gasless] resolveAuthorization - start', {
19
+ chainId,
20
+ key: 'resolveAuthorization-start',
21
+ time: 0,
22
+ });
15
23
  if (authorization) {
24
+ logger.instrument('[evm-gasless] resolveAuthorization - completed', {
25
+ chainId,
26
+ hasAuthorization: true,
27
+ key: 'resolveAuthorization-completed',
28
+ time: Date.now() - startedAt,
29
+ });
16
30
  return authorization;
17
31
  }
18
32
  if (!autoDelegate) {
33
+ logger.instrument('[evm-gasless] resolveAuthorization - completed', {
34
+ chainId,
35
+ hasAuthorization: false,
36
+ key: 'resolveAuthorization-completed',
37
+ time: Date.now() - startedAt,
38
+ });
19
39
  return undefined;
20
40
  }
21
41
  const isDelegated = await is7702DelegationActive({ walletAddress }, deps);
22
42
  if (isDelegated) {
43
+ logger.instrument('[evm-gasless] resolveAuthorization - completed', {
44
+ chainId,
45
+ hasAuthorization: false,
46
+ key: 'resolveAuthorization-completed',
47
+ time: Date.now() - startedAt,
48
+ });
23
49
  return undefined;
24
50
  }
25
- return sign7702Authorization({}, deps);
51
+ const signedAuthorization = await sign7702Authorization({}, deps);
52
+ logger.instrument('[evm-gasless] resolveAuthorization - completed', {
53
+ chainId,
54
+ hasAuthorization: true,
55
+ key: 'resolveAuthorization-completed',
56
+ time: Date.now() - startedAt,
57
+ });
58
+ return signedAuthorization;
26
59
  };
27
60
 
28
61
  export { resolveAuthorization };
@@ -3,6 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var logger = require('../logger/logger.cjs');
6
7
  var relaySponsoredTransaction = require('../relaySponsoredTransaction/relaySponsoredTransaction.cjs');
7
8
  var waitForSponsoredTransaction = require('../waitForSponsoredTransaction/waitForSponsoredTransaction.cjs');
8
9
 
@@ -14,8 +15,30 @@ var waitForSponsoredTransaction = require('../waitForSponsoredTransaction/waitFo
14
15
  * transaction hash once the relay reports inclusion.
15
16
  */
16
17
  const sendSponsoredTransaction = async (params, deps) => {
17
- const { requestId } = await relaySponsoredTransaction.relaySponsoredTransaction(params, deps);
18
- return waitForSponsoredTransaction.waitForSponsoredTransaction({ requestId }, deps);
18
+ const { chainId, environmentId } = deps;
19
+ const startedAt = Date.now();
20
+ try {
21
+ const { requestId } = await relaySponsoredTransaction.relaySponsoredTransaction(params, deps);
22
+ const { transactionHash } = await waitForSponsoredTransaction.waitForSponsoredTransaction({ requestId }, deps);
23
+ logger.logger.instrument('[evm-gasless] sendSponsoredTransaction - completed', {
24
+ chainId,
25
+ environmentId,
26
+ key: 'sendSponsoredTransaction-completed',
27
+ time: Date.now() - startedAt,
28
+ transactionHash,
29
+ });
30
+ return { transactionHash };
31
+ }
32
+ catch (error) {
33
+ logger.logger.instrument('[evm-gasless] sendSponsoredTransaction - failed', {
34
+ chainId,
35
+ environmentId,
36
+ key: 'sendSponsoredTransaction-failed',
37
+ time: Date.now() - startedAt,
38
+ ...logger.errorLogContext(error),
39
+ });
40
+ throw error;
41
+ }
19
42
  };
20
43
 
21
44
  exports.sendSponsoredTransaction = sendSponsoredTransaction;
@@ -1,4 +1,5 @@
1
1
  'use client'
2
+ import { logger, errorLogContext } from '../logger/logger.js';
2
3
  import { relaySponsoredTransaction } from '../relaySponsoredTransaction/relaySponsoredTransaction.js';
3
4
  import { waitForSponsoredTransaction } from '../waitForSponsoredTransaction/waitForSponsoredTransaction.js';
4
5
 
@@ -10,8 +11,30 @@ import { waitForSponsoredTransaction } from '../waitForSponsoredTransaction/wait
10
11
  * transaction hash once the relay reports inclusion.
11
12
  */
12
13
  const sendSponsoredTransaction = async (params, deps) => {
13
- const { requestId } = await relaySponsoredTransaction(params, deps);
14
- return waitForSponsoredTransaction({ requestId }, deps);
14
+ const { chainId, environmentId } = deps;
15
+ const startedAt = Date.now();
16
+ try {
17
+ const { requestId } = await relaySponsoredTransaction(params, deps);
18
+ const { transactionHash } = await waitForSponsoredTransaction({ requestId }, deps);
19
+ logger.instrument('[evm-gasless] sendSponsoredTransaction - completed', {
20
+ chainId,
21
+ environmentId,
22
+ key: 'sendSponsoredTransaction-completed',
23
+ time: Date.now() - startedAt,
24
+ transactionHash,
25
+ });
26
+ return { transactionHash };
27
+ }
28
+ catch (error) {
29
+ logger.instrument('[evm-gasless] sendSponsoredTransaction - failed', {
30
+ chainId,
31
+ environmentId,
32
+ key: 'sendSponsoredTransaction-failed',
33
+ time: Date.now() - startedAt,
34
+ ...errorLogContext(error),
35
+ });
36
+ throw error;
37
+ }
15
38
  };
16
39
 
17
40
  export { sendSponsoredTransaction };
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('../constants.cjs');
7
+ var logger = require('../logger/logger.cjs');
7
8
 
8
9
  /**
9
10
  * Signs an EIP-7702 authorization to delegate the user's wallet to the
@@ -13,10 +14,19 @@ var constants = require('../constants.cjs');
13
14
  * (or any first-time sponsored call) to activate delegation as part of the
14
15
  * sponsored intent.
15
16
  */
16
- const sign7702Authorization = async ({ chainId }, { chainId: depsChainId, walletClient }) => walletClient.signAuthorization({
17
- account: walletClient.account,
18
- chainId: chainId ?? depsChainId,
19
- contractAddress: constants.DELEGATION_CONTRACT_ADDRESS,
20
- });
17
+ const sign7702Authorization = async ({ chainId }, { chainId: depsChainId, walletClient }) => {
18
+ const startedAt = Date.now();
19
+ const authorization = await walletClient.signAuthorization({
20
+ account: walletClient.account,
21
+ chainId: chainId ?? depsChainId,
22
+ contractAddress: constants.DELEGATION_CONTRACT_ADDRESS,
23
+ });
24
+ logger.logger.instrument('[evm-gasless] sign7702Authorization - completed', {
25
+ chainId: chainId ?? depsChainId,
26
+ key: 'sign7702Authorization-completed',
27
+ time: Date.now() - startedAt,
28
+ });
29
+ return authorization;
30
+ };
21
31
 
22
32
  exports.sign7702Authorization = sign7702Authorization;
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { DELEGATION_CONTRACT_ADDRESS } from '../constants.js';
3
+ import { logger } from '../logger/logger.js';
3
4
 
4
5
  /**
5
6
  * Signs an EIP-7702 authorization to delegate the user's wallet to the
@@ -9,10 +10,19 @@ import { DELEGATION_CONTRACT_ADDRESS } from '../constants.js';
9
10
  * (or any first-time sponsored call) to activate delegation as part of the
10
11
  * sponsored intent.
11
12
  */
12
- const sign7702Authorization = async ({ chainId }, { chainId: depsChainId, walletClient }) => walletClient.signAuthorization({
13
- account: walletClient.account,
14
- chainId: chainId ?? depsChainId,
15
- contractAddress: DELEGATION_CONTRACT_ADDRESS,
16
- });
13
+ const sign7702Authorization = async ({ chainId }, { chainId: depsChainId, walletClient }) => {
14
+ const startedAt = Date.now();
15
+ const authorization = await walletClient.signAuthorization({
16
+ account: walletClient.account,
17
+ chainId: chainId ?? depsChainId,
18
+ contractAddress: DELEGATION_CONTRACT_ADDRESS,
19
+ });
20
+ logger.instrument('[evm-gasless] sign7702Authorization - completed', {
21
+ chainId: chainId ?? depsChainId,
22
+ key: 'sign7702Authorization-completed',
23
+ time: Date.now() - startedAt,
24
+ });
25
+ return authorization;
26
+ };
17
27
 
18
28
  export { sign7702Authorization };
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var constants = require('../constants.cjs');
7
7
  var generateIntentNonce = require('../generateIntentNonce/generateIntentNonce.cjs');
8
+ var logger = require('../logger/logger.cjs');
8
9
  var getAvailableEvmGaslessRelayer = require('../getAvailableEvmGaslessRelayer/getAvailableEvmGaslessRelayer.cjs');
9
10
  var resolveAuthorization = require('../resolveAuthorization/resolveAuthorization.cjs');
10
11
  var toSerializedAuthorization = require('../toSerializedAuthorization/toSerializedAuthorization.cjs');
@@ -18,8 +19,9 @@ var toSerializedAuthorization = require('../toSerializedAuthorization/toSerializ
18
19
  * provided in `deps`.
19
20
  */
20
21
  const signSponsoredTransaction = async ({ authorization, autoDelegate = true, calls, nonce: providedNonce, validForSeconds = constants.DEFAULT_VALID_FOR_SECONDS, }, deps) => {
21
- const { chainId, walletClient } = deps;
22
+ const { chainId, environmentId, walletClient } = deps;
22
23
  const walletAddress = walletClient.account.address;
24
+ const startedAt = Date.now();
23
25
  const authPromise = resolveAuthorization.resolveAuthorization({ authorization, autoDelegate, walletAddress }, deps);
24
26
  const signPromise = (async () => {
25
27
  const [nonce, { relayerAddress }] = await Promise.all([
@@ -27,6 +29,13 @@ const signSponsoredTransaction = async ({ authorization, autoDelegate = true, ca
27
29
  getAvailableEvmGaslessRelayer.getAvailableEvmGaslessRelayer({ chainId }, deps),
28
30
  ]);
29
31
  const deadline = BigInt(Math.floor(Date.now() / 1000) + validForSeconds);
32
+ const signTypedDataStartedAt = Date.now();
33
+ logger.logger.instrument('[evm-gasless] signTypedData - start', {
34
+ chainId,
35
+ environmentId,
36
+ key: 'signTypedData-start',
37
+ time: 0,
38
+ });
30
39
  const signature = await walletClient.signTypedData({
31
40
  account: walletClient.account,
32
41
  domain: {
@@ -47,9 +56,21 @@ const signSponsoredTransaction = async ({ authorization, autoDelegate = true, ca
47
56
  primaryType: 'AuthorizedExecutions',
48
57
  types: constants.AUTHORIZED_EXECUTIONS_TYPES,
49
58
  });
59
+ logger.logger.instrument('[evm-gasless] signTypedData - completed', {
60
+ chainId,
61
+ environmentId,
62
+ key: 'signTypedData-completed',
63
+ time: Date.now() - signTypedDataStartedAt,
64
+ });
50
65
  return { deadline, nonce, relayerAddress, signature };
51
66
  })();
52
67
  const [resolvedAuthorization, { deadline, nonce, relayerAddress, signature },] = await Promise.all([authPromise, signPromise]);
68
+ logger.logger.instrument('[evm-gasless] signSponsoredTransaction - completed', {
69
+ chainId,
70
+ environmentId,
71
+ key: 'signSponsoredTransaction-completed',
72
+ time: Date.now() - startedAt,
73
+ });
53
74
  return {
54
75
  authorization: resolvedAuthorization
55
76
  ? toSerializedAuthorization.toSerializedAuthorization(resolvedAuthorization)
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { DELEGATION_CONTRACT_ADDRESS, BATCH_CALL_OPDATA_AUTH_MODE, AUTHORIZED_EXECUTIONS_TYPES, DEFAULT_VALID_FOR_SECONDS } from '../constants.js';
3
3
  import { generateIntentNonce } from '../generateIntentNonce/generateIntentNonce.js';
4
+ import { logger } from '../logger/logger.js';
4
5
  import { getAvailableEvmGaslessRelayer } from '../getAvailableEvmGaslessRelayer/getAvailableEvmGaslessRelayer.js';
5
6
  import { resolveAuthorization } from '../resolveAuthorization/resolveAuthorization.js';
6
7
  import { toSerializedAuthorization } from '../toSerializedAuthorization/toSerializedAuthorization.js';
@@ -14,8 +15,9 @@ import { toSerializedAuthorization } from '../toSerializedAuthorization/toSerial
14
15
  * provided in `deps`.
15
16
  */
16
17
  const signSponsoredTransaction = async ({ authorization, autoDelegate = true, calls, nonce: providedNonce, validForSeconds = DEFAULT_VALID_FOR_SECONDS, }, deps) => {
17
- const { chainId, walletClient } = deps;
18
+ const { chainId, environmentId, walletClient } = deps;
18
19
  const walletAddress = walletClient.account.address;
20
+ const startedAt = Date.now();
19
21
  const authPromise = resolveAuthorization({ authorization, autoDelegate, walletAddress }, deps);
20
22
  const signPromise = (async () => {
21
23
  const [nonce, { relayerAddress }] = await Promise.all([
@@ -23,6 +25,13 @@ const signSponsoredTransaction = async ({ authorization, autoDelegate = true, ca
23
25
  getAvailableEvmGaslessRelayer({ chainId }, deps),
24
26
  ]);
25
27
  const deadline = BigInt(Math.floor(Date.now() / 1000) + validForSeconds);
28
+ const signTypedDataStartedAt = Date.now();
29
+ logger.instrument('[evm-gasless] signTypedData - start', {
30
+ chainId,
31
+ environmentId,
32
+ key: 'signTypedData-start',
33
+ time: 0,
34
+ });
26
35
  const signature = await walletClient.signTypedData({
27
36
  account: walletClient.account,
28
37
  domain: {
@@ -43,9 +52,21 @@ const signSponsoredTransaction = async ({ authorization, autoDelegate = true, ca
43
52
  primaryType: 'AuthorizedExecutions',
44
53
  types: AUTHORIZED_EXECUTIONS_TYPES,
45
54
  });
55
+ logger.instrument('[evm-gasless] signTypedData - completed', {
56
+ chainId,
57
+ environmentId,
58
+ key: 'signTypedData-completed',
59
+ time: Date.now() - signTypedDataStartedAt,
60
+ });
46
61
  return { deadline, nonce, relayerAddress, signature };
47
62
  })();
48
63
  const [resolvedAuthorization, { deadline, nonce, relayerAddress, signature },] = await Promise.all([authPromise, signPromise]);
64
+ logger.instrument('[evm-gasless] signSponsoredTransaction - completed', {
65
+ chainId,
66
+ environmentId,
67
+ key: 'signSponsoredTransaction-completed',
68
+ time: Date.now() - startedAt,
69
+ });
49
70
  return {
50
71
  authorization: resolvedAuthorization
51
72
  ? toSerializedAuthorization(resolvedAuthorization)
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var SponsorTransactionError = require('../errors/SponsorTransactionError/SponsorTransactionError.cjs');
7
7
  var getEVMSponsoredTransactionStatus = require('../getEVMSponsoredTransactionStatus/getEVMSponsoredTransactionStatus.cjs');
8
+ var logger = require('../logger/logger.cjs');
8
9
 
9
10
  const TIMEOUT_MS = 60000;
10
11
  const MAX_WAIT_SECONDS = 10;
@@ -24,18 +25,47 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
24
25
  * resolves, so the hash comes back as soon as it exists.
25
26
  */
26
27
  const waitForSponsoredTransaction = async ({ requestId }, deps) => {
27
- const deadline = Date.now() + TIMEOUT_MS;
28
+ const { chainId, environmentId } = deps;
29
+ const waitStartedAt = Date.now();
30
+ const deadline = waitStartedAt + TIMEOUT_MS;
31
+ logger.logger.instrument('[evm-gasless] waitForSponsoredTransaction - start', {
32
+ chainId,
33
+ environmentId,
34
+ key: 'waitForSponsoredTransaction-start',
35
+ requestId,
36
+ time: 0,
37
+ });
38
+ let attempt = 0;
28
39
  while (Date.now() < deadline) {
40
+ attempt += 1;
29
41
  const startedAt = Date.now();
30
42
  // Never ask for a hold that would outlive the deadline; under a second
31
43
  // left means asking for none at all. The clamp matters because the
32
44
  // deadline can pass between the loop check and here.
33
45
  const waitSeconds = Math.max(0, Math.min(MAX_WAIT_SECONDS, Math.floor((deadline - startedAt) / 1000)));
34
46
  const result = await getEVMSponsoredTransactionStatus.getEVMSponsoredTransactionStatus({ requestId, waitSeconds }, deps);
47
+ logger.logger.instrument('[evm-gasless] waitForSponsoredTransaction - poll', {
48
+ attempt,
49
+ chainId,
50
+ environmentId,
51
+ key: 'waitForSponsoredTransaction-poll',
52
+ requestId,
53
+ status: result.status,
54
+ time: Date.now() - startedAt,
55
+ });
35
56
  if (TERMINAL_FAILURE_STATUSES.has(result.status)) {
36
57
  throw new SponsorTransactionError.SponsorTransactionError(null, result.errorMessage);
37
58
  }
38
59
  if (result.transactionHash) {
60
+ logger.logger.instrument('[evm-gasless] waitForSponsoredTransaction - completed', {
61
+ attempt,
62
+ chainId,
63
+ environmentId,
64
+ key: 'waitForSponsoredTransaction-completed',
65
+ requestId,
66
+ time: Date.now() - waitStartedAt,
67
+ transactionHash: result.transactionHash,
68
+ });
39
69
  return { transactionHash: result.transactionHash };
40
70
  }
41
71
  const elapsed = Date.now() - startedAt;
@@ -4,6 +4,10 @@ type WaitForSponsoredTransactionParams = {
4
4
  /** The request ID returned by `relaySponsoredTransaction` / `sendSponsoredTransaction`. */
5
5
  requestId: string;
6
6
  };
7
+ type WaitForSponsoredTransactionDeps = EvmGaslessApiDeps & {
8
+ /** Optional chain ID, included in instrumentation logs when provided. */
9
+ chainId?: number;
10
+ };
7
11
  /**
8
12
  * Waits until the relay reports the transaction has been included on-chain,
9
13
  * then returns the transaction hash.
@@ -11,7 +15,7 @@ type WaitForSponsoredTransactionParams = {
11
15
  * Each request asks the API to hold the response open until the transaction
12
16
  * resolves, so the hash comes back as soon as it exists.
13
17
  */
14
- export declare const waitForSponsoredTransaction: ({ requestId }: WaitForSponsoredTransactionParams, deps: EvmGaslessApiDeps) => Promise<{
18
+ export declare const waitForSponsoredTransaction: ({ requestId }: WaitForSponsoredTransactionParams, deps: WaitForSponsoredTransactionDeps) => Promise<{
15
19
  transactionHash: Hex;
16
20
  }>;
17
21
  export {};
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { SponsorTransactionError } from '../errors/SponsorTransactionError/SponsorTransactionError.js';
3
3
  import { getEVMSponsoredTransactionStatus } from '../getEVMSponsoredTransactionStatus/getEVMSponsoredTransactionStatus.js';
4
+ import { logger } from '../logger/logger.js';
4
5
 
5
6
  const TIMEOUT_MS = 60000;
6
7
  const MAX_WAIT_SECONDS = 10;
@@ -20,18 +21,47 @@ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
20
21
  * resolves, so the hash comes back as soon as it exists.
21
22
  */
22
23
  const waitForSponsoredTransaction = async ({ requestId }, deps) => {
23
- const deadline = Date.now() + TIMEOUT_MS;
24
+ const { chainId, environmentId } = deps;
25
+ const waitStartedAt = Date.now();
26
+ const deadline = waitStartedAt + TIMEOUT_MS;
27
+ logger.instrument('[evm-gasless] waitForSponsoredTransaction - start', {
28
+ chainId,
29
+ environmentId,
30
+ key: 'waitForSponsoredTransaction-start',
31
+ requestId,
32
+ time: 0,
33
+ });
34
+ let attempt = 0;
24
35
  while (Date.now() < deadline) {
36
+ attempt += 1;
25
37
  const startedAt = Date.now();
26
38
  // Never ask for a hold that would outlive the deadline; under a second
27
39
  // left means asking for none at all. The clamp matters because the
28
40
  // deadline can pass between the loop check and here.
29
41
  const waitSeconds = Math.max(0, Math.min(MAX_WAIT_SECONDS, Math.floor((deadline - startedAt) / 1000)));
30
42
  const result = await getEVMSponsoredTransactionStatus({ requestId, waitSeconds }, deps);
43
+ logger.instrument('[evm-gasless] waitForSponsoredTransaction - poll', {
44
+ attempt,
45
+ chainId,
46
+ environmentId,
47
+ key: 'waitForSponsoredTransaction-poll',
48
+ requestId,
49
+ status: result.status,
50
+ time: Date.now() - startedAt,
51
+ });
31
52
  if (TERMINAL_FAILURE_STATUSES.has(result.status)) {
32
53
  throw new SponsorTransactionError(null, result.errorMessage);
33
54
  }
34
55
  if (result.transactionHash) {
56
+ logger.instrument('[evm-gasless] waitForSponsoredTransaction - completed', {
57
+ attempt,
58
+ chainId,
59
+ environmentId,
60
+ key: 'waitForSponsoredTransaction-completed',
61
+ requestId,
62
+ time: Date.now() - waitStartedAt,
63
+ transactionHash: result.transactionHash,
64
+ });
35
65
  return { transactionHash: result.transactionHash };
36
66
  }
37
67
  const elapsed = Date.now() - startedAt;