Skip to content

No way to provide "referrer" field in 'tradeParameters' for 'tradeCoin' function #531

@cryptomarabout

Description

@cryptomarabout

The Zora SDK documentation mentions that developers can provide their referral address.
The createCoin function has a platformReferrer parameter, but the tradeCoin function doesn’t expose any referrer field.

By looking into the Zora SDK code, it seems that the referrer parameter can be provided to the postQuote call in the type PostQuoteData , but there is currently no way to pass it in via tradeParameters.

I've tried to modify the SDK locally, but the Zora API doesn't seem to use the provided referrer field (the field hookData is empty in the call data returned by the API).

More details:

We can see below that the body object used for postQuote can contain a field referrer , but it’s not currently mapped from tradeParameters .

PostQuoteData type

export type PostQuoteData = {
  body?: {
    referrer?: string;
    signatures?: Array<{
      // ...
    }>;
  };
};

PostQuote call

const quote = await postQuote({
  body: {
    tokenIn: tradeParameters.sell,
    tokenOut: tradeParameters.buy,
    amountIn: tradeParameters.amountIn.toString(),
    slippage: tradeParameters.slippage,
    chainId: base.id,
    sender: tradeParameters.sender,
    recipient: tradeParameters.recipient || tradeParameters.sender,
    // referrer should be added here ( referrer: tradeParameters.referrer, )
    signatures: tradeParameters.signatures,
  },
});

TradeParameters type

export type TradeParameters = {
  sell: TradeCurrency;
  buy: TradeCurrency;
  amountIn: bigint;
  slippage?: number;
  // can be smart wallet or EOA here.
  sender: Address;
  // needs to be EOA, if signer is blank assumes EOA in sender.
  signer?: Address;
  recipient?: Address;
  // referrer should be added here ( referrer?: string; )
  signatures?: SignatureWithPermit<PermitStringAmounts>[];
  permitActiveSeconds?: number;
};

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