Skip to content

@my-swu/simulator-client


@my-swu/simulator-client / MatchAccessResponse

Interface: MatchAccessResponse ​

Defined in: packages/ts-sdk/src/generated/types/common.ts:3907

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

console.log(matchAccessResponse)

Properties ​

matchId ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

const { matchId } = matchAccessResponse

console.log(matchId)

matchId: string

Defined in: packages/ts-sdk/src/generated/types/common.ts:3908


replaySeed? ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

const { replaySeed } = matchAccessResponse

console.log(replaySeed)

optional replaySeed?: string

Defined in: packages/ts-sdk/src/generated/types/common.ts:3912

Resolved seed for a private solo-vs-AI match. Never projected in live state.


seat ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

const { seat: matchSeat } = matchAccessResponse

console.log(matchSeat)

seat: Seat

Defined in: packages/ts-sdk/src/generated/types/common.ts:3913


seatToken ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

const { seatToken } = matchAccessResponse

console.log(seatToken)

seatToken: string

Defined in: packages/ts-sdk/src/generated/types/common.ts:3914


snapshot ​

Example:

ts
import { createSimulatorClient } from '@my-swu/simulator-client'

// Point this at the simulator HTTP origin for /health and /api routes.
const simulatorClient = createSimulatorClient({
  baseUrl: 'http://127.0.0.1:4000',
})

// Use card ids; the server validates deck legality.
const premierHostDeck = {
  leader: 46102, // Leia Organa - Someone Who Loves You
  leaders: [], // Twin Suns only; Premier uses the single `leader` above.
  base: 308, // Echo Base
  cards: Array.from({ length: 50 }, () => 45), // Alliance X-Wing
  sideboard: [],
}

const matchAccessResponse = await simulatorClient.matches.create({
  format: 'premier',
  // Twin Suns supports 2-4 players; every other format is exactly 2.
  playerCount: 2,
  hostName: 'Host',
  hostAuthenticated: false,
  historyIdentities: [],
  // One entry per AI-controlled seat; empty means a human opponent joins.
  aiOpponents: [],
  hostDeck: premierHostDeck,
})

const { snapshot: initialMatchSnapshot } = matchAccessResponse

console.log(initialMatchSnapshot)

snapshot: GameState

Defined in: packages/ts-sdk/src/generated/types/common.ts:3915

Released under the MIT License.