Skip to content

Commit

Permalink
fix: Send target correctly to server (#601)
Browse files Browse the repository at this point in the history
  • Loading branch information
fzavalia authored Mar 26, 2024
1 parent 64985a9 commit 08aa78a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/marketplaceApi.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { AuthIdentity } from 'decentraland-crypto-fetch'
import { WertMessage } from '../modules/gateway/types'
import { WertMessageWithTarget } from '../modules/gateway/types'
import { BaseClient } from './BaseClient'

export class MarketplaceAPI extends BaseClient {
async signWertMessage(
message: WertMessage,
message: WertMessageWithTarget,
identity: AuthIdentity
): Promise<string> {
try {
Expand Down
7 changes: 4 additions & 3 deletions src/modules/gateway/sagas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export function createGatewaySaga(config: GatewaySagasConfig) {
function* handleOpenFiatGatewayWidget(
action: OpenFiatGatewayWidgetRequestAction
) {
const { data, gateway, listeners } = action.payload
const { gateway, listeners } = action.payload
const { target, ...data } = action.payload.data
try {
switch (gateway) {
case FiatGateway.WERT:
Expand Down Expand Up @@ -140,7 +141,7 @@ export function createGatewaySaga(config: GatewaySagasConfig) {
address: wallet.address,
commodity,
commodity_amount,
network: network ? network : isDev ? 'sepolia' : 'ethereum', // will be wallet.network
network: network ? network : isDev ? 'sepolia' : 'ethereum',
sc_address,
sc_input_data
}
Expand All @@ -149,7 +150,7 @@ export function createGatewaySaga(config: GatewaySagasConfig) {

const signature: string = yield call(
[marketplaceAPI, 'signWertMessage'],
dataToSign,
{ ...dataToSign, target },
identity
)

Expand Down
2 changes: 2 additions & 0 deletions src/modules/gateway/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export type WertMessage = {
sc_input_data: string
}

export type WertMessageWithTarget = WertMessage & { target?: WertTarget }

export type WertConfig = {
url: string
marketplaceServerURL: string
Expand Down

0 comments on commit 08aa78a

Please sign in to comment.