@dopamint-fun/open-sdk 0.2.0-dev.0 → 0.2.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,12 @@
1
1
  import { ByteWriter } from "./bytes.js";
2
2
  /** The participant session version this build speaks.
3
3
  *
4
- * It is the contract that carries the named `PredictionGateReleased` overlay
5
- * event, so an authority that cannot name it in its join advertisement is
6
- * refused at discovery and a selected context from any other version is
7
- * refused rather than re-encoded. */
8
- export declare const SESSION_VERSION = 2;
4
+ * It is the contract that carries the named prediction-gate lifecycle - the
5
+ * prepared and open notices, the terminal release overlay, and the optional
6
+ * handshake view a held seat joins or resumes with - so an authority that
7
+ * cannot name it in its join advertisement is refused at discovery and a
8
+ * selected context from any other version is refused rather than re-encoded. */
9
+ export declare const SESSION_VERSION = 3;
9
10
  /** A selected participant session version this build cannot speak.
10
11
  *
11
12
  * Thrown where a *selected* version enters or leaves the process -- a
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Join, action, and resume signing bodies live here; acknowledgements are
5
5
  * unsigned and encoded next to the authority decoder. The layouts are pinned
6
- * by `libs/dopa-open-client-rs/vectors/ts-signer-parity.json`.
6
+ * by `libs/dopa-open/client-rs/vectors/ts-signer-parity.json`.
7
7
  */
8
8
  import { ByteWriter, frameSigningBytes, textBytes } from "./bytes.js";
9
9
  const JOIN_DOMAIN = textBytes("arena_session::join");
@@ -14,11 +14,12 @@ const ACTION_PROPOSAL_TAG = 0x04;
14
14
  const SESSION_RESUME_REQUEST_TAG = 0x0a;
15
15
  /** The participant session version this build speaks.
16
16
  *
17
- * It is the contract that carries the named `PredictionGateReleased` overlay
18
- * event, so an authority that cannot name it in its join advertisement is
19
- * refused at discovery and a selected context from any other version is
20
- * refused rather than re-encoded. */
21
- export const SESSION_VERSION = 2;
17
+ * It is the contract that carries the named prediction-gate lifecycle - the
18
+ * prepared and open notices, the terminal release overlay, and the optional
19
+ * handshake view a held seat joins or resumes with - so an authority that
20
+ * cannot name it in its join advertisement is refused at discovery and a
21
+ * selected context from any other version is refused rather than re-encoded. */
22
+ export const SESSION_VERSION = 3;
22
23
  /** A selected participant session version this build cannot speak.
23
24
  *
24
25
  * Thrown where a *selected* version enters or leaves the process -- a
@@ -28,7 +29,7 @@ export const SESSION_VERSION = 2;
28
29
  export class UnsupportedSessionVersionError extends Error {
29
30
  version;
30
31
  constructor(version) {
31
- super(`unsupported participant session version ${version}; expected 2`);
32
+ super(`unsupported participant session version ${version}; expected 3`);
32
33
  this.version = version;
33
34
  this.name = "UnsupportedSessionVersionError";
34
35
  }
@@ -1,3 +1,8 @@
1
+ /** The Product API's deployed default origin. `dopa-open`'s `--product-url`
2
+ * (and `DOPA_OPEN_PRODUCT_URL`) default here, matching the Rust client and
3
+ * CLI's `DEFAULT_OPEN_API_BASE_URL`, so a caller only has to override it for
4
+ * a local stack or a non-default plane. */
5
+ export declare const DEFAULT_OPEN_API_BASE_URL = "https://open.dopamint.fun";
1
6
  export interface SeatEntitlement {
2
7
  seat: number;
3
8
  amount: bigint;
@@ -52,5 +57,4 @@ export declare function buildConsentRequest(args: ConsentDisclosure & {
52
57
  signature: Uint8Array;
53
58
  }): ConsentRequest;
54
59
  export declare function settlementConsentPath(executionIdHex: string): string;
55
- export declare function authorityOriginFromSessionBase(sessionBaseUrl: string): string;
56
60
  export declare function digestForPrompt(prompt: ConsentPrompt): Uint8Array;
@@ -2,6 +2,11 @@ import { ByteReader, ByteWriter, equalBytes, fromHex, textBytes, toHex0x, } from
2
2
  import { digestFramed } from "./crypto.js";
3
3
  const ANCHOR_DOMAIN_ID_V1 = textBytes("arena_tunnel::anchor_domain_id_v1");
4
4
  const SETTLEMENT_PURPOSE = textBytes("arena_tunnel::settlement");
5
+ /** The Product API's deployed default origin. `dopa-open`'s `--product-url`
6
+ * (and `DOPA_OPEN_PRODUCT_URL`) default here, matching the Rust client and
7
+ * CLI's `DEFAULT_OPEN_API_BASE_URL`, so a caller only has to override it for
8
+ * a local stack or a non-default plane. */
9
+ export const DEFAULT_OPEN_API_BASE_URL = "https://open.dopamint.fun";
5
10
  export function encodeTerminalState(state) {
6
11
  const writer = new ByteWriter()
7
12
  .pushU16(1)
@@ -103,13 +108,7 @@ export function buildConsentRequest(args) {
103
108
  }
104
109
  export function settlementConsentPath(executionIdHex) {
105
110
  const hex = executionIdHex.replace(/^0x/, "");
106
- return `/open/v1/authority/executions/${hex}/settlements`;
107
- }
108
- export function authorityOriginFromSessionBase(sessionBaseUrl) {
109
- const idx = sessionBaseUrl.indexOf("/v1/exec/");
110
- if (idx <= 0)
111
- throw new Error(`admission session_base_url is not an execution session URL: ${sessionBaseUrl}`);
112
- return sessionBaseUrl.slice(0, idx);
111
+ return `/v1/authority/executions/${hex}/settlements`;
113
112
  }
114
113
  export function digestForPrompt(prompt) {
115
114
  const terminal = decodeTerminalState(fromHex(prompt.encoded_terminal_state));
package/dist/tour.js CHANGED
@@ -63,8 +63,8 @@ function unavailable(error) {
63
63
  }
64
64
  export async function enterTour(client, tour, floor = {}) {
65
65
  const target = tour === "playground"
66
- ? "/open/v1/tours/playground/entries"
67
- : "/open/v1/tours/tournament/entries";
66
+ ? "/v1/tours/playground/entries"
67
+ : "/v1/tours/tournament/entries";
68
68
  if (floor.minAgents !== undefined && tour !== "playground")
69
69
  throw new Error("a floor of real agents only applies to the playground");
70
70
  /* No body at all when nothing is stated: the join every client sent before
@@ -124,13 +124,13 @@ export async function queueUntilSeated(client, tour, options = {}) {
124
124
  }
125
125
  }
126
126
  export async function readPosition(client, tableId) {
127
- const { status, json } = await signedFetch(client, "GET", `/open/v1/tables/${tableId}/decision`);
127
+ const { status, json } = await signedFetch(client, "GET", `/v1/tables/${tableId}/decision`);
128
128
  if (status !== 200)
129
129
  throw new Error(refusalMessage("decision read", status, json));
130
130
  return json;
131
131
  }
132
132
  export async function act(client, tableId, move) {
133
- const { status, json } = await signedFetch(client, "POST", `/open/v1/tables/${tableId}/actions`, move);
133
+ const { status, json } = await signedFetch(client, "POST", `/v1/tables/${tableId}/actions`, move);
134
134
  if (status !== 200)
135
135
  throw new Error(refusalMessage("action", status, json));
136
136
  return json;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@dopamint-fun/open-sdk",
3
- "version": "0.2.0-dev.0",
3
+ "version": "0.2.0-dev.10",
4
4
  "description": "DOPA-OPEN client SDK: generate and hold your own agent key, sign registrations, and play a Participant Session",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/CommandOSSLabs/dopamint-arena.git",
9
- "directory": "libs/dopa-open-client-ts"
9
+ "directory": "libs/dopa-open/client-ts"
10
10
  },
11
11
  "type": "module",
12
12
  "main": "dist/index.js",