@lifi/sdk-provider-ethereum 4.1.0 → 4.2.0
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 +25 -0
- package/README.md +24 -8
- package/dist/cjs/core/EthereumStepExecutor.js +2 -0
- package/dist/cjs/core/EthereumStepExecutor.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.d.ts +2 -2
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js +6 -5
- package/dist/cjs/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js +11 -29
- package/dist/cjs/core/tasks/EthereumCheckPermitsTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js +2 -0
- package/dist/cjs/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.d.ts +10 -0
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js +33 -0
- package/dist/cjs/core/tasks/EthereumPermit2AllowanceTask.js.map +1 -0
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js +6 -4
- package/dist/cjs/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js +14 -27
- package/dist/cjs/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js +2 -3
- package/dist/cjs/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js +3 -4
- package/dist/cjs/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.d.ts +7 -0
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js +15 -0
- package/dist/cjs/core/tasks/helpers/findSignedNativePermit.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.d.ts +6 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.js +16 -0
- package/dist/cjs/core/tasks/helpers/getApprovalAmount.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +7 -1
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js +12 -4
- package/dist/cjs/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.d.ts +3 -2
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js +4 -4
- package/dist/cjs/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +8 -0
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js +17 -0
- package/dist/cjs/core/tasks/helpers/hasPermit2AllowanceInFlight.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +6 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js +29 -0
- package/dist/cjs/core/tasks/helpers/isTypedDataAlreadySigned.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.d.ts +11 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js +22 -0
- package/dist/cjs/core/tasks/helpers/preservePermit2Allowances.js.map +1 -0
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js +2 -1
- package/dist/cjs/core/tasks/helpers/resolvePermit2Support.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -1
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js +3 -3
- package/dist/cjs/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.d.ts +13 -0
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js +37 -0
- package/dist/cjs/core/tasks/helpers/signTypedDataEntries.js.map +1 -0
- package/dist/cjs/index.d.ts +1 -2
- package/dist/cjs/index.js +1 -3
- package/dist/cjs/utils/getTypedDataLane.d.ts +15 -0
- package/dist/cjs/utils/getTypedDataLane.js +33 -0
- package/dist/cjs/utils/getTypedDataLane.js.map +1 -0
- package/dist/cjs/utils/isGaslessStep.d.ts +3 -1
- package/dist/cjs/utils/isGaslessStep.js +7 -1
- package/dist/cjs/utils/isGaslessStep.js.map +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.d.ts.map +1 -1
- package/dist/esm/core/EthereumStepExecutor.js +2 -0
- package/dist/esm/core/EthereumStepExecutor.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.d.ts +2 -2
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js +6 -5
- package/dist/esm/core/tasks/EthereumCheckBalanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js +11 -29
- package/dist/esm/core/tasks/EthereumCheckPermitsTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumNativePermitTask.js +2 -0
- package/dist/esm/core/tasks/EthereumNativePermitTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts +10 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.d.ts.map +1 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js +32 -0
- package/dist/esm/core/tasks/EthereumPermit2AllowanceTask.js.map +1 -0
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js +6 -4
- package/dist/esm/core/tasks/EthereumPrepareTransactionTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js +14 -27
- package/dist/esm/core/tasks/EthereumRelayedSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js +2 -3
- package/dist/esm/core/tasks/EthereumSetAllowanceTask.js.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.d.ts.map +1 -1
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js +3 -4
- package/dist/esm/core/tasks/EthereumStandardSignAndExecuteTask.js.map +1 -1
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts +7 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.js +14 -0
- package/dist/esm/core/tasks/helpers/findSignedNativePermit.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts +6 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.js +15 -0
- package/dist/esm/core/tasks/helpers/getApprovalAmount.js.map +1 -0
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts +7 -1
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js +12 -4
- package/dist/esm/core/tasks/helpers/getEthereumExecutionStrategy.js.map +1 -1
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts +3 -2
- package/dist/esm/core/tasks/helpers/getUpdatedStep.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js +4 -4
- package/dist/esm/core/tasks/helpers/getUpdatedStep.js.map +1 -1
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts +8 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js +15 -0
- package/dist/esm/core/tasks/helpers/hasPermit2AllowanceInFlight.js.map +1 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts +6 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js +28 -0
- package/dist/esm/core/tasks/helpers/isTypedDataAlreadySigned.js.map +1 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts +11 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js +21 -0
- package/dist/esm/core/tasks/helpers/preservePermit2Allowances.js.map +1 -0
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.js +2 -1
- package/dist/esm/core/tasks/helpers/resolvePermit2Support.js.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.d.ts.map +1 -1
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js +3 -3
- package/dist/esm/core/tasks/helpers/signHyperliquidTypedData.js.map +1 -1
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts +13 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.d.ts.map +1 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.js +36 -0
- package/dist/esm/core/tasks/helpers/signTypedDataEntries.js.map +1 -0
- package/dist/esm/index.d.ts +1 -2
- package/dist/esm/index.js +2 -3
- package/dist/esm/utils/getTypedDataLane.d.ts +15 -0
- package/dist/esm/utils/getTypedDataLane.d.ts.map +1 -0
- package/dist/esm/utils/getTypedDataLane.js +28 -0
- package/dist/esm/utils/getTypedDataLane.js.map +1 -0
- package/dist/esm/utils/isGaslessStep.d.ts +3 -1
- package/dist/esm/utils/isGaslessStep.d.ts.map +1 -1
- package/dist/esm/utils/isGaslessStep.js +7 -2
- package/dist/esm/utils/isGaslessStep.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/package.json +3 -3
- package/src/core/EthereumStepExecutor.ts +2 -0
- package/src/core/tasks/EthereumCheckBalanceTask.ts +6 -7
- package/src/core/tasks/EthereumCheckPermitsTask.ts +31 -63
- package/src/core/tasks/EthereumNativePermitTask.ts +5 -0
- package/src/core/tasks/EthereumPermit2AllowanceTask.ts +53 -0
- package/src/core/tasks/EthereumPrepareTransactionTask.ts +11 -2
- package/src/core/tasks/EthereumRelayedSignAndExecuteTask.ts +25 -47
- package/src/core/tasks/EthereumSetAllowanceTask.ts +2 -3
- package/src/core/tasks/EthereumStandardSignAndExecuteTask.ts +2 -9
- package/src/core/tasks/helpers/findSignedNativePermit.ts +23 -0
- package/src/core/tasks/helpers/getApprovalAmount.ts +30 -0
- package/src/core/tasks/helpers/getEthereumExecutionStrategy.ts +31 -5
- package/src/core/tasks/helpers/getUpdatedStep.ts +7 -2
- package/src/core/tasks/helpers/hasPermit2AllowanceInFlight.ts +31 -0
- package/src/core/tasks/helpers/isTypedDataAlreadySigned.ts +56 -0
- package/src/core/tasks/helpers/preservePermit2Allowances.ts +44 -0
- package/src/core/tasks/helpers/resolvePermit2Support.ts +3 -1
- package/src/core/tasks/helpers/signHyperliquidTypedData.ts +3 -3
- package/src/core/tasks/helpers/signTypedDataEntries.ts +70 -0
- package/src/index.ts +0 -1
- package/src/utils/getTypedDataLane.ts +76 -0
- package/src/utils/isGaslessStep.ts +22 -9
- package/src/version.ts +1 -1
- package/dist/cjs/utils/isRelayerStep.d.ts +0 -6
- package/dist/cjs/utils/isRelayerStep.js +0 -9
- package/dist/cjs/utils/isRelayerStep.js.map +0 -1
- package/dist/esm/utils/isRelayerStep.d.ts +0 -6
- package/dist/esm/utils/isRelayerStep.d.ts.map +0 -1
- package/dist/esm/utils/isRelayerStep.js +0 -8
- package/dist/esm/utils/isRelayerStep.js.map +0 -1
- package/src/utils/isRelayerStep.ts +0 -8
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseStepExecutionTask, type TaskResult } from '@lifi/sdk'
|
|
2
|
+
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
3
|
+
import {
|
|
4
|
+
getTypedDataInLane,
|
|
5
|
+
isPermit2AllowanceLane,
|
|
6
|
+
} from '../../utils/getTypedDataLane.js'
|
|
7
|
+
import { signTypedDataEntries } from './helpers/signTypedDataEntries.js'
|
|
8
|
+
|
|
9
|
+
/** Signs the Permit2 allowances a caller attached to its own step, before prepare. */
|
|
10
|
+
export class EthereumPermit2AllowanceTask extends BaseStepExecutionTask {
|
|
11
|
+
override async shouldRun(
|
|
12
|
+
context: EthereumStepExecutorContext
|
|
13
|
+
): Promise<boolean> {
|
|
14
|
+
const { step, fromChain, disableMessageSigning } = context
|
|
15
|
+
|
|
16
|
+
return isPermit2AllowanceLane(step, fromChain) && !disableMessageSigning
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
20
|
+
const { step, fromChain, statusManager } = context
|
|
21
|
+
|
|
22
|
+
const action = statusManager.initializeAction({
|
|
23
|
+
step,
|
|
24
|
+
type: 'PERMIT',
|
|
25
|
+
chainId: step.action.fromChainId,
|
|
26
|
+
status: 'STARTED',
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const allowanceTypedData = getTypedDataInLane(
|
|
30
|
+
step,
|
|
31
|
+
'permit2-allowance',
|
|
32
|
+
fromChain
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
// `ACTION_REQUIRED`, not `MESSAGE_REQUIRED`: the widget maps no `PERMIT`
|
|
36
|
+
// text for it. Pinned by `emits exactly STARTED, ACTION_REQUIRED and DONE`.
|
|
37
|
+
const result = await signTypedDataEntries(
|
|
38
|
+
context,
|
|
39
|
+
allowanceTypedData,
|
|
40
|
+
action.type
|
|
41
|
+
)
|
|
42
|
+
if (result.status === 'PAUSED') {
|
|
43
|
+
return { status: 'PAUSED' }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
statusManager.updateAction(step, action.type, 'DONE')
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
status: 'COMPLETED',
|
|
50
|
+
context: { signedTypedData: result.signedTypedData },
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -10,6 +10,7 @@ import { getMaxPriorityFeePerGas } from '../../actions/getMaxPriorityFeePerGas.j
|
|
|
10
10
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
11
11
|
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
12
12
|
import { getUpdatedStep } from './helpers/getUpdatedStep.js'
|
|
13
|
+
import { preservePermit2Allowances } from './helpers/preservePermit2Allowances.js'
|
|
13
14
|
|
|
14
15
|
export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
15
16
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
@@ -23,6 +24,7 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
23
24
|
isBridgeExecution,
|
|
24
25
|
signedTypedData,
|
|
25
26
|
ethereumClient,
|
|
27
|
+
fromChain,
|
|
26
28
|
} = context
|
|
27
29
|
|
|
28
30
|
const action = statusManager.findAction(
|
|
@@ -41,6 +43,7 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
41
43
|
const updatedStep = await getUpdatedStep(
|
|
42
44
|
client,
|
|
43
45
|
step,
|
|
46
|
+
fromChain,
|
|
44
47
|
executionOptions,
|
|
45
48
|
signedTypedData
|
|
46
49
|
)
|
|
@@ -53,13 +56,19 @@ export class EthereumPrepareTransactionTask extends BaseStepExecutionTask {
|
|
|
53
56
|
executionOptions
|
|
54
57
|
)
|
|
55
58
|
|
|
59
|
+
const answeredTypedData = updatedStep.typedData ?? step.typedData
|
|
60
|
+
|
|
56
61
|
Object.assign(step, {
|
|
57
62
|
...comparedStep,
|
|
58
63
|
execution: step.execution,
|
|
59
|
-
typedData:
|
|
64
|
+
typedData: preservePermit2Allowances(
|
|
65
|
+
step,
|
|
66
|
+
updatedStep.typedData,
|
|
67
|
+
fromChain
|
|
68
|
+
),
|
|
60
69
|
})
|
|
61
70
|
|
|
62
|
-
if (!step.transactionRequest && !
|
|
71
|
+
if (!step.transactionRequest && !answeredTypedData?.length) {
|
|
63
72
|
throw new TransactionError(
|
|
64
73
|
LiFiErrorCode.TransactionUnprepared,
|
|
65
74
|
'Unable to prepare transaction. Transaction request is not found.'
|
|
@@ -2,34 +2,28 @@ import {
|
|
|
2
2
|
BaseStepExecutionTask,
|
|
3
3
|
LiFiErrorCode,
|
|
4
4
|
relayTransaction,
|
|
5
|
+
type SignedTypedData,
|
|
5
6
|
type TaskResult,
|
|
6
7
|
TransactionError,
|
|
7
8
|
} from '@lifi/sdk'
|
|
8
9
|
import type { Hash } from 'viem'
|
|
9
|
-
import { signTypedData } from 'viem/actions'
|
|
10
|
-
import { getAction } from 'viem/utils'
|
|
11
10
|
import { isHyperliquidAgentStep } from '../../hyperliquid/isHyperliquidAgentStep.js'
|
|
12
11
|
import { isNativePermitValid } from '../../permits/isNativePermitValid.js'
|
|
13
12
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
14
|
-
import {
|
|
15
|
-
import { assertValidSignature } from '../../utils/isValidSignature.js'
|
|
13
|
+
import { isTypedDataAlreadySigned } from './helpers/isTypedDataAlreadySigned.js'
|
|
16
14
|
import { signHyperliquidTypedData } from './helpers/signHyperliquidTypedData.js'
|
|
15
|
+
import { signTypedDataEntries } from './helpers/signTypedDataEntries.js'
|
|
17
16
|
|
|
18
17
|
export class EthereumRelayedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
19
18
|
async run(context: EthereumStepExecutorContext): Promise<TaskResult> {
|
|
20
19
|
const {
|
|
21
20
|
step,
|
|
22
|
-
fromChain,
|
|
23
21
|
client,
|
|
24
22
|
statusManager,
|
|
25
|
-
allowUserInteraction,
|
|
26
|
-
checkClient,
|
|
27
23
|
isBridgeExecution,
|
|
28
24
|
signedTypedData: currentSignedTypedData,
|
|
29
25
|
} = context
|
|
30
26
|
|
|
31
|
-
const signedTypedData = [...currentSignedTypedData]
|
|
32
|
-
|
|
33
27
|
const action = statusManager.findAction(
|
|
34
28
|
step,
|
|
35
29
|
isBridgeExecution ? 'CROSS_CHAIN' : 'SWAP'
|
|
@@ -42,66 +36,50 @@ export class EthereumRelayedSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
42
36
|
)
|
|
43
37
|
}
|
|
44
38
|
|
|
45
|
-
const
|
|
39
|
+
const allowanceTypedData = step.typedData?.filter(
|
|
46
40
|
(typedData) =>
|
|
47
|
-
!
|
|
41
|
+
!currentSignedTypedData.some((signedPermit) =>
|
|
48
42
|
isNativePermitValid(signedPermit, typedData)
|
|
49
43
|
)
|
|
50
44
|
)
|
|
51
|
-
if (!
|
|
45
|
+
if (!allowanceTypedData?.length) {
|
|
52
46
|
throw new TransactionError(
|
|
53
47
|
LiFiErrorCode.TransactionUnprepared,
|
|
54
48
|
'Unable to prepare transaction. Typed data for transfer is not found.'
|
|
55
49
|
)
|
|
56
50
|
}
|
|
57
51
|
|
|
58
|
-
|
|
52
|
+
// An entry we already hold a signature for is relayed as it is.
|
|
53
|
+
const unsignedTypedData = allowanceTypedData.filter(
|
|
54
|
+
(typedData) =>
|
|
55
|
+
!isTypedDataAlreadySigned(currentSignedTypedData, typedData)
|
|
56
|
+
)
|
|
59
57
|
|
|
58
|
+
let signedTypedData: SignedTypedData[]
|
|
60
59
|
if (isHyperliquidAgentStep(step)) {
|
|
60
|
+
statusManager.updateAction(step, action.type, 'MESSAGE_REQUIRED')
|
|
61
|
+
|
|
61
62
|
const signedResults = await signHyperliquidTypedData(
|
|
62
63
|
context,
|
|
63
|
-
|
|
64
|
+
unsignedTypedData
|
|
64
65
|
)
|
|
65
66
|
|
|
66
67
|
if (!signedResults) {
|
|
67
68
|
return { status: 'PAUSED' }
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
signedTypedData
|
|
71
|
+
signedTypedData = [...currentSignedTypedData, ...signedResults]
|
|
71
72
|
} else {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// Switch to the typed data's chain if needed
|
|
81
|
-
const updatedClient = await checkClient(step, typedDataChainId)
|
|
82
|
-
if (!updatedClient) {
|
|
83
|
-
return { status: 'PAUSED' }
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const signature = await getAction(
|
|
87
|
-
updatedClient,
|
|
88
|
-
signTypedData,
|
|
89
|
-
'signTypedData'
|
|
90
|
-
)({
|
|
91
|
-
account: updatedClient.account!,
|
|
92
|
-
primaryType: typedData.primaryType,
|
|
93
|
-
domain: typedData.domain,
|
|
94
|
-
types: typedData.types,
|
|
95
|
-
message: typedData.message,
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
assertValidSignature(signature)
|
|
99
|
-
|
|
100
|
-
signedTypedData.push({
|
|
101
|
-
...typedData,
|
|
102
|
-
signature: signature,
|
|
103
|
-
})
|
|
73
|
+
const result = await signTypedDataEntries(
|
|
74
|
+
context,
|
|
75
|
+
unsignedTypedData,
|
|
76
|
+
action.type,
|
|
77
|
+
'MESSAGE_REQUIRED'
|
|
78
|
+
)
|
|
79
|
+
if (result.status === 'PAUSED') {
|
|
80
|
+
return { status: 'PAUSED' }
|
|
104
81
|
}
|
|
82
|
+
signedTypedData = result.signedTypedData
|
|
105
83
|
}
|
|
106
84
|
|
|
107
85
|
statusManager.updateAction(step, action.type, 'PENDING')
|
|
@@ -3,8 +3,8 @@ import type { Address } from 'viem'
|
|
|
3
3
|
import { resolveTransactionHash } from '../../actions/resolveTransactionHash.js'
|
|
4
4
|
import { setAllowance } from '../../actions/setAllowance.js'
|
|
5
5
|
import { waitForTransactionReceipt } from '../../actions/waitForTransactionReceipt.js'
|
|
6
|
-
import { MaxUint256 } from '../../permits/constants.js'
|
|
7
6
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
7
|
+
import { getApprovalAmount } from './helpers/getApprovalAmount.js'
|
|
8
8
|
import { getEthereumExecutionStrategy } from './helpers/getEthereumExecutionStrategy.js'
|
|
9
9
|
import { getTxLink } from './helpers/getTxLink.js'
|
|
10
10
|
import { resolvePermit2Support } from './helpers/resolvePermit2Support.js'
|
|
@@ -53,8 +53,7 @@ export class EthereumSetAllowanceTask extends BaseStepExecutionTask {
|
|
|
53
53
|
)
|
|
54
54
|
|
|
55
55
|
// Set new allowance
|
|
56
|
-
const
|
|
57
|
-
const approveAmount = permit2Supported ? MaxUint256 : fromAmount
|
|
56
|
+
const approveAmount = getApprovalAmount(context, permit2Supported)
|
|
58
57
|
|
|
59
58
|
// Check if chain has Permit2 contract deployed. Permit2 should not be available for atomic batch.
|
|
60
59
|
const spenderAddress = permit2Supported
|
|
@@ -13,9 +13,8 @@ import { encodePermit2Data } from '../../permits/encodePermit2Data.js'
|
|
|
13
13
|
import { signPermit2Message } from '../../permits/signPermit2Message.js'
|
|
14
14
|
import type { EthereumStepExecutorContext } from '../../types.js'
|
|
15
15
|
import { convertExtendedChain } from '../../utils/convertExtendedChain.js'
|
|
16
|
-
import { getDomainChainId } from '../../utils/getDomainChainId.js'
|
|
17
|
-
import { isValidSignature } from '../../utils/isValidSignature.js'
|
|
18
16
|
import { estimateTransactionRequest } from './helpers/estimateTransactionRequest.js'
|
|
17
|
+
import { findSignedNativePermit } from './helpers/findSignedNativePermit.js'
|
|
19
18
|
import { getTxLink } from './helpers/getTxLink.js'
|
|
20
19
|
import { resolvePermit2Support } from './helpers/resolvePermit2Support.js'
|
|
21
20
|
|
|
@@ -28,7 +27,6 @@ export class EthereumStandardSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
28
27
|
statusManager,
|
|
29
28
|
checkClient,
|
|
30
29
|
transactionRequest,
|
|
31
|
-
signedTypedData,
|
|
32
30
|
allowUserInteraction,
|
|
33
31
|
isBridgeExecution,
|
|
34
32
|
} = context
|
|
@@ -57,12 +55,7 @@ export class EthereumStandardSignAndExecuteTask extends BaseStepExecutionTask {
|
|
|
57
55
|
return { status: 'PAUSED' }
|
|
58
56
|
}
|
|
59
57
|
|
|
60
|
-
const signedNativePermitTypedData =
|
|
61
|
-
(p) =>
|
|
62
|
-
p.primaryType === 'Permit' &&
|
|
63
|
-
getDomainChainId(p.domain) === fromChain.id &&
|
|
64
|
-
isValidSignature(p.signature)
|
|
65
|
-
)
|
|
58
|
+
const signedNativePermitTypedData = findSignedNativePermit(context)
|
|
66
59
|
// Resolved *after* the native-permit lookup, and short-circuited when one
|
|
67
60
|
// is found: a matching permit always wins, so resolving the gate first
|
|
68
61
|
// would spend an `eth_getCode` on a verdict this task never reads. The
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { SignedTypedData } from '@lifi/sdk'
|
|
2
|
+
import type { EthereumStepExecutorContext } from '../../../types.js'
|
|
3
|
+
import { getDomainChainId } from '../../../utils/getDomainChainId.js'
|
|
4
|
+
import { isValidSignature } from '../../../utils/isValidSignature.js'
|
|
5
|
+
import { isPermit2AllowanceLaneInFlight } from './hasPermit2AllowanceInFlight.js'
|
|
6
|
+
|
|
7
|
+
/** The signed native EIP-2612 permit this step should execute through, if any. */
|
|
8
|
+
export function findSignedNativePermit(
|
|
9
|
+
context: EthereumStepExecutorContext
|
|
10
|
+
): SignedTypedData | undefined {
|
|
11
|
+
const { fromChain, signedTypedData } = context
|
|
12
|
+
|
|
13
|
+
if (isPermit2AllowanceLaneInFlight(context)) {
|
|
14
|
+
return undefined
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return signedTypedData.find(
|
|
18
|
+
(typedData) =>
|
|
19
|
+
typedData.primaryType === 'Permit' &&
|
|
20
|
+
getDomainChainId(typedData.domain) === fromChain.id &&
|
|
21
|
+
isValidSignature(typedData.signature)
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { MaxUint256 } from '../../../permits/constants.js'
|
|
2
|
+
import type { EthereumStepExecutorContext } from '../../../types.js'
|
|
3
|
+
import { getTypedDataInLane } from '../../../utils/getTypedDataLane.js'
|
|
4
|
+
|
|
5
|
+
/** How much of the source token to approve to the step's approval address. */
|
|
6
|
+
export function getApprovalAmount(
|
|
7
|
+
context: EthereumStepExecutorContext,
|
|
8
|
+
permit2Supported: boolean
|
|
9
|
+
): bigint {
|
|
10
|
+
const { step, fromChain, disableMessageSigning } = context
|
|
11
|
+
|
|
12
|
+
if (permit2Supported) {
|
|
13
|
+
return MaxUint256
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const permit2Allowances = disableMessageSigning
|
|
17
|
+
? []
|
|
18
|
+
: getTypedDataInLane(step, 'permit2-allowance', fromChain)
|
|
19
|
+
|
|
20
|
+
const approvalAddress = step.estimate.approvalAddress?.toLowerCase()
|
|
21
|
+
const targetsApprovalAddress =
|
|
22
|
+
permit2Allowances.length > 0 &&
|
|
23
|
+
!!approvalAddress &&
|
|
24
|
+
permit2Allowances.every(
|
|
25
|
+
(typedData) =>
|
|
26
|
+
typedData.domain.verifyingContract?.toLowerCase() === approvalAddress
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
return targetsApprovalAddress ? MaxUint256 : BigInt(step.action.fromAmount)
|
|
30
|
+
}
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { TransactionMethodType } from '@lifi/sdk'
|
|
2
2
|
import { isBatchingSupported } from '../../../actions/isBatchingSupported.js'
|
|
3
3
|
import type { EthereumStepExecutorContext } from '../../../types.js'
|
|
4
|
-
import {
|
|
4
|
+
import { isPermit2AllowanceLane } from '../../../utils/getTypedDataLane.js'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Determines the execution strategy: 'relayed', 'batched', or 'standard'.
|
|
8
8
|
* Falls back to 'standard' when EIP-5792 batching is unavailable,
|
|
9
9
|
* the wallet rejected the 7702 upgrade, or the tool doesn't support it.
|
|
10
|
+
*
|
|
11
|
+
* `afterPrepare` marks the single call from `EthereumPrepareTransactionTask`.
|
|
12
|
+
* The step has just been re-quoted, so the cached verdict is stale and, for the
|
|
13
|
+
* first time, the absence of a `transactionRequest` is final rather than merely
|
|
14
|
+
* not-yet-known. Both effects come from that one fact, which is why they share
|
|
15
|
+
* a parameter.
|
|
10
16
|
*/
|
|
11
17
|
export async function getEthereumExecutionStrategy(
|
|
12
18
|
context: EthereumStepExecutorContext,
|
|
13
|
-
|
|
19
|
+
afterPrepare: boolean = false
|
|
14
20
|
): Promise<TransactionMethodType> {
|
|
15
21
|
const {
|
|
16
22
|
step,
|
|
@@ -22,13 +28,33 @@ export async function getEthereumExecutionStrategy(
|
|
|
22
28
|
executionStrategy: executionStrategyContext,
|
|
23
29
|
} = context
|
|
24
30
|
|
|
25
|
-
if (!
|
|
31
|
+
if (!afterPrepare && executionStrategyContext) {
|
|
26
32
|
return executionStrategyContext
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
const atomicityNotReady = !!retryParams?.atomicityNotReady
|
|
30
|
-
|
|
31
|
-
|
|
36
|
+
// Declared by the backend. It is the only signal that reaches the allowance
|
|
37
|
+
// tasks, which run before a `transactionRequest` can exist.
|
|
38
|
+
if (step.executionType === 'message') {
|
|
39
|
+
return 'relayed'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Typed data the user does not sign for its own send: gasless, `Order`,
|
|
43
|
+
// Hyperliquid. A Permit2 allowance is the one shape excluded, because its signer
|
|
44
|
+
// and its sender are the same person.
|
|
45
|
+
if (step.typedData?.length && !isPermit2AllowanceLane(step, fromChain)) {
|
|
46
|
+
return 'relayed'
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// After prepare, missing means never: the step carries typed data and the user
|
|
50
|
+
// has nothing to send, so the relayer is the only lane that can execute it.
|
|
51
|
+
// This is a derivation, not a guess — no other strategy can run such a step.
|
|
52
|
+
//
|
|
53
|
+
// Before prepare the same expression is unsound. A Permit2 allowance that will
|
|
54
|
+
// receive its transaction from `/stepTransaction` is indistinguishable from
|
|
55
|
+
// one that never will, and calling it relayed there costs the step its
|
|
56
|
+
// EIP-5792 batching.
|
|
57
|
+
if (afterPrepare && step.typedData?.length && !step.transactionRequest) {
|
|
32
58
|
return 'relayed'
|
|
33
59
|
}
|
|
34
60
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
convertQuoteToRoute,
|
|
3
3
|
type ExecutionOptions,
|
|
4
|
+
type ExtendedChain,
|
|
4
5
|
getContractCallsQuote,
|
|
5
6
|
getRelayerQuote,
|
|
6
7
|
getStepTransaction,
|
|
@@ -14,18 +15,22 @@ import {
|
|
|
14
15
|
import { PatcherMagicNumber } from '../../../permits/constants.js'
|
|
15
16
|
import { isContractCallStep } from '../../../utils/isContractCallStep.js'
|
|
16
17
|
import { isGaslessStep } from '../../../utils/isGaslessStep.js'
|
|
17
|
-
import { isRelayerStep } from '../../../utils/isRelayerStep.js'
|
|
18
18
|
|
|
19
|
+
/** Re-quotes the step through the endpoint that matches how it will execute. */
|
|
19
20
|
export const getUpdatedStep = async (
|
|
20
21
|
client: SDKClient,
|
|
21
22
|
step: LiFiStepExtended,
|
|
23
|
+
fromChain: ExtendedChain,
|
|
22
24
|
executionOptions?: ExecutionOptions,
|
|
23
25
|
signedTypedData?: SignedTypedData[]
|
|
24
26
|
): Promise<LiFiStepExtended> => {
|
|
25
27
|
if (isContractCallStep(step)) {
|
|
26
28
|
return getContractCallUpdatedStep(client, step, executionOptions)
|
|
27
29
|
}
|
|
28
|
-
|
|
30
|
+
// Do NOT substitute `hasRelayerMessage` for `isGaslessStep`: an `Order` retry
|
|
31
|
+
// would fetch a relayer quote instead of `/advanced/stepTransaction`. Pinned
|
|
32
|
+
// by `re-quotes an Order step ...` in `getUpdatedStep.unit.spec.ts`.
|
|
33
|
+
if (isGaslessStep(step, fromChain)) {
|
|
29
34
|
return getRelayerUpdatedStep(client, step)
|
|
30
35
|
}
|
|
31
36
|
return getStandardUpdatedStep(client, step, signedTypedData)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { EthereumStepExecutorContext } from '../../../types.js'
|
|
2
|
+
import {
|
|
3
|
+
getTypedDataLane,
|
|
4
|
+
hasPermit2Allowance,
|
|
5
|
+
hasRelayerMessage,
|
|
6
|
+
} from '../../../utils/getTypedDataLane.js'
|
|
7
|
+
|
|
8
|
+
/** Whether this execution carries a caller-supplied Permit2 allowance, declared or signed. */
|
|
9
|
+
export function hasPermit2AllowanceInFlight(
|
|
10
|
+
context: EthereumStepExecutorContext
|
|
11
|
+
): boolean {
|
|
12
|
+
const { step, fromChain, signedTypedData } = context
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
hasPermit2Allowance(step, fromChain) ||
|
|
16
|
+
signedTypedData.some(
|
|
17
|
+
(typedData) =>
|
|
18
|
+
getTypedDataLane(typedData, fromChain) === 'permit2-allowance'
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** `isPermit2AllowanceLane`, for gates that run after prepare may have replaced `step.typedData`. */
|
|
24
|
+
export function isPermit2AllowanceLaneInFlight(
|
|
25
|
+
context: EthereumStepExecutorContext
|
|
26
|
+
): boolean {
|
|
27
|
+
return (
|
|
28
|
+
hasPermit2AllowanceInFlight(context) &&
|
|
29
|
+
!hasRelayerMessage(context.step, context.fromChain)
|
|
30
|
+
)
|
|
31
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { SignedTypedData, TypedData } from '@lifi/sdk'
|
|
2
|
+
import { isValidSignature } from '../../../utils/isValidSignature.js'
|
|
3
|
+
|
|
4
|
+
/** Whether `signedTypedData` already holds a signature for this exact entry. */
|
|
5
|
+
export function isTypedDataAlreadySigned(
|
|
6
|
+
signedTypedData: SignedTypedData[],
|
|
7
|
+
typedData: TypedData
|
|
8
|
+
): boolean {
|
|
9
|
+
// `Permit` stays with `isNativePermitValid`, which also checks the deadline,
|
|
10
|
+
// the amount and the salt. Equality alone would drop those checks.
|
|
11
|
+
if (typedData.primaryType === 'Permit') {
|
|
12
|
+
return false
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return signedTypedData.some(
|
|
16
|
+
(signed) =>
|
|
17
|
+
signed.primaryType === typedData.primaryType &&
|
|
18
|
+
isValidSignature(signed.signature) &&
|
|
19
|
+
isSameValue(signed.domain, typedData.domain) &&
|
|
20
|
+
isSameValue(signed.message, typedData.message)
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* `domain` and `message` are decoded JSON, so compare them structurally: a
|
|
26
|
+
* round trip through the API rebuilds the objects, and `JSON.stringify` both
|
|
27
|
+
* depends on key order and throws on a `bigint`. Scalars compare by string
|
|
28
|
+
* form, because `1`, `1n` and `'1'` are one EIP-712 value.
|
|
29
|
+
*/
|
|
30
|
+
function isSameValue(a: unknown, b: unknown): boolean {
|
|
31
|
+
if (a === b) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
35
|
+
return (
|
|
36
|
+
Array.isArray(a) &&
|
|
37
|
+
Array.isArray(b) &&
|
|
38
|
+
a.length === b.length &&
|
|
39
|
+
a.every((item, index) => isSameValue(item, b[index]))
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
if (isRecord(a) && isRecord(b)) {
|
|
43
|
+
const keys = Object.keys(a)
|
|
44
|
+
return (
|
|
45
|
+
keys.length === Object.keys(b).length &&
|
|
46
|
+
keys.every((key) => key in b && isSameValue(a[key], b[key]))
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
if (a == null || b == null) {
|
|
50
|
+
return false
|
|
51
|
+
}
|
|
52
|
+
return String(a) === String(b)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const isRecord = (value: unknown): value is Record<string, unknown> =>
|
|
56
|
+
typeof value === 'object' && value !== null
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ExtendedChain,
|
|
3
|
+
LiFiStep,
|
|
4
|
+
LiFiStepExtended,
|
|
5
|
+
TypedData,
|
|
6
|
+
} from '@lifi/sdk'
|
|
7
|
+
import {
|
|
8
|
+
getTypedDataInLane,
|
|
9
|
+
getTypedDataLane,
|
|
10
|
+
isPermit2AllowanceLane,
|
|
11
|
+
} from '../../../utils/getTypedDataLane.js'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* `??` keeps the Permit2 allowance only when the answer omits `typedData`. An
|
|
15
|
+
* answer that carries entries of its own — native permits, or `[]` from a
|
|
16
|
+
* third-party backend — would drop it, and `signedTypedData` resets per
|
|
17
|
+
* `executeStep`, so a retry would let the Permit2 proxy hijack the calldata.
|
|
18
|
+
*/
|
|
19
|
+
export function preservePermit2Allowances(
|
|
20
|
+
step: LiFiStepExtended | LiFiStep,
|
|
21
|
+
updatedTypedData: TypedData[] | undefined,
|
|
22
|
+
chain: ExtendedChain
|
|
23
|
+
): TypedData[] | undefined {
|
|
24
|
+
if (!updatedTypedData) {
|
|
25
|
+
return step.typedData
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!isPermit2AllowanceLane(step, chain)) {
|
|
29
|
+
return updatedTypedData
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const answerDeclaresLane = updatedTypedData.some((typedData) => {
|
|
33
|
+
const lane = getTypedDataLane(typedData, chain)
|
|
34
|
+
return lane === 'permit2-allowance' || lane === 'relayer-message'
|
|
35
|
+
})
|
|
36
|
+
if (answerDeclaresLane) {
|
|
37
|
+
return updatedTypedData
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return [
|
|
41
|
+
...updatedTypedData,
|
|
42
|
+
...getTypedDataInLane(step, 'permit2-allowance', chain),
|
|
43
|
+
]
|
|
44
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { TransactionMethodType } from '@lifi/sdk'
|
|
|
2
2
|
import type { Address } from 'viem'
|
|
3
3
|
import { canAccountUsePermit2 } from '../../../permits/canAccountUsePermit2.js'
|
|
4
4
|
import type { EthereumStepExecutorContext } from '../../../types.js'
|
|
5
|
+
import { isPermit2AllowanceLaneInFlight } from './hasPermit2AllowanceInFlight.js'
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Cheap, synchronous part of the gate: does the step/chain combination allow
|
|
@@ -22,7 +23,8 @@ const isPermit2SupportedForStep = (
|
|
|
22
23
|
// Approval address is not required for Permit2 per se, but we use it to skip allowance checks for direct transfers
|
|
23
24
|
!!step.estimate.approvalAddress &&
|
|
24
25
|
!step.estimate.skipApproval &&
|
|
25
|
-
!step.estimate.skipPermit
|
|
26
|
+
!step.estimate.skipPermit &&
|
|
27
|
+
!isPermit2AllowanceLaneInFlight(context)
|
|
26
28
|
)
|
|
27
29
|
}
|
|
28
30
|
|
|
@@ -13,7 +13,7 @@ import { assertValidSignature } from '../../../utils/isValidSignature.js'
|
|
|
13
13
|
|
|
14
14
|
export const signHyperliquidTypedData = async (
|
|
15
15
|
context: EthereumStepExecutorContext,
|
|
16
|
-
|
|
16
|
+
allowanceTypedData: TypedData[]
|
|
17
17
|
): Promise<SignedTypedData[] | undefined> => {
|
|
18
18
|
const {
|
|
19
19
|
step,
|
|
@@ -33,7 +33,7 @@ export const signHyperliquidTypedData = async (
|
|
|
33
33
|
const ownerAddress = ethereumClient.account!.address
|
|
34
34
|
const storage = getStorage(client)
|
|
35
35
|
|
|
36
|
-
const approveMessage =
|
|
36
|
+
const approveMessage = allowanceTypedData.find(isApproveAgentMessage)
|
|
37
37
|
const existingAgentAddress = approveMessage?.message.agentAddress as
|
|
38
38
|
| string
|
|
39
39
|
| undefined
|
|
@@ -44,7 +44,7 @@ export const signHyperliquidTypedData = async (
|
|
|
44
44
|
expiresAt,
|
|
45
45
|
} = await getOrCreateAgentWallet(storage, ownerAddress, existingAgentAddress)
|
|
46
46
|
|
|
47
|
-
for (const typedData of
|
|
47
|
+
for (const typedData of allowanceTypedData) {
|
|
48
48
|
if (isApproveAgentMessage(typedData)) {
|
|
49
49
|
if (!needsApproval) {
|
|
50
50
|
continue
|