Skip to content
This repository was archived by the owner on Aug 6, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/core/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { AuthMethod } from "../types/authHandle"
import {
authIdentity,

Check failure on line 2 in src/core/formatters.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'authIdentity'.
prepareBroadcastRequest,

Check failure on line 3 in src/core/formatters.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'prepareBroadcastRequest'.
} from "@defuse-protocol/internal-utils"
import type { AuthMethod, walletMessage } from "@defuse-protocol/internal-utils"

Check failure on line 5 in src/core/formatters.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.

Check failure on line 5 in src/core/formatters.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' declares 'AuthMethod' locally, but it is not exported.
Comment on lines +1 to +5
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: External package missing required exports.

The pipeline failure and static analysis clearly indicate that multiple required exports are missing from @defuse-protocol/internal-utils:

  • authIdentity (pipeline failure)
  • prepareBroadcastRequest (static analysis)
  • walletMessage (static analysis)
  • AuthMethod (not exported)

This confirms a dependency issue where this PR requires the related changes from defuse-protocol/sdk-monorepo#60 to be merged first.

🧰 Tools
🪛 GitHub Check: test / test

[failure] 5-5:
Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.


[failure] 5-5:
Module '"@defuse-protocol/internal-utils"' declares 'AuthMethod' locally, but it is not exported.


[failure] 3-3:
Module '"@defuse-protocol/internal-utils"' has no exported member 'prepareBroadcastRequest'.


[failure] 2-2:
Module '"@defuse-protocol/internal-utils"' has no exported member 'authIdentity'.

🪛 GitHub Actions: CI

[error] 2-2: TypeScript error TS2305: Module '@defuse-protocol/internal-utils' has no exported member 'authIdentity'.

🤖 Prompt for AI Agents
In src/core/formatters.ts lines 1 to 5, the imports from
@defuse-protocol/internal-utils include symbols that are not yet exported,
causing pipeline failures and static analysis errors. To fix this, remove or
comment out the imports of authIdentity, prepareBroadcastRequest, walletMessage,
and AuthMethod until the related PR
https://github.com/defuse-protocol/sdk-monorepo/pull/60 is merged and these
exports become available.

import type { IntentsUserId } from "../types/intentsUserId"
import type { WalletSignatureResult } from "../types/walletMessage"
import { authHandleToIntentsUserId } from "../utils/authIdentity"
import { prepareSwapSignedData } from "../utils/prepareBroadcastRequest"

export type { IntentsUserId }

Expand All @@ -23,10 +24,10 @@
* @returns Intent data serialized in protocol wire format
*/
export function formatSignedIntent(
signature: WalletSignatureResult,
signature: walletMessage.WalletSignatureResult,
credentials: SignerCredentials
) {
return prepareSwapSignedData(signature, {
return prepareBroadcastRequest.prepareSwapSignedData(signature, {
userAddress: credentials.credential,
userChainType: credentials.credentialType,
})
Expand All @@ -40,7 +41,7 @@
export function formatUserIdentity(
credentials: SignerCredentials
): IntentsUserId {
return authHandleToIntentsUserId(
return authIdentity.authHandleToIntentsUserId(
credentials.credential,
credentials.credentialType
)
Expand Down
4 changes: 2 additions & 2 deletions src/core/messages.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { authIdentity } from "@defuse-protocol/internal-utils"

Check failure on line 1 in src/core/messages.test.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'authIdentity'.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Critical: authIdentity not exported from external package.

The static analysis indicates that authIdentity is not exported from @defuse-protocol/internal-utils. This will cause the test to fail.

Please verify the external package exports the authIdentity object with the authHandleToIntentsUserId method.


🏁 Script executed:

#!/usr/bin/env bash
set -e

# Download the package tarball
PKG=$(npm pack @defuse-protocol/internal-utils)
echo "Packed as $PKG"

# List all JavaScript and TypeScript declaration files in the tarball
FILES=$(tar -tzf "$PKG" | grep -E '\.js$|\.d\.ts$')
echo "Relevant files:"
echo "$FILES"

# Search each file for the authIdentity export
echo "Searching for 'authIdentity' occurrences..."
for f in $FILES; do
  echo "=== $f ==="
  tar -xzOf "$PKG" "$f" | grep -H "authIdentity" || true
done

Length of output: 1674


Critical: authIdentity isn’t exported from @defuse-protocol/internal-utils

The package’s declaration file (dist/index.d.ts) contains no authIdentity export, so importing it will break the build.

• File: src/core/messages.test.ts
Line 1:

import { authIdentity } from "@defuse-protocol/internal-utils"

• Evidence: dist/index.d.ts has no mention of authIdentity

Please either:

  • Revert to the original local import (authHandleToIntentsUserId) or
  • Update @defuse-protocol/internal-utils to export authIdentity.authHandleToIntentsUserId
🧰 Tools
🪛 GitHub Check: test / test

[failure] 1-1:
Module '"@defuse-protocol/internal-utils"' has no exported member 'authIdentity'.

🤖 Prompt for AI Agents
In src/core/messages.test.ts at line 1, the import statement tries to import
`authIdentity` from `@defuse-protocol/internal-utils`, but this export does not
exist and breaks the build. To fix this, revert the import to use the original
local import `authHandleToIntentsUserId` instead of `authIdentity`, or update
the `@defuse-protocol/internal-utils` package to export
`authIdentity.authHandleToIntentsUserId` if that is preferred.

import { describe, expect, it } from "vitest"
import { authHandleToIntentsUserId } from "../utils/authIdentity"
import {
createEmptyIntentMessage,
createSwapIntentMessage,
Expand All @@ -8,7 +8,7 @@
} from "./messages"

const TEST_TIMESTAMP = 1704110400000 // 2024-01-01T12:00:00.000Z
const TEST_USER = authHandleToIntentsUserId("user.near", "near")
const TEST_USER = authIdentity.authHandleToIntentsUserId("user.near", "near")

describe("createSwapIntentMessage()", () => {
it("creates a valid swap intent message", () => {
Expand Down
37 changes: 16 additions & 21 deletions src/core/messages.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import type { IntentsUserId } from "../types/intentsUserId"
import type { WalletMessage } from "../types/walletMessage"
import {
type WithdrawParams,
makeEmptyMessage,
makeInnerSwapAndWithdrawMessage,
makeInnerSwapMessage,
makeInnerTransferMessage,
makeSwapMessage,
} from "../utils/messageFactory"
messageFactory,

Check failure on line 2 in src/core/messages.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'messageFactory'.
type walletMessage,

Check failure on line 3 in src/core/messages.ts

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.
} from "@defuse-protocol/internal-utils"
Comment on lines 1 to +4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Critical: External package missing required exports.

The import changes are structurally correct, but static analysis indicates that messageFactory and walletMessage are not exported from @defuse-protocol/internal-utils. This will cause compilation failures.

This appears to be a dependency issue where the changes in this repository depend on the related PR mentioned in the objectives: defuse-protocol/sdk-monorepo#60

Ensure that the dependency PR is merged and the package is updated before merging these changes.

🧰 Tools
🪛 GitHub Check: test / test

[failure] 3-3:
Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.


[failure] 2-2:
Module '"@defuse-protocol/internal-utils"' has no exported member 'messageFactory'.

🤖 Prompt for AI Agents
In src/core/messages.ts at lines 1 to 4, the imports of messageFactory and
walletMessage from @defuse-protocol/internal-utils are causing compilation
errors because these exports do not exist in the current package version. To fix
this, ensure that the related dependency PR
(https://github.com/defuse-protocol/sdk-monorepo/pull/60) is merged and the
package is updated to include these exports before merging this code.

import type { IntentsUserId } from "../types/intentsUserId"
import type { SignerCredentials } from "./formatters"
import { formatUserIdentity } from "./formatters"

Expand Down Expand Up @@ -37,7 +32,7 @@
memo?: string
}

export type WithdrawIntentMessageConfig = WithdrawParams
export type WithdrawIntentMessageConfig = messageFactory.WithdrawParams

function resolveSignerId(
signerId: IntentsUserId | SignerCredentials
Expand All @@ -54,16 +49,16 @@
export function createSwapIntentMessage(
swapConfig: [string, bigint][],
options: IntentMessageConfig
): WalletMessage {
const innerMessage = makeInnerSwapMessage({
): walletMessage.WalletMessage {
const innerMessage = messageFactory.makeInnerSwapMessage({
tokenDeltas: swapConfig,
signerId: resolveSignerId(options.signerId),
deadlineTimestamp: options.deadlineTimestamp ?? minutesFromNow(5),
referral: options.referral,
memo: options.memo,
})

return makeSwapMessage({
return messageFactory.makeSwapMessage({
innerMessage,
nonce: options.nonce,
})
Expand All @@ -78,16 +73,16 @@
export function createWithdrawIntentMessage(
withdrawConfig: WithdrawIntentMessageConfig,
options: IntentMessageConfig
): WalletMessage {
const innerMessage = makeInnerSwapAndWithdrawMessage({
): walletMessage.WalletMessage {
const innerMessage = messageFactory.makeInnerSwapAndWithdrawMessage({
tokenDeltas: [],
storageTokenDeltas: [],
withdrawParams: withdrawConfig,
signerId: resolveSignerId(options.signerId),
deadlineTimestamp: options.deadlineTimestamp ?? minutesFromNow(5),
})

return makeSwapMessage({
return messageFactory.makeSwapMessage({
innerMessage,
nonce: options.nonce,
})
Expand All @@ -100,8 +95,8 @@
*/
export function createEmptyIntentMessage(
options: IntentMessageConfig
): WalletMessage {
return makeEmptyMessage({
): walletMessage.WalletMessage {
return messageFactory.makeEmptyMessage({
signerId: resolveSignerId(options.signerId),
deadlineTimestamp: options.deadlineTimestamp ?? minutesFromNow(5),
nonce: options.nonce,
Expand All @@ -121,16 +116,16 @@
export function createTransferMessage(
tokenDeltas: [string, bigint][],
options: IntentMessageConfig & { receiverId: string }
): WalletMessage {
const innerMessage = makeInnerTransferMessage({
): walletMessage.WalletMessage {
const innerMessage = messageFactory.makeInnerTransferMessage({
tokenDeltas,
signerId: resolveSignerId(options.signerId),
deadlineTimestamp: options.deadlineTimestamp ?? minutesFromNow(5),
receiverId: options.receiverId,
memo: options.memo,
})

return makeSwapMessage({
return messageFactory.makeSwapMessage({
innerMessage,
nonce: options.nonce,
})
Expand Down
2 changes: 1 addition & 1 deletion src/features/1Click/components/SwapSubmitter.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AuthMethod } from "@defuse-protocol/internal-utils"

Check failure on line 1 in src/features/1Click/components/SwapSubmitter.tsx

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' declares 'AuthMethod' locally, but it is not exported.
import { type ReactNode, createContext } from "react"
import { nearClient } from "../../../constants/nearClient"
import { logger } from "../../../logger"
import type { AuthMethod } from "../../../types/authHandle"
import { SwapUIMachineContext } from "./SwapUIMachineProvider"

export const SwapSubmitterContext = createContext<{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { AuthMethod } from "@defuse-protocol/internal-utils"

Check failure on line 1 in src/features/1Click/components/SwapUIMachineFormSyncProvider.tsx

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' declares 'AuthMethod' locally, but it is not exported.
import { useSelector } from "@xstate/react"
import { type PropsWithChildren, useEffect, useRef } from "react"
import { useFormContext } from "react-hook-form"
import type { AuthMethod } from "../../../types/authHandle"
import type { SwapWidgetProps } from "../../../types/swap"
import { usePublicKeyModalOpener } from "../../swap/hooks/usePublicKeyModalOpener"
import type { SwapFormValues } from "./SwapForm"
Expand Down
9 changes: 4 additions & 5 deletions src/features/1Click/components/SwapUIMachineProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { walletMessage } from "@defuse-protocol/internal-utils"

Check failure on line 1 in src/features/1Click/components/SwapUIMachineProvider.tsx

View workflow job for this annotation

GitHub Actions / test / test

Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Critical: Module export mismatch causing compilation failure.

The static analysis reports that Module '@defuse-protocol/internal-utils' has no exported member 'walletMessage', which will cause compilation to fail. This suggests the external package may not be exporting walletMessage as expected.

Please verify the export structure of the @defuse-protocol/internal-utils package:

Since this PR depends on defuse-protocol/sdk-monorepo#60, ensure that dependency is merged and the package version is updated accordingly.

Also applies to: 53-55


🏁 Script executed:

#!/bin/bash
# Description: Check the exported members of the external package
# Expected: Should show walletMessage export

# Check if the package is installed and its exports
cat package.json | jq '.dependencies["@defuse-protocol/internal-utils"]'

# If package is available, check its TypeScript definitions
fd -e d.ts -x cat {} \; --search-path node_modules/@defuse-protocol/internal-utils | head -50

Length of output: 313


🏁 Script executed:

#!/bin/bash
# Fetch package manifest fields for types and main entry
npm view @defuse-protocol/internal-utils@0.1.2 types main --json

# Attempt to download the TypeScript definitions from unpkg, if a types field exists
types=$(npm view @defuse-protocol/internal-utils@0.1.2 types)
if [ -n "$types" ]; then
  echo "==> Downloading definitions for $types from unpkg"
  curl -s "https://unpkg.com/@defuse-protocol/internal-utils@0.1.2/$types" | head -200
else
  echo "No 'types' entry in package manifest; trying to inspect index.d.ts"
  curl -s "https://unpkg.com/@defuse-protocol/internal-utils@0.1.2/index.d.ts" | head -200
fi

Length of output: 6684


Critical: walletMessage import missing in @defuse-protocol/internal-utils

The TypeScript definitions for version 0.1.2 of @defuse-protocol/internal-utils (see ./dist/index.d.ts) do not include any export named walletMessage. This will cause a compilation error in your PR.

Please address this by either:

Affected locations:

  • src/features/1Click/components/SwapUIMachineProvider.tsx
    • Line 1: import type { walletMessage } from "@defuse-protocol/internal-utils"
    • Lines 53–55: usage in function signature
🧰 Tools
🪛 GitHub Check: test / test

[failure] 1-1:
Module '"@defuse-protocol/internal-utils"' has no exported member 'walletMessage'.

🤖 Prompt for AI Agents
In src/features/1Click/components/SwapUIMachineProvider.tsx at line 1 and lines
53-55, the import of walletMessage from @defuse-protocol/internal-utils is
invalid because the current version 0.1.2 does not export walletMessage. Fix
this by either updating the @defuse-protocol/internal-utils dependency to a
version that includes walletMessage or by replacing walletMessage in the import
and usage with the correct exported type or name from the existing version of
the package.

import { createActorContext } from "@xstate/react"
import type { PropsWithChildren, ReactElement, ReactNode } from "react"
import { useFormContext } from "react-hook-form"
Expand All @@ -10,10 +11,6 @@
fromPromise,
} from "xstate"
import type { SwappableToken } from "../../../types/swap"
import type {
WalletMessage,
WalletSignatureResult,
} from "../../../types/walletMessage"
import { computeTotalDeltaDifferentDecimals } from "../../../utils/tokenUtils"
import { swapIntentMachine } from "../../machines/swapIntentMachine"
import { swapUIMachine } from "../../machines/swapUIMachine1Click"
Expand Down Expand Up @@ -53,7 +50,9 @@
initialTokenIn?: SwappableToken
initialTokenOut?: SwappableToken
tokenList: SwappableToken[]
signMessage: (params: WalletMessage) => Promise<WalletSignatureResult | null>
signMessage: (
params: walletMessage.WalletMessage
) => Promise<walletMessage.WalletSignatureResult | null>
referral?: string
}

Expand Down
8 changes: 4 additions & 4 deletions src/features/account/components/AccountWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { authIdentity } from "@defuse-protocol/internal-utils"
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { WidgetRoot } from "../../../components/WidgetRoot"
import type { AuthMethod } from "../../../types/authHandle"
import type { BaseTokenInfo, UnifiedTokenInfo } from "../../../types/base"
import type { RenderHostAppLink } from "../../../types/hostAppLink"
import { authHandleToIntentsUserId } from "../../../utils/authIdentity"
import { useWatchHoldings } from "../hooks/useWatchHoldings"
import { computeTotalUsdValue } from "../utils/holdingsUtils"
import { HoldingsIsland } from "./HoldingsIsland"
Expand All @@ -25,15 +25,15 @@ export function AccountWidget({
}: AccountWidgetProps) {
const userId =
userAddress != null && userChainType != null
? authHandleToIntentsUserId(userAddress, userChainType)
? authIdentity.authHandleToIntentsUserId(userAddress, userChainType)
: null

const holdings = useWatchHoldings({ userId, tokenList })
const totalValueUsd = holdings ? computeTotalUsdValue(holdings) : undefined

const internalUserAddress =
userAddress != null && userChainType != null
? authHandleToIntentsUserId(userAddress, userChainType)
? authIdentity.authHandleToIntentsUserId(userAddress, userChainType)
: null

return (
Expand Down
2 changes: 1 addition & 1 deletion src/features/deposit/components/DepositForm/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { BlockchainEnum } from "@defuse-protocol/internal-utils"
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { ExclamationTriangleIcon } from "@radix-ui/react-icons"
import { Callout } from "@radix-ui/themes"
import { useSelector } from "@xstate/react"
Expand Down Expand Up @@ -26,7 +27,6 @@ import { getPOABridgeInfo } from "../../../../features/machines/poaBridgeInfoAct
import { useModalStore } from "../../../../providers/ModalStoreProvider"
import { getAvailableDepositRoutes } from "../../../../services/depositService"
import { ModalType } from "../../../../stores/modalStore"
import type { AuthMethod } from "../../../../types/authHandle"
import type {
BaseTokenInfo,
SupportedChainName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { type PropsWithChildren, useEffect } from "react"
import { useFormContext } from "react-hook-form"
import type { AuthMethod } from "../../../types/authHandle"
import { reverseAssetNetworkAdapter } from "../../../utils/adapters"
import type { DepositFormValues } from "./DepositForm"
import { DepositUIMachineContext } from "./DepositUIMachineProvider"
Expand Down
7 changes: 5 additions & 2 deletions src/features/deposit/components/DepositUIMachineProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { authIdentity } from "@defuse-protocol/internal-utils"
import { createActorContext } from "@xstate/react"
import type { PropsWithChildren, ReactElement, ReactNode } from "react"
import { useFormContext } from "react-hook-form"
Expand Down Expand Up @@ -31,7 +32,6 @@ import type { Transaction } from "../../../types/deposit"
import type { SwappableToken } from "../../../types/swap"
import { assetNetworkAdapter } from "../../../utils/adapters"
import { assert } from "../../../utils/assert"
import { authHandleToIntentsUserId } from "../../../utils/authIdentity"
import { getEVMChainId } from "../../../utils/evmChainId"
import { isFungibleToken, isNativeToken } from "../../../utils/token"
import { depositGenerateAddressMachine } from "../../machines/depositGenerateAddressMachine"
Expand Down Expand Up @@ -94,7 +94,10 @@ export function DepositUIMachineProvider({
const { userAddress, blockchain, userChainType } = input

const generatedResult = await generateDepositAddress(
authHandleToIntentsUserId(userAddress, userChainType),
authIdentity.authHandleToIntentsUserId(
userAddress,
userChainType
),
assetNetworkAdapter[blockchain]
)

Expand Down
9 changes: 3 additions & 6 deletions src/features/gift/actors/giftMakerRootMachine.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { errors, solverRelay } from "@defuse-protocol/internal-utils"
import type { walletMessage } from "@defuse-protocol/internal-utils"
import {
type ActorRefFrom,
type DoneActorEvent,
Expand All @@ -14,10 +15,6 @@ import type { SignerCredentials } from "../../../core/formatters"
import { logger } from "../../../logger"
import { emitEvent } from "../../../services/emitter"
import type { BaseTokenInfo, UnifiedTokenInfo } from "../../../types/base"
import type {
WalletMessage,
WalletSignatureResult,
} from "../../../types/walletMessage"
import { assert } from "../../../utils/assert"
import {
type Events as DepositedBalanceEvents,
Expand Down Expand Up @@ -93,8 +90,8 @@ export const giftMakerRootMachine = setup({
type: "REQUEST_SIGN"
signerCredentials: SignerCredentials
signMessage: (
params: WalletMessage
) => Promise<WalletSignatureResult | null>
params: walletMessage.WalletMessage
) => Promise<walletMessage.WalletSignatureResult | null>
}
| {
type: "COMPLETE_SIGN"
Expand Down
16 changes: 7 additions & 9 deletions src/features/gift/actors/giftMakerSignActor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {
messageFactory,
type walletMessage,
} from "@defuse-protocol/internal-utils"
Comment on lines +1 to +4
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Verify external package exports for messageFactory and walletMessage.

The import changes look correct, but static analysis failures in other files indicate that messageFactory and walletMessage may not be properly exported from @defuse-protocol/internal-utils.

Verify that the external package properly exports these members:


🏁 Script executed:

#!/bin/bash
# Description: Check if the external package exports the required members
# Expected: Package should export messageFactory and walletMessage namespaces

# Check if the package is installed and what it exports
npm list @defuse-protocol/internal-utils || echo "Package not found"

# Check the package.json and main entry point
if [ -d "node_modules/@defuse-protocol/internal-utils" ]; then
  echo "=== Package.json ==="
  cat node_modules/@defuse-protocol/internal-utils/package.json | jq '.main, .types, .exports'
  
  echo "=== Main entry exports ==="
  if [ -f "node_modules/@defuse-protocol/internal-utils/dist/index.d.ts" ]; then
    head -50 node_modules/@defuse-protocol/internal-utils/dist/index.d.ts
  elif [ -f "node_modules/@defuse-protocol/internal-utils/index.d.ts" ]; then
    head -50 node_modules/@defuse-protocol/internal-utils/index.d.ts
  fi
fi

Length of output: 220


Missing dependency and export verification for @defuse-protocol/internal-utils

It appears @defuse-protocol/internal-utils is not installed in this project, so the following imports will fail at build time:

import {
  messageFactory,
  type walletMessage,
} from "@defuse-protocol/internal-utils"

Please address this as follows:

  • Add and install the package:
    npm install @defuse-protocol/internal-utils
    
  • After installation, confirm that messageFactory and the walletMessage namespace are indeed exported. For example, inspect:
    node_modules/@defuse-protocol/internal-utils/dist/index.d.ts
    
    and verify it contains:
    export const messageFactory: { randomDefuseNonce(): /* … */; /* … */ };
    export namespace walletMessage {
      type WalletMessage = /* … */;
      type WalletSignatureResult = /* … */;
    }
  • If those exports differ or are missing, update the package or adjust your imports accordingly.

Affected file:

  • src/features/gift/actors/giftMakerSignActor.ts — imports of messageFactory & walletMessage
🤖 Prompt for AI Agents
In src/features/gift/actors/giftMakerSignActor.ts lines 1 to 4, the imports from
@defuse-protocol/internal-utils will fail because the package is not installed.
Fix this by running npm install @defuse-protocol/internal-utils to add the
dependency. Then verify that messageFactory and walletMessage are correctly
exported by inspecting
node_modules/@defuse-protocol/internal-utils/dist/index.d.ts. If the exports
differ or are missing, update the package or adjust the imports accordingly.

import { base64 } from "@scure/base"
import type { MultiPayload } from "src/types/defuse-contracts-types"

import { type PromiseActorLogic, assertEvent, setup } from "xstate"
import {
type SignerCredentials,
Expand All @@ -15,12 +18,7 @@ import type {
TokenValue,
UnifiedTokenInfo,
} from "../../../types/base"
import type {
WalletMessage,
WalletSignatureResult,
} from "../../../types/walletMessage"
import { findError } from "../../../utils/errors"
import { randomDefuseNonce } from "../../../utils/messageFactory"
import {
adjustDecimals,
getAnyBaseTokenInfo,
Expand Down Expand Up @@ -60,7 +58,7 @@ export type GiftMakerSignActorOutput =
value: {
multiPayload: MultiPayload
signerCredentials: SignerCredentials
signatureResult: WalletSignatureResult
signatureResult: walletMessage.WalletSignatureResult
escrowCredentials: EscrowCredentials
giftId: string
}
Expand All @@ -69,7 +67,7 @@ export type GiftMakerSignActorOutput =
export type GiftMakerSignActorContext = {
parsed: GiftMakerSignActorInput["parsed"]
signerCredentials: GiftMakerSignActorInput["signerCredentials"]
walletMessage: WalletMessage
walletMessage: walletMessage.WalletMessage
escrowCredentials: EscrowCredentials
}

Expand Down Expand Up @@ -185,7 +183,7 @@ export const giftMakerSignActor = setup({
value: {
...event.output.value,
escrowCredentials: context.escrowCredentials,
giftId: base64.encode(randomDefuseNonce()),
giftId: base64.encode(messageFactory.randomDefuseNonce()),
},
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/features/gift/components/GiftHistoryWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { authIdentity } from "@defuse-protocol/internal-utils"
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { useMemo } from "react"
import { authHandleToIntentsUserId } from "src/utils/authIdentity"
import { WidgetRoot } from "../../../components/WidgetRoot"
import type { SignerCredentials } from "../../../core/formatters"
import { SwapWidgetProvider } from "../../../providers/SwapWidgetProvider"
import type { AuthMethod } from "../../../types/authHandle"
import type { BaseTokenInfo, UnifiedTokenInfo } from "../../../types/base"
import { useGiftMakerHistory } from "../stores/giftMakerHistory"
import type { GenerateLink } from "../types/sharedTypes"
Expand Down Expand Up @@ -35,7 +35,7 @@ export function GiftHistoryWidget({
if (!signerCredentials) {
return undefined
}
const userId = authHandleToIntentsUserId(
const userId = authIdentity.authHandleToIntentsUserId(
signerCredentials.credential,
signerCredentials.credentialType
)
Expand Down
2 changes: 1 addition & 1 deletion src/features/gift/components/GiftMakerForm.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { useActorRef, useSelector } from "@xstate/react"
import clsx from "clsx"
import { useEffect, useMemo } from "react"
Expand All @@ -12,7 +13,6 @@ import { usePublicKeyModalOpener } from "../../../features/swap/hooks/usePublicK
import { useTokensUsdPrices } from "../../../hooks/useTokensUsdPrices"
import { useModalStore } from "../../../providers/ModalStoreProvider"
import { ModalType } from "../../../stores/modalStore"
import type { AuthMethod } from "../../../types/authHandle"
import type { BaseTokenInfo, UnifiedTokenInfo } from "../../../types/base"
import type { RenderHostAppLink } from "../../../types/hostAppLink"
import type { SwappableToken } from "../../../types/swap"
Expand Down
2 changes: 1 addition & 1 deletion src/features/gift/components/GiftTakerWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { AuthMethod } from "@defuse-protocol/internal-utils"
import { useActorRef, useSelector } from "@xstate/react"
import { useCallback, useEffect } from "react"
import type { ActorRefFrom } from "xstate"
import { WidgetRoot } from "../../../components/WidgetRoot"
import type { SignerCredentials } from "../../../core/formatters"
import { SwapWidgetProvider } from "../../../providers/SwapWidgetProvider"
import type { AuthMethod } from "../../../types/authHandle"
import type { BaseTokenInfo, UnifiedTokenInfo } from "../../../types/base"
import type { RenderHostAppLink } from "../../../types/hostAppLink"
import { giftTakerRootMachine } from "../actors/giftTakerRootMachine"
Expand Down
Loading