dataswap / dataswapjs

dataswap sdk
Other
0 stars 2 forks source link

change winner to ethaddress in matchingmetadata #323

Closed siriusyim closed 6 months ago

siriusyim commented 7 months ago

Describe the Bug

change winner to ethaddress in matchingmetadata

Repro Steps

  1. Run '...'
  2. Do '...'
  3. See error '...' ...

Logging Information

No response

Additional context

No response

siriusyim commented 7 months ago
    async updateMatchingWinner(options: {
        matchingBids: MatchingBidsEvm
        matchingId: number
    }): Promise<Result<any>> {
        try {
            const winner = await options.matchingBids.getMatchingWinner(
                options.matchingId
            )
            if (winner.ok) {
                return await this.update(
                    { conditions: [{ matchingId: options.matchingId }] },
                    {
                        winner: delegatedFromEthAddress(
                            winner.data!,
                            CoinType.MAIN
                        ),
                    }
                )
            }
            return { ok: true }
        } catch (error) {
            throw error
        }
    }