Skip to content

The porto sdk requires any custom relay provider to return non required data as per the EIP-5792 spec #1006

@r0ohafza

Description

@r0ohafza

Check existing issues

Describe the bug

I am building my own relay server that can replace rpc.porto.sh. As part of that process I was trying to setup the server to respond to wallet_getCapabilities request but the RelayActions require the getCapabilities to return porto specific data which is not part of the EIP-5792 spec.

const capabilities = await RelayActions.getCapabilities(client, {
          chainIds: chainIds ? chainIds.map((id) => Hex.toNumber(id)) : 'all',
          raw: true,
        })

        return Object.entries(capabilities).reduce(
          (acc, [chainId, capabilities]) => ({
            // biome-ignore lint/performance/noAccumulatingSpread: _
            ...acc,
            [chainId]: {
              ...base,
              ...capabilities,
              feeToken: {
                supported: true,
                tokens: capabilities.fees.tokens,
              },
              requiredFunds: {
                supported: Boolean(multichain),
                tokens: multichain
                  ? capabilities.fees.tokens.filter((token) => token.interop)
                  : [],
              },
            },
          }),
          {} as Record<Hex.Hex, typeof base>,
        ) as Record<Hex.Hex, typeof base>
z.object({
      contracts: z.object({
        /** Account implementation address. */
        accountImplementation: VersionedContract,
        /** Account proxy address. */
        accountProxy: VersionedContract,
        /** Legacy account implementation address. */
        legacyAccountImplementations: z.readonly(z.array(VersionedContract)),
        /** Legacy orchestrator address. */
        legacyOrchestrators: z.readonly(
          z.array(
            z.union([
              z.object({
                orchestrator: VersionedContract,
                simulator: VersionedContract,
              }),
              VersionedContract,
            ]),
          ),
        ),
        /** Orchestrator address. */
        orchestrator: VersionedContract,
        /** Simulator address. */
        simulator: VersionedContract,
      }),
      fees: z.object({
        /** Fee recipient address. */
        quoteConfig: z.object({
          /** Sets a constant rate for the price oracle. Used for testing. */
          constantRate: z.optional(z.union([z.number(), z.null()])),
          /** Gas estimate configuration. */
          gas: z.optional(
            z.object({
              /** Extra buffer added to Intent gas estimates. */
              intentBuffer: z.optional(z.number()),
              /** Extra buffer added to transaction gas estimates. */
              txBuffer: z.optional(z.number()),
            }),
          ),
          /** The lifetime of a price rate. */
          rateTtl: z.number(),
          /** The lifetime of a fee quote. */
          ttl: z.number(),
        }),
        /** Quote configuration. */
        recipient: u.address(),
        /** Tokens the fees can be paid in. */
        tokens: z.readonly(z.array(Token.Token)),
      }),
    }),

I would expect my relay server to not require this data to be returned and only require EIP-5792 specific data to be returned.

Link to Minimal Reproducible Example

No response

Steps To Reproduce

No response

Porto Version

0.2.30

Viem Version

2.29.4

Wagmi Version

2.17.5

TypeScript Version

5.9.2

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions